X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fi2c%2Fmvtwsi.c;h=74ac0a4aa78976487f8314ec7c531a7f781d9299;hb=cca7429ddd24d0cccc72f708a6f05c6ab9a75303;hp=38bca897458661aa652e635bc252895fecdad812;hpb=004b4cdaeca45d4702f0494f517b6fc472ccf4a1;p=oweals%2Fu-boot.git diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c index 38bca89745..74ac0a4aa7 100644 --- a/drivers/i2c/mvtwsi.c +++ b/drivers/i2c/mvtwsi.c @@ -1,17 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Driver for the TWSI (i2c) controller found on the Marvell * orion5x and kirkwood SoC families. * * Author: Albert Aribaud * Copyright (c) 2010 Albert Aribaud. - * - * SPDX-License-Identifier: GPL-2.0+ */ #include #include #include #include +#include #include #ifdef CONFIG_DM_I2C #include @@ -58,6 +58,7 @@ struct mvtwsi_registers { u32 status; u32 baudrate; u32 soft_reset; + u32 debug; /* Dummy field for build compatibility with mvebu */ }; #else @@ -71,8 +72,10 @@ struct mvtwsi_registers { u32 baudrate; /* When writing */ }; u32 xtnd_slave_addr; - u32 reserved[2]; + u32 reserved0[2]; u32 soft_reset; + u32 reserved1[27]; + u32 debug; }; #endif @@ -796,6 +799,23 @@ static int mvtwsi_i2c_ofdata_to_platdata(struct udevice *bus) return 0; } +static void twsi_disable_i2c_slave(struct mvtwsi_registers *twsi) +{ + clrbits_le32(&twsi->debug, BIT(18)); +} + +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)) + && bus->req_seq == 0) + twsi_disable_i2c_slave(twsi); + + return 0; +} + static int mvtwsi_i2c_probe(struct udevice *bus) { struct mvtwsi_i2c_dev *dev = dev_get_priv(bus); @@ -851,6 +871,7 @@ U_BOOT_DRIVER(i2c_mvtwsi) = { .name = "i2c_mvtwsi", .id = UCLASS_I2C, .of_match = mvtwsi_i2c_ids, + .bind = mvtwsi_i2c_bind, .probe = mvtwsi_i2c_probe, .ofdata_to_platdata = mvtwsi_i2c_ofdata_to_platdata, .priv_auto_alloc_size = sizeof(struct mvtwsi_i2c_dev),