Skip to contentSkip to conversation

OMAP: I2C driver for TI OMAP boards #2

PATCH David Brownell 4 participants 14 messages Jul 31, 2006 – Aug 4, 2006 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

And I **really** hope this gets merged into 2.6.18 since virtually no OMAP board is very usable without it. I2C is one of the main missing pieces(*) ... can whoever's managing I2C merges please expedite this?

I just tried building an OSK config against RC3 and found at least five will-not-build errors in the kernel.org tree. The reason for this is basically that folk have no option except the linux-omap tree, since there's no point in trying to use the kernel.org version until the I2C driver finally gets merged ... so such bugs won't get fixed. Needless to say, this is not the desired development process.

- Dave

(*) I submitted the then-current I2C driver over a year ago, but
after a few months of inaction I found that it was dropped (or rejected?) by the I2C list software. Of course at that point I no longer had time to resubmit the current code ...

#2 lore raw

Hi David,

Quoted 4 lines

And I **really** hope this gets merged into 2.6.18 since virtually no OMAP board is very usable without it. I2C is one of the main missing pieces(*) ... can whoever's managing I2C merges please expedite this?

It doesn't work like this, sorry. The merge window for 2.6.18 is closed. The driver needs to be reviewed before it is merged. So the best you can hope for is -mm soon, and 2.6.19.

Quoted 6 lines

I just tried building an OSK config against RC3 and found at least five will-not-build errors in the kernel.org tree. The reason for this is basically that folk have no option except the linux-omap tree, since there's no point in trying to use the kernel.org version until the I2C driver finally gets merged ... so such bugs won't get fixed. Needless to say, this is not the desired development process.

Indeed, this is no good. If you want things to improve, please help by reviewing Komal's driver. I think I understand you already commented on it, but I'd like you to really review it, and add a formal approval to it (e.g. Signed-off-by or Acked-by). Then I'll review it for merge.

Quoted 4 lines

(*) I submitted the then-current I2C driver over a year ago, but
after a few months of inaction I found that it was dropped (or rejected?) by the I2C list software. Of course at that point I no longer had time to resubmit the current code ...

Neither dropped nor rejected, as I received it and it shows in the archive as well:
http://lists.lm-sensors.org/pipermail/lm-sensors/2005-August/013216.html
The reason why it was "ignored" is more likely a lack of time and/or interest.

What is the relation between your "old" driver and the new one Komal is submitting now? Evolution, or rewrite?

Signature · 1 line
Jean Delvare
#3 lore raw
Quoted 10 lines · Jean Delvare

Hi David,

Quoted 4 lines

And I **really** hope this gets merged into 2.6.18 since virtually no OMAP board is very usable without it. I2C is one of the main missing pieces(*) ... can whoever's managing I2C merges please expedite this?

It doesn't work like this, sorry. The merge window for 2.6.18 is closed. The driver needs to be reviewed before it is merged. So the best you can hope for is -mm soon, and 2.6.19.

So there's been a change from the "new drivers can be merged late" policy? News to me if so. Not that this is a particularly new driver of course, or at all unstable.

Quoted 11 lines
Quoted 6 lines

I just tried building an OSK config against RC3 and found at least five will-not-build errors in the kernel.org tree. The reason for this is basically that folk have no option except the linux-omap tree, since there's no point in trying to use the kernel.org version until the I2C driver finally gets merged ... so such bugs won't get fixed. Needless to say, this is not the desired development process.

Indeed, this is no good. If you want things to improve, please help by reviewing Komal's driver. I think I understand you already commented on it, but I'd like you to really review it, and add a formal approval to it (e.g. Signed-off-by or Acked-by). Then I'll review it for merge.

Review it again? I'll try to make some time to help there, but it's unlikely I'll notice significant issues that seem to me worth holding up the upstream merge. Certainly none that make up for the problems caused by having the kernel.org tree be all but unusable for OMAP work, and couldn't be patched later.

Quoted 5 lines
Quoted 4 lines

(*) I submitted the then-current I2C driver over a year ago, but
after a few months of inaction I found that it was dropped (or rejected?) by the I2C list software. Of course at that point I no longer had time to resubmit the current code ...

