Skip to contentSkip to conversation

arm: mediatek: add mt8195 SOC support

PATCH Superseded Macpaul Lin 4 participants 23 messages Nov 8, 2022 – Jan 2, 2023

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm: mediatek: add mt8195 SOC support

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts, SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

---
 MAINTAINERS                            |   2 +
 arch/arm/dts/mt8195.dtsi               | 317 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |  13 +-
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 +++++++
 6 files changed, 416 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c
MAINTAINERS +2 -0
index 1cf99c1393..5528dd28c3 100644
@@ -362,8 +362,10 @@ ARM MEDIATEK
 M:	Ryder Lee <[email protected]>
 M:	Weijie Gao <[email protected]>
 M:	Chunfeng Yun <[email protected]>
+M:	Macpaul Lin <[email protected]>
 R:	GSS_MTK_Uboot_upstream <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/mt8195.dtsi
 F:	arch/arm/mach-mediatek/
 F:	arch/arm/include/asm/arch-mediatek/
 F:	board/mediatek/
arch/arm/dts/mt8195.dtsi new file +317 -0

317 lines not on this page · raw message

arch/arm/mach-mediatek/Kconfig +12 -1
index 04aa2fd97f..3a2af1cdee 100644
@@ -67,6 +67,15 @@ config TARGET_MT8183
 	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
 	  and LPDDR4 options.
 
+config TARGET_MT8195
+	bool "MediaTek MT8195 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
+	  a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
+	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
+	  and LPDDR4 options.
+
 config TARGET_MT8512
         bool "MediaTek MT8512 M1 Board"
         select ARM64
@@ -105,6 +114,7 @@ config SYS_BOARD
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -122,6 +132,7 @@ config SYS_CONFIG_NAME
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -134,7 +145,7 @@ config SYS_CONFIG_NAME
 config MTK_BROM_HEADER_INFO
 	string
 	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 || TARGET_MT7622
-	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
+	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 || TARGET_MT8195
 	default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986
 	default "lk=1" if TARGET_MT7623
 
arch/arm/mach-mediatek/Makefile +1 -0
index fc85293f71..fbbb5431d1 100644
@@ -10,5 +10,6 @@ obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT7981) += mt7981/
 obj-$(CONFIG_TARGET_MT7986) += mt7986/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
+obj-$(CONFIG_TARGET_MT8195) += mt8195/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
 obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach-mediatek/mt8195/Makefile new file +3 -0
new file mode 100644
index 0000000000..886ab7e4eb
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach-mediatek/mt8195/init.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.18.0
#1 lore raw

Hello! I'm not mediatek maintainer and if this patch series is not something important for me which should I review then please do not send me lot of these emails... As I would have time to review stuff which are important.

Quoted 514 lines · On Tuesday 08 November 2022 11:21:48 Macpaul Lin wrote:

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts, SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

---
 MAINTAINERS                            |   2 +
 arch/arm/dts/mt8195.dtsi               | 317 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |  13 +-
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 +++++++
 6 files changed, 416 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c
MAINTAINERS +2 -0
index 1cf99c1393..5528dd28c3 100644
@@ -362,8 +362,10 @@ ARM MEDIATEK
 M:	Ryder Lee <[email protected]>
 M:	Weijie Gao <[email protected]>
 M:	Chunfeng Yun <[email protected]>
+M:	Macpaul Lin <[email protected]>
 R:	GSS_MTK_Uboot_upstream <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/mt8195.dtsi
 F:	arch/arm/mach-mediatek/
 F:	arch/arm/include/asm/arch-mediatek/
 F:	board/mediatek/
arch/arm/dts/mt8195.dtsi new file +317 -0
new file mode 100644
index 0000000000..d28b038d57
@@ -0,0 +1,317 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Ben Ho <[email protected]>
+ *         Erin Lo <[email protected]>
+ *         Fabien Parent <[email protected]>
+ *         Macpaul Lin <[email protected]>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/phy/phy.h>
+
+/ {
+	compatible = "mediatek,mt8195";
+	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>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cpu4>;
+				};
+				core1 {
+					cpu = <&cpu5>;
+				};
+				core2 {
+					cpu = <&cpu6>;
+				};
+				core3 {
+					cpu = <&cpu7>;
+				};
+			};
+		};
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x000>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x001>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu2: cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x002>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x003>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu4: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x100>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu5: cpu@101 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x101>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu6: cpu@102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x102>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu7: cpu@103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x103>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+	};
+
+	clk26m: oscillator {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <26000000>;
+		clock-output-names = "clk26m";
+	};
+
+	mmc_source_clk: mmc-source-clk{
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <400000000>;
+		clock-output-names = "mmc_source_clk";
+	};
+
+	soc {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		compatible = "simple-bus";
+		ranges;
+
+		watchdog: watchdog@10007000 {
+			compatible = "mediatek,mt8195-wdt",
+				      "mediatek,wdt";
+			reg = <0 0x10007000 0 0x100>;
+			status = "disabled";
+		};
+
+		gic: interrupt-controller@c000000 {
+			compatible = "arm,gic-v3";
+			#interrupt-cells = <4>;
+			interrupt-parent = <&gic>;
+			interrupt-controller;
+			reg = <0 0x0c000000 0 0x40000>,  /* GICD */
+			      <0 0x0c100000 0 0x200000>, /* GICR */
+			      <0 0x0c400000 0 0x2000>,   /* GICC */
+			      <0 0x0c410000 0 0x1000>,   /* GICH */
+			      <0 0x0c420000 0 0x2000>;   /* GICV */
+
+			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH 0>;
+			ppi-partitions {
+				ppi_cluster0: interrupt-partition-0 {
+					affinity = <&cpu0 &cpu1 &cpu2 &cpu3>;
+				};
+				ppi_cluster1: interrupt-partition-1 {
+					affinity = <&cpu4 &cpu5 &cpu6 &cpu7>;
+				};
+			};
+		};
+
+		sysirq: interrupt-controller@c530a80 {
+			compatible = "mediatek,mt8195-sysirq",
+				     "mediatek,mt6577-sysirq";
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			interrupt-parent = <&gic>;
+			reg = <0 0x0c530a80 0 0x50>;
+		};
+
+		topckgen: syscon@10000000 {
+			compatible = "mediatek,mt8195-topckgen", "syscon";
+			reg = <0 0x10000000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		infracfg: syscon@10001000 {
+			compatible = "mediatek,mt8195-infracfg", "syscon";
+			reg = <0 0x10001000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		apmixedsys: syscon@1000c000 {
+			compatible = "mediatek,mt8195-apmixedsys", "syscon";
+			reg = <0 0x1000c000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		uart0: serial@11001100 {
+			compatible = "mediatek,mt8195-uart",
+				     "mediatek,hsuart";
+			reg = <0 0x11001100 0 0x1000>;
+			interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>;
+			clock-frequency = <26000000>;
+			clocks = <&clk26m>, <&clk26m>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		mmc0: mmc@11230000 {
+			compatible = "mediatek,mt8195-mmc",
+				     "mediatek,mt8183-mmc";
+			reg = <0 0x11230000 0 0x1000>,
+			      <0 0x11f50000 0 0x1000>;
+			interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&mmc_source_clk>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "source", "hclk", "source_cg";
+			status = "disabled";
+		};
+
+		u3phy0: usb-phy@11f40000 {
+			compatible = "mediatek,generic-tphy-v2";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11e40000 0xe00>;
+			status = "okay";
+
+			u2port0: usb-phy@0 {
+				reg = <0 0x700>;
+				clocks = <&clk26m>,
+					 <&clk26m>;
+				clock-names = "ref", "da_ref";
+				#phy-cells = <1>;
+				status = "okay";
+			};
+
+			u3port0: usb-phy@700 {
+				reg = <0x700 0x700>;
+				clocks = <&clk26m>,
+					 <&clk26m>;
+				clock-names = "ref", "da_ref";
+				#phy-cells = <1>;
+				status = "okay";
+			};
+		};
+
+		usb: usb@11200000 {
+			compatible ="mediatek,mt8195-mtu3", "mediatek,mtu3";
+			reg = <0 0x11200000 0 0x3e00>,
+			      <0 0x11203e00 0 0x0100>;
+			reg-names = "mac", "ippc";
+			phys = <&u2port0 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "ref_ck", "mcu_ck";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			status = "disabled";
+
+			ssusb: ssusb@11200000 {
+				compatible = "mediatek,ssusb";
+				reg = <0 0x11200000 0 0x3e00>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_LOW>;
+				status = "disabled";
+			};
+
+			xhci0: xhci@11200000 {
+				compatible = "mediatek,mtk-xhci";
+				reg = <0 0x11200000 0 0x1000>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 129 IRQ_TYPE_LEVEL_LOW>;
+				clocks = <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>;
+				clock-names = "sys_ck", "xhci_ck", "ref_ck", "mcu_ck";
+				status = "disabled";
+			};
+		};
+
+		u3phy3: t-phy@11c50000 {
+			compatible = "mediatek,generic-tphy-v2";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11c50000 0x700>;
+			status = "okay";
+
+			u2port3: usb-phy@0 {
+				reg = <0x0 0x700>;
+				clocks = <&clk26m>;
+				clock-names = "ref";
+				#phy-cells = <1>;
+			};
+		};
+
+		xhci3: xhci3@112b0000 {
+			compatible = "mediatek,mt8195-xhci",
+				     "mediatek,mtk-xhci";
+			reg = <0 0x112b0000 0 0x1000>,
+			      <0 0x112b3e00 0 0x0100>;
+			reg-names = "mac", "ippc";
+			interrupts = <GIC_SPI 536 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&u2port3 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "xhci_ck", "ref_ck";
+			usb2-lpm-disable;
+			status = "disabled";
+		};
+	};
+};
arch/arm/mach-mediatek/Kconfig +12 -1
index 04aa2fd97f..3a2af1cdee 100644
@@ -67,6 +67,15 @@ config TARGET_MT8183
 	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
 	  and LPDDR4 options.
 
+config TARGET_MT8195
+	bool "MediaTek MT8195 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
+	  a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
+	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
+	  and LPDDR4 options.
+
 config TARGET_MT8512
         bool "MediaTek MT8512 M1 Board"
         select ARM64
@@ -105,6 +114,7 @@ config SYS_BOARD
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -122,6 +132,7 @@ config SYS_CONFIG_NAME
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -134,7 +145,7 @@ config SYS_CONFIG_NAME
 config MTK_BROM_HEADER_INFO
 	string
 	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 || TARGET_MT7622
-	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
+	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 || TARGET_MT8195
 	default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986
 	default "lk=1" if TARGET_MT7623
 
arch/arm/mach-mediatek/Makefile +1 -0
index fc85293f71..fbbb5431d1 100644
@@ -10,5 +10,6 @@ obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT7981) += mt7981/
 obj-$(CONFIG_TARGET_MT7986) += mt7986/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
+obj-$(CONFIG_TARGET_MT8195) += mt8195/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
 obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach-mediatek/mt8195/Makefile new file +3 -0
new file mode 100644
index 0000000000..886ab7e4eb
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach-mediatek/mt8195/init.c new file +81 -0
new file mode 100644
index 0000000000..1eb4ade6c5
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Macpaul Lin <[email protected]>
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <clk.h>
+#include <common.h>
+#include <dm.h>
+#include <fdtdec.h>
+#include <ram.h>
+#include <asm/arch/misc.h>
+#include <asm/armv8/mmu.h>
+#include <asm/sections.h>
+#include <asm/system.h>
+#include <dm/uclass.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	int ret;
+
+	ret = fdtdec_setup_memory_banksize();
+	if (ret)
+		return ret;
+
+	return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+	gd->bd->bi_dram[0].start = gd->ram_base;
+	gd->bd->bi_dram[0].size = gd->ram_size;
+
+	return 0;
+}
+
+int mtk_pll_early_init(void)
+{
+	return 0;
+}
+
+int mtk_soc_early_init(void)
+{
+	return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+	psci_system_reset();
+}
+
+int print_cpuinfo(void)
+{
+	printf("CPU:   MediaTek MT8195\n");
+	return 0;
+}
+
+static struct mm_region mt8195_mem_map[] = {
+	{
+		/* DDR */
+		.virt = 0x40000000UL,
+		.phys = 0x40000000UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | PTE_BLOCK_OUTER_SHARE,
+	}, {
+		.virt = 0x00000000UL,
+		.phys = 0x00000000UL,
+		.size = 0x20000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		0,
+	}
+};
+
+struct mm_region *mem_map = mt8195_mem_map;
Signature · 1 line
2.18.0
#2 lore raw
Quoted 4 lines · Pali Rohár

Hello! I'm not mediatek maintainer and if this patch series is not something important for me which should I review then please do not send me lot of these emails... As I would have time to review stuff which are important.

I'm so sorry for bothering you and other developers.
I've used ./scripts/get_maintainer.pl to check these 2 patches and found you all in the suggestion list.

Result:
"Pali Rohár" <[email protected]> (added_lines:16/253=6%,removed_lines:12/76=16%)

I'll remove Pali when I send next version.
Who else don't want to be involved in these reviewing activities of MediaTek platforms, please let us know.

[deleted]

Thanks!
Macpaul Lin

#3 lore raw

+ Tom
- all

Quoted 14 lines · On Wednesday 09 November 2022 15:10:59 Macpaul Lin wrote:
Quoted 4 lines · Pali Rohár

Hello! I'm not mediatek maintainer and if this patch series is not something important for me which should I review then please do not send me lot of these emails... As I would have time to review stuff which are important.

I'm so sorry for bothering you and other developers.
I've used ./scripts/get_maintainer.pl to check these 2 patches and found you all in the suggestion list.

Result:
"Pali Rohár" <[email protected]>
(added_lines:16/253=6%,removed_lines:12/76=16%)

Quoted 8 lines

I'll remove Pali when I send next version.
Who else don't want to be involved in these reviewing activities of MediaTek platforms, please let us know.

[deleted]

Thanks!
Macpaul Lin

I think that this is improper configuration of that get_maintainer.pl script. As it currently spams tons of people. And it is not really a good idea to spam people about unrelated stuff. Tom, could you do something with it?

#4 lore raw
Quoted 24 lines · Pali Rohár

+ Tom
- all

Quoted 20 lines · On Wednesday 09 November 2022 15:10:59 Macpaul Lin wrote:
Quoted 4 lines · Pali Rohár

Hello! I'm not mediatek maintainer and if this patch series is not something important for me which should I review then please do not send me lot of these emails... As I would have time to review stuff which are important.

I'm so sorry for bothering you and other developers.
I've used ./scripts/get_maintainer.pl to check these 2 patches and found you all in the suggestion list.

Result:
"Pali Rohár" <[email protected]>
(added_lines:16/253=6%,removed_lines:12/76=16%)

I'll remove Pali when I send next version.
Who else don't want to be involved in these reviewing activities of MediaTek platforms, please let us know.

[deleted]

Quoted 7 lines
Quoted 2 lines

Thanks!
Macpaul Lin

I think that this is improper configuration of that get_maintainer.pl script. As it currently spams tons of people. And it is not really a good idea to spam people about unrelated stuff. Tom, could you do something with it?

I've been waiting for someone to submit a patch to tweak .get_maintainers.conf based on what I think Sean suggested last time. But in this case I'm not even sure what file was suggesting you.

Signature · 1 line
Tom
#5 lore raw

PATCH 2/2 board: mediatek: add mt8195 demo board

In reply to Macpaul Lin

From: Fabien Parent <[email protected]>

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

---
 MAINTAINERS                         |   1 +
 arch/arm/dts/Makefile               |   1 +
 arch/arm/dts/mt8195-demo.dts        | 109 ++++++++++++++++++++++++++++
 board/mediatek/mt8195/MAINTAINERS   |   6 ++
 board/mediatek/mt8195/Makefile      |   3 +
 board/mediatek/mt8195/mt8195_demo.c |  38 ++++++++++
 configs/mt8195_demo_defconfig       |  89 +++++++++++++++++++++++
 include/configs/mt8195.h            |  34 +++++++++
 8 files changed, 281 insertions(+)
 create mode 100644 arch/arm/dts/mt8195-demo.dts
 create mode 100644 board/mediatek/mt8195/MAINTAINERS
 create mode 100644 board/mediatek/mt8195/Makefile
 create mode 100644 board/mediatek/mt8195/mt8195_demo.c
 create mode 100644 configs/mt8195_demo_defconfig
 create mode 100644 include/configs/mt8195.h
MAINTAINERS +1 -0
index 5528dd28c3..5aaeeb02cb 100644
@@ -389,6 +389,7 @@ F:	drivers/watchdog/mtk_wdt.c
 F:	drivers/net/mtk_eth.c
 F:	drivers/net/mtk_eth.h
 F:	drivers/reset/reset-mediatek.c
+F:	include/configs/mt8195.h
 F:	tools/mtk_image.c
 F:	tools/mtk_image.h
 F:	tools/mtk_nand_headers.c
arch/arm/dts/Makefile +1 -0
index 791838733c..994f7ebcc0 100644
@@ -1271,6 +1271,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7986a-emmc-rfb.dtb \
 	mt7986b-emmc-rfb.dtb \
 	mt8183-pumpkin.dtb \
+	mt8195-demo.dtb \
 	mt8512-bm1-emmc.dtb \
 	mt8516-pumpkin.dtb \
 	mt8518-ap1-emmc.dtb
arch/arm/dts/mt8195-demo.dts new file +109 -0

109 lines not on this page · raw message

board/mediatek/mt8195/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..01fa25115d
@@ -0,0 +1,6 @@
+MT8195 Demo
+M:	Macpaul Lin <[email protected]>
+S:	Maintained
+F:	board/mediatek/mt8195
+F:	include/configs/mt8195.h
+F:	configs/mt8195_demo_defconfig
board/mediatek/mt8195/Makefile new file +3 -0
new file mode 100644
index 0000000000..7e94a87aea
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += mt8195_demo.o
board/mediatek/mt8195/mt8195_demo.c new file +38 -0
new file mode 100644
index 0000000000..b95f5cf28d
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 BayLibre SAS
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <net.h>
+#include <asm/io.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();
+
+	printf("Disabling WDT\n");
+	writel(0, 0x10007000);
+
+	printf("Enabling SCP SRAM\n");
+	for (unsigned int val = 0xFFFFFFFF; val != 0U;) {
+		val = val >> 1;
+		writel(val, 0x1072102C);
+	}
+
+	return 0;
+}
configs/mt8195_demo_defconfig new file +89 -0

