* Transaction timeout issue with Temperature sensor driver on 2.6.32 kernel.
@ 2012-07-17 8:50 bhanuprakash bodireddy
[not found] ` <CALPjBuW+B2=Y3g9n_Sqe2QOT18XHyJc4t77WGjvsm-0ik+NmAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: bhanuprakash bodireddy @ 2012-07-17 8:50 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Hello,
I am porting an old INTEL temperature sensor module (written for
2.6.21) to kernel version (2.6.32).
The sensor is probed and accessed via I2C. Changed the code in-line
with the latest I2C framework
which uses new device driver binding model to make it work with new kernel.
But I see Transaction timeout errors on inserting the module. My module invokes
'i2c_smbus_write_block_data/i2c_smbus_read_block_data' to clear/set
temperature format and
that's when i see the below errors get triggered.
> insmod temp_sensor.ko
[ 211.804338] XXXX(temperature sensor) driver init start..
[ 211.815119] devfn: fb, vendor: 8086, device: 269b
[ 211.854127] temp_probe[bus details]: name: SMBus I801 adapter at
3000, id:0x0, algo: 0xffffffff81469fe0)
[ 211.884109] i801_smbus 0000:00:1f.3: start call for
ffff88015b155400 ffff88015f94a580 at 4294879180
[ 211.895031] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294879191
[ 211.905023] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294879200
[ 211.915024] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294879211
[ 211.924016] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294879220
[ 211.933021] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294879229
[ 211.942018] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294879238
.
.
[ 211.951019] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294879247
[ 211.960018] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294879256
[ 211.969020] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294879265
[ 212.787881] i801_smbus 0000:00:1f.3: Transaction timeout
[ 212.793163] i801_smbus 0000:00:1f.3: Terminating the current operation
[ 212.800016] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294880096
[ 212.808880] i801_smbus 0000:00:1f.3: Failed terminating the transaction
[ 212.816016] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400
ffff88015f94a580 at 4294880112
[ 212.824872] XXXX_CMD_STOP_POLLING smbus read fail(-110)!!
(enabled the debug messages in i2c-i801.c)
Is this driver issue or the bus problem on my Target board?
Thanks,
Bhanu Prakash.
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <CALPjBuW+B2=Y3g9n_Sqe2QOT18XHyJc4t77WGjvsm-0ik+NmAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Transaction timeout issue with Temperature sensor driver on 2.6.32 kernel. [not found] ` <CALPjBuW+B2=Y3g9n_Sqe2QOT18XHyJc4t77WGjvsm-0ik+NmAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2012-07-17 11:17 ` Jean Delvare [not found] ` <20120717131738.7f7aaf80-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Jean Delvare @ 2012-07-17 11:17 UTC (permalink / raw) To: bhanuprakash bodireddy; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA On Tue, 17 Jul 2012 14:20:49 +0530, bhanuprakash bodireddy wrote: > I am porting an old INTEL temperature sensor module (written for > 2.6.21) to kernel version (2.6.32). > The sensor is probed and accessed via I2C. Changed the code in-line > with the latest I2C framework > which uses new device driver binding model to make it work with new kernel. > > But I see Transaction timeout errors on inserting the module. My module invokes > 'i2c_smbus_write_block_data/i2c_smbus_read_block_data' to clear/set > temperature format and > that's when i see the below errors get triggered. > > > insmod temp_sensor.ko Why was this driver not submitted for inclusion into the kernel tree? Or was it? Are you sure there is no compatible driver already in the tree? > [ 211.804338] XXXX(temperature sensor) driver init start.. > [ 211.815119] devfn: fb, vendor: 8086, device: 269b > [ 211.854127] temp_probe[bus details]: name: SMBus I801 adapter at > 3000, id:0x0, algo: 0xffffffff81469fe0) > [ 211.884109] i801_smbus 0000:00:1f.3: start call for > ffff88015b155400 ffff88015f94a580 at 4294879180 > [ 211.895031] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294879191 > [ 211.905023] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294879200 > [ 211.915024] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294879211 > [ 211.924016] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294879220 > [ 211.933021] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294879229 > [ 211.942018] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294879238 > . > . > [ 211.951019] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294879247 > [ 211.960018] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294879256 > [ 211.969020] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294879265 > [ 212.787881] i801_smbus 0000:00:1f.3: Transaction timeout > [ 212.793163] i801_smbus 0000:00:1f.3: Terminating the current operation > [ 212.800016] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294880096 > [ 212.808880] i801_smbus 0000:00:1f.3: Failed terminating the transaction > [ 212.816016] i801_smbus 0000:00:1f.3: Poll call for ffff88015b155400 > ffff88015f94a580 at 4294880112 > [ 212.824872] XXXX_CMD_STOP_POLLING smbus read fail(-110)!! > > (enabled the debug messages in i2c-i801.c) You did not just enable them, you added some of your own, or you aren't using the original i2c-i801 driver from your kernel version. > Is this driver issue or the bus problem on my Target board? It is impossible to tell without seeing the temperature sensor driver source code and the bus driver source code. It _looks_ like a bus driver issue, but if the same code worked in kernel 2.6.21 there's no reason why it would fail in kernel 2.6.32 (unless the hardware changed too.) You can try the standalone i2c-i801 driver from: http://khali.linux-fr.org/devel/misc/i2c-i801/ and see if it helps. -- Jean Delvare ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20120717131738.7f7aaf80-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>]
* Re: Transaction timeout issue with Temperature sensor driver on 2.6.32 kernel. [not found] ` <20120717131738.7f7aaf80-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> @ 2012-07-17 12:22 ` bhanuprakash bodireddy [not found] ` <CALPjBuUYJPOwTqZ+9gr2AVYigTD6N4B_2K6Erns+0vSX9biR+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: bhanuprakash bodireddy @ 2012-07-17 12:22 UTC (permalink / raw) To: Jean Delvare; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA > Why was this driver not submitted for inclusion into the kernel tree? > Or was it? Are you sure there is no compatible driver already in the > tree? This driver wasn't submitted to the kernel tree. This was written keeping in mind to service a user space program which uses ioctl calls. > You did not just enable them, you added some of your own, or you aren't > using the original i2c-i801 driver from your kernel version. True, I may not using the original i2c-i801 as the code is from MontaVista CGE6 and as i see the bus driver code is bit different to what i see on kernel tree for same version. That makes the debugging even more difficult for me :( >> Is this driver issue or the bus problem on my Target board? > > It is impossible to tell without seeing the temperature sensor driver > source code and the bus driver source code. It _looks_ like a bus > driver issue, but if the same code worked in kernel 2.6.21 there's no > reason why it would fail in kernel 2.6.32 (unless the hardware changed > too.) Below is my driver code. PECI_ADDR = 0x29; #define BYTE_CNT_1 0x01 #define PECI_STOP_POLLING 0x00 static struct i2c_device_id peci_idtable[] = { { "PECI", 0 }, { } }; MODULE_DEVICE_TABLE(i2c, peci_idtable); struct i2c_driver peci_driver = { .driver = { .owner = THIS_MODULE, .name = "PECI", }, .probe = peci_probe, .remove = peci_remove, .id_table = peci_idtable, }; xxx_probe() { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) struct i2c_client *pNewClient; #else struct device *dev = &pAdapter->dev; struct i2c_adapter *adapter = pAdapter->adapter; #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) if (!i2c_check_functionality(pAdapter, I2C_FUNC_SMBUS_BYTE|I2C_FUNC_SMBUS_BYTE_DATA)) #else if (!i2c_check_functionality(pAdapter->adapter, I2C_FUNC_SMBUS_BYTE|I2C_FUNC_SMBUS_BYTE_DATA|I2C_FUNC_SMBUS_BLOCK_DATA)) #endif { printk(KERN_ERR "i2c_check_functionality() fail!\n"); return -1; } } xxx_init_conf() { u8 aVal[I2C_SMBUS_BLOCK_MAX]={0,}; memset(aVal, 0, I2C_SMBUS_BLOCK_MAX); bCnt = BYTE_CNT_1; aVal[0] = bCnt; aVal[1] = PECI_STOP_POLLING; rslt = i2c_smbus_write_block_data(pClient, PECI_CMD_STOP_POLLING , bCnt+1, aVal); if(rslt) return -EFAULT; rslt = i2c_smbus_read_block_data(pClient, PECI_CMD_STOP_POLLING, NULL); if(rslt < 0) return -EFAULT; } xxx_init() { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) static int bus_id = 0; struct i2c_adapter *adapter; struct i2c_board_info peci_device; memset(&peci_device, 0, sizeof(struct i2c_board_info)); peci_device.addr = PECI_ADDR; strlcpy(peci_device.type, "PECI", I2C_NAME_SIZE); adapter = i2c_get_adapter(bus_id); if (!adapter) { return -ENODEV; } pClient = i2c_new_device(adapter, &peci_device); i2c_put_adapter(adapter); if (!pClient) { peci_exit(); } #endif xxx_init_conf(); } tree /sys/bus/i2c /sys/bus/i2c |-- devices | |-- 0-0029 -> ../../../devices/pci0000:00/0000:00:1f.3/i2c-0/0-0029 | `-- i2c-0 -> ../../../devices/pci0000:00/0000:00:1f.3/i2c-0 |-- drivers | |-- PECI | | |-- 0-0029 -> ../../../../devices/pci0000:00/0000:00:1f.3/i2c-0/0-0029 | | |-- bind | | |-- module -> ../../../../module/peci_ctrl | | |-- uevent | | `-- unbind | |-- dev_driver | | |-- bind | | |-- uevent | | `-- unbind | `-- dummy | |-- bind | |-- uevent | `-- unbind |-- drivers_autoprobe |-- drivers_probe `-- uevent > You can try the standalone i2c-i801 driver from: > http://khali.linux-fr.org/devel/misc/i2c-i801/ > and see if it helps. Sure Jean, will try this out and see if it helps me. --- Bhanu Prakash ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CALPjBuUYJPOwTqZ+9gr2AVYigTD6N4B_2K6Erns+0vSX9biR+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Transaction timeout issue with Temperature sensor driver on 2.6.32 kernel. [not found] ` <CALPjBuUYJPOwTqZ+9gr2AVYigTD6N4B_2K6Erns+0vSX9biR+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2012-07-18 7:24 ` Jean Delvare [not found] ` <20120718092449.305baddb-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Jean Delvare @ 2012-07-18 7:24 UTC (permalink / raw) To: bhanuprakash bodireddy; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA On Tue, 17 Jul 2012 17:52:57 +0530, bhanuprakash bodireddy wrote: > > Why was this driver not submitted for inclusion into the kernel tree? > > Or was it? Are you sure there is no compatible driver already in the > > tree? > > This driver wasn't submitted to the kernel tree. This was written > keeping in mind > to service a user space program which uses ioctl calls. Oh well, if the driver doesn't implement the standard hwmon interface then indeed there's no point in submitting it, it won't be accepted. OTOH I am curious why the driver doesn't stick to a well established, widely supported interface. > > You did not just enable them, you added some of your own, or you aren't > > using the original i2c-i801 driver from your kernel version. > > True, I may not using the original i2c-i801 as the code is from MontaVista CGE6 > and as i see the bus driver code is bit different to what i see on > kernel tree for > same version. That makes the debugging even more difficult for me :( If the code is from MontaVista, ask them for help, not us. Maybe they know of the issue and/or have an updated driver to offer. > > (...) > > It is impossible to tell without seeing the temperature sensor driver > > source code and the bus driver source code. It _looks_ like a bus > > driver issue, but if the same code worked in kernel 2.6.21 there's no > > reason why it would fail in kernel 2.6.32 (unless the hardware changed > > too.) > > Below is my driver code. > > PECI_ADDR = 0x29; > #define BYTE_CNT_1 0x01 > #define PECI_STOP_POLLING 0x00 > > static struct i2c_device_id peci_idtable[] = { > { "PECI", 0 }, > { } > }; > MODULE_DEVICE_TABLE(i2c, peci_idtable); > > struct i2c_driver peci_driver = { > .driver = > { > .owner = THIS_MODULE, > .name = "PECI", > }, > .probe = peci_probe, > .remove = peci_remove, > .id_table = peci_idtable, > }; > > xxx_probe() > { > #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) > struct i2c_client *pNewClient; > #else > struct device *dev = &pAdapter->dev; > struct i2c_adapter *adapter = pAdapter->adapter; > #endif > > #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) > if (!i2c_check_functionality(pAdapter, > I2C_FUNC_SMBUS_BYTE|I2C_FUNC_SMBUS_BYTE_DATA)) > #else > if (!i2c_check_functionality(pAdapter->adapter, > I2C_FUNC_SMBUS_BYTE|I2C_FUNC_SMBUS_BYTE_DATA|I2C_FUNC_SMBUS_BLOCK_DATA)) > #endif > { > printk(KERN_ERR "i2c_check_functionality() fail!\n"); > return -1; > } > } > > xxx_init_conf() > { > u8 aVal[I2C_SMBUS_BLOCK_MAX]={0,}; > > memset(aVal, 0, I2C_SMBUS_BLOCK_MAX); > bCnt = BYTE_CNT_1; > > aVal[0] = bCnt; > aVal[1] = PECI_STOP_POLLING; > rslt = i2c_smbus_write_block_data(pClient, > PECI_CMD_STOP_POLLING , bCnt+1, aVal); > if(rslt) > return -EFAULT; > > rslt = i2c_smbus_read_block_data(pClient, PECI_CMD_STOP_POLLING, NULL); > if(rslt < 0) > return -EFAULT; > } > > xxx_init() > { > #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,30) > static int bus_id = 0; > struct i2c_adapter *adapter; > struct i2c_board_info peci_device; > > memset(&peci_device, 0, sizeof(struct i2c_board_info)); > peci_device.addr = PECI_ADDR; > strlcpy(peci_device.type, "PECI", I2C_NAME_SIZE); > > adapter = i2c_get_adapter(bus_id); > if (!adapter) { > return -ENODEV; > } > > pClient = i2c_new_device(adapter, &peci_device); > i2c_put_adapter(adapter); > if (!pClient) { > peci_exit(); > } > #endif > > xxx_init_conf(); > } The code is horrible and obfuscated, I can't help much without seeing the real thing, unmodified. One important point though is that a large part of the code appears to depend on the kernel version being < or >= to 2.6.30. As you switched from kernel version 2.6.21 to kernel version 2.6.32, you are actually no longer using the same code as before. Maybe there's a bug in the part of the code which runs on kernels >= 2.6.30. -- Jean Delvare ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20120718092449.305baddb-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>]
* Re: Transaction timeout issue with Temperature sensor driver on 2.6.32 kernel. [not found] ` <20120718092449.305baddb-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org> @ 2012-07-18 13:16 ` bhanuprakash bodireddy 0 siblings, 0 replies; 5+ messages in thread From: bhanuprakash bodireddy @ 2012-07-18 13:16 UTC (permalink / raw) To: Jean Delvare; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA > If the code is from MontaVista, ask them for help, not us. Maybe they > know of the issue and/or have an updated driver to offer. Extremely sorry jean, I believed that the bug could be in bus driver and hence posted here thinking it could be an known issue and may be a patch is available for 2.6.32. > the real thing, unmodified. One important point though is that a large > part of the code appears to depend on the kernel version being < or >= > to 2.6.30. As you switched from kernel version 2.6.21 to kernel version > 2.6.32, you are actually no longer using the same code as before. Maybe > there's a bug in the part of the code which runs on kernels >= 2.6.30. Finally my driver is working and user space program could read the temperature correctly. The i2c-i801.c file you gave me yesterday worked like a charm. The issue is with the bus driver in MVL code. Below is the result from my user space program. > peci_test CPU_0 CORE_0(0x18) => Temp : 48 CPU_0 CORE_1(0x1A) => Temp : 48 CPU_1 CORE_0(0x1B) => Temp : 45 CPU_1 CORE_1(0x1C) => Temp : 45 Regards, Bhanu Prakash. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-18 13:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17 8:50 Transaction timeout issue with Temperature sensor driver on 2.6.32 kernel bhanuprakash bodireddy
[not found] ` <CALPjBuW+B2=Y3g9n_Sqe2QOT18XHyJc4t77WGjvsm-0ik+NmAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-17 11:17 ` Jean Delvare
[not found] ` <20120717131738.7f7aaf80-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-17 12:22 ` bhanuprakash bodireddy
[not found] ` <CALPjBuUYJPOwTqZ+9gr2AVYigTD6N4B_2K6Erns+0vSX9biR+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-07-18 7:24 ` Jean Delvare
[not found] ` <20120718092449.305baddb-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2012-07-18 13:16 ` bhanuprakash bodireddy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox