diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/fec.c | 49 |
1 files changed, 38 insertions, 11 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 03023dd17829..4e8df910c00d 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
48 | #include <asm/io.h> | 48 | #include <asm/io.h> |
49 | #include <asm/pgtable.h> | 49 | #include <asm/pgtable.h> |
50 | #include <asm/cacheflush.h> | ||
50 | 51 | ||
51 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || \ | 52 | #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || \ |
52 | defined(CONFIG_M5272) || defined(CONFIG_M528x) || \ | 53 | defined(CONFIG_M5272) || defined(CONFIG_M528x) || \ |
@@ -98,8 +99,6 @@ static unsigned char fec_mac_default[] = { | |||
98 | #define FEC_FLASHMAC 0xf0006006 | 99 | #define FEC_FLASHMAC 0xf0006006 |
99 | #elif defined(CONFIG_GILBARCONAP) || defined(CONFIG_SCALES) | 100 | #elif defined(CONFIG_GILBARCONAP) || defined(CONFIG_SCALES) |
100 | #define FEC_FLASHMAC 0xf0006000 | 101 | #define FEC_FLASHMAC 0xf0006000 |
101 | #elif defined (CONFIG_MTD_KeyTechnology) | ||
102 | #define FEC_FLASHMAC 0xffe04000 | ||
103 | #elif defined(CONFIG_CANCam) | 102 | #elif defined(CONFIG_CANCam) |
104 | #define FEC_FLASHMAC 0xf0020000 | 103 | #define FEC_FLASHMAC 0xf0020000 |
105 | #elif defined (CONFIG_M5272C3) | 104 | #elif defined (CONFIG_M5272C3) |
@@ -191,6 +190,8 @@ struct fec_enet_private { | |||
191 | /* Hardware registers of the FEC device */ | 190 | /* Hardware registers of the FEC device */ |
192 | volatile fec_t *hwp; | 191 | volatile fec_t *hwp; |
193 | 192 | ||
193 | struct net_device *netdev; | ||
194 | |||
194 | /* The saved address of a sent-in-place packet/buffer, for skfree(). */ | 195 | /* The saved address of a sent-in-place packet/buffer, for skfree(). */ |
195 | unsigned char *tx_bounce[TX_RING_SIZE]; | 196 | unsigned char *tx_bounce[TX_RING_SIZE]; |
196 | struct sk_buff* tx_skbuff[TX_RING_SIZE]; | 197 | struct sk_buff* tx_skbuff[TX_RING_SIZE]; |
@@ -1269,7 +1270,7 @@ static void __inline__ fec_request_intrs(struct net_device *dev) | |||
1269 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR3); | 1270 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR3); |
1270 | *icrp = 0x00000ddd; | 1271 | *icrp = 0x00000ddd; |
1271 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); | 1272 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); |
1272 | *icrp = (*icrp & 0x70777777) | 0x0d000000; | 1273 | *icrp = 0x0d000000; |
1273 | } | 1274 | } |
1274 | 1275 | ||
1275 | static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep) | 1276 | static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep) |
@@ -1331,7 +1332,7 @@ static void __inline__ fec_disable_phy_intr(void) | |||
1331 | { | 1332 | { |
1332 | volatile unsigned long *icrp; | 1333 | volatile unsigned long *icrp; |
1333 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); | 1334 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); |
1334 | *icrp = (*icrp & 0x70777777) | 0x08000000; | 1335 | *icrp = 0x08000000; |
1335 | } | 1336 | } |
1336 | 1337 | ||
1337 | static void __inline__ fec_phy_ack_intr(void) | 1338 | static void __inline__ fec_phy_ack_intr(void) |
@@ -1339,7 +1340,7 @@ static void __inline__ fec_phy_ack_intr(void) | |||
1339 | volatile unsigned long *icrp; | 1340 | volatile unsigned long *icrp; |
1340 | /* Acknowledge the interrupt */ | 1341 | /* Acknowledge the interrupt */ |
1341 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); | 1342 | icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); |
1342 | *icrp = (*icrp & 0x77777777) | 0x08000000; | 1343 | *icrp = 0x0d000000; |
1343 | } | 1344 | } |
1344 | 1345 | ||
1345 | static void __inline__ fec_localhw_setup(void) | 1346 | static void __inline__ fec_localhw_setup(void) |
@@ -1426,6 +1427,29 @@ static void __inline__ fec_request_intrs(struct net_device *dev) | |||
1426 | *gpio_pehlpar = 0xc0; | 1427 | *gpio_pehlpar = 0xc0; |
1427 | } | 1428 | } |
1428 | #endif | 1429 | #endif |
1430 | |||
1431 | #if defined(CONFIG_M527x) | ||
1432 | /* Set up gpio outputs for MII lines */ | ||
1433 | { | ||
1434 | volatile u8 *gpio_par_fec; | ||
1435 | volatile u16 *gpio_par_feci2c; | ||
1436 | |||
1437 | gpio_par_feci2c = (volatile u16 *)(MCF_IPSBAR + 0x100082); | ||
1438 | /* Set up gpio outputs for FEC0 MII lines */ | ||
1439 | gpio_par_fec = (volatile u8 *)(MCF_IPSBAR + 0x100078); | ||
1440 | |||
1441 | *gpio_par_feci2c |= 0x0f00; | ||
1442 | *gpio_par_fec |= 0xc0; | ||
1443 | |||
1444 | #if defined(CONFIG_FEC2) | ||
1445 | /* Set up gpio outputs for FEC1 MII lines */ | ||
1446 | gpio_par_fec = (volatile u8 *)(MCF_IPSBAR + 0x100079); | ||
1447 | |||
1448 | *gpio_par_feci2c |= 0x00a0; | ||
1449 | *gpio_par_fec |= 0xc0; | ||
1450 | #endif /* CONFIG_FEC2 */ | ||
1451 | } | ||
1452 | #endif /* CONFIG_M527x */ | ||
1429 | } | 1453 | } |
1430 | 1454 | ||
1431 | static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep) | 1455 | static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep) |
@@ -1940,9 +1964,10 @@ static void mii_display_status(struct net_device *dev) | |||
1940 | printk(".\n"); | 1964 | printk(".\n"); |
1941 | } | 1965 | } |
1942 | 1966 | ||
1943 | static void mii_display_config(struct net_device *dev) | 1967 | static void mii_display_config(struct work_struct *work) |
1944 | { | 1968 | { |
1945 | struct fec_enet_private *fep = netdev_priv(dev); | 1969 | struct fec_enet_private *fep = container_of(work, struct fec_enet_private, phy_task); |
1970 | struct net_device *dev = fep->netdev; | ||
1946 | uint status = fep->phy_status; | 1971 | uint status = fep->phy_status; |
1947 | 1972 | ||
1948 | /* | 1973 | /* |
@@ -1976,9 +2001,10 @@ static void mii_display_config(struct net_device *dev) | |||
1976 | fep->sequence_done = 1; | 2001 | fep->sequence_done = 1; |
1977 | } | 2002 | } |
1978 | 2003 | ||
1979 | static void mii_relink(struct net_device *dev) | 2004 | static void mii_relink(struct work_struct *work) |
1980 | { | 2005 | { |
1981 | struct fec_enet_private *fep = netdev_priv(dev); | 2006 | struct fec_enet_private *fep = container_of(work, struct fec_enet_private, phy_task); |
2007 | struct net_device *dev = fep->netdev; | ||
1982 | int duplex; | 2008 | int duplex; |
1983 | 2009 | ||
1984 | /* | 2010 | /* |
@@ -2022,7 +2048,7 @@ static void mii_queue_relink(uint mii_reg, struct net_device *dev) | |||
2022 | return; | 2048 | return; |
2023 | 2049 | ||
2024 | fep->mii_phy_task_queued = 1; | 2050 | fep->mii_phy_task_queued = 1; |
2025 | INIT_WORK(&fep->phy_task, (void*)mii_relink, dev); | 2051 | INIT_WORK(&fep->phy_task, mii_relink); |
2026 | schedule_work(&fep->phy_task); | 2052 | schedule_work(&fep->phy_task); |
2027 | } | 2053 | } |
2028 | 2054 | ||
@@ -2035,7 +2061,7 @@ static void mii_queue_config(uint mii_reg, struct net_device *dev) | |||
2035 | return; | 2061 | return; |
2036 | 2062 | ||
2037 | fep->mii_phy_task_queued = 1; | 2063 | fep->mii_phy_task_queued = 1; |
2038 | INIT_WORK(&fep->phy_task, (void*)mii_display_config, dev); | 2064 | INIT_WORK(&fep->phy_task, mii_display_config); |
2039 | schedule_work(&fep->phy_task); | 2065 | schedule_work(&fep->phy_task); |
2040 | } | 2066 | } |
2041 | 2067 | ||
@@ -2330,6 +2356,7 @@ int __init fec_enet_init(struct net_device *dev) | |||
2330 | 2356 | ||
2331 | fep->index = index; | 2357 | fep->index = index; |
2332 | fep->hwp = fecp; | 2358 | fep->hwp = fecp; |
2359 | fep->netdev = dev; | ||
2333 | 2360 | ||
2334 | /* Whack a reset. We should wait for this. | 2361 | /* Whack a reset. We should wait for this. |
2335 | */ | 2362 | */ |