Skip to contentSkip to conversation

mips: octeon: Misc Octeon drivers, DT and Kconfig / defconfig updates

PATCH Superseded Stefan Roese 1 participant 7 messages Jul 22, 2020

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover mips: octeon: Misc Octeon drivers, DT and Kconfig / defconfig updates

This patchset includes the following parts:
- Octeon GPIO driver in v3
- New simple Octeon clk driver
- DT updates (GPIO, I2C & CLK nodes)
- Kconfig & defconfig updates

Thanks,
Stefan

Changes in v1:
- Removed common.h and reduced headers as suggested by Daniel

Stefan Roese (5):
mips: octeon: mrvl,cn73xx.dtsi: Add GPIO DT nodes
mips: octeon: dts: Add I2C DT nodes
clk: clk_octeon: Add simple MIPS Octeon clock driver
mips: octeon: dts: Add Octeon clock driver DT nodes
mips: octeon: Update Octeon Kconfig and EBB7304 defconfig

Suneel Garapati (1):
gpio: octeon_gpio: Add GPIO controller driver for Octeon

 arch/mips/Kconfig                        |   7 +-
 arch/mips/dts/mrvl,cn73xx.dtsi           |  56 +++++
 arch/mips/dts/mrvl,octeon-ebb7304.dts    |  12 +-
 configs/octeon_ebb7304_defconfig         |   4 +
 drivers/clk/Kconfig                      |   7 +
 drivers/clk/Makefile                     |   1 +
 drivers/clk/clk_octeon.c                 |  72 +++++++
 drivers/gpio/Kconfig                     |  10 +
 drivers/gpio/Makefile                    |   1 +
 drivers/gpio/octeon_gpio.c               | 250 +++++++++++++++++++++++
 include/dt-bindings/clock/octeon-clock.h |  12 ++
 11 files changed, 429 insertions(+), 3 deletions(-)
 create mode 100644 drivers/clk/clk_octeon.c
 create mode 100644 drivers/gpio/octeon_gpio.c
 create mode 100644 include/dt-bindings/clock/octeon-clock.h
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/6 gpio: octeon_gpio: Add GPIO controller driver for Octeon

From: Suneel Garapati <[email protected]>

Add support for GPIO controllers found on Octeon II/III and Octeon TX TX2 SoC platforms.

---

Changes in v1:
- Removed common.h and reduced headers as suggested by Daniel

 drivers/gpio/Kconfig       |  10 ++
 drivers/gpio/Makefile      |   1 +
 drivers/gpio/octeon_gpio.c | 250 +++++++++++++++++++++++++++++++++++++
 3 files changed, 261 insertions(+)
 create mode 100644 drivers/gpio/octeon_gpio.c
drivers/gpio/Kconfig +10 -0
index 0e8ad9530d..18cf918b94 100644
@@ -335,6 +335,16 @@ config PIC32_GPIO
 	help
 	  Say yes here to support Microchip PIC32 GPIOs.
 
+config OCTEON_GPIO
+	bool "Octeon II/III/TX/TX2 GPIO driver"
+	depends on DM_GPIO && (ARCH_OCTEON || ARCH_OCTEONTX || ARCH_OCTEONTX2)
+	default y
+	help
+	  Add support for the Marvell Octeon GPIO driver. This is used with
+	  various Octeon parts such as Octeon II/III and OcteonTX/TX2.
+	  Octeon II/III has 32 GPIOs (count defined via DT) and OcteonTX/TX2
+	  has 64 GPIOs (count defined via internal register).
+
 config STM32_GPIO
 	bool "ST STM32 GPIO driver"
 	depends on DM_GPIO && (ARCH_STM32 || ARCH_STM32MP)
drivers/gpio/Makefile +1 -0
index 7638259007..eb6364adb4 100644
@@ -58,6 +58,7 @@ obj-$(CONFIG_HIKEY_GPIO)	+= hi6220_gpio.o
 obj-$(CONFIG_HSDK_CREG_GPIO)	+= hsdk-creg-gpio.o
 obj-$(CONFIG_IMX_RGPIO2P)	+= imx_rgpio2p.o
 obj-$(CONFIG_PIC32_GPIO)	+= pic32_gpio.o
