Skip to contentSkip to conversation

Add support for MediaTek MT8518 Soc

PATCH Superseded mingming lee 3 participants 12 messages Sep 11, 2019 – Oct 15, 2019

Subsystems (9)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add support for MediaTek MT8518 Soc

This patch series adds basic boot support on eMMC for the MediaTek MT8518 SoC based boards. This series add the clock, pinctrl drivers and the SoC initializaton code.

mingming lee (5):
ARM: MediaTek: Add support for MediaTek MT8518 SoC
clk: mediatek: add driver for MT8518
mmc: mtk-sd: add HS200 support
pinctrl: add driver for MT8518
ARM: MediaTek: add basic support for MT8518 boards

 arch/arm/dts/Makefile                         |    3 +-
 arch/arm/dts/mt8518-ap1-emmc.dts              |  104 ++
 arch/arm/dts/mt8518.dtsi                      |  210 +++
 arch/arm/mach-mediatek/Kconfig                |   10 +
 arch/arm/mach-mediatek/Makefile               |    1 +
 arch/arm/mach-mediatek/mt8518/Makefile        |    4 +
 arch/arm/mach-mediatek/mt8518/init.c          |  116 ++
 arch/arm/mach-mediatek/mt8518/lowlevel_init.S |   59 +
 board/mediatek/mt8518/Kconfig                 |   14 +
 board/mediatek/mt8518/MAINTAINERS             |    6 +
 board/mediatek/mt8518/Makefile                |    3 +
 board/mediatek/mt8518/mt8518_ap1.c            |   27 +
 configs/mt8518_ap1_emmc_defconfig             |   54 +
 drivers/clk/mediatek/Makefile                 |    1 +
 drivers/clk/mediatek/clk-mt8518.c             | 1558 +++++++++++++++++
 drivers/mmc/mtk-sd.c                          |   30 +-
 drivers/pinctrl/mediatek/Kconfig              |    4 +
 drivers/pinctrl/mediatek/Makefile             |    1 +
 drivers/pinctrl/mediatek/pinctrl-mt8518.c     |  411 +++++
 include/configs/mt8518.h                      |   73 +
 include/dt-bindings/clock/mt8518-clk.h        |  249 +++
 21 files changed, 2931 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/dts/mt8518-ap1-emmc.dts
 create mode 100644 arch/arm/dts/mt8518.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8518/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8518/init.c
 create mode 100644 arch/arm/mach-mediatek/mt8518/lowlevel_init.S
 create mode 100644 board/mediatek/mt8518/Kconfig
 create mode 100644 board/mediatek/mt8518/MAINTAINERS
 create mode 100644 board/mediatek/mt8518/Makefile
 create mode 100644 board/mediatek/mt8518/mt8518_ap1.c
 create mode 100644 configs/mt8518_ap1_emmc_defconfig
 create mode 100644 drivers/clk/mediatek/clk-mt8518.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8518.c
 create mode 100644 include/configs/mt8518.h
 create mode 100644 include/dt-bindings/clock/mt8518-clk.h
Signature · 1 line
2.18.0
#1 lore raw

PATCH 1/5 ARM: MediaTek: Add support for MediaTek MT8518 SoC

Add support for MediaTek MT8518 SoC. This include the file that will initialize the SoC after boot and its device tree.

---
 arch/arm/dts/mt8518.dtsi                      | 201 ++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig                |   9 +
 arch/arm/mach-mediatek/Makefile               |   1 +
 arch/arm/mach-mediatek/mt8518/Makefile        |   4 +
 arch/arm/mach-mediatek/mt8518/init.c          | 116 ++++++++++
 arch/arm/mach-mediatek/mt8518/lowlevel_init.S |  59 +++++
 6 files changed, 390 insertions(+)
 create mode 100644 arch/arm/dts/mt8518.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8518/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8518/init.c
 create mode 100644 arch/arm/mach-mediatek/mt8518/lowlevel_init.S
arch/arm/dts/mt8518.dtsi new file +201 -0
new file mode 100644
index 0000000000..39d001884f
@@ -0,0 +1,201 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2019 MediaTek Inc.
+ * Author: Mingming Lee <[email protected]>
+ *
+ */
+
+#include <dt-bindings/clock/mt8518-clk.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "mediatek,mt8518";
+	interrupt-parent = <&sysirq>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		enable-method = "mediatek,mt8518-smp";
+
+		cpu0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x1>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu2: cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x2>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu3: cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x3>;
+			clock-frequency = <1300000000>;
+		};
+	};
+
+	chipid: chipid at 08000000 {
+		compatible = "mediatek,chipid";
+		reg = <0x08000000 0x0004>,
+		      <0x08000004 0x0004>,
+		      <0x08000008 0x0004>,
+		      <0x0800000c 0x0004>;
+	};
+
+	topckgen: clock-controller at 10000000 {
+		compatible = "mediatek,mt8518-topckgen";
+		reg = <0x10000000 0x1000>;
+		#clock-cells = <1>;
+	};
+
+	topckgen_cg: clock-controller-cg at 10000000 {
+		compatible = "mediatek,mt8518-topckgen-cg";
+		reg = <0x10000000 0x1000>;
+		#clock-cells = <1>;
+	};
+
+	apmixedsys: clock-controller at 10018000 {
+		compatible = "mediatek,mt8518-apmixedsys";
+		reg = <0x10018000 0x1000>;
+		#clock-cells = <1>;
+	};
+
+	gic: interrupt-controller at 0c000000 {
+		 compatible = "arm,gic-v3";
+		#interrupt-cells = <3>;
+		interrupt-parent = <&gic>;
+		interrupt-controller;
+		reg = <0xc000000 0x40000>,	/* GICD */
+			  <0xc100000 0x200000>; /* GICR */
+		interrupts = <GIC_PPI 9
+			(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
+	};
+
+	sysirq: interrupt-controller at 10200a80 {
+		compatible = "mediatek,sysirq";
+		interrupt-controller;
+		#interrupt-cells = <3>;
+		interrupt-parent = <&gic>;
+		reg = <0x10200a80 0x50>;
+	};
+
+	apdma: dma-controller at 11000480 {
+		compatible = "mediatek,mt8518-uart-dma",
+			"mediatek,mt6577-uart-dma";
+		reg = <0x11000480 0x80>,
+			  <0x11000500 0x80>,
+			  <0x11000580 0x80>,
+			  <0x11000600 0x80>,
+			  <0x11000980 0x80>,
+			  <0x11000a00 0x80>;
+		interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>,
+			<GIC_SPI 97 IRQ_TYPE_LEVEL_LOW>,
+			<GIC_SPI 98 IRQ_TYPE_LEVEL_LOW>,
+			<GIC_SPI 99 IRQ_TYPE_LEVEL_LOW>,
+			<GIC_SPI 100 IRQ_TYPE_LEVEL_LOW>,
+			<GIC_SPI 101 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&topckgen CLK_TOP_APDMA>;
+		clock-names = "apdma";
+		#dma-cells = <1>;
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_PPI 13
+				 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				 <GIC_PPI 14
+				 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				 <GIC_PPI 11
+				 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
+				 <GIC_PPI 10
+				 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <13000000>;
+	};
+
+	timer0: apxgpt at 10008000 {
+		compatible = "mediatek,timer",
+			   "mediatek,mt8518-timer",
+			   "mediatek,mt6577-timer";
+		reg = <0x10008000 0x1000>;
+		interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&topckgen CLK_TOP_CLK26M_D2>,
+			 <&topckgen CLK_TOP_CLK32K>,
+			 <&topckgen CLK_TOP_APXGPT>;
+		clock-names = "clk13m",
+			 "clk32k",
+			 "bus";
+	};
+
+	watchdog: watchdog at 10007000 {
+		compatible = "mediatek,wdt";
+		reg = <0x10007000 0x1000>;
+		interrupts = <GIC_SPI 190 IRQ_TYPE_EDGE_FALLING>;
+		#reset-cells = <1>;
+		status = "disabled";
+	};
+
+	mmc0: mmc at 11120000 {
+		compatible = "mediatek,mt8516-mmc";
+		reg = <0x11120000 0x1000>;
+		interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&topckgen CLK_TOP_MSDC0>,
+			<&topckgen CLK_TOP_MSDC0>,
+			<&topckgen CLK_TOP_MSDC0_B>;
+		clock-names = "source", "hclk", "source_cg";
+		status = "disabled";
+	};
+
+	uart0: serial at 11005000 {
+		compatible = "mediatek,hsuart";
+		reg = <0x11005000 0x1000>;
+		interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&topckgen CLK_TOP_UART0_SEL>,
+			<&topckgen CLK_TOP_UART0>;
+		clock-names = "baud", "bus";
+		status = "disabled";
+	};
+
+	uart1: serial at 11001A000 {
+		compatible = "mediatek,hsuart";
+		reg = <0x1001A000 0x1000>;
+		interrupts = <GIC_SPI 169 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&topckgen CLK_TOP_UART1_SEL>,
+			<&topckgen CLK_TOP_UART1>;
+		clock-names = "baud", "bus";
+		dmas = <&apdma 2
+			&apdma 3>;
+		dma-names = "tx", "rx";
+		status = "disabled";
+	};
+
+	uart2: serial at 11007000 {
+		compatible = "mediatek,hsuart";
+		reg = <0x11007000 0x1000>;
+		interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&topckgen CLK_TOP_UART2_SEL>,
+			<&topckgen CLK_TOP_UART2>;
+		clock-names = "baud", "bus";
+		dmas = <&apdma 4
+			&apdma 5>;
+		dma-names = "tx", "rx";
+		status = "disabled";
+	};
+
+};
arch/arm/mach-mediatek/Kconfig +9 -0
index 25ef7651f0..8e343c3182 100644
@@ -38,6 +38,15 @@ config TARGET_MT8516
 	  Ethernet, IR TX/RX, I2C, I2S, S/PDIF, and built-in Wi-Fi / Bluetooth combo
 	  chip and several DDR3 and DDR4 options.
 
+config TARGET_MT8518
+	bool "MediaTek MT8518 SoC"
+	select ARM64
+	help
+	  The MediaTek MT8518 is a ARM64-based SoC with a quad-core Cortex-A53.
+	  including UART, SPI, USB2.0 and OTG, SD and MMC cards, NAND, PWM,
+	  Ethernet, IR TX/RX, I2C, I2S, S/PDIF, and built-in Wi-Fi / Bluetooth combo
+	  chip and several DDR3 and DDR4 options.
+
 endchoice
 
 source "board/mediatek/mt7623/Kconfig"
arch/arm/mach-mediatek/Makefile +1 -0
index ea414dc407..b9b2355e03 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_SPL_BUILD)	+= spl.o
 obj-$(CONFIG_TARGET_MT7623) += mt7623/
 obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
+obj-$(CONFIG_TARGET_MT8518) += mt8518/
arch/arm/mach-mediatek/mt8518/Makefile new file +4 -0
new file mode 100644
index 0000000000..007eb4a367
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += init.o
+obj-y += lowlevel_init.o
arch/arm/mach-mediatek/mt8518/init.c new file +116 -0

116 lines not on this page · raw message

arch/arm/mach-mediatek/mt8518/lowlevel_init.S new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.18.0
maintainer
#2 lore raw

PATCH 1/5 ARM: MediaTek: Add support for MediaTek MT8518 SoC

Quoted 72 lines · mingming lee

Add support for MediaTek MT8518 SoC. This include the file that will initialize the SoC after boot and its device tree.

---
 arch/arm/dts/mt8518.dtsi                      | 201 ++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig                |   9 +
 arch/arm/mach-mediatek/Makefile               |   1 +
 arch/arm/mach-mediatek/mt8518/Makefile        |   4 +
 arch/arm/mach-mediatek/mt8518/init.c          | 116 ++++++++++
 arch/arm/mach-mediatek/mt8518/lowlevel_init.S |  59 +++++
 6 files changed, 390 insertions(+)
 create mode 100644 arch/arm/dts/mt8518.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8518/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8518/init.c
 create mode 100644 arch/arm/mach-mediatek/mt8518/lowlevel_init.S
arch/arm/dts/mt8518.dtsi new file +49 -0
new file mode 100644
index 0000000000..39d001884f
@@ -0,0 +1,201 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2019 MediaTek Inc.
+ * Author: Mingming Lee <[email protected]>
+ *
+ */
+
+#include <dt-bindings/clock/mt8518-clk.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "mediatek,mt8518";
+	interrupt-parent = <&sysirq>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		enable-method = "mediatek,mt8518-smp";
+
+		cpu0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x1>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu2: cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x2>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu3: cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x3>;
+			clock-frequency = <1300000000>;

arch/arm/dts/mt8518.dtsi line 59

Quoted 10 lines
arch/arm/dts/mt8518.dtsi new file +10 -0
+		};
+	};
+
+	chipid: chipid at 08000000 {
+		compatible = "mediatek,chipid";
+		reg = <0x08000000 0x0004>,
+		      <0x08000004 0x0004>,
+		      <0x08000008 0x0004>,
+		      <0x0800000c 0x0004>;
+	};

I couldn't find any driver using this compatible.
You may want to drop this 'device'.

Regards,
Matthias

#3 lore raw

PATCH 1/5 ARM: MediaTek: Add support for MediaTek MT8518 SoC

Quoted 88 lines · Matthias Brugger
Quoted 72 lines · mingming lee

Add support for MediaTek MT8518 SoC. This include the file that will initialize the SoC after boot and its device tree.

---
 arch/arm/dts/mt8518.dtsi                      | 201 ++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig                |   9 +
 arch/arm/mach-mediatek/Makefile               |   1 +
 arch/arm/mach-mediatek/mt8518/Makefile        |   4 +
 arch/arm/mach-mediatek/mt8518/init.c          | 116 ++++++++++
 arch/arm/mach-mediatek/mt8518/lowlevel_init.S |  59 +++++
 6 files changed, 390 insertions(+)
 create mode 100644 arch/arm/dts/mt8518.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8518/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8518/init.c
 create mode 100644 arch/arm/mach-mediatek/mt8518/lowlevel_init.S
arch/arm/dts/mt8518.dtsi new file +49 -0
new file mode 100644
index 0000000000..39d001884f
@@ -0,0 +1,201 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2019 MediaTek Inc.
+ * Author: Mingming Lee <[email protected]>
+ *
+ */
+
+#include <dt-bindings/clock/mt8518-clk.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "mediatek,mt8518";
+	interrupt-parent = <&sysirq>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		enable-method = "mediatek,mt8518-smp";
+
+		cpu0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x1>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu2: cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x2>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu3: cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x3>;
+			clock-frequency = <1300000000>;

arch/arm/dts/mt8518.dtsi line 59

Quoted 10 lines
arch/arm/dts/mt8518.dtsi new file +10 -0
+		};
+	};
+
+	chipid: chipid at 08000000 {
+		compatible = "mediatek,chipid";
+		reg = <0x08000000 0x0004>,
+		      <0x08000004 0x0004>,
+		      <0x08000008 0x0004>,
+		      <0x0800000c 0x0004>;
+	};

I couldn't find any driver using this compatible.
You may want to drop this 'device'.

Quoted 2 lines

Regards,
Matthias

Thank you for review.
I will drop it and also drop other unused 'device'.

#4 lore raw

PATCH 1/5 ARM: MediaTek: Add support for MediaTek MT8518 SoC

In reply to Matthias Brugger
Quoted 88 lines · Matthias Brugger
Quoted 72 lines · mingming lee

Add support for MediaTek MT8518 SoC. This include the file that will initialize the SoC after boot and its device tree.

---
 arch/arm/dts/mt8518.dtsi                      | 201 ++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig                |   9 +
 arch/arm/mach-mediatek/Makefile               |   1 +
 arch/arm/mach-mediatek/mt8518/Makefile        |   4 +
 arch/arm/mach-mediatek/mt8518/init.c          | 116 ++++++++++
 arch/arm/mach-mediatek/mt8518/lowlevel_init.S |  59 +++++
 6 files changed, 390 insertions(+)
 create mode 100644 arch/arm/dts/mt8518.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8518/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8518/init.c
 create mode 100644 arch/arm/mach-mediatek/mt8518/lowlevel_init.S
arch/arm/dts/mt8518.dtsi new file +49 -0
new file mode 100644
index 0000000000..39d001884f
@@ -0,0 +1,201 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2019 MediaTek Inc.
+ * Author: Mingming Lee <[email protected]>
+ *
+ */
+
+#include <dt-bindings/clock/mt8518-clk.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "mediatek,mt8518";
+	interrupt-parent = <&sysirq>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		enable-method = "mediatek,mt8518-smp";
+
+		cpu0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x1>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu2: cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x2>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu3: cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x3>;
+			clock-frequency = <1300000000>;

arch/arm/dts/mt8518.dtsi line 59

Quoted 10 lines
arch/arm/dts/mt8518.dtsi new file +10 -0
+		};
+	};
+
+	chipid: chipid at 08000000 {
+		compatible = "mediatek,chipid";
+		reg = <0x08000000 0x0004>,
+		      <0x08000004 0x0004>,
+		      <0x08000008 0x0004>,
+		      <0x0800000c 0x0004>;
+	};

I couldn't find any driver using this compatible.
You may want to drop this 'device'.

Quoted 2 lines

Regards,
Matthias

Thank you for review.
I will drop this 'device' and also drop other unused 'device'.

#5 lore raw

PATCH 1/5 ARM: MediaTek: Add support for MediaTek MT8518 SoC

In reply to Matthias Brugger
Quoted 88 lines · Matthias Brugger
Quoted 72 lines · mingming lee

Add support for MediaTek MT8518 SoC. This include the file that will initialize the SoC after boot and its device tree.

---
 arch/arm/dts/mt8518.dtsi                      | 201 ++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig                |   9 +
 arch/arm/mach-mediatek/Makefile               |   1 +
 arch/arm/mach-mediatek/mt8518/Makefile        |   4 +
 arch/arm/mach-mediatek/mt8518/init.c          | 116 ++++++++++
 arch/arm/mach-mediatek/mt8518/lowlevel_init.S |  59 +++++
 6 files changed, 390 insertions(+)
 create mode 100644 arch/arm/dts/mt8518.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt8518/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt8518/init.c
 create mode 100644 arch/arm/mach-mediatek/mt8518/lowlevel_init.S
arch/arm/dts/mt8518.dtsi new file +49 -0
new file mode 100644
index 0000000000..39d001884f
@@ -0,0 +1,201 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2019 MediaTek Inc.
+ * Author: Mingming Lee <[email protected]>
+ *
+ */
+
+#include <dt-bindings/clock/mt8518-clk.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "mediatek,mt8518";
+	interrupt-parent = <&sysirq>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		enable-method = "mediatek,mt8518-smp";
+
+		cpu0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x0>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x1>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu2: cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x2>;
+			clock-frequency = <1300000000>;
+		};
+
+		cpu3: cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a53";
+			reg = <0x3>;
+			clock-frequency = <1300000000>;

arch/arm/dts/mt8518.dtsi line 59

Quoted 10 lines
arch/arm/dts/mt8518.dtsi new file +10 -0
+		};
+	};
+
+	chipid: chipid at 08000000 {
+		compatible = "mediatek,chipid";
+		reg = <0x08000000 0x0004>,
+		      <0x08000004 0x0004>,
+		      <0x08000008 0x0004>,
+		      <0x0800000c 0x0004>;
+	};

I couldn't find any driver using this compatible.
You may want to drop this 'device'.

Quoted 2 lines

Regards,
Matthias

Thank you for review.
I will drop it and also drop other unused 'device'.

#6 lore raw

PATCH 2/5 clk: mediatek: add driver for MT8518

In reply to mingming lee

Add clock driver for MediaTek MT8518 SoC.

---
 drivers/clk/mediatek/Makefile          |    1 +
 drivers/clk/mediatek/clk-mt8518.c      | 1558 ++++++++++++++++++++++++
 include/dt-bindings/clock/mt8518-clk.h |  249 ++++
 3 files changed, 1808 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8518.c
 create mode 100644 include/dt-bindings/clock/mt8518-clk.h
drivers/clk/mediatek/Makefile +1 -0
index a47a5bdbc2..e92bcd4efe 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_ARCH_MEDIATEK) += clk-mtk.o
 obj-$(CONFIG_TARGET_MT7623) += clk-mt7623.o
 obj-$(CONFIG_TARGET_MT7629) += clk-mt7629.o
 obj-$(CONFIG_TARGET_MT8516) += clk-mt8516.o
+obj-$(CONFIG_TARGET_MT8518) += clk-mt8518.o
drivers/clk/mediatek/clk-mt8518.c new file +1558 -0

1,558 lines not on this page · raw message

include/dt-bindings/clock/mt8518-clk.h new file +249 -0

