Skip to contentSkip to conversation

clk: mediatek: mt7986: drop duplicate dt-bindings header

PATCH Applied Lucien.Jheng 2 participants 4 messages Oct 12 – Nov 9

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clk: mediatek: mt7986: drop duplicate dt-bindings header

From: "Lucien Jheng" <[email protected]>

include/dt-bindings/clock/mt7986-clk.h duplicates the binding header that is already provided by dts/upstream/include/. Since the U-Boot include/ directory precedes dts/upstream/include/ in UBOOTINCLUDE, the local copy shadows the upstream one regardless of CONFIG_OF_UPSTREAM.

Remove the local copy so that the upstream header is used. The only symbols used by the clock driver that differ from upstream are:

- CLK_TOP_MMPLL_U2PHYD is named CLK_TOP_MMPLL_U2PHY upstream, with the same value (14).
- CLK_APMIXED_NR_CLK is a sentinel not defined upstream. Use ARRAY_SIZE(fixed_pll_clks) instead, which is also 8, following the ARRAY_SIZE() pattern used by clk-mt7987.c and clk-mt7988.c.

No functional change.

---

Notes:
Tested on a Banana Pi R3 Mini (eMMC) using the downstream devicetree arch/arm/dts/mt7986a-bpi-r3-mini-emmc.dts from Frank Wunderlich's U-Boot tree, together with the upstream header dts/upstream/include/dt-bindings/clock/mt7986-clk.h. U-Boot boots normally and TFTP transfers work.

checkpatch warns that DT binding headers should be a separate patch. That rule targets the Linux binding workflow; here the header is only a stale local copy of the one in dts/upstream/. Removing it and updating its users in clk-mt7986.c must happen together, otherwise the tree does not build in between, so this is kept as a single patch.

UBoot init log with upstream dt-bidings header:
U-Boot 2026.07--gedb017c49881-dirty (Oct 13 2026 - 00:14:37 +0800)

CPU:   MediaTek MT7986
Model: Bananapi BPi-R3 Mini
DRAM:  2 GiB
Core:  46 devices, 22 uclasses, devicetree: separate
MMC:   mmc@11230000: 0
Loading Environment from MMC... Reading from MMC(0)... OK
In:    serial@11002000
Out:   serial@11002000
Err:   serial@11002000

Net:
16384 bytes read in 2 ms (7.8 MiB/s)
131072 bytes read in 9 ms (13.9 MiB/s)
mtk-eth ethernet@15100000: MD32 firmware version: 24112802
eth0: ethernet@15100000
Hit any key to stop autoboot: 0

 drivers/clk/mediatek/clk-mt7986.c      |   6 +-
 include/dt-bindings/clock/mt7986-clk.h | 178 -------------------------
 2 files changed, 3 insertions(+), 181 deletions(-)
 delete mode 100644 include/dt-bindings/clock/mt7986-clk.h