Quoted 7 lines

Neither dropped nor rejected, as I received it and it shows in the archive as well:
http://lists.lm-sensors.org/pipermail/lm-sensors/2005-August/013216.html
The reason why it was "ignored" is more likely a lack of time and/or interest.

What is the relation between your "old" driver

Not "my" driver at all; I'm not even on the copyright list, and maybe the biggest change I did was the platform_driver conversion. (If that; I don't recall, but I converted a lot of drivers around that time and I think I probably did that one too.)

Quoted 2 lines

and the new one Komal is
submitting now? Evolution, or rewrite?

Evolution. I see support for the new OMAP2 parts (ARMv6) and maybe the clock framework stuff is new; plus as you know the I2C framework has collected simplifications and updates.

- Dave

#4 lore raw
Quoted 7 lines · David Brownell
Quoted 6 lines · Jean Delvare

Hi David,

Quoted 4 lines

And I **really** hope this gets merged into 2.6.18 since virtually no OMAP board is very usable without it. I2C is one of the main missing pieces(*) ... can whoever's managing I2C merges please expedite this?

Slightly off-topic, and probably not your area, but it would probably help your case if omap were better looked after in mainline. Most OMAP platforms build fine, except for one long standing one - the H2 1610 defconfig, which hasn't built since 2.6.17-git11.

So, rather than shoveling new stuff in there, can the maintainence of the stuff already merged please be improved.

Build results vs kernel version for H2 1610:

http://armlinux.simtec.co.uk/kautobuild/omap_h2_1610_defconfig.html

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#5 lore raw
Quoted 11 lines · Russell King
Quoted 7 lines · David Brownell
Quoted 6 lines · Jean Delvare

Hi David,

Quoted 4 lines

And I **really** hope this gets merged into 2.6.18 since virtually no OMAP board is very usable without it. I2C is one of the main missing pieces(*) ... can whoever's managing I2C merges please expedite this?

Slightly off-topic, and probably not your area, but it would probably help your case if omap were better looked after in mainline.

Actually that _is_ part of my case. It can't be looked after in any reasonable way until the I2C driver gets merged, because significant chunks of the OMAP driver stack require I2C. (And notably for me, USB always requires I2C to handle VBUS switches ...)

So for example once the OMAP I2C gets merged, then it'll finallly become practical for folk to try _using_ mainline kernels. Which is a prerequisite for getting the bugs there fixed with any level of promptness, since they can't be fixed until they're noticed.

Quoted 3 lines

Most OMAP
platforms build fine, except for one long standing one - the H2 1610 defconfig, which hasn't built since 2.6.17-git11.

Yet oddly enough, that's the only OMAP defconfig present. :(

Once I2C gets merged, the OSK defconfig could be merged too; and that's a much handier board to work with and test. H2 and OSK use basically the same OMAP chip (5912 ~= 1610b), but 5912 doesn't need NDAs; and the OSK board is is 10x smaller in size and price, plus it's available on the open market.

Quoted 6 lines

So, rather than shoveling new stuff in there, can the maintainence of the stuff already merged please be improved.

Build results vs kernel version for H2 1610:

http://armlinux.simtec.co.uk/kautobuild/omap_h2_1610_defconfig.html

You'll observe that I recently posted four build fixes (tps65010, ohci-omap, omap-rng, smc91x) ... all of which would affect H2... the fifth build fix will go to your armlinux patch database soon, it addresses the fatal error in that build log. I've already submitted patches for the three Kconfig complaints. (By the way, those build logs could become more informative by using "make -k" ...)

Plus H2 is another of the OMAP platforms that can't be fully initialized without using I2C. :)

- Dave

#6 lore raw
Quoted 18 lines · David Brownell
Quoted 11 lines · Russell King
Quoted 7 lines · David Brownell
Quoted 6 lines · Jean Delvare

Hi David,

Quoted 4 lines

And I **really** hope this gets merged into 2.6.18 since virtually no OMAP board is very usable without it. I2C is one of the main missing pieces(*) ... can whoever's managing I2C merges please expedite this?

