Skip to contentSkip to conversation

ARM: amlogic: add i2c support to Amlogic's gxbb family

PATCH New Jerome Brunet 2 participants 6 messages Sep 14, 2016

Subsystems (4)
lore
Share & tools
lore

Jerome Brunet

author maintainer
#0 lore raw

cover ARM: amlogic: add i2c support to Amlogic's gxbb family

Add support for the meson i2c controller found on the gxbb SoC family This patchset adds 1 i2c in the AO domain and 3 in the EE domain (A,B,C). There is 1 last i2c in the EE domain (D) but it is actually not connected to the pad of the SoC, so there is no point in adding it here.

Patches for the i2c [0] driver and pinctrl [1] have been sent in dedicated series

[0]: http://lkml.kernel.org/r/1473846557-18123-1-git-send-email-jbrunet at baylibre.com [1]: http://lkml.kernel.org/r/1473846328-17339-1-git-send-email-jbrunet at baylibre.com

Jerome Brunet (3):
clk: gxbb: expose i2c clocks
ARM64: dts: meson-gxbb: add pins for I2C
ARM64: dts: gxbb: add i2c bus

Neil Armstrong (1):
ARM64: dts: meson-gxbb: add I2C nodes

 .../arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts |  6 ++
 arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts    |  6 ++
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi        | 72 ++++++++++++++++++++++
 drivers/clk/meson/gxbb.h                           |  4 +-
 include/dt-bindings/clock/gxbb-clkc.h              |  2 +
 5 files changed, 88 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
author maintainer
#1 lore raw

PATCH 1/4 clk: gxbb: expose i2c clocks

I2C and AO_I2C clocks are needed for the i2c driver, expose to DT (and comment out in clk driver)

---
 drivers/clk/meson/gxbb.h              | 4 ++--
 include/dt-bindings/clock/gxbb-clkc.h | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/clk/meson/gxbb.h +2 -2
index 044fc44e9144..0252939ba58f 100644
@@ -190,7 +190,7 @@
 #define CLKID_PL301		  19
 #define CLKID_PERIPHS		  20
 #define CLKID_SPICC		  21
-#define CLKID_I2C		  22
+/* CLKID_I2C */
 #define CLKID_SAR_ADC		  23
 #define CLKID_SMART_CARD	  24
 #define CLKID_RNG0		  25
@@ -261,7 +261,7 @@
 #define CLKID_AO_AHB_SRAM	  90
 #define CLKID_AO_AHB_BUS	  91
 #define CLKID_AO_IFACE		  92
-#define CLKID_AO_I2C		  93
+/* CLKID_AO_I2C */
 /* CLKID_SD_EMMC_A */
 /* CLKID_SD_EMMC_B */
 /* CLKID_SD_EMMC_C */
include/dt-bindings/clock/gxbb-clkc.h +2 -0
index 743c45b40361..baade6f429d0 100644
@@ -13,12 +13,14 @@
 #define CLKID_CLK81		12
 #define CLKID_MPLL2		15
 #define CLKID_SPI		34
+#define CLKID_I2C		22
 #define CLKID_ETH		36
 #define CLKID_USB0		50
 #define CLKID_USB1		51
 #define CLKID_USB		55
 #define CLKID_USB1_DDR_BRIDGE	64
 #define CLKID_USB0_DDR_BRIDGE	65
+#define CLKID_AO_I2C		93
 #define CLKID_SD_EMMC_A		94
 #define CLKID_SD_EMMC_B		95
 #define CLKID_SD_EMMC_C		96
Signature · 1 line
2.7.4
author maintainer
#3 lore raw

PATCH 2/4 ARM64: dts: meson-gxbb: add pins for I2C

In reply to Jerome Brunet
---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 32 +++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +32 -0
index 9506597fcc1c..75aca5013e61 100644
@@ -293,6 +293,14 @@
 					};
 				};
 