89 lines not on this page · raw message

include/configs/mt8195.h new file +34 -0
new file mode 100644
index 0000000000..22bcf87794
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for MT8195 based boards
+ *
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Fabien Parent <[email protected]>
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#ifndef __MT8195_H
+#define __MT8195_H
+
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	-4
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_COM1		0x11002000
+#define CONFIG_SYS_NS16550_CLK		26000000
+
+/* Environment settings */
+#include <config_distro_bootcmd.h>
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0)
+
+#if !defined(CONFIG_EXTRA_ENV_SETTINGS)
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"scriptaddr=0x40000000\0" \
+	BOOTENV
+#endif
+
+#endif
Signature · 1 line
2.18.0
#6 lore raw
In reply to Macpaul Lin
Quoted 263 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

---
 MAINTAINERS                            |   2 +
 arch/arm/dts/mt8195.dtsi               | 317
+++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |  13 +-
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 +++++++
 6 files changed, 416 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c
MAINTAINERS +2 -0
index 1cf99c1393..5528dd28c3 100644
@@ -362,8 +362,10 @@ ARM MEDIATEK
 M:	Ryder Lee <[email protected]>
 M:	Weijie Gao <[email protected]>
 M:	Chunfeng Yun <[email protected]>
+M:	Macpaul Lin <[email protected]>
 R:	GSS_MTK_Uboot_upstream <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/mt8195.dtsi
 F:	arch/arm/mach-mediatek/
 F:	arch/arm/include/asm/arch-mediatek/
 F:	board/mediatek/
arch/arm/dts/mt8195.dtsi new file +164 -0
new file mode 100644
index 0000000000..d28b038d57
@@ -0,0 +1,317 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Ben Ho <[email protected]>
+ *         Erin Lo <[email protected]>
+ *         Fabien Parent <[email protected]>
+ *         Macpaul Lin <[email protected]>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/phy/phy.h>
+
+/ {
+	compatible = "mediatek,mt8195";
+	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>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cpu4>;
+				};
+				core1 {
+					cpu = <&cpu5>;
+				};
+				core2 {
+					cpu = <&cpu6>;
+				};
+				core3 {
+					cpu = <&cpu7>;
+				};
+			};
+		};
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x000>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x001>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu2: cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x002>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x003>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu4: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x100>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu5: cpu@101 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x101>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu6: cpu@102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x102>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu7: cpu@103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x103>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+	};
+
+	clk26m: oscillator {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <26000000>;
+		clock-output-names = "clk26m";
+	};
+
+	mmc_source_clk: mmc-source-clk{
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <400000000>;
+		clock-output-names = "mmc_source_clk";
+	};
+
+	soc {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		compatible = "simple-bus";
+		ranges;
+
+		watchdog: watchdog@10007000 {
+			compatible = "mediatek,mt8195-wdt",
+				      "mediatek,wdt";
+			reg = <0 0x10007000 0 0x100>;
+			status = "disabled";
+		};
+
+		gic: interrupt-controller@c000000 {
+			compatible = "arm,gic-v3";
+			#interrupt-cells = <4>;
+			interrupt-parent = <&gic>;
+			interrupt-controller;
+			reg = <0 0x0c000000 0 0x40000>,  /* GICD */
+			      <0 0x0c100000 0 0x200000>, /* GICR */
+			      <0 0x0c400000 0 0x2000>,   /* GICC */
+			      <0 0x0c410000 0 0x1000>,   /* GICH */
+			      <0 0x0c420000 0 0x2000>;   /* GICV */
+
+			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH 0>;
+			ppi-partitions {
+				ppi_cluster0: interrupt-partition-0 {
+					affinity = <&cpu0 &cpu1 &cpu2

&cpu3>;

arch/arm/dts/mt8195.dtsi new file +3 -0
+				};
+				ppi_cluster1: interrupt-partition-1 {
+					affinity = <&cpu4 &cpu5 &cpu6

&cpu7>;

arch/arm/dts/mt8195.dtsi new file +15 -0
+				};
+			};
+		};
+
+		sysirq: interrupt-controller@c530a80 {
+			compatible = "mediatek,mt8195-sysirq",
+				     "mediatek,mt6577-sysirq";
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			interrupt-parent = <&gic>;
+			reg = <0 0x0c530a80 0 0x50>;
+		};
+
+		topckgen: syscon@10000000 {
+			compatible = "mediatek,mt8195-topckgen",

"syscon";

arch/arm/dts/mt8195.dtsi new file +6 -0
+			reg = <0 0x10000000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		infracfg: syscon@10001000 {
+			compatible = "mediatek,mt8195-infracfg",

"syscon";

arch/arm/dts/mt8195.dtsi new file +6 -0
+			reg = <0 0x10001000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		apmixedsys: syscon@1000c000 {
+			compatible = "mediatek,mt8195-apmixedsys",

"syscon";

arch/arm/dts/mt8195.dtsi new file +19 -0
+			reg = <0 0x1000c000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		uart0: serial@11001100 {
+			compatible = "mediatek,mt8195-uart",
+				     "mediatek,hsuart";
+			reg = <0 0x11001100 0 0x1000>;
+			interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>;
+			clock-frequency = <26000000>;
+			clocks = <&clk26m>, <&clk26m>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		mmc0: mmc@11230000 {
+			compatible = "mediatek,mt8195-mmc",
+				     "mediatek,mt8183-mmc";
+			reg = <0 0x11230000 0 0x1000>,

arch/arm/dts/mt8195.dtsi line 223

Quoted 10 lines
arch/arm/dts/mt8195.dtsi new file +10 -0
+			      <0 0x11f50000 0 0x1000>;
+			interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&mmc_source_clk>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "source", "hclk", "source_cg";
+			status = "disabled";
+		};
+
+		u3phy0: usb-phy@11f40000 {

change node name as t-phy as u3phy3?

arch/arm/dts/mt8195.dtsi

Quoted 1 line
arch/arm/dts/mt8195.dtsi new file +1 -0
+			compatible = "mediatek,generic-tphy-v2";

prefer to add "mediatek,mt8195-tphy" before generic's

arch/arm/dts/mt8195.dtsi line 234

Quoted 10 lines
arch/arm/dts/mt8195.dtsi new file +10 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11e40000 0xe00>;
+			status = "okay";
+
+			u2port0: usb-phy@0 {
+				reg = <0 0x700>;
+				clocks = <&clk26m>,
+					 <&clk26m>;
+				clock-names = "ref", "da_ref";

these two clocks are optional, if sw can't control it, no need add it here.

arch/arm/dts/mt8195.dtsi line 243

Quoted 9 lines
arch/arm/dts/mt8195.dtsi new file +9 -0
+				#phy-cells = <1>;
+				status = "okay";
+			};
+
+			u3port0: usb-phy@700 {
+				reg = <0x700 0x700>;
+				clocks = <&clk26m>,
+					 <&clk26m>;
+				clock-names = "ref", "da_ref";

ditto

arch/arm/dts/mt8195.dtsi line 253

Quoted 11 lines
arch/arm/dts/mt8195.dtsi new file +7 -0
+				#phy-cells = <1>;
+				status = "okay";
+			};
+		};
+
+		usb: usb@11200000 {
+			compatible ="mediatek,mt8195-mtu3",

"mediatek,mtu3";

arch/arm/dts/mt8195.dtsi new file +3 -0
+			reg = <0 0x11200000 0 0x3e00>,
+			      <0 0x11203e00 0 0x0100>;
+			reg-names = "mac", "ippc";

"mac" can be removed, the driver get it from the first child node

Quoted 31 lines
arch/arm/dts/mt8195.dtsi new file +15 -0
+			phys = <&u2port0 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "ref_ck", "mcu_ck";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			status = "disabled";
+
+			ssusb: ssusb@11200000 {
+				compatible = "mediatek,ssusb";
+				reg = <0 0x11200000 0 0x3e00>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 128

IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8195.dtsi new file +8 -0
+				status = "disabled";
+			};
+
+			xhci0: xhci@11200000 {
+				compatible = "mediatek,mtk-xhci";
+				reg = <0 0x11200000 0 0x1000>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 129

IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8195.dtsi new file +5 -0
+				clocks = <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>;
+				clock-names = "sys_ck", "xhci_ck",

"ref_ck", "mcu_ck";

arch/arm/dts/mt8195.dtsi line 287

Quoted 6 lines
arch/arm/dts/mt8195.dtsi new file +6 -0
+				status = "disabled";
+			};
+		};
+
+		u3phy3: t-phy@11c50000 {
+			compatible = "mediatek,generic-tphy-v2";

add specific one

Quoted 4 lines
arch/arm/dts/mt8195.dtsi new file +4 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11c50000 0x700>;
+			status = "okay";

arch/arm/dts/mt8195.dtsi line 301

Quoted 10 lines
arch/arm/dts/mt8195.dtsi new file +10 -0
+
+			u2port3: usb-phy@0 {
+				reg = <0x0 0x700>;
+				clocks = <&clk26m>;
+				clock-names = "ref";
+				#phy-cells = <1>;
+			};
+		};
+
+		xhci3: xhci3@112b0000 {

change node name as xhci? prefer to use the same name

arch/arm/dts/mt8195.dtsi line 306

Quoted 5 lines
arch/arm/dts/mt8195.dtsi new file +5 -0
+			compatible = "mediatek,mt8195-xhci",
+				     "mediatek,mtk-xhci";
+			reg = <0 0x112b0000 0 0x1000>,
+			      <0 0x112b3e00 0 0x0100>;
+			reg-names = "mac", "ippc";

remove "mac"

Quoted 176 lines
arch/arm/dts/mt8195.dtsi new file +11 -0
+			interrupts = <GIC_SPI 536 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&u2port3 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "xhci_ck", "ref_ck";
+			usb2-lpm-disable;
+			status = "disabled";
+		};
+	};
+};
arch/arm/mach- renamed from arch/arm/mach-mediatek/Kconfig +0 -0

mediatek/Kconfig
index 04aa2fd97f..3a2af1cdee 100644

arch/arm/mach-mediatek/Kconfig +0 -0
@@ -67,6 +67,15 @@ config TARGET_MT8183
 	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several

LPDDR3

arch/arm/mach-mediatek/Kconfig +5 -0
 	  and LPDDR4 options.
 
+config TARGET_MT8195
+	bool "MediaTek MT8195 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8195 is a ARM64-based SoC with a quad-core

Cortex-A73 and

arch/arm/mach-mediatek/Kconfig +1 -0
+	  a quad-core Cortex-A53. It is including UART, SPI, USB3.0

device and hosts,

arch/arm/mach-mediatek/Kconfig +1 -0
+	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several

LPDDR3

arch/arm/mach-mediatek/Kconfig +4 -0
+	  and LPDDR4 options.
+
 config TARGET_MT8512
         bool "MediaTek MT8512 M1 Board"
         select ARM64
@@ -105,6 +114,7 @@ config SYS_BOARD
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -122,6 +132,7 @@ config SYS_CONFIG_NAME
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -134,7 +145,7 @@ config SYS_CONFIG_NAME
 config MTK_BROM_HEADER_INFO
 	string
 	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 ||

TARGET_MT7629 || TARGET_MT7622

arch/arm/mach-mediatek/Kconfig +0 -1
-	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 ||

TARGET_MT8183

arch/arm/mach-mediatek/Kconfig +1 -0
+	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 ||

TARGET_MT8183 || TARGET_MT8195
default "media=snand;nandinfo=2k+64" if TARGET_MT7981 ||
TARGET_MT7986

arch/arm/mach-mediatek/Kconfig +0 -0
 	default "lk=1" if TARGET_MT7623
arch/arm/mach- renamed from arch/arm/mach-mediatek/Makefile +0 -0

mediatek/Makefile
index fc85293f71..fbbb5431d1 100644

arch/arm/mach-mediatek/Makefile +1 -0
@@ -10,5 +10,6 @@ obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT7981) += mt7981/
 obj-$(CONFIG_TARGET_MT7986) += mt7986/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
+obj-$(CONFIG_TARGET_MT8195) += mt8195/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
 obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach- renamed from arch/arm/mach-mediatek/mt8195/Makefile +0 -0

mediatek/mt8195/Makefile
new file mode 100644
index 0000000000..886ab7e4eb

arch/arm/mach-mediatek/mt8195/Makefile new file +3 -0
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach- renamed from arch/arm/mach-mediatek/mt8195/init.c +0 -0

mediatek/mt8195/init.c
new file mode 100644
index 0000000000..1eb4ade6c5

arch/arm/mach-mediatek/mt8195/init.c new file +68 -0
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Macpaul Lin <[email protected]>
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <clk.h>
+#include <common.h>
+#include <dm.h>
+#include <fdtdec.h>
+#include <ram.h>
+#include <asm/arch/misc.h>
+#include <asm/armv8/mmu.h>
+#include <asm/sections.h>
+#include <asm/system.h>
+#include <dm/uclass.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	int ret;
+
+	ret = fdtdec_setup_memory_banksize();
+	if (ret)
+		return ret;
+
+	return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+	gd->bd->bi_dram[0].start = gd->ram_base;
+	gd->bd->bi_dram[0].size = gd->ram_size;
+
+	return 0;
+}
+
+int mtk_pll_early_init(void)
+{
+	return 0;
+}
+
+int mtk_soc_early_init(void)
+{
+	return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+	psci_system_reset();
+}
+
+int print_cpuinfo(void)
+{
+	printf("CPU:   MediaTek MT8195\n");
+	return 0;
+}
+
+static struct mm_region mt8195_mem_map[] = {
+	{
+		/* DDR */
+		.virt = 0x40000000UL,
+		.phys = 0x40000000UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |

PTE_BLOCK_OUTER_SHARE,

arch/arm/mach-mediatek/mt8195/init.c new file +13 -0
+	}, {
+		.virt = 0x00000000UL,
+		.phys = 0x00000000UL,
+		.size = 0x20000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		0,
+	}
+};
+
+struct mm_region *mem_map = mt8195_mem_map;
#7 lore raw
Quoted 10 lines · Chunfeng Yun (云春峰)
Quoted 9 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

Quoted 14 lines
Quoted 11 lines
---
  MAINTAINERS                            |   2 +
  arch/arm/dts/mt8195.dtsi               | 317
+++++++++++++++++++++++++
  arch/arm/mach-mediatek/Kconfig         |  13 +-
  arch/arm/mach-mediatek/Makefile        |   1 +
  arch/arm/mach-mediatek/mt8195/Makefile |   3 +
  arch/arm/mach-mediatek/mt8195/init.c   |  81 +++++++
  6 files changed, 416 insertions(+), 1 deletion(-)
Quoted 3 lines

create mode 100644 arch/arm/dts/mt8195.dtsi create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

[deleted]

Quoted 3 lines

arch/arm/dts/mt8195.dtsi line 223

Quoted 1 line
arch/arm/dts/mt8195.dtsi new file +1 -0
+		u3phy0: usb-phy@11f40000 {

change node name as t-phy as u3phy3?

Got it, will fix it in next version.

Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+			compatible = "mediatek,generic-tphy-v2";

prefer to add "mediatek,mt8195-tphy" before generic's

Will fix it in next version.

Quoted 4 lines
Quoted 4 lines
arch/arm/dts/mt8195.dtsi new file +4 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11e40000 0xe00>;
+			status = "okay";
Quoted 8 lines

arch/arm/dts/mt8195.dtsi line 234

Quoted 6 lines
arch/arm/dts/mt8195.dtsi new file +6 -0
+
+			u2port0: usb-phy@0 {
+				reg = <0 0x700>;
+				clocks = <&clk26m>,
+					 <&clk26m>;
+				clock-names = "ref", "da_ref";

these two clocks are optional, if sw can't control it, no need add it here.

MediaTek's clock driver developer will upstream clock driver when refactoring work has been completed. Before clock driver is applied to trunk, we can use clk26m only.
Will fix it in next version.

Quoted 11 lines

arch/arm/dts/mt8195.dtsi line 243

Quoted 9 lines
arch/arm/dts/mt8195.dtsi new file +9 -0
+				#phy-cells = <1>;
+				status = "okay";
+			};
+
+			u3port0: usb-phy@700 {
+				reg = <0x700 0x700>;
+				clocks = <&clk26m>,
+					 <&clk26m>;
+				clock-names = "ref", "da_ref";

ditto

Will fix it in next version.

Quoted 4 lines
Quoted 4 lines
arch/arm/dts/mt8195.dtsi new file +4 -0
+				#phy-cells = <1>;
+				status = "okay";
+			};
+		};
Quoted 9 lines

arch/arm/dts/mt8195.dtsi line 253

Quoted 7 lines
arch/arm/dts/mt8195.dtsi new file +3 -0
+
+		usb: usb@11200000 {
+			compatible ="mediatek,mt8195-mtu3",

"mediatek,mtu3";

arch/arm/dts/mt8195.dtsi new file +3 -0
+			reg = <0 0x11200000 0 0x3e00>,
+			      <0 0x11203e00 0 0x0100>;
+			reg-names = "mac", "ippc";

"mac" can be removed, the driver get it from the first child node

Will fix it in next version.

Quoted 30 lines
Quoted 30 lines
arch/arm/dts/mt8195.dtsi new file +15 -0
+			phys = <&u2port0 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "ref_ck", "mcu_ck";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			status = "disabled";
+
+			ssusb: ssusb@11200000 {
+				compatible = "mediatek,ssusb";
+				reg = <0 0x11200000 0 0x3e00>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 128

IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8195.dtsi new file +8 -0
+				status = "disabled";
+			};
+
+			xhci0: xhci@11200000 {
+				compatible = "mediatek,mtk-xhci";
+				reg = <0 0x11200000 0 0x1000>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 129

IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8195.dtsi new file +5 -0
+				clocks = <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>;
+				clock-names = "sys_ck", "xhci_ck",
Quoted 9 lines

arch/arm/dts/mt8195.dtsi line 287

Quoted 7 lines

"ref_ck", "mcu_ck";

arch/arm/dts/mt8195.dtsi new file +6 -0
+				status = "disabled";
+			};
+		};
+
+		u3phy3: t-phy@11c50000 {
+			compatible = "mediatek,generic-tphy-v2";

add specific one

Will fix it in next version.

Quoted 7 lines
Quoted 7 lines
arch/arm/dts/mt8195.dtsi new file +7 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11c50000 0x700>;
+			status = "okay";
+
+			u2port3: usb-phy@0 {
+				reg = <0x0 0x700>;
Quoted 9 lines

arch/arm/dts/mt8195.dtsi line 301

Quoted 7 lines
arch/arm/dts/mt8195.dtsi new file +7 -0
+				clocks = <&clk26m>;
+				clock-names = "ref";
+				#phy-cells = <1>;
+			};
+		};
+
+		xhci3: xhci3@112b0000 {

change node name as xhci? prefer to use the same name

Since there are other board manufacturers will use the other HOST ports, like xhci1 or xhci2 with USB mass storage function by their needs.
I'll add these 2 node in dtsi in next version.

Quoted 6 lines

arch/arm/dts/mt8195.dtsi line 306

Quoted 5 lines
arch/arm/dts/mt8195.dtsi new file +5 -0
+			compatible = "mediatek,mt8195-xhci",
+				     "mediatek,mtk-xhci";
+			reg = <0 0x112b0000 0 0x1000>,
+			      <0 0x112b3e00 0 0x0100>;
+			reg-names = "mac", "ippc";

remove "mac"

Will fix it in next version.

Quoted 168 lines
Quoted 168 lines
arch/arm/dts/mt8195.dtsi new file +11 -0
+			interrupts = <GIC_SPI 536 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&u2port3 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "xhci_ck", "ref_ck";
+			usb2-lpm-disable;
+			status = "disabled";
+		};
+	};
+};
arch/arm/mach- renamed from arch/arm/mach-mediatek/Kconfig +0 -0

mediatek/Kconfig
index 04aa2fd97f..3a2af1cdee 100644

arch/arm/mach-mediatek/Kconfig +0 -0
@@ -67,6 +67,15 @@ config TARGET_MT8183
  	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several

LPDDR3
and LPDDR4 options.

arch/arm/mach-mediatek/Kconfig +5 -0
+config TARGET_MT8195
+	bool "MediaTek MT8195 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8195 is a ARM64-based SoC with a quad-core

Cortex-A73 and

arch/arm/mach-mediatek/Kconfig +1 -0
+	  a quad-core Cortex-A53. It is including UART, SPI, USB3.0

device and hosts,

arch/arm/mach-mediatek/Kconfig +1 -0
+	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several

LPDDR3

arch/arm/mach-mediatek/Kconfig +4 -0
+	  and LPDDR4 options.
+
  config TARGET_MT8512
          bool "MediaTek MT8512 M1 Board"
          select ARM64
@@ -105,6 +114,7 @@ config SYS_BOARD
  	default "mt7981" if TARGET_MT7981
  	default "mt7986" if TARGET_MT7986
  	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
  	default "mt8512" if TARGET_MT8512
  	default "mt8516" if TARGET_MT8516
  	default "mt8518" if TARGET_MT8518