Slightly off-topic, and probably not your area, but it would probably help your case if omap were better looked after in mainline.

Actually that _is_ part of my case. It can't be looked after in any reasonable way until the I2C driver gets merged, because significant chunks of the OMAP driver stack require I2C. (And notably for me, USB always requires I2C to handle VBUS switches ...)

Quoted 4 lines

So for example once the OMAP I2C gets merged, then it'll finallly become practical for folk to try _using_ mainline kernels. Which is a prerequisite for getting the bugs there fixed with any level of promptness, since they can't be fixed until they're noticed.

I agree, we want to use the mainline kernel for omap. Most of the core omap code is already integrated, now we just need to get few more omap device drivers integrated to have mainline kernel usable for most omap boards.

Quoted 11 lines
Quoted 3 lines

Most OMAP
platforms build fine, except for one long standing one - the H2 1610 defconfig, which hasn't built since 2.6.17-git11.

Yet oddly enough, that's the only OMAP defconfig present. :(

Once I2C gets merged, the OSK defconfig could be merged too; and that's a much handier board to work with and test. H2 and OSK use basically the same OMAP chip (5912 ~= 1610b), but 5912 doesn't need NDAs; and the OSK board is is 10x smaller in size and price, plus it's available on the open market.

I agree. After the omap I2C driver has been integrated, we should provide patches for few more omap defconfigs.

Quoted 2 lines
Quoted 2 lines

So, rather than shoveling new stuff in there, can the maintainence of the stuff already merged please be improved.

Sorry, my fault, I've been on vacation for most of July.

Quoted 11 lines
Quoted 3 lines

Build results vs kernel version for H2 1610:

http://armlinux.simtec.co.uk/kautobuild/omap_h2_1610_defconfig.html

You'll observe that I recently posted four build fixes (tps65010, ohci-omap, omap-rng, smc91x) ... all of which would affect H2... the fifth build fix will go to your armlinux patch database soon, it addresses the fatal error in that build log. I've already submitted patches for the three Kconfig complaints. (By the way, those build logs could become more informative by using "make -k" ...)

Quoted 2 lines

Plus H2 is another of the OMAP platforms that can't be fully initialized without using I2C. :)

Good to hear the patches mentioned above fix the compile problem :)

Tony

#7 lore raw
In reply to David Brownell
Quoted 7 lines
Quoted 3 lines

It doesn't work like this, sorry. The merge window for 2.6.18 is closed. The driver needs to be reviewed before it is merged. So the best you can hope for is -mm soon, and 2.6.19.

So there's been a change from the "new drivers can be merged late" policy? News to me if so. Not that this is a particularly new driver of course, or at all unstable.

This is my own policy for i2c drivers as the maintainer of the i2c subsystem. I simply observed that new drivers cause much more late-rc trouble than all other changes. So in order to let things stabilize quickly, I don't take new drivers after -rc1. I see no reason why new drivers would be allowed to bypass the -mm staging anyway.

If people want their drivers merged, they have to send them early. And if they think I don't review them quickly enough (which is true) they have to find other reviewers. There is no reason why I would have to review every new i2c driver. As a matter of fact, I just don't have the time to do so.

Quoted 10 lines
Quoted 4 lines

Indeed, this is no good. If you want things to improve, please help by reviewing Komal's driver. I think I understand you already commented on it, but I'd like you to really review it, and add a formal approval to it (e.g. Signed-off-by or Acked-by). Then I'll review it for merge.

Review it again? I'll try to make some time to help there, but it's unlikely I'll notice significant issues that seem to me worth holding up the upstream merge. Certainly none that make up for the problems caused by having the kernel.org tree be all but unusable for OMAP work, and couldn't be patched later.

The "and could be patched later" way has been tried before, and I'm not going there again. Later happened to be "never" or at least "too late" more often than not.

And again maybe other subsystem maintainers have other policies, I don't really care. I do the things the way I think works better. Anyone not happy with that will have to help me a lot with the i2c patches before I listen to him/her.

Thanks,

Signature · 1 line
Jean Delvare

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Hi David,

Quoted 7 lines
Quoted 3 lines

