Skip to contentSkip to conversation

riscv: dts: thead: Add Milk-V Meles support

PATCH Applied Han Gao 6 participants 12 messages Oct 1 – Nov 1

Subsystems (3)
lore
Share & tools
lore

Han Gao

author
#0 lore raw

v2 cover riscv: dts: thead: Add Milk-V Meles support

Milk-V Meles is a single-board computer powered by T-HEAD's TH1520 SoC with four C910 RISC-V cores. Add the board compatible and device tree for the Milk-V Meles.

Enable UART0, eMMC, microSD, Gigabit Ethernet and the PWM fan, and name the GPIO lines exposed on the 40-pin header. Add AP6256 Wi-Fi support over SDIO and enable HDMI output through the DC8200 display controller and DW-HDMI transmitter.

Board details:
https://milkv.io/docs/meles/overview

---
Changes in v2:
- Group BeagleV Ahead and Milk-V Meles compatibles in a common TH1520 enum, as requested by Krzysztof Kozlowski.
- Explicitly select the GPIO function for the Wi-Fi host-wake pin,
as reported by Sashiko and confirmed by Drew Fustini.
- Add Drew Fustini's Reviewed-by tags to patches 2-4.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Han Gao (4):
dt-bindings: riscv: thead: add Milk-V Meles
riscv: dts: thead: add Milk-V Meles
riscv: dts: thead: enable AP6256 Wi-Fi on Milk-V Meles
riscv: dts: thead: enable HDMI on Milk-V Meles

 Documentation/devicetree/bindings/riscv/thead.yaml |   6 +-
 arch/riscv/boot/dts/thead/Makefile                 |   1 +
 arch/riscv/boot/dts/thead/th1520-milkv-meles.dts   | 346 +++++++++++++++++++++
 3 files changed, 351 insertions(+), 2 deletions(-)

---
base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
change-id: 20260929-rv-meles-25d10148dc0c

Best regards,

Signature · 1 line
Han Gao <[email protected]>
author
#1 lore raw

PATCH v2 1/4 dt-bindings: riscv: thead: add Milk-V Meles

Document the Milk-V Meles board compatible with the TH1520 fallback.

---
 Documentation/devicetree/bindings/riscv/thead.yaml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/riscv/thead.yaml +4 -2
index 301912dcd290e60f816d380152591106de9415b4..e8170915f4d6d63fbc10a0e6863ea7d5000e3643 100644
@@ -17,9 +17,11 @@ properties:
     const: '/'
   compatible:
     oneOf:
-      - description: BeagleV Ahead single board computer
+      - description: TH1520 single board computers
         items:
-          - const: beagle,beaglev-ahead
+          - enum:
+              - beagle,beaglev-ahead
+              - milkv,meles
           - const: thead,th1520
       - description: Sipeed Lichee Pi 4A board for the Sipeed Lichee Module 4A
         items:
Signature · 1 line
2.47.3
maintainer Reviewed-by on v2 1/4
#3 lore raw

Re: [PATCH v2 1/4] dt-bindings: riscv: thead: add Milk-V Meles

In reply to Han Gao
Quoted 13 lines · Han Gao

Document the Milk-V Meles board compatible with the TH1520 fallback.

---
 Documentation/devicetree/bindings/riscv/thead.yaml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/riscv/thead.yaml +0 -0
index 301912dcd290e60f816d380152591106de9415b4..e8170915f4d6d63fbc10a0e6863ea7d5000e3643 100644
@@ -17,9 +17,11 @@ properties:
     const: '/'

Documentation/devicetree/bindings/riscv/thead.yaml properties: · line 25

Quoted 10 lines
Documentation/devicetree/bindings/riscv/thead.yaml +4 -2
   compatible:
     oneOf:
-      - description: BeagleV Ahead single board computer
+      - description: TH1520 single board computers
         items:
-          - const: beagle,beaglev-ahead
+          - enum:
+              - beagle,beaglev-ahead
+              - milkv,meles
           - const: thead,th1520

Thanks for making the change.

author
#4 lore raw

PATCH v2 2/4 riscv: dts: thead: add Milk-V Meles

In reply to Han Gao

Add the Milk-V Meles board with UART0, eMMC, SD, Ethernet and the PWM2 fan. Describe the board pin assignments and the PHY on the GMAC0 MDIO bus. Give GPIO banks aliases and name the exposed 40-pin header lines.

The eMMC I/O supply is fixed at 1.8 V. Enable DDR52 at that voltage and retain the 52 MHz board limit. Describe 8 GiB as the default memory size; firmware updates it to match the detected RAM capacity.