@@ -122,6 +132,7 @@ config SYS_CONFIG_NAME
  	default "mt7981" if TARGET_MT7981
  	default "mt7986" if TARGET_MT7986
  	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
  	default "mt8512" if TARGET_MT8512
  	default "mt8516" if TARGET_MT8516
  	default "mt8518" if TARGET_MT8518
@@ -134,7 +145,7 @@ config SYS_CONFIG_NAME
  config MTK_BROM_HEADER_INFO
  	string
  	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 ||

TARGET_MT7629 || TARGET_MT7622

arch/arm/mach-mediatek/Kconfig +0 -1
-	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 ||

TARGET_MT8183

arch/arm/mach-mediatek/Kconfig +1 -0
+	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 ||

TARGET_MT8183 || TARGET_MT8195
default "media=snand;nandinfo=2k+64" if TARGET_MT7981 ||
TARGET_MT7986
default "lk=1" if TARGET_MT7623

arch/arm/mach- renamed from arch/arm/mach-mediatek/Makefile +0 -0

mediatek/Makefile
index fc85293f71..fbbb5431d1 100644

arch/arm/mach-mediatek/Makefile +1 -0
@@ -10,5 +10,6 @@ obj-$(CONFIG_TARGET_MT7629) += mt7629/
  obj-$(CONFIG_TARGET_MT7981) += mt7981/
  obj-$(CONFIG_TARGET_MT7986) += mt7986/
  obj-$(CONFIG_TARGET_MT8183) += mt8183/
+obj-$(CONFIG_TARGET_MT8195) += mt8195/
  obj-$(CONFIG_TARGET_MT8516) += mt8516/
  obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach- renamed from arch/arm/mach-mediatek/mt8195/Makefile +0 -0

mediatek/mt8195/Makefile
new file mode 100644
index 0000000000..886ab7e4eb

arch/arm/mach-mediatek/mt8195/Makefile new file +3 -0
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach- renamed from arch/arm/mach-mediatek/mt8195/init.c +0 -0

mediatek/mt8195/init.c
new file mode 100644
index 0000000000..1eb4ade6c5

arch/arm/mach-mediatek/mt8195/init.c new file +68 -0
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Macpaul Lin <[email protected]>
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <clk.h>
+#include <common.h>
+#include <dm.h>
+#include <fdtdec.h>
+#include <ram.h>
+#include <asm/arch/misc.h>
+#include <asm/armv8/mmu.h>
+#include <asm/sections.h>
+#include <asm/system.h>
+#include <dm/uclass.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	int ret;
+
+	ret = fdtdec_setup_memory_banksize();
+	if (ret)
+		return ret;
+
+	return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+	gd->bd->bi_dram[0].start = gd->ram_base;
+	gd->bd->bi_dram[0].size = gd->ram_size;
+
+	return 0;
+}
+
+int mtk_pll_early_init(void)
+{
+	return 0;
+}
+
+int mtk_soc_early_init(void)
+{
+	return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+	psci_system_reset();
+}
+
+int print_cpuinfo(void)
+{
+	printf("CPU:   MediaTek MT8195\n");
+	return 0;
+}
+
+static struct mm_region mt8195_mem_map[] = {
+	{
+		/* DDR */
+		.virt = 0x40000000UL,
+		.phys = 0x40000000UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |

PTE_BLOCK_OUTER_SHARE,

arch/arm/mach-mediatek/mt8195/init.c new file +5 -0
+	}, {
+		.virt = 0x00000000UL,
+		.phys = 0x00000000UL,
+		.size = 0x20000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
Quoted 8 lines

arch/arm/mach-mediatek/mt8195/init.c line 81

Quoted 8 lines
arch/arm/mach-mediatek/mt8195/init.c new file +8 -0
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		0,
+	}
+};
+
+struct mm_region *mem_map = mt8195_mem_map;

Thanks a lot!
Macpaul Lin

#8 lore raw
Quoted 12 lines · Macpaul Lin
Quoted 10 lines · Chunfeng Yun (云春峰)
Quoted 9 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines

---
  MAINTAINERS                            |   2 +
  arch/arm/dts/mt8195.dtsi               | 317
+++++++++++++++++++++++++

Quoted 8 lines
Quoted 8 lines

  arch/arm/mach-mediatek/Kconfig         |  13 +- arch/arm/mach-mediatek/Makefile        |   1 + arch/arm/mach-mediatek/mt8195/Makefile |   3 + arch/arm/mach-mediatek/mt8195/init.c   |  81 +++++++

  6 files changed, 416 insertions(+), 1 deletion(-)

  create mode 100644 arch/arm/dts/mt8195.dtsi create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

[deleted]

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

+        xhci3: xhci3@112b0000 {

change node name as xhci? prefer to use the same name

Since there are other board manufacturers will use the other HOST ports, like xhci1 or xhci2 with USB mass storage function by their needs.
I'll add these 2 node in dtsi in next version.

Quoted 9 lines
Quoted 6 lines
Quoted 5 lines

+            compatible = "mediatek,mt8195-xhci",
+                     "mediatek,mtk-xhci";
+            reg = <0 0x112b0000 0 0x1000>,
+                  <0 0x112b3e00 0 0x0100>;
+            reg-names = "mac", "ippc";

remove "mac"

Will fix it in next version.

Dear Chunfeng,

Unfortunately, if we remove "mac" register here for HOST only node like xhci3, the driver will complain about probing fail. Please check the following log.

=> usb start
starting USB...
Bus xhci3@112b0000: xhci-mtk xhci3@112b0000: failed to get xHCI base address probe failed, error -6
No working controllers found

I'll add "mac" back to HOST only nodes.

Thanks!
Macpaul Lin

#9 lore raw
Quoted 54 lines · Macpaul Lin
Quoted 15 lines · Macpaul Lin
Quoted 13 lines · Chunfeng Yun (云春峰)
Quoted 12 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73
and
a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and
hosts,
SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
and LPDDR4 options.

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
---
  MAINTAINERS                            |   2 +
  arch/arm/dts/mt8195.dtsi               | 317

+++++++++++++++++++++++++

Quoted 8 lines
Quoted 8 lines
  arch/arm/mach-mediatek/Kconfig         |  13 +-
  arch/arm/mach-mediatek/Makefile        |   1 +
  arch/arm/mach-mediatek/mt8195/Makefile |   3 +
  arch/arm/mach-mediatek/mt8195/init.c   |  81 +++++++
  6 files changed, 416 insertions(+), 1 deletion(-)

create mode 100644 arch/arm/dts/mt8195.dtsi create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

[deleted]

Quoted 16 lines
Quoted 4 lines
Quoted 1 line

+ xhci3: xhci3@112b0000 {

change node name as xhci? prefer to use the same name

Since there are other board manufacturers will use the other HOST ports, like xhci1 or xhci2 with USB mass storage function by their needs.
I'll add these 2 node in dtsi in next version.

Quoted 6 lines
Quoted 5 lines
arch/arm/dts/mt8195.dtsi new file +5 -0
+            compatible = "mediatek,mt8195-xhci",
+                     "mediatek,mtk-xhci";
+            reg = <0 0x112b0000 0 0x1000>,
+                  <0 0x112b3e00 0 0x0100>;
+            reg-names = "mac", "ippc";
Quoted 4 lines
Quoted 1 line

remove "mac"

Will fix it in next version.

Quoted 6 lines

Dear Chunfeng,

Unfortunately, if we remove "mac" register here for HOST only node like
xhci3, the driver will complain about probing fail. Please check the following log.

My bad, do need it for host only mode, sorry

Quoted 12 lines

=> usb start
starting USB...
Bus xhci3@112b0000: xhci-mtk xhci3@112b0000: failed to get xHCI base address
probe failed, error -6
No working controllers found

I'll add "mac" back to HOST only nodes.

Thanks!
Macpaul Lin

#10 lore raw

PATCH v2 1/2 arm: mediatek: add mt8195 SOC support

In reply to Macpaul Lin

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts, SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

---
 MAINTAINERS                            |   2 +
 arch/arm/dts/mt8195.dtsi               | 370 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |  13 +-
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 ++++++
 6 files changed, 469 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

Changes for v2:
- Correct node name to t-phy for u3phy0.
- Add platform compatible string "mediatek,mt8195-tphy" to all usb phy nodes.
- remove clock nodes that software cannot controlled in phy nodes.
- Test and add back "mac" for HOST only xhci nodes.

MAINTAINERS +2 -0
index 1cf99c1393..5528dd28c3 100644
@@ -362,8 +362,10 @@ ARM MEDIATEK
 M:	Ryder Lee <[email protected]>
 M:	Weijie Gao <[email protected]>
 M:	Chunfeng Yun <[email protected]>
+M:	Macpaul Lin <[email protected]>
 R:	GSS_MTK_Uboot_upstream <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/mt8195.dtsi
 F:	arch/arm/mach-mediatek/
 F:	arch/arm/include/asm/arch-mediatek/
 F:	board/mediatek/
arch/arm/dts/mt8195.dtsi new file +370 -0

370 lines not on this page · raw message

arch/arm/mach-mediatek/Kconfig +12 -1
index 04aa2fd97f..3a2af1cdee 100644
@@ -67,6 +67,15 @@ config TARGET_MT8183
 	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
 	  and LPDDR4 options.
 
+config TARGET_MT8195
+	bool "MediaTek MT8195 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
+	  a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
+	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
+	  and LPDDR4 options.
+
 config TARGET_MT8512
         bool "MediaTek MT8512 M1 Board"
         select ARM64
@@ -105,6 +114,7 @@ config SYS_BOARD
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -122,6 +132,7 @@ config SYS_CONFIG_NAME
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -134,7 +145,7 @@ config SYS_CONFIG_NAME
 config MTK_BROM_HEADER_INFO
 	string
 	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 || TARGET_MT7622
-	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
+	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 || TARGET_MT8195
 	default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986
 	default "lk=1" if TARGET_MT7623
 
arch/arm/mach-mediatek/Makefile +1 -0
index fc85293f71..fbbb5431d1 100644
@@ -10,5 +10,6 @@ obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT7981) += mt7981/
 obj-$(CONFIG_TARGET_MT7986) += mt7986/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
+obj-$(CONFIG_TARGET_MT8195) += mt8195/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
 obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach-mediatek/mt8195/Makefile new file +3 -0
new file mode 100644
index 0000000000..886ab7e4eb
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach-mediatek/mt8195/init.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.18.0
#11 lore raw

PATCH v2 2/2 board: mediatek: add mt8195 demo board

From: Fabien Parent <[email protected]>

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

---
 MAINTAINERS                         |   1 +
 arch/arm/dts/Makefile               |   1 +
 arch/arm/dts/mt8195-demo.dts        | 109 ++++++++++++++++++++++++++++
 board/mediatek/mt8195/MAINTAINERS   |   6 ++
 board/mediatek/mt8195/Makefile      |   3 +
 board/mediatek/mt8195/mt8195_demo.c |  38 ++++++++++
 configs/mt8195_demo_defconfig       |  89 +++++++++++++++++++++++
 include/configs/mt8195.h            |  34 +++++++++
 8 files changed, 281 insertions(+)
 create mode 100644 arch/arm/dts/mt8195-demo.dts
 create mode 100644 board/mediatek/mt8195/MAINTAINERS
 create mode 100644 board/mediatek/mt8195/Makefile
 create mode 100644 board/mediatek/mt8195/mt8195_demo.c
 create mode 100644 configs/mt8195_demo_defconfig
 create mode 100644 include/configs/mt8195.h

Changes for v2:
- no change.

MAINTAINERS +1 -0
index 5528dd28c3..5aaeeb02cb 100644
@@ -389,6 +389,7 @@ F:	drivers/watchdog/mtk_wdt.c
 F:	drivers/net/mtk_eth.c
 F:	drivers/net/mtk_eth.h
 F:	drivers/reset/reset-mediatek.c
+F:	include/configs/mt8195.h
 F:	tools/mtk_image.c
 F:	tools/mtk_image.h
 F:	tools/mtk_nand_headers.c
arch/arm/dts/Makefile +1 -0
index 791838733c..994f7ebcc0 100644
@@ -1271,6 +1271,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7986a-emmc-rfb.dtb \
 	mt7986b-emmc-rfb.dtb \
 	mt8183-pumpkin.dtb \
+	mt8195-demo.dtb \
 	mt8512-bm1-emmc.dtb \
 	mt8516-pumpkin.dtb \
 	mt8518-ap1-emmc.dtb
arch/arm/dts/mt8195-demo.dts new file +109 -0

109 lines not on this page · raw message

board/mediatek/mt8195/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..01fa25115d
@@ -0,0 +1,6 @@
+MT8195 Demo
+M:	Macpaul Lin <[email protected]>
+S:	Maintained
+F:	board/mediatek/mt8195
+F:	include/configs/mt8195.h
+F:	configs/mt8195_demo_defconfig
board/mediatek/mt8195/Makefile new file +3 -0
new file mode 100644
index 0000000000..7e94a87aea
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += mt8195_demo.o
board/mediatek/mt8195/mt8195_demo.c new file +38 -0
new file mode 100644
index 0000000000..b95f5cf28d
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 BayLibre SAS
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <net.h>
+#include <asm/io.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();
+
+	printf("Disabling WDT\n");
+	writel(0, 0x10007000);
+
+	printf("Enabling SCP SRAM\n");
+	for (unsigned int val = 0xFFFFFFFF; val != 0U;) {
+		val = val >> 1;
+		writel(val, 0x1072102C);
+	}
+
+	return 0;
+}
configs/mt8195_demo_defconfig new file +89 -0