The "and could be patched later" way has been tried before, and I'm not going there again. Later happened to be "never" or at least "too late" more often than not.

Well, you've seen my basic review. As for "later", it's quite routine; that's what "submit early and often" means. That whole ext4 devel cycle depends on using "later" intelligently.

Releasing "early and often" was never an excuse to release buggy code. It is (to me, at least) about adding functionalities one at a time, rather than waiting to be full-featured before releasing first.

As for the "later", there are areas where it is known not to work, e.g. documentation - or more generally, everything which is optional from a functional point of view. I do expect functional bugs to be fixed later when they bite the users, but I am more skeptical about cleanups and documentation.

Signature · 1 line
Jean Delvare
#10 lore raw
In reply to Jean Delvare
Quoted 4 lines · Jean Delvare

If you want things to improve, please help by
reviewing Komal's driver. I think I understand you already commented on it, but I'd like you to really review it, and add a formal approval to it (e.g. Signed-off-by or Acked-by). Then I'll review it for merge.

The issues noted in the code are still almost all low priority (non-blocking).

- The FIXME about choosing the address is very low priority, and would affect only multi-master systems. The fix would involve defining a new i2c-specific struct for platform_data, updating various boards to use it (e.g. OSK can use 400 MHz), and wouldn't change behavior for any board I've ever seen.

- Likewise with the REVISIT for the bus speed to use. They'd be fixed with the same patch.

- The REVISIT about maybe a better way to probe is also low priority; someone with a board that needs better probing could address it at that time. (Then restest any changes on multiple generations of silicion ... which IMO is the role the linux-omap tree should play.)

- The revisit about adap->retries is still up in the air, and was a question in my submission from last year. How exactly is that supposed to be used? Right now it's neither initialized (except to zero) nor tested.

Re coding style issues, I didn't give it a detailed nitpick but I did easily notice two things worth fixing:

- Some lines are more than 80 characters, so they'll wrap on standard editor windows.

- There are a couple instances of hidden whitespace to
remove: at end of line, or space-before-tab.

This doesn't include the drivers/Makefile change to push i2c linkage up near the beginning with other "system" busses, but that can be a separate patch in any case (assuming that it's still needed).

Assuming those two coding style things get resolved first,

- Dave

#11 lore raw

Hi David,

Quoted 6 lines · Jean Delvare
Quoted 4 lines

If you want things to improve, please help by
reviewing Komal's driver. I think I understand you already commented on it, but I'd like you to really review it, and add a formal approval to it (e.g. Signed-off-by or Acked-by). Then I'll review it for merge.

Quoted 8 lines

The issues noted in the code are still almost all low priority (non-blocking).

- The FIXME about choosing the address is very low priority, and would affect only multi-master systems. The fix would involve defining a new i2c-specific struct for platform_data, updating various boards to use it (e.g. OSK can use 400 MHz), and wouldn't change behavior for any board I've ever seen.

Given that the slave mode isn't supported by Linux at the moment, I don't even see how this is relevant. (So I agree with you that this is very low priority - I would even kill that part of the code.)

Quoted 3 lines

- Likewise with the REVISIT for the bus speed to use. They'd be fixed with the same patch.

I don't see any relation with the slave address mechanism. The bus speed is a simple parameter, internal to the device (i2c-core doesn't care) so it should be very easy to move it to platform data. Not that I really care, though.

Quoted 5 lines

- The REVISIT about maybe a better way to probe is also low priority; someone with a board that needs better probing could address it at that time. (Then restest any changes on multiple generations of silicion ... which IMO is the role the linux-omap tree should play.)