---
 arch/riscv/boot/dts/thead/Makefile               |   1 +
 arch/riscv/boot/dts/thead/th1520-milkv-meles.dts | 227 +++++++++++++++++++++++
 2 files changed, 228 insertions(+)
arch/riscv/boot/dts/thead/Makefile +1 -0
index b55a17127c2bc06cbfb06d5f7c92dc7296e98437..25f7fe068368c97df2490bedc3eae70276a2e442 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_THEAD) += th1520-lichee-pi-4a.dtb th1520-beaglev-ahead.dtb
+dtb-$(CONFIG_ARCH_THEAD) += th1520-milkv-meles.dtb
arch/riscv/boot/dts/thead/th1520-milkv-meles.dts new file +227 -0

227 lines not on this page · raw message

Signature · 1 line
2.47.3
#5 lore raw

Re: [PATCH v2 2/4] riscv: dts: thead: add Milk-V Meles

Quoted 34 lines · Han Gao

Add the Milk-V Meles board with UART0, eMMC, SD, Ethernet and the PWM2 fan. Describe the board pin assignments and the PHY on the GMAC0 MDIO bus. Give GPIO banks aliases and name the exposed 40-pin header lines.

The eMMC I/O supply is fixed at 1.8 V. Enable DDR52 at that voltage and retain the 52 MHz board limit. Describe 8 GiB as the default memory size; firmware updates it to match the detected RAM capacity.

---
 arch/riscv/boot/dts/thead/Makefile               |   1 +
 arch/riscv/boot/dts/thead/th1520-milkv-meles.dts | 227 +++++++++++++++++++++++
 2 files changed, 228 insertions(+)
arch/riscv/boot/dts/thead/Makefile +1 -0
index b55a17127c2bc06cbfb06d5f7c92dc7296e98437..25f7fe068368c97df2490bedc3eae70276a2e442 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_THEAD) += th1520-lichee-pi-4a.dtb th1520-beaglev-ahead.dtb
+dtb-$(CONFIG_ARCH_THEAD) += th1520-milkv-meles.dtb
arch/riscv/boot/dts/thead/th1520-milkv-meles.dts new file +5 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3714047190789bfccd8ff6810342d7ff865e74e4
@@ -0,0 +1,227 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021-2022 Alibaba Group Holding Limited.
+ * Copyright (C) 2026 Han Gao <[email protected]>
+ */

...

arch/riscv/boot/dts/thead/th1520-milkv-meles.dts line 63

Quoted 11 lines

+&emmc {

arch/riscv/boot/dts/thead/th1520-milkv-meles.dts new file +10 -0
+	bus-width = <8>;
+	max-frequency = <52000000>;
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+	non-removable;
+	no-sdio;
+	no-sd;
+
+	status = "okay";
+};

Could you please explain the 52MHz limitation? This doesn't match what I saw at RevyOS' downstream kernel, which seems the only distribution supported by Milk-V officially.

Regards,
Yao Zi

[1]: https://github.com/revyos/th1520-linux-kernel/blob/a092d55649279e1c9bcda2769b8f6b4370fa2c94/arch/riscv/boot/dts/thead/th1520-milkv-meles.dts#L1012-L1023

maintainer
#6 lore raw

Re: [PATCH v2 2/4] riscv: dts: thead: add Milk-V Meles

Quoted 54 lines · Yao Zi
Quoted 34 lines · Han Gao

Add the Milk-V Meles board with UART0, eMMC, SD, Ethernet and the PWM2 fan. Describe the board pin assignments and the PHY on the GMAC0 MDIO bus. Give GPIO banks aliases and name the exposed 40-pin header lines.

The eMMC I/O supply is fixed at 1.8 V. Enable DDR52 at that voltage and retain the 52 MHz board limit. Describe 8 GiB as the default memory size; firmware updates it to match the detected RAM capacity.

---
 arch/riscv/boot/dts/thead/Makefile               |   1 +
 arch/riscv/boot/dts/thead/th1520-milkv-meles.dts | 227 +++++++++++++++++++++++
 2 files changed, 228 insertions(+)
arch/riscv/boot/dts/thead/Makefile +1 -0
index b55a17127c2bc06cbfb06d5f7c92dc7296e98437..25f7fe068368c97df2490bedc3eae70276a2e442 100644
@@ -1,2 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_THEAD) += th1520-lichee-pi-4a.dtb th1520-beaglev-ahead.dtb
+dtb-$(CONFIG_ARCH_THEAD) += th1520-milkv-meles.dtb
arch/riscv/boot/dts/thead/th1520-milkv-meles.dts new file +5 -0
new file mode 100644
index 0000000000000000000000000000000000000000..3714047190789bfccd8ff6810342d7ff865e74e4
@@ -0,0 +1,227 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2021-2022 Alibaba Group Holding Limited.
+ * Copyright (C) 2026 Han Gao <[email protected]>
+ */

