Skip to contentSkip to conversation

GPIO support for Meson GXBB and Odroid-C2

PATCH Superseded Beniamino Galvani 4 participants 9 messages Jun 25, 2017 – Jul 7, 2017

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover GPIO support for Meson GXBB and Odroid-C2

Hi,

this series adds a GPIO driver for Meson GXBB and enables it on Odroid-C2.

Beniamino Galvani (3):
arm: dts: meson: import dts files from Linux 4.12-rc6
pinctrl: meson: add GPIO support
odroid-c2: enable GPIO

 arch/arm/dts/meson-gx.dtsi                 |  97 +++++++++++++--
 arch/arm/dts/meson-gxbb-odroidc2.dts       |  82 ++++++++++++-
 arch/arm/dts/meson-gxbb.dtsi               | 187 ++++++++++++++++++++++++-----
 configs/odroid-c2_defconfig                |   2 +
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c |  21 ++++
 drivers/pinctrl/meson/pinctrl-meson.c      | 167 +++++++++++++++++++++++++-
 drivers/pinctrl/meson/pinctrl-meson.h      |  63 ++++++++++
 include/dt-bindings/clock/gxbb-clkc.h      |  14 ++-
 8 files changed, 586 insertions(+), 47 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

PATCH 1/3 arm: dts: meson: import dts files from Linux 4.12-rc6

Import Amlogic Meson DTS files from Linux kernel version 4.12-rc6.

---
 arch/arm/dts/meson-gx.dtsi            |  97 ++++++++++++++++--
 arch/arm/dts/meson-gxbb-odroidc2.dts  |  82 ++++++++++++++-
 arch/arm/dts/meson-gxbb.dtsi          | 187 ++++++++++++++++++++++++++++------
 include/dt-bindings/clock/gxbb-clkc.h |  14 ++-
 4 files changed, 335 insertions(+), 45 deletions(-)
arch/arm/dts/meson-gx.dtsi +87 -10
index c129100..436b875 100644
@@ -71,6 +71,14 @@
 			reg = <0x0 0x10000000 0x0 0x200000>;
 			no-map;
 		};
+
+		linux,cma {
+			compatible = "shared-dma-pool";
+			reusable;
+			size = <0x0 0xbc00000>;
+			alignment = <0x0 0x400000>;
+			linux,cma-default;
+		};
 	};
 
 	cpus {
@@ -233,7 +241,7 @@
 			};
 
 			i2c_A: i2c at 8500 {
-				compatible = "amlogic,meson-gxbb-i2c";
+				compatible = "amlogic,meson-gx-i2c", "amlogic,meson-gxbb-i2c";
 				reg = <0x0 0x08500 0x0 0x20>;
 				interrupts = <GIC_SPI 21 IRQ_TYPE_EDGE_RISING>;
 				#address-cells = <1>;
@@ -255,6 +263,14 @@
 				status = "disabled";
 			};
 
+			saradc: adc at 8680 {
+				compatible = "amlogic,meson-saradc";
+				reg = <0x0 0x8680 0x0 0x34>;
+				#io-channel-cells = <1>;
+				interrupts = <GIC_SPI 73 IRQ_TYPE_EDGE_RISING>;
+				status = "disabled";
+			};
+
 			pwm_ef: pwm at 86c0 {
 				compatible = "amlogic,meson-gx-pwm", "amlogic,meson-gxbb-pwm";
 				reg = <0x0 0x086c0 0x0 0x10>;
@@ -271,7 +287,7 @@
 			};
 
 			i2c_B: i2c at 87c0 {
-				compatible = "amlogic,meson-gxbb-i2c";
+				compatible = "amlogic,meson-gx-i2c", "amlogic,meson-gxbb-i2c";
 				reg = <0x0 0x087c0 0x0 0x20>;
 				interrupts = <GIC_SPI 214 IRQ_TYPE_EDGE_RISING>;
 				#address-cells = <1>;
@@ -280,7 +296,7 @@
 			};
 
 			i2c_C: i2c at 87e0 {
-				compatible = "amlogic,meson-gxbb-i2c";
+				compatible = "amlogic,meson-gx-i2c", "amlogic,meson-gxbb-i2c";
 				reg = <0x0 0x087e0 0x0 0x20>;
 				interrupts = <GIC_SPI 215 IRQ_TYPE_EDGE_RISING>;
 				#address-cells = <1>;
@@ -288,6 +304,14 @@
 				status = "disabled";
 			};
 
