Skip to contentSkip to conversation

Add support for MediaTek MT7622 SoC

PATCH Superseded Sam Shih 2 participants 11 messages Dec 6, 2019

Subsystems (8)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sam Shih

author
#0 lore raw

cover Add support for MediaTek MT7622 SoC

This patch series adds basic boot support on eMMC/SD/spi-nor for the MediaTek MT7622 SoC based boards. This series add the clock, pinctrl drivers and the SoC initializaton code.

Sam Shih (8):
ARM: MediaTek: Add support for MediaTek MT7622 SoC
pinctrl: mediatek: add driver for MT7622
pinctrl: mediatek: add support for different pinctrl
clk: mediatek: add driver for MT7622
clk: mediatek: fix clock-rate overflow problem
power: domain: add power domain support for MT7622
mmc: add mmc and sd support for MT7622
Add support for MT7622 reference board

 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/mt7622-rfb.dts                   | 179 +++++
 arch/arm/dts/mt7622.dtsi                      | 191 +++++
 arch/arm/mach-mediatek/Kconfig                |   9 +
 arch/arm/mach-mediatek/Makefile               |   1 +
 arch/arm/mach-mediatek/mt7622/Makefile        |   3 +
 arch/arm/mach-mediatek/mt7622/init.c          |  51 ++
 board/mediatek/mt7622/Kconfig                 |  17 +
 board/mediatek/mt7622/MAINTAINERS             |   6 +
 board/mediatek/mt7622/Makefile                |   4 +
 board/mediatek/mt7622/mt7622_rfb.c            |  23 +
 configs/mt7622_rfb_defconfig                  |  57 ++
 drivers/clk/mediatek/Makefile                 |   1 +
 drivers/clk/mediatek/clk-mt7622.c             | 678 ++++++++++++++++
 drivers/clk/mediatek/clk-mtk.c                |   6 +-
 drivers/mmc/mtk-sd.c                          |  10 +
 drivers/pinctrl/mediatek/Kconfig              |   4 +
 drivers/pinctrl/mediatek/Makefile             |   1 +
 drivers/pinctrl/mediatek/pinctrl-mt7622.c     | 754 ++++++++++++++++++
 drivers/pinctrl/mediatek/pinctrl-mt7623.c     |   2 +
 drivers/pinctrl/mediatek/pinctrl-mt7629.c     |   2 +
 drivers/pinctrl/mediatek/pinctrl-mt8516.c     |   2 +
 drivers/pinctrl/mediatek/pinctrl-mt8518.c     |   2 +
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 122 ++-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |  12 +-
 drivers/power/domain/mtk-power-domain.c       |   6 +
 include/configs/mt7622.h                      |  46 ++
 include/dt-bindings/clock/mt7622-clk.h        | 271 +++++++
 28 files changed, 2439 insertions(+), 22 deletions(-)
 create mode 100644 arch/arm/dts/mt7622-rfb.dts
 create mode 100644 arch/arm/dts/mt7622.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt7622/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt7622/init.c
 create mode 100644 board/mediatek/mt7622/Kconfig
 create mode 100644 board/mediatek/mt7622/MAINTAINERS
 create mode 100644 board/mediatek/mt7622/Makefile
 create mode 100644 board/mediatek/mt7622/mt7622_rfb.c
 create mode 100644 configs/mt7622_rfb_defconfig
 create mode 100644 drivers/clk/mediatek/clk-mt7622.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt7622.c
 create mode 100644 include/configs/mt7622.h
 create mode 100644 include/dt-bindings/clock/mt7622-clk.h
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/8 ARM: MediaTek: Add support for MediaTek MT7622 SoC

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

---
 arch/arm/dts/mt7622.dtsi               | 191 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/Kconfig         |   9 ++
 arch/arm/mach-mediatek/Makefile        |   1 +
 arch/arm/mach-mediatek/mt7622/Makefile |   3 +
 arch/arm/mach-mediatek/mt7622/init.c   |  51 +++++++
 5 files changed, 255 insertions(+)
 create mode 100644 arch/arm/dts/mt7622.dtsi
 create mode 100644 arch/arm/mach-mediatek/mt7622/Makefile
 create mode 100644 arch/arm/mach-mediatek/mt7622/init.c
arch/arm/dts/mt7622.dtsi new file +191 -0
new file mode 100644
index 0000000000..f6abf7cf35
@@ -0,0 +1,191 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ * Author: Sam Shih <[email protected]>
+ */
+
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/clock/mt7622-clk.h>
+
+/ {
+	compatible = "mediatek,mt7622";
+	interrupt-parent = <&sysirq>;
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		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>;
+		};
+	};
+
+	snfi: snfi at 1100d000 {
+		compatible = "mediatek,mtk-snfi-spi";
+		reg = <0x1100d000 0x2000>;
+		clocks = <&pericfg CLK_PERI_NFI_PD>,
+			 <&pericfg CLK_PERI_SNFI_PD>;
+		clock-names = "nfi_clk", "pad_clk";
+		assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>,
+				  <&topckgen CLK_TOP_NFI_INFRA_SEL>;
+
+		assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>,
+					 <&topckgen CLK_TOP_UNIVPLL2_D8>;
+		status = "disabled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		u-boot,dm-pre-reloc;
+	};
+
+	timer {
+		compatible = "arm,armv8-timer";
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) |
+			      IRQ_TYPE_LEVEL_HIGH)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) |
+			      IRQ_TYPE_LEVEL_HIGH)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) |
+			      IRQ_TYPE_LEVEL_HIGH)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) |
+			      IRQ_TYPE_LEVEL_HIGH)>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
+	timer0: timer at 10004000 {
+		compatible = "mediatek,timer";
+		reg = <0x10004000 0x80>;
+		interrupts = <GIC_SPI 152 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&system_clk>;
+		clock-names = "system-clk";
+		u-boot,dm-pre-reloc;
+	};
+
+	system_clk: dummy13m {
+		compatible = "fixed-clock";
+		clock-frequency = <13000000>;
+		#clock-cells = <0>;
+	};
+
+	infracfg: infracfg at 10000000 {
+		compatible = "mediatek,mt7622-infracfg",
+			     "syscon";
+		reg = <0 0x10000000 0 0x1000>;
+		#clock-cells = <1>;
+		#reset-cells = <1>;
+	};
+
+	pericfg: pericfg at 10002000 {
+		compatible = "mediatek,mt7622-pericfg", "syscon";
+		reg = <0x10002000 0x1000>;
+		#clock-cells = <1>;
+		u-boot,dm-pre-reloc;
+	};
+
+	scpsys: scpsys at 10006000 {
+		compatible = "mediatek,mt7622-scpsys",
+			     "syscon";
+		#power-domain-cells = <1>;
+		reg = <0 0x10006000 0 0x1000>;
+		interrupts = <GIC_SPI 165 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 166 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 167 IRQ_TYPE_LEVEL_LOW>,
+			     <GIC_SPI 168 IRQ_TYPE_LEVEL_LOW>;
+		infracfg = <&infracfg>;
+		clocks = <&topckgen CLK_TOP_HIF_SEL>;
+		clock-names = "hif_sel";
+	};
+
+	sysirq: interrupt-controller at 10200620 {
+		compatible = "mediatek,sysirq";
+		reg = <0x10200620 0x20>;
+		interrupt-controller;
+		#interrupt-cells = <3>;
+		interrupt-parent = <&gic>;
+	};
+
+	apmixedsys: apmixedsys at 10209000 {
+		compatible = "mediatek,mt7622-apmixedsys";
+		reg = <0x10209000 0x1000>;
+		#clock-cells = <1>;
+		u-boot,dm-pre-reloc;
+	};
+
+	topckgen: topckgen at 10210000 {
+		compatible = "mediatek,mt7622-topckgen";
+		reg = <0x10210000 0x1000>;
+		#clock-cells = <1>;
+		u-boot,dm-pre-reloc;
+	};
+
+	pinctrl: pinctrl at 10211000 {
+		compatible = "mediatek,mt7622-pinctrl";
+		reg = <0x10211000 0x1000>;
+		gpio: gpio-controller {
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+	};
+
+	watchdog: watchdog at 10212000 {
+		compatible = "mediatek,wdt";
+		reg = <0x10212000 0x800>;
+	};
+
+	gic: interrupt-controller at 10300000 {
+		compatible = "arm,gic-400";
+		interrupt-controller;
+		#interrupt-cells = <3>;
+		interrupt-parent = <&gic>;
+		reg = <0x10310000 0x1000>,
+		      <0x10320000 0x1000>,
+		      <0x10340000 0x2000>,
+		      <0x10360000 0x2000>;
+	};
+
+	uart0: serial at 11002000 {
+		compatible = "mediatek,hsuart";
+		reg = <0x11002000 0x400>;
+		reg-shift = <2>;
+		interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&topckgen CLK_TOP_UART_SEL>,
+			 <&pericfg CLK_PERI_UART0_PD>;
+		clock-names = "baud", "bus";
+		status = "disabled";
+		assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>;
+		assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>;
+		u-boot,dm-pre-reloc;
+	};
+
+	mmc0: mmc at 11230000 {
+		compatible = "mediatek,mt7622-mmc";
+		reg = <0x11230000 0x1000>;
+		interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&pericfg CLK_PERI_MSDC30_0_PD>,
+			 <&topckgen CLK_TOP_MSDC50_0_SEL>;
+		clock-names = "source", "hclk";
+		status = "disabled";
+	};
+
+	mmc1: mmc at 11240000 {
+		compatible = "mediatek,mt7622-mmc";
+		reg = <0x11240000 0x1000>;
+		interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_LOW>;
+		clocks = <&pericfg CLK_PERI_MSDC30_1_PD>,
+			 <&topckgen CLK_TOP_AXI_SEL>;
+		clock-names = "source", "hclk";
+		status = "disabled";
+	};
+};
arch/arm/mach-mediatek/Kconfig +9 -0
index ad453a60c1..908ca48b47 100644
@@ -9,6 +9,14 @@ config SYS_VENDOR
 choice
 	prompt "MediaTek board select"
 
