Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1721777 > unrolled thread
| Started by | Wolfram Sang <wsa@the-dreams.de> |
|---|---|
| First post | 2017-08-28 18:10 +0200 |
| Last post | 2017-08-29 10:50 +0200 |
| Articles | 8 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RESEND PATCH v5 00/16] eeprom: at24: Add OF device ID table Wolfram Sang <wsa@the-dreams.de> - 2017-08-28 18:10 +0200
Re: [RESEND PATCH v5 00/16] eeprom: at24: Add OF device ID table Wolfram Sang <wsa@the-dreams.de> - 2017-08-29 10:50 +0200
Re: [RESEND PATCH v5 00/16] eeprom: at24: Add OF device ID table Javier Martinez Canillas <javier@dowhile0.org> - 2017-08-30 18:20 +0200
Re: [RESEND PATCH v5 00/16] eeprom: at24: Add OF device ID table Wolfram Sang <wsa@the-dreams.de> - 2017-08-30 19:50 +0200
Re: [RESEND PATCH v5 00/16] eeprom: at24: Add OF device ID table Javier Martinez Canillas <javier@dowhile0.org> - 2017-08-30 22:00 +0200
Re: [RESEND PATCH v5 00/16] eeprom: at24: Add OF device ID table Geert Uytterhoeven <geert@linux-m68k.org> - 2017-08-30 22:20 +0200
Re: [RESEND PATCH v5 00/16] eeprom: at24: Add OF device ID table Javier Martinez Canillas <javier@dowhile0.org> - 2017-08-30 23:00 +0200
Re: [RESEND PATCH v5 00/16] eeprom: at24: Add OF device ID table Javier Martinez Canillas <javier@dowhile0.org> - 2017-08-29 10:50 +0200
| From | Wolfram Sang <wsa@the-dreams.de> |
|---|---|
| Date | 2017-08-28 18:10 +0200 |
| Subject | Re: [RESEND PATCH v5 00/16] eeprom: at24: Add OF device ID table |
| Message-ID | <ujuLU-7II-13@gated-at.bofh.it> |
[Multipart message — attachments visible in raw view] — view raw
> > But there is a dependency, no? If I apply the driver patch, > > non-converted device trees will not find their eeproms anymore. So, I > > I don't think that's correct. If you apply this patch before the DTS > changes, the driver will still match using the I2C device ID table > like it has been doing it until today. My tests do not confirm this. If I add a node with a "renesas,24c01" compatible to my board, it works before your patch, but not after. If I change it to "atmel,24c01" it works even after your patch. I haven't looked into it, though, maybe i2c_of_match_device_sysfs() is stepping on our foots here? Did you test and did it work for you?
[toc] | [next] | [standalone]
| From | Wolfram Sang <wsa@the-dreams.de> |
|---|---|
| Date | 2017-08-29 10:50 +0200 |
| Message-ID | <ujKnE-lz-5@gated-at.bofh.it> |
| In reply to | #1721777 |
[Multipart message — attachments visible in raw view] — view raw
> I don't have a DT based system at hand now, but I'll test it again and > let you know probably tomorrow. I will try again today, too. Thanks!
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@dowhile0.org> |
|---|---|
| Date | 2017-08-30 18:20 +0200 |
| Message-ID | <ukdSG-28x-9@gated-at.bofh.it> |
| In reply to | #1722230 |
Hello Wolfram, On Tue, Aug 29, 2017 at 10:48 AM, Wolfram Sang <wsa@the-dreams.de> wrote: > >> I don't have a DT based system at hand now, but I'll test it again and >> let you know probably tomorrow. > > I will try again today, too. Thanks! > Ok, I had some time to do some tests again. I used an ARM Chromebook (Exynos Peach Pi) that has an I2C touchpad (Atmel maXTouch). Tested the following cases: 1) Driver without OF device ID table (only a I2C table with a "maxtouch" entry) and DTS defining a device node with a "atmel,maxtouch" compatible string. This is the case without any of the patches in this series. $ modinfo drivers/input/touchscreen/atmel_mxt_ts.ko | grep maxtouch alias: i2c:maxtouch $ grep maxtouch /sys/devices/platform/soc/12e00000.i2c/i2c-8/8-004b/uevent OF_COMPATIBLE_0=atmel,maxtouch MODALIAS=i2c:maxtouch 2) Driver without OF device ID table (only a I2C table with a "maxtouch" entry) and DTS defining a device node with a "atmel,maxtouch", "generic,maxtouch" compatible string. This is the case when platform maintainers merge the DTS patches without the driver patch. $ modinfo drivers/input/touchscreen/atmel_mxt_ts.ko | grep maxtouch alias: i2c:maxtouch $ grep maxtouch /sys/devices/platform/soc/12e00000.i2c/i2c-8/8-004b/uevent OF_COMPATIBLE_0=atmel,maxtouch OF_COMPATIBLE_1=generic,maxtouch MODALIAS=i2c:maxtouch 3) Driver with an OF device ID table (with a "generic,maxtouch" entry) and DTS defining a device node with a "atmel,maxtouch" compatible string. This is the case when the driver patch is merged without the DTS patches. $ modinfo drivers/input/touchscreen/atmel_mxt_ts.ko | grep maxtouch alias: of:N*T*Cgeneric,maxtouchC* alias: of:N*T*Cgeneric,maxtouch alias: i2c:maxtouch $ grep maxtouch /sys/devices/platform/soc/12e00000.i2c/i2c-8/8-004b/uevent OF_COMPATIBLE_0=atmel,maxtouch MODALIAS=i2c:maxtouch 4) Driver with an OF device ID table (with a "generic,maxtouch" entry) and DTS defining a device node with a "atmel,maxtouch", "generic,maxtouch" compatible string. This is the case when both the DTS and driver patches are merged. $ modinfo drivers/input/touchscreen/atmel_mxt_ts.ko | grep maxtouch alias: of:N*T*Cgeneric,maxtouchC* alias: of:N*T*Cgeneric,maxtouch alias: i2c:maxtouch $ grep maxtouch /sys/devices/platform/soc/12e00000.i2c/i2c-8/8-004b/uevent OF_COMPATIBLE_0=atmel,maxtouch OF_COMPATIBLE_1=generic,maxtouch MODALIAS=i2c:maxtouch For all cases module autoload, driver probe and evtest worked for me. You said that (3) doesn't work but I don't understand why is failing for you. Probably I'm missing something. Best regards, Javier
[toc] | [prev] | [next] | [standalone]
| From | Wolfram Sang <wsa@the-dreams.de> |
|---|---|
| Date | 2017-08-30 19:50 +0200 |
| Message-ID | <ukfhM-2SU-7@gated-at.bofh.it> |
| In reply to | #1723480 |
[Multipart message — attachments visible in raw view] — view raw
On Wed, Aug 30, 2017 at 06:19:02PM +0200, Javier Martinez Canillas wrote:
> Hello Wolfram,
>
> On Tue, Aug 29, 2017 at 10:48 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> >
> >> I don't have a DT based system at hand now, but I'll test it again and
> >> let you know probably tomorrow.
> >
> > I will try again today, too. Thanks!
> >
>
> Ok, I had some time to do some tests again. I used an ARM Chromebook
> (Exynos Peach Pi) that has an I2C touchpad (Atmel maXTouch).
I tried again as well and it still fails for me.
> Tested the following cases:
I think we should talk about the same case: Let me repeat what I did:
1) I added your patch "eeprom: at24: Add OF device ID table"
2) I added an EEPROM node to an I2C
+ eeprom@50 {
+ compatible = "renesas,24c01";
+ reg = <0x50>;
+ };
-> no at24 binding to the device
3) I revert your patch
-> at24 binding to the device
I think you should be able to test this DTS snipplet even without a real
eeprom. Especially after applying this to the at24 driver.
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 79c5c39be29cac..f9f547680c53db 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -805,11 +805,6 @@ static int at24_probe(struct i2c_client *client, const struct i2c_device_id *id)
* Perform a one-byte test read to verify that the
* chip is functional.
*/
- err = at24_read(at24, 0, &test_byte, 1);
- if (err) {
- err = -ENODEV;
- goto err_clients;
- }
at24->nvmem_config.name = dev_name(&client->dev);
at24->nvmem_config.dev = &client->dev;
Can you check this?
Thanks,
Wolfram
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@dowhile0.org> |
|---|---|
| Date | 2017-08-30 22:00 +0200 |
| Message-ID | <ukhjB-483-49@gated-at.bofh.it> |
| In reply to | #1723536 |
>
> I think we should talk about the same case: Let me repeat what I did:
>
> 1) I added your patch "eeprom: at24: Add OF device ID table"
> 2) I added an EEPROM node to an I2C
>
> + eeprom@50 {
> + compatible = "renesas,24c01";
> + reg = <0x50>;
> + };
>
> -> no at24 binding to the device
>
> 3) I revert your patch
>
> -> at24 binding to the device
>
I've tested this and you are right, it fails...
The problem is that the patch also changes how the driver obtains the
EEPROM parameters (the magic value in the entry's data field).
So even when module autoload and device / driver matching works, the
driver probe function fails because if (client->dev.of_node) the
driver attempts to get the entry data using
of_device_get_match_data(), which is obviously wrong since the
compatible string in the dev node isn't present in the OF table.
The id->driver_data from the I2C table should be used instead since
that's the table that matches in this case.
One option is to fallback to id->driver_data if
of_device_get_match_data() fails, but that's just an (ugly)
workaround. So I agree with you that the best option is to wait for
the DTS patches to land first.
It worked for me on my previous tests because the tested drivers
didn't use a table entry data, I'm so sorry for missing this :(
Best regards,
Javier
[toc] | [prev] | [next] | [standalone]
| From | Geert Uytterhoeven <geert@linux-m68k.org> |
|---|---|
| Date | 2017-08-30 22:20 +0200 |
| Message-ID | <ukhCW-4vj-11@gated-at.bofh.it> |
| In reply to | #1723630 |
Hi Javier,
On Wed, Aug 30, 2017 at 9:57 PM, Javier Martinez Canillas
<javier@dowhile0.org> wrote:
>> I think we should talk about the same case: Let me repeat what I did:
>>
>> 1) I added your patch "eeprom: at24: Add OF device ID table"
>> 2) I added an EEPROM node to an I2C
>>
>> + eeprom@50 {
>> + compatible = "renesas,24c01";
>> + reg = <0x50>;
>> + };
>>
>> -> no at24 binding to the device
>>
>> 3) I revert your patch
>>
>> -> at24 binding to the device
>>
>
> I've tested this and you are right, it fails...
>
> The problem is that the patch also changes how the driver obtains the
> EEPROM parameters (the magic value in the entry's data field).
>
> So even when module autoload and device / driver matching works, the
> driver probe function fails because if (client->dev.of_node) the
> driver attempts to get the entry data using
> of_device_get_match_data(), which is obviously wrong since the
> compatible string in the dev node isn't present in the OF table.
>
> The id->driver_data from the I2C table should be used instead since
> that's the table that matches in this case.
>
> One option is to fallback to id->driver_data if
> of_device_get_match_data() fails, but that's just an (ugly)
> workaround. So I agree with you that the best option is to wait for
> the DTS patches to land first.
Which means new kernels won't work with old DTBs. Oops...
I'm afraid that needs to be fixed. People care about DTB backward
compatibility on many platforms.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@dowhile0.org> |
|---|---|
| Date | 2017-08-30 23:00 +0200 |
| Message-ID | <ukifE-4I6-29@gated-at.bofh.it> |
| In reply to | #1723639 |
Hello Geert,
On Wed, Aug 30, 2017 at 10:15 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> Hi Javier,
>
> On Wed, Aug 30, 2017 at 9:57 PM, Javier Martinez Canillas
> <javier@dowhile0.org> wrote:
>>> I think we should talk about the same case: Let me repeat what I did:
>>>
>>> 1) I added your patch "eeprom: at24: Add OF device ID table"
>>> 2) I added an EEPROM node to an I2C
>>>
>>> + eeprom@50 {
>>> + compatible = "renesas,24c01";
>>> + reg = <0x50>;
>>> + };
>>>
>>> -> no at24 binding to the device
>>>
>>> 3) I revert your patch
>>>
>>> -> at24 binding to the device
>>>
>>
>> I've tested this and you are right, it fails...
>>
>> The problem is that the patch also changes how the driver obtains the
>> EEPROM parameters (the magic value in the entry's data field).
>>
>> So even when module autoload and device / driver matching works, the
>> driver probe function fails because if (client->dev.of_node) the
>> driver attempts to get the entry data using
>> of_device_get_match_data(), which is obviously wrong since the
>> compatible string in the dev node isn't present in the OF table.
>>
>> The id->driver_data from the I2C table should be used instead since
>> that's the table that matches in this case.
>>
>> One option is to fallback to id->driver_data if
>> of_device_get_match_data() fails, but that's just an (ugly)
>> workaround. So I agree with you that the best option is to wait for
>> the DTS patches to land first.
>
> Which means new kernels won't work with old DTBs. Oops...
> I'm afraid that needs to be fixed. People care about DTB backward
> compatibility on many platforms.
>
Right, I've yet to find one of those mythical platforms that ship old
DTBs with new kernels, but I agree with you since people seem to care
about backward compatibility (at least on theory).
So I see two options then:
1) Use the workaround I mentioned and lookup the I2C device ID table
entry data if of_device_get_match_data() fails
2) Only call of_device_get_match_data() if (dev->of_node &&
of_match_device(dev->driver->of_match_table, dev))
Not sure what's the preferred idiom for these cases.
To good thing about keeping backward compatibility is that Wolfram
would be able to pick the driver patch even before the DTS patches
land.
Best regards,
Javier
[toc] | [prev] | [next] | [standalone]
| From | Javier Martinez Canillas <javier@dowhile0.org> |
|---|---|
| Date | 2017-08-29 10:50 +0200 |
| Message-ID | <ujKnE-lz-7@gated-at.bofh.it> |
| In reply to | #1721777 |
Hello Wolfram, On Mon, Aug 28, 2017 at 6:01 PM, Wolfram Sang <wsa@the-dreams.de> wrote: > >> > But there is a dependency, no? If I apply the driver patch, >> > non-converted device trees will not find their eeproms anymore. So, I >> >> I don't think that's correct. If you apply this patch before the DTS >> changes, the driver will still match using the I2C device ID table >> like it has been doing it until today. > > My tests do not confirm this. If I add a node with a "renesas,24c01" > compatible to my board, it works before your patch, but not after. If I > change it to "atmel,24c01" it works even after your patch. I haven't > looked into it, though, maybe i2c_of_match_device_sysfs() is stepping on > our foots here? > > Did you test and did it work for you? > I would swear that I tested both combinations (driver patch without DT changes and DTS changes without driver patch), but it was months ago when I first posted the patches so I may misremembering. I don't have a DT based system at hand now, but I'll test it again and let you know probably tomorrow. Best regards, Javier
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web