Re: I2c driver crash
I think the client-adapter pointer is NULL. Make sure the ds75_attach_adapte() is called before you invoke ioctl(). -Mohan On Fri, Sep 23, 2011 at 6:58 AM, Benjamin Herrenschmidt b...@kernel.crashing.org wrote: On Thu, 2011-09-22 at 15:25 +, smitha.va...@wipro.com wrote: Hi Scott, When I call if i2c_master_send(ds75-i2c_client,buffer,2) it crashes. In module initialization I don't see any errors. Below are kernel messages. Could you please let me know what may be the reason for this crash. Why the heck are you trying to write a new driver for ds75 ? There's already one in there (lm75, same thing). Cheers, Ben. ---Logs- Loading Temperature Sensor Interface module (temp_if.ko) ds75_init DS75_DRIVER : Open DS75_DRIVER : Device Open Successful! DS75_DRIVER : ioctl TEMP_READ cmd 1 ds75_temp_read calling i2c_master_send In i2c_master_send enter--- Unable to handle kernel paging request for data at address 0x0010 Faulting instruction address: 0xc01b06a4 Oops: Kernel access of bad area, sig: 11 [#1] Modules linked in: temp_if gpio_if NIP: C01B06A4 LR: C01B06A0 CTR: C019BC90 REGS: c309bdc0 TRAP: 0300 Not tainted (2.6.21.7-hrt1-cfs-v22-grsec-WR2.0bl_cgl) MSR: 9032 EE,ME,IR,DR CR: 44004822 XER: DAR: 0010, DSISR: 2000 TASK = c306f810[145] 'epn412' THREAD: c309a000 GPR00: 7D00 C309BE70 C306F810 C02A 0001 0001 FDFBD0A0 GPR08: 003DE8A0 A827A936 3F78 C02EAE88 0001 1011C7C0 03EFD000 GPR16: 0001 007FFC00 37942FA8 1012EAC0 1001E530 37942FB4 0003 GPR24: 37942FB4 003D0F00 C309BEA8 FFF7 0008 C309BEA8 0002 Call Trace: [C309BE70] [C01B0698] (unreliable) [C309BEA0] [C50B71DC] [C309BED0] [C007A0D0] [C309BEE0] [C007A158] [C309BF10] [C007A4EC] [C309BF40] [C000E780] --- Exception: c01Instruction dump: 7c0802a6 bf61001c 7c7d1b78 3c60c02a 386313b4 7cbf2b78 90010034 7c9b2378 4be6bc79 386007d0 4be5ac6d 3c60c02a 839d0008 386313d8 4be6bc61 a01d0004 Below is the driver code. - #include temp_if.h #include asm-powerpc/uaccess.h #include linux/i2c.h //#include asm/arch/platform.h #define I2C_DEBUG #ifdef I2C_DEBUG #define I2C_DBG1(x) printk(KERN_WARNING x) #define I2C_DBG2(x,y) printk(KERN_WARNING x,y) #define I2C_DBG3(x,y,z) printk(KERN_WARNING x,y,z) #define I2C_DBG4(w,x,y,z) printk(KERN_WARNING w,x,y,z) #else #define I2C_DBG1(x) #define I2C_DBG2(x,y) #define I2C_DBG3(x,y,z) #define I2C_DBG4(w,x,y,z) #endif /* Function Prototype */ static int ds75_open(struct inode *inode, struct file *filp); static int ds75_iotcl(struct inode *inode, struct file *flip, unsigned int cmd, unsigned long arg); static int ds75_release(struct inode *inode, struct file *flip); int ds75_attach_client(struct ds75_data * ds75, struct i2c_adapter *adapter); int ds75_attach_adapter(struct i2c_adapter *adapter); int ds75_detach_client(struct i2c_client *client); /* Structure */ static struct file_operations tmpsensor_fops = { ioctl: ds75_iotcl, open: ds75_open, release: ds75_release, }; static struct i2c_driver ds75_driver = { .driver = { .name = DS75, }, .attach_adapter = ds75_attach_adapter, .detach_client = ds75_detach_client, }; /* Global Variable */ static int s_nI2CMajor = 0; static int s_bI2CDevOpen = 0; static int s_nUseCnt = 0; struct ds75_data *ds75; static int ds75_open(struct inode *inode, struct file *flip) { I2C_DBG1( DS75_DRIVER : Open\n); if(s_bI2CDevOpen == 0) { I2C_DBG1(DS75_DRIVER : Device Open Successful!\n); s_bI2CDevOpen = 1; s_nUseCnt++; } else { I2C_DBG1(DS75_DRIVER : Device Already Opened Successfully!\n); s_bI2CDevOpen = 1; s_nUseCnt++; } return 0; } static int ds75_release(struct inode *inode, struct file *flip) { I2C_DBG1 (KERN_INFO Entering ds75_release\n ); if(s_bI2CDevOpen) { if( s_nUseCnt = 0 ) { I2C_DBG1(DS75_DRIVER : i2c driver can't be released!\n); return -EIO; } else { I2C_DBG1(DS75_DRIVER : Release Successful!\n); s_nUseCnt--; if( s_nUseCnt == 0 ) { s_bI2CDevOpen = 0; I2C_DBG1(DS75_DRIVER : I2C Driver is Closed!\n); } } return 0; } else { I2C_DBG1(DS75_DRIVER : Release Fail! (Device is Not Open)\n); return -EIO; } } /* This function will read the Temperature from the device and copies to user space */ static int ds75_temp_read(struct ds75_msg_t *pData) { //unsigned char buffer[4]; signed char buffer[4]; int ret; buffer[0]=0; /* Writing 0 in to Pointer
Re: Timer interrupt on Linux 3.0.3
I had the same issue with an MPC885 board. My kernel was 2.6.33. On that board decrementer exception was not working. I replaced the board, took new board (MPC885 only, just another board) and the same kernel worked fine. I don't know how the problem was solved. -Mohan On 9/22/11, Scott Wood scottw...@freescale.com wrote: On 09/21/2011 01:56 AM, Vineeth wrote: What was the issue? You really should try to make this work rather than hack around it. what we found was the decrementer is not generating an exception when it becomes 0. and the timebase registers are not getting incremented too. Does the decrementer actually tick until it reaches zero, or do it and the timebase never tick? Is the TBEN input to the CPU asserted? -Scott ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Problem with a driver in Linux-2.6.33
Hi, I am writing a device driver for DSP Embedded Line and Port Interface Controller PEB 20570 (Delic) from infineon. I am using MPC885 custom board. First we wrote a driver without OS and tested transmission and reception, they are working fine. But when I port the same code to the Linux-2.6.33, the chip initialization is done properly but transmission and reception are not happening properly. Some times it receives and transmits the data but some times it doen't. Please let me know where could the problem be and how I should proceed. Is there any open source driver available for this chip?. Thanks, Venkat. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Problem with Busybox shell
I further debugged and found that flush_to_ldisc() function is not called which actually wakes up the readers. This is a worker function and is not being scheduled. I suspected whether timer interrupts are generated or not. powerpc uses decrementer exceptions as timer interrupts. I see that timer_interrupt() function in arch/powerpc/kernel/time.c is not called at all. I printed even jiffies values and it is not incremented. And I beleivethis makes scheduler is not scheduling this worker thread. I think if flush_to_ldisc is not called nothing can be read from the tty. Please let me know what could be the reason for timer interrupt being not called. Thanks, Mohan On Wed, Jan 19, 2011 at 12:37 AM, tiejun.chen tiejun.c...@windriver.com wrote: MohanReddy koppula wrote: But, if there is any problem with cable I could not have seen any character in the interrupt routine of the driver. I turned off both I suppose the bootloader, i.e u-boot, works well so looks this should not be issued by the cable at least. software and hardware flow control as by board doesn't have hardware flow control. tty_read is called and it hangs at ldisc-read. And I Any panic information? Or any dead lock? Which line in detail? see that data is put into the tty buffer by the driver. Will there be any problem with copy_to_user() if there is some problem in the memory? Can the serial driver support the poll mode? If so maybe you can take a try to exclude any interrupt reason. And even you can remove all codes to initialize the corresponding PIN CLK dedicated to the serial port, then try again since the bootloader already did this. Tiejun Thanks, Mohan On Tue, Jan 18, 2011 at 12:55 PM, Nicholas Mc Guire der.h...@hofr.at wrote: On Tue, 18 Jan 2011, MohanReddy koppula wrote: Hi All, I am working on an MPC885 based custom board. I am able to boot up the linux (linux-2.6.33.7). I could see busybox shell (ash) prompt. But it is not accepting any inputs, I am not able to enter any command, it just hangs there. I am using ttyCPM0 terminal. I suspected if there was any problem in CPM driver interrupts generation and put some printk's in the interrupt handler and could see interrupts are raised and data is read, but shell is not taking the input. I wrote an init.c and opened the ttyCPM0 and tried to read from it, but couldn't. I am able to write to ttyCPM0 and see it on the host minicom. if you are using minicom to connect check if you have hardware/software flow control turned on - it also could be a cabling problem - had this with the beagle board where the tx line was on the wrong pin - so I got output but could not get any response to input. hofrat ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Problem with Busybox shell
Hi All, I am working on an MPC885 based custom board. I am able to boot up the linux (linux-2.6.33.7). I could see busybox shell (ash) prompt. But it is not accepting any inputs, I am not able to enter any command, it just hangs there. I am using ttyCPM0 terminal. I suspected if there was any problem in CPM driver interrupts generation and put some printk's in the interrupt handler and could see interrupts are raised and data is read, but shell is not taking the input. I wrote an init.c and opened the ttyCPM0 and tried to read from it, but couldn't. I am able to write to ttyCPM0 and see it on the host minicom. Please some one help me. thanks in advance for your help. -Mohan ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: Problem with Busybox shell
But, if there is any problem with cable I could not have seen any character in the interrupt routine of the driver. I turned off both software and hardware flow control as by board doesn't have hardware flow control. tty_read is called and it hangs at ldisc-read. And I see that data is put into the tty buffer by the driver. Will there be any problem with copy_to_user() if there is some problem in the memory? Thanks, Mohan On Tue, Jan 18, 2011 at 12:55 PM, Nicholas Mc Guire der.h...@hofr.at wrote: On Tue, 18 Jan 2011, MohanReddy koppula wrote: Hi All, I am working on an MPC885 based custom board. I am able to boot up the linux (linux-2.6.33.7). I could see busybox shell (ash) prompt. But it is not accepting any inputs, I am not able to enter any command, it just hangs there. I am using ttyCPM0 terminal. I suspected if there was any problem in CPM driver interrupts generation and put some printk's in the interrupt handler and could see interrupts are raised and data is read, but shell is not taking the input. I wrote an init.c and opened the ttyCPM0 and tried to read from it, but couldn't. I am able to write to ttyCPM0 and see it on the host minicom. if you are using minicom to connect check if you have hardware/software flow control turned on - it also could be a cabling problem - had this with the beagle board where the tx line was on the wrong pin - so I got output but could not get any response to input. hofrat ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev