]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tsec: Add support for BCM5482S PHY
authorZach LeRoy <zleroy@xes-inc.com>
Fri, 22 May 2009 15:26:33 +0000 (10:26 -0500)
committerBen Warren <biggerbadderben@gmail.com>
Mon, 15 Jun 2009 07:13:54 +0000 (00:13 -0700)
Signed-off-by: Zach LeRoy <zleroy@xes-inc.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
drivers/net/tsec.c
include/tsec.h

index 399116f3a258c6540fe13c6f88d778847719bd83..63fc02e44d1be1980145e0382772ee9ad4022855 100644 (file)
@@ -467,6 +467,18 @@ uint mii_parse_link(uint mii_reg, struct tsec_private *priv)
        return 0;
 }
 
+/*
+ * "Ethernet@Wirespeed" needs to be enabled to achieve link in certain
+ * circumstances.  eg a gigabit TSEC connected to a gigabit switch with
+ * a 4-wire ethernet cable.  Both ends advertise gigabit, but can't
+ * link.  "Ethernet@Wirespeed" reduces advertised speed until link
+ * can be achieved.
+ */
+uint mii_BCM54xx_wirespeed(uint mii_reg, struct tsec_private *priv)
+{
+       return (read_phy_reg(priv, mii_reg) & 0x8FFF) | 0x8010;
+}
+
 /*
  * Parse the BCM54xx status register for speed and duplex information.
  * The linux sungem_phy has this information, but in a table format.
@@ -1070,6 +1082,34 @@ struct phy_info phy_info_BCM5464S = {
        },
 };
 
+struct phy_info phy_info_BCM5482S =  {
+       0x0143bcb,
+       "Broadcom BCM5482S",
+       4,
+       (struct phy_cmd[]) { /* config */
+               /* Reset and configure the PHY */
+               {MIIM_CONTROL, MIIM_CONTROL_RESET, NULL},
+               /* Setup read from auxilary control shadow register 7 */
+               {MIIM_BCM54xx_AUXCNTL, MIIM_BCM54xx_AUXCNTL_ENCODE(7), NULL},
+               /* Read Misc Control register and or in Ethernet@Wirespeed */
+               {MIIM_BCM54xx_AUXCNTL, 0, &mii_BCM54xx_wirespeed},
+               {MIIM_CONTROL, MIIM_CONTROL_INIT, &mii_cr_init},
+               {miim_end,}
+       },
+       (struct phy_cmd[]) { /* startup */
+               /* Status is read once to clear old link state */
+               {MIIM_STATUS, miim_read, NULL},
+               /* Auto-negotiate */
+               {MIIM_STATUS, miim_read, &mii_parse_sr},
+               /* Read the status */
+               {MIIM_BCM54xx_AUXSTATUS, miim_read, &mii_parse_BCM54xx_sr},
+               {miim_end,}
+       },
+       (struct phy_cmd[]) { /* shutdown */
+               {miim_end,}
+       },
+};
+
 struct phy_info phy_info_M88E1011S = {
        0x01410c6,
        "Marvell 88E1011S",
@@ -1611,6 +1651,7 @@ struct phy_info *phy_info[] = {
        &phy_info_cis8201,
        &phy_info_BCM5461S,
        &phy_info_BCM5464S,
+       &phy_info_BCM5482S,
        &phy_info_M88E1011S,
        &phy_info_M88E1111S,
        &phy_info_M88E1118,
index 9184256b577ef1ecd583d2e13f16a4ccb9da6c85..0ac303406060565543825748f9edb6177dd8d683 100644 (file)
 #define MIIM_EXT_PAGE_ACCESS   0x1f
 
 /* Broadcom BCM54xx -- taken from linux sungem_phy */
+#define MIIM_BCM54xx_AUXCNTL                   0x18
+#define MIIM_BCM54xx_AUXCNTL_ENCODE(val)       ((val & 0x7) << 12)|(val & 0x7)
 #define MIIM_BCM54xx_AUXSTATUS                 0x19
 #define MIIM_BCM54xx_AUXSTATUS_LINKMODE_MASK   0x0700
 #define MIIM_BCM54xx_AUXSTATUS_LINKMODE_SHIFT  8