+				i2c_ao_pins: i2c_ao {
+					mux {
+						groups = "i2c_sck_ao",
+						       "i2c_sda_ao";
+						function = "i2c_ao";
+					};
+				};
+
 				pwm_ao_a_3_pins: pwm_ao_a_3 {
 					mux {
 						groups = "pwm_ao_a_3";
@@ -455,6 +463,30 @@
 					};
 				};
 
+				i2c_a_pins: i2c_a {
+					mux {
+						groups = "i2c_sck_a",
+						       "i2c_sda_a";
+						function = "i2c_a";
+					};
+				};
+
+				i2c_b_pins: i2c_b {
+					mux {
+						groups = "i2c_sck_b",
+						       "i2c_sda_b";
+						function = "i2c_b";
+					};
+				};
+
+				i2c_c_pins: i2c_c {
+					mux {
+						groups = "i2c_sck_c",
+						       "i2c_sda_c";
+						function = "i2c_c";
+					};
+				};
+
 				eth_pins: eth_c {
 					mux {
 						groups = "eth_mdio",
Signature · 1 line
2.7.4
author maintainer
#4 lore raw

PATCH 3/4 ARM64: dts: meson-gxbb: add I2C nodes

In reply to Jerome Brunet

From: Neil Armstrong <[email protected]>

---
 arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 40 +++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi +40 -0
index 75aca5013e61..4aa59dc2beb9 100644
@@ -242,6 +242,36 @@
 				clocks = <&clkc CLKID_SPI>;
 				status = "disabled";
 			};
+
+			i2c_A: i2c at 8500 {
+				compatible = "amlogic,meson-gxbb-i2c";
+				reg = <0x0 0x08500 0x0 0x20>;
+				interrupts = <GIC_SPI 21 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&clkc CLKID_I2C>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c_B: i2c at 87c0 {
+				compatible = "amlogic,meson-gxbb-i2c";
+				reg = <0x0 0x087c0 0x0 0x20>;
+				interrupts = <GIC_SPI 214 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&clkc CLKID_I2C>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			i2c_C: i2c at 87e0 {
+				compatible = "amlogic,meson-gxbb-i2c";
+				reg = <0x0 0x087e0 0x0 0x20>;
+				interrupts = <GIC_SPI 215 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&clkc CLKID_I2C>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		gic: interrupt-controller at c4301000 {
@@ -358,6 +388,16 @@
 				#pwm-cells = <3>;
 				status = "disabled";
 			};
+
+			i2c_AO: i2c at 500 {
+				compatible = "amlogic,meson-gxbb-i2c";
+				reg = <0x0 0x500 0x0 0x20>;
+				interrupts = <GIC_SPI 195 IRQ_TYPE_EDGE_RISING>;
+				clocks = <&clkc CLKID_AO_I2C>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
 		};
 
 		periphs: periphs at c8834000 {
Signature · 1 line
2.7.4
author maintainer
#5 lore raw

PATCH 4/4 ARM64: dts: gxbb: add i2c bus

In reply to Jerome Brunet

Add nodes for i2c bus on gxbb based platforms.
On the OdroidC2 (I2C A) and P200 (I2C B), the pull-up resistor are present directly on the board. This indicates that these pins are dedicated to i2c.

---
 arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 6 ++++++
 arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts     | 6 ++++++
 2 files changed, 12 insertions(+)
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +6 -0
index 4f1554a27422..c6d78d3a018f 100644
@@ -180,3 +180,9 @@
 	vmmc-supply = <&vcc3v3>;
 	vqmmc-supply = <&vcc1v8>;
 };
+
+&i2c_A {
+	status = "okay";
+	pinctrl-0 = <&i2c_a_pins>;
+	pinctrl-names = "default";
+};
arch/arm64/boot/dts/amlogic/meson-gxbb-p200.dts +6 -0
index 62979076e250..03e3d76626dd 100644
@@ -50,3 +50,9 @@
 	compatible = "amlogic,p200", "amlogic,meson-gxbb";
 	model = "Amlogic Meson GXBB P200 Development Board";
 };
+
+&i2c_B {
+	status = "okay";
+	pinctrl-0 = <&i2c_b_pins>;
+	pinctrl-names = "default";
+};
Signature · 1 line
2.7.4