On Sat, Oct 03, 2020 at 07:21:41PM +0300, Codrin Ciubotariu wrote: > Starting with > commit 75820314de26 ("i2c: core: add generic I2C GPIO recovery") > GPIO bus recovery is supported by the I2C core, so we can remove the > driver implementation and use that one instead. > > Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@xxxxxxxxxxxxx> > --- > > This patch is not tested. > The only different thing should be the fact that the pinctl state is > now switched back to the default state after the bus is enabled. > > drivers/i2c/busses/i2c-pxa.c | 75 +++--------------------------------- > 1 file changed, 6 insertions(+), 69 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c > index 35ca2c02c9b9..dd357b6e6c61 100644 > --- a/drivers/i2c/busses/i2c-pxa.c > +++ b/drivers/i2c/busses/i2c-pxa.c > @@ -264,9 +264,6 @@ struct pxa_i2c { > u32 hs_mask; > > struct i2c_bus_recovery_info recovery; > - struct pinctrl *pinctrl; > - struct pinctrl_state *pinctrl_default; > - struct pinctrl_state *pinctrl_recovery; > }; > > #define _IBMR(i2c) ((i2c)->reg_ibmr) > @@ -1305,8 +1302,6 @@ static void i2c_pxa_prepare_recovery(struct i2c_adapter *adap) > */ > gpiod_set_value(i2c->recovery.scl_gpiod, ibmr & IBMR_SCLS); > gpiod_set_value(i2c->recovery.sda_gpiod, ibmr & IBMR_SDAS); > - > - WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_recovery)); > } > > static void i2c_pxa_unprepare_recovery(struct i2c_adapter *adap) > @@ -1325,8 +1320,6 @@ static void i2c_pxa_unprepare_recovery(struct i2c_adapter *adap) > i2c_pxa_do_reset(i2c); > } > > - WARN_ON(pinctrl_select_state(i2c->pinctrl, i2c->pinctrl_default)); > - This won't fly. We need to put the pinctrl back into i2c mode _before_ we re-enable the I2C module, otherwise the I2C block will see logic 0 on both SCL and SDA which could confuse the block. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!