+config TARGET_MT7622
+	bool "MediaTek MT7622 SoC"
+	select ARM64
+	help
+	  The MediaTek MT7622 is a ARM64-based SoC with a dual-core Cortex-A53.
+	  including UART, SPI, USB3.0, SD and MMC cards, NAND, SNFI, PWM, PCIe,
+	  Gigabit Ethernet, I2C, built-in Wi-Fi, and PCIe.
+
 config TARGET_MT7623
 	bool "MediaTek MT7623 SoC"
 	select CPU_V7A
@@ -49,6 +57,7 @@ config TARGET_MT8518
 
 endchoice
 
+source "board/mediatek/mt7622/Kconfig"
 source "board/mediatek/mt7623/Kconfig"
 source "board/mediatek/mt7629/Kconfig"
 source "board/mediatek/mt8518/Kconfig"
arch/arm/mach-mediatek/Makefile +1 -0
index b9b2355e03..7e1e4a986c 100644
@@ -3,6 +3,7 @@
 obj-y	+= cpu.o
 obj-$(CONFIG_SPL_BUILD)	+= spl.o
 
+obj-$(CONFIG_TARGET_MT7622) += mt7622/
 obj-$(CONFIG_TARGET_MT7623) += mt7623/
 obj-$(CONFIG_TARGET_MT7629) += mt7629/
 obj-$(CONFIG_TARGET_MT8516) += mt8516/
arch/arm/mach-mediatek/mt7622/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/mt7622/init.c new file +51 -0

51 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH 1/8 ARM: MediaTek: Add support for MediaTek MT7622 SoC

Quoted 7 lines · Sam Shih

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

---
 arch/arm/dts/mt7622.dtsi               | 191 +++++++++++++++++++++++++

I see u-boot, properties in this file. They belong in a -u-boot.dtsi file that will be automatically picked up, and this lets us keep the files otherwise unchanged from the Linux kernel we import them from. I may have missed this on other MediaTek platforms, sorry and if so please submit patches to correct that. 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: <https://lists.denx.de/pipermail/u-boot/attachments/20191206/4345ce55/attachment.sig>
author
#3 lore raw

PATCH 2/8 pinctrl: mediatek: add driver for MT7622

In reply to Sam Shih

This patch add Pinctrl driver for MediaTek MT7622 SoC.

---
 drivers/pinctrl/mediatek/Kconfig          |   4 +
 drivers/pinctrl/mediatek/Makefile         |   1 +
 drivers/pinctrl/mediatek/pinctrl-mt7622.c | 752 ++++++++++++++++++++++
 3 files changed, 757 insertions(+)
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt7622.c
drivers/pinctrl/mediatek/Kconfig +4 -0
index 22ee62362b..b5d0baee38 100644
@@ -4,6 +4,10 @@ config PINCTRL_MTK
 	depends on PINCTRL_GENERIC
 	bool
 