249 lines not on this page · raw message

Signature · 1 line
2.18.0
#7 lore raw

PATCH 3/5 mmc: mtk-sd: add HS200 support

In reply to mingming lee

add HS200 mode and tune support

---
 drivers/mmc/mtk-sd.c | 30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)
drivers/mmc/mtk-sd.c +24 -6
index f555357af2..bede4153b3 100644
@@ -362,6 +362,8 @@ static u32 msdc_cmd_prepare_raw_cmd(struct msdc_host *host,
 	case MMC_CMD_WRITE_SINGLE_BLOCK:
 	case MMC_CMD_READ_SINGLE_BLOCK:
 	case SD_CMD_APP_SEND_SCR:
+	case MMC_CMD_SEND_TUNING_BLOCK:
+	case MMC_CMD_SEND_TUNING_BLOCK_HS200:
 		dtype = 1;
 		break;
 	case SD_CMD_SWITCH_FUNC: /* same as MMC_CMD_SWITCH */
@@ -467,6 +469,14 @@ static int msdc_start_command(struct msdc_host *host, struct mmc_cmd *cmd,
 	if (!msdc_cmd_is_ready(host))
 		return -EIO;
 
+	if ((readl(&host->base->msdc_fifocs) &
+	    MSDC_FIFOCS_TXCNT_M) >> MSDC_FIFOCS_TXCNT_S ||
+	    (readl(&host->base->msdc_fifocs) &
+	    MSDC_FIFOCS_RXCNT_M) >> MSDC_FIFOCS_RXCNT_S) {
+		pr_err("TX/RX FIFO non-empty before start of IO. Reset\n");
+		msdc_reset_hw(host);
+	}
+
 	msdc_fifo_clr(host);
 
 	host->last_resp_type = cmd->resp_type;
@@ -650,14 +660,22 @@ static int msdc_ops_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
 			     struct mmc_data *data)
 {
 	struct msdc_host *host = dev_get_priv(dev);
-	int ret;
+	int cmd_ret, data_ret;
 
-	ret = msdc_start_command(host, cmd, data);
-	if (ret)
-		return ret;
+	cmd_ret = msdc_start_command(host, cmd, data);
+	if (cmd_ret &&
+	    !(cmd_ret == -EIO &&
+	    (cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK ||
+	    cmd->cmdidx == MMC_CMD_SEND_TUNING_BLOCK_HS200)))
+		return cmd_ret;
 
-	if (data)
-		return msdc_start_data(host, data);
+	if (data) {
+		data_ret = msdc_start_data(host, data);
+		if (cmd_ret)
+			return cmd_ret;
+		else
+			return data_ret;
+	}
 
 	return 0;
 }
Signature · 1 line
2.18.0
#8 lore raw

PATCH 4/5 pinctrl: add driver for MT8518

In reply to mingming lee

Add Pinctrl driver for MediaTek MT8518 SoC.

---
 arch/arm/dts/mt8518.dtsi                  |   9 +
 drivers/pinctrl/mediatek/Kconfig          |   4 +
 drivers/pinctrl/mediatek/Makefile         |   1 +
 drivers/pinctrl/mediatek/pinctrl-mt8518.c | 411 ++++++++++++++++++++++
 4 files changed, 425 insertions(+)
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8518.c
arch/arm/dts/mt8518.dtsi +9 -0
index 39d001884f..d924944c2a 100644
@@ -151,6 +151,15 @@
 		status = "disabled";
 	};
 
