Skip to contentSkip to conversation

Add support for MediaTek MT7622 SoC

PATCH RESEND New Sam Shih 2 participants 21 messages Jan 10, 2020 – Jan 16, 2020

Subsystems (8)
lore
Share & tools
lore

Sam Shih

author
#0 lore raw

v2 cover Add support for MediaTek MT7622 SoC

A gentle ping on this whole patch series

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.

Change since V1:
- move mt7622/23/29 u-boot properties to -u-boot.dtsi files
- pinctrl: mediatek: add support for different pinctrl:
- use gpio_mode to replace gpio_func for easier understanding
- fix mt7623n bpir2 defconfig
- ARM: MediaTek: Add support for MediaTek MT7622 SoC
- fix dram size in mm_region

Sam Shih (10):
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
arm: dts: mediatek: move u-boot properties to -u-boot.dtsi file
configs: mediatek: fix mt7623n bpir2 defconfig

 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/mt7622-rfb.dts                   | 180 +++++
 arch/arm/dts/mt7622-u-boot.dtsi               |  29 +
 arch/arm/dts/mt7622.dtsi                      | 185 +++++
 arch/arm/dts/mt7623-u-boot.dtsi               |  29 +
 arch/arm/dts/mt7623.dtsi                      |   6 -
 arch/arm/dts/mt7623n-bananapi-bpi-r2.dts      |   1 +
 arch/arm/dts/mt7629-rfb-u-boot.dtsi           |  36 +
 arch/arm/dts/mt7629-rfb.dts                   |   1 +
 arch/arm/dts/mt7629.dtsi                      |   9 -
 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                  |  55 ++
 configs/mt7623n_bpir2_defconfig               |   1 +
 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 +++++++
 36 files changed, 2529 insertions(+), 37 deletions(-)
 create mode 100644 arch/arm/dts/mt7622-rfb.dts
 create mode 100644 arch/arm/dts/mt7622-u-boot.dtsi
 create mode 100644 arch/arm/dts/mt7622.dtsi
 create mode 100644 arch/arm/dts/mt7623-u-boot.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 RESEND v2 1/10 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-u-boot.dtsi        |  29 ++++
 arch/arm/dts/mt7622.dtsi               | 185 +++++++++++++++++++++++++
 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 +++++++
 6 files changed, 278 insertions(+)
 create mode 100644 arch/arm/dts/mt7622-u-boot.dtsi
 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-u-boot.dtsi new file +29 -0
new file mode 100644
index 0000000000..b14b1d4344
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ * Author: Sam Shih <[email protected]>
+ */
+
+&topckgen {
+	u-boot,dm-pre-reloc;
+};
+
+&pericfg {
+	u-boot,dm-pre-reloc;
+};
+
+&apmixedsys {
+	u-boot,dm-pre-reloc;
+};
+
+&timer0 {
+	u-boot,dm-pre-reloc;
+};
+
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&snfi {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/mt7622.dtsi new file +185 -0

185 lines not on this page · raw message

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 RESEND v2 1/10 ARM: MediaTek: Add support for MediaTek MT7622 SoC

Quoted 5 lines · Sam Shih

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

Applied to u-boot/master, 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/20200116/4d3a0bf9/attachment.sig>
author
#3 lore raw

PATCH RESEND v2 2/10 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
@@ -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
#4 lore raw

PATCH RESEND v2 2/10 pinctrl: mediatek: add driver for MT7622

Quoted 4 lines · Sam Shih

This patch add Pinctrl driver for MediaTek MT7622 SoC.

Applied to u-boot/master, 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/20200116/90b62734/attachment.sig>
author
#5 lore raw

PATCH RESEND v2 3/10 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 common 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..1aa323c009 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_mode = 1,
+	.rev = MTK_PINCTRL_V0,
 };
 
 static int mtk_pinctrl_mt7622_probe(struct udevice *dev)
drivers/pinctrl/mediatek/pinctrl-mt7623.c +2 -0
index fd37dfa442..d58d840e08 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_mode = 0,
+	.rev = MTK_PINCTRL_V1,
 };
 
 /*
drivers/pinctrl/mediatek/pinctrl-mt7629.c +2 -0
index aa6d1c2d91..37640dd2b6 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_mode = 0,
+	.rev = MTK_PINCTRL_V1,
 };
 
 static int mtk_pinctrl_mt7629_probe(struct udevice *dev)
drivers/pinctrl/mediatek/pinctrl-mt8516.c +2 -0
index 829b30e5a2..62e339e931 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_mode = 0,
+	.rev = MTK_PINCTRL_V1,
 };
 
 static int mtk_pinctrl_mt8516_probe(struct udevice *dev)
drivers/pinctrl/mediatek/pinctrl-mt8518.c +2 -0
index 8d2cd948f6..91427aed4b 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_mode = 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..e815761450 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_mode;
+	int rev;
 };
 
 /**
Signature · 1 line
2.17.1
#6 lore raw

PATCH RESEND v2 3/10 pinctrl: mediatek: add support for different pinctrl

Quoted 6 lines · Sam Shih

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

Applied to u-boot/master, 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/20200116/096c237a/attachment.sig>
author
#7 lore raw

PATCH RESEND v2 4/10 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
#8 lore raw

PATCH RESEND v2 4/10 clk: mediatek: add driver for MT7622

Quoted 4 lines · Sam Shih

This patch add clock driver for MediaTek MT7622 SoC.

Applied to u-boot/master, 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/20200116/cd2d5461/attachment.sig>
author
#9 lore raw

PATCH RESEND v2 5/10 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
#10 lore raw

PATCH RESEND v2 5/10 clk: mediatek: fix clock-rate overflow problem

Quoted 5 lines · Sam Shih

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

Applied to u-boot/master, 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/20200116/e049fa0d/attachment.sig>
author
#11 lore raw

PATCH RESEND v2 6/10 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
#12 lore raw

PATCH RESEND v2 6/10 power: domain: add power domain support for MT7622

Quoted 4 lines · Sam Shih

This patch add power domain support for Mediatek MT7622 SoCs

Applied to u-boot/master, 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/20200116/312a911e/attachment.sig>
author
#13 lore raw

PATCH RESEND v2 7/10 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
#14 lore raw

PATCH RESEND v2 7/10 mmc: add mmc and sd support for MT7622

Quoted 4 lines · Sam Shih

This patch add mmc and sd support for Mediatek MT7622 SoCs

Applied to u-boot/master, 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/20200116/e48123db/attachment.sig>
author
#15 lore raw

PATCH RESEND v2 8/10 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        | 180 +++++++++++++++++++++++++++++
 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       |  55 +++++++++
 include/configs/mt7622.h           |  46 ++++++++
 8 files changed, 332 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 +180 -0

180 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 +55 -0

55 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
#16 lore raw

PATCH RESEND v2 8/10 Add support for MT7622 reference board

Quoted 6 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.

Applied to u-boot/master, 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/20200116/7771387a/attachment.sig>
author
#17 lore raw

PATCH RESEND v2 9/10 arm: dts: mediatek: move u-boot properties to -u-boot.dtsi file

In reply to Sam Shih

This patch move u-boot properties to -u-boot.dtsi file.

---
 arch/arm/dts/mt7623-u-boot.dtsi          | 29 +++++++++++++++++++
 arch/arm/dts/mt7623.dtsi                 |  6 ----
 arch/arm/dts/mt7623n-bananapi-bpi-r2.dts |  1 +
 arch/arm/dts/mt7629-rfb-u-boot.dtsi      | 36 ++++++++++++++++++++++++
 arch/arm/dts/mt7629-rfb.dts              |  1 +
 arch/arm/dts/mt7629.dtsi                 |  9 ------
 6 files changed, 67 insertions(+), 15 deletions(-)
 create mode 100644 arch/arm/dts/mt7623-u-boot.dtsi
arch/arm/dts/mt7623-u-boot.dtsi new file +29 -0
new file mode 100644
index 0000000000..832c16dca8
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ * Author: Sam Shih <[email protected]>
+ */
+
+&topckgen {
+	u-boot,dm-pre-reloc;
+};
+
+&topckgen {
+	u-boot,dm-pre-reloc;
+};
+
+&pericfg {
+	u-boot,dm-pre-reloc;
+};
+
+&timer0 {
+	u-boot,dm-pre-reloc;
+};
+
+&apmixedsys {
+	u-boot,dm-pre-reloc;
+};
+
+&uart2 {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/mt7623.dtsi +0 -6
index 1135b1e1ae..1f45dea575 100644
@@ -101,21 +101,18 @@
 		compatible = "mediatek,mt7623-topckgen";
 		reg = <0x10000000 0x1000>;
 		#clock-cells = <1>;
-		u-boot,dm-pre-reloc;
 	};
 
 	infracfg: syscon at 10001000 {
 		compatible = "mediatek,mt7623-infracfg", "syscon";
 		reg = <0x10001000 0x1000>;
 		#clock-cells = <1>;
-		u-boot,dm-pre-reloc;
 	};
 
 	pericfg: syscon at 10003000 {
 		compatible = "mediatek,mt7623-pericfg", "syscon";
 		reg = <0x10003000 0x1000>;
 		#clock-cells = <1>;
-		u-boot,dm-pre-reloc;
 	};
 
 	pinctrl: pinctrl at 10005000 {
@@ -155,7 +152,6 @@
 		interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_LOW>;
 		clocks = <&system_clk>;
 		clock-names = "system-clk";
-		u-boot,dm-pre-reloc;
 	};
 
 	sysirq: interrupt-controller at 10200100 {
@@ -170,7 +166,6 @@
 		compatible = "mediatek,mt7623-apmixedsys";
 		reg = <0x10209000 0x1000>;
 		#clock-cells = <1>;
-		u-boot,dm-pre-reloc;
 	};
 
 	gic: interrupt-controller at 10211000 {
@@ -215,7 +210,6 @@
 			 <&pericfg CLK_PERI_UART2>;
 		clock-names = "baud", "bus";
 		status = "disabled";
-		u-boot,dm-pre-reloc;
 	};
 
 	uart3: serial at 11005000 {
arch/arm/dts/mt7623n-bananapi-bpi-r2.dts +1 -0
index b0c86219b6..bcedcf20f1 100644
@@ -7,6 +7,7 @@
 
 /dts-v1/;
 #include "mt7623.dtsi"
+#include "mt7623-u-boot.dtsi"
 
 / {
 	model = "Bananapi BPI-R2";
arch/arm/dts/mt7629-rfb-u-boot.dtsi +36 -0
index 1ef5568518..164afd633b 100644
@@ -22,3 +22,39 @@
 #endif
 	};
 };
