Skip to contentSkip to conversation

Make designware_i2c driver platform independent

PATCH New Alexey Brodkin 1 participant 4 messages Feb 10, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Make designware_i2c driver platform independent

Currently DW I2C driver required a target platform to have "asm/arch/hardware.h" file. This file doesn't exist for most of platforms so it would be good to remove this requirement.

Alexey Brodkin (3):
spear: move CONFIG_SYS_I2C_BASE from arch-spear/hardware to board
configs
designware_i2c: remove inclusion of <asm/arch/hardware.h>
arc: remove "hardware.h"

 arch/arc/include/asm/arch-arc700/hardware.h | 10 ----------
 arch/arm/include/asm/arch-spear/hardware.h  |  4 ----
 drivers/i2c/designware_i2c.c                |  1 -
 include/configs/spear-common.h              |  9 +++++++++
 include/configs/x600.h                      |  1 +
 5 files changed, 10 insertions(+), 15 deletions(-)
 delete mode 100644 arch/arc/include/asm/arch-arc700/hardware.h
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH 1/3 spear: move CONFIG_SYS_I2C_BASE from arch-spear/hardware to board configs

Having CONFIG_SYS_I2C_BASE requires DW I2C driver to explicitly include <arch/hardware.h> which other platforms may not have at all.

It's always good to have a driver platform-independent.

Cc Tom Rini <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc Armando Visconti <[email protected]>
---
 arch/arm/include/asm/arch-spear/hardware.h | 4 ----
 include/configs/spear-common.h             | 9 +++++++++
 include/configs/x600.h                     | 1 +
 3 files changed, 10 insertions(+), 4 deletions(-)
arch/arm/include/asm/arch-spear/hardware.h +0 -4
index f3afd4d..c6da405 100644
@@ -26,7 +26,6 @@
 #define CONFIG_SYS_NAND_ALE			(1 << 17)
 
 #if defined(CONFIG_SPEAR600)
-#define CONFIG_SYS_I2C_BASE			0xD0200000
 #define CONFIG_SYS_FSMC_BASE			0xD1800000
 #define CONFIG_FSMC_NAND_BASE			0xD2000000
 
@@ -42,11 +41,9 @@
 #define CONFIG_SPEAR_MPMCREGS			100
 
 #elif defined(CONFIG_SPEAR300)
-#define CONFIG_SYS_I2C_BASE			0xD0180000
 #define CONFIG_SYS_FSMC_BASE			0x94000000
 
 #elif defined(CONFIG_SPEAR310)
-#define CONFIG_SYS_I2C_BASE			0xD0180000
 #define CONFIG_SYS_FSMC_BASE			0x44000000
 
 #undef CONFIG_SYS_NAND_CLE
@@ -63,7 +60,6 @@
 #define CONFIG_SYS_MACB3_BASE			0xB1800000
 
 #elif defined(CONFIG_SPEAR320)
-#define CONFIG_SYS_I2C_BASE			0xD0180000
 #define CONFIG_SYS_FSMC_BASE			0x4C000000
 
 #define CONFIG_SPEAR_EMIBASE			0x40000000
include/configs/spear-common.h +9 -0
index e090a37..c0eba37 100644
@@ -39,6 +39,15 @@
 /* I2C driver configuration */
 #define CONFIG_HARD_I2C
 #define CONFIG_DW_I2C
+#if defined(CONFIG_SPEAR600)
+#define CONFIG_SYS_I2C_BASE			0xD0200000
+#elif defined(CONFIG_SPEAR300)
+#define CONFIG_SYS_I2C_BASE			0xD0180000
+#elif defined(CONFIG_SPEAR310)
+#define CONFIG_SYS_I2C_BASE			0xD0180000
+#elif defined(CONFIG_SPEAR320)
+#define CONFIG_SYS_I2C_BASE			0xD0180000
+#endif
 #define CONFIG_SYS_I2C_SPEED			400000
 #define CONFIG_SYS_I2C_SLAVE			0x02
 
include/configs/x600.h +1 -0
index 00b938a..fbdc8cc 100644
@@ -85,6 +85,7 @@
 /* I2C config options */
 #define CONFIG_HARD_I2C
 #define CONFIG_DW_I2C
+#define CONFIG_SYS_I2C_BASE			0xD0200000
 #define CONFIG_SYS_I2C_SPEED			400000
 #define CONFIG_SYS_I2C_SLAVE			0x02
 #define CONFIG_I2C_CHIPADDRESS			0x50
Signature · 1 line
1.8.5.3
#2 lore raw

PATCH 2/3 designware_i2c: remove inclusion of <asm/arch/hardware.h>

In reply to Alexey Brodkin

As soon as all boards have their CONFIG_SYS_I2C_BASE defined in configuration files instead of "asm/arch/hardware.h" it's safe to remove the inclusion in question and make driver platform-independent.

Cc Tom Rini <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc Armando Visconti <[email protected]>
---
 drivers/i2c/designware_i2c.c | 1 -
 1 file changed, 1 deletion(-)
drivers/i2c/designware_i2c.c +0 -1
index 9ed9295..5a78a36 100644
@@ -7,7 +7,6 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/arch/hardware.h>
 #include "designware_i2c.h"
 
 #ifdef CONFIG_I2C_MULTI_BUS
Signature · 1 line
1.8.5.3
#3 lore raw

PATCH 3/3 arc: remove "hardware.h"

In reply to Alexey Brodkin

This file was only required for compilation of designware_i2c driver. Since explicit inclusion of "hardware.h" is now removed from the driver we may safely remove this empty header as well.

Cc Tom Rini <[email protected]>
Cc Heiko Schocher <[email protected]>
Cc Stefan Roese <[email protected]>
Cc Vipin Kumar <[email protected]>
Cc Armando Visconti <[email protected]>
---
 arch/arc/include/asm/arch-arc700/hardware.h | 10 ----------
 1 file changed, 10 deletions(-)
 delete mode 100644 arch/arc/include/asm/arch-arc700/hardware.h
arch/arc/include/asm/arch-arc700/hardware.h deleted +0 -10
deleted file mode 100644
index 8ec13a8..0000000
@@ -1,10 +0,0 @@
-/*
- * Copyright (C) 2014 Synopsys, Inc. All rights reserved.
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-/*
- * This file is only required to allow compilation of "designware_i2c" driver.
- * Which explicitly includes <asm/arch/hardware.h>.
- */
Signature · 1 line
1.8.5.3