+config PINCTRL_MT7622
+	bool "MT7622 SoC pinctrl driver"
+	select PINCTRL_MTK
+
 config PINCTRL_MT7623
 	bool "MT7623 SoC pinctrl driver"
 	select PINCTRL_MTK
drivers/pinctrl/mediatek/Makefile +1 -0
index 0ab7b1595b..b330fb831e 100644
@@ -3,6 +3,7 @@
 obj-$(CONFIG_PINCTRL_MTK) += pinctrl-mtk-common.o
 
 # SoC Drivers
+obj-$(CONFIG_PINCTRL_MT7622) += pinctrl-mt7622.o
 obj-$(CONFIG_PINCTRL_MT7623) += pinctrl-mt7623.o
 obj-$(CONFIG_PINCTRL_MT7629) += pinctrl-mt7629.o
 obj-$(CONFIG_PINCTRL_MT8516) += pinctrl-mt8516.o
drivers/pinctrl/mediatek/pinctrl-mt7622.c new file +752 -0

752 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#4 lore raw

PATCH 3/8 pinctrl: mediatek: add support for different pinctrl

In reply to Sam Shih

Due to the pinctrl hardware of MT7622 is difference from others SoC which using the commom part of mediatek pinctrl. So we need to modify the common part of mediatek pinctrl.

---
 drivers/pinctrl/mediatek/pinctrl-mt7622.c     |   2 +
 drivers/pinctrl/mediatek/pinctrl-mt7623.c     |   2 +
 drivers/pinctrl/mediatek/pinctrl-mt7629.c     |   2 +
 drivers/pinctrl/mediatek/pinctrl-mt8516.c     |   2 +
 drivers/pinctrl/mediatek/pinctrl-mt8518.c     |   2 +
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 122 +++++++++++++++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |  12 +-
 7 files changed, 125 insertions(+), 19 deletions(-)
drivers/pinctrl/mediatek/pinctrl-mt7622.c +2 -0
index 2a4bf43c32..12b6174bfd 100644
@@ -728,6 +728,8 @@ static struct mtk_pinctrl_soc mt7622_data = {
 	.ngrps = ARRAY_SIZE(mt7622_groups),
 	.funcs = mt7622_functions,
 	.nfuncs = ARRAY_SIZE(mt7622_functions),
+	.gpio_func = 1,
+	.rev = MTK_PINCTRL_V0,
 };
 
 static int mtk_pinctrl_mt7622_probe(struct udevice *dev)
drivers/pinctrl/mediatek/pinctrl-mt7623.c +2 -0
index fd37dfa442..5cff9ebb3b 100644
@@ -1242,6 +1242,8 @@ static struct mtk_pinctrl_soc mt7623_data = {
 	.ngrps = ARRAY_SIZE(mt7623_groups),
 	.funcs = mt7623_functions,
 	.nfuncs = ARRAY_SIZE(mt7623_functions),
+	.gpio_func = 0,
+	.rev = MTK_PINCTRL_V1,
 };
 
 /*
drivers/pinctrl/mediatek/pinctrl-mt7629.c +2 -0
index aa6d1c2d91..bb68a2d876 100644
@@ -387,6 +387,8 @@ static struct mtk_pinctrl_soc mt7629_data = {
 	.ngrps = ARRAY_SIZE(mt7629_groups),
 	.funcs = mt7629_functions,
 	.nfuncs = ARRAY_SIZE(mt7629_functions),
+	.gpio_func = 0,
+	.rev = MTK_PINCTRL_V1,
 };
 
 static int mtk_pinctrl_mt7629_probe(struct udevice *dev)
drivers/pinctrl/mediatek/pinctrl-mt8516.c +2 -0
index 829b30e5a2..6baa5a9045 100644
@@ -369,6 +369,8 @@ static struct mtk_pinctrl_soc mt8516_data = {
 	.ngrps = ARRAY_SIZE(mt8516_groups),
 	.funcs = mt8516_functions,
 	.nfuncs = ARRAY_SIZE(mt8516_functions),
+	.gpio_func = 0,
+	.rev = MTK_PINCTRL_V1,
 };
 
 static int mtk_pinctrl_mt8516_probe(struct udevice *dev)
drivers/pinctrl/mediatek/pinctrl-mt8518.c +2 -0
index 8d2cd948f6..350b90ec27 100644
@@ -389,6 +389,8 @@ static struct mtk_pinctrl_soc mt8518_data = {
 	.ngrps = ARRAY_SIZE(mt8518_groups),
 	.funcs = mt8518_functions,
 	.nfuncs = ARRAY_SIZE(mt8518_functions),
+	.gpio_func = 0,
+	.rev = MTK_PINCTRL_V1,
 };
 
 static int mtk_pinctrl_mt8518_probe(struct udevice *dev)
drivers/pinctrl/mediatek/pinctrl-mtk-common.c +105 -17

164 lines not on this page · raw message

drivers/pinctrl/mediatek/pinctrl-mtk-common.h +10 -2
index 86559f0f14..c49610442c 100644
@@ -3,10 +3,12 @@
  * Copyright (C) 2018 MediaTek Inc.
  * Author: Ryder Lee <[email protected]>
  */