...

arch/riscv/boot/dts/thead/th1520-milkv-meles.dts line 63

Quoted 11 lines

+&emmc {

arch/riscv/boot/dts/thead/th1520-milkv-meles.dts new file +10 -0
+	bus-width = <8>;
+	max-frequency = <52000000>;
+	cap-mmc-highspeed;
+	mmc-ddr-1_8v;
+	non-removable;
+	no-sdio;
+	no-sd;
+
+	status = "okay";
+};

Could you please explain the 52MHz limitation? This doesn't match what I saw at RevyOS' downstream kernel, which seems the only distribution supported by Milk-V officially.

Quoted 4 lines

Regards,
Yao Zi

[1]: https://github.com/revyos/th1520-linux-kernel/blob/a092d55649279e1c9bcda2769b8f6b4370fa2c94/arch/riscv/boot/dts/thead/th1520-milkv-meles.dts#L1012-L1023

Sorry about not following up on this sooner.

Han Gao - could you explain what the motivation was for 52MHz?

Thanks,
Drew

author
#7 lore raw

PATCH v2 3/4 riscv: dts: thead: enable AP6256 Wi-Fi on Milk-V Meles

In reply to Han Gao

Connect AP6256 to SDIO1 with its fixed supplies and PMIC LPO clock. Use GPIO0_20 for WL_REG_ON and GPIO0_21 for the host-wake interrupt. Keep GPIO1_24 low to select the external antenna by default.

Use the existing BCM43456 binding and the 198 MHz board limit. Keep module power during suspend and assign mmc2 to SDIO1.

---
 arch/riscv/boot/dts/thead/th1520-milkv-meles.dts | 94 ++++++++++++++++++++++++
 1 file changed, 94 insertions(+)
arch/riscv/boot/dts/thead/th1520-milkv-meles.dts +94 -0
index 3714047190789bfccd8ff6810342d7ff865e74e4..bb1be377569063b0f6d6864c8d18d37103c2c7a6 100644
@@ -7,6 +7,7 @@
 /dts-v1/;
 
 #include "th1520.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 / {
 	model = "Milk-V Meles";
@@ -22,6 +23,7 @@ aliases {
 		gpio5 = &aogpio;
 		mmc0 = &emmc;
 		mmc1 = &sdio0;
+		mmc2 = &sdio1;
 		serial0 = &uart0;
 	};
 
@@ -29,6 +31,13 @@ chosen {
 		stdout-path = "serial0:115200n8";
 	};
 
+	wifi_32k: clock-wifi-32k {
+		compatible = "fixed-clock";
+		#clock-cells = <0>;
+		clock-frequency = <32768>;
+		/* The module LPO input is supplied by PMIC_32K_OUT. */
+	};
+
 	memory@0 {
 		device_type = "memory";
 		reg = <0x0 0x0 0x2 0x0>;
@@ -42,6 +51,30 @@ fan: pwm-fan {
 		cooling-levels = <0 64 192 255>;
 		#cooling-cells = <2>;
 	};
+
+	wifi_vbat: regulator-wifi-vbat {
+		compatible = "regulator-fixed";
+		regulator-name = "WIFI_3V3";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+	};
+
+	wifi_vddio: regulator-wifi-vddio {
+		compatible = "regulator-fixed";
+		regulator-name = "WIFI_VDDIO";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-always-on;
+	};
+
+	wifi_pwrseq: wifi-pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		pinctrl-names = "default";
+		pinctrl-0 = <&wifi_enable_pins>;
+		reset-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
+		post-power-on-delay-ms = <50>;
+	};
 };
 
 /* Names follow the 40-pin header signal labels. */
@@ -77,6 +110,16 @@ &gpio0 {
 			  "", "GPIO0_16", "GPIO0_17";
 };
 
+&gpio1 {
+	/* GPIO1_24 low selects the external antenna through U39. */
+	wifi-antenna-select-hog {
+		gpio-hog;
+		gpios = <24 GPIO_ACTIVE_HIGH>;
+		output-low;
+		line-name = "wifi-external-antenna";
+	};
+};
+
 &gpio2 {
 	gpio-line-names = "GPIO2_0", "GPIO2_1", "", "", "", "", "", "",
 			  "", "", "", "GPIO2_11", "GPIO2_12", "",
@@ -206,6 +249,27 @@ rx-pins {
 	};
 };
 
+&padctrl1_apsys {
+	wifi_enable_pins: wifi-enable-0 {
+		gpio-pins {
+			pins = "GPIO0_20";
+			bias-disable;
+			drive-strength = <7>;
+			input-disable;
+		};
+	};
+
+	wifi_host_wake_pins: wifi-host-wake-0 {
+		gpio-pins {
+			pins = "GPIO0_21";
+			function = "gpio";
+			bias-disable;
+			input-enable;
+			input-schmitt-enable;
+		};
+	};
+};
+
 &sdio0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&sdio0_pins>;
@@ -219,6 +283,36 @@ &sdio0 {
 	status = "okay";
 };
 
+&sdio1 {
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	cap-sd-highspeed;
+	cap-sdio-irq;
+	non-removable;
+	no-sd;
+	no-mmc;
+	keep-power-in-suspend;
+	vmmc-supply = <&wifi_vbat>;
+	vqmmc-supply = <&wifi_vddio>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	status = "okay";
+
+	wifi@1 {
+		compatible = "brcm,bcm43456-fmac", "brcm,bcm4329-fmac";
+		reg = <1>;
+		clocks = <&wifi_32k>;
+		clock-names = "lpo";
+		pinctrl-names = "default";
+		pinctrl-0 = <&wifi_host_wake_pins>;
+		interrupt-parent = <&gpio0>;
+		interrupts = <21 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-names = "host-wake";
+	};
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pins>;
Signature · 1 line
2.47.3
author
#8 lore raw

PATCH v2 4/4 riscv: dts: thead: enable HDMI on Milk-V Meles

In reply to Han Gao

Enable the DC8200 display controller and DW-HDMI transmitter. Connect the transmitter to the board Type-A HDMI connector with reciprocal graph endpoints.

---
 arch/riscv/boot/dts/thead/th1520-milkv-meles.dts | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
arch/riscv/boot/dts/thead/th1520-milkv-meles.dts +25 -0
index bb1be377569063b0f6d6864c8d18d37103c2c7a6..1c9de6b37a3e6f7a4ec34fdfa584332c7ab3fc59 100644
@@ -38,6 +38,17 @@ wifi_32k: clock-wifi-32k {
 		/* The module LPO input is supplied by PMIC_32K_OUT. */
 	};
 
+	hdmi-connector {
+		compatible = "hdmi-connector";
+		type = "a";
+
+		port {
+			hdmi_con_in: endpoint {
+				remote-endpoint = <&hdmi_out_con>;
+			};
+		};
+	};
+
 	memory@0 {
 		device_type = "memory";
 		reg = <0x0 0x0 0x2 0x0>;
@@ -83,6 +94,10 @@ &aogpio {
 			  "AOGPIO_8", "", "AOGPIO_10", "AOGPIO_11";
 };
 
+&dpu {
+	status = "okay";
+};
+
 &emmc {
 	bus-width = <8>;
 	max-frequency = <52000000>;
@@ -133,6 +148,16 @@ &gpio3 {
 	gpio-line-names = "GPIO3_0", "GPIO3_1", "GPIO3_2", "GPIO3_3";
 };
 
+&hdmi {
+	status = "okay";
+};
+
+&hdmi_out_port {
+	hdmi_out_con: endpoint {
+		remote-endpoint = <&hdmi_con_in>;
+	};
+};
+
 &mdio0 {
 	phy0: ethernet-phy@1 {
 		reg = <1>;
Signature · 1 line
2.47.3
maintainer Reviewed-by on the v2 series
#9 lore raw
In reply to Han Gao
Quoted 34 lines · Han Gao

Milk-V Meles is a single-board computer powered by T-HEAD's TH1520 SoC with four C910 RISC-V cores. Add the board compatible and device tree for the Milk-V Meles.

Enable UART0, eMMC, microSD, Gigabit Ethernet and the PWM fan, and name the GPIO lines exposed on the 40-pin header. Add AP6256 Wi-Fi support over SDIO and enable HDMI output through the DC8200 display controller and DW-HDMI transmitter.

Board details:
https://milkv.io/docs/meles/overview

---
Changes in v2:
- Group BeagleV Ahead and Milk-V Meles compatibles in a common TH1520 enum, as requested by Krzysztof Kozlowski.
- Explicitly select the GPIO function for the Wi-Fi host-wake pin,
as reported by Sashiko and confirmed by Drew Fustini.
- Add Drew Fustini's Reviewed-by tags to patches 2-4.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Han Gao (4):
dt-bindings: riscv: thead: add Milk-V Meles
riscv: dts: thead: add Milk-V Meles
riscv: dts: thead: enable AP6256 Wi-Fi on Milk-V Meles
riscv: dts: thead: enable HDMI on Milk-V Meles

 Documentation/devicetree/bindings/riscv/thead.yaml |   6 +-
 arch/riscv/boot/dts/thead/Makefile                 |   1 +
 arch/riscv/boot/dts/thead/th1520-milkv-meles.dts   | 346 +++++++++++++++++++++
 3 files changed, 351 insertions(+), 2 deletions(-)
Quoted 8 lines

---
base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
change-id: 20260929-rv-meles-25d10148dc0c

Best regards,
--
Han Gao <[email protected]>

This series looks good to me.

Signature · 2 lines
Best Regards
 Guo Ren
maintainer
#10 lore raw
In reply to Han Gao
Quoted 33 lines · Han Gao

Milk-V Meles is a single-board computer powered by T-HEAD's TH1520 SoC with four C910 RISC-V cores. Add the board compatible and device tree for the Milk-V Meles.

Enable UART0, eMMC, microSD, Gigabit Ethernet and the PWM fan, and name the GPIO lines exposed on the 40-pin header. Add AP6256 Wi-Fi support over SDIO and enable HDMI output through the DC8200 display controller and DW-HDMI transmitter.

Board details:
https://milkv.io/docs/meles/overview

---
Changes in v2:
- Group BeagleV Ahead and Milk-V Meles compatibles in a common TH1520 enum, as requested by Krzysztof Kozlowski.
- Explicitly select the GPIO function for the Wi-Fi host-wake pin,
as reported by Sashiko and confirmed by Drew Fustini.
- Add Drew Fustini's Reviewed-by tags to patches 2-4.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Han Gao (4):
dt-bindings: riscv: thead: add Milk-V Meles
riscv: dts: thead: add Milk-V Meles
riscv: dts: thead: enable AP6256 Wi-Fi on Milk-V Meles
riscv: dts: thead: enable HDMI on Milk-V Meles

 Documentation/devicetree/bindings/riscv/thead.yaml |   6 +-
 arch/riscv/boot/dts/thead/Makefile                 |   1 +
 arch/riscv/boot/dts/thead/th1520-milkv-meles.dts   | 346 +++++++++++++++++++++
 3 files changed, 351 insertions(+), 2 deletions(-)
Quoted 7 lines

---
base-commit: 72d3fcf802c45d00b300f25b848a93c3a2bd7c7e
change-id: 20260929-rv-meles-25d10148dc0c

Best regards,

Signature · 1 line
Han Gao <[email protected]>

Sorry, I forgot to reply to this thread that I did apply all 4 patches to thead-dt-for-next.

[1/4] dt-bindings: riscv: thead: add Milk-V Meles

        https://git.kernel.org/fustini/c/2c8613ec65f4
  [2/4] riscv: dts: thead: add Milk-V Meles
        https://git.kernel.org/fustini/c/8360e1bcc246
  [3/4] riscv: dts: thead: enable AP6256 Wi-Fi on Milk-V Meles
        https://git.kernel.org/fustini/c/a7f2539005c4
  [4/4] riscv: dts: thead: enable HDMI on Milk-V Meles
        https://git.kernel.org/fustini/c/d43b33e0253c

Thanks,
Drew

#11 lore raw
In reply to Han Gao
This series was applied to riscv/linux.git (fixes) by Drew Fustini <[email protected]>:

Hello:

This series was applied to riscv/linux.git (fixes) by Drew Fustini <[email protected]>:

Quoted 10 lines · On Thu, 01 Oct 2026 15:44:09 +0800 you wrote:

Milk-V Meles is a single-board computer powered by T-HEAD's TH1520 SoC with four C910 RISC-V cores. Add the board compatible and device tree for the Milk-V Meles.

Enable UART0, eMMC, microSD, Gigabit Ethernet and the PWM fan, and name the GPIO lines exposed on the 40-pin header. Add AP6256 Wi-Fi support over SDIO and enable HDMI output through the DC8200 display controller and DW-HDMI transmitter.

[...]

Here is the summary with links:
- [v2,1/4] dt-bindings: riscv: thead: add Milk-V Meles

    https://git.kernel.org/riscv/c/2c8613ec65f4
  - [v2,2/4] riscv: dts: thead: add Milk-V Meles
    https://git.kernel.org/riscv/c/8360e1bcc246
  - [v2,3/4] riscv: dts: thead: enable AP6256 Wi-Fi on Milk-V Meles
    https://git.kernel.org/riscv/c/a7f2539005c4
  - [v2,4/4] riscv: dts: thead: enable HDMI on Milk-V Meles
    https://git.kernel.org/riscv/c/d43b33e0253c

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html