Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit c673ce2ce358f473e81292af6b59d6fdc62f5ade
- Author: Andre Przywara <andre.przywara@arm.com>
- Date: Tue Feb 28 22:23:35 2017 +0000
- PHY: faulty 8211E workaround
- diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
- index 9cbe645..331183f 100644
- --- a/drivers/net/phy/realtek.c
- +++ b/drivers/net/phy/realtek.c
- @@ -15,6 +15,7 @@
- */
- #include <linux/phy.h>
- #include <linux/module.h>
- +#include <linux/of.h>
- #define RTL821x_PHYSR 0x11
- #define RTL821x_PHYSR_DUPLEX 0x2000
- @@ -23,6 +24,8 @@
- #define RTL821x_INER_INIT 0x6400
- #define RTL821x_INSR 0x13
- #define RTL8211E_INER_LINK_STATUS 0x400
- +#define RTL8211E_EXTENSION_PAGE 0x7
- +#define RTL8211E_EXT_PAGE_SEL 0x1e
- #define RTL8211F_INER_LINK_STATUS 0x0010
- #define RTL8211F_INSR 0x1d
- @@ -67,6 +70,33 @@ static int rtl8211b_config_intr(struct phy_device *phydev)
- return err;
- }
- +static int rtl8211e_config_init(struct phy_device *phydev)
- +{
- + struct device_node *of_node = phydev->mdio.dev.of_node;
- +
- + if (!of_node)
- + return 0;
- +
- + if (!of_property_read_bool(of_node, "disable-rx-delay")) {
- + pr_info("8211E PHY, but no DT property\n");
- + return 0;
- + }
- +
- + /* This is a workaround for a batch of faulty PHY chips, found
- + * on a range of Pine64 boards. The RX delay needs to be disabled
- + * completely (the normal rx_delay of 0 programmable by the driver
- + * is not "short enough").
- + */
- + phy_write(phydev, RTL8211F_PAGE_SELECT, RTL8211E_EXTENSION_PAGE);
- + phy_write(phydev, RTL8211E_EXT_PAGE_SEL, 0x00a4);
- + /* Recommended by Realtek engineers, without further explanation. */
- + phy_write(phydev, 0x1c, 0xb591);
- + phy_write(phydev, RTL8211F_PAGE_SELECT, 0x0);
- + pr_info("Applied RTL8211E PHY fix to disable RX delay.\n");
- +
- + return 0;
- +}
- +
- static int rtl8211e_config_intr(struct phy_device *phydev)
- {
- int err;
- @@ -156,6 +186,7 @@ static struct phy_driver realtek_drvs[] = {
- .phy_id_mask = 0x001fffff,
- .features = PHY_GBIT_FEATURES,
- .flags = PHY_HAS_INTERRUPT,
- + .config_init = rtl8211e_config_init,
- .config_aneg = &genphy_config_aneg,
- .read_status = &genphy_read_status,
- .ack_interrupt = &rtl821x_ack_interrupt,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement