From 1313442a95cd6405928324cb4e8d72c25242a767 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sun, 19 Jan 2020 14:37:17 +0100 Subject: [PATCH] remove RGMII TX delay fixup --- ...-at803x-allow-to-configure-via-pdata.patch | 70 ++----------------- ...net-phy-at803x-fix-at8033-sgmii-mode.patch | 4 +- ...phy-at803x-allow-to-configure-via-dt.patch | 35 +--------- 3 files changed, 11 insertions(+), 98 deletions(-) diff --git a/target/linux/generic/pending-5.4/734-net-phy-at803x-allow-to-configure-via-pdata.patch b/target/linux/generic/pending-5.4/734-net-phy-at803x-allow-to-configure-via-pdata.patch index bc635b5a24..fe75f53948 100644 --- a/target/linux/generic/pending-5.4/734-net-phy-at803x-allow-to-configure-via-pdata.patch +++ b/target/linux/generic/pending-5.4/734-net-phy-at803x-allow-to-configure-via-pdata.patch @@ -48,7 +48,7 @@ Signed-off-by: Gabor Juhos }; struct at803x_context { -@@ -256,8 +264,16 @@ static int at803x_probe(struct phy_devic +@@ -256,6 +264,13 @@ static int at803x_probe(struct phy_devic return 0; } @@ -61,84 +61,26 @@ Signed-off-by: Gabor Juhos + static int at803x_config_init(struct phy_device *phydev) { -+ struct at803x_platform_data *pdata; int ret; - - /* The RX and TX delay default is: -@@ -315,6 +331,9 @@ static int at803x_config_intr(struct phy - - static void at803x_link_change_notify(struct phy_device *phydev) - { -+ struct at803x_platform_data *pdata; -+ pdata = dev_get_platdata(&phydev->mdio.dev); -+ - /* - * Conduct a hardware reset for AT8030/2 every time a link loss is - * signalled. This is necessary to circumvent a hardware bug that -@@ -336,6 +355,25 @@ static void at803x_link_change_notify(st - - phydev_dbg(phydev, "%s(): phy was reset\n", __func__); - } -+ -+ if (pdata && pdata->fixup_rgmii_tx_delay && -+ phydev->speed != priv->prev_speed) { -+ switch (phydev->speed) { -+ case SPEED_10: -+ case SPEED_100: -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0, -+ AT803X_DEBUG_TX_CLK_DLY_EN); -+ break; -+ case SPEED_1000: -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, -+ AT803X_DEBUG_TX_CLK_DLY_EN, 0); -+ break; -+ default: -+ break; -+ } -+ -+ priv->prev_speed = phydev->speed; -+ } - } - - static int at803x_aneg_done(struct phy_device *phydev) -@@ -423,6 +461,26 @@ static int at803x_read_status(struct phy +@@ -423,6 +438,10 @@ static int at803x_read_status(struct phy if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) phy_resolve_aneg_pause(phydev); -+ pdata = dev_get_platdata(&phydev->mdio.dev); -+ if (pdata) { -+ if (pdata->disable_smarteee) -+ at803x_disable_smarteee(phydev); -+ -+ if (pdata->enable_rgmii_rx_delay) -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, 0, -+ AT803X_DEBUG_RX_CLK_DLY_EN); -+ else -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_0, -+ AT803X_DEBUG_RX_CLK_DLY_EN, 0); -+ -+ if (pdata->enable_rgmii_tx_delay) -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, 0, -+ AT803X_DEBUG_TX_CLK_DLY_EN); -+ else -+ at803x_debug_reg_mask(phydev, AT803X_DEBUG_REG_5, -+ AT803X_DEBUG_TX_CLK_DLY_EN, 0); -+ } ++ struct at803x_platform_data *pdata = dev_get_platdata(&phydev->mdio.dev); ++ if (pdata && pdata->disable_smarteee) ++ at803x_disable_smarteee(phydev); + return 0; } --- /dev/null +++ b/include/linux/platform_data/phy-at803x.h -@@ -0,0 +1,11 @@ +@@ -0,0 +1,8 @@ +#ifndef _PHY_AT803X_PDATA_H +#define _PHY_AT803X_PDATA_H + +struct at803x_platform_data { + int disable_smarteee:1; -+ int enable_rgmii_tx_delay:1; -+ int enable_rgmii_rx_delay:1; -+ int fixup_rgmii_tx_delay:1; +}; + +#endif /* _PHY_AT803X_PDATA_H */ diff --git a/target/linux/generic/pending-5.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch b/target/linux/generic/pending-5.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch index 00a96a3355..db6668d105 100644 --- a/target/linux/generic/pending-5.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch +++ b/target/linux/generic/pending-5.4/735-net-phy-at803x-fix-at8033-sgmii-mode.patch @@ -21,9 +21,9 @@ Signed-off-by: Roman Yeryomin #define AT803X_PCS_SMART_EEE_CTRL3 0x805D #define AT803X_SMART_EEE_CTRL3_LPI_TX_DELAY_SEL_MASK 0x3 -@@ -275,6 +276,27 @@ static int at803x_config_init(struct phy +@@ -274,6 +275,27 @@ static void at803x_disable_smarteee(stru + static int at803x_config_init(struct phy_device *phydev) { - struct at803x_platform_data *pdata; int ret; + u32 v; + diff --git a/target/linux/generic/pending-5.4/736-net-phy-at803x-allow-to-configure-via-dt.patch b/target/linux/generic/pending-5.4/736-net-phy-at803x-allow-to-configure-via-dt.patch index a9f7fcf310..f18492d140 100644 --- a/target/linux/generic/pending-5.4/736-net-phy-at803x-allow-to-configure-via-dt.patch +++ b/target/linux/generic/pending-5.4/736-net-phy-at803x-allow-to-configure-via-dt.patch @@ -1,37 +1,8 @@ --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c -@@ -355,6 +355,7 @@ static void at803x_link_change_notify(st - { - struct at803x_platform_data *pdata; - pdata = dev_get_platdata(&phydev->mdio.dev); -+ u8 fixup_rgmii_tx_delay = 0; - - /* - * Conduct a hardware reset for AT8030/2 every time a link loss is -@@ -378,8 +379,18 @@ static void at803x_link_change_notify(st - phydev_dbg(phydev, "%s(): phy was reset\n", __func__); - } - -- if (pdata && pdata->fixup_rgmii_tx_delay && -- phydev->speed != priv->prev_speed) { -+ if (pdata && pdata->fixup_rgmii_tx_delay) -+ fixup_rgmii_tx_delay = 1; -+ -+#ifdef CONFIG_OF_MDIO -+ if (phydev->mdio.dev.of_node && -+ of_property_read_bool(phydev->mdio.dev.of_node, -+ "at803x-fixup-rgmii-tx-delay")) { -+ fixup_rgmii_tx_delay = 1; -+ } -+#endif -+ -+ if (fixup_rgmii_tx_delay && phydev->speed != priv->prev_speed) { - switch (phydev->speed) { - case SPEED_10: - case SPEED_100: -@@ -503,6 +514,14 @@ static int at803x_read_status(struct phy - AT803X_DEBUG_TX_CLK_DLY_EN, 0); - } +@@ -464,6 +464,14 @@ static int at803x_read_status(struct phy + if (pdata && pdata->disable_smarteee) + at803x_disable_smarteee(phydev); +#ifdef CONFIG_OF_MDIO + if (phydev->mdio.dev.of_node && -- 2.30.2