+	pinctrl: pinctrl at 10005000 {
+		compatible = "mediatek,mt8518-pinctrl";
+		reg = <0x10005000 0x1000>;
+		gpio: gpio-controller {
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+	};
+
 	mmc0: mmc at 11120000 {
 		compatible = "mediatek,mt8516-mmc";
 		reg = <0x11120000 0x1000>;
drivers/pinctrl/mediatek/Kconfig +4 -0
index 9930ca1faf..22ee62362b 100644
@@ -16,4 +16,8 @@ config PINCTRL_MT8516
 	bool "MT8516 SoC pinctrl driver"
 	select PINCTRL_MTK
 
+config PINCTRL_MT8518
+        bool "MT8518 SoC pinctrl driver"
+	select PINCTRL_MTK
+
 endif
drivers/pinctrl/mediatek/Makefile +1 -0
index c4f29088d2..0ab7b1595b 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_PINCTRL_MTK) += pinctrl-mtk-common.o
 obj-$(CONFIG_PINCTRL_MT7623) += pinctrl-mt7623.o
 obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o
 obj-$(CONFIG_PINCTRL_MT8516) += pinctrl-mt8516.o
+obj-$(CONFIG_PINCTRL_MT8518) += pinctrl-mt8518.o
drivers/pinctrl/mediatek/pinctrl-mt8518.c new file +411 -0

411 lines not on this page · raw message

Signature · 1 line
2.18.0
#9 lore raw

PATCH 5/5 ARM: MediaTek: add basic support for MT8518 boards

In reply to mingming lee

This adds a general board file based on MT8518 SoCs from MediaTek.

Apart from the generic parts (cpu) we add some low level init codes and initialize the early clocks.

This commit is adding the basic boot support for the MT8518 eMMC board.

---
 arch/arm/dts/Makefile              |   3 +-
 arch/arm/dts/mt8518-ap1-emmc.dts   | 104 +++++++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig     |   1 +
 board/mediatek/mt8518/Kconfig      |  14 ++++
 board/mediatek/mt8518/MAINTAINERS  |   6 ++
 board/mediatek/mt8518/Makefile     |   3 +
 board/mediatek/mt8518/mt8518_ap1.c |  27 ++++++++
 configs/mt8518_ap1_emmc_defconfig  |  54 +++++++++++++++
 include/configs/mt8518.h           |  73 ++++++++++++++++++++
 9 files changed, 284 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/mt8518-ap1-emmc.dts
 create mode 100644 board/mediatek/mt8518/Kconfig
 create mode 100644 board/mediatek/mt8518/MAINTAINERS
 create mode 100644 board/mediatek/mt8518/Makefile
 create mode 100644 board/mediatek/mt8518/mt8518_ap1.c
 create mode 100644 configs/mt8518_ap1_emmc_defconfig
 create mode 100644 include/configs/mt8518.h
arch/arm/dts/Makefile +2 -1
index aac1b83d49..54ca31c995 100644
@@ -788,7 +788,8 @@ dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-common-proc-board.dtb \
 dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7623n-bananapi-bpi-r2.dtb \
 	mt7629-rfb.dtb \
-	mt8516-pumpkin.dtb
+	mt8516-pumpkin.dtb \
+	mt8518-ap1-emmc.dtb
 
 dtb-$(CONFIG_TARGET_GE_BX50V3) += imx6q-bx50v3.dtb
 dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
arch/arm/dts/mt8518-ap1-emmc.dts new file +104 -0

104 lines not on this page · raw message

arch/arm/mach-mediatek/Kconfig +1 -0
index 8e343c3182..a5808bd343 100644
@@ -52,5 +52,6 @@ endchoice
 source "board/mediatek/mt7623/Kconfig"
 source "board/mediatek/mt7629/Kconfig"
 source "board/mediatek/pumpkin/Kconfig"
+source "board/mediatek/mt8518/Kconfig"
 
 endif
board/mediatek/mt8518/Kconfig new file +14 -0
new file mode 100644
index 0000000000..1971c4d8c3
@@ -0,0 +1,14 @@
+if TARGET_MT8518
+
+config SYS_BOARD
+	default "mt8518"
+
+config SYS_CONFIG_NAME
+	default "mt8518"
+
+
+config MTK_BROM_HEADER_INFO
+	string
+	default "media=nor"
+
+endif
board/mediatek/mt8518/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..c9151947ad
@@ -0,0 +1,6 @@
+MT8518
+M:	Mingming lee <[email protected]>
+S:	Maintained
+F:	board/mediatek/mt8518
+F:	include/configs/mt8518.h
+F:	configs/mt8518_ap1_emmc_defconfig
board/mediatek/mt8518/Makefile new file +3 -0
new file mode 100644
index 0000000000..0884b32c56
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y += mt8518_ap1.o
board/mediatek/mt8518/mt8518_ap1.c new file +27 -0
new file mode 100644
index 0000000000..3d46350514
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 MediaTek Inc.
+ */
+
+#include <common.h>
+#include <dm.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+	/* address of boot parameters */
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+	printf("gd->fdt_blob is %p\n", gd->fdt_blob);
+	return 0;
+}
+
+int board_late_init(void)
+{
+	/*to load environment variable from persistent store*/
+	gd->env_valid = 1;
+	env_relocate();
+
+	return 0;
+}
configs/mt8518_ap1_emmc_defconfig new file +54 -0

