i2c: remove i2c driver-model compatibility layer
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 29 Jul 2019 06:58:00 +0000 (08:58 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 29 Jul 2019 21:58:52 +0000 (17:58 -0400)
There are no more users of the compatibility layer for i2c. Remove the
driver and all references to it.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Acked-by: Heiko Schocher <hs@denx.de>
Makefile
drivers/i2c/Kconfig
drivers/i2c/Makefile
drivers/i2c/i2c-uclass-compat.c [deleted file]
include/_exports.h
include/exports.h
include/i2c.h

index 252525bf0ab9787f627a16e341b856b44d11427e..bff5a402a7c00ac2996921e5dc277b746134bcc6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -936,13 +936,6 @@ ifneq ($(CONFIG_DM_SPI)$(CONFIG_OF_CONTROL),yy)
 endif
 endif
 endif
-ifeq ($(CONFIG_DM_I2C_COMPAT),y)
-       @echo >&2 "===================== WARNING ======================"
-       @echo >&2 "This board uses CONFIG_DM_I2C_COMPAT. Please remove"
-       @echo >&2 "(possibly in a subsequent patch in your series)"
-       @echo >&2 "before sending patches to the mailing list."
-       @echo >&2 "===================================================="
-endif
 ifeq ($(CONFIG_MMC),y)
 ifneq ($(CONFIG_DM_MMC)$(CONFIG_OF_CONTROL)$(CONFIG_BLK),yyy)
        @echo >&2 "===================== WARNING ======================"
index 4772db383722354b38ec679206df5dcdf6049517..03d2fed341303950a8ab76498b48199605ff376c 100644 (file)
@@ -12,18 +12,7 @@ config DM_I2C
          write and speed, is implemented with the bus drivers operations,
          which provide methods for bus setting and data transfer. Each chip
          device (bus child) info is kept as parent platdata. The interface
-         is defined in include/i2c.h. When i2c bus driver supports the i2c
-         uclass, but the device drivers not, then DM_I2C_COMPAT config can
-         be used as compatibility layer.
-
-config DM_I2C_COMPAT
-       bool "Enable I2C compatibility layer"
-       depends on DM
-       help
-         Enable old-style I2C functions for compatibility with existing code.
-         This option can be enabled as a temporary measure to avoid needing
-         to convert all code for a board in a single commit. It should not
-         be enabled for any board in an official release.
+         is defined in include/i2c.h.
 
 config I2C_CROS_EC_TUNNEL
        tristate "Chrome OS EC tunnel I2C bus"
index dc40055efb319e4462ee2fc260055f29842b8bbb..c2f75d87559817c93e054eedfd55ec2dc192bd25 100644 (file)
@@ -3,7 +3,6 @@
 # (C) Copyright 2000-2007
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 obj-$(CONFIG_DM_I2C) += i2c-uclass.o
-obj-$(CONFIG_DM_I2C_COMPAT) += i2c-uclass-compat.o
 obj-$(CONFIG_DM_I2C_GPIO) += i2c-gpio.o
 obj-$(CONFIG_$(SPL_)I2C_CROS_EC_TUNNEL) += cros_ec_tunnel.o
 obj-$(CONFIG_$(SPL_)I2C_CROS_EC_LDO) += cros_ec_ldo.o
diff --git a/drivers/i2c/i2c-uclass-compat.c b/drivers/i2c/i2c-uclass-compat.c
deleted file mode 100644 (file)
index b3ade88..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (c) 2014 Google, Inc
- */
-
-#include <common.h>
-#include <dm.h>
-#include <errno.h>
-#include <i2c.h>
-
-static int cur_busnum __attribute__((section(".data")));
-
-static int i2c_compat_get_device(uint chip_addr, int alen,
-                                struct udevice **devp)
-{
-       struct dm_i2c_chip *chip;
-       int ret;
-
-       ret = i2c_get_chip_for_busnum(cur_busnum, chip_addr, alen, devp);
-       if (ret)
-               return ret;
-       chip = dev_get_parent_platdata(*devp);
-       if (chip->offset_len != alen) {
-               printf("I2C chip %x: requested alen %d does not match chip offset_len %d\n",
-                      chip_addr, alen, chip->offset_len);
-               return -EADDRNOTAVAIL;
-       }
-
-       return 0;
-}
-
-int i2c_probe(uint8_t chip_addr)
-{
-       struct udevice *bus, *dev;
-       int ret;
-
-       ret = uclass_get_device_by_seq(UCLASS_I2C, cur_busnum, &bus);
-       if (ret) {
-               debug("Cannot find I2C bus %d: err=%d\n", cur_busnum, ret);
-               return ret;
-       }
-
-       if (!bus)
-               return -ENOENT;
-
-       return dm_i2c_probe(bus, chip_addr, 0, &dev);
-}
-
-int i2c_read(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
-            int len)
-{
-       struct udevice *dev;
-       int ret;
-
-       ret = i2c_compat_get_device(chip_addr, alen, &dev);
-       if (ret)
-               return ret;
-
-       return dm_i2c_read(dev, addr, buffer, len);
-}
-
-int i2c_write(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
-             int len)
-{
-       struct udevice *dev;
-       int ret;
-
-       ret = i2c_compat_get_device(chip_addr, alen, &dev);
-       if (ret)
-               return ret;
-
-       return dm_i2c_write(dev, addr, buffer, len);
-}
-
-int i2c_get_bus_num_fdt(int node)
-{
-       struct udevice *bus;
-       int ret;
-
-       ret = uclass_get_device_by_of_offset(UCLASS_I2C, node, &bus);
-       if (ret)
-               return ret;
-
-       return bus->seq;
-}
-
-unsigned int i2c_get_bus_num(void)
-{
-       return cur_busnum;
-}
-
-int i2c_set_bus_num(unsigned int bus)
-{
-       cur_busnum = bus;
-
-       return 0;
-}
-
-void i2c_init(int speed, int slaveaddr)
-{
-       /* Nothing to do here - the init happens through driver model */
-}
-
-void board_i2c_init(const void *blob)
-{
-       /* Nothing to do here - the init happens through driver model */
-}
-
-uint8_t i2c_reg_read(uint8_t chip_addr, uint8_t offset)
-{
-       struct udevice *dev;
-       int ret;
-
-       ret = i2c_compat_get_device(chip_addr, 1, &dev);
-       if (ret)
-               return 0xff;
-       return dm_i2c_reg_read(dev, offset);
-}
-
-void i2c_reg_write(uint8_t chip_addr, uint8_t offset, uint8_t val)
-{
-       struct udevice *dev;
-       int ret;
-
-       ret = i2c_compat_get_device(chip_addr, 1, &dev);
-       if (!ret)
-               dm_i2c_reg_write(dev, offset, val);
-}
index c15050e30b775a5a8c6f16cbe06c89127f47be9a..0dee05f077a60509a1e021415da6d9b59265779c 100644 (file)
@@ -40,8 +40,7 @@
        EXPORT_FUNC(simple_strtol, long, simple_strtol,
                    const char *, char **, unsigned int)
        EXPORT_FUNC(strcmp, int, strcmp, const char *cs, const char *ct)
-#if defined(CONFIG_CMD_I2C) && \
-               (!defined(CONFIG_DM_I2C) || defined(CONFIG_DM_I2C_COMPAT))
+#if defined(CONFIG_CMD_I2C) && !defined(CONFIG_DM_I2C)
        EXPORT_FUNC(i2c_write, int, i2c_write, uchar, uint, int , uchar * , int)
        EXPORT_FUNC(i2c_read, int, i2c_read, uchar, uint, int , uchar * , int)
 #else
index a4b862f19178d561db3d1eda7d27ae5da937bc82..bf8d53c6b0112bc2e9e802cea5de3a6bb71c1bc3 100644 (file)
@@ -32,8 +32,7 @@ long simple_strtol(const char *cp, char **endp, unsigned int base);
 int strcmp(const char *cs, const char *ct);
 unsigned long ustrtoul(const char *cp, char **endp, unsigned int base);
 unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base);
