Skip to contentSkip to conversation

MediaTek MT7629 OF_UPSTREAM migration (v2)

PATCH In review Weijie Gao 2 participants 4 messages Jan 14, 2025 – Jan 21, 2025

Subsystems (4)
lore
Share & tools
lore

Weijie Gao

author
#0 lore raw

v2 cover MediaTek MT7629 OF_UPSTREAM migration (v2)

This patch series migrates MediaTek MT7629 to OF_UPSTREAM

Changes in v2:
* Remove mt7629-rfb.dtb from arch/arm/dts/Makefile
* Add wdt-reboot node to make reset command work

Sam Shih (2):
clk: mediatek: mt7629: fix gate offset of peri clock tree
board: mediatek: mt7629: Migrate to OF_UPSTREAM

 arch/arm/dts/Makefile                  |   1 -
 arch/arm/dts/mt7629-rfb-u-boot.dtsi    | 119 +++++++-
 arch/arm/dts/mt7629-rfb.dts            | 123 ---------
 arch/arm/dts/mt7629.dtsi               | 360 -------------------------
 configs/mt7629_rfb_defconfig           |   3 +-
 drivers/clk/mediatek/clk-mt7629.c      |  14 +-
 include/dt-bindings/clock/mt7629-clk.h | 206 --------------
 7 files changed, 133 insertions(+), 693 deletions(-)
 delete mode 100644 arch/arm/dts/mt7629-rfb.dts
 delete mode 100644 arch/arm/dts/mt7629.dtsi
 delete mode 100644 include/dt-bindings/clock/mt7629-clk.h
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v2 1/2 clk: mediatek: mt7629: fix gate offset of peri clock tree

From: Sam Shih <[email protected]>

The clock definitions in mt7629-clk.h indicate that CLK_PERIBUS_SEL is the first element in the pericfg clock tree and also serves as a clock mux, unlike other clocks belonging to the clock gate in pericfg.

This make the clock consumer get a wrong clock gate during request a clock from <&pericfg>.

Since CLK_PERIBUS_SEL clock is not required in U-Boot, add a clock gate offset for the pericfg clock tree to resolve this problem.

---
 drivers/clk/mediatek/clk-mt7629.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/clk/mediatek/clk-mt7629.c +13 -1
index 380ab9b9b0b..94fc5e51456 100644
@@ -574,6 +574,18 @@ static const struct mtk_clk_tree mt7629_clk_tree = {
 	.muxes = top_muxes,
 };
 
+static const struct mtk_clk_tree mt7629_peri_clk_tree = {
+	.xtal_rate = 40 * MHZ,
+	.xtal2_rate = 20 * MHZ,
+	.gates_offs = CLK_PERI_PWM1_PD,
+	.fdivs_offs = CLK_TOP_TO_USB3_SYS,
+	.muxes_offs = CLK_TOP_AXI_SEL,
+	.plls = apmixed_plls,
+	.fclks = top_fixed_clks,
+	.fdivs = top_fixed_divs,
+	.muxes = top_muxes,
+};
+
 static int mt7629_mcucfg_probe(struct udevice *dev)
 {
 	void __iomem *base;
@@ -619,7 +631,7 @@ static int mt7629_infracfg_probe(struct udevice *dev)
 
 static int mt7629_pericfg_probe(struct udevice *dev)
 {
-	return mtk_common_clk_gate_init(dev, &mt7629_clk_tree, peri_cgs);
+	return mtk_common_clk_gate_init(dev, &mt7629_peri_clk_tree, peri_cgs);
 }
 
 static int mt7629_ethsys_probe(struct udevice *dev)
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v2 2/2 board: mediatek: mt7629: Migrate to OF_UPSTREAM

In reply to Weijie Gao

From: Sam Shih <[email protected]>

Move differences in DT files between upstream Linux DT and U-Boot DT to mt7629-rfb-u-boot.dtsi.
Remove old copies of mt7629-related clock bindings, .dts, and .dtsi files. Update defconfig to switch the whole mt7629 SoC to use OF_UPSTREAM.

---
Changes in v2:
* Remove mt7629-rfb.dtb from arch/arm/dts/Makefile
* Add wdt-reboot node to make reset command work

---
 arch/arm/dts/Makefile                  |   1 -
 arch/arm/dts/mt7629-rfb-u-boot.dtsi    | 119 +++++++-
 arch/arm/dts/mt7629-rfb.dts            | 123 ---------
 arch/arm/dts/mt7629.dtsi               | 360 -------------------------
 configs/mt7629_rfb_defconfig           |   3 +-
 include/dt-bindings/clock/mt7629-clk.h | 206 --------------
 6 files changed, 120 insertions(+), 692 deletions(-)
 delete mode 100644 arch/arm/dts/mt7629-rfb.dts
 delete mode 100644 arch/arm/dts/mt7629.dtsi
 delete mode 100644 include/dt-bindings/clock/mt7629-clk.h
arch/arm/dts/Makefile +0 -1
index 23b537a2fcb..991ba55e9bd 100644
@@ -1190,7 +1190,6 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += \
 	mt7623a-unielec-u7623-02-emmc.dtb \
 	mt7622-bananapi-bpi-r64.dtb \
 	mt7623n-bananapi-bpi-r2.dtb \
-	mt7629-rfb.dtb \
 	mt7981-rfb.dtb \
 	mt7981-emmc-rfb.dtb \
 	mt7981-sd-rfb.dtb \
arch/arm/dts/mt7629-rfb-u-boot.dtsi +118 -1

132 lines not on this page · raw message

arch/arm/dts/mt7629-rfb.dts deleted +0 -123

123 lines not on this page · raw message

arch/arm/dts/mt7629.dtsi deleted +0 -360

360 lines not on this page · raw message

configs/mt7629_rfb_defconfig +2 -1
index abdf3d0cc49..4acf521e7fd 100644
@@ -9,7 +9,7 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x41fffef0
 CONFIG_ENV_SIZE=0x1000
-CONFIG_DEFAULT_DEVICE_TREE="mt7629-rfb"
+CONFIG_DEFAULT_DEVICE_TREE="mediatek/mt7629-rfb"
 CONFIG_TARGET_MT7629=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
@@ -52,6 +52,7 @@ CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_CMD_LOG=y
+CONFIG_OF_UPSTREAM=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-parents"
 CONFIG_ENV_OVERWRITE=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
include/dt-bindings/clock/mt7629-clk.h deleted +0 -206

206 lines not on this page · raw message

Signature · 1 line
2.34.1
#3 lore raw
In reply to Weijie Gao
Quoted 11 lines · Weijie Gao

This patch series migrates MediaTek MT7629 to OF_UPSTREAM

Changes in v2:
* Remove mt7629-rfb.dtb from arch/arm/dts/Makefile
* Add wdt-reboot node to make reset command work

Sam Shih (2):
clk: mediatek: mt7629: fix gate offset of peri clock tree
board: mediatek: mt7629: Migrate to OF_UPSTREAM

[...]

Applied to u-boot/master, thanks!

Signature · 1 line
Tom