89 lines not on this page · raw message

include/configs/mt8195.h new file +34 -0
new file mode 100644
index 0000000000..22bcf87794
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for MT8195 based boards
+ *
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Fabien Parent <[email protected]>
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#ifndef __MT8195_H
+#define __MT8195_H
+
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	-4
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_COM1		0x11002000
+#define CONFIG_SYS_NS16550_CLK		26000000
+
+/* Environment settings */
+#include <config_distro_bootcmd.h>
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0)
+
+#if !defined(CONFIG_EXTRA_ENV_SETTINGS)
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"scriptaddr=0x40000000\0" \
+	BOOTENV
+#endif
+
+#endif
Signature · 1 line
2.18.0
#12 lore raw
In reply to Macpaul Lin
Quoted 351 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

---
 MAINTAINERS                            |   2 +
 arch/arm/dts/mt8195.dtsi               | 370
+++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |  13 +-
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 ++++++
 6 files changed, 469 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

Changes for v2:
- Correct node name to t-phy for u3phy0.
- Add platform compatible string "mediatek,mt8195-tphy" to all usb
phy nodes.
- remove clock nodes that software cannot controlled in phy nodes.
- Test and add back "mac" for HOST only xhci nodes.

MAINTAINERS +2 -0
index 1cf99c1393..5528dd28c3 100644
@@ -362,8 +362,10 @@ ARM MEDIATEK
 M:	Ryder Lee <[email protected]>
 M:	Weijie Gao <[email protected]>
 M:	Chunfeng Yun <[email protected]>
+M:	Macpaul Lin <[email protected]>
 R:	GSS_MTK_Uboot_upstream <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/mt8195.dtsi
 F:	arch/arm/mach-mediatek/
 F:	arch/arm/include/asm/arch-mediatek/
 F:	board/mediatek/
arch/arm/dts/mt8195.dtsi new file +164 -0
new file mode 100644
index 0000000000..33282d21d1
@@ -0,0 +1,370 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Ben Ho <[email protected]>
+ *         Erin Lo <[email protected]>
+ *         Fabien Parent <[email protected]>
+ *         Macpaul Lin <[email protected]>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/phy/phy.h>
+
+/ {
+	compatible = "mediatek,mt8195";
+	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>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cpu4>;
+				};
+				core1 {
+					cpu = <&cpu5>;
+				};
+				core2 {
+					cpu = <&cpu6>;
+				};
+				core3 {
+					cpu = <&cpu7>;
+				};
+			};
+		};
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x000>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x001>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu2: cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x002>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x003>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu4: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x100>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu5: cpu@101 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x101>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu6: cpu@102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x102>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu7: cpu@103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x103>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+	};
+
+	clk26m: oscillator {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <26000000>;
+		clock-output-names = "clk26m";
+	};
+
+	mmc_source_clk: mmc-source-clk{
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <400000000>;
+		clock-output-names = "mmc_source_clk";
+	};
+
+	soc {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		compatible = "simple-bus";
+		ranges;
+
+		watchdog: watchdog@10007000 {
+			compatible = "mediatek,mt8195-wdt",
+				      "mediatek,wdt";
+			reg = <0 0x10007000 0 0x100>;
+			status = "disabled";
+		};
+
+		gic: interrupt-controller@c000000 {
+			compatible = "arm,gic-v3";
+			#interrupt-cells = <4>;
+			interrupt-parent = <&gic>;
+			interrupt-controller;
+			reg = <0 0x0c000000 0 0x40000>,  /* GICD */
+			      <0 0x0c100000 0 0x200000>, /* GICR */
+			      <0 0x0c400000 0 0x2000>,   /* GICC */
+			      <0 0x0c410000 0 0x1000>,   /* GICH */
+			      <0 0x0c420000 0 0x2000>;   /* GICV */
+
+			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH 0>;
+			ppi-partitions {
+				ppi_cluster0: interrupt-partition-0 {
+					affinity = <&cpu0 &cpu1 &cpu2

&cpu3>;

arch/arm/dts/mt8195.dtsi new file +3 -0
+				};
+				ppi_cluster1: interrupt-partition-1 {
+					affinity = <&cpu4 &cpu5 &cpu6

&cpu7>;

arch/arm/dts/mt8195.dtsi new file +15 -0
+				};
+			};
+		};
+
+		sysirq: interrupt-controller@c530a80 {
+			compatible = "mediatek,mt8195-sysirq",
+				     "mediatek,mt6577-sysirq";
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			interrupt-parent = <&gic>;
+			reg = <0 0x0c530a80 0 0x50>;
+		};
+
+		topckgen: syscon@10000000 {
+			compatible = "mediatek,mt8195-topckgen",

"syscon";

arch/arm/dts/mt8195.dtsi new file +6 -0
+			reg = <0 0x10000000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		infracfg: syscon@10001000 {
+			compatible = "mediatek,mt8195-infracfg",

"syscon";

arch/arm/dts/mt8195.dtsi new file +6 -0
+			reg = <0 0x10001000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		apmixedsys: syscon@1000c000 {
+			compatible = "mediatek,mt8195-apmixedsys",

"syscon";

arch/arm/dts/mt8195.dtsi new file +30 -0
+			reg = <0 0x1000c000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		uart0: serial@11001100 {
+			compatible = "mediatek,mt8195-uart",
+				     "mediatek,hsuart";
+			reg = <0 0x11001100 0 0x1000>;
+			interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>;
+			clock-frequency = <26000000>;
+			clocks = <&clk26m>, <&clk26m>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		mmc0: mmc@11230000 {
+			compatible = "mediatek,mt8195-mmc",
+				     "mediatek,mt8183-mmc";
+			reg = <0 0x11230000 0 0x1000>,
+			      <0 0x11f50000 0 0x1000>;
+			interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&mmc_source_clk>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "source", "hclk", "source_cg";
+			status = "disabled";
+		};
+
+		u3phy0: t-phy@11f40000 {
+			compatible = "mediatek,mt8195-tphy",

"mediatek,generic-tphy-v2";

arch/arm/dts/mt8195.dtsi new file +20 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11e40000 0xe00>;
+			status = "okay";
+
+			u2port0: usb-phy@0 {
+				reg = <0 0x700>;
+				#phy-cells = <1>;
+				status = "okay";
+			};
+
+			u3port0: usb-phy@700 {
+				reg = <0x700 0x700>;
+				#phy-cells = <1>;
+				status = "okay";
+			};
+		};
+
+		usb: usb@11200000 {
+			compatible ="mediatek,mt8195-mtu3",

"mediatek,mtu3";

arch/arm/dts/mt8195.dtsi new file +17 -0
+			reg = <0 0x11203e00 0 0x0100>;
+			reg-names = "ippc";
+			phys = <&u2port0 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "ref_ck", "mcu_ck";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			status = "disabled";
+
+			ssusb: ssusb@11200000 {
+				compatible = "mediatek,ssusb";
+				reg = <0 0x11200000 0 0x3e00>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 128

IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8195.dtsi new file +8 -0
+				status = "disabled";
+			};
+
+			xhci0: xhci@11200000 {
+				compatible = "mediatek,mtk-xhci";
+				reg = <0 0x11200000 0 0x1000>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 129

IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8195.dtsi new file +5 -0
+				clocks = <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>;
+				clock-names = "sys_ck", "xhci_ck",

"ref_ck", "mcu_ck";

arch/arm/dts/mt8195.dtsi new file +6 -0
+				status = "disabled";
+			};
+		};
+
+		u3phy1: t-phy@11e30000 {
+			compatible = "mediatek,mt8195-tphy",

"mediatek,generic-tphy-v2";

arch/arm/dts/mt8195.dtsi new file +7 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11e30000 0xe00>;
+			status = "disabled";
+
+			u2port1: usb-phy@0 {
+				reg = <0x0 0x700>;

arch/arm/dts/mt8195.dtsi line 297

Quoted 10 lines
arch/arm/dts/mt8195.dtsi new file +10 -0
+				#phy-cells = <1>;
+			};
+
+			u3port1: usb-phy@700 {
+				reg = <0x700 0x700>;
+				#phy-cells = <1>;
+			};
+		};
+
+		xhci1: xhci1@11290000 {

Prefer to use 'xchi' as node name, but it's ok to use 'xhci1' as a label.

Quoted 21 lines
arch/arm/dts/mt8195.dtsi new file +12 -0
+			compatible = "mediatek,mt8195-xhci",
+				     "mediatek,mtk-xhci";
+			reg = <0 0x11290000 0 0x1000>,
+			      <0 0x11293e00 0 0x0100>;
+			reg-names = "mac", "ippc";
+			interrupts = <GIC_SPI 530 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&u2port1 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "xhci_ck", "ref_ck",

"mcu_ck";

arch/arm/dts/mt8195.dtsi new file +5 -0
+			status = "disabled";
+		};
+
+		u3phy2: t-phy@11c40000 {
+			compatible = "mediatek,mt8195-tphy",

"mediatek,generic-tphy-v2";

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

arch/arm/dts/mt8195.dtsi line 326

Quoted 10 lines
arch/arm/dts/mt8195.dtsi new file +10 -0
+			ranges = <0 0 0x11c40000 0x700>;
+			status = "disabled";
+
+			u2port2: usb-phy@0 {
+				reg = <0x0 0x700>;
+				#phy-cells = <1>;
+			};
+		};
+
+		xhci2: xhci2@112a0000 {

xhci2: xhci@112a0000

Quoted 19 lines
arch/arm/dts/mt8195.dtsi new file +16 -0
+			compatible = "mediatek,mt8195-xhci",
+				     "mediatek,mtk-xhci";
+			reg = <0 0x112a0000 0 0x1000>,
+			      <0 0x112a3e00 0 0x0100>;
+			reg-names = "mac", "ippc";
+			interrupts = <GIC_SPI 533 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&u2port2 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "xhci_ck", "ref_ck";
+			status = "disabled";
+		};
+
+		u3phy3: t-phy@11c50000 {
+			compatible = "mediatek,mt8195-tphy",

"mediatek,generic-tphy-v2";

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

arch/arm/dts/mt8195.dtsi line 354

Quoted 10 lines
arch/arm/dts/mt8195.dtsi new file +10 -0
+			ranges = <0 0 0x11c50000 0x700>;
+			status = "okay";
+
+			u2port3: usb-phy@0 {
+				reg = <0x0 0x700>;
+				#phy-cells = <1>;
+			};
+		};
+
+		xhci3: xhci3@112b0000 {

xhci3: xhci@112b0000

Quoted 181 lines
arch/arm/dts/mt8195.dtsi new file +16 -0
+			compatible = "mediatek,mt8195-xhci",
+				     "mediatek,mtk-xhci";
+			reg = <0 0x112b0000 0 0x1000>,
+			      <0 0x112b3e00 0 0x0100>;
+			reg-names = "mac", "ippc";
+			interrupts = <GIC_SPI 536 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&u2port3 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "xhci_ck", "ref_ck";
+			usb2-lpm-disable;
+			status = "disabled";
+		};
+	};
+};
arch/arm/mach- renamed from arch/arm/mach-mediatek/Kconfig +0 -0

mediatek/Kconfig
index 04aa2fd97f..3a2af1cdee 100644

arch/arm/mach-mediatek/Kconfig +0 -0
@@ -67,6 +67,15 @@ config TARGET_MT8183
 	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several

LPDDR3

arch/arm/mach-mediatek/Kconfig +5 -0
 	  and LPDDR4 options.
 
+config TARGET_MT8195
+	bool "MediaTek MT8195 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8195 is a ARM64-based SoC with a quad-core

Cortex-A73 and

arch/arm/mach-mediatek/Kconfig +1 -0
+	  a quad-core Cortex-A53. It is including UART, SPI, USB3.0

device and hosts,

arch/arm/mach-mediatek/Kconfig +1 -0
+	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several

LPDDR3

arch/arm/mach-mediatek/Kconfig +4 -0
+	  and LPDDR4 options.
+
 config TARGET_MT8512
         bool "MediaTek MT8512 M1 Board"
         select ARM64
@@ -105,6 +114,7 @@ config SYS_BOARD
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -122,6 +132,7 @@ config SYS_CONFIG_NAME
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -134,7 +145,7 @@ config SYS_CONFIG_NAME
 config MTK_BROM_HEADER_INFO
 	string
 	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 ||

TARGET_MT7629 || TARGET_MT7622

arch/arm/mach-mediatek/Kconfig +0 -1
-	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 ||

TARGET_MT8183

arch/arm/mach-mediatek/Kconfig +1 -0
+	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 ||

TARGET_MT8183 || TARGET_MT8195
default "media=snand;nandinfo=2k+64" if TARGET_MT7981 ||
TARGET_MT7986

arch/arm/mach-mediatek/Kconfig +0 -0
 	default "lk=1" if TARGET_MT7623
arch/arm/mach- renamed from arch/arm/mach-mediatek/Makefile +0 -0

mediatek/Makefile
index fc85293f71..fbbb5431d1 100644

arch/arm/mach-mediatek/Makefile +1 -0
@@ -10,5 +10,6 @@ obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT7981) += mt7981/
 obj-$(CONFIG_TARGET_MT7986) += mt7986/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
+obj-$(CONFIG_TARGET_MT8195) += mt8195/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
 obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach- renamed from arch/arm/mach-mediatek/mt8195/Makefile +0 -0

mediatek/mt8195/Makefile
new file mode 100644
index 0000000000..886ab7e4eb

arch/arm/mach-mediatek/mt8195/Makefile new file +3 -0
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach- renamed from arch/arm/mach-mediatek/mt8195/init.c +0 -0

mediatek/mt8195/init.c
new file mode 100644
index 0000000000..1eb4ade6c5

arch/arm/mach-mediatek/mt8195/init.c new file +68 -0
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Macpaul Lin <[email protected]>
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <clk.h>
+#include <common.h>
+#include <dm.h>
+#include <fdtdec.h>
+#include <ram.h>
+#include <asm/arch/misc.h>
+#include <asm/armv8/mmu.h>
+#include <asm/sections.h>
+#include <asm/system.h>
+#include <dm/uclass.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	int ret;
+
+	ret = fdtdec_setup_memory_banksize();
+	if (ret)
+		return ret;
+
+	return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+	gd->bd->bi_dram[0].start = gd->ram_base;
+	gd->bd->bi_dram[0].size = gd->ram_size;
+
+	return 0;
+}
+
+int mtk_pll_early_init(void)
+{
+	return 0;
+}
+
+int mtk_soc_early_init(void)
+{
+	return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+	psci_system_reset();
+}
+
+int print_cpuinfo(void)
+{
+	printf("CPU:   MediaTek MT8195\n");
+	return 0;
+}
+
+static struct mm_region mt8195_mem_map[] = {
+	{
+		/* DDR */
+		.virt = 0x40000000UL,
+		.phys = 0x40000000UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |

PTE_BLOCK_OUTER_SHARE,

arch/arm/mach-mediatek/mt8195/init.c new file +13 -0
+	}, {
+		.virt = 0x00000000UL,
+		.phys = 0x00000000UL,
+		.size = 0x20000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		0,
+	}
+};
+
+struct mm_region *mem_map = mt8195_mem_map;
#13 lore raw

PATCH v3 1/2 arm: mediatek: add mt8195 SOC support

In reply to Macpaul Lin

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts, SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

---
 MAINTAINERS                            |   2 +
 arch/arm/dts/mt8195.dtsi               | 370 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |  13 +-
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 ++++++
 6 files changed, 469 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

Changes for v2:
- Correct node name to t-phy for u3phy0.
- Add platform compatible string "mediatek,mt8195-tphy" to all usb phy nodes.
- remove clock nodes that software cannot controlled in phy nodes.
- Test and add back "mac" for HOST only xhci nodes.

Changes for v3:
- Revise device node name from "xhciX: xhciX@" to "xhciX: xhci@".

MAINTAINERS +2 -0
index 1cf99c1393..5528dd28c3 100644
@@ -362,8 +362,10 @@ ARM MEDIATEK
 M:	Ryder Lee <[email protected]>
 M:	Weijie Gao <[email protected]>
 M:	Chunfeng Yun <[email protected]>
+M:	Macpaul Lin <[email protected]>
 R:	GSS_MTK_Uboot_upstream <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/mt8195.dtsi
 F:	arch/arm/mach-mediatek/
 F:	arch/arm/include/asm/arch-mediatek/
 F:	board/mediatek/
arch/arm/dts/mt8195.dtsi new file +370 -0

370 lines not on this page · raw message

arch/arm/mach-mediatek/Kconfig +12 -1
index 04aa2fd97f..3a2af1cdee 100644
@@ -67,6 +67,15 @@ config TARGET_MT8183
 	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
 	  and LPDDR4 options.
 
+config TARGET_MT8195
+	bool "MediaTek MT8195 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
+	  a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
+	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
+	  and LPDDR4 options.
+
 config TARGET_MT8512
         bool "MediaTek MT8512 M1 Board"
         select ARM64
@@ -105,6 +114,7 @@ config SYS_BOARD
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -122,6 +132,7 @@ config SYS_CONFIG_NAME
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -134,7 +145,7 @@ config SYS_CONFIG_NAME
 config MTK_BROM_HEADER_INFO
 	string
 	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 || TARGET_MT7622
-	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
+	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 || TARGET_MT8195
 	default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986
 	default "lk=1" if TARGET_MT7623
 
arch/arm/mach-mediatek/Makefile +1 -0
index fc85293f71..fbbb5431d1 100644
@@ -10,5 +10,6 @@ obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT7981) += mt7981/
 obj-$(CONFIG_TARGET_MT7986) += mt7986/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
