]> git.sur5r.net Git - u-boot/blobdiff - drivers/i2c/mxs_i2c.c
efi_loader: always check parameters in efi_cout_query_mode()
[u-boot] / drivers / i2c / mxs_i2c.c
index d3cb7274f3086d2e82a4ca9a9fb32de0bd75ee9a..6766d3754794d323ab52252fe0b07e0c61fd6035 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Freescale i.MX28 I2C Driver
  *
  *
  * Which was based on a (non-working) driver which was:
  * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <malloc.h>
 #include <i2c.h>
-#include <asm/errno.h>
+#include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 
 static struct mxs_i2c_regs *mxs_i2c_get_base(struct i2c_adapter *adap)
 {
-       return (struct mxs_i2c_regs *)MXS_I2C0_BASE;
+       if (adap->hwadapnr == 0)
+               return (struct mxs_i2c_regs *)MXS_I2C0_BASE;
+       else
+               return (struct mxs_i2c_regs *)MXS_I2C1_BASE;
 }
 
 static unsigned int mxs_i2c_get_bus_speed(struct i2c_adapter *adap)
@@ -311,3 +313,7 @@ U_BOOT_I2C_ADAP_COMPLETE(mxs0, mxs_i2c_init, mxs_i2c_probe,
                         mxs_i2c_if_read, mxs_i2c_if_write,
                         mxs_i2c_set_bus_speed,
                         CONFIG_SYS_I2C_SPEED, 0, 0)
+U_BOOT_I2C_ADAP_COMPLETE(mxs1, mxs_i2c_init, mxs_i2c_probe,
+                        mxs_i2c_if_read, mxs_i2c_if_write,
+                        mxs_i2c_set_bus_speed,
+                        CONFIG_SYS_I2C_SPEED, 0, 1)