+obj-$(CONFIG_OCTEON_GPIO)	+= octeon_gpio.o
 obj-$(CONFIG_MVEBU_GPIO)	+= mvebu_gpio.o
 obj-$(CONFIG_MSM_GPIO)		+= msm_gpio.o
 obj-$(CONFIG_$(SPL_)PCF8575_GPIO)	+= pcf8575_gpio.o
drivers/gpio/octeon_gpio.c new file +250 -0

250 lines not on this page · raw message

Signature · 1 line
2.27.0
#2 lore raw

PATCH 2/6 mips: octeon: mrvl,cn73xx.dtsi: Add GPIO DT nodes

In reply to Stefan Roese

Add the Octeon GPIO DT node to the dtsi file.

---

 arch/mips/dts/mrvl,cn73xx.dtsi | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
arch/mips/dts/mrvl,cn73xx.dtsi +26 -0
index a7bd55f8ad..8d32a49795 100644
@@ -38,6 +38,32 @@
 			#size-cells = <1>;
 		};
 
+		gpio: gpio-controller at 1070000000800 {
+			#gpio-cells = <2>;
+			compatible = "cavium,octeon-7890-gpio";
+			reg = <0x10700 0x00000800 0x0 0x100>;
+			gpio-controller;
+			nr-gpios = <32>;
+			/* Interrupts are specified by two parts:
+			 * 1) GPIO pin number (0..15)
+			 * 2) Triggering (1 - edge rising
+			 *		  2 - edge falling
+			 *		  4 - level active high
+			 *		  8 - level active low)
+			 */
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			/* The GPIO pins connect to 16 consecutive CUI bits */
+			interrupts = <0x03000 4>, <0x03001 4>,
+				     <0x03002 4>, <0x03003 4>,
+				     <0x03004 4>, <0x03005 4>,
+				     <0x03006 4>, <0x03007 4>,
+				     <0x03008 4>, <0x03009 4>,
+				     <0x0300a 4>, <0x0300b 4>,
+				     <0x0300c 4>, <0x0300d 4>,
+				     <0x0300e 4>, <0x0300f 4>;
+		};
+
 		reset: reset at 1180006001600 {
 			compatible = "mrvl,cn7xxx-rst";
 			reg = <0x11800 0x06001600 0x0 0x200>;
Signature · 1 line
2.27.0
#3 lore raw

PATCH 3/6 mips: octeon: dts: Add I2C DT nodes

In reply to Stefan Roese

Add I2C DT nodes to the Octeon dts / dtsi files.

---

 arch/mips/dts/mrvl,cn73xx.dtsi        | 20 ++++++++++++++++++++
 arch/mips/dts/mrvl,octeon-ebb7304.dts | 10 ++++++++++
 2 files changed, 30 insertions(+)
arch/mips/dts/mrvl,cn73xx.dtsi +20 -0
index 8d32a49795..4c7b6e4160 100644
@@ -86,5 +86,25 @@
 			reg-shift = <3>;
 			interrupts = <0x08040 4>;
 		};
+
+		i2c0: i2c at 1180000001000 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			compatible = "cavium,octeon-7890-twsi";
+			reg = <0x11800 0x00001000 0x0 0x200>;
+			/* INT_ST, INT_TS, INT_CORE */
+			interrupts = <0x0b000 1>, <0x0b001 1>, <0x0b002 1>;
+			clock-frequency = <100000>;
+		};
+
+		i2c1: i2c at 1180000001200 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			compatible = "cavium,octeon-7890-twsi";
+			reg = <0x11800 0x00001200 0x0 0x200>;
+			/* INT_ST, INT_TS, INT_CORE */
+			interrupts = <0x0b100 1>, <0x0b101 1>, <0x0b102 1>;
+			clock-frequency = <100000>;
+		};
 	};
 };