+			spifc: spi at 8c80 {
+				compatible = "amlogic,meson-gx-spifc", "amlogic,meson-gxbb-spifc";
+				reg = <0x0 0x08c80 0x0 0x80>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
 			watchdog at 98d0 {
 				compatible = "amlogic,meson-gx-wdt", "amlogic,meson-gxbb-wdt";
 				reg = <0x0 0x098d0 0x0 0x10>;
@@ -309,7 +333,7 @@
 		};
 
 		sram: sram at c8000000 {
-			compatible = "amlogic,meson-gxbb-sram", "mmio-sram";
+			compatible = "amlogic,meson-gx-sram", "amlogic,meson-gxbb-sram", "mmio-sram";
 			reg = <0x0 0xc8000000 0x0 0x14000>;
 
 			#address-cells = <1>;
@@ -317,12 +341,12 @@
 			ranges = <0 0x0 0xc8000000 0x14000>;
 
 			cpu_scp_lpri: scp-shmem at 0 {
-				compatible = "amlogic,meson-gxbb-scp-shmem";
+				compatible = "amlogic,meson-gx-scp-shmem", "amlogic,meson-gxbb-scp-shmem";
 				reg = <0x13000 0x400>;
 			};
 
 			cpu_scp_hpri: scp-shmem at 200 {
-				compatible = "amlogic,meson-gxbb-scp-shmem";
+				compatible = "amlogic,meson-gx-scp-shmem", "amlogic,meson-gxbb-scp-shmem";
 				reg = <0x13400 0x400>;
 			};
 		};
@@ -334,6 +358,13 @@
 			#size-cells = <2>;
 			ranges = <0x0 0x0 0x0 0xc8100000 0x0 0x100000>;
 
+			clkc_AO: clock-controller at 040 {
+				compatible = "amlogic,gx-aoclkc", "amlogic,gxbb-aoclkc";
+				reg = <0x0 0x00040 0x0 0x4>;
+				#clock-cells = <1>;
+				#reset-cells = <1>;
+			};
+
 			uart_AO: serial at 4c0 {
 				compatible = "amlogic,meson-uart";
 				reg = <0x0 0x004c0 0x0 0x14>;
@@ -350,8 +381,24 @@
 				status = "disabled";
 			};
 
+			i2c_AO: i2c at 500 {
+				compatible = "amlogic,meson-gx-i2c", "amlogic,meson-gxbb-i2c";
+				reg = <0x0 0x500 0x0 0x20>;
+				interrupts = <GIC_SPI 195 IRQ_TYPE_EDGE_RISING>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+
+			pwm_AO_ab: pwm at 550 {
+				compatible = "amlogic,meson-gx-pwm", "amlogic,meson-gxbb-pwm";
+				reg = <0x0 0x00550 0x0 0x10>;
+				#pwm-cells = <3>;
+				status = "disabled";
+			};
+
 			ir: ir at 580 {
-				compatible = "amlogic,meson-gxbb-ir";
+				compatible = "amlogic,meson-gx-ir", "amlogic,meson-gxbb-ir";
 				reg = <0x0 0x00580 0x0 0x40>;
 				interrupts = <GIC_SPI 196 IRQ_TYPE_EDGE_RISING>;
 				status = "disabled";
@@ -365,13 +412,12 @@
 			#size-cells = <2>;
 			ranges = <0x0 0x0 0x0 0xc8834000 0x0 0x2000>;
 
-			rng {
+			hwrng: rng {
 				compatible = "amlogic,meson-rng";
 				reg = <0x0 0x0 0x0 0x4>;
 			};
 		};
 
-
 		hiubus: hiubus at c883c000 {
 			compatible = "simple-bus";
 			reg = <0x0 0xc883c000 0x0 0x2000>;
@@ -395,7 +441,6 @@
 			       0x0 0xc8834540 0x0 0x4>;
 			interrupts = <0 8 1>;
 			interrupt-names = "macirq";
-			phy-mode = "rgmii";
 			status = "disabled";
 		};
 
@@ -442,6 +487,38 @@
 			cvbs_vdac_port: port at 0 {
 				reg = <0>;
 			};
+
+			/* HDMI-TX output port */
+			hdmi_tx_port: port at 1 {
+				reg = <1>;
+
+				hdmi_tx_out: endpoint {
+					remote-endpoint = <&hdmi_tx_in>;
+				};
+			};
+		};
+
+		hdmi_tx: hdmi-tx at c883a000 {
+			compatible = "amlogic,meson-gx-dw-hdmi";
+			reg = <0x0 0xc883a000 0x0 0x1c>;
+			interrupts = <GIC_SPI 57 IRQ_TYPE_EDGE_RISING>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "disabled";
+
+			/* VPU VENC Input */
+			hdmi_tx_venc_port: port at 0 {
+				reg = <0>;
+
+				hdmi_tx_in: endpoint {
+					remote-endpoint = <&hdmi_tx_out>;
+				};
+			};
+
+			/* TMDS Output */
+			hdmi_tx_tmds_port: port at 1 {
+				reg = <1>;
+			};
 		};
 	};
 };
