On Wed, May 20, 2020 at 03:16:07PM +0300, Jarkko Nikula wrote: > On 5/10/20 12:50 PM, Serge Semin wrote: > > Seeing the DW I2C driver is using flags-based accessors with two > > conditional clauses it would be better to replace them with the regmap > > API IO methods and to initialize the regmap object with read/write > > callbacks specific to the controller registers map implementation. This > > will be also handy for the drivers with non-standard registers mapping > > (like an embedded into the Baikal-T1 System Controller DW I2C block, which > > glue-driver is a part of this series). > > > > As before the driver tries to detect the mapping setup at probe stage and > > creates a regmap object accordingly, which will be used by the rest of the > > code to correctly access the controller registers. In two places it was > > appropriate to convert the hand-written read-modify-write and > > read-poll-loop design patterns to the corresponding regmap API > > ready-to-use methods. > > > > Note the regmap IO methods return value is checked only at the probe > > stage. The rest of the code won't do this because basically we have > > MMIO-based regmap so non of the read/write methods can fail (this also > > won't be needed for the Baikal-T1-specific I2C controller). > > > > Suggested-by: Andy Shevchenko <andriy.shevche...@linux.intel.com> > > Signed-off-by: Serge Semin <sergey.se...@baikalelectronics.ru> > > Cc: Alexey Malahov <alexey.mala...@baikalelectronics.ru> > > Cc: Thomas Bogendoerfer <tsbog...@alpha.franken.de> > > Cc: Paul Burton <paulbur...@kernel.org> > > Cc: Ralf Baechle <r...@linux-mips.org> > > Cc: Wolfram Sang <w...@the-dreams.de> > > Cc: Rob Herring <robh...@kernel.org> > > Cc: Frank Rowand <frowand.l...@gmail.com> > > Cc: devicet...@vger.kernel.org > > Cc: linux-m...@vger.kernel.org > > --- > > drivers/i2c/busses/Kconfig | 1 + > > drivers/i2c/busses/i2c-designware-common.c | 171 +++++++++++++++------ > > drivers/i2c/busses/i2c-designware-core.h | 18 +-- > > drivers/i2c/busses/i2c-designware-master.c | 125 ++++++++------- > > drivers/i2c/busses/i2c-designware-slave.c | 77 +++++----- > > 5 files changed, 239 insertions(+), 153 deletions(-) > > > Looking at patches 4/12-12/12 I think it would be good to move fixes and > less invasive patches before this. Like > > i2c: designware: slave: Set DW I2C core module dependency > i2c: designware: Use `-y` to build multi-object modules > i2c: designware: Move Baytrail sem config to the platform if-clause > > That said, you may add: > > Tested-by: Jarkko Nikula <jarkko.nik...@linux.intel.com> > Acked-by: Jarkko Nikula <jarkko.nik...@linux.intel.com>
Ok. I'll move those three patches to be before this one in v3. Thanks. -Sergey