drivers/clk/mediatek/clk-mt7986.c +3 -3
index e4abddbd515..862e0ce912f 100644
@@ -78,7 +78,7 @@ static const struct mtk_fixed_factor top_fixed_divs[] = {
 	PLL_FACTOR(CLK_TOP_MMPLL_D8, "mmpll_d8", CLK_APMIXED_MMPLL, 1, 8),
 	PLL_FACTOR(CLK_TOP_MMPLL_D8_D2, "mmpll_d8_d2", CLK_APMIXED_MMPLL, 1, 16),
 	PLL_FACTOR(CLK_TOP_MMPLL_D3_D8, "mmpll_d3_d8", CLK_APMIXED_MMPLL, 1, 8),
-	PLL_FACTOR(CLK_TOP_MMPLL_U2PHYD, "mmpll_u2phy", CLK_APMIXED_MMPLL, 1, 30),
+	PLL_FACTOR(CLK_TOP_MMPLL_U2PHY, "mmpll_u2phy", CLK_APMIXED_MMPLL, 1, 30),
 	/* APLL2 */
 	PLL_FACTOR(CLK_TOP_APLL2_D4, "apll2_d4", CLK_APMIXED_APLL2, 1, 4),
 	/* NET1PLL */
@@ -227,7 +227,7 @@ static const struct mtk_parent u2u3_sys_parents[] = {
 };
 
 static const struct mtk_parent da_u2_refsel_parents[] = {
-	TOP_PARENT(CLK_TOP_XTAL), TOP_PARENT(CLK_TOP_MMPLL_U2PHYD),
+	TOP_PARENT(CLK_TOP_XTAL), TOP_PARENT(CLK_TOP_MMPLL_U2PHY),
 };
 
 #define TOP_MUX(_id, _name, _parents, _mux_ofs, _mux_set_ofs, _mux_clr_ofs,    \
@@ -526,7 +526,7 @@ static const struct mtk_gate infracfg_gates[] = {
 static const struct mtk_clk_tree mt7986_fixed_pll_clk_tree = {
 	.ext_clk_rates = ext_clock_rates,
 	.num_ext_clks = ARRAY_SIZE(ext_clock_rates),
-	.fdivs_offs = CLK_APMIXED_NR_CLK,
+	.fdivs_offs = ARRAY_SIZE(fixed_pll_clks),
 	.fclks = fixed_pll_clks,
 	.num_fclks = ARRAY_SIZE(fixed_pll_clks),
 	.flags = CLK_PARENT_APMIXED,
include/dt-bindings/clock/mt7986-clk.h deleted +0 -178

178 lines not on this page · raw message

--
2.34.1

#1 lore raw
Quoted 7 lines · Lucien.Jheng

From: "Lucien Jheng" <[email protected]>

include/dt-bindings/clock/mt7986-clk.h duplicates the binding header that is already provided by dts/upstream/include/. Since the U-Boot include/ directory precedes dts/upstream/include/ in UBOOTINCLUDE, the local copy shadows the upstream one regardless of CONFIG_OF_UPSTREAM.

Nice cleanup, thanks.

drivers/clk/mediatek/clk-mt7986.c static const struct mtk_gate infracfg_gates[] = { · line 529

Quoted 6 lines
drivers/clk/mediatek/clk-mt7986.c +1 -1
@@ -526,7 +526,7 @@ static const struct mtk_gate infracfg_gates[] = {
 static const struct mtk_clk_tree mt7986_fixed_pll_clk_tree = {
 	.ext_clk_rates = ext_clock_rates,
 	.num_ext_clks = ARRAY_SIZE(ext_clock_rates),
-	.fdivs_offs = CLK_APMIXED_NR_CLK,
+	.fdivs_offs = ARRAY_SIZE(fixed_pll_clks),

I noticed this is actually no longer needed and we have the same thing in a couple of other files. So I sent out [1] to take care of that. So I will apply 1 first and then this patch so that this line change goes away (after the customary 2 week review period).

[1]: https://lore.kernel.org/u-boot/20261012-clk-mediatek-apmixed-fdivs-offs-v1-1-f366cc5dd0d7@baylibre.com/

Quoted 3 lines
drivers/clk/mediatek/clk-mt7986.c +0 -0
 	.fclks = fixed_pll_clks,
 	.num_fclks = ARRAY_SIZE(fixed_pll_clks),
 	.flags = CLK_PARENT_APMIXED,
#2 lore raw

Hi David

David Lechner 於 2026/10/13 上午 05:20 寫道:

Quoted 10 lines · Lucien.Jheng
Quoted 7 lines

From: "Lucien Jheng" <[email protected]>

include/dt-bindings/clock/mt7986-clk.h duplicates the binding header that is already provided by dts/upstream/include/. Since the U-Boot include/ directory precedes dts/upstream/include/ in UBOOTINCLUDE, the local copy shadows the upstream one regardless of CONFIG_OF_UPSTREAM.

Nice cleanup, thanks.

Quoted 10 lines

drivers/clk/mediatek/clk-mt7986.c static const struct mtk_gate infracfg_gates[] = { · line 529

Quoted 6 lines
drivers/clk/mediatek/clk-mt7986.c +1 -1
@@ -526,7 +526,7 @@ static const struct mtk_gate infracfg_gates[] = {
  static const struct mtk_clk_tree mt7986_fixed_pll_clk_tree = {
  	.ext_clk_rates = ext_clock_rates,
  	.num_ext_clks = ARRAY_SIZE(ext_clock_rates),
-	.fdivs_offs = CLK_APMIXED_NR_CLK,
+	.fdivs_offs = ARRAY_SIZE(fixed_pll_clks),

I noticed this is actually no longer needed and we have the same thing in a couple of other files. So I sent out [1] to take care of that. So I will apply 1 first and then this patch so that this line change goes away (after the customary 2 week review period).

I'll update the patch once your commit is merged into U-Boot.

Thanks

Quoted 6 lines

[1]: https://lore.kernel.org/u-boot/20261012-clk-mediatek-apmixed-fdivs-offs-v1-1-f366cc5dd0d7@baylibre.com/

Quoted 3 lines
drivers/clk/mediatek/clk-mt7986.c +0 -0
  	.fclks = fixed_pll_clks,
  	.num_fclks = ARRAY_SIZE(fixed_pll_clks),
  	.flags = CLK_PARENT_APMIXED,
#3 lore raw
In reply to Lucien.Jheng
Quoted 1 line · Lucien.Jheng

clk: mediatek: mt7986: drop duplicate dt-bindings header

Applied to mediatek-for-next, thanks!

[1/1] clk: mediatek: mt7986: drop duplicate dt-bindings header

      commit: 1d7b1f28d30b7059aaf0e473e179cbc8e7718efe

Best regards,

Signature · 1 line
David Lechner <[email protected]>