arch/arm/dts/meson-gxbb-odroidc2.dts +80 -2

118 lines not on this page · raw message

arch/arm/dts/meson-gxbb.dtsi +155 -32

242 lines not on this page · raw message

include/dt-bindings/clock/gxbb-clkc.h +13 -1
index 692846c..3190e30 100644
@@ -10,12 +10,18 @@
 #define CLKID_FCLK_DIV2		4
 #define CLKID_FCLK_DIV3		5
 #define CLKID_FCLK_DIV4		6
+#define CLKID_GP0_PLL		9
 #define CLKID_CLK81		12
 #define CLKID_MPLL2		15
-#define CLKID_SPI		34
 #define CLKID_I2C		22
 #define CLKID_SAR_ADC		23
+#define CLKID_RNG0		25
+#define CLKID_SPI		34
 #define CLKID_ETH		36
+#define CLKID_AIU_GLUE		38
+#define CLKID_I2S_OUT		40
+#define CLKID_MIXER_IFACE	44
+#define CLKID_AIU		47
 #define CLKID_USB0		50
 #define CLKID_USB1		51
 #define CLKID_USB		55
@@ -24,11 +30,17 @@
 #define CLKID_USB0_DDR_BRIDGE	65
 #define CLKID_SANA		69
 #define CLKID_GCLK_VENCI_INT0	77
+#define CLKID_AOCLK_GATE	80
 #define CLKID_AO_I2C		93
 #define CLKID_SD_EMMC_A		94
 #define CLKID_SD_EMMC_B		95
 #define CLKID_SD_EMMC_C		96
 #define CLKID_SAR_ADC_CLK	97
 #define CLKID_SAR_ADC_SEL	98
+#define CLKID_MALI_0_SEL	100
+#define CLKID_MALI_0		102
+#define CLKID_MALI_1_SEL	103
+#define CLKID_MALI_1		105
+#define CLKID_MALI		106
 
 #endif /* __GXBB_CLKC_H */
Signature · 1 line
2.9.3
#2 lore raw

PATCH 1/3 arm: dts: meson: import dts files from Linux 4.12-rc6

Quoted 9 lines · Beniamino Galvani

Import Amlogic Meson DTS files from Linux kernel version 4.12-rc6.

---
 arch/arm/dts/meson-gx.dtsi            |  97 ++++++++++++++++--
 arch/arm/dts/meson-gxbb-odroidc2.dts  |  82 ++++++++++++++-
 arch/arm/dts/meson-gxbb.dtsi          | 187 ++++++++++++++++++++++++++++------
 include/dt-bindings/clock/gxbb-clkc.h |  14 ++-
 4 files changed, 335 insertions(+), 45 deletions(-)
#3 lore raw

PATCH 2/3 pinctrl: meson: add GPIO support

In reply to Beniamino Galvani

This commit adds GPIO support to the Amlogic Meson pin controller driver, based on code from Linux kernel.

