linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* register access issues in pca953x gpio driver
@ 2020-03-27  7:49 Uwe Kleine-König
  2020-03-27 10:26 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2020-03-27  7:49 UTC (permalink / raw)
  To: Marek Vasut, Andy Shevchenko, H. Nikolaus Schaller, Mark Brown; +Cc: linux-gpio

Hello,

I have an issue with an pca9505 when the .set_multiple callback is used.
That chip has a bit ("AI") in the register address that makes the
address increment automatically on subsequent reads and writes.

The problem (that was already noticed in commit 3b00691cc46a ("gpio:
pca953x: hack to fix 24 bit gpio expanders")) is that the regmap stuff
isn't aware of this bit and so register accesses that make use of the auto
incrementing are not matched to those without it.

Additionally there is a bug in pca953x_recalc_addr() that results in the
AI bit only be set for register writes. (That's the issue that made me
notice this problem. The result is that in .set_multiple the read
accesses bank 0's register only (when the hardware is hit) or uses the
read cache from a location without AI set and then writes using AI set.)

I didn't try to understand if fixing pca953x_recalc_addr() to not set AI
depending on write fixes all issues. But to make the register access in
the driver robust I'm convinced we need to fix the regmap stuff to
understand the AI bit.

@broonie: I don't know regmap good enough to instantly know the right
magic to do this. Can you give a rough overview what would be needed?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-03-30 14:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27  7:49 register access issues in pca953x gpio driver Uwe Kleine-König
2020-03-27 10:26 ` Andy Shevchenko
2020-03-27 13:49   ` Uwe Kleine-König
2020-03-27 13:03 ` Mark Brown
2020-03-27 13:46   ` Uwe Kleine-König
2020-03-27 13:58     ` Mark Brown
2020-03-27 17:22 ` [PATCH v1 0/2] gpio: pca953x: fix handling of automatic address incrementing Uwe Kleine-König
2020-03-27 17:22   ` [PATCH v1 1/2] [RFC] " Uwe Kleine-König
2020-03-27 17:22   ` [PATCH v1 2/2] [RFC] gpio: pca953x: drop unused parameters of pca953x_recalc_addr() Uwe Kleine-König
2020-03-27 22:06     ` H. Nikolaus Schaller
2020-03-28  9:27       ` Uwe Kleine-König
2020-03-28 19:41         ` Andy Shevchenko
2020-03-30 14:07           ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).