arm: kirkwood: Add support for Pogoplug V4
Subsystems (2)
v4 cover arm: kirkwood: Add support for Pogoplug V4
Pogoplug V4 specifications:
Kirkwood 88F6192 SoC
800 MHz CPU
1Gbs Ethernet
128 MB RAM
128 MB NAND
1x USB 2.0
2x USB 3.0 (on PCIe bus)
1 SDHC slot
1x External SATA port (USM enclosure form factor slot)
Changes in v4:
- Remove CONFIG_FEATURE_COMMAND_EDITING and ifdefs for CMD_NET in include header
Changes in v3:
- Migrate symbols from board include header to Kconfig
- Squash board file small patches into one patch
- Migrate config symbols from board include header to defconfig
- Remove obsolete config symbols from header file
- Don't use ifdefs for unselectable config symbols in header file
Changes in v2:
- Use mainline Linux DTS version
- Move constants to .c file and remove header file
- Use canonical format for defconfig file
Tony Dinh (4):
arm: kirkwood: Pogoplug-V4 : Add DTS files
arm: kirkwood: Pogoplug-V4 : Add Kconfig files
arm: kirkwood: Pogoplug-V4 : Add board implementation files
arm: kirkwood: Pogoplug V4 : Add board include header and defconfig
files
arch/arm/dts/Makefile | 1 + arch/arm/dts/kirkwood-pogoplug-series-4.dts | 180 ++++++++++++++++ arch/arm/mach-kirkwood/Kconfig | 6 + board/cloudengines/pogo_v4/Kconfig | 16 ++ board/cloudengines/pogo_v4/MAINTAINERS | 6 + board/cloudengines/pogo_v4/Makefile | 10 + board/cloudengines/pogo_v4/kwbimage.cfg | 148 +++++++++++++ board/cloudengines/pogo_v4/pogo_v4.c | 220 ++++++++++++++++++++ configs/pogo_v4_defconfig | 79 +++++++ include/configs/pogo_v4.h | 53 +++++ 10 files changed, 719 insertions(+) create mode 100644 arch/arm/dts/kirkwood-pogoplug-series-4.dts create mode 100644 board/cloudengines/pogo_v4/Kconfig create mode 100644 board/cloudengines/pogo_v4/MAINTAINERS create mode 100644 board/cloudengines/pogo_v4/Makefile create mode 100644 board/cloudengines/pogo_v4/kwbimage.cfg create mode 100644 board/cloudengines/pogo_v4/pogo_v4.c create mode 100644 configs/pogo_v4_defconfig create mode 100644 include/configs/pogo_v4.h
Signature · 1 line
2.30.2
PATCH v4 1/4 arm: kirkwood: Pogoplug-V4 : Add DTS files
Add DTS files for Pogoplug V4 board
---
(no changes since v2)
Changes in v2:
- Use mainline Linux DTS version
arch/arm/dts/Makefile | 1 + arch/arm/dts/kirkwood-pogoplug-series-4.dts | 180 ++++++++++++++++++++ 2 files changed, 181 insertions(+) create mode 100644 arch/arm/dts/kirkwood-pogoplug-series-4.dts
arch/arm/dts/Makefile +1 -0
@@ -71,6 +71,7 @@ dtb-$(CONFIG_ARCH_KIRKWOOD) += \ kirkwood-openrd-client.dtb \ kirkwood-openrd-ultimate.dtb \ kirkwood-pogo_e02.dtb \ + kirkwood-pogoplug-series-4.dtb \ kirkwood-sheevaplug.dtb dtb-$(CONFIG_MACH_S900) += \
arch/arm/dts/kirkwood-pogoplug-series-4.dts new file +180 -0
180 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v4 2/4 arm: kirkwood: Pogoplug-V4 : Add Kconfig files
In reply to Tony DinhAdd Kconfig files for Pogoplug V4 board
---
(no changes since v3)
Changes in v3:
- Migrate symbols from board include header to Kconfig
arch/arm/mach-kirkwood/Kconfig | 6 ++++++ board/cloudengines/pogo_v4/Kconfig | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 board/cloudengines/pogo_v4/Kconfig
arch/arm/mach-kirkwood/Kconfig +6 -0
@@ -51,6 +51,11 @@ config TARGET_POGO_E02 select FEROCEON_88FR131 select KW88F6281 +config TARGET_POGO_V4 + bool "Pogoplug V4 Board" + select FEROCEON_88FR131 + select KW88F6192 + config TARGET_DNS325 bool "dns325 Board" select FEROCEON_88FR131
@@ -123,6 +128,7 @@ source "board/Marvell/guruplug/Kconfig" source "board/Marvell/sheevaplug/Kconfig" source "board/buffalo/lsxl/Kconfig" source "board/cloudengines/pogo_e02/Kconfig" +source "board/cloudengines/pogo_v4/Kconfig" source "board/d-link/dns325/Kconfig" source "board/iomega/iconnect/Kconfig" source "board/keymile/Kconfig"
board/cloudengines/pogo_v4/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2014-2021 Tony Dinh <[email protected]> +# +if TARGET_POGO_V4 + +config SYS_BOARD + default "pogo_v4" + +config SYS_VENDOR + default "cloudengines" + +config SYS_CONFIG_NAME + default "pogo_v4" + +endif
Signature · 1 line
2.30.2
PATCH v4 3/4 arm: kirkwood: Pogoplug-V4 : Add board implementation files
In reply to Tony DinhNote: currently the fdt_get_phy_addr function in this file is duplicate in this board and many other Kirkwood boards (eg. Sheevaplug, GoFlex Home, etc.). This function is being factored out into common area by another patch. And because it was written for flattree only, the patch is being rewritten to use livetree calls.
---
(no changes since v3)
Changes in v3:
- Squash board file small patches into one patch
Changes in v2:
- Move constants to .c file and remove header file
board/cloudengines/pogo_v4/MAINTAINERS | 6 + board/cloudengines/pogo_v4/Makefile | 10 ++ board/cloudengines/pogo_v4/kwbimage.cfg | 148 ++++++++++++++++ board/cloudengines/pogo_v4/pogo_v4.c | 220 ++++++++++++++++++++++++ 4 files changed, 384 insertions(+) create mode 100644 board/cloudengines/pogo_v4/MAINTAINERS create mode 100644 board/cloudengines/pogo_v4/Makefile create mode 100644 board/cloudengines/pogo_v4/kwbimage.cfg create mode 100644 board/cloudengines/pogo_v4/pogo_v4.c
board/cloudengines/pogo_v4/MAINTAINERS new file +6 -0
@@ -0,0 +1,6 @@ +POGO_V4 BOARD +M: Tony Dinh <[email protected]> +S: Maintained +F: board/cloudengines/pogo_v4/ +F: include/configs/pogo_v4.h +F: configs/pogo_v4_defconfig
board/cloudengines/pogo_v4/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2014-2021 Tony Dinh <[email protected]> +# +# Based on +# Marvell Semiconductor <www.marvell.com> +# Written-by: Prafulla Wadaskar <[email protected]> +# + +obj-y := pogo_v4.o
board/cloudengines/pogo_v4/kwbimage.cfg new file +148 -0
148 lines not on this page · raw message
board/cloudengines/pogo_v4/pogo_v4.c new file +220 -0
220 lines not on this page · raw message
Signature · 1 line
2.30.2
PATCH v4 4/4 arm: kirkwood: Pogoplug V4 : Add board include header and defconfig files
In reply to Tony DinhAdd board include header and defconfig files for Pogoplug V4
---
Changes in v4:
- Remove CONFIG_FEATURE_COMMAND_EDITING and ifdefs for CMD_NET in include header
Changes in v3:
- Migrate config symbols from board include header to defconfig
- Remove obsolete config symbols from header file
- Don't use ifdefs for unselectable config symbols in header file
Changes in v2:
- Use canonical format for defconfig file
configs/pogo_v4_defconfig | 79 +++++++++++++++++++++++++++++++++++++++ include/configs/pogo_v4.h | 53 ++++++++++++++++++++++++++ 2 files changed, 132 insertions(+) create mode 100644 configs/pogo_v4_defconfig create mode 100644 include/configs/pogo_v4.h
configs/pogo_v4_defconfig new file +79 -0
@@ -0,0 +1,79 @@ +CONFIG_ARM=y +CONFIG_SKIP_LOWLEVEL_INIT=y +CONFIG_SYS_DCACHE_OFF=y +CONFIG_ARCH_CPU_INIT=y +CONFIG_SYS_THUMB_BUILD=y +CONFIG_ARCH_KIRKWOOD=y +CONFIG_SYS_KWD_CONFIG="board/cloudengines/pogo_v4/kwbimage.cfg" +CONFIG_SYS_TEXT_BASE=0x600000 +CONFIG_TARGET_POGO_V4=y +CONFIG_ENV_SIZE=0x20000 +CONFIG_ENV_OFFSET=0xC0000 +CONFIG_DEFAULT_DEVICE_TREE="kirkwood-pogoplug-series-4" +CONFIG_IDENT_STRING="\nPogoplug V4" +CONFIG_SYS_LOAD_ADDR=0x800000 +CONFIG_BOOTSTAGE=y +CONFIG_SHOW_BOOT_PROGRESS=y +CONFIG_BOOTDELAY=10 +CONFIG_USE_BOOTCOMMAND=y +CONFIG_BOOTCOMMAND="setenv bootargs ${bootargs_console}; run bootcmd_usb; bootm 0x00800000 0x01100000 0x2c00000" +CONFIG_USE_PREBOOT=y +CONFIG_BOARD_LATE_INIT=y +CONFIG_HUSH_PARSER=y +CONFIG_SYS_PROMPT="Pogo_V4> " +CONFIG_CMD_BOOTZ=y +# CONFIG_BOOTM_PLAN9 is not set +# CONFIG_BOOTM_RTEMS is not set +# CONFIG_BOOTM_VXWORKS is not set +# CONFIG_CMD_FLASH is not set +CONFIG_CMD_MMC=y +CONFIG_CMD_MTD=y +CONFIG_CMD_NAND=y +CONFIG_CMD_PCI=y +CONFIG_CMD_SATA=y +CONFIG_CMD_USB=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_SNTP=y +CONFIG_CMD_DNS=y +CONFIG_CMD_EXT2=y +CONFIG_CMD_EXT4=y +CONFIG_CMD_FAT=y +CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_JFFS2=y +CONFIG_CMD_MTDPARTS=y +CONFIG_MTDIDS_DEFAULT="nand0=orion_nand" +CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:2M(u-boot),3M(uImage),3M(uImage2),8M(failsafe),112M(root)" +CONFIG_CMD_UBI=y +CONFIG_ISO_PARTITION=y +CONFIG_EFI_PARTITION=y +CONFIG_PARTITION_TYPE_GUID=y +CONFIG_OF_CONTROL=y +CONFIG_ENV_OVERWRITE=y +CONFIG_ENV_IS_IN_NAND=y +CONFIG_VERSION_VARIABLE=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_NETCONSOLE=y +CONFIG_DM=y +CONFIG_SATA_MV=y +CONFIG_KIRKWOOD_GPIO=y +# CONFIG_MMC_HW_PARTITIONING is not set +CONFIG_MVEBU_MMC=y +CONFIG_MTD=y +CONFIG_MTD_RAW_NAND=y +CONFIG_DM_ETH=y +CONFIG_MVGBE=y +CONFIG_MII=y +CONFIG_PCI=y +CONFIG_PCI_MVEBU=y +CONFIG_DM_RTC=y +CONFIG_RTC_EMULATION=y +CONFIG_SYS_NS16550=y +CONFIG_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PCI=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_JFFS2_LZO=y +CONFIG_JFFS2_NAND=y
include/configs/pogo_v4.h new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.30.2
Re: [PATCH v4 3/4] arm: kirkwood: Pogoplug-V4 : Add board implementation files
In reply to Tony DinhQuoted 39 lines · On Thursday 20 January 2022 17:50:54 Tony Dinh wrote:
board/cloudengines/pogo_v4/pogo_v4.c new file +34
-0+int fdt_get_phy_addr (const char *path) +{ +const void *fdt = gd->fdt_blob; +const u32 *reg; +const u32 *val; +int node, phandle, addr; + +/* Find the node by its full path */ + node =fdt_path_offset (fdt, path); +if (node >=0 ) { +/* Look up phy-handle */ + val =fdt_getprop (fdt, node,"phy-handle" ,NULL ); +if (!val) { +/* Look up phy (deprecated property for phy handle) */ + val =fdt_getprop (fdt, node,"phy" ,NULL ); + } +if (val) { + phandle =fdt32_to_cpu (*val); +if (!phandle) +return -FDT_ERR_NOTFOUND ; + +/* Follow it to its node */ + node =fdt_node_offset_by_phandle (fdt, phandle); +if (node) { +/* Look up reg */ + reg =fdt_getprop (fdt, node,"reg" ,NULL ); +if (reg) { + addr =fdt32_to_cpu (*reg); +return addr; + } + } + } + } +return -FDT_ERR_NOTFOUND ;
board/cloudengines/pogo_v4/pogo_v4.c line 160
Quoted 10 lines
board/cloudengines/pogo_v4/pogo_v4.c new file +10
-0+} + +#if defined(CONFIG_RESET_PHY_R ) +/* Configure and initialize PHY */ +void reset_phy (void ) +{ +u16 reg; +int phyaddr; +char *name ="ethernet-controller@72000" ; +char *eth0_path ="/ocp@f1000000/ethernet-controller@72000" ;
Hello! I would suggest to avoid hardcoding DT node names and DT node paths into source code.
How to avoid it?
In DTS file define alias "ethernet0" as alias to eth0 node:
aliases {
ethernet0 = ð0;
};(just before memory {} node)
ð0 label is already defined in arch/arm/dts/kirkwood.dtsi.
Function fdt_path_offset() understands either full path or alias. So you can call fdt_get_phy_addr("ethernet0").
And to get node name you can use function fdt_get_name() which takes node offset - return value of fdt_path_offset().
And maybe... to avoid calling fdt_path_offset() two times, you may adjust fdt_get_phy_addr() to directly take node offset (not path/alias).
So something like this:
node = fdt_path_offset(gd->fdt_blob, "ethernet0");
... error checking ...
name = fdt_get_name(gd->fdt_blob, node, NULL);
... error checking ...
miiphy_set_current_dev(name);
... error checking ...
fdt_get_phy_addr(node);
... error checking ...Quoted 22 lines
board/cloudengines/pogo_v4/pogo_v4.c new file +22
-0+if (miiphy_set_current_dev (name)) +return ; + + phyaddr =fdt_get_phy_addr (eth0_path); +if (phyaddr <0 ) +return ; + +/* +* Enable RGMII delay on Tx and Rx for CPU port +* Ref: sec 4.7.2 of chip datasheet +*/ +miiphy_write (name, phyaddr,MV88E1116_PGADR_REG ,2 ); +miiphy_read (name, phyaddr,MV88E1116_MAC_CTRL_REG , ®); + reg |= (MV88E1116_RGMII_RXTM_CTRL |MV88E1116_RGMII_TXTM_CTRL ); +miiphy_write (name, phyaddr,MV88E1116_MAC_CTRL_REG , reg); +miiphy_write (name, phyaddr,MV88E1116_PGADR_REG ,0 ); + +/* reset the phy */ +miiphy_reset (name, phyaddr); + +printf ("88E1116 Initialized on %s\n" , name); +}
Re: [PATCH v4 3/4] arm: kirkwood: Pogoplug-V4 : Add board implementation files
Hi Pali and Stefan,
Quoted 67 lines · Pali Rohár
Quoted 39 lines · On Thursday 20 January 2022 17:50:54 Tony Dinh wrote:
board/cloudengines/pogo_v4/pogo_v4.c new file +34
-0+int fdt_get_phy_addr (const char *path) +{ +const void *fdt = gd->fdt_blob; +const u32 *reg; +const u32 *val; +int node, phandle, addr; + +/* Find the node by its full path */ + node =fdt_path_offset (fdt, path); +if (node >=0 ) { +/* Look up phy-handle */ + val =fdt_getprop (fdt, node,"phy-handle" ,NULL ); +if (!val) { +/* Look up phy (deprecated property for phy handle) */ + val =fdt_getprop (fdt, node,"phy" ,NULL ); + } +if (val) { + phandle =fdt32_to_cpu (*val); +if (!phandle) +return -FDT_ERR_NOTFOUND ; + +/* Follow it to its node */ + node =fdt_node_offset_by_phandle (fdt, phandle); +if (node) { +/* Look up reg */ + reg =fdt_getprop (fdt, node,"reg" ,NULL ); +if (reg) { + addr =fdt32_to_cpu (*reg); +return addr; + } + } + } + } +return -FDT_ERR_NOTFOUND ;board/cloudengines/pogo_v4/pogo_v4.c line 160
Quoted 10 lines
board/cloudengines/pogo_v4/pogo_v4.c new file +10
-0+} + +#if defined(CONFIG_RESET_PHY_R ) +/* Configure and initialize PHY */ +void reset_phy (void ) +{ +u16 reg; +int phyaddr; +char *name ="ethernet-controller@72000" ; +char *eth0_path ="/ocp@f1000000/ethernet-controller@72000" ;Hello! I would suggest to avoid hardcoding DT node names and DT node paths into source code.
How to avoid it?
In DTS file define alias "ethernet0" as alias to eth0 node:
aliases { ethernet0 = ð0; };(just before memory {} node)
ð0 label is already defined in
arch/arm/dts/kirkwood.dtsi.
Quoted 8 lines
Function
fdt_path_offset()understands either full path or alias. So you can callfdt_get_phy_addr("ethernet0").And to get node name you can use function
fdt_get_name()which takes node offset - return value offdt_path_offset().And maybe... to avoid calling
fdt_path_offset()two times, you may adjustfdt_get_phy_addr()to directly take node offset (not path/alias).
Pali,
Thanks for your suggestion and reviewing this fdt_get_phy_addr() function. However, this function will be removed. See my followup post in the V3 patch thread about the uclass MVGBE.
https://lists.denx.de/pipermail/u-boot/2022-January/472691.html
Stefan,
Perhaps I should send in a v5 patch series for this board now (instead of reworking this file in a separate patch)? I've tested the uclass MVGBE in this board and it is working as I expected.
Thank,
Tony
Quoted 35 lines
So something like this:
node = fdt_path_offset(gd->fdt_blob, "ethernet0"); ... error checking ... name = fdt_get_name(gd->fdt_blob, node, NULL); ... error checking ... miiphy_set_current_dev(name); ... error checking ... fdt_get_phy_addr(node); ... error checking ...Quoted 22 lines
board/cloudengines/pogo_v4/pogo_v4.c new file +22
-0+if (miiphy_set_current_dev (name)) +return ; + + phyaddr =fdt_get_phy_addr (eth0_path); +if (phyaddr <0 ) +return ; + +/* +* Enable RGMII delay on Tx and Rx for CPU port +* Ref: sec 4.7.2 of chip datasheet +*/ +miiphy_write (name, phyaddr,MV88E1116_PGADR_REG ,2 ); +miiphy_read (name, phyaddr,MV88E1116_MAC_CTRL_REG , ®); + reg |= (MV88E1116_RGMII_RXTM_CTRL |MV88E1116_RGMII_TXTM_CTRL ); +miiphy_write (name, phyaddr,MV88E1116_MAC_CTRL_REG , reg); +miiphy_write (name, phyaddr,MV88E1116_PGADR_REG ,0 ); + +/* reset the phy */ +miiphy_reset (name, phyaddr); + +printf ("88E1116 Initialized on %s\n" , name); +}
Re: [PATCH v4 3/4] arm: kirkwood: Pogoplug-V4 : Add board implementation files
Hi Pali,
Quoted 85 lines · Tony Dinh
Hi Pali and Stefan,
Quoted 67 lines · Pali Rohár
Quoted 39 lines · On Thursday 20 January 2022 17:50:54 Tony Dinh wrote:
board/cloudengines/pogo_v4/pogo_v4.c new file +34
-0+int fdt_get_phy_addr (const char *path) +{ +const void *fdt = gd->fdt_blob; +const u32 *reg; +const u32 *val; +int node, phandle, addr; + +/* Find the node by its full path */ + node =fdt_path_offset (fdt, path); +if (node >=0 ) { +/* Look up phy-handle */ + val =fdt_getprop (fdt, node,"phy-handle" ,NULL ); +if (!val) { +/* Look up phy (deprecated property for phy handle) */ + val =fdt_getprop (fdt, node,"phy" ,NULL ); + } +if (val) { + phandle =fdt32_to_cpu (*val); +if (!phandle) +return -FDT_ERR_NOTFOUND ; + +/* Follow it to its node */ + node =fdt_node_offset_by_phandle (fdt, phandle); +if (node) { +/* Look up reg */ + reg =fdt_getprop (fdt, node,"reg" ,NULL ); +if (reg) { + addr =fdt32_to_cpu (*reg); +return addr; + } + } + } + } +return -FDT_ERR_NOTFOUND ;board/cloudengines/pogo_v4/pogo_v4.c line 160
Quoted 10 lines
board/cloudengines/pogo_v4/pogo_v4.c new file +10
-0+} + +#if defined(CONFIG_RESET_PHY_R ) +/* Configure and initialize PHY */ +void reset_phy (void ) +{ +u16 reg; +int phyaddr; +char *name ="ethernet-controller@72000" ; +char *eth0_path ="/ocp@f1000000/ethernet-controller@72000" ;Hello! I would suggest to avoid hardcoding DT node names and DT node paths into source code.
How to avoid it?
In DTS file define alias "ethernet0" as alias to eth0 node:
aliases { ethernet0 = ð0; };(just before memory {} node)
ð0 label is already defined in
arch/arm/dts/kirkwood.dtsi.Quoted 8 lines
Function
fdt_path_offset()understands either full path or alias. So you can callfdt_get_phy_addr("ethernet0").And to get node name you can use function
fdt_get_name()which takes node offset - return value offdt_path_offset().And maybe... to avoid calling
fdt_path_offset()two times, you may adjustfdt_get_phy_addr()to directly take node offset (not path/alias).Pali,
Thanks for your suggestion and reviewing thisfdt_get_phy_addr()function. However, this function will be removed. See my followup post in the V3 patch thread about the uclass MVGBE.
Quoted 7 lines
https://lists.denx.de/pipermail/u-boot/2022-January/472691.html
Stefan,
Perhaps I should send in a v5 patch series for this board now (instead of reworking this file in a separate patch)? I've tested the uclass MVGBE in this board and it is working as I expected.
Here is the test using mvgbe uclass. I've added some debug printfs to see what the calling sequence is.
<BEGIN log>
U-Boot 2022.01-00673-g70fe7827f2-dirty (Jan 22 2022 - 00:09:05 -0800) Pogoplug V4
SoC: Kirkwood 88F6281_A1 Model: Cloud Engines PogoPlug Series 4 DRAM: 128 MiB Core: 11 devices, 10 uclasses, devicetree: separate NAND: 128 MiB MMC: mvsdio@90000: 0 Loading Environment from NAND... OK In: serial Out: serial Err: serial pcie0.0: Link up Net: mvgbe_of_to_plat
mvgbe_of_to_plat phy-mode 1mvgbe_probe
eth0: ethernet-controller@72000
Hit any key to stop autoboot: 0
Pogo_V4> ping 192.168.0.1mvgbe_start UCLASS_ETH mvgbemvgbe_start PHY addr 0__mvgbe_phy_init phy_interface = gmiiphy_configphy.c board_phy_configphy.c board_phy_config calling default phydev->drv->config phy.c genphy_config
ethernet-controller@72000 Waiting for PHY auto negotiation to complete....... done
Using ethernet-controller@72000 device
host 192.168.0.1 is alive
<END log>
So the network bringup is purely based on the DTS. None of the marvell.c driver config is involved (i.e genphy_config function is where the configuration occurs). It is currently working fine with gmii phy-mode. So to get rgmii, we'll just need to add a phy-mode = "rgmii" property to the eth0 node in the DTS.
All this to say is I'm happy that I can remove a lot of code in pogo_v4.c, and not have to patch anything in the common area like FDT or network PHY.
Thanks,
Tony
Quoted 39 lines
Thank,
TonyQuoted 35 lines
So something like this:
node = fdt_path_offset(gd->fdt_blob, "ethernet0"); ... error checking ... name = fdt_get_name(gd->fdt_blob, node, NULL); ... error checking ... miiphy_set_current_dev(name); ... error checking ... fdt_get_phy_addr(node); ... error checking ...Quoted 22 lines
board/cloudengines/pogo_v4/pogo_v4.c new file +22
-0+if (miiphy_set_current_dev (name)) +return ; + + phyaddr =fdt_get_phy_addr (eth0_path); +if (phyaddr <0 ) +return ; + +/* +* Enable RGMII delay on Tx and Rx for CPU port +* Ref: sec 4.7.2 of chip datasheet +*/ +miiphy_write (name, phyaddr,MV88E1116_PGADR_REG ,2 ); +miiphy_read (name, phyaddr,MV88E1116_MAC_CTRL_REG , ®); + reg |= (MV88E1116_RGMII_RXTM_CTRL |MV88E1116_RGMII_TXTM_CTRL ); +miiphy_write (name, phyaddr,MV88E1116_MAC_CTRL_REG , reg); +miiphy_write (name, phyaddr,MV88E1116_PGADR_REG ,0 ); + +/* reset the phy */ +miiphy_reset (name, phyaddr); + +printf ("88E1116 Initialized on %s\n" , name); +}