No, it's not low priority, it's a blocker. I can't let that code go in. The driver must do what it is told to do. If it can't, it must fail. Yes, this means no (in-kernel) probing on this bus at the moment. Blame it on the hardware manufacturer (if the chip actually can't do it.) In user-space, i2cdetect can be told to use byte reads for probing.

Quoted 4 lines

- The revisit about adap->retries is still up in the air, and was a question in my submission from last year. How exactly is that supposed to be used? Right now it's neither initialized (except to zero) nor tested.

This is an optional feature, most i2c adapter drivers don't implement it. I'm fine without it, this can always be implemented later if needed.

I just sent my own review of the code. As you can see, I had quite a few comments. Hopefully you now agree that pushing that code to Linus right away wouldn't have been wise.

Thanks,

Signature · 1 line
Jean Delvare
#12 lore raw
Quoted 6 lines · Jean Delvare
Quoted 2 lines

- The FIXME about choosing the address is very low priority,
...

Given that the slave mode isn't supported by Linux at the moment, I don't even see how this is relevant. (So I agree with you that this is very low priority - I would even kill that part of the code.)

Killing it might be the right thing to do, but someone should double check against omap 1510 errata ... on first principles that should be either a workaround for a very old erratum, or else a bug that's been sitting around for a long time. (Possibly making one of your other points!) The earliest versions of that driver were pretty crappy, and I could imagine that mechanism was left unchanged since, unlike a lot of stuf you didn't see, this wasn't actively buggy.

Quoted 7 lines
Quoted 2 lines

- Likewise with the REVISIT for the bus speed to use. They'd be fixed with the same patch.

I don't see any relation with the slave address mechanism. The bus speed is a simple parameter, internal to the device (i2c-core doesn't care) so it should be very easy to move it to platform data. Not that I really care, though.

The relation is that they'd both be per-board mechanisms that belong better with platform data. (Unless of course setting that one address is not really needed.)

Quoted 8 lines
Quoted 5 lines

- The REVISIT about maybe a better way to probe is also low priority; someone with a board that needs better probing could address it at that time. (Then restest any changes on multiple generations of silicion ... which IMO is the role the linux-omap tree should play.)

No, it's not low priority, it's a blocker. I can't let that code go in. The driver must do what it is told to do. If it can't, it must fail.

Well for the record that's not been reported as a problem ... that is, nobody's reported a board where that matters. We'd have to see if the driver is even usable without that, since the I2C stack overall seemed to require probing to work.

(There's a separate issue about how the I2C stack doesn't just have a mechanism to just declare "this board has these chips, these addresses", so I2C drivers have needless reliance on probing...)

Quoted 3 lines

