From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yang, Wenyou Date: Thu, 30 Nov 2017 09:20:32 +0800 Subject: [U-Boot] [PATCH 2/2] i2c: at91_i2c: remove the .probe_chip function In-Reply-To: <20171129032524.14431-3-alan@softiron.com> References: <20171129032524.14431-1-alan@softiron.com> <20171129032524.14431-3-alan@softiron.com> Message-ID: <30391a48-49f1-e260-6e13-90e13cee79b7@Microchip.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2017/11/29 11:25, Alan Ott wrote: > The .probe_chip function is supposed to probe an i2c device on the bus to > determine whether a device is answering to a particular address. > at91_i2c_probe_chip() did not do anything resembling this and always > returned 0. > > It looks as though at91_i2c_probe_chip() was intended to be a .probe > function for the controller, as it was copied-and-pasted to become > at91_i2c_probe() in 0bc8f640a4d7ed. > > Removing the at91_i2c_probe_chip() function makes the higher layer > (i2c_probe_chip()) try a zero-length read transfer to test for the > presence of a device instead, which does work. > > Signed-off-by: Alan Ott > --- Acked-by: Wenyou Yang Thank you for your patch. > drivers/i2c/at91_i2c.c | 22 ---------------------- > 1 file changed, 22 deletions(-) > > diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c > index 20d0929..7917ca1 100644 > --- a/drivers/i2c/at91_i2c.c > +++ b/drivers/i2c/at91_i2c.c > @@ -201,27 +201,6 @@ static int at91_i2c_enable_clk(struct udevice *dev) > return 0; > } > > -static int at91_i2c_probe_chip(struct udevice *dev, uint chip, uint chip_flags) > -{ > - struct at91_i2c_bus *bus = dev_get_priv(dev); > - struct at91_i2c_regs *reg = bus->regs; > - int ret; > - > - ret = at91_i2c_enable_clk(dev); > - if (ret) > - return ret; > - > - writel(TWI_CR_SWRST, ®->cr); > - > - at91_calc_i2c_clock(dev, bus->clock_frequency); > - > - writel(bus->cwgr_val, ®->cwgr); > - writel(TWI_CR_MSEN, ®->cr); > - writel(TWI_CR_SVDIS, ®->cr); > - > - return 0; > -} > - > static int at91_i2c_set_bus_speed(struct udevice *dev, unsigned int speed) > { > struct at91_i2c_bus *bus = dev_get_priv(dev); > @@ -256,7 +235,6 @@ static int at91_i2c_ofdata_to_platdata(struct udevice *dev) > > static const struct dm_i2c_ops at91_i2c_ops = { > .xfer = at91_i2c_xfer, > - .probe_chip = at91_i2c_probe_chip, > .set_bus_speed = at91_i2c_set_bus_speed, > .get_bus_speed = at91_i2c_get_bus_speed, > }; Best Regards, Wenyou Yang