+obj-$(CONFIG_TARGET_MT8195) += mt8195/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
 obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach-mediatek/mt8195/Makefile new file +3 -0
new file mode 100644
index 0000000000..886ab7e4eb
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach-mediatek/mt8195/init.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.18.0
#14 lore raw

PATCH v3 2/2 board: mediatek: add mt8195 demo board

From: Fabien Parent <[email protected]>

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

---
 MAINTAINERS                         |   1 +
 arch/arm/dts/Makefile               |   1 +
 arch/arm/dts/mt8195-demo.dts        | 109 ++++++++++++++++++++++++++++
 board/mediatek/mt8195/MAINTAINERS   |   6 ++
 board/mediatek/mt8195/Makefile      |   3 +
 board/mediatek/mt8195/mt8195_demo.c |  38 ++++++++++
 configs/mt8195_demo_defconfig       |  89 +++++++++++++++++++++++
 include/configs/mt8195.h            |  34 +++++++++
 8 files changed, 281 insertions(+)
 create mode 100644 arch/arm/dts/mt8195-demo.dts
 create mode 100644 board/mediatek/mt8195/MAINTAINERS
 create mode 100644 board/mediatek/mt8195/Makefile
 create mode 100644 board/mediatek/mt8195/mt8195_demo.c
 create mode 100644 configs/mt8195_demo_defconfig
 create mode 100644 include/configs/mt8195.h

Changes for v2 and v3:
- no change.

MAINTAINERS +1 -0
index 5528dd28c3..5aaeeb02cb 100644
@@ -389,6 +389,7 @@ F:	drivers/watchdog/mtk_wdt.c
 F:	drivers/net/mtk_eth.c
 F:	drivers/net/mtk_eth.h
 F:	drivers/reset/reset-mediatek.c
+F:	include/configs/mt8195.h
 F:	tools/mtk_image.c
 F:	tools/mtk_image.h
 F:	tools/mtk_nand_headers.c
arch/arm/dts/Makefile +1 -0
index 791838733c..994f7ebcc0 100644
@@ -1271,6 +1271,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7986a-emmc-rfb.dtb \
 	mt7986b-emmc-rfb.dtb \
 	mt8183-pumpkin.dtb \
+	mt8195-demo.dtb \
 	mt8512-bm1-emmc.dtb \
 	mt8516-pumpkin.dtb \
 	mt8518-ap1-emmc.dtb
arch/arm/dts/mt8195-demo.dts new file +109 -0

109 lines not on this page · raw message

board/mediatek/mt8195/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..01fa25115d
@@ -0,0 +1,6 @@
+MT8195 Demo
+M:	Macpaul Lin <[email protected]>
+S:	Maintained
+F:	board/mediatek/mt8195
+F:	include/configs/mt8195.h
+F:	configs/mt8195_demo_defconfig
board/mediatek/mt8195/Makefile new file +3 -0
new file mode 100644
index 0000000000..7e94a87aea
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += mt8195_demo.o
board/mediatek/mt8195/mt8195_demo.c new file +38 -0
new file mode 100644
index 0000000000..b95f5cf28d
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 BayLibre SAS
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <net.h>
+#include <asm/io.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();
+
+	printf("Disabling WDT\n");
+	writel(0, 0x10007000);
+
+	printf("Enabling SCP SRAM\n");
+	for (unsigned int val = 0xFFFFFFFF; val != 0U;) {
+		val = val >> 1;
+		writel(val, 0x1072102C);
+	}
+
+	return 0;
+}
configs/mt8195_demo_defconfig new file +89 -0

89 lines not on this page · raw message

include/configs/mt8195.h new file +34 -0
new file mode 100644
index 0000000000..22bcf87794
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for MT8195 based boards
+ *
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Fabien Parent <[email protected]>
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#ifndef __MT8195_H
+#define __MT8195_H
+
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	-4
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_COM1		0x11002000
+#define CONFIG_SYS_NS16550_CLK		26000000
+
+/* Environment settings */
+#include <config_distro_bootcmd.h>
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0)
+
+#if !defined(CONFIG_EXTRA_ENV_SETTINGS)
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"scriptaddr=0x40000000\0" \
+	BOOTENV
+#endif
+
+#endif
Signature · 1 line
2.18.0
#15 lore raw

Re: [PATCH v3 2/2] board: mediatek: add mt8195 demo board

Quoted 8 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

[snip]

include/configs/mt8195.h line 20

Quoted 7 lines
include/configs/mt8195.h new file +7 -0
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	-4
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_COM1		0x11002000
+#define CONFIG_SYS_NS16550_CLK		26000000

This is unused, I believe. But when trying to build with current next I get:
Error: Load Address must be set.
Error: Bad parameters for image type

Please rebase on top of current next and repost, thanks!

Signature · 1 line
Tom
#16 lore raw

Re: [PATCH v3 2/2] board: mediatek: add mt8195 demo board

Quoted 24 lines · Tom Rini
Quoted 8 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

[snip]

include/configs/mt8195.h line 20

Quoted 7 lines
include/configs/mt8195.h new file +7 -0
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	-4
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_COM1		0x11002000
+#define CONFIG_SYS_NS16550_CLK		26000000

This is unused, I believe. But when trying to build with current next I get:
Error: Load Address must be set.
Error: Bad parameters for image type

Quoted 1 line

Please rebase on top of current next and repost, thanks!

Sorry for the noise, this failed due to another patch that needs to be reworked instead.

Signature · 1 line
Tom
#17 lore raw

Re: [PATCH v3 2/2] board: mediatek: add mt8195 demo board

Quoted 25 lines · Tom Rini
Quoted 24 lines · Tom Rini
Quoted 8 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

[snip]

include/configs/mt8195.h line 20

Quoted 7 lines
include/configs/mt8195.h new file +7 -0
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	-4
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_COM1		0x11002000
+#define CONFIG_SYS_NS16550_CLK		26000000

This is unused, I believe. But when trying to build with current next I get:
Error: Load Address must be set.
Error: Bad parameters for image type

Quoted 4 lines
Quoted 1 line

Please rebase on top of current next and repost, thanks!

Sorry for the noise, this failed due to another patch that needs to be reworked instead.

Welp, I should have finished my re-testing. The patch that broke phycore-rk3288 and I assumed broke this platform too, did not break this platform, there's still some other problem here.

Signature · 1 line
Tom
#18 lore raw

Re: [PATCH v3 2/2] board: mediatek: add mt8195 demo board

Quoted 26 lines · Tom Rini
Quoted 25 lines · Tom Rini
Quoted 24 lines · Tom Rini
Quoted 8 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

[snip]

include/configs/mt8195.h line 20

Quoted 7 lines
include/configs/mt8195.h new file +7 -0
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	-4
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_COM1		0x11002000
+#define CONFIG_SYS_NS16550_CLK		26000000

This is unused, I believe. But when trying to build with current next I get:
Error: Load Address must be set.
Error: Bad parameters for image type

Quoted 1 line
Quoted 1 line
Quoted 1 line

Please rebase on top of current next and repost, thanks!

Thanks for the information, will send patch v4 later.

Quoted 8 lines
Quoted 3 lines

Sorry for the noise, this failed due to another patch that needs to be reworked instead.

Welp, I should have finished my re-testing. The patch that broke phycore-rk3288 and I assumed broke this platform too, did not break this platform, there's still some other problem here.

I've tested it on uboot/next and got the following result.

$ make ARCH=arm phycore-rk3288_defconfig
$ make ARCH=arm
scripts/kconfig/conf  --syncconfig Kconfig
  UPD     include/config.h
  CFG     u-boot.cfg
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
  CFG     spl/u-boot.cfg
  GEN     spl/include/autoconf.mk
  UPD     include/config/uboot.release
  UPD     include/generated/version_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  UPD     include/generated/dt.h
  ENVC    include/generated/env.txt
  ENVP    include/generated/env.in
  ENVT    include/generated/environment.h
  CC      lib/asm-offsets.s
cc1: error: bad value (‘generic-armv7-a’) for ‘-mtune=’ switch
cc1: note: valid arguments to ‘-mtune=’ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 bonnell atom silvermont slm knl intel x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 btver1 btver2 generic
scripts/Makefile.build:147: recipe for target 'lib/asm-offsets.s' failed
make[1]: *** [lib/asm-offsets.s] Error 1
Makefile:1932: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