-#if defined(CONFIG_CMD_I2C) && \
-               (!defined(CONFIG_DM_I2C) || defined(CONFIG_DM_I2C_COMPAT))
+#if defined(CONFIG_CMD_I2C) && !defined(CONFIG_DM_I2C)
 int i2c_write (uchar, uint, int , uchar* , int);
 int i2c_read (uchar, uint, int , uchar* , int);
 #endif
index a5c760c711edcca9e278e478cd0c4babbef80b80..33570f5404f144f07ef9ec2682ff9ad2a521d688 100644 (file)
@@ -271,86 +271,6 @@ int i2c_get_chip_offset_len(struct udevice *dev);
  */
 int i2c_deblock(struct udevice *bus);
 
-#ifdef CONFIG_DM_I2C_COMPAT
-/**
- * i2c_probe() - Compatibility function for driver model
- *
- * Calls dm_i2c_probe() on the current bus
- */
-int i2c_probe(uint8_t chip_addr);
-
-/**
- * i2c_read() - Compatibility function for driver model
- *
- * Calls dm_i2c_read() with the device corresponding to @chip_addr, and offset
- * set to @addr. @alen must match the current setting for the device.
- */
-int i2c_read(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
-            int len);
-
-/**
- * i2c_write() - Compatibility function for driver model
- *
- * Calls dm_i2c_write() with the device corresponding to @chip_addr, and offset
- * set to @addr. @alen must match the current setting for the device.
- */
-int i2c_write(uint8_t chip_addr, unsigned int addr, int alen, uint8_t *buffer,
-             int len);
-
-/**
- * i2c_get_bus_num_fdt() - Compatibility function for driver model
- *
- * @return the bus number associated with the given device tree node
- */
-int i2c_get_bus_num_fdt(int node);
-
-/**
- * i2c_get_bus_num() - Compatibility function for driver model
- *
- * @return the 'current' bus number
- */
-unsigned int i2c_get_bus_num(void);
-
-/**
- * i2c_set_bus_num() - Compatibility function for driver model
- *
- * Sets the 'current' bus
- */
-int i2c_set_bus_num(unsigned int bus);
-
-static inline void I2C_SET_BUS(unsigned int bus)
-{
-       i2c_set_bus_num(bus);
-}
-
-static inline unsigned int I2C_GET_BUS(void)
-{
-       return i2c_get_bus_num();
-}
-
-/**
- * i2c_init() - Compatibility function for driver model
- *
- * This function does nothing.
- */
-void i2c_init(int speed, int slaveaddr);
-
-/**
- * board_i2c_init() - Compatibility function for driver model
- *
- * @param blob  Device tree blbo
- * @return the number of I2C bus
- */
-void board_i2c_init(const void *blob);
-
-/*
- * Compatibility functions for driver model.
- */
-uint8_t i2c_reg_read(uint8_t addr, uint8_t reg);
-void i2c_reg_write(uint8_t addr, uint8_t reg, uint8_t val);
-
-#endif
-
 /**
  * struct dm_i2c_ops - driver operations for I2C uclass
  *