Message ID | 20180806142104.17392-3-mail@david-bauer.net |
---|---|
State | Accepted |
Delegated to: | John Crispin |
Headers | show |
Series | [OpenWrt-Devel,1/4] uboot-envtools: add ath79 target | expand |
On 06/08/18 16:21, David Bauer wrote: > This commit adds the ability to configure specific functions of the > at803x series ethernet-PHYs, which were previously configured > exclusively with the help of platform-data, via device-tree. > > This is needed to fully support existing boards of the ar71xx platform. > > Signed-off-by: David Bauer <mail@david-bauer.net> > --- > ...phy-at803x-allow-to-configure-via-dt.patch | 49 +++++++++++++++++++ > 1 file changed, 49 insertions(+) > create mode 100644 target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch > > diff --git a/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch b/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch > new file mode 100644 > index 0000000000..daff25b633 > --- /dev/null > +++ b/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch > @@ -0,0 +1,49 @@ > +Index: linux-4.14.60/drivers/net/phy/at803x.c > +=================================================================== > +--- linux-4.14.60.orig/drivers/net/phy/at803x.c > ++++ linux-4.14.60/drivers/net/phy/at803x.c > +@@ -354,6 +354,14 @@ static int at803x_config_init(struct phy > + AT803X_DEBUG_TX_CLK_DLY_EN, 0); > + } > + > ++#ifdef CONFIG_OF_MDIO the ifdef seems superfluous and again this should be part of the at803x_priv struct. however looking at the current code it seems that the patchery is inconsistent and the driver is pretty messy. we should consider cleaning this up and consolidating the driver patches and move them to generic/ John > ++ if (phydev->mdio.dev.of_node && > ++ of_property_read_bool(phydev->mdio.dev.of_node, > ++ "at803x-disable-smarteee")) { > ++ at803x_disable_smarteee(phydev); > ++ } > ++#endif > ++ > + return 0; > + } > + > +@@ -392,6 +400,7 @@ static void at803x_link_change_notify(st > + { > + struct at803x_priv *priv = phydev->priv; > + struct at803x_platform_data *pdata; > ++ u8 fixup_rgmii_tx_delay = 0; > + pdata = dev_get_platdata(&phydev->mdio.dev); > + > + /* > +@@ -421,8 +430,19 @@ static void at803x_link_change_notify(st > + } else { > + priv->phy_reset = false; > + } > +- 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:
diff --git a/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch b/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch new file mode 100644 index 0000000000..daff25b633 --- /dev/null +++ b/target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch @@ -0,0 +1,49 @@ +Index: linux-4.14.60/drivers/net/phy/at803x.c +=================================================================== +--- linux-4.14.60.orig/drivers/net/phy/at803x.c ++++ linux-4.14.60/drivers/net/phy/at803x.c +@@ -354,6 +354,14 @@ static int at803x_config_init(struct phy + AT803X_DEBUG_TX_CLK_DLY_EN, 0); + } + ++#ifdef CONFIG_OF_MDIO ++ if (phydev->mdio.dev.of_node && ++ of_property_read_bool(phydev->mdio.dev.of_node, ++ "at803x-disable-smarteee")) { ++ at803x_disable_smarteee(phydev); ++ } ++#endif ++ + return 0; + } + +@@ -392,6 +400,7 @@ static void at803x_link_change_notify(st + { + struct at803x_priv *priv = phydev->priv; + struct at803x_platform_data *pdata; ++ u8 fixup_rgmii_tx_delay = 0; + pdata = dev_get_platdata(&phydev->mdio.dev); + + /* +@@ -421,8 +430,19 @@ static void at803x_link_change_notify(st + } else { + priv->phy_reset = false; + } +- 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:
This commit adds the ability to configure specific functions of the at803x series ethernet-PHYs, which were previously configured exclusively with the help of platform-data, via device-tree. This is needed to fully support existing boards of the ar71xx platform. Signed-off-by: David Bauer <mail@david-bauer.net> --- ...phy-at803x-allow-to-configure-via-dt.patch | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 target/linux/generic/pending-4.14/736-net-phy-at803x-allow-to-configure-via-dt.patch