-
 #ifndef __PINCTRL_MEDIATEK_H__
 #define __PINCTRL_MEDIATEK_H__
 
+#define MTK_PINCTRL_V0 0x0
+#define MTK_PINCTRL_V1 0x1
+
 #define MTK_RANGE(_a)		{ .range = (_a), .nranges = ARRAY_SIZE(_a), }
 #define MTK_PIN(_number, _name, _drv_n) {				\
 		.number = _number,					\
@@ -40,8 +42,12 @@ enum {
 	PINCTRL_PIN_REG_DIR,
 	PINCTRL_PIN_REG_DI,
 	PINCTRL_PIN_REG_DO,
-	PINCTRL_PIN_REG_IES,
 	PINCTRL_PIN_REG_SMT,
+	PINCTRL_PIN_REG_PD,
+	PINCTRL_PIN_REG_PU,
+	PINCTRL_PIN_REG_E4,
+	PINCTRL_PIN_REG_E8,
+	PINCTRL_PIN_REG_IES,
 	PINCTRL_PIN_REG_PULLEN,
 	PINCTRL_PIN_REG_PULLSEL,
 	PINCTRL_PIN_REG_DRV,
@@ -161,6 +167,8 @@ struct mtk_pinctrl_soc {
 	int ngrps;
 	const struct mtk_function_desc *funcs;
 	int nfuncs;
+	int gpio_func;
+	int rev;
 };
 
 /**
Signature · 1 line
2.17.1
author
#5 lore raw

PATCH 4/8 clk: mediatek: add driver for MT7622

In reply to Sam Shih

This patch add clock driver for MediaTek MT7622 SoC.

---
 drivers/clk/mediatek/Makefile          |   1 +
 drivers/clk/mediatek/clk-mt7622.c      | 678 +++++++++++++++++++++++++
 include/dt-bindings/clock/mt7622-clk.h | 271 ++++++++++
 3 files changed, 950 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt7622.c
 create mode 100644 include/dt-bindings/clock/mt7622-clk.h
drivers/clk/mediatek/Makefile +1 -0
index e92bcd4efe..755e24c651 100644
@@ -4,6 +4,7 @@ obj-$(CONFIG_ARCH_MEDIATEK) += clk-mtk.o
 
 # SoC Drivers
 obj-$(CONFIG_TARGET_MT7623) += clk-mt7623.o
+obj-$(CONFIG_TARGET_MT7622) += clk-mt7622.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-mt7622.c new file +678 -0

678 lines not on this page · raw message

include/dt-bindings/clock/mt7622-clk.h new file +271 -0

271 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#6 lore raw

PATCH 5/8 clk: mediatek: fix clock-rate overflow problem

In reply to Sam Shih

This patch fix clock-rate overflow problem in mediatek clock driver common part.

---
 drivers/clk/mediatek/clk-mtk.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/mediatek/clk-mtk.c +3 -3
index 6c6b500d9b..9c30be994e 100644
@@ -39,7 +39,7 @@
  * this function is recursively called to find the parent to calculate
  * the accurate frequency.
  */
-static int mtk_clk_find_parent_rate(struct clk *clk, int id,
+static ulong mtk_clk_find_parent_rate(struct clk *clk, int id,
 				    const struct driver *drv)
 {
 	struct clk parent = { .id = id, };
@@ -265,7 +265,7 @@ static ulong mtk_factor_recalc_rate(const struct mtk_fixed_factor *fdiv,
 	return rate;
 }
 
-static int mtk_topckgen_get_factor_rate(struct clk *clk, u32 off)
+static ulong mtk_topckgen_get_factor_rate(struct clk *clk, u32 off)
 {
 	struct mtk_clk_priv *priv = dev_get_priv(clk->dev);
 	const struct mtk_fixed_factor *fdiv = &priv->tree->fdivs[off];
@@ -287,7 +287,7 @@ static int mtk_topckgen_get_factor_rate(struct clk *clk, u32 off)
 	return mtk_factor_recalc_rate(fdiv, rate);
 }
 
-static int mtk_topckgen_get_mux_rate(struct clk *clk, u32 off)
+static ulong mtk_topckgen_get_mux_rate(struct clk *clk, u32 off)
 {
 	struct mtk_clk_priv *priv = dev_get_priv(clk->dev);
 	const struct mtk_composite *mux = &priv->tree->muxes[off];
Signature · 1 line
2.17.1
author
#7 lore raw

PATCH 6/8 power: domain: add power domain support for MT7622

In reply to Sam Shih

This patch add power domain support for Mediatek MT7622 SoCs

---
 drivers/power/domain/mtk-power-domain.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/power/domain/mtk-power-domain.c +6 -0
index c67e8804b1..0bf8a16447 100644
@@ -60,6 +60,7 @@
 #define DCM_TOP_EN		BIT(0)
 
 enum scp_domain_type {
+	SCPSYS_MT7622,
 	SCPSYS_MT7623,
 	SCPSYS_MT7629,
 };
@@ -328,6 +329,7 @@ static int mtk_power_domain_hook(struct udevice *dev)
 	case SCPSYS_MT7623:
 		scpd->data = scp_domain_mt7623;
 		break;
+	case SCPSYS_MT7622:
 	case SCPSYS_MT7629:
 		scpd->data = scp_domain_mt7629;
 		break;
@@ -378,6 +380,10 @@ static int mtk_power_domain_probe(struct udevice *dev)
 }
 
 static const struct udevice_id mtk_power_domain_ids[] = {
+	{
+		.compatible = "mediatek,mt7622-scpsys",
+		.data = SCPSYS_MT7622,
+	},
 	{
 		.compatible = "mediatek,mt7623-scpsys",
 		.data = SCPSYS_MT7623,
Signature · 1 line
2.17.1
author
#8 lore raw

PATCH 7/8 mmc: add mmc and sd support for MT7622

In reply to Sam Shih

This patch add mmc and sd support for Mediatek MT7622 SoCs

---
 drivers/mmc/mtk-sd.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/mmc/mtk-sd.c +10 -0
index eaa584a4df..a3ede3070a 100644
@@ -1568,6 +1568,15 @@ static const struct msdc_compatible mt7620_compat = {
 	.enhance_rx = false
 };
 
+static const struct msdc_compatible mt7622_compat = {
+	.clk_div_bits = 12,
+	.pad_tune0 = true,
+	.async_fifo = true,
+	.data_tune = true,
+	.busy_check = true,
+	.stop_clk_fix = true,
+};
+
 static const struct msdc_compatible mt7623_compat = {
 	.clk_div_bits = 12,
 	.sclk_cycle_shift = 20,
@@ -1601,6 +1610,7 @@ static const struct msdc_compatible mt8183_compat = {
 
 static const struct udevice_id msdc_ids[] = {
 	{ .compatible = "mediatek,mt7620-mmc", .data = (ulong)&mt7620_compat },
+	{ .compatible = "mediatek,mt7622-mmc", .data = (ulong)&mt7622_compat },
 	{ .compatible = "mediatek,mt7623-mmc", .data = (ulong)&mt7623_compat },
 	{ .compatible = "mediatek,mt8516-mmc", .data = (ulong)&mt8516_compat },
 	{ .compatible = "mediatek,mt8183-mmc", .data = (ulong)&mt8183_compat },
Signature · 1 line
2.17.1
author
#9 lore raw

PATCH 8/8 Add support for MT7622 reference board

In reply to Sam Shih

This adds a general board file based on MT7622 SoCs from MediaTek. This commit is adding the basic boot support for the MT7622 rfb.

---
 arch/arm/dts/Makefile              |   1 +
 arch/arm/dts/mt7622-rfb.dts        | 179 +++++++++++++++++++++++++++++
 board/mediatek/mt7622/Kconfig      |  17 +++
 board/mediatek/mt7622/MAINTAINERS  |   6 +
 board/mediatek/mt7622/Makefile     |   4 +
 board/mediatek/mt7622/mt7622_rfb.c |  23 ++++
 configs/mt7622_rfb_defconfig       |  57 +++++++++
 include/configs/mt7622.h           |  46 ++++++++
 8 files changed, 333 insertions(+)
 create mode 100644 arch/arm/dts/mt7622-rfb.dts
 create mode 100644 board/mediatek/mt7622/Kconfig
 create mode 100644 board/mediatek/mt7622/MAINTAINERS
 create mode 100644 board/mediatek/mt7622/Makefile
 create mode 100644 board/mediatek/mt7622/mt7622_rfb.c
 create mode 100644 configs/mt7622_rfb_defconfig
 create mode 100644 include/configs/mt7622.h
arch/arm/dts/Makefile +1 -0
index 3dc9c4d41c..b92980bd76 100644
@@ -833,6 +833,7 @@ dtb-$(CONFIG_SOC_K3_J721E) += k3-j721e-common-proc-board.dtb \
 			      k3-j721e-r5-common-proc-board.dtb
 
 dtb-$(CONFIG_ARCH_MEDIATEK) += \
+	mt7622-rfb.dtb \
 	mt7623n-bananapi-bpi-r2.dtb \
 	mt7629-rfb.dtb \
 	mt8516-pumpkin.dtb \
arch/arm/dts/mt7622-rfb.dts new file +179 -0

179 lines not on this page · raw message

board/mediatek/mt7622/Kconfig new file +17 -0
new file mode 100644
index 0000000000..d0abdc0a67
@@ -0,0 +1,17 @@
+if TARGET_MT7622
+
+config SYS_BOARD
+	default "mt7622"
+
+config SYS_CONFIG_NAME
+	default "mt7622"
+
+config MTK_BROM_HEADER_INFO
+	string
+	default "lk=1"
+
+config MTK_BROM_HEADER_INFO
+	string
+	default "media=nor"
+
+endif
board/mediatek/mt7622/MAINTAINERS new file +6 -0
new file mode 100644
index 0000000000..a3e0e75ca0
@@ -0,0 +1,6 @@
+MT7622
+M:	Sam Shih <[email protected]>
+S:	Maintained
+F:	board/mediatek/mt7622
+F:	include/configs/mt7622.h
+F:	configs/mt7622_rfb_defconfig
board/mediatek/mt7622/Makefile new file +4 -0
new file mode 100644
index 0000000000..2c54d86fff
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier:	GPL-2.0
+
+obj-y	+= mt7622_rfb.o
+
board/mediatek/mt7622/mt7622_rfb.c new file +23 -0
new file mode 100644
index 0000000000..b9296bede2
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 MediaTek Inc.
+ * Author: Sam Shih <[email protected]>
+ */
+
+#include <common.h>
+#include <config.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+	return 0;
+}
+
+int board_late_init(void)
+{
+	gd->env_valid = 1; //to load environment variable from persistent store
+	env_relocate();
+	return 0;
+}
configs/mt7622_rfb_defconfig new file +57 -0

57 lines not on this page · raw message

include/configs/mt7622.h new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.17.1
#10 lore raw

PATCH 8/8 Add support for MT7622 reference board

Quoted 8 lines · Sam Shih

This adds a general board file based on MT7622 SoCs from MediaTek. This commit is adding the basic boot support for the MT7622 rfb.

---
 arch/arm/dts/Makefile              |   1 +
 arch/arm/dts/mt7622-rfb.dts        | 179 +++++++++++++++++++++++++++++

Same comment about u-boot, properties. Thanks! Nothing otherwise sticks out to me in the series from a general point of view.

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: <https://lists.denx.de/pipermail/u-boot/attachments/20191206/711f23ac/attachment.sig>