+
+&infracfg {
+	u-boot,dm-pre-reloc;
+};
+
+&pericfg {
+	u-boot,dm-pre-reloc;
+};
+
+&timer0 {
+	u-boot,dm-pre-reloc;
+};
+
+&mcucfg {
+	u-boot,dm-pre-reloc;
+};
+
+&dramc {
+	u-boot,dm-pre-reloc;
+};
+
+&apmixedsys {
+	u-boot,dm-pre-reloc;
+};
+
+&topckgen {
+	u-boot,dm-pre-reloc;
+};
+
+&uart0 {
+	u-boot,dm-pre-reloc;
+};
+
+&snfi {
+	u-boot,dm-pre-reloc;
+};
arch/arm/dts/mt7629-rfb.dts +1 -0
index 0981f9b3b1..687fe1c029 100644
@@ -7,6 +7,7 @@
 
 /dts-v1/;
 #include "mt7629.dtsi"
+#include "mt7629-rfb-u-boot.dtsi"
 
 / {
 	model = "MediaTek MT7629 RFB";
arch/arm/dts/mt7629.dtsi +0 -9
index b0c843bafd..a33a74a556 100644
@@ -68,14 +68,12 @@
 		compatible = "mediatek,mt7629-infracfg", "syscon";
 		reg = <0x10000000 0x1000>;
 		#clock-cells = <1>;
-		u-boot,dm-pre-reloc;
 	};
 
 	pericfg: syscon at 10002000 {
 		compatible = "mediatek,mt7629-pericfg", "syscon";
 		reg = <0x10002000 0x1000>;
 		#clock-cells = <1>;
-		u-boot,dm-pre-reloc;
 	};
 
 	timer0: timer at 10004000 {
@@ -85,7 +83,6 @@
 		clocks = <&topckgen CLK_TOP_CLKXTAL_D4>,
 			 <&topckgen CLK_TOP_10M_SEL>;
 		clock-names = "mux", "src";
-		u-boot,dm-pre-reloc;
 	};
 
 	scpsys: scpsys at 10006000 {
@@ -103,7 +100,6 @@
 		compatible = "mediatek,mt7629-mcucfg", "syscon";
 		reg = <0x10200000 0x1000>;
 		#clock-cells = <1>;
-		u-boot,dm-pre-reloc;
 	};
 
 	sysirq: interrupt-controller at 10200a80 {
@@ -124,21 +120,18 @@
 			 <&topckgen CLK_TOP_MEM_SEL>,
 			 <&topckgen CLK_TOP_DMPLL>;
 		clock-names = "phy", "phy_mux", "mem", "mem_mux";
-		u-boot,dm-pre-reloc;
 	};
 
 	apmixedsys: clock-controller at 10209000 {
 		compatible = "mediatek,mt7629-apmixedsys";
 		reg = <0x10209000 0x1000>;
 		#clock-cells = <1>;
-		u-boot,dm-pre-reloc;
 	};
 
 	topckgen: clock-controller at 10210000 {
 		compatible = "mediatek,mt7629-topckgen";
 		reg = <0x10210000 0x1000>;
 		#clock-cells = <1>;
-		u-boot,dm-pre-reloc;
 	};
 
 	watchdog: watchdog at 10212000 {
@@ -186,7 +179,6 @@
 		status = "disabled";
 		assigned-clocks = <&topckgen CLK_TOP_AXI_SEL>;
 		assigned-clock-parents = <&topckgen CLK_TOP_SYSPLL1_D2>;
-		u-boot,dm-pre-reloc;
 	};
 
 	uart1: serial at 11003000 {
@@ -228,7 +220,6 @@
 		status = "disabled";
 		#address-cells = <1>;
 		#size-cells = <0>;
-		u-boot,dm-pre-reloc;
 	};
 
 	ethsys: syscon at 1b000000 {
Signature · 1 line
2.17.1
#18 lore raw

PATCH RESEND v2 9/10 arm: dts: mediatek: move u-boot properties to -u-boot.dtsi file

Quoted 4 lines · Sam Shih

This patch move u-boot properties to -u-boot.dtsi file.

Applied to u-boot/master, 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/20200116/608f7bfd/attachment.sig>
author
#19 lore raw

PATCH RESEND v2 10/10 configs: mediatek: fix mt7623n bpir2 defconfig

In reply to Sam Shih

This patch add CONFIG_TARGET_MT7623 into mt7623n_bpir2_defconfig to fix the mt7623 compile error after building others mediatek target platform

---
 configs/mt7623n_bpir2_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/mt7623n_bpir2_defconfig +1 -0
index 58e93d5da6..d6ccae1942 100644
@@ -1,6 +1,7 @@
 CONFIG_ARM=y
 CONFIG_SYS_THUMB_BUILD=y
 CONFIG_ARCH_MEDIATEK=y
+CONFIG_TARGET_MT7623=y
 CONFIG_SYS_TEXT_BASE=0x81e00000
 CONFIG_SYS_MALLOC_F_LEN=0x4000
 CONFIG_ENV_SIZE=0x1000
Signature · 1 line
2.17.1
#20 lore raw

PATCH RESEND v2 10/10 configs: mediatek: fix mt7623n bpir2 defconfig

Quoted 6 lines · Sam Shih

This patch add CONFIG_TARGET_MT7623 into mt7623n_bpir2_defconfig to fix the mt7623 compile error after building others mediatek target platform

Applied to u-boot/master, 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/20200116/6b352451/attachment.sig>