summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2018-09-09 01:39:57 +0100
committerAndre Przywara <andre.przywara@arm.com>2018-09-19 09:24:02 +0100
commitdfc0fb272554ea5829fa74c6b75b9e656f55d0b3 (patch)
tree74b4fd77dc28f2457d2bdaa15b137e0762b49f52
parent159c52491af33ff8014ee2fa708804bb75540419 (diff)
drivers: i2c: mentor: move platform code into header files
At the moment we have two I2C stub drivers (for the Allwinner and the Marvell platform), which #include the actual .c driver file. Change this into the more usual design, by renaming and moving the stub drivers into platform specific header files and including these from the actual driver file. The platform specific include directories make sure the driver picks up the right header automatically. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
-rw-r--r--drivers/mentor/i2c/mi2cv.c1
-rw-r--r--plat/allwinner/common/include/mentor_i2c_plat.h (renamed from drivers/allwinner/sunxi_i2c.c)6
-rw-r--r--plat/allwinner/sun50i_h6/platform.mk2
-rw-r--r--plat/marvell/a8k/common/a8k_common.mk4
-rw-r--r--plat/marvell/a8k/common/include/mentor_i2c_plat.h (renamed from drivers/marvell/i2c/a8k_i2c.c)6
5 files changed, 10 insertions, 9 deletions
diff --git a/drivers/mentor/i2c/mi2cv.c b/drivers/mentor/i2c/mi2cv.c
index 1b73e6f1..8ebd9662 100644
--- a/drivers/mentor/i2c/mi2cv.c
+++ b/drivers/mentor/i2c/mi2cv.c
@@ -15,6 +15,7 @@
#include <delay_timer.h>
#include <errno.h>
#include <mentor/mi2cv.h>
+#include <mentor_i2c_plat.h>
#include <mmio.h>
#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
diff --git a/drivers/allwinner/sunxi_i2c.c b/plat/allwinner/common/include/mentor_i2c_plat.h
index cc91ca58..f547f9a4 100644
--- a/drivers/allwinner/sunxi_i2c.c
+++ b/plat/allwinner/common/include/mentor_i2c_plat.h
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
* https://spdx.org/licenses
*/
-
/* This driver provides I2C support for Allwinner sunXi SoCs */
-#include <mmio.h>
+#ifndef SUNXI_I2C_H
+#define SUNXI_I2C_H
#define CONFIG_SYS_TCLK 24000000
#define CONFIG_SYS_I2C_SPEED 100000
@@ -25,4 +25,4 @@ struct mentor_i2c_regs {
uint32_t soft_reset;
};
-#include "../mentor/i2c/mi2cv.c"
+#endif
diff --git a/plat/allwinner/sun50i_h6/platform.mk b/plat/allwinner/sun50i_h6/platform.mk
index c3901d01..90987020 100644
--- a/plat/allwinner/sun50i_h6/platform.mk
+++ b/plat/allwinner/sun50i_h6/platform.mk
@@ -15,8 +15,8 @@ PLAT_INCLUDES := -Iinclude/plat/arm/common \
-I${AW_PLAT}/${PLAT}/include
PLAT_BL_COMMON_SOURCES := drivers/console/${ARCH}/console.S \
+ drivers/mentor/i2c/mi2cv.c \
drivers/ti/uart/${ARCH}/16550_console.S \
- ${AW_DRIVERS}/sunxi_i2c.c \
${XLAT_TABLES_LIB_SRCS} \
${AW_PLAT}/common/plat_helpers.S \
${AW_PLAT}/common/sunxi_common.c
diff --git a/plat/marvell/a8k/common/a8k_common.mk b/plat/marvell/a8k/common/a8k_common.mk
index 5956737d..be2ff1e3 100644
--- a/plat/marvell/a8k/common/a8k_common.mk
+++ b/plat/marvell/a8k/common/a8k_common.mk
@@ -57,9 +57,9 @@ BLE_PORTING_SOURCES := $(PLAT_FAMILY_BASE)/$(PLAT)/board/dram_port.c \
MARVELL_MOCHI_DRV += $(MARVELL_DRV_BASE)/mochi/cp110_setup.c
-BLE_SOURCES := $(PLAT_COMMON_BASE)/plat_ble_setup.c \
+BLE_SOURCES := drivers/mentor/i2c/mi2cv.c \
+ $(PLAT_COMMON_BASE)/plat_ble_setup.c \
$(MARVELL_MOCHI_DRV) \
- $(MARVELL_DRV_BASE)/i2c/a8k_i2c.c \
$(PLAT_COMMON_BASE)/plat_pm.c \
$(MARVELL_DRV_BASE)/thermal.c \
$(PLAT_COMMON_BASE)/plat_thermal.c \
diff --git a/drivers/marvell/i2c/a8k_i2c.c b/plat/marvell/a8k/common/include/mentor_i2c_plat.h
index 1c0f922c..8829a922 100644
--- a/drivers/marvell/i2c/a8k_i2c.c
+++ b/plat/marvell/a8k/common/include/mentor_i2c_plat.h
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: BSD-3-Clause
* https://spdx.org/licenses
*/
-
/* This driver provides I2C support for Marvell A8K and compatible SoCs */
-#include <mmio.h>
+#ifndef A8K_I2C_H
+#define A8K_I2C_H
#define CONFIG_SYS_TCLK 250000000
#define CONFIG_SYS_I2C_SPEED 100000
@@ -30,4 +30,4 @@ struct mentor_i2c_regs {
uint32_t unstuck;
};
-#include "../../mentor/i2c/mi2cv.c"
+#endif