board: sophgo: milkv_duo: Add ethernet support for Milk-V Duo board
Subsystems (3)
cover board: sophgo: milkv_duo: Add ethernet support for Milk-V Duo board
This series add init code for cv1800b ethernet phy and enable ethernet support for Sophgo Milk-V Duo board.
In cv1800b, due to the PHY register phy_id being initialized to 0, it is necessary to initialize the PHY before the ethernet driver initialization. Therefore, the initialization code is placed in the board_init function.
Duo to modification of dts and defconfig, This series depends on the series:
https://lore.kernel.org/all/[email protected]/
Kongyang Liu (3):
board: milkv_duo: Add init code for Milk-V Duo ethernet
riscv: dts: sophgo: Add ethernet node
configs: milkv_duo: Add ethernet configs
arch/riscv/dts/cv18xx.dtsi | 6 +++ board/sophgo/milkv_duo/Makefile | 3 +- board/sophgo/milkv_duo/board.c | 4 ++ board/sophgo/milkv_duo/ethernet.c | 79 +++++++++++++++++++++++++++++++ board/sophgo/milkv_duo/ethernet.h | 11 +++++ configs/milkv_duo_defconfig | 4 ++ drivers/net/designware.c | 1 + 7 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 board/sophgo/milkv_duo/ethernet.c create mode 100644 board/sophgo/milkv_duo/ethernet.h
Signature · 1 line
2.41.0
PATCH 1/3 board: milkv_duo: Add init code for Milk-V Duo ethernet
Initialize register in cv1800b ethernet phy to make it compatible with generic phy driver
---
board/sophgo/milkv_duo/Makefile | 3 +- board/sophgo/milkv_duo/board.c | 4 ++ board/sophgo/milkv_duo/ethernet.c | 79 +++++++++++++++++++++++++++++++ board/sophgo/milkv_duo/ethernet.h | 11 +++++ drivers/net/designware.c | 1 + 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 board/sophgo/milkv_duo/ethernet.c create mode 100644 board/sophgo/milkv_duo/ethernet.h
board/sophgo/milkv_duo/Makefile +2 -1
@@ -2,4 +2,5 @@ # # Copyright (c) 2024, Kongyang Liu <[email protected]> -obj-y := board.o +obj-y += board.o +obj-$(CONFIG_NET) += ethernet.o
board/sophgo/milkv_duo/board.c +4 -0
@@ -3,7 +3,11 @@* Copyright (c) 2024, Kongyang Liu <[email protected]> */ +#include "ethernet.h" +int board_init (void ) { +if (IS_ENABLED (CONFIG_NET )) +cv1800b_ephy_init ();return 0 ; }
board/sophgo/milkv_duo/ethernet.c new file +79 -0
79 lines not on this page · raw message
board/sophgo/milkv_duo/ethernet.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright (c) 2024, Kongyang Liu <[email protected]> +*/ + +#ifndef __CV1800B_ETHERNET_H +#define __CV1800B_ETHERNET_H + +void cv1800b_ephy_init (void ); + +#endif
drivers/net/designware.c +1 -0
@@ -861,6 +861,7 @@ static const struct udevice_id designware_eth_ids[] = { { .compatible = "amlogic,meson6-dwmac" }, { .compatible = "st,stm32-dwmac" }, { .compatible = "snps,arc-dwmac-3.70a" }, + { .compatible = "sophgo,cv1800b-ethernet" }, { } };
Signature · 1 line
2.41.0
PATCH 2/3 riscv: dts: sophgo: Add ethernet node
In reply to Kongyang LiuAdd ethernet node for cv1800b SoC
---
arch/riscv/dts/cv18xx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/riscv/dts/cv18xx.dtsi +6 -0
@@ -197,6 +197,12 @@ status = "disabled"; }; + ethernet0: ethernet@4070000 { + compatible = "sophgo,cv1800b-ethernet"; + reg = <0x04070000 0x10000>; + phy-mode = "rmii"; + }; + plic: interrupt-controller@70000000 { reg = <0x70000000 0x4000000>; interrupts-extended = <&cpu0_intc 11>, <&cpu0_intc 9>;
Signature · 1 line
2.41.0
PATCH 3/3 configs: milkv_duo: Add ethernet configs
In reply to Kongyang LiuAdd configs related to ethernet and ethernet boot command for Sophgo Milk-V Duo board
---
configs/milkv_duo_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
configs/milkv_duo_defconfig +4 -0
@@ -19,14 +19,18 @@ CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="milkv_duo# " CONFIG_CMD_MMC=y CONFIG_CMD_PART=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_PXE=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y CONFIG_ENV_OVERWRITE=y +CONFIG_NET_RANDOM_ETHADDR=y CONFIG_MMC=y CONFIG_MMC_IO_VOLTAGE=y CONFIG_MMC_UHS_SUPPORT=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_ADMA=y CONFIG_MMC_SDHCI_CV1800B=y +CONFIG_ETH_DESIGNWARE=y CONFIG_SYS_NS16550=y CONFIG_SYS_NS16550_MEM32=y
Signature · 1 line
2.41.0
Re: [PATCH 1/3] board: milkv_duo: Add init code for Milk-V Duo ethernet
In reply to Kongyang LiuQuoted 6 lines · Kongyang Liu
Initialize register in cv1800b ethernet phy to make it compatible with generic phy driver
Signed-off-by Kongyang Liu <[email protected]>---
Quoted 8 lines
board/sophgo/milkv_duo/Makefile | 3 +- board/sophgo/milkv_duo/board.c | 4 ++ board/sophgo/milkv_duo/ethernet.c | 79 +++++++++++++++++++++++++++++++ board/sophgo/milkv_duo/ethernet.h | 11 +++++ drivers/net/designware.c | 1 + 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 board/sophgo/milkv_duo/ethernet.c create mode 100644 board/sophgo/milkv_duo/ethernet.h
Re: [PATCH 2/3] riscv: dts: sophgo: Add ethernet node
In reply to Kongyang LiuQuoted 7 lines · Kongyang Liu
Add ethernet node for cv1800b SoC
Signed-off-by Kongyang Liu <[email protected]>---
arch/riscv/dts/cv18xx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
Hi KongYang,
Will there be a patch adding this ethernet node for kernel as well ?
Best regards,
Leo
Re: [PATCH 3/3] configs: milkv_duo: Add ethernet configs
In reply to Kongyang LiuQuoted 8 lines · Kongyang Liu
Add configs related to ethernet and ethernet boot command for Sophgo Milk-V Duo board
Signed-off-by Kongyang Liu <[email protected]>---
configs/milkv_duo_defconfig | 4 ++++ 1 file changed, 4 insertions(+)
Re: [PATCH 2/3] riscv: dts: sophgo: Add ethernet node
In reply to Leo LiangQuoted 6 lines · Leo Liang
Quoted 5 lines · Kongyang Liu
Add ethernet node for cv1800b SoC
Signed-off-by Kongyang Liu <[email protected]>---
Quoted 6 lines
Quoted 2 lines
arch/riscv/dts/cv18xx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)Hi KongYang,
Will there be a patch adding this ethernet node for kernel as well ?
It's highly like that the compatible of "cv1800b-ethernet" will be requested to be changed to "cv1800b-dwmac" to match the designware IP used in other SoCs.
The added node also looks suspiciously missing any clocks or interrupts.
Re: [PATCH 2/3] riscv: dts: sophgo: Add ethernet node
In reply to Leo LiangQuoted 7 lines · Leo Liang <[email protected]> 于2024年3月12日周二 17:59写道:
Quoted 5 lines · Kongyang Liu
Add ethernet node for cv1800b SoC
Signed-off-by Kongyang Liu <[email protected]>---
Quoted 7 lines
Quoted 2 lines
arch/riscv/dts/cv18xx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)Hi KongYang,
Will there be a patch adding this ethernet node for kernel as well ?
Currently, I'm only focusing on the u-boot for the Milk-V Duo board, while the kernel part is being handled by others. Therefore, this patch will not be added to the kernel.
Best regards
Kongyang Liu
Quoted 2 lines
Best regards,
Leo
Re: [PATCH 2/3] riscv: dts: sophgo: Add ethernet node
In reply to Conor DooleyQuoted 11 lines · Conor Dooley <[email protected]> 于2024年3月12日周二 21:20写道:
Quoted 9 lines · Leo Liang
Quoted 7 lines · Kongyang Liu
Add ethernet node for cv1800b SoC
Signed-off-by Kongyang Liu <[email protected]>---
arch/riscv/dts/cv18xx.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
Quoted 8 lines
Quoted 3 lines
Hi KongYang,
Will there be a patch adding this ethernet node for kernel as well ?
It's highly like that the compatible of "cv1800b-ethernet" will be requested to be changed to "cv1800b-dwmac" to match the designware IP used in other SoCs.
I will change it in next version
Quoted 1 line
The added node also looks suspiciously missing any clocks or interrupts.
If we only consider u-boot, since u-boot does not utilize interrupts and clocks, this code can function properly. However, if compatibility with the kernel is a concern, I will discuss this issue with who is working on Milk-V Duo Ethernet support for the kernel.
Best regards
Kongyang Liu