Add support for MT8516 SoC
Subsystems (8)
v3 cover Add support for MT8516 SoC
This patch series adds basic boot support on eMMC for the MediaTek MT8516 SoC based boards. This series adds the clock, pinctrl drivers and the SoC initialization code.
Fabien Parent (7):
mmc: mtk-sd: add source_cg clock support
mmc: mtk-sd: add support for MT8516
mmc: mtk-sd: fix configuration option check
clk: mediatek: add support for SETCLR_INV and NO_SETCLR flags
clk: mediatek: add driver for MT8516
pinctrl: add driver for MT8516
ARM: MediaTek: Add support for MT8516 SoC
arch/arm/dts/mt8516-u-boot.dtsi | 25 + arch/arm/dts/mt8516.dtsi | 136 +++++ arch/arm/mach-mediatek/Kconfig | 10 + arch/arm/mach-mediatek/Makefile | 1 + arch/arm/mach-mediatek/mt8516/Makefile | 3 + arch/arm/mach-mediatek/mt8516/init.c | 120 ++++ drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8516.c | 701 ++++++++++++++++++++++ drivers/clk/mediatek/clk-mtk.c | 12 + drivers/mmc/mtk-sd.c | 23 +- drivers/pinctrl/mediatek/Kconfig | 4 + drivers/pinctrl/mediatek/Makefile | 1 + drivers/pinctrl/mediatek/pinctrl-mt8516.c | 391 ++++++++++++ include/dt-bindings/clock/mt8516-clk.h | 230 +++++++ 14 files changed, 1654 insertions(+), 4 deletions(-) create mode 100644 arch/arm/dts/mt8516-u-boot.dtsi create mode 100644 arch/arm/dts/mt8516.dtsi create mode 100644 arch/arm/mach-mediatek/mt8516/Makefile create mode 100644 arch/arm/mach-mediatek/mt8516/init.c create mode 100644 drivers/clk/mediatek/clk-mt8516.c create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8516.c create mode 100644 include/dt-bindings/clock/mt8516-clk.h
Signature · 1 line
2.20.1
PATCH v3 1/7 mmc: mtk-sd: add source_cg clock support
Some MediaTek SoC need an additional clock "source_cg". Enable this new clock. We reuse the same clock name as in the kernel.
---
v3:
* No change
v2:
* Get rid of variable has_src_clk_cg
--- drivers/mmc/mtk-sd.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mmc/mtk-sd.c +5 -0
@@ -247,6 +247,7 @@ struct msdc_host {struct msdc_compatible *dev_comp;struct clk src_clk;/* for SD/MMC bus clock */ +struct clk src_clk_cg;/* optional, MSDC source clock control gate */ struct clk h_clk;/* MSDC core clock */ u32 src_clk_freq;/* source clock */
@@ -1269,6 +1270,8 @@ static void msdc_ungate_clock(struct msdc_host *host) {clk_enable (&host->src_clk);clk_enable (&host->h_clk); +if (host->src_clk_cg.dev) +clk_enable (&host->src_clk_cg); }static int msdc_drv_probe (struct udevice *dev)
@@ -1332,6 +1335,8 @@ static int msdc_ofdata_to_platdata(struct udevice *dev)if (ret <0 )return ret; +clk_get_by_name (dev,"source_cg" , &host->src_clk_cg);/* optional */ +#if IS_ENABLED (DM_GPIO )gpio_request_by_name (dev,"wp-gpios" ,0 , &host->gpio_wp,GPIOD_IS_IN );gpio_request_by_name (dev,"cd-gpios" ,0 , &host->gpio_cd,GPIOD_IS_IN );
Signature · 1 line
2.20.1
PATCH v3 1/7 mmc: mtk-sd: add source_cg clock support
Quoted 5 lines · Fabien Parent
Some MediaTek SoC need an additional clock "
source_cg". Enable this new clock. We reuse the same clock name as in the kernel.Signed-off-by Fabien Parent <[email protected]>Acked-by Ryder Lee <[email protected]>
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: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/9ce57aa5/attachment.sig>
PATCH v3 2/7 mmc: mtk-sd: add support for MT8516
In reply to Fabien ParentAdd config for handling MT8516 SoC.
---
v3:
* No change
v2:
* No change
--- drivers/mmc/mtk-sd.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mmc/mtk-sd.c +10 -0
@@ -1381,8 +1381,18 @@ static const struct msdc_compatible mt7623_compat = { .enhance_rx = false }; +static const struct msdc_compatible mt8516_compat = { + .clk_div_bits =12 , + .pad_tune0 = true, + .async_fifo = true, + .data_tune = true, + .busy_check = true, + .stop_clk_fix = true, +}; +static const struct udevice_id msdc_ids[] = { { .compatible ="mediatek,mt7623-mmc" , .data = (ulong)&mt7623_compat }, + { .compatible ="mediatek,mt8516-mmc" , .data = (ulong)&mt8516_compat }, {} };
Signature · 1 line
2.20.1
PATCH v3 2/7 mmc: mtk-sd: add support for MT8516
Quoted 4 lines · Fabien Parent
Add config for handling MT8516 SoC.
Signed-off-by Fabien Parent <[email protected]>Acked-by Ryder Lee <[email protected]>
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: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/12f646fd/attachment.sig>
PATCH v3 3/7 mmc: mtk-sd: fix configuration option check
In reply to Fabien ParentWe either need to use IS_ENABLED(CONFIG_FOO) or CONFIG_IS_ENABLED(FOO). IS_ENABLE(FOO) will always return false.
This commit fixes the comparison by using the CONFIG_IS_ENABLED(FOO) syntax.
---
v3:
* New patch
--- drivers/mmc/mtk-sd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/mtk-sd.c +4 -4
@@ -270,7 +270,7 @@ struct msdc_host {bool builtin_cd;/* card detection / write protection GPIOs */ -#if IS_ENABLED (DM_GPIO ) +#if CONFIG_IS_ENABLED (DM_GPIO )struct gpio_desc gpio_wp;struct gpio_desc gpio_cd;#endif
@@ -850,7 +850,7 @@ static int msdc_ops_get_cd(struct udevice *dev)return !(val &MSDC_PS_CDSTS ); } -#if IS_ENABLED (DM_GPIO ) +#if CONFIG_IS_ENABLED (DM_GPIO )if (!host->gpio_cd.dev)return 1 ;
@@ -862,7 +862,7 @@ static int msdc_ops_get_cd(struct udevice *dev)static int msdc_ops_get_wp (struct udevice *dev) { -#if IS_ENABLED (DM_GPIO ) +#if CONFIG_IS_ENABLED (DM_GPIO )struct msdc_host *host =dev_get_priv (dev);if (!host->gpio_wp.dev)
@@ -1337,7 +1337,7 @@ static int msdc_ofdata_to_platdata(struct udevice *dev)clk_get_by_name (dev,"source_cg" , &host->src_clk_cg);/* optional */ -#if IS_ENABLED (DM_GPIO ) +#if CONFIG_IS_ENABLED (DM_GPIO )gpio_request_by_name (dev,"wp-gpios" ,0 , &host->gpio_wp,GPIOD_IS_IN );gpio_request_by_name (dev,"cd-gpios" ,0 , &host->gpio_cd,GPIOD_IS_IN );#endif
Signature · 1 line
2.20.1
PATCH v3 3/7 mmc: mtk-sd: fix configuration option check
Quoted 7 lines · Fabien Parent
We either need to use
IS_ENABLED(CONFIG_FOO)orCONFIG_IS_ENABLED(FOO).IS_ENABLE(FOO)will always return false.This commit fixes the comparison by using the
CONFIG_IS_ENABLED(FOO)syntax.Signed-off-by Fabien Parent <[email protected]>
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: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/2ca55f2c/attachment.sig>
PATCH v3 4/7 clk: mediatek: add support for SETCLR_INV and NO_SETCLR flags
In reply to Fabien ParentAdd the implementation for the CLK_GATE_SETCLR_INV and CLK_GATE_NO_SETCLR flags.
---
v3:
* No changes
--- drivers/clk/mediatek/clk-mtk.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/clk/mediatek/clk-mtk.c +12 -0
@@ -390,6 +390,12 @@ static int mtk_clk_gate_enable(struct clk *clk)case CLK_GATE_SETCLR :writel (bit, priv->base + gate->regs->clr_ofs);break ; +case CLK_GATE_SETCLR_INV : +writel (bit, priv->base + gate->regs->set_ofs); +break ; +case CLK_GATE_NO_SETCLR : +clrsetbits_le32 (priv->base + gate->regs->sta_ofs, bit,0 ); +break ;case CLK_GATE_NO_SETCLR_INV :clrsetbits_le32 (priv->base + gate->regs->sta_ofs, bit, bit);break ;
@@ -411,6 +417,12 @@ static int mtk_clk_gate_disable(struct clk *clk)case CLK_GATE_SETCLR :writel (bit, priv->base + gate->regs->set_ofs);break ; +case CLK_GATE_SETCLR_INV : +writel (bit, priv->base + gate->regs->clr_ofs); +break ; +case CLK_GATE_NO_SETCLR : +clrsetbits_le32 (priv->base + gate->regs->sta_ofs, bit, bit); +break ;case CLK_GATE_NO_SETCLR_INV :clrsetbits_le32 (priv->base + gate->regs->sta_ofs, bit,0 );break ;
Signature · 1 line
2.20.1
PATCH v3 4/7 clk: mediatek: add support for SETCLR_INV and NO_SETCLR flags
Quoted 5 lines · Fabien Parent
Add the implementation for the
CLK_GATE_SETCLR_INVandCLK_GATE_NO_SETCLRflags.Signed-off-by Fabien Parent <[email protected]>Acked-by Ryder Lee <[email protected]>
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: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/724cf185/attachment.sig>
PATCH v3 5/7 clk: mediatek: add driver for MT8516
In reply to Fabien ParentAdd clock driver for MediaTek MT8516 SoC.
---
v3:
* Remove invalid clocks
v2:
* Fix invalid GATE_TOP5 flag
--- drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8516.c | 802 +++++++++++++++++++++++++ include/dt-bindings/clock/mt8516-clk.h | 251 ++++++++ 3 files changed, 1054 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8516.c create mode 100644 include/dt-bindings/clock/mt8516-clk.h
drivers/clk/mediatek/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_ARCH_MEDIATEK) += clk-mtk.o # SoC Drivers obj-$(CONFIG_TARGET_MT7623) += clk-mt7623.o obj-$(CONFIG_TARGET_MT7629) += clk-mt7629.o +obj-$(CONFIG_TARGET_MT8516) += clk-mt8516.o
drivers/clk/mediatek/clk-mt8516.c new file +802 -0
802 lines not on this page · raw message
include/dt-bindings/clock/mt8516-clk.h new file +251 -0
251 lines not on this page · raw message
--- drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8516.c | 802 +++++++++++++++++++++++++ include/dt-bindings/clock/mt8516-clk.h | 251 ++++++++ 3 files changed, 1054 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8516.c create mode 100644 include/dt-bindings/clock/mt8516-clk.h
drivers/clk/mediatek/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_ARCH_MEDIATEK) += clk-mtk.o # SoC Drivers obj-$(CONFIG_TARGET_MT7623) += clk-mt7623.o obj-$(CONFIG_TARGET_MT7629) += clk-mt7629.o +obj-$(CONFIG_TARGET_MT8516) += clk-mt8516.o
drivers/clk/mediatek/clk-mt8516.c new file +802 -0
802 lines not on this page · raw message
include/dt-bindings/clock/mt8516-clk.h new file +251 -0
251 lines not on this page · raw message
--- drivers/clk/mediatek/Makefile | 1 + drivers/clk/mediatek/clk-mt8516.c | 701 +++++++++++++++++++++++++ include/dt-bindings/clock/mt8516-clk.h | 230 ++++++++ 3 files changed, 932 insertions(+) create mode 100644 drivers/clk/mediatek/clk-mt8516.c create mode 100644 include/dt-bindings/clock/mt8516-clk.h
drivers/clk/mediatek/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_ARCH_MEDIATEK) += clk-mtk.o # SoC Drivers obj-$(CONFIG_TARGET_MT7623) += clk-mt7623.o obj-$(CONFIG_TARGET_MT7629) += clk-mt7629.o +obj-$(CONFIG_TARGET_MT8516) += clk-mt8516.o
drivers/clk/mediatek/clk-mt8516.c new file +701 -0
701 lines not on this page · raw message
include/dt-bindings/clock/mt8516-clk.h new file +230 -0
181 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.20.1
Part of the diff is not shown here. View the raw message.
PATCH v3 5/7 clk: mediatek: add driver for MT8516
Quoted 4 lines · Fabien Parent
Add clock driver for MediaTek MT8516 SoC.
Signed-off-by Fabien Parent <[email protected]>Acked-by Ryder Lee <[email protected]>
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: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/930c6af8/attachment.sig>
PATCH v3 6/7 pinctrl: add driver for MT8516
In reply to Fabien ParentAdd Pinctrl driver for MediaTek MT8516 SoC.
---
v3:
* Fix incorrect field size for mt8516_pin_mode_range
v2:
* No change
--- drivers/pinctrl/mediatek/Kconfig | 4 + drivers/pinctrl/mediatek/Makefile | 1 + drivers/pinctrl/mediatek/pinctrl-mt8516.c | 391 ++++++++++++++++++++++ 3 files changed, 396 insertions(+) create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8516.c
drivers/pinctrl/mediatek/Kconfig +4 -0
@@ -12,4 +12,8 @@ config PINCTRL_MT7629 bool "MT7629 SoC pinctrl driver" select PINCTRL_MTK +config PINCTRL_MT8516 + bool "MT8516 SoC pinctrl driver" + select PINCTRL_MTK + endif
drivers/pinctrl/mediatek/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-$(CONFIG_PINCTRL_MTK) += pinctrl-mtk-common.o # SoC Drivers 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-mt8516.c new file +391 -0
391 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v3 6/7 pinctrl: add driver for MT8516
Quoted 4 lines · Fabien Parent
Add Pinctrl driver for MediaTek MT8516 SoC.
Signed-off-by Fabien Parent <[email protected]>Acked-by Ryder Lee <[email protected]>
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: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/76407099/attachment.sig>
PATCH v3 7/7 ARM: MediaTek: Add support for MT8516 SoC
In reply to Fabien ParentAdd support for MediaTek MT8516 SoC. This include the file that will initialize the SoC after boot and its device tree.
---
v3:
* No change
v2:
* Move u-boot,dm-pre-reloc into a seperate dts
* Implement dram_init_banksize to get DRAM size correct
--- arch/arm/dts/mt8516-u-boot.dtsi | 25 +++++ arch/arm/dts/mt8516.dtsi | 136 +++++++++++++++++++++++++ arch/arm/mach-mediatek/Kconfig | 10 ++ arch/arm/mach-mediatek/Makefile | 1 + arch/arm/mach-mediatek/mt8516/Makefile | 3 + arch/arm/mach-mediatek/mt8516/init.c | 120 ++++++++++++++++++++++ 6 files changed, 295 insertions(+) create mode 100644 arch/arm/dts/mt8516-u-boot.dtsi create mode 100644 arch/arm/dts/mt8516.dtsi create mode 100644 arch/arm/mach-mediatek/mt8516/Makefile create mode 100644 arch/arm/mach-mediatek/mt8516/init.c
arch/arm/dts/mt8516-u-boot.dtsi new file +25 -0
@@ -0,0 +1,25 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright (C) 2019 BayLibre, SAS + * Author: Fabien Parent <[email protected]> + */ + +&infracfg { + u-boot,dm-pre-reloc; +}; + +&topckgen_ { + u-boot,dm-pre-reloc; +}; + +&topckgen_cg { + u-boot,dm-pre-reloc; +}; + +&apmixedsys { + u-boot,dm-pre-reloc; +}; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/mt8516.dtsi new file +136 -0
136 lines not on this page · raw message
arch/arm/mach-mediatek/Kconfig +10 -0
@@ -31,6 +31,16 @@ config TARGET_MT7629 including DDR3, crypto engine, 3x3 11n/ac Wi-Fi, Gigabit Ethernet, switch, USB3.0, PCIe, UART, SPI, I2C and PWM. +config TARGET_MT8516 + bool "MediaTek MT8516 SoC" + select ARM64 + select ARCH_MISC_INIT + help + The MediaTek MT8516 is a ARM64-based SoC with a quad-core Cortex-A35. + 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
@@ -5,3 +5,4 @@ obj-$(CONFIG_SPL_BUILD) += spl.o obj-$(CONFIG_TARGET_MT7623) += mt7623/ obj-$(CONFIG_TARGET_MT7629) += mt7629/ +obj-$(CONFIG_TARGET_MT8516) += mt8516/
arch/arm/mach-mediatek/mt8516/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += init.o
arch/arm/mach-mediatek/mt8516/init.c new file +120 -0
120 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH v3 7/7 ARM: MediaTek: Add support for MT8516 SoC
Quoted 5 lines · Fabien Parent
Add support for MediaTek MT8516 SoC. This include the file that will initialize the SoC after boot and its device tree.
Signed-off-by Fabien Parent <[email protected]>Reviewed-by Tom Rini <[email protected]>
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: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190424/e51dc1c2/attachment.sig>