arch/mips/dts/mrvl,octeon-ebb7304.dts +10 -0
index 4e9c2de7d4..096e5c8f66 100644
@@ -94,3 +94,13 @@
 &uart0 {
 	clock-frequency = <1200000000>;
 };
+
+&i2c0 {
+	u-boot,dm-pre-reloc;	/* Needed early for DDR SPD EEPROM */
+	clock-frequency = <100000>;
+};
+
+&i2c1 {
+	u-boot,dm-pre-reloc;	/* Needed early for DDR SPD EEPROM */
+	clock-frequency = <100000>;
+};
Signature · 1 line
2.27.0
#4 lore raw

PATCH 4/6 clk: clk_octeon: Add simple MIPS Octeon clock driver

In reply to Stefan Roese

This patch adds a simple clock driver for the Marvell Octeon MIPS SoC family. Its for IO clock rate passing via DT in some of the Octeon driver, like I2C. So that we don't need to use the non-mainline API octeon_get_io_clock().

Cc Lukasz Majewski <[email protected]>

---

 drivers/clk/Kconfig                      |  7 +++
 drivers/clk/Makefile                     |  1 +
 drivers/clk/clk_octeon.c                 | 72 ++++++++++++++++++++++++
 include/dt-bindings/clock/octeon-clock.h | 12 ++++
 4 files changed, 92 insertions(+)
 create mode 100644 drivers/clk/clk_octeon.c
 create mode 100644 include/dt-bindings/clock/octeon-clock.h
drivers/clk/Kconfig +7 -0
index 82cb1874e1..6003e140b5 100644
@@ -83,6 +83,13 @@ config CLK_INTEL
 	  set up by U-Boot itself but only statically. Thus the driver does not
 	  support changing clock rates, only querying them.
 
+config CLK_OCTEON
+	bool "Clock controller driver for Marvell MIPS Octeon"
+	depends on CLK && ARCH_OCTEON
+	default y
+	help
+	  Enable this to support the clocks on Octeon MIPS platforms.
+
 config CLK_STM32F
 	bool "Enable clock driver support for STM32F family"
 	depends on CLK && (STM32F7 || STM32F4)
drivers/clk/Makefile +1 -0
index d911954581..cda4b4b605 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_$(SPL_TPL_)CLK_INTEL) += intel/
 obj-$(CONFIG_CLK_HSDK) += clk-hsdk-cgu.o
 obj-$(CONFIG_CLK_K210) += kendryte/
 obj-$(CONFIG_CLK_MPC83XX) += mpc83xx_clk.o
+obj-$(CONFIG_CLK_OCTEON) += clk_octeon.o
 obj-$(CONFIG_CLK_OWL) += owl/
 obj-$(CONFIG_CLK_RENESAS) += renesas/
 obj-$(CONFIG_CLK_SIFIVE) += sifive/
drivers/clk/clk_octeon.c new file +72 -0

72 lines not on this page · raw message

include/dt-bindings/clock/octeon-clock.h new file +12 -0
new file mode 100644
index 0000000000..34e6a3bf41
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2020 Stefan Roese <[email protected]>
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_OCTEON_CLOCK_H
+#define __DT_BINDINGS_CLOCK_OCTEON_CLOCK_H
+
+#define OCTEON_CLK_CORE		0
+#define OCTEON_CLK_IO		1
+
+#endif /* __DT_BINDINGS_CLOCK_OCTEON_CLOCK_H */
Signature · 1 line
2.27.0
#5 lore raw

PATCH 5/6 mips: octeon: dts: Add Octeon clock driver DT nodes

In reply to Stefan Roese

This patch adds the DT nodes for the Octeon clock support via the common clk_ API.

---

 arch/mips/dts/mrvl,cn73xx.dtsi        | 10 ++++++++++
 arch/mips/dts/mrvl,octeon-ebb7304.dts |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)