---
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c |  21 ++++
 drivers/pinctrl/meson/pinctrl-meson.c      | 167 ++++++++++++++++++++++++++++-
 drivers/pinctrl/meson/pinctrl-meson.h      |  63 +++++++++++
 3 files changed, 249 insertions(+), 2 deletions(-)
drivers/pinctrl/meson/pinctrl-meson-gxbb.c +21 -0
index 2fa840c..87c9912 100644
@@ -391,14 +391,33 @@ static struct meson_pmx_func meson_gxbb_aobus_functions[] = {
 	FUNCTION(i2c_slave_ao),
 };
 
+static struct meson_bank meson_gxbb_periphs_banks[] = {
+	/*   name    first                      last                    pullen  pull    dir     out     in  */
+	BANK("X",    PIN(GPIOX_0, EE_OFF),	PIN(GPIOX_22, EE_OFF),  4,  0,  4,  0,  12, 0,  13, 0,  14, 0),
+	BANK("Y",    PIN(GPIOY_0, EE_OFF),	PIN(GPIOY_16, EE_OFF),  1,  0,  1,  0,  3,  0,  4,  0,  5,  0),
+	BANK("DV",   PIN(GPIODV_0, EE_OFF),	PIN(GPIODV_29, EE_OFF), 0,  0,  0,  0,  0,  0,  1,  0,  2,  0),
+	BANK("H",    PIN(GPIOH_0, EE_OFF),	PIN(GPIOH_3, EE_OFF),   1, 20,  1, 20,  3, 20,  4, 20,  5, 20),
+	BANK("Z",    PIN(GPIOZ_0, EE_OFF),	PIN(GPIOZ_15, EE_OFF),  3,  0,  3,  0,  9,  0,  10, 0, 11,  0),
+	BANK("CARD", PIN(CARD_0, EE_OFF),	PIN(CARD_6, EE_OFF),    2, 20,  2, 20,  6, 20,  7, 20,  8, 20),
+	BANK("BOOT", PIN(BOOT_0, EE_OFF),	PIN(BOOT_17, EE_OFF),   2,  0,  2,  0,  6,  0,  7,  0,  8,  0),
+	BANK("CLK",  PIN(GPIOCLK_0, EE_OFF),	PIN(GPIOCLK_3, EE_OFF), 3, 28,  3, 28,  9, 28, 10, 28, 11, 28),
+};
+
+static struct meson_bank meson_gxbb_aobus_banks[] = {
+	/*   name    first              last               pullen  pull    dir     out     in  */
+	BANK("AO",   PIN(GPIOAO_0, 0),  PIN(GPIOAO_13, 0), 0,  0,  0, 16,  0,  0,  0, 16,  1,  0),
+};
+
 struct meson_pinctrl_data meson_gxbb_periphs_pinctrl_data = {
 	.name		= "periphs-banks",
 	.pin_base	= 14,
 	.groups		= meson_gxbb_periphs_groups,
 	.funcs		= meson_gxbb_periphs_functions,
+	.banks		= meson_gxbb_periphs_banks,
 	.num_pins	= 120,
 	.num_groups	= ARRAY_SIZE(meson_gxbb_periphs_groups),
 	.num_funcs	= ARRAY_SIZE(meson_gxbb_periphs_functions),
+	.num_banks	= ARRAY_SIZE(meson_gxbb_periphs_banks),
 };
 
 struct meson_pinctrl_data meson_gxbb_aobus_pinctrl_data = {
@@ -406,9 +425,11 @@ struct meson_pinctrl_data meson_gxbb_aobus_pinctrl_data = {
 	.pin_base	= 0,
 	.groups		= meson_gxbb_aobus_groups,
 	.funcs		= meson_gxbb_aobus_functions,
+	.banks		= meson_gxbb_aobus_banks,
 	.num_pins	= 14,
 	.num_groups	= ARRAY_SIZE(meson_gxbb_aobus_groups),
 	.num_funcs	= ARRAY_SIZE(meson_gxbb_aobus_functions),
+	.num_banks	= ARRAY_SIZE(meson_gxbb_aobus_banks),
 };
 
 static const struct udevice_id meson_gxbb_pinctrl_match[] = {
drivers/pinctrl/meson/pinctrl-meson.c +165 -2

200 lines not on this page · raw message

drivers/pinctrl/meson/pinctrl-meson.h +63 -0

84 lines not on this page · raw message

Signature · 1 line
2.9.3
#4 lore raw

PATCH 2/3 pinctrl: meson: add GPIO support

Quoted 9 lines · Beniamino Galvani

This commit adds GPIO support to the Amlogic Meson pin controller driver, based on code from Linux kernel.

---
 drivers/pinctrl/meson/pinctrl-meson-gxbb.c |  21 ++++
 drivers/pinctrl/meson/pinctrl-meson.c      | 167 ++++++++++++++++++++++++++++-
 drivers/pinctrl/meson/pinctrl-meson.h      |  63 +++++++++++
 3 files changed, 249 insertions(+), 2 deletions(-)

You might want to consider supporting livetree with new drivers.

#5 lore raw

PATCH 3/3 odroid-c2: enable GPIO

In reply to Beniamino Galvani

GPIOs are now supported on Meson GXBB, enable driver and command in the config.

---
 configs/odroid-c2_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/odroid-c2_defconfig +2 -0
index 547cd52..cf06715 100644
@@ -13,9 +13,11 @@ CONFIG_DEBUG_UART=y
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_FPGA is not set
+CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_OF_CONTROL=y
 CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_DM_ETH=y
Signature · 1 line
2.9.3
#6 lore raw

PATCH 3/3 odroid-c2: enable GPIO

Quoted 14 lines · Beniamino Galvani

GPIOs are now supported on Meson GXBB, enable driver and command in the config.

---
 configs/odroid-c2_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/odroid-c2_defconfig +0 -0
index 547cd52..cf06715 100644
@@ -13,9 +13,11 @@ CONFIG_DEBUG_UART=y
 # CONFIG_CMD_LOADS is not set

configs/odroid-c2_defconfig CONFIG_DEBUG_UART=y · line 23

Quoted 10 lines
configs/odroid-c2_defconfig +2 -0
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_FPGA is not set
+CONFIG_CMD_GPIO=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_OF_CONTROL=y
 CONFIG_NET_RANDOM_ETHADDR=y
+CONFIG_DM_GPIO=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_MESON_GX=y
 CONFIG_DM_ETH=y

Some part of this series needs to introduce asm/arch/gpio.h and is not, so it fails to build.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-amlogic/attachments/20170706/e6d6ae22/attachment.sig>
maintainer
#7 lore raw

cover GPIO support for Meson GXBB and Odroid-C2

In reply to Beniamino Galvani
Quoted 19 lines · Beniamino Galvani

Hi,

this series adds a GPIO driver for Meson GXBB and enables it on Odroid-C2.

Beniamino Galvani (3):
? arm: dts: meson: import dts files from Linux 4.12-rc6 ? pinctrl: meson: add GPIO support
? odroid-c2: enable GPIO

?arch/arm/dts/meson-gx.dtsi?????????????????|??97 +++++++++++++--
?arch/arm/dts/meson-gxbb-odroidc2.dts???????|??82 ++++++++++++-
?arch/arm/dts/meson-gxbb.dtsi???????????????| 187 ++++++++++++++++++++++++--
---
?configs/odroid-c2_defconfig????????????????|???2 +
?drivers/pinctrl/meson/pinctrl-meson-gxbb.c |??21 ++++
?drivers/pinctrl/meson/pinctrl-meson.c??????| 167 +++++++++++++++++++++++++-
?drivers/pinctrl/meson/pinctrl-meson.h??????|??63 ++++++++++
?include/dt-bindings/clock/gxbb-clkc.h??????|??14 ++-
Quoted 4 lines

?8 files changed, 586 insertions(+), 47 deletions(-)

From the recipient list, I'm guessing this patch is addressed to the u-boot

community, right ?

Would you mind stating it a bit more clearly next time ? especially if you include linux-amlogic list.

Thx
Jerome

#8 lore raw

cover GPIO support for Meson GXBB and Odroid-C2

Quoted 2 lines · Jerome Brunet

From the recipient list, I'm guessing this patch is addressed to the u-boot community, right ?

Correct.

Quoted 2 lines

Would you mind stating it a bit more clearly next time ? especially if you include linux-amlogic list.

Yeah, I'll do next time.

Thanks,
Beniamino