* status of i2c-cpm and ds2482
@ 2010-01-08 2:02 Baurzhan Ismagulov
[not found] ` <20100108020253.GJ3388-Y2X99Y6vBNTR7s880joybQ@public.gmane.org>
0 siblings, 1 reply; 12+ messages in thread
From: Baurzhan Ismagulov @ 2010-01-08 2:02 UTC (permalink / raw)
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA
Hello,
I have a 2.6.25.7 kernel working on my MPC885 board with i2c-cpm and
ds2482. I'm currently rebasing the board changes on a newer kernel. So
far I could get to 2.6.27.25 (with i2c-cpm and ds2482 from linux-2.6
git). Other parts of 2.6.27.25 work better with the board, so I'd like
to get the application (reportedly using the
/sys/devices/w1_bus_master1/* interface) working and have a couple of
questions.
What is the current state of i2c-cpm and ds2482 in 2.6 or 2.6.27 gits?
If I correctly understand the commit messages, those are maintained.
There are boot messages about both. Creating /dev/i2c-0 and reading from
it result in appropriate debug messages. However,
/sys/devices/w1_bus_master1 is not created; the path described in
http://marc.info/?l=linux-i2c&m=125365009130579&w=2 does not exist. What
is the fastest way to get the application running on 2.6.27.25?
Thanks in advance,
Baurzhan.
^ permalink raw reply [flat|nested] 12+ messages in thread[parent not found: <20100108020253.GJ3388-Y2X99Y6vBNTR7s880joybQ@public.gmane.org>]
* Re: status of i2c-cpm and ds2482 [not found] ` <20100108020253.GJ3388-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> @ 2010-01-08 11:25 ` Jochen Friedrich [not found] ` <4B471647.8050806-NIgtFMG+Po8@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Jochen Friedrich @ 2010-01-08 11:25 UTC (permalink / raw) To: Baurzhan Ismagulov; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA Hi Baurzhan, > There are boot messages about both. Creating /dev/i2c-0 and reading from > it result in appropriate debug messages. However, > /sys/devices/w1_bus_master1 is not created; the path described in > http://marc.info/?l=linux-i2c&m=125365009130579&w=2 does not exist. What > is the fastest way to get the application running on 2.6.27.25? What does your dts look like? Is the ds2482 present in the dts? Thanks, Jochen ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <4B471647.8050806-NIgtFMG+Po8@public.gmane.org>]
* Re: status of i2c-cpm and ds2482 [not found] ` <4B471647.8050806-NIgtFMG+Po8@public.gmane.org> @ 2010-01-08 12:17 ` Baurzhan Ismagulov [not found] ` <20100108121723.GD4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Baurzhan Ismagulov @ 2010-01-08 12:17 UTC (permalink / raw) To: Jochen Friedrich; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA Hello Jochen, On Fri, Jan 08, 2010 at 12:25:59PM +0100, Jochen Friedrich wrote: >> There are boot messages about both. Creating /dev/i2c-0 and reading from >> it result in appropriate debug messages. However, >> /sys/devices/w1_bus_master1 is not created; the path described in >> http://marc.info/?l=linux-i2c&m=125365009130579&w=2 does not exist. What >> is the fastest way to get the application running on 2.6.27.25? > > What does your dts look like? Is the ds2482 present in the dts? Oh, that's an interesting point. No, it isn't present, only i2c. How did it work in 2.6.25.7? I'd also appreciate pointers about that, if there are any. Currently I'm trying to understand why the new i2c infrastructure doesn't call ds2482_probe, which creates the w1_bus_master1 directory. Other ideas also welcome. Gruß, Baurzhan. ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20100108121723.GD4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org>]
* Re: status of i2c-cpm and ds2482 [not found] ` <20100108121723.GD4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> @ 2010-01-08 12:36 ` Jochen Friedrich [not found] ` <4B4726CF.9020605-NIgtFMG+Po8@public.gmane.org> 2010-01-08 12:52 ` Jean Delvare 1 sibling, 1 reply; 12+ messages in thread From: Jochen Friedrich @ 2010-01-08 12:36 UTC (permalink / raw) To: Baurzhan Ismagulov; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA Hi Baurzhan, > Oh, that's an interesting point. No, it isn't present, only i2c. How did > it work in 2.6.25.7? I'd also appreciate pointers about that, if there > are any. It was probably probed by some userspace tool. This has been turned off as probing i2c might be problematic on Soc boards. See: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0a346dacee18ff69f6162d9860d723a058f47321 You could try to add the property "linux,i2c-class=1" to the i2c controller in your dts to see if this commit is the cause of difference. > Currently I'm trying to understand why the new i2c infrastructure > doesn't call ds2482_probe, which creates the w1_bus_master1 directory. > Other ideas also welcome. You should definitely add your ds2482 to the device tree so it is auto loaded by the i2c subsystem. Thanks, Jochen ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <4B4726CF.9020605-NIgtFMG+Po8@public.gmane.org>]
* Re: status of i2c-cpm and ds2482 [not found] ` <4B4726CF.9020605-NIgtFMG+Po8@public.gmane.org> @ 2010-01-08 13:43 ` Baurzhan Ismagulov 0 siblings, 0 replies; 12+ messages in thread From: Baurzhan Ismagulov @ 2010-01-08 13:43 UTC (permalink / raw) To: Jochen Friedrich; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA On Fri, Jan 08, 2010 at 01:36:31PM +0100, Jochen Friedrich wrote: >> How did it work in 2.6.25.7? > > It was probably probed by some userspace tool. Nope, it worked directly after booting. The initialization sequence looked like this: w1_add_master_device ds2482_attach_adapter i2c_register_driver sensors_ds2482_init kernel_init kernel_thread > This has been turned off as probing i2c might be problematic on Soc > boards. See: > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0a346dacee18ff69f6162d9860d723a058f47321 > > You could try to add the property "linux,i2c-class=1" to the i2c > controller in your dts to see if this commit is the cause of difference. I've added "linux,i2c-class = <1>;" to i2c@860; this has set i2c-cpm's class to I2C_CLASS_HWMON. You are probably right in that the problem seems to be partly related to that. That said, the default class of i2c-cpm is I2C_CLASS_HWMON | I2C_CLASS_SPD, whereas the one of ds2482 is not set and thus zero (I'm using 2.6.27.25), so if (!(adapter->class & driver->class)) in i2c_detect goes to exit_free. So yesterday I had to set ds2482's class to I2C_CLASS_SPD since the classes have to match. However, it still goes to exit_free immediately after that since ds2482 doesn't provide I2C_FUNC_SMBUS_QUICK. IIUC, drivers are not required to provide that, so I'm still looking why cpm_i2c_probe and ds2482_probe don't get called. > You should definitely add your ds2482 to the device tree so it is auto > loaded by the i2c subsystem. You mean, in dts? Do you have a template for that? I could look up the necessary values in the working 2.6.25.7 kernel if I knew which ones I need. Which routine reads it and calls probe? Gruß, Baurzhan. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: status of i2c-cpm and ds2482 [not found] ` <20100108121723.GD4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> 2010-01-08 12:36 ` Jochen Friedrich @ 2010-01-08 12:52 ` Jean Delvare [not found] ` <20100108135222.49d7b834-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org> 1 sibling, 1 reply; 12+ messages in thread From: Jean Delvare @ 2010-01-08 12:52 UTC (permalink / raw) To: Baurzhan Ismagulov; +Cc: Jochen Friedrich, linux-i2c-u79uwXL29TY76Z2rM5mHXA On Fri, 8 Jan 2010 13:17:23 +0100, Baurzhan Ismagulov wrote: > Hello Jochen, > > On Fri, Jan 08, 2010 at 12:25:59PM +0100, Jochen Friedrich wrote: > >> There are boot messages about both. Creating /dev/i2c-0 and reading from > >> it result in appropriate debug messages. However, > >> /sys/devices/w1_bus_master1 is not created; the path described in > >> http://marc.info/?l=linux-i2c&m=125365009130579&w=2 does not exist. What > >> is the fastest way to get the application running on 2.6.27.25? > > > > What does your dts look like? Is the ds2482 present in the dts? > > Oh, that's an interesting point. No, it isn't present, only i2c. How did > it work in 2.6.25.7? I'd also appreciate pointers about that, if there > are any. You probably want to take a look at these 2 patches of mine which were applied to the ds2482 driver: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=61c91f7ded640bb2b340cc89d9ca3a3ca0229c74 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=0314b020c49c1d6cd182d2b89775bfa6686660db The first one went in 2.6.27, the second in 2.6.32. > Currently I'm trying to understand why the new i2c infrastructure > doesn't call ds2482_probe, which creates the w1_bus_master1 directory. > Other ideas also welcome. Before 2.6.27, the ds2482 driver was a so-called "legacy i2c driver" probing buses randomly in search of supported chips. Since 2.6.27 is is a so-called "new-style i2c driver" which only attaches to the devices when told to. So what you observe is the expected behavior. It is much safer that way. For an overview of how an I2C device can be declared, see: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/i2c/instantiating-devices One method not described in this document is listing the device in a dts. It should probably be added, unfortunately I don't know enough about this myself to do it. Any volunteer? -- Jean Delvare ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20100108135222.49d7b834-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>]
* Re: status of i2c-cpm and ds2482 [not found] ` <20100108135222.49d7b834-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org> @ 2010-01-08 14:01 ` Baurzhan Ismagulov [not found] ` <20100108140111.GF4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Baurzhan Ismagulov @ 2010-01-08 14:01 UTC (permalink / raw) To: Jean Delvare; +Cc: Jochen Friedrich, linux-i2c-u79uwXL29TY76Z2rM5mHXA Hello Jean, On Fri, Jan 08, 2010 at 01:52:22PM +0100, Jean Delvare wrote: > You probably want to take a look at these 2 patches of mine which were > applied to the ds2482 driver: > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=61c91f7ded640bb2b340cc89d9ca3a3ca0229c74 > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=0314b020c49c1d6cd182d2b89775bfa6686660db Yes, I studied them yesterday in detail :) . The docs in i2c are also useful to get the big picture, thank you. That said, I'm currently stuck how to make the infrastructure probe ds2482. > Before 2.6.27, the ds2482 driver was a so-called "legacy i2c driver" > probing buses randomly in search of supported chips. Since 2.6.27 is is > a so-called "new-style i2c driver" which only attaches to the devices > when told to. So what you observe is the expected behavior. It is much > safer that way. Yes, this is clear from your docs. > For an overview of how an I2C device can be declared, see: > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/i2c/instantiating-devices As I wrote yesterday, I did try Method 4. However, /sys/bus/i2c/devices/i2c-0 doesn't exist. There is also ds2482_detect in ds2482.c of 2.6.27.25 (Method 3); still cannot see /sys/devices/w1_bus_master1. What is the problem there? Should I update some infrastructure files from 2.6 git? For now, I can't use newer kernels since they either hang or run very slowly ("time id" taking real 32s) on my board. > One method not described in this document is listing the device in a > dts. It should probably be added, unfortunately I don't know enough > about this myself to do it. Any volunteer? I would gladly contribute that as soon as I learn how to do that :) . Thanks in advance, Baurzhan. ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20100108140111.GF4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org>]
* Re: status of i2c-cpm and ds2482 [not found] ` <20100108140111.GF4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> @ 2010-01-08 14:06 ` Jochen Friedrich [not found] ` <4B473BCE.8060803-NIgtFMG+Po8@public.gmane.org> 2010-01-08 14:11 ` Jochen Friedrich 2010-01-08 17:54 ` Jean Delvare 2 siblings, 1 reply; 12+ messages in thread From: Jochen Friedrich @ 2010-01-08 14:06 UTC (permalink / raw) To: Baurzhan Ismagulov; +Cc: Jean Delvare, linux-i2c-u79uwXL29TY76Z2rM5mHXA Hi Baurzhan, >> One method not described in this document is listing the device in a >> dts. It should probably be added, unfortunately I don't know enough >> about this myself to do it. Any volunteer? > > I would gladly contribute that as soon as I learn how to do that :) . just add your ds2482 as child node to the i2c controller like this: I2C0: i2c@860 { compatible = "fsl,mpc823-i2c", "fsl,cpm1-i2c"; reg = <0x860 0x20 0x3c80 0x30>; interrupts = <16>; interrupt-parent = <&CPM_PIC>; fsl,cpm-command = <0x10>; bus-frequency = <100000>; w1@aa { reg = <0xaa>; compatible = "dallas,ds2482"; }; }; Of course you'll have to replace "aa" with the real i2c address of the device. Thanks, Jochen ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <4B473BCE.8060803-NIgtFMG+Po8@public.gmane.org>]
* Re: status of i2c-cpm and ds2482 [not found] ` <4B473BCE.8060803-NIgtFMG+Po8@public.gmane.org> @ 2010-01-08 23:19 ` Baurzhan Ismagulov [not found] ` <20100108231942.GA3699-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> 0 siblings, 1 reply; 12+ messages in thread From: Baurzhan Ismagulov @ 2010-01-08 23:19 UTC (permalink / raw) To: Jochen Friedrich; +Cc: Jean Delvare, linux-i2c-u79uwXL29TY76Z2rM5mHXA On Fri, Jan 08, 2010 at 03:06:06PM +0100, Jochen Friedrich wrote: > I2C0: i2c@860 { ... > w1@aa { > reg = <0xaa>; > compatible = "dallas,ds2482"; > }; > }; This worked, thanks much Jochen and Jean! I had to use "reg = <18>;", it didn't build with "0x". FWIW, I've also tried restoring 0x18 in normal_i2c in ds2482.c, and i2c-core complained about quick not being supported. Where can I read about what it is? Why is it now required, whereas this worked in 2.6.25.7? With kind regards, Baurzhan. ^ permalink raw reply [flat|nested] 12+ messages in thread
[parent not found: <20100108231942.GA3699-Y2X99Y6vBNTR7s880joybQ@public.gmane.org>]
* Re: status of i2c-cpm and ds2482 [not found] ` <20100108231942.GA3699-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> @ 2010-01-09 8:12 ` Jean Delvare 0 siblings, 0 replies; 12+ messages in thread From: Jean Delvare @ 2010-01-09 8:12 UTC (permalink / raw) To: Baurzhan Ismagulov; +Cc: Jochen Friedrich, linux-i2c-u79uwXL29TY76Z2rM5mHXA Hi Baurzhan, On Sat, 9 Jan 2010 00:19:43 +0100, Baurzhan Ismagulov wrote: > On Fri, Jan 08, 2010 at 03:06:06PM +0100, Jochen Friedrich wrote: > > I2C0: i2c@860 { > ... > > w1@aa { > > reg = <0xaa>; > > compatible = "dallas,ds2482"; > > }; > > }; > > This worked, thanks much Jochen and Jean! > > I had to use "reg = <18>;", it didn't build with "0x". > > FWIW, I've also tried restoring 0x18 in normal_i2c in ds2482.c, and > i2c-core complained about quick not being supported. Restoring? 0x18 has never been in ds2482's normal_i2c list. > Where can I read about what it is? As I2C doesn't offer any standard way to detect device presence at a given address, we (ab)use the SMBus "Quick command" (0-byte message) for this purpose. Not all adapters support this type of transaction. > Why is it now required, whereas this worked in 2.6.25.7? The i2c-cpm driver was not present in kernel 2.6.25.7, so you must have been using an out-of-tree driver. Maybe that driver had (possibly fake) support for the SMBus quick command. -- Jean Delvare http://khali.linux-fr.org/wishlist.html ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: status of i2c-cpm and ds2482 [not found] ` <20100108140111.GF4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> 2010-01-08 14:06 ` Jochen Friedrich @ 2010-01-08 14:11 ` Jochen Friedrich 2010-01-08 17:54 ` Jean Delvare 2 siblings, 0 replies; 12+ messages in thread From: Jochen Friedrich @ 2010-01-08 14:11 UTC (permalink / raw) To: Baurzhan Ismagulov; +Cc: Jean Delvare, linux-i2c-u79uwXL29TY76Z2rM5mHXA Hi Baurzhan, >> One method not described in this document is listing the device in a >> dts. It should probably be added, unfortunately I don't know enough >> about this myself to do it. Any volunteer? > > I would gladly contribute that as soon as I learn how to do that :) . Some documentation about this can be found in the kernel source at Documentation/powerpc/dts-bindings/fsl/cpm_qe/cpm/i2c.txt Thanks, Jochen ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: status of i2c-cpm and ds2482 [not found] ` <20100108140111.GF4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org> 2010-01-08 14:06 ` Jochen Friedrich 2010-01-08 14:11 ` Jochen Friedrich @ 2010-01-08 17:54 ` Jean Delvare 2 siblings, 0 replies; 12+ messages in thread From: Jean Delvare @ 2010-01-08 17:54 UTC (permalink / raw) To: Baurzhan Ismagulov; +Cc: Jochen Friedrich, linux-i2c-u79uwXL29TY76Z2rM5mHXA On Fri, 8 Jan 2010 15:01:11 +0100, Baurzhan Ismagulov wrote: > On Fri, Jan 08, 2010 at 01:52:22PM +0100, Jean Delvare wrote: > > For an overview of how an I2C device can be declared, see: > > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/i2c/instantiating-devices > > As I wrote yesterday, I did try Method 4. However, > /sys/bus/i2c/devices/i2c-0 doesn't exist. /sys/bus/i2c/devices/i2c-* is new in kernel 2.6.32. For older kernels, look in /sys/class/i2c-adapter. That being said, method 4 is new in kernel 2.6.31 anyway, so it isn't what you want. > There is also ds2482_detect in ds2482.c of 2.6.27.25 (Method 3); still > cannot see /sys/devices/w1_bus_master1. As I recall, this isn't a real detect function, because the list of addresses to probe by default is empty. For the detect function to be called, you must provide extra module parameters (e.g. probe or force). > What is the problem there? Should I update some infrastructure files > from 2.6 git? For now, I can't use newer kernels since they either hang > or run very slowly ("time id" taking real 32s) on my board. You don't have to update anything, other than your dts file. Until your dts file lists the ds2482 device, you must load the ds2482 driver with the right parameter. -- Jean Delvare http://khali.linux-fr.org/wishlist.html ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-01-09 8:12 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-08 2:02 status of i2c-cpm and ds2482 Baurzhan Ismagulov
[not found] ` <20100108020253.GJ3388-Y2X99Y6vBNTR7s880joybQ@public.gmane.org>
2010-01-08 11:25 ` Jochen Friedrich
[not found] ` <4B471647.8050806-NIgtFMG+Po8@public.gmane.org>
2010-01-08 12:17 ` Baurzhan Ismagulov
[not found] ` <20100108121723.GD4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org>
2010-01-08 12:36 ` Jochen Friedrich
[not found] ` <4B4726CF.9020605-NIgtFMG+Po8@public.gmane.org>
2010-01-08 13:43 ` Baurzhan Ismagulov
2010-01-08 12:52 ` Jean Delvare
[not found] ` <20100108135222.49d7b834-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2010-01-08 14:01 ` Baurzhan Ismagulov
[not found] ` <20100108140111.GF4004-Y2X99Y6vBNTR7s880joybQ@public.gmane.org>
2010-01-08 14:06 ` Jochen Friedrich
[not found] ` <4B473BCE.8060803-NIgtFMG+Po8@public.gmane.org>
2010-01-08 23:19 ` Baurzhan Ismagulov
[not found] ` <20100108231942.GA3699-Y2X99Y6vBNTR7s880joybQ@public.gmane.org>
2010-01-09 8:12 ` Jean Delvare
2010-01-08 14:11 ` Jochen Friedrich
2010-01-08 17:54 ` Jean Delvare
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox