
Hi Stefan,
On Tue, May 29, 2018 at 08:11:55AM +0200, Stefan Roese wrote:
On 29.05.2018 06:45, Baruch Siach wrote:
Equivalent code that disables the hidden i2c0 slave already exists in the Turris Omnia platform specific code. But this hidden i2c0 slave that interferes the i2c bus is not board specific. Armada 38x SoCs and at least some Kirkwood variants are affected as well. Add code to disable this slave to the i2c bus driver to make it work on all affected hardware.
Use the bind callback because we want this to always run at boot, regardless of whether U-Boot uses the i2c bus.
Cc: Rabeeh Khoury rabeeh@solid-run.com Cc: Chris Packham judge.packham@gmail.com Reviewed-by: Stefan Roese sr@denx.de Reviewed-by: Heiko Schocher hs@denx.de Signed-off-by: Baruch Siach baruch@tkos.co.il
[snip]
+static int mvtwsi_i2c_bind(struct udevice *bus) +{
- struct mvtwsi_registers *twsi = devfdt_get_addr_ptr(bus);
- /* Disable the hidden slave in i2c0 of these platforms */
- if ((IS_ENABLED(CONFIG_ARMADA_38X) || IS_ENABLED(CONFIG_KIRKWOOD))
We could better use the compatible check here:
if (device_is_compatible(dev, "marvell,mv64xxx-i2c"))
This is not an equivalent check. marvell,mv64xxx-i2c covers other SoCs that might not be affected.
Furthermore, this makes a build time test into a run time one. This bloats the code for platforms like Allwinner that are unlikely to be affected.
What is the advantage of device_is_compatible()? Is it feasible to build a multi-platform U-Boot image?
&& bus->req_seq == 0)
twsi_disable_i2c_slave(twsi);
- return 0;
+}
baruch