diff options
Diffstat (limited to 'drivers/net/phy/icplus.c')
-rw-r--r-- | drivers/net/phy/icplus.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/net/phy/icplus.c b/drivers/net/phy/icplus.c index d5199cb4caec..b5ddd5077a80 100644 --- a/drivers/net/phy/icplus.c +++ b/drivers/net/phy/icplus.c | |||
@@ -36,8 +36,9 @@ MODULE_LICENSE("GPL"); | |||
36 | 36 | ||
37 | /* IP101A/G - IP1001 */ | 37 | /* IP101A/G - IP1001 */ |
38 | #define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ | 38 | #define IP10XX_SPEC_CTRL_STATUS 16 /* Spec. Control Register */ |
39 | #define IP1001_RXPHASE_SEL (1<<0) /* Add delay on RX_CLK */ | ||
40 | #define IP1001_TXPHASE_SEL (1<<1) /* Add delay on TX_CLK */ | ||
39 | #define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ | 41 | #define IP1001_SPEC_CTRL_STATUS_2 20 /* IP1001 Spec. Control Reg 2 */ |
40 | #define IP1001_PHASE_SEL_MASK 3 /* IP1001 RX/TXPHASE_SEL */ | ||
41 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ | 42 | #define IP1001_APS_ON 11 /* IP1001 APS Mode bit */ |
42 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ | 43 | #define IP101A_G_APS_ON 2 /* IP101A/G APS Mode bit */ |
43 | #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ | 44 | #define IP101A_G_IRQ_CONF_STATUS 0x11 /* Conf Info IRQ & Status Reg */ |
@@ -138,19 +139,24 @@ static int ip1001_config_init(struct phy_device *phydev) | |||
138 | if (c < 0) | 139 | if (c < 0) |
139 | return c; | 140 | return c; |
140 | 141 | ||
141 | /* INTR pin used: speed/link/duplex will cause an interrupt */ | 142 | if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || |
142 | c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT); | 143 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || |
143 | if (c < 0) | 144 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || |
144 | return c; | 145 | (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) { |
145 | 146 | ||
146 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII) { | ||
147 | /* Additional delay (2ns) used to adjust RX clock phase | ||
148 | * at RGMII interface */ | ||
149 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); | 147 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); |
150 | if (c < 0) | 148 | if (c < 0) |
151 | return c; | 149 | return c; |
152 | 150 | ||
153 | c |= IP1001_PHASE_SEL_MASK; | 151 | c &= ~(IP1001_RXPHASE_SEL | IP1001_TXPHASE_SEL); |
152 | |||
153 | if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) | ||
154 | c |= (IP1001_RXPHASE_SEL | IP1001_TXPHASE_SEL); | ||
155 | else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) | ||
156 | c |= IP1001_RXPHASE_SEL; | ||
157 | else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) | ||
158 | c |= IP1001_TXPHASE_SEL; | ||
159 | |||
154 | c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); | 160 | c = phy_write(phydev, IP10XX_SPEC_CTRL_STATUS, c); |
155 | if (c < 0) | 161 | if (c < 0) |
156 | return c; | 162 | return c; |
@@ -167,6 +173,11 @@ static int ip101a_g_config_init(struct phy_device *phydev) | |||
167 | if (c < 0) | 173 | if (c < 0) |
168 | return c; | 174 | return c; |
169 | 175 | ||
176 | /* INTR pin used: speed/link/duplex will cause an interrupt */ | ||
177 | c = phy_write(phydev, IP101A_G_IRQ_CONF_STATUS, IP101A_G_IRQ_DEFAULT); | ||
178 | if (c < 0) | ||
179 | return c; | ||
180 | |||
170 | /* Enable Auto Power Saving mode */ | 181 | /* Enable Auto Power Saving mode */ |
171 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); | 182 | c = phy_read(phydev, IP10XX_SPEC_CTRL_STATUS); |
172 | c |= IP101A_G_APS_ON; | 183 | c |= IP101A_G_APS_ON; |