54 lines not on this page · raw message

include/configs/mt8518.h new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
2.18.0
#10 lore raw

PATCH 5/5 ARM: MediaTek: add basic support for MT8518 boards

Quoted 8 lines · mingming lee

This adds a general board file based on MT8518 SoCs from MediaTek.

Apart from the generic parts (cpu) we add some low level init codes and initialize the early clocks.

This commit is adding the basic boot support for the MT8518 eMMC board.

OK, there's a few problems here:

[snip]

board/mediatek/mt8518/mt8518_ap1.c line 16

Quoted 6 lines
board/mediatek/mt8518/mt8518_ap1.c new file +6 -0
+int board_init(void)
+{
+	/* address of boot parameters */
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+	printf("gd->fdt_blob is %p\n", gd->fdt_blob);

Please remove this (and audit the series for other) bring-up debug printfs that we shouldn't need anymore.

board/mediatek/mt8518/mt8518_ap1.c line 27

Quoted 11 lines
board/mediatek/mt8518/mt8518_ap1.c new file +11 -0
+	return 0;
+}
+
+int board_late_init(void)
+{
+	/*to load environment variable from persistent store*/
+	gd->env_valid = 1;
+	env_relocate();
+
+	return 0;
+}

Er, do you really need this?

[snip]

include/configs/mt8518.h line 18

Quoted 3 lines
include/configs/mt8518.h new file +3 -0
+/* Machine ID */
+#define CONFIG_MACH_TYPE			8518
+#define CONFIG_SYS_NONCACHED_MEMORY		BIT(20)

CONFIG_MACH_TYPE is not relevant to aarch64 platforms (it's for pre-device tree boards) and 'BIT(20)' isn't a valid value for CONFIG_SYS_NONCACHED_MEMORY (and leads to a warning a build).

Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20191011/7da0c477/attachment.sig>
#11 lore raw

PATCH 5/5 ARM: MediaTek: add basic support for MT8518 boards

Quoted 47 lines · Tom Rini
Quoted 8 lines · mingming lee

This adds a general board file based on MT8518 SoCs from MediaTek.

Apart from the generic parts (cpu) we add some low level init codes and initialize the early clocks.

This commit is adding the basic boot support for the MT8518 eMMC board.

OK, there's a few problems here:

[snip]

board/mediatek/mt8518/mt8518_ap1.c line 16

Quoted 6 lines
board/mediatek/mt8518/mt8518_ap1.c new file +6 -0
+int board_init(void)
+{
+	/* address of boot parameters */
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
+	printf("gd->fdt_blob is %p\n", gd->fdt_blob);

Please remove this (and audit the series for other) bring-up debug printfs that we shouldn't need anymore.

board/mediatek/mt8518/mt8518_ap1.c line 27

Quoted 11 lines
board/mediatek/mt8518/mt8518_ap1.c new file +11 -0
+	return 0;
+}
+
+int board_late_init(void)
+{
+	/*to load environment variable from persistent store*/
+	gd->env_valid = 1;
+	env_relocate();
+
+	return 0;
+}

Er, do you really need this?

[snip]

include/configs/mt8518.h line 18

Quoted 3 lines
include/configs/mt8518.h new file +3 -0
+/* Machine ID */
+#define CONFIG_MACH_TYPE			8518
+#define CONFIG_SYS_NONCACHED_MEMORY		BIT(20)

CONFIG_MACH_TYPE is not relevant to aarch64 platforms (it's for pre-device tree boards) and 'BIT(20)' isn't a valid value for CONFIG_SYS_NONCACHED_MEMORY (and leads to a warning a build).

Quoted 2 lines

Thanks!

Thank you for your advice.I would modify those issues in the next Version.
For the debug info using API printf,I would modify it to the API debug()
For the API board_late_init and define CONFIG_MACH_TYPE,I would delete it.
For BIT(20), I used to use SZ_1M,it also have warning.I think I would modify it to 0x100000.