I'm not sure should I test it on custodian tree: arm/next, too. This failure seems not related to the 2nd patch of mt8195-demo board.

Thanks
Macpaul Lin

#19 lore raw

Re: [PATCH v3 2/2] board: mediatek: add mt8195 demo board

Quoted 72 lines · Macpaul Lin
Quoted 26 lines · Tom Rini
Quoted 25 lines · Tom Rini
Quoted 24 lines · Tom Rini
Quoted 8 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

[snip]

include/configs/mt8195.h line 20

Quoted 7 lines
include/configs/mt8195.h new file +7 -0
+#include <linux/sizes.h>
+
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE	-4
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_NS16550_COM1		0x11002000
+#define CONFIG_SYS_NS16550_CLK		26000000

This is unused, I believe. But when trying to build with current next I get:
Error: Load Address must be set.
Error: Bad parameters for image type

Quoted 1 line
Quoted 1 line
Quoted 1 line

Please rebase on top of current next and repost, thanks!

Thanks for the information, will send patch v4 later.

Quoted 8 lines
Quoted 3 lines

Sorry for the noise, this failed due to another patch that needs to be reworked instead.

Welp, I should have finished my re-testing. The patch that broke phycore-rk3288 and I assumed broke this platform too, did not break this platform, there's still some other problem here.

I've tested it on uboot/next and got the following result.

$ make ARCH=arm phycore-rk3288_defconfig
$ make ARCH=arm
scripts/kconfig/conf  --syncconfig Kconfig
  UPD     include/config.h
  CFG     u-boot.cfg
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
  CFG     spl/u-boot.cfg
  GEN     spl/include/autoconf.mk
  UPD     include/config/uboot.release
  UPD     include/generated/version_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  UPD     include/generated/dt.h
  ENVC    include/generated/env.txt
  ENVP    include/generated/env.in
  ENVT    include/generated/environment.h
  CC      lib/asm-offsets.s
cc1: error: bad value (‘generic-armv7-a’) for ‘-mtune=’ switch
cc1: note: valid arguments to ‘-mtune=’ switch are: nocona core2 nehalem
corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell
core-avx2 broadwell skylake skylake-avx512 bonnell atom silvermont slm knl
intel x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4
nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx
amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 btver1 btver2 generic
scripts/Makefile.build:147: recipe for target 'lib/asm-offsets.s' failed
make[1]: *** [lib/asm-offsets.s] Error 1
Makefile:1932: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
Quoted 2 lines

I'm not sure should I test it on custodian tree: arm/next, too. This failure seems not related to the 2nd patch of mt8195-demo board.

You don't pass ARCH= when building U-Boot, and you didn't set CROSS_COMPILE to your arm32 compiler, so that's why it failed there. v4 shows the same problem as v3 for me, so please make sure to build and boot v5, thanks.

Signature · 1 line
Tom
Reviewed-by on v3 1/2
#20 lore raw
In reply to Macpaul Lin
Quoted 430 lines · Macpaul Lin

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

---
 MAINTAINERS                            |   2 +
 arch/arm/dts/mt8195.dtsi               | 370
+++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |  13 +-
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 ++++++
 6 files changed, 469 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

Changes for v2:
- Correct node name to t-phy for u3phy0.
- Add platform compatible string "mediatek,mt8195-tphy" to all usb
phy nodes.
- remove clock nodes that software cannot controlled in phy nodes.
- Test and add back "mac" for HOST only xhci nodes.

Changes for v3:
- Revise device node name from "xhciX: xhciX@" to "xhciX: xhci@".

MAINTAINERS +2 -0
index 1cf99c1393..5528dd28c3 100644
@@ -362,8 +362,10 @@ ARM MEDIATEK
 M:	Ryder Lee <[email protected]>
 M:	Weijie Gao <[email protected]>
 M:	Chunfeng Yun <[email protected]>
+M:	Macpaul Lin <[email protected]>
 R:	GSS_MTK_Uboot_upstream <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/mt8195.dtsi
 F:	arch/arm/mach-mediatek/
 F:	arch/arm/include/asm/arch-mediatek/
 F:	board/mediatek/
arch/arm/dts/mt8195.dtsi new file +164 -0
new file mode 100644
index 0000000000..33282d21d1
@@ -0,0 +1,370 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Ben Ho <[email protected]>
+ *         Erin Lo <[email protected]>
+ *         Fabien Parent <[email protected]>
+ *         Macpaul Lin <[email protected]>
+ */
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/phy/phy.h>
+
+/ {
+	compatible = "mediatek,mt8195";
+	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>;
+				};
+			};
+
+			cluster1 {
+				core0 {
+					cpu = <&cpu4>;
+				};
+				core1 {
+					cpu = <&cpu5>;
+				};
+				core2 {
+					cpu = <&cpu6>;
+				};
+				core3 {
+					cpu = <&cpu7>;
+				};
+			};
+		};
+
+		cpu0: cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x000>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu1: cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x001>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu2: cpu@2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x002>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu3: cpu@3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x003>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <741>;
+		};
+
+		cpu4: cpu@100 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x100>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu5: cpu@101 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x101>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu6: cpu@102 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x102>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+
+		cpu7: cpu@103 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a73";
+			reg = <0x103>;
+			enable-method = "psci";
+			capacity-dmips-mhz = <1024>;
+		};
+	};
+
+	clk26m: oscillator {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <26000000>;
+		clock-output-names = "clk26m";
+	};
+
+	mmc_source_clk: mmc-source-clk{
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <400000000>;
+		clock-output-names = "mmc_source_clk";
+	};
+
+	soc {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		compatible = "simple-bus";
+		ranges;
+
+		watchdog: watchdog@10007000 {
+			compatible = "mediatek,mt8195-wdt",
+				      "mediatek,wdt";
+			reg = <0 0x10007000 0 0x100>;
+			status = "disabled";
+		};
+
+		gic: interrupt-controller@c000000 {
+			compatible = "arm,gic-v3";
+			#interrupt-cells = <4>;
+			interrupt-parent = <&gic>;
+			interrupt-controller;
+			reg = <0 0x0c000000 0 0x40000>,  /* GICD */
+			      <0 0x0c100000 0 0x200000>, /* GICR */
+			      <0 0x0c400000 0 0x2000>,   /* GICC */
+			      <0 0x0c410000 0 0x1000>,   /* GICH */
+			      <0 0x0c420000 0 0x2000>;   /* GICV */
+
+			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH 0>;
+			ppi-partitions {
+				ppi_cluster0: interrupt-partition-0 {
+					affinity = <&cpu0 &cpu1 &cpu2

&cpu3>;

arch/arm/dts/mt8195.dtsi new file +3 -0
+				};
+				ppi_cluster1: interrupt-partition-1 {
+					affinity = <&cpu4 &cpu5 &cpu6

&cpu7>;

arch/arm/dts/mt8195.dtsi new file +15 -0
+				};
+			};
+		};
+
+		sysirq: interrupt-controller@c530a80 {
+			compatible = "mediatek,mt8195-sysirq",
+				     "mediatek,mt6577-sysirq";
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			interrupt-parent = <&gic>;
+			reg = <0 0x0c530a80 0 0x50>;
+		};
+
+		topckgen: syscon@10000000 {
+			compatible = "mediatek,mt8195-topckgen",

"syscon";

arch/arm/dts/mt8195.dtsi new file +6 -0
+			reg = <0 0x10000000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		infracfg: syscon@10001000 {
+			compatible = "mediatek,mt8195-infracfg",

"syscon";

arch/arm/dts/mt8195.dtsi new file +6 -0
+			reg = <0 0x10001000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		apmixedsys: syscon@1000c000 {
+			compatible = "mediatek,mt8195-apmixedsys",

"syscon";

arch/arm/dts/mt8195.dtsi new file +30 -0
+			reg = <0 0x1000c000 0 0x1000>;
+			#clock-cells = <1>;
+		};
+
+		uart0: serial@11001100 {
+			compatible = "mediatek,mt8195-uart",
+				     "mediatek,hsuart";
+			reg = <0 0x11001100 0 0x1000>;
+			interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>;
+			clock-frequency = <26000000>;
+			clocks = <&clk26m>, <&clk26m>;
+			clock-names = "baud", "bus";
+			status = "disabled";
+		};
+
+		mmc0: mmc@11230000 {
+			compatible = "mediatek,mt8195-mmc",
+				     "mediatek,mt8183-mmc";
+			reg = <0 0x11230000 0 0x1000>,
+			      <0 0x11f50000 0 0x1000>;
+			interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_LOW>;
+			clocks = <&mmc_source_clk>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "source", "hclk", "source_cg";
+			status = "disabled";
+		};
+
+		u3phy0: t-phy@11f40000 {
+			compatible = "mediatek,mt8195-tphy",

"mediatek,generic-tphy-v2";

arch/arm/dts/mt8195.dtsi new file +20 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11e40000 0xe00>;
+			status = "okay";
+
+			u2port0: usb-phy@0 {
+				reg = <0 0x700>;
+				#phy-cells = <1>;
+				status = "okay";
+			};
+
+			u3port0: usb-phy@700 {
+				reg = <0x700 0x700>;
+				#phy-cells = <1>;
+				status = "okay";
+			};
+		};
+
+		usb: usb@11200000 {
+			compatible ="mediatek,mt8195-mtu3",

"mediatek,mtu3";

arch/arm/dts/mt8195.dtsi new file +17 -0
+			reg = <0 0x11203e00 0 0x0100>;
+			reg-names = "ippc";
+			phys = <&u2port0 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "ref_ck", "mcu_ck";
+			#address-cells = <2>;
+			#size-cells = <2>;
+			ranges;
+			status = "disabled";
+
+			ssusb: ssusb@11200000 {
+				compatible = "mediatek,ssusb";
+				reg = <0 0x11200000 0 0x3e00>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 128

IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8195.dtsi new file +8 -0
+				status = "disabled";
+			};
+
+			xhci0: xhci@11200000 {
+				compatible = "mediatek,mtk-xhci";
+				reg = <0 0x11200000 0 0x1000>;
+				reg-names = "mac";
+				interrupts = <GIC_SPI 129

IRQ_TYPE_LEVEL_LOW>;

arch/arm/dts/mt8195.dtsi new file +5 -0
+				clocks = <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>,
+					 <&clk26m>;
+				clock-names = "sys_ck", "xhci_ck",

"ref_ck", "mcu_ck";

arch/arm/dts/mt8195.dtsi new file +6 -0
+				status = "disabled";
+			};
+		};
+
+		u3phy1: t-phy@11e30000 {
+			compatible = "mediatek,mt8195-tphy",

"mediatek,generic-tphy-v2";

arch/arm/dts/mt8195.dtsi new file +29 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11e30000 0xe00>;
+			status = "disabled";
+
+			u2port1: usb-phy@0 {
+				reg = <0x0 0x700>;
+				#phy-cells = <1>;
+			};
+
+			u3port1: usb-phy@700 {
+				reg = <0x700 0x700>;
+				#phy-cells = <1>;
+			};
+		};
+
+		xhci1: xhci@11290000 {
+			compatible = "mediatek,mt8195-xhci",
+				     "mediatek,mtk-xhci";
+			reg = <0 0x11290000 0 0x1000>,
+			      <0 0x11293e00 0 0x0100>;
+			reg-names = "mac", "ippc";
+			interrupts = <GIC_SPI 530 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&u2port1 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "xhci_ck", "ref_ck",

"mcu_ck";

arch/arm/dts/mt8195.dtsi new file +5 -0
+			status = "disabled";
+		};
+
+		u3phy2: t-phy@11c40000 {
+			compatible = "mediatek,mt8195-tphy",

"mediatek,generic-tphy-v2";

arch/arm/dts/mt8195.dtsi new file +28 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11c40000 0x700>;
+			status = "disabled";
+
+			u2port2: usb-phy@0 {
+				reg = <0x0 0x700>;
+				#phy-cells = <1>;
+			};
+		};
+
+		xhci2: xhci@112a0000 {
+			compatible = "mediatek,mt8195-xhci",
+				     "mediatek,mtk-xhci";
+			reg = <0 0x112a0000 0 0x1000>,
+			      <0 0x112a3e00 0 0x0100>;
+			reg-names = "mac", "ippc";
+			interrupts = <GIC_SPI 533 IRQ_TYPE_LEVEL_HIGH>;
+			phys = <&u2port2 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "xhci_ck", "ref_ck";
+			status = "disabled";
+		};
+
+		u3phy3: t-phy@11c50000 {
+			compatible = "mediatek,mt8195-tphy",

"mediatek,generic-tphy-v2";

arch/arm/dts/mt8195.dtsi new file +18 -0
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 0 0x11c50000 0x700>;
+			status = "okay";
+
+			u2port3: usb-phy@0 {
+				reg = <0x0 0x700>;
+				#phy-cells = <1>;
+			};
+		};
+
+		xhci3: xhci@112b0000 {
+			compatible = "mediatek,mt8195-xhci",
+				     "mediatek,mtk-xhci";
+			reg = <0 0x112b0000 0 0x1000>,
+			      <0 0x112b3e00 0 0x0100>;
+			reg-names = "mac", "ippc";
+			interrupts = <GIC_SPI 536 IRQ_TYPE_LEVEL_HIGH>;

arch/arm/dts/mt8195.dtsi line 370

Quoted 10 lines
arch/arm/dts/mt8195.dtsi new file +10 -0
+			phys = <&u2port3 PHY_TYPE_USB2>;
+			clocks = <&clk26m>,
+				 <&clk26m>,
+				 <&clk26m>;
+			clock-names = "sys_ck", "xhci_ck", "ref_ck";
+			usb2-lpm-disable;
+			status = "disabled";
+		};
+	};
+};

For usb part:

Thanks a lot

Quoted 165 lines
arch/arm/mach- renamed from arch/arm/mach-mediatek/Kconfig +0 -0

mediatek/Kconfig
index 04aa2fd97f..3a2af1cdee 100644

arch/arm/mach-mediatek/Kconfig +0 -0
@@ -67,6 +67,15 @@ config TARGET_MT8183
 	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several

LPDDR3

arch/arm/mach-mediatek/Kconfig +5 -0
 	  and LPDDR4 options.
 
+config TARGET_MT8195
+	bool "MediaTek MT8195 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8195 is a ARM64-based SoC with a quad-core

Cortex-A73 and

arch/arm/mach-mediatek/Kconfig +1 -0
+	  a quad-core Cortex-A53. It is including UART, SPI, USB3.0

device and hosts,

arch/arm/mach-mediatek/Kconfig +1 -0
+	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several

LPDDR3

arch/arm/mach-mediatek/Kconfig +4 -0
+	  and LPDDR4 options.
+
 config TARGET_MT8512
         bool "MediaTek MT8512 M1 Board"
         select ARM64
@@ -105,6 +114,7 @@ config SYS_BOARD
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -122,6 +132,7 @@ config SYS_CONFIG_NAME
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -134,7 +145,7 @@ config SYS_CONFIG_NAME
 config MTK_BROM_HEADER_INFO
 	string
 	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 ||

TARGET_MT7629 || TARGET_MT7622

arch/arm/mach-mediatek/Kconfig +0 -1
-	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 ||

TARGET_MT8183

arch/arm/mach-mediatek/Kconfig +1 -0
+	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 ||

TARGET_MT8183 || TARGET_MT8195
default "media=snand;nandinfo=2k+64" if TARGET_MT7981 ||
TARGET_MT7986

arch/arm/mach-mediatek/Kconfig +0 -0
 	default "lk=1" if TARGET_MT7623
arch/arm/mach- renamed from arch/arm/mach-mediatek/Makefile +0 -0

mediatek/Makefile
index fc85293f71..fbbb5431d1 100644

arch/arm/mach-mediatek/Makefile +1 -0
@@ -10,5 +10,6 @@ obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT7981) += mt7981/
 obj-$(CONFIG_TARGET_MT7986) += mt7986/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
