Skip to contentSkip to conversation

clk: mediatek: Add MT8175 clock driver

PATCH New Fabien Parent 2 participants 6 messages Mar 29, 2021 – Mar 30, 2021

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

PATCH 1/3 clk: mediatek: Add MT8175 clock driver

Add the topckgen, apmixedsys and infracfg clock driver for the MT8175 SoC.

---
 drivers/clk/mediatek/Makefile          |   1 +
 drivers/clk/mediatek/clk-mt8175.c      | 785 +++++++++++++++++++++++++
 include/dt-bindings/clock/mt8175-clk.h | 392 ++++++++++++
 3 files changed, 1178 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8175.c
 create mode 100644 include/dt-bindings/clock/mt8175-clk.h
drivers/clk/mediatek/Makefile +1 -0
index 522e72422144..0f3135eca39c 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_MT8512) += clk-mt8512.o
 obj-$(CONFIG_TARGET_MT7623) += clk-mt7623.o
 obj-$(CONFIG_TARGET_MT7622) += clk-mt7622.o
 obj-$(CONFIG_TARGET_MT7629) += clk-mt7629.o
+obj-$(CONFIG_TARGET_MT8175) += clk-mt8175.o
 obj-$(CONFIG_TARGET_MT8183) += clk-mt8183.o
 obj-$(CONFIG_TARGET_MT8516) += clk-mt8516.o
 obj-$(CONFIG_TARGET_MT8518) += clk-mt8518.o
drivers/clk/mediatek/clk-mt8175.c new file +785 -0

785 lines not on this page · raw message

include/dt-bindings/clock/mt8175-clk.h new file +392 -0

392 lines not on this page · raw message

Signature · 1 line
2.31.0
#1 lore raw

PATCH 2/3 ARM: mediatek: Add MT8175 support

Add MT8175 SoC support.

---
 arch/arm/dts/mt8175.dtsi               | 247 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |   9 +
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8175/Makefile |   3 +
 arch/arm/mach-mediatek/mt8175/init.c   |  75 ++++++++
 5 files changed, 335 insertions(+)
 create mode 100644 arch/arm/dts/mt8175.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8175/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8175/init.c