Yes, this means no (in-kernel) probing on this bus at the moment. Blame it on the hardware manufacturer (if the chip actually can't do it.) In user-space, i2cdetect can be told to use byte reads for probing.

The spec does say it's tested for zero after decrementing the count, so a value of zero gives a 65536 byte transfer.

Quoted 7 lines
Quoted 4 lines

- The revisit about adap->retries is still up in the air, and was a question in my submission from last year. How exactly is that supposed to be used? Right now it's neither initialized (except to zero) nor tested.

This is an optional feature, most i2c adapter drivers don't implement it. I'm fine without it, this can always be implemented later if needed.

Good. Komal, please update the comment accordingly ... it'd be handy if kerneldoc or Documentation/i2c/* said that adap->retries is optional, and said what it's supposed to do.

Quoted 3 lines

I just sent my own review of the code. As you can see, I had quite a few comments. Hopefully you now agree that pushing that code to Linus right away wouldn't have been wise.

My main concern was that the process had stalled, for an essential driver. It's not stalled any more, assuming Komal makes time to address those comments!

- Dave

#13 lore raw

Hi David,

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

- The REVISIT about maybe a better way to probe is also low priority; someone with a board that needs better probing could address it at that time. (Then restest any changes on multiple generations of silicion ... which IMO is the role the linux-omap tree should play.)

Quoted 7 lines
Quoted 2 lines

No, it's not low priority, it's a blocker. I can't let that code go in. The driver must do what it is told to do. If it can't, it must fail.

Well for the record that's not been reported as a problem ... that is, nobody's reported a board where that matters. We'd have to see if the driver is even usable without that, since the I2C stack overall seemed to require probing to work.

The i2c core provides a mechanism to bypass the probing when you know for sure what device is at a given address. For an embedded system, that should work.

Quoted 3 lines

(There's a separate issue about how the I2C stack doesn't just have a mechanism to just declare "this board has these chips, these addresses", so I2C drivers have needless reliance on probing...)

This is being (slowly) addressed by Nathan Lutchansky and Mark M. Hoffman. The best solution implies converting the i2c subsystem to the device driver model - a non-trivial task.

Quoted 6 lines
Quoted 3 lines

Yes, this means no (in-kernel) probing on this bus at the moment. Blame it on the hardware manufacturer (if the chip actually can't do it.) In user-space, i2cdetect can be told to use byte reads for probing.

The spec does say it's tested for zero after decrementing the count, so a value of zero gives a 65536 byte transfer.

Did you try setting the OMAP_I2C_CON_STP bit before writing the address to OMAP_I2C_SA_REG for zero-byte transfactions? And then don't write to the OMAP_I2C_CNT_REG register at all, as the transaction is already finished.

BTW, it looks like the driver attempts to handle 10-bit addresses, but the way it is done, I very much doubt it would work. So it would be better no to implement it at all (I've never seen a 10-bit address chip anyway.)

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

- The revisit about adap->retries is still up in the air, and was a question in my submission from last year. How exactly is that supposed to be used? Right now it's neither initialized (except to zero) nor tested.

This is an optional feature, most i2c adapter drivers don't implement it. I'm fine without it, this can always be implemented later if needed.

Good. Komal, please update the comment accordingly ... it'd be handy if kerneldoc or Documentation/i2c/* said that adap->retries is optional, and said what it's supposed to do.

I take patches :) I don't see in which file it would fit under Documentation/i2c (there's no i2c bus driver writing howto), maybe it would be more useful to add a comment to include/linux/i2c.h instead.

Signature · 1 line
Jean Delvare
#14 lore raw
Quoted 3 lines · Jean Delvare

The i2c core provides a mechanism to bypass the probing when you know for sure what device is at a given address. For an embedded system, that should work.

Unfortunately the mechanisms I'm aware of require either error-prone kernel command line parameters, or (not error prone, but inelegant) board-specific logic in the drivers, before driver registration, to do equivalent stuff.

Quoted 7 lines
Quoted 3 lines

(There's a separate issue about how the I2C stack doesn't just have a mechanism to just declare "this board has these chips, these addresses", so I2C drivers have needless reliance on probing...)

This is being (slowly) addressed by Nathan Lutchansky and Mark M. Hoffman. The best solution implies converting the i2c subsystem to the device driver model - a non-trivial task.

Glad to hear that fixes are in the works. That's the same conclusion I reached: that I2C needed those non-trivial changes.

It may help to see how the SPI core solves that problem. Unlike I2C, SPI actually _can't_ probe (except in rare specialized cases), and when I did the SPI stuff I was thinking about models that could apply easily to help I2C avoid probing. (Though not, at this point, code.)

That model of a table of board-specific declarations (with things like "I2C chip type X at address A, using interrupt I and platform_data P") should work for I2C too.

- Dave

#15 lore raw

David,

Quoted 9 lines · Jean Delvare
Quoted 3 lines

The i2c core provides a mechanism to bypass the probing when you know for sure what device is at a given address. For an embedded system, that should work.

Unfortunately the mechanisms I'm aware of require either error-prone kernel command line parameters, or (not error prone, but inelegant) board-specific logic in the drivers, before driver registration, to do equivalent stuff.

I said it was possible, not that it was nice and elegant ;) I know it's ugly at the moment - which is exactly why people have been asking for an i2c-core conversion.

Quoted 4 lines

It may help to see how the SPI core solves that problem. Unlike I2C, SPI actually _can't_ probe (except in rare specialized cases), and when I did the SPI stuff I was thinking about models that could apply easily to help I2C avoid probing. (Though not, at this point, code.)

I2C can't really probe either. We abuse a transaction type we known most chips will reply to but otherwise ignore to achieve chip presence detection. It did damage in the past (killing Thinkpad laptops) and could do again in the future. So, having board-specific lists of chips to avoid probing would help.

Quoted 3 lines

That model of a table of board-specific declarations (with things like "I2C chip type X at address A, using interrupt I and platform_data P") should work for I2C too.

What we have in the works is "I2C chip type X at address A". No interrupt nor platform data at this point. But once the conversion to the device driver model is done, I guess it'll come naturally if needed.

Signature · 1 line
Jean Delvare