+obj-$(CONFIG_TARGET_MT8195) += mt8195/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
 obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach- renamed from arch/arm/mach-mediatek/mt8195/Makefile +0 -0

mediatek/mt8195/Makefile
new file mode 100644
index 0000000000..886ab7e4eb

arch/arm/mach-mediatek/mt8195/Makefile new file +3 -0
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach- renamed from arch/arm/mach-mediatek/mt8195/init.c +0 -0

mediatek/mt8195/init.c
new file mode 100644
index 0000000000..1eb4ade6c5

arch/arm/mach-mediatek/mt8195/init.c new file +68 -0
@@ -0,0 +1,81 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Macpaul Lin <[email protected]>
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <clk.h>
+#include <common.h>
+#include <dm.h>
+#include <fdtdec.h>
+#include <ram.h>
+#include <asm/arch/misc.h>
+#include <asm/armv8/mmu.h>
+#include <asm/sections.h>
+#include <asm/system.h>
+#include <dm/uclass.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+	int ret;
+
+	ret = fdtdec_setup_memory_banksize();
+	if (ret)
+		return ret;
+
+	return fdtdec_setup_mem_size_base();
+}
+
+int dram_init_banksize(void)
+{
+	gd->bd->bi_dram[0].start = gd->ram_base;
+	gd->bd->bi_dram[0].size = gd->ram_size;
+
+	return 0;
+}
+
+int mtk_pll_early_init(void)
+{
+	return 0;
+}
+
+int mtk_soc_early_init(void)
+{
+	return 0;
+}
+
+void reset_cpu(ulong addr)
+{
+	psci_system_reset();
+}
+
+int print_cpuinfo(void)
+{
+	printf("CPU:   MediaTek MT8195\n");
+	return 0;
+}
+
+static struct mm_region mt8195_mem_map[] = {
+	{
+		/* DDR */
+		.virt = 0x40000000UL,
+		.phys = 0x40000000UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |

PTE_BLOCK_OUTER_SHARE,

arch/arm/mach-mediatek/mt8195/init.c new file +13 -0
+	}, {
+		.virt = 0x00000000UL,
+		.phys = 0x00000000UL,
+		.size = 0x20000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		0,
+	}
+};
+
+struct mm_region *mem_map = mt8195_mem_map;
#21 lore raw

PATCH v4 1/2 arm: mediatek: add mt8195 SOC support

In reply to Macpaul Lin

From: Fabien Parent <[email protected]>

The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts, SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3 and LPDDR4 options.

---
 MAINTAINERS                            |   2 +
 arch/arm/dts/mt8195.dtsi               | 370 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |  13 +-
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt8195/Makefile |   3 +
 arch/arm/mach-mediatek/mt8195/init.c   |  81 ++++++
 6 files changed, 469 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8195.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8195/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8195/init.c

Changes for v2:
- Correct node name to t-phy for u3phy0.
- Add platform compatible string "mediatek,mt8195-tphy" to all usb phy nodes.
- remove clock nodes that software cannot controlled in phy nodes.
- Test and add back "mac" for HOST only xhci nodes.

Changes for v3:
- Revise device node name from "xhciX: xhciX@" to "xhciX: xhci@".

Changes for v4:
- No change.

MAINTAINERS +2 -0
index 75b27bc1cc..f2fe78dfc7 100644
@@ -363,8 +363,10 @@ ARM MEDIATEK
 M:	Ryder Lee <[email protected]>
 M:	Weijie Gao <[email protected]>
 M:	Chunfeng Yun <[email protected]>
+M:	Macpaul Lin <[email protected]>
 R:	GSS_MTK_Uboot_upstream <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/mt8195.dtsi
 F:	arch/arm/mach-mediatek/
 F:	arch/arm/include/asm/arch-mediatek/
 F:	board/mediatek/
arch/arm/dts/mt8195.dtsi new file +370 -0

370 lines not on this page · raw message

arch/arm/mach-mediatek/Kconfig +12 -1
index 04aa2fd97f..3a2af1cdee 100644
@@ -67,6 +67,15 @@ config TARGET_MT8183
 	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
 	  and LPDDR4 options.
 
+config TARGET_MT8195
+	bool "MediaTek MT8195 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8195 is a ARM64-based SoC with a quad-core Cortex-A73 and
+	  a quad-core Cortex-A53. It is including UART, SPI, USB3.0 device and hosts,
+	  SD and MMC cards, UFS, PWM, I2C, I2S, S/PDIF, and several LPDDR3
+	  and LPDDR4 options.
+
 config TARGET_MT8512
         bool "MediaTek MT8512 M1 Board"
         select ARM64
@@ -105,6 +114,7 @@ config SYS_BOARD
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -122,6 +132,7 @@ config SYS_CONFIG_NAME
 	default "mt7981" if TARGET_MT7981
 	default "mt7986" if TARGET_MT7986
 	default "mt8183" if TARGET_MT8183
+	default "mt8195" if TARGET_MT8195
 	default "mt8512" if TARGET_MT8512
 	default "mt8516" if TARGET_MT8516
 	default "mt8518" if TARGET_MT8518
@@ -134,7 +145,7 @@ config SYS_CONFIG_NAME
 config MTK_BROM_HEADER_INFO
 	string
 	default "media=nor" if TARGET_MT8518 || TARGET_MT8512 || TARGET_MT7629 || TARGET_MT7622
-	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183
+	default "media=emmc" if TARGET_MT8516 || TARGET_MT8365 || TARGET_MT8183 || TARGET_MT8195
 	default "media=snand;nandinfo=2k+64" if TARGET_MT7981 || TARGET_MT7986
 	default "lk=1" if TARGET_MT7623
 
arch/arm/mach-mediatek/Makefile +1 -0
index fc85293f71..fbbb5431d1 100644
@@ -10,5 +10,6 @@ obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT7981) += mt7981/
 obj-$(CONFIG_TARGET_MT7986) += mt7986/
 obj-$(CONFIG_TARGET_MT8183) += mt8183/
+obj-$(CONFIG_TARGET_MT8195) += mt8195/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
 obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach-mediatek/mt8195/Makefile new file +3 -0
new file mode 100644
index 0000000000..886ab7e4eb
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
arch/arm/mach-mediatek/mt8195/init.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.18.0
#22 lore raw

PATCH v4 2/2 board: mediatek: add mt8195 demo board

From: Fabien Parent <[email protected]>

Add mt8195-demo board support.
This demo purpose board uses MediaTek's MT8195 SoC.

---
 MAINTAINERS                         |   1 +
 arch/arm/dts/Makefile               |   1 +
 arch/arm/dts/mt8195-demo.dts        | 109 ++++++++++++++++++++++++++++
 board/mediatek/mt8195/MAINTAINERS   |   6 ++
 board/mediatek/mt8195/Makefile      |   3 +
 board/mediatek/mt8195/mt8195_demo.c |  38 ++++++++++
 configs/mt8195_demo_defconfig       |  89 +++++++++++++++++++++++
 include/configs/mt8195.h            |  28 +++++++
 8 files changed, 275 insertions(+)
 create mode 100644 arch/arm/dts/mt8195-demo.dts
 create mode 100644 board/mediatek/mt8195/MAINTAINERS
 create mode 100644 board/mediatek/mt8195/Makefile
 create mode 100644 board/mediatek/mt8195/mt8195_demo.c
 create mode 100644 configs/mt8195_demo_defconfig
 create mode 100644 include/configs/mt8195.h

Changes for v2 and v3:
- no change.

Changes for v4:
- Remove CONFIG_SYS_NS16550 related settings in mt8195.h
- Tested with u-boot/next.

MAINTAINERS +1 -0
index f2fe78dfc7..3c7db798be 100644
@@ -390,6 +390,7 @@ F:	drivers/watchdog/mtk_wdt.c
 F:	drivers/net/mtk_eth.c
 F:	drivers/net/mtk_eth.h
 F:	drivers/reset/reset-mediatek.c
+F:	include/configs/mt8195.h
 F:	tools/mtk_image.c
 F:	tools/mtk_image.h
 F:	tools/mtk_nand_headers.c
arch/arm/dts/Makefile +1 -0
index b3baaf4829..5ab10ac3db 100644
@@ -1278,6 +1278,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7986a-emmc-rfb.dtb \
 	mt7986b-emmc-rfb.dtb \
 	mt8183-pumpkin.dtb \
+	mt8195-demo.dtb \
 	mt8512-bm1-emmc.dtb \
 	mt8516-pumpkin.dtb \
 	mt8518-ap1-emmc.dtb
arch/arm/dts/mt8195-demo.dts new file +109 -0

109 lines not on this page · raw message

board/mediatek/mt8195/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..01fa25115d
@@ -0,0 +1,6 @@
+MT8195 Demo
+M:	Macpaul Lin <[email protected]>
+S:	Maintained
+F:	board/mediatek/mt8195
+F:	include/configs/mt8195.h
+F:	configs/mt8195_demo_defconfig
board/mediatek/mt8195/Makefile new file +3 -0
new file mode 100644
index 0000000000..7e94a87aea
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += mt8195_demo.o
board/mediatek/mt8195/mt8195_demo.c new file +38 -0
new file mode 100644
index 0000000000..b95f5cf28d
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2022 BayLibre SAS
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <net.h>
+#include <asm/io.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();
+
+	printf("Disabling WDT\n");
+	writel(0, 0x10007000);
+
+	printf("Enabling SCP SRAM\n");
+	for (unsigned int val = 0xFFFFFFFF; val != 0U;) {
+		val = val >> 1;
+		writel(val, 0x1072102C);
+	}
+
+	return 0;
+}
configs/mt8195_demo_defconfig new file +89 -0

89 lines not on this page · raw message

include/configs/mt8195.h new file +28 -0
new file mode 100644
index 0000000000..bc067647c0
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Configuration for MT8195 based boards
+ *
+ * Copyright (C) 2022 MediaTek Inc.
+ * Copyright (C) 2022 BayLibre, SAS
+ * Author: Fabien Parent <[email protected]>
+ * Author: Fabien Parent <[email protected]>
+ */
+
+#ifndef __MT8195_H
+#define __MT8195_H
+
+#include <linux/sizes.h>
+
+/* Environment settings */
+#include <config_distro_bootcmd.h>
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0)
+
+#if !defined(CONFIG_EXTRA_ENV_SETTINGS)
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"scriptaddr=0x40000000\0" \
+	BOOTENV
+#endif
+
+#endif
Signature · 1 line
2.18.0