Merge tag 'u-boot-rockchip-20200531' of https://gitlab.denx.de/u-boot/custodians...
[oweals/u-boot.git] / drivers / i2c / lpc32xx_i2c.c
index b4d1014b8d909f698a725c97df0eb4cc2a243764..6af2e975cf35f0936f3e83f0183c8475a832a892 100644 (file)
@@ -1,20 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * LPC32xx I2C interface driver
  *
  * (C) Copyright 2014-2015  DENX Software Engineering GmbH
  * Written-by: Albert ARIBAUD - 3ADEV <albert.aribaud@3adev.fr>
- *
- * SPDX-License-Identifier:    GPL-2.0+
- *
- * NOTE: This driver should be converted to driver model before June 2017.
- * Please see doc/driver-model/i2c-howto.txt for instructions.
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <i2c.h>
 #include <linux/errno.h>
 #include <asm/arch/clk.h>
+#include <asm/arch/i2c.h>
 #include <dm.h>
 #include <mapmem.h>
 
 #define CONFIG_SYS_I2C_LPC32XX_SLAVE 0
 #endif
 
-/* i2c register set */
-struct lpc32xx_i2c_base {
-       union {
-               u32 rx;
-               u32 tx;
-       };
-       u32 stat;
-       u32 ctrl;
-       u32 clk_hi;
-       u32 clk_lo;
-       u32 adr;
-       u32 rxfl;
-       u32 txfl;
-       u32 rxb;
-       u32 txb;
-       u32 stx;
-       u32 stxfl;
-};
-
-#ifdef CONFIG_DM_I2C
-struct lpc32xx_i2c_dev {
-       struct lpc32xx_i2c_base *base;
-       int index;
-       uint speed;
-};
-#endif /* CONFIG_DM_I2C */
-
 /* TX register fields */
 #define LPC32XX_I2C_TX_START           0x00000100
 #define LPC32XX_I2C_TX_STOP            0x00000200
@@ -311,6 +282,7 @@ U_BOOT_I2C_ADAP_COMPLETE(lpc32xx_2, lpc32xx_i2c_init, NULL,
 static int lpc32xx_i2c_probe(struct udevice *bus)
 {
        struct lpc32xx_i2c_dev *dev = dev_get_platdata(bus);
+       bus->seq = dev->index;
 
        __i2c_init(dev->base, dev->speed, 0, dev->index);
        return 0;