
On 5/1/07, David Updegraff dave@cray.com wrote:
Here is a first pass; not yet request for merge.
Only have been able to test with 8343 TSEC and an old SC520-based rtl8139 so far, and with only two concurrent downloads; against atftpd server. Re-cycling the existing ext2 bitmap functions to do housekeeping.
In about a month I should have access to enough hardware to test 20+ concurrent tftpboots.
Suggestions & comments appreciated.
I have to NACK this portion:
@@ -378,6 +378,28 @@ uint mii_parse_sr(uint mii_reg, struct tsec_private * priv) priv->link = 1; }
+ /* take a stab at 10/100 and Duplex info too; from linux mii.c */ + mii_reg = (read_phy_reg(priv, PHY_ANAR) & read_phy_reg(priv, PHY_ANLPAR)); + if ( mii_reg & PHY_ANLPAR_TXFD ) { + priv->duplexity = 1; + priv->speed = 100; + } + else if ( mii_reg & PHY_ANLPAR_TX ) { + priv->duplexity = 0; + priv->speed = 100; + } + else if ( mii_reg & PHY_ANLPAR_TX ) { + priv->duplexity = 0; + priv->speed = 100; + } + else if ( mii_reg & PHY_ANLPAR_10FD ) { + priv->duplexity = 1; + priv->speed = 10; + } else { + priv->duplexity = 0; + priv->speed = 10; + } + return 0; }
@@ -1056,6 +1078,26 @@ struct phy_info phy_info_VSC8244 = { {miim_end,} }, }; +/* a generic flavor. */ +struct phy_info phy_info_generic = { + 0, + "Unknown/Generic PHY", + 32, + (struct phy_cmd[]) { /* config */ + {PHY_BMCR, PHY_BMCR_RESET, NULL}, + {PHY_BMCR, PHY_BMCR_AUTON|PHY_BMCR_RST_NEG, NULL}, + {miim_end,} + }, + (struct phy_cmd[]) { /* startup */ + {PHY_BMSR, miim_read, NULL}, + {PHY_BMSR, miim_read, &mii_parse_sr}, + {miim_end,} + }, + (struct phy_cmd[]) { /* shutdown */ + {miim_end,} + } +}; +
struct phy_info phy_info_dm9161 = { 0x0181b88, @@ -1203,6 +1245,7 @@ struct phy_info *phy_info[] = { &phy_info_lxt971, &phy_info_VSC8244, &phy_info_dp83865, + &phy_info_generic, NULL };
Sadly, I've already applied it to my tree, but I've just determined that it breaks gigabit links, even on boards with known PHYs.
I'm going to fix that, but these two hunks need to be in a separate patch, anyway. I will post the updated version.
Andy