arch/arm/dts/mt8175.dtsi new file +247 -0
new file mode 100644
index 000000000000..98320e44cd5c
@@ -0,0 +1,247 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021 MediaTek Inc.
+ * Copyright (C) 2021 BayLibre, SAS
+ * Author: Ben Ho <[email protected]>
+ *         Erin Lo <[email protected]>
+ *         Fabien Parent <[email protected]>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/clock/mt8175-clk.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/phy/phy.h>
+
+/ {
+	compatible = "mediatek,mt8175";
+	interrupt-parent = <&sysirq>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu-map {
+			cluster0 {
+				core0 {
+					cpu = <&cpu0>;
+				};
+				core1 {
+					cpu = <&cpu1>;
+				};
+				core2 {
+					cpu = <&cpu2>;
+				};
+				core3 {
+					cpu = <&cpu3>;
+				};
+			};
+		};
+
+		cpu0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x000>;
+			enable-method = "psci";
+		};
+
+		cpu1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x001>;
+			enable-method = "psci";
+		};
+
+		cpu2: cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x002>;
+			enable-method = "psci";
+		};
+
+		cpu3: cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x003>;
+			enable-method = "psci";
+		};
+	};
+
+	psci {
+		compatible = "arm,psci-1.0";
+		method = "smc";
+	};
+
+	soc {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		compatible = "simple-bus";
+		ranges;
+
+		watchdog: watchdog at 10007000 {
+			compatible = "mediatek,mt8175-rgu",
+				     "mediatek,wdt";
+			reg = <0 0x10007000 0 0x100>;
+			#reset-cells = <1>;
+		};
+
+		gic: interrupt-controller at c000000 {
+			compatible = "arm,gic-v3";
+			#interrupt-cells = <4>;
+			interrupt-parent = <&gic>;
+			interrupt-controller;
+			reg = <0 0xc000000 0 0x80000>,
+			      <0 0xc080000 0 0x80000>;
+
+			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH 0>;
+		};
+
+		sysirq: intpol-controller at 10200a80 {
+			compatible = "mediatek,mt8175-sysirq",
+				     "mediatek,mt6577-sysirq";
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			interrupt-parent = <&gic>;
+			reg = <0 0x10200a80 0 0x20>;
+		};
+
+		topckgen: topckgen at 10000000 {
+			compatible = "mediatek,mt8175-topckgen", "syscon";
+			reg = <0 0x10000000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		topckgen_cg: topckgen-cg at 10000000 {
+			compatible = "mediatek,mt8175-topckgen-cg", "syscon";
+			reg = <0 0x10000000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		infracfg: infracfg at 10001000 {
+			compatible = "mediatek,mt8175-infracfg", "syscon";
+			reg = <0 0x10001000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		apmixedsys: syscon at 1000c000 {
+			compatible = "mediatek,mt8175-apmixedsys", "syscon";
+			reg = <0 0x1000c000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		uart0: uart0 at 11002000 {
+			compatible = "mediatek,mt8175-uart",
+				     "mediatek,hsuart";
+			reg = <0 0x11002000 0 0x1000>;
+			interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_LOW>;
+			clock-frequency = <26000000>;
+			clocks = <&topckgen CLK_TOP_CLK26M>, <&infracfg CLK_IFR_UART0>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		uart1: uart1 at 11003000 {
+			compatible = "mediatek,mt8175-uart",
+				     "mediatek,hsuart";
+			reg = <0 0x11003000 0 0x1000>;
+			interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&topckgen CLK_TOP_CLK26M>, <&infracfg CLK_IFR_UART1>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		uart2: uart2 at 11004000 {
+			compatible = "mediatek,mt8175-uart",
+				     "mediatek,hsuart";
+			reg = <0 0x11004000 0 0x1000>;
+			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&topckgen CLK_TOP_CLK26M>, <&infracfg CLK_IFR_UART2>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		mmc0: mmc at 11230000 {
+			compatible = "mediatek,mt8175-mmc", "mediatek,mt8183-mmc";
+			reg = <0 0x11230000 0 0x1000>,
+			      <0 0x11cd0000 0 0x1000>;
+			interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&topckgen CLK_TOP_MSDC50_0_SEL>,
+				 <&infracfg CLK_IFR_MSDC0_HCLK>,
+				 <&infracfg CLK_IFR_MSDC0_SRC>;
+			clock-names = "source", "hclk", "source_cg";
+			status = "disabled";
+		};
+
+		u3phy: usb-phy at 11cc0000 {
+			compatible = "mediatek,generic-tphy-v2";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			status = "okay";
+
+			u2port0: usb-phy at 11cc0000 {
+				reg = <0 0x11cc0000 0 0x400>;
+				clocks = <&topckgen_cg CLK_TOP_SSUSB_PHY_CK_EN>,
+					 <&topckgen_cg CLK_TOP_USB20_48M_EN>;
+				clock-names = "ref", "da_ref";
+				#phy-cells = <1>;
+				status = "okay";
+			};
+
+			u2port1: usb-phy at 11cc1000 {
+				reg = <0 0x11cc1000 0 0x400>;
+				clocks = <&topckgen_cg CLK_TOP_SSUSB_PHY_CK_EN>,
+					 <&topckgen_cg CLK_TOP_USB20_48M_EN>;
+				clock-names = "ref", "da_ref";
+				#phy-cells = <1>;
+				status = "okay";
+			};
+		};
+
+		usb: usb at 11201000 {
+			compatible ="mediatek,mt8175-mtu3", "mediatek,mtu3";
+			reg = <0 0x11200000 0 0x3e00>,
+			      <0 0x11203e00 0 0x0100>;
+			reg-names = "mac", "ippc";
+			interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_LOW>;
+			phys = <&u2port0 PHY_TYPE_USB2>,
+			       <&u2port1 PHY_TYPE_USB2>;
+			clocks = <&topckgen_cg CLK_TOP_SSUSB_TOP_CK_EN>,
+				 <&infracfg CLK_IFR_SSUSB_REF>,
+				 <&infracfg CLK_IFR_SSUSB_SYS>,
+				 <&infracfg CLK_IFR_ICUSB>;
+			clock-names = "sys_ck", "ref_ck", "mcu_ck",
+				      "dma_ck";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			status = "disabled";
+
+			ssusb: ssusb at 11200000 {
+				compatible = "mediatek,ssusb";
+				reg = <0 0x11200000 0 0x3e00>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_LOW>;
+				status = "disabled";
+			};
+
+			usb_host: xhci at 11200000 {
+				compatible = "mediatek,mt8175-xhci",
+					     "mediatek,mtk-xhci";
+				reg = <0 0x11200000 0 0x1000>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_LOW>;
+				clocks = <&topckgen_cg CLK_TOP_SSUSB_TOP_CK_EN>,
+					 <&infracfg CLK_IFR_SSUSB_REF>,
+					 <&infracfg CLK_IFR_SSUSB_SYS>,
+					 <&infracfg CLK_IFR_ICUSB>,
+					 <&infracfg CLK_IFR_SSUSB_XHCI>;
+				clock-names = "sys_ck", "ref_ck", "mcu_ck",
+					      "dma_ck", "xhci_ck";
+				status = "disabled";
+			};
+		};
+	};
+};
arch/arm/mach-mediatek/Kconfig +9 -0
index e067604d9b39..4a91fb764175 100644
@@ -41,6 +41,14 @@ config TARGET_MT7629
 	  including DDR3, crypto engine, 3x3 11n/ac Wi-Fi, Gigabit Ethernet,
 	  switch, USB3.0, PCIe, UART, SPI, I2C and PWM.
 
+config TARGET_MT8175
+	bool "MediaTek MT8175 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8175 is a ARM64-based SoC with a quad-core Cortex-A53.
+	  It is including UART, SPI, USB2.0 dual role, SD and MMC cards, NAND, PWM,
+	  I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.
+
 config TARGET_MT8183
 	bool "MediaTek MT8183 SoC"
 	select ARM64
@@ -83,6 +91,7 @@ endchoice
 source "board/mediatek/mt7622/Kconfig"
 source "board/mediatek/mt7623/Kconfig"
 source "board/mediatek/mt7629/Kconfig"
+source "board/mediatek/mt8175/Kconfig"
 source "board/mediatek/mt8183/Kconfig"
 source "board/mediatek/mt8512/Kconfig"
 source "board/mediatek/mt8516/Kconfig"
arch/arm/mach-mediatek/Makefile +1 -0
index 0f5b0c16d2cb..ba030fb0b373 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_MT8512) += mt8512/
 obj-$(CONFIG_TARGET_MT7622) += mt7622/
 obj-$(CONFIG_TARGET_MT7623) += mt7623/
 obj-$(CONFIG_TARGET_MT7629) += mt7629/
+obj-$(CONFIG_TARGET_MT8175) += mt8175/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
 obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach-mediatek/mt8175/Makefile new file +3 -0
new file mode 100644
index 000000000000..886ab7e4eb9f
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach-mediatek/mt8175/init.c new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.31.0
#2 lore raw

PATCH 2/3 ARM: mediatek: Add MT8175 support

Quoted 44 lines · Fabien Parent

Add MT8175 SoC support.

---
 arch/arm/dts/mt8175.dtsi               | 247 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |   9 +
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8175/Makefile |   3 +
 arch/arm/mach-mediatek/mt8175/init.c   |  75 ++++++++
 5 files changed, 335 insertions(+)
 create mode 100644 arch/arm/dts/mt8175.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8175/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8175/init.c
arch/arm/dts/mt8175.dtsi new file +24 -0
new file mode 100644
index 000000000000..98320e44cd5c
@@ -0,0 +1,247 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021 MediaTek Inc.
+ * Copyright (C) 2021 BayLibre, SAS
+ * Author: Ben Ho <[email protected]>
+ *         Erin Lo <[email protected]>
+ *         Fabien Parent <[email protected]>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/clock/mt8175-clk.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/phy/phy.h>
+
+/ {
+	compatible = "mediatek,mt8175";
+	interrupt-parent = <&sysirq>;
+	#address-cells = <2>;
+	#size-cells = <2>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;

[...]

Quoted 15 lines
arch/arm/dts/mt8175.dtsi new file +15 -0
+		uart2: uart2 at 11004000 {
+			compatible = "mediatek,mt8175-uart",
+				     "mediatek,hsuart";
+			reg = <0 0x11004000 0 0x1000>;
+			interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&topckgen CLK_TOP_CLK26M>, <&infracfg CLK_IFR_UART2>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		mmc0: mmc at 11230000 {
+			compatible = "mediatek,mt8175-mmc", "mediatek,mt8183-mmc";
+			reg = <0 0x11230000 0 0x1000>,
+			      <0 0x11cd0000 0 0x1000>;
+			interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8175.dtsi line 179

Quoted 10 lines
arch/arm/dts/mt8175.dtsi new file +10 -0
+			clocks = <&topckgen CLK_TOP_MSDC50_0_SEL>,
+				 <&infracfg CLK_IFR_MSDC0_HCLK>,
+				 <&infracfg CLK_IFR_MSDC0_SRC>;
+			clock-names = "source", "hclk", "source_cg";
+			status = "disabled";
+		};
+
+		u3phy: usb-phy at 11cc0000 {
+			compatible = "mediatek,generic-tphy-v2";
+			#address-cells = <2>;

<1>

arch/arm/dts/mt8175.dtsi

Quoted 1 line
arch/arm/dts/mt8175.dtsi new file +1 -0
+			#size-cells = <2>;

<1>

arch/arm/dts/mt8175.dtsi

Quoted 1 line
arch/arm/dts/mt8175.dtsi new file +1 -0
+			ranges;

Please use <prop-encoded-array> as following,

ranges = <0 0 0x11cc0000 0x2000>;

arch/arm/dts/mt8175.dtsi line 184

Quoted 3 lines
arch/arm/dts/mt8175.dtsi new file +3 -0
+			status = "okay";
+
+			u2port0: usb-phy at 11cc0000 {

u2port0: usb-phy at 0

arch/arm/dts/mt8175.dtsi line 185

Quoted 1 line
arch/arm/dts/mt8175.dtsi new file +1 -0
+				reg = <0 0x11cc0000 0 0x400>;

reg = <0 0x400>;

arch/arm/dts/mt8175.dtsi line 193

Quoted 8 lines
arch/arm/dts/mt8175.dtsi new file +8 -0
+				clocks = <&topckgen_cg CLK_TOP_SSUSB_PHY_CK_EN>,
+					 <&topckgen_cg CLK_TOP_USB20_48M_EN>;
+				clock-names = "ref", "da_ref";
+				#phy-cells = <1>;
+				status = "okay";
+			};
+
+			u2port1: usb-phy at 11cc1000 {

u2port1: usb-phy at 1000

arch/arm/dts/mt8175.dtsi line 194

Quoted 1 line
arch/arm/dts/mt8175.dtsi new file +1 -0
+				reg = <0 0x11cc1000 0 0x400>;

reg = <0x1000 0x400>;

arch/arm/dts/mt8175.dtsi line 207

Quoted 13 lines
arch/arm/dts/mt8175.dtsi new file +13 -0
+				clocks = <&topckgen_cg CLK_TOP_SSUSB_PHY_CK_EN>,
+					 <&topckgen_cg CLK_TOP_USB20_48M_EN>;
+				clock-names = "ref", "da_ref";
+				#phy-cells = <1>;
+				status = "okay";
+			};
+		};
+
+		usb: usb at 11201000 {
+			compatible ="mediatek,mt8175-mtu3", "mediatek,mtu3";
+			reg = <0 0x11200000 0 0x3e00>,
+			      <0 0x11203e00 0 0x0100>;
+			reg-names = "mac", "ippc";

No need mac reg, it's in subnode

arch/arm/dts/mt8175.dtsi line 208

Quoted 1 line
arch/arm/dts/mt8175.dtsi new file +1 -0
+			interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_LOW>;

remove it, it's also in subnode

Quoted 26 lines
arch/arm/dts/mt8175.dtsi new file +26 -0
+			phys = <&u2port0 PHY_TYPE_USB2>,
+			       <&u2port1 PHY_TYPE_USB2>;
+			clocks = <&topckgen_cg CLK_TOP_SSUSB_TOP_CK_EN>,
+				 <&infracfg CLK_IFR_SSUSB_REF>,
+				 <&infracfg CLK_IFR_SSUSB_SYS>,
+				 <&infracfg CLK_IFR_ICUSB>;
+			clock-names = "sys_ck", "ref_ck", "mcu_ck",
+				      "dma_ck";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			status = "disabled";
+
+			ssusb: ssusb at 11200000 {
+				compatible = "mediatek,ssusb";
+				reg = <0 0x11200000 0 0x3e00>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_LOW>;
+				status = "disabled";
+			};
+
+			usb_host: xhci at 11200000 {
+				compatible = "mediatek,mt8175-xhci",
+					     "mediatek,mtk-xhci";
+				reg = <0 0x11200000 0 0x1000>;
+				reg-names = "mac";

arch/arm/dts/mt8175.dtsi line 244

Quoted 10 lines
arch/arm/dts/mt8175.dtsi new file +10 -0
+				interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_LOW>;
+				clocks = <&topckgen_cg CLK_TOP_SSUSB_TOP_CK_EN>,
+					 <&infracfg CLK_IFR_SSUSB_REF>,
+					 <&infracfg CLK_IFR_SSUSB_SYS>,
+					 <&infracfg CLK_IFR_ICUSB>,
+					 <&infracfg CLK_IFR_SSUSB_XHCI>;
+				clock-names = "sys_ck", "ref_ck", "mcu_ck",
+					      "dma_ck", "xhci_ck";
+				status = "disabled";
+			};

No need usb_host node if you want support dual-role mode, it's used for host only IP.

Thanks a lot

Quoted 3 lines
arch/arm/dts/mt8175.dtsi new file +3 -0
+		};
+	};
+};
#3 lore raw

PATCH 2/3 ARM: mediatek: Add MT8175 support

Hi Chunfeng,

Quoted 153 lines · Chunfeng Yun
Quoted 44 lines · Fabien Parent

Add MT8175 SoC support.

---
 arch/arm/dts/mt8175.dtsi               | 247 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |   9 +
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8175/Makefile |   3 +
 arch/arm/mach-mediatek/mt8175/init.c   |  75 ++++++++
 5 files changed, 335 insertions(+)
 create mode 100644 arch/arm/dts/mt8175.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8175/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8175/init.c
arch/arm/dts/mt8175.dtsi new file +24 -0
new file mode 100644
index 000000000000..98320e44cd5c
@@ -0,0 +1,247 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021 MediaTek Inc.
+ * Copyright (C) 2021 BayLibre, SAS
+ * Author: Ben Ho <[email protected]>
+ *         Erin Lo <[email protected]>
+ *         Fabien Parent <[email protected]>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/clock/mt8175-clk.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/phy/phy.h>
+
+/ {
+     compatible = "mediatek,mt8175";
+     interrupt-parent = <&sysirq>;
+     #address-cells = <2>;
+     #size-cells = <2>;
+
+     cpus {
+             #address-cells = <1>;
+             #size-cells = <0>;

[...]

Quoted 15 lines
arch/arm/dts/mt8175.dtsi new file +15 -0
+             uart2: uart2 at 11004000 {
+                     compatible = "mediatek,mt8175-uart",
+                                  "mediatek,hsuart";
+                     reg = <0 0x11004000 0 0x1000>;
+                     interrupts = <GIC_SPI 37 IRQ_TYPE_LEVEL_LOW>;
+                     clocks = <&topckgen CLK_TOP_CLK26M>, <&infracfg CLK_IFR_UART2>;
+                     clock-names = "baud", "bus";
+                     status = "disabled";
+             };
+
+             mmc0: mmc at 11230000 {
+                     compatible = "mediatek,mt8175-mmc", "mediatek,mt8183-mmc";
+                     reg = <0 0x11230000 0 0x1000>,
+                           <0 0x11cd0000 0 0x1000>;
+                     interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8175.dtsi line 179

Quoted 10 lines
arch/arm/dts/mt8175.dtsi new file +10 -0
+                     clocks = <&topckgen CLK_TOP_MSDC50_0_SEL>,
+                              <&infracfg CLK_IFR_MSDC0_HCLK>,
+                              <&infracfg CLK_IFR_MSDC0_SRC>;
+                     clock-names = "source", "hclk", "source_cg";
+                     status = "disabled";
+             };
+
+             u3phy: usb-phy at 11cc0000 {
+                     compatible = "mediatek,generic-tphy-v2";
+                     #address-cells = <2>;

<1>

Quoted 1 line

+ #size-cells = <2>;

<1>

Quoted 1 line

+ ranges;

Please use <prop-encoded-array> as following,

ranges = <0 0 0x11cc0000 0x2000>;

arch/arm/dts/mt8175.dtsi line 184

Quoted 3 lines
arch/arm/dts/mt8175.dtsi new file +3 -0
+                     status = "okay";
+
+                     u2port0: usb-phy at 11cc0000 {

u2port0: usb-phy at 0

Quoted 1 line

+ reg = <0 0x11cc0000 0 0x400>;

reg = <0 0x400>;

arch/arm/dts/mt8175.dtsi line 193

Quoted 8 lines
arch/arm/dts/mt8175.dtsi new file +8 -0
+                             clocks = <&topckgen_cg CLK_TOP_SSUSB_PHY_CK_EN>,
+                                      <&topckgen_cg CLK_TOP_USB20_48M_EN>;
+                             clock-names = "ref", "da_ref";
+                             #phy-cells = <1>;
+                             status = "okay";
+                     };
+
+                     u2port1: usb-phy at 11cc1000 {

u2port1: usb-phy at 1000

Quoted 1 line

+ reg = <0 0x11cc1000 0 0x400>;

reg = <0x1000 0x400>;

arch/arm/dts/mt8175.dtsi line 207

Quoted 13 lines
arch/arm/dts/mt8175.dtsi new file +13 -0
+                             clocks = <&topckgen_cg CLK_TOP_SSUSB_PHY_CK_EN>,
+                                      <&topckgen_cg CLK_TOP_USB20_48M_EN>;
+                             clock-names = "ref", "da_ref";
+                             #phy-cells = <1>;
+                             status = "okay";
+                     };
+             };
+
+             usb: usb at 11201000 {
+                     compatible ="mediatek,mt8175-mtu3", "mediatek,mtu3";
+                     reg = <0 0x11200000 0 0x3e00>,
+                           <0 0x11203e00 0 0x0100>;
+                     reg-names = "mac", "ippc";

No need mac reg, it's in subnode

Quoted 1 line

+ interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_LOW>;

remove it, it's also in subnode

Quoted 26 lines
arch/arm/dts/mt8175.dtsi new file +26 -0
+                     phys = <&u2port0 PHY_TYPE_USB2>,
+                            <&u2port1 PHY_TYPE_USB2>;
+                     clocks = <&topckgen_cg CLK_TOP_SSUSB_TOP_CK_EN>,
+                              <&infracfg CLK_IFR_SSUSB_REF>,
+                              <&infracfg CLK_IFR_SSUSB_SYS>,
+                              <&infracfg CLK_IFR_ICUSB>;
+                     clock-names = "sys_ck", "ref_ck", "mcu_ck",
+                                   "dma_ck";
+                     #address-cells = <2>;
+                     #size-cells = <2>;
+                     ranges;
+                     status = "disabled";
+
+                     ssusb: ssusb at 11200000 {
+                             compatible = "mediatek,ssusb";
+                             reg = <0 0x11200000 0 0x3e00>;
+                             reg-names = "mac";
+                             interrupts = <GIC_SPI 72 IRQ_TYPE_LEVEL_LOW>;
+                             status = "disabled";
+                     };
+
+                     usb_host: xhci at 11200000 {
+                             compatible = "mediatek,mt8175-xhci",
+                                          "mediatek,mtk-xhci";
+                             reg = <0 0x11200000 0 0x1000>;
+                             reg-names = "mac";

arch/arm/dts/mt8175.dtsi line 244

Quoted 10 lines
arch/arm/dts/mt8175.dtsi new file +10 -0
+                             interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_LOW>;
+                             clocks = <&topckgen_cg CLK_TOP_SSUSB_TOP_CK_EN>,
+                                      <&infracfg CLK_IFR_SSUSB_REF>,
+                                      <&infracfg CLK_IFR_SSUSB_SYS>,
+                                      <&infracfg CLK_IFR_ICUSB>,
+                                      <&infracfg CLK_IFR_SSUSB_XHCI>;
+                             clock-names = "sys_ck", "ref_ck", "mcu_ck",
+                                           "dma_ck", "xhci_ck";
+                             status = "disabled";
+                     };

No need usb_host node if you want support dual-role mode, it's used for host only IP.

Quoted 1 line

Thanks a lot

Thanks. I've applied all your changes in v2.

Quoted 4 lines
Quoted 4 lines
arch/arm/dts/mt8175.dtsi new file +3 -0
+             };
+     };
+};
#4 lore raw

PATCH 3/3 board: Add MT8175 pumpkin board support

In reply to Fabien Parent

Add the MT8175 pumpkin board support.

---
 arch/arm/dts/Makefile                  |  1 +
 arch/arm/dts/mt8175-pumpkin.dts        | 95 ++++++++++++++++++++++++++
 board/mediatek/mt8175/Kconfig          | 13 ++++
 board/mediatek/mt8175/MAINTAINERS      |  6 ++
 board/mediatek/mt8175/Makefile         |  3 +
 board/mediatek/mt8175/mt8175_pumpkin.c | 28 ++++++++
 configs/mt8175_pumpkin_defconfig       | 81 ++++++++++++++++++++++
 include/configs/mt8175.h               | 41 +++++++++++
 8 files changed, 268 insertions(+)
 create mode 100644 arch/arm/dts/mt8175-pumpkin.dts
 create mode 100644 board/mediatek/mt8175/Kconfig
 create mode 100644 board/mediatek/mt8175/MAINTAINERS
 create mode 100644 board/mediatek/mt8175/Makefile
 create mode 100644 board/mediatek/mt8175/mt8175_pumpkin.c
 create mode 100644 configs/mt8175_pumpkin_defconfig
 create mode 100644 include/configs/mt8175.h
arch/arm/dts/Makefile +1 -0
index 9a8de46272a2..18f6763d569a 100644
@@ -1013,6 +1013,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7622-bananapi-bpi-r64.dtb \
 	mt7623n-bananapi-bpi-r2.dtb \
 	mt7629-rfb.dtb \
+	mt8175-pumpkin.dtb \
 	mt8183-pumpkin.dtb \
 	mt8512-bm1-emmc.dtb \
 	mt8516-pumpkin.dtb \
arch/arm/dts/mt8175-pumpkin.dts new file +95 -0

95 lines not on this page · raw message

board/mediatek/mt8175/Kconfig new file +13 -0
new file mode 100644
index 000000000000..00fd6c9c7f6e
@@ -0,0 +1,13 @@
+if TARGET_MT8175
+
+config SYS_BOARD
+	default "mt8175"
+
+config SYS_CONFIG_NAME
+	default "mt8175"
+
+config MTK_BROM_HEADER_INFO
+	string
+	default "media=emmc"
+
+endif
board/mediatek/mt8175/MAINTAINERS new file +6 -0
new file mode 100644
index 000000000000..1d2c966a8b44
@@ -0,0 +1,6 @@
+MT8175 Pumpkin
+M:	Fabien Parent <[email protected]>
+S:	Maintained
+F:	board/mediatek/mt8175
+F:	include/configs/mt8175.h
+F:	configs/mt8175_pumpkin_defconfig
board/mediatek/mt8175/Makefile new file +3 -0
new file mode 100644
index 000000000000..65fb3a6cb42c
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += mt8175_pumpkin.o
board/mediatek/mt8175/mt8175_pumpkin.c new file +28 -0
new file mode 100644
index 000000000000..f071089cd44a
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2021 BayLibre SAS
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <net.h>
+
+int board_init(void)
+{
+	struct udevice *dev;
+	int ret;
+
+	if (CONFIG_IS_ENABLED(USB_GADGET)) {
+		ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, 0, &dev);
+		if (ret) {
+			pr_err("%s: Cannot find USB device\n", __func__);
+			return ret;
+		}
+	}
+
+	if (CONFIG_IS_ENABLED(USB_ETHER))
+		usb_ether_init();
+
+	return 0;
+}
configs/mt8175_pumpkin_defconfig new file +81 -0

81 lines not on this page · raw message

include/configs/mt8175.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.31.0
#5 lore raw

PATCH 3/3 board: Add MT8175 pumpkin board support

Quoted 332 lines · Fabien Parent

Add the MT8175 pumpkin board support.

---
 arch/arm/dts/Makefile                  |  1 +
 arch/arm/dts/mt8175-pumpkin.dts        | 95 ++++++++++++++++++++++++++
 board/mediatek/mt8175/Kconfig          | 13 ++++
 board/mediatek/mt8175/MAINTAINERS      |  6 ++
 board/mediatek/mt8175/Makefile         |  3 +
 board/mediatek/mt8175/mt8175_pumpkin.c | 28 ++++++++
 configs/mt8175_pumpkin_defconfig       | 81 ++++++++++++++++++++++
 include/configs/mt8175.h               | 41 +++++++++++
 8 files changed, 268 insertions(+)
 create mode 100644 arch/arm/dts/mt8175-pumpkin.dts
 create mode 100644 board/mediatek/mt8175/Kconfig
 create mode 100644 board/mediatek/mt8175/MAINTAINERS
 create mode 100644 board/mediatek/mt8175/Makefile
 create mode 100644 board/mediatek/mt8175/mt8175_pumpkin.c
 create mode 100644 configs/mt8175_pumpkin_defconfig
 create mode 100644 include/configs/mt8175.h
arch/arm/dts/Makefile +1 -0
index 9a8de46272a2..18f6763d569a 100644
@@ -1013,6 +1013,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7622-bananapi-bpi-r64.dtb \
 	mt7623n-bananapi-bpi-r2.dtb \
 	mt7629-rfb.dtb \
+	mt8175-pumpkin.dtb \
 	mt8183-pumpkin.dtb \
 	mt8512-bm1-emmc.dtb \
 	mt8516-pumpkin.dtb \
arch/arm/dts/mt8175-pumpkin.dts new file +95 -0
new file mode 100644
index 000000000000..9c5bc845a781
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/*
+ * Copyright (C) 2021 BayLibre SAS.
+ * Author: Fabien Parent <[email protected]>
+ */
+
+/dts-v1/;
+
+#include <config.h>
+#include "mt8175.dtsi"
+
+/ {
+	model = "MT8175 pumpkin board";
+	compatible = "mediatek,mt8175-pumpkin", "mediatek,mt8175";
+
+	memory at 40000000 {
+		device_type = "memory";
+		reg = <0 0x40000000 0 0x40000000>;
+	};
+
+	reserved-memory {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		/* 192 KiB reserved for ARM Trusted Firmware (BL31) */
+		bl31_secmon_reserved: secmon at 43000000 {
+			no-map;
+			reg = <0 0x43000000 0 0x30000>;
+		};
+
+		/* 12 MiB reserved for OP-TEE (BL32)
+		 * +-----------------------+ 0x43e0_0000
+		 * |      SHMEM 2MiB       |
+		 * +-----------------------+ 0x43c0_0000
+		 * |        | TA_RAM  8MiB |
+		 * + TZDRAM +--------------+ 0x4340_0000
+		 * |        | TEE_RAM 2MiB |
+		 * +-----------------------+ 0x4320_0000
+		 */
+		optee_reserved: optee at 43200000 {
+			no-map;
+			reg = <0 0x43200000 0 0x00c00000>;
+		};
+	};
+
+	chosen {
+		stdout-path = &uart0;
+	};
+
+	reg_1p8v: regulator-1p8v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-1.8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
+
+&mmc0 {
+	bus-width = <4>;
+	max-frequency = <200000000>;
+	cap-mmc-highspeed;
+	mmc-hs200-1_8v;
+	cap-mmc-hw-reset;
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_1p8v>;
+	non-removable;
+	status = "okay";
+};
+
+&usb {
+	status = "okay";
+};
+
+&ssusb {
+	mediatek,force-vbus;
+	maximum-speed = "high-speed";
+	dr_mode = "peripheral";
+	status = "okay";
+};
board/mediatek/mt8175/Kconfig new file +13 -0
new file mode 100644
index 000000000000..00fd6c9c7f6e
@@ -0,0 +1,13 @@
+if TARGET_MT8175
+
+config SYS_BOARD
+	default "mt8175"
+
+config SYS_CONFIG_NAME
+	default "mt8175"
+
+config MTK_BROM_HEADER_INFO
+	string
+	default "media=emmc"
+
+endif
board/mediatek/mt8175/MAINTAINERS new file +6 -0
new file mode 100644
index 000000000000..1d2c966a8b44
@@ -0,0 +1,6 @@
+MT8175 Pumpkin
+M:	Fabien Parent <[email protected]>
+S:	Maintained
+F:	board/mediatek/mt8175
+F:	include/configs/mt8175.h
+F:	configs/mt8175_pumpkin_defconfig
board/mediatek/mt8175/Makefile new file +3 -0
new file mode 100644
index 000000000000..65fb3a6cb42c
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += mt8175_pumpkin.o
board/mediatek/mt8175/mt8175_pumpkin.c new file +28 -0
new file mode 100644
index 000000000000..f071089cd44a
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2021 BayLibre SAS
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <net.h>
+
+int board_init(void)
+{
+	struct udevice *dev;
+	int ret;
+
+	if (CONFIG_IS_ENABLED(USB_GADGET)) {
+		ret = uclass_get_device(UCLASS_USB_GADGET_GENERIC, 0, &dev);
+		if (ret) {
+			pr_err("%s: Cannot find USB device\n", __func__);
+			return ret;
+		}
+	}
+
+	if (CONFIG_IS_ENABLED(USB_ETHER))
+		usb_ether_init();
+
+	return 0;
+}
configs/mt8175_pumpkin_defconfig new file +81 -0
new file mode 100644
index 000000000000..9d17659c9691
@@ -0,0 +1,81 @@
+CONFIG_ARM=y
+CONFIG_POSITION_INDEPENDENT=y
+CONFIG_ARCH_MEDIATEK=y
+CONFIG_SYS_TEXT_BASE=0x4c000000
+CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_ENV_SIZE=0x1000
+CONFIG_ENV_OFFSET=0x0
+CONFIG_DM_GPIO=y
+CONFIG_TARGET_MT8175=y
+CONFIG_DEBUG_UART_BASE=0x11002000
+CONFIG_DEBUG_UART_CLOCK=26000000
+# CONFIG_PSCI_RESET is not set
+CONFIG_DEFAULT_DEVICE_TREE="mt8175-pumpkin"
+CONFIG_DEBUG_UART=y
+# CONFIG_ANDROID_BOOT_IMAGE is not set
+CONFIG_FIT=y
+# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
+CONFIG_DEFAULT_FDT_FILE="mt8175-pumpkin"
+# CONFIG_DISPLAY_BOARDINFO is not set
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_BDI is not set
+# CONFIG_CMD_CONSOLE is not set
+# CONFIG_CMD_BOOTD is not set
+# CONFIG_CMD_BOOTI is not set
+# CONFIG_CMD_ELF is not set
+# CONFIG_CMD_GO is not set
+# CONFIG_CMD_IMI is not set
+# CONFIG_CMD_XIMG is not set
+# CONFIG_CMD_EXPORTENV is not set
+# CONFIG_CMD_IMPORTENV is not set
+# CONFIG_CMD_EDITENV is not set
+# CONFIG_CMD_CRC32 is not set
+# CONFIG_CMD_MEMORY is not set
+CONFIG_CMD_CLK=y
+CONFIG_CMD_GPT=y
+# CONFIG_RANDOM_UUID is not set
+# CONFIG_CMD_LOADB is not set
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+# CONFIG_CMD_ITEST is not set
+# CONFIG_CMD_SETEXPR is not set
+# CONFIG_CMD_BLOCK_CACHE is not set
+CONFIG_CMD_EXT4=y
+CONFIG_CMD_FS_GENERIC=y
+CONFIG_ENV_IS_IN_MMC=y
+CONFIG_SYS_MMC_ENV_PART=2
+CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y
+CONFIG_DEVRES=y
+CONFIG_CLK=y
+CONFIG_USB_FUNCTION_FASTBOOT=y
+CONFIG_FASTBOOT_BUF_ADDR=0x4d000000
+CONFIG_FASTBOOT_BUF_SIZE=0x8000000
+CONFIG_FASTBOOT_FLASH=y
+CONFIG_FASTBOOT_FLASH_MMC_DEV=0
+CONFIG_FASTBOOT_MMC_BOOT_SUPPORT=y
+# CONFIG_INPUT is not set
+CONFIG_DM_MMC=y
+# CONFIG_MMC_QUIRKS is not set
+CONFIG_MMC_MTK=y
+CONFIG_DM_ETH=y
+CONFIG_PHY=y
+CONFIG_PHY_MTK_TPHY=y
+CONFIG_BAUDRATE=921600
+CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_MTK_SERIAL=y
+CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_USB_MTU3=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_VENDOR_NUM=0x0e8d
+CONFIG_USB_GADGET_PRODUCT_NUM=0x201c
+CONFIG_USB_ETHER=y
+CONFIG_WDT=y
+CONFIG_WDT_MTK=y
+# CONFIG_REGEX is not set
+CONFIG_OF_LIBFDT_OVERLAY=y
+# CONFIG_EFI_LOADER is not set
include/configs/mt8175.h new file +31 -0
new file mode 100644
index 000000000000..1f7a8032a65f
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for MT8175 based boards
+ *
+ * Copyright (C) 2021 BayLibre, SAS
+ * Author: Fabien Parent <[email protected]
+ */
+
+#ifndef __MT8175_H
+#define __MT8175_H
+
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_LOAD_ADDR		CONFIG_SYS_TEXT_BASE
+#define CONFIG_SYS_MALLOC_LEN		SZ_4M
+
+#define CONFIG_CPU_ARMV8
+#define COUNTER_FREQUENCY		13000000
+
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	-4
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_COM1		0x11005200
+#define CONFIG_SYS_NS16550_CLK		26000000
+
+#define CONFIG_SYS_INIT_SP_ADDR		(CONFIG_SYS_TEXT_BASE + SZ_2M - \
+						 GENERATED_GBL_DATA_SIZE)
+
+#define CONFIG_SYS_BOOTM_LEN		SZ_64M
+
+/* Environment settings */

include/configs/mt8175.h line 41

Quoted 10 lines
include/configs/mt8175.h new file +10 -0
+#include <config_distro_bootcmd.h>
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0)
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"scriptaddr=0x40000000\0" \
+	BOOTENV
+
+#endif

For usb related:

Thanks a lot