Enable the use of the Ethernet port 1 (none other tested). The PHY is limited to use 100FD as 1000FD is failing.
Signed-off-by: Renaud Barbier <[email protected]> --- arch/arm/boards/ls1021aiot/board.c | 35 ++++++++++++++++++++++++ arch/arm/configs/layerscape_v7_defconfig | 7 +++++ arch/arm/dts/fsl-ls1021a-iot.dts | 28 +++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/arch/arm/boards/ls1021aiot/board.c b/arch/arm/boards/ls1021aiot/board.c index 70070a4e75..d4976ebc80 100644 --- a/arch/arm/boards/ls1021aiot/board.c +++ b/arch/arm/boards/ls1021aiot/board.c @@ -20,6 +20,39 @@ #include <of_address.h> #include <soc/fsl/immap_lsch2.h> +#define PHY_ID_AR8031 0x004dd074 + +/* Currently 1000FD is not working. Below is a bit of guess work + * from reading MMD3/MMD7 of the AR8033 + */ +static int phy_fixup(struct phy_device *phydev) +{ + unsigned short val; + int advertise = SUPPORTED_1000baseT_Full | SUPPORTED_1000baseT_Half; + + phydev->advertising &= ~advertise; + + /* Ar8031 phy SmartEEE feature cause link status generates glitch, + * which cause ethernet link down/up issue, so disable SmartEEE + */ + phy_write(phydev, 0xd, 0x3); + phy_write(phydev, 0xe, 0x805d); + phy_write(phydev, 0xd, 0x4003); + val = phy_read(phydev, 0xe); + val &= ~(0x1 << 8); + phy_write(phydev, 0xe, val); + + /* Use XTAL */ + phy_write(phydev, 0xd, 0x7); + phy_write(phydev, 0xe, 0x8016); + phy_write(phydev, 0xd, 0x4007); + val = phy_read(phydev, 0xe); + val &= 0xffe3; + phy_write(phydev, 0xe, val); + + return 0; +} + static int iot_mem_init(void) { if (!of_machine_is_compatible("fsl,ls1021a")) @@ -42,6 +75,8 @@ static int iot_postcore_init(void) clrbits_be32(&scfg->etsecdmamcr, SCFG_ETSECDMAMCR_LE_BD_FR); out_be32(&scfg->etsecmcr, SCFG_ETSECCMCR_GE2_CLK125); + phy_register_fixup_for_uid(PHY_ID_AR8031, 0xffffffff, phy_fixup); + return 0; } coredevice_initcall(iot_postcore_init); diff --git a/arch/arm/configs/layerscape_v7_defconfig b/arch/arm/configs/layerscape_v7_defconfig index 5127a52522..99570a8890 100644 --- a/arch/arm/configs/layerscape_v7_defconfig +++ b/arch/arm/configs/layerscape_v7_defconfig @@ -45,6 +45,10 @@ CONFIG_CMD_LET=y CONFIG_CMD_MSLEEP=y CONFIG_CMD_READF=y CONFIG_CMD_SLEEP=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_TFTP=y +CONFIG_CMD_MIITOOL=y +CONFIG_CMD_PING=y CONFIG_CMD_ECHO_E=y CONFIG_CMD_EDIT=y CONFIG_CMD_MENU=y @@ -67,6 +71,8 @@ CONFIG_CMD_OF_NODE=y CONFIG_CMD_OF_PROPERTY=y CONFIG_CMD_OFTREE=y CONFIG_CMD_TIME=y +CONFIG_NET=y +CONFIG_DRIVER_NET_GIANFAR=y CONFIG_OF_BAREBOX_DRIVERS=y CONFIG_DRIVER_SERIAL_NS16550=y CONFIG_DRIVER_SPI_FSL_QUADSPI=y @@ -85,3 +91,4 @@ CONFIG_EEPROM_AT24=y CONFIG_GPIO_PCA953X=y CONFIG_ZLIB=y CONFIG_LZO_DECOMPRESS=y +CONFIG_FS_TFTP=y diff --git a/arch/arm/dts/fsl-ls1021a-iot.dts b/arch/arm/dts/fsl-ls1021a-iot.dts index d7e8bcc7ed..33282c8f52 100644 --- a/arch/arm/dts/fsl-ls1021a-iot.dts +++ b/arch/arm/dts/fsl-ls1021a-iot.dts @@ -69,6 +69,34 @@ &i2c2 { status = "disabled"; }; +&enet0 { + status = "disabled"; +}; + +&enet1 { + tbi-handle = <&tbi1>; + phy-handle = <&phy3>; + phy-mode = "sgmii"; + /* Disable property as transmit fails without a DMA sync */ + /delete-property/ dma-coherent; +}; + +&enet2 { + status = "disabled"; +}; + +&mdio0 { + /* Rename the compatible name property as the mdio register offset + * in the gianfar driver depends on this name. Once the driver + * is in sync with Linux, it may be gone. + */ + compatible = "fsl,etsec2-mdio"; +}; + +&mdio1 { + compatible = "fsl,etsec2-mdio"; +}; + &uart0 { status = "okay"; clock-frequency = <150000000>; -- 2.43.0