arch/mips/dts/mrvl,cn73xx.dtsi +10 -0
index 4c7b6e4160..7c0a8d73f0 100644
@@ -5,6 +5,8 @@
 
 /dts-v1/;
 
+#include <dt-bindings/clock/octeon-clock.h>
+
 / {
 	#address-cells = <2>;
 	#size-cells = <2>;
@@ -38,6 +40,12 @@
 			#size-cells = <1>;
 		};
 
+		clk: clock {
+			compatible = "mrvl,octeon-clk";
+			#clock-cells = <1>;
+			u-boot,dm-pre-reloc;
+		};
+
 		gpio: gpio-controller at 1070000000800 {
 			#gpio-cells = <2>;
 			compatible = "cavium,octeon-7890-gpio";
@@ -95,6 +103,7 @@
 			/* INT_ST, INT_TS, INT_CORE */
 			interrupts = <0x0b000 1>, <0x0b001 1>, <0x0b002 1>;
 			clock-frequency = <100000>;
+			clocks = <&clk OCTEON_CLK_IO>;
 		};
 
 		i2c1: i2c at 1180000001200 {
@@ -105,6 +114,7 @@
 			/* INT_ST, INT_TS, INT_CORE */
 			interrupts = <0x0b100 1>, <0x0b101 1>, <0x0b102 1>;
 			clock-frequency = <100000>;
+			clocks = <&clk OCTEON_CLK_IO>;
 		};
 	};
 };
arch/mips/dts/mrvl,octeon-ebb7304.dts +1 -1
index 096e5c8f66..c229aa5fc0 100644
@@ -5,7 +5,7 @@
 
 /dts-v1/;
 
-/include/ "mrvl,cn73xx.dtsi"
+#include "mrvl,cn73xx.dtsi"
 
 / {
 	model = "cavium,ebb7304";
Signature · 1 line
2.27.0
#6 lore raw

PATCH 6/6 mips: octeon: Update Octeon Kconfig and EBB7304 defconfig

In reply to Stefan Roese

This patch selects DM_PCI, DM_GPIO and DM_SPI for MIPS Octeon. It also enables PCI and SPI and the matching commands in the EBB7304 defconfig file.

This needs to be done in one patch, as the Kconfig change depends on the defconfig change and vice versa.

---

 arch/mips/Kconfig                | 7 +++++--
 configs/octeon_ebb7304_defconfig | 4 ++++
 2 files changed, 9 insertions(+), 2 deletions(-)
arch/mips/Kconfig +5 -2
index 997e145450..52a49a8541 100644
@@ -112,9 +112,12 @@ config ARCH_OCTEON
 	select DISPLAY_CPUINFO
 	select DMA_ADDR_T_64BIT
 	select DM
-	select DM_SERIAL
-	select DM_GPIO
 	select DM_ETH
+	select DM_GPIO
+	select DM_I2C
+	select DM_PCI
+	select DM_SERIAL
+	select DM_SPI
 	select MIPS_L2_CACHE
 	select MIPS_MACH_EARLY_INIT
 	select MIPS_TUNE_OCTEON3
configs/octeon_ebb7304_defconfig +4 -0
index d810b1e45f..e6ab4e0211 100644
@@ -12,6 +12,8 @@ CONFIG_ARCH_OCTEON=y
 CONFIG_DEBUG_UART=y
 CONFIG_SYS_CONSOLE_INFO_QUIET=y
 CONFIG_HUSH_PARSER=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_I2C=y
 CONFIG_CMD_MTD=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_DHCP=y
@@ -30,9 +32,11 @@ CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
 CONFIG_FLASH_CFI_MTD=y
 CONFIG_SYS_FLASH_CFI=y
 # CONFIG_NETDEVICES is not set
+CONFIG_PCI=y
 CONFIG_DEBUG_UART_SHIFT=3
 CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_SYS_NS16550=y
+CONFIG_SPI=y
 CONFIG_SYSRESET=y
 CONFIG_SYSRESET_OCTEON=y
 CONFIG_HEXDUMP=y
Signature · 1 line
2.27.0