aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fec.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-25 19:59:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-25 19:59:51 -0400
commitb1cdc4670b9508fcd47a15fbd12f70d269880b37 (patch)
treefea9e2650170886d539488f8b1e064f6ca60ad36 /drivers/net/fec.c
parentce7d0226198aac42ed311dd2783232adc16b296d (diff)
parentf925b1303e0672effc78547353bd2ddfe11f5b5f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (63 commits) drivers/net/usb/asix.c: Fix pointer cast. be2net: Bug fix to avoid disabling bottom half during firmware upgrade. proc_dointvec: write a single value hso: add support for new products Phonet: fix potential use-after-free in pep_sock_close() ath9k: remove VEOL support for ad-hoc ath9k: change beacon allocation to prefer the first beacon slot sock.h: fix kernel-doc warning cls_cgroup: Fix build error when built-in macvlan: do proper cleanup in macvlan_common_newlink() V2 be2net: Bug fix in init code in probe net/dccp: expansion of error code size ath9k: Fix rx of mcast/bcast frames in PS mode with auto sleep wireless: fix sta_info.h kernel-doc warnings wireless: fix mac80211.h kernel-doc warnings iwlwifi: testing the wrong variable in iwl_add_bssid_station() ath9k_htc: rare leak in ath9k_hif_usb_alloc_tx_urbs() ath9k_htc: dereferencing before check in hif_usb_tx_cb() rt2x00: Fix rt2800usb TX descriptor writing. rt2x00: Fix failed SLEEP->AWAKE and AWAKE->SLEEP transitions. ...
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r--drivers/net/fec.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 42d9ac9ba39..326465ffbb2 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -41,6 +41,7 @@
41#include <linux/clk.h> 41#include <linux/clk.h>
42#include <linux/platform_device.h> 42#include <linux/platform_device.h>
43#include <linux/phy.h> 43#include <linux/phy.h>
44#include <linux/fec.h>
44 45
45#include <asm/cacheflush.h> 46#include <asm/cacheflush.h>
46 47
@@ -182,6 +183,7 @@ struct fec_enet_private {
182 struct phy_device *phy_dev; 183 struct phy_device *phy_dev;
183 int mii_timeout; 184 int mii_timeout;
184 uint phy_speed; 185 uint phy_speed;
186 phy_interface_t phy_interface;
185 int index; 187 int index;
186 int link; 188 int link;
187 int full_duplex; 189 int full_duplex;
@@ -1191,6 +1193,21 @@ fec_restart(struct net_device *dev, int duplex)
1191 /* Set MII speed */ 1193 /* Set MII speed */
1192 writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED); 1194 writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
1193 1195
1196#ifdef FEC_MIIGSK_ENR
1197 if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) {
1198 /* disable the gasket and wait */
1199 writel(0, fep->hwp + FEC_MIIGSK_ENR);
1200 while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4)
1201 udelay(1);
1202
1203 /* configure the gasket: RMII, 50 MHz, no loopback, no echo */
1204 writel(1, fep->hwp + FEC_MIIGSK_CFGR);
1205
1206 /* re-enable the gasket */
1207 writel(2, fep->hwp + FEC_MIIGSK_ENR);
1208 }
1209#endif
1210
1194 /* And last, enable the transmit and receive processing */ 1211 /* And last, enable the transmit and receive processing */
1195 writel(2, fep->hwp + FEC_ECNTRL); 1212 writel(2, fep->hwp + FEC_ECNTRL);
1196 writel(0, fep->hwp + FEC_R_DES_ACTIVE); 1213 writel(0, fep->hwp + FEC_R_DES_ACTIVE);
@@ -1226,6 +1243,7 @@ static int __devinit
1226fec_probe(struct platform_device *pdev) 1243fec_probe(struct platform_device *pdev)
1227{ 1244{
1228 struct fec_enet_private *fep; 1245 struct fec_enet_private *fep;
1246 struct fec_platform_data *pdata;
1229 struct net_device *ndev; 1247 struct net_device *ndev;
1230 int i, irq, ret = 0; 1248 int i, irq, ret = 0;
1231 struct resource *r; 1249 struct resource *r;
@@ -1259,6 +1277,10 @@ fec_probe(struct platform_device *pdev)
1259 1277
1260 platform_set_drvdata(pdev, ndev); 1278 platform_set_drvdata(pdev, ndev);
1261 1279
1280 pdata = pdev->dev.platform_data;
1281 if (pdata)
1282 fep->phy_interface = pdata->phy;
1283
1262 /* This device has up to three irqs on some platforms */ 1284 /* This device has up to three irqs on some platforms */
1263 for (i = 0; i < 3; i++) { 1285 for (i = 0; i < 3; i++) {
1264 irq = platform_get_irq(pdev, i); 1286 irq = platform_get_irq(pdev, i);