aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2009-02-27 01:42:51 -0500
committerDavid S. Miller <davem@davemloft.net>2009-02-27 01:42:51 -0500
commit43be63662db56de3f87cb4a86bfe062a9797be65 (patch)
tree31f68005e1f165be66209d76bd2c430e882ddbec /drivers
parentffba3f48bcd2d8af0570e7d4ce9b86fc4de9b10d (diff)
m68knommu: remove ColdFire specific setup code from FEC driver
Remove the ColdFire CPU specific setup from here. The ColdFire CPU platform code now sets up all this. Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/fec.c512
1 files changed, 12 insertions, 500 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index fe2650237e34..a515acccc61f 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -57,36 +57,11 @@
57#define FEC_ALIGNMENT 0x3 57#define FEC_ALIGNMENT 0x3
58#endif 58#endif
59 59
60#if defined CONFIG_M5272 || defined CONFIG_M527x || defined CONFIG_M523x \
61 || defined CONFIG_M528x || defined CONFIG_M532x || defined CONFIG_M520x
62#define FEC_LEGACY
63/* 60/*
64 * Define the fixed address of the FEC hardware. 61 * Define the fixed address of the FEC hardware.
65 */ 62 */
66#if defined(CONFIG_M5272) 63#if defined(CONFIG_M5272)
67#define HAVE_mii_link_interrupt 64#define HAVE_mii_link_interrupt
68#endif
69
70#if defined(CONFIG_FEC2)
71#define FEC_MAX_PORTS 2
72#else
73#define FEC_MAX_PORTS 1
74#endif
75
76static unsigned int fec_hw[] = {
77#if defined(CONFIG_M5272)
78 (MCF_MBAR + 0x840),
79#elif defined(CONFIG_M527x)
80 (MCF_MBAR + 0x1000),
81 (MCF_MBAR + 0x1800),
82#elif defined(CONFIG_M523x) || defined(CONFIG_M528x)
83 (MCF_MBAR + 0x1000),
84#elif defined(CONFIG_M520x)
85 (MCF_MBAR+0x30000),
86#elif defined(CONFIG_M532x)
87 (MCF_MBAR+0xfc030000),
88#endif
89};
90 65
91static unsigned char fec_mac_default[] = { 66static unsigned char fec_mac_default[] = {
92 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -109,8 +84,7 @@ static unsigned char fec_mac_default[] = {
109#else 84#else
110#define FEC_FLASHMAC 0 85#define FEC_FLASHMAC 0
111#endif 86#endif
112 87#endif /* CONFIG_M5272 */
113#endif /* FEC_LEGACY */
114 88
115/* Forward declarations of some structures to support different PHYs 89/* Forward declarations of some structures to support different PHYs
116*/ 90*/
@@ -1242,89 +1216,14 @@ static phy_info_t const * const phy_info[] = {
1242#ifdef HAVE_mii_link_interrupt 1216#ifdef HAVE_mii_link_interrupt
1243static irqreturn_t 1217static irqreturn_t
1244mii_link_interrupt(int irq, void * dev_id); 1218mii_link_interrupt(int irq, void * dev_id);
1245#endif
1246 1219
1247#if defined(CONFIG_M5272)
1248/* 1220/*
1249 * Code specific to Coldfire 5272 setup. 1221 * This is specific to the MII interrupt setup of the M5272EVB.
1250 */ 1222 */
1251static void __inline__ fec_request_intrs(struct net_device *dev) 1223static void __inline__ fec_request_mii_intr(struct net_device *dev)
1252{ 1224{
1253 volatile unsigned long *icrp; 1225 if (request_irq(66, mii_link_interrupt, IRQF_DISABLED, "fec(MII)", dev) != 0)
1254 static const struct idesc { 1226 printk("FEC: Could not allocate fec(MII) IRQ(66)!\n");
1255 char *name;
1256 unsigned short irq;
1257 irq_handler_t handler;
1258 } *idp, id[] = {
1259 { "fec(RX)", 86, fec_enet_interrupt },
1260 { "fec(TX)", 87, fec_enet_interrupt },
1261 { "fec(OTHER)", 88, fec_enet_interrupt },
1262 { "fec(MII)", 66, mii_link_interrupt },
1263 { NULL },
1264 };
1265
1266 /* Setup interrupt handlers. */
1267 for (idp = id; idp->name; idp++) {
1268 if (request_irq(idp->irq, idp->handler, IRQF_DISABLED, idp->name, dev) != 0)
1269 printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, idp->irq);
1270 }
1271
1272 /* Unmask interrupt at ColdFire 5272 SIM */
1273 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR3);
1274 *icrp = 0x00000ddd;
1275 icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
1276 *icrp = 0x0d000000;
1277}
1278
1279static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
1280{
1281 volatile fec_t *fecp;
1282
1283 fecp = fep->hwp;
1284 fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04;
1285 fecp->fec_x_cntrl = 0x00;
1286
1287 /*
1288 * Set MII speed to 2.5 MHz
1289 * See 5272 manual section 11.5.8: MSCR
1290 */
1291 fep->phy_speed = ((((MCF_CLK / 4) / (2500000 / 10)) + 5) / 10) * 2;
1292 fecp->fec_mii_speed = fep->phy_speed;
1293
1294 fec_restart(dev, 0);
1295}
1296
1297static void __inline__ fec_get_mac(struct net_device *dev)
1298{
1299 struct fec_enet_private *fep = netdev_priv(dev);
1300 volatile fec_t *fecp;
1301 unsigned char *iap, tmpaddr[ETH_ALEN];
1302
1303 fecp = fep->hwp;
1304
1305 if (FEC_FLASHMAC) {
1306 /*
1307 * Get MAC address from FLASH.
1308 * If it is all 1's or 0's, use the default.
1309 */
1310 iap = (unsigned char *)FEC_FLASHMAC;
1311 if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) &&
1312 (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0))
1313 iap = fec_mac_default;
1314 if ((iap[0] == 0xff) && (iap[1] == 0xff) && (iap[2] == 0xff) &&
1315 (iap[3] == 0xff) && (iap[4] == 0xff) && (iap[5] == 0xff))
1316 iap = fec_mac_default;
1317 } else {
1318 *((unsigned long *) &tmpaddr[0]) = fecp->fec_addr_low;
1319 *((unsigned short *) &tmpaddr[4]) = (fecp->fec_addr_high >> 16);
1320 iap = &tmpaddr[0];
1321 }
1322
1323 memcpy(dev->dev_addr, iap, ETH_ALEN);
1324
1325 /* Adjust MAC if using default MAC address */
1326 if (iap == fec_mac_default)
1327 dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
1328} 1227}
1329 1228
1330static void __inline__ fec_disable_phy_intr(void) 1229static void __inline__ fec_disable_phy_intr(void)
@@ -1342,218 +1241,7 @@ static void __inline__ fec_phy_ack_intr(void)
1342 *icrp = 0x0d000000; 1241 *icrp = 0x0d000000;
1343} 1242}
1344 1243
1345/* ------------------------------------------------------------------------- */ 1244#ifdef CONFIG_M5272
1346
1347#elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
1348
1349/*
1350 * Code specific to Coldfire 5230/5231/5232/5234/5235,
1351 * the 5270/5271/5274/5275 and 5280/5282 setups.
1352 */
1353static void __inline__ fec_request_intrs(struct net_device *dev)
1354{
1355 struct fec_enet_private *fep;
1356 int b;
1357 static const struct idesc {
1358 char *name;
1359 unsigned short irq;
1360 } *idp, id[] = {
1361 { "fec(TXF)", 23 },
1362 { "fec(RXF)", 27 },
1363 { "fec(MII)", 29 },
1364 { NULL },
1365 };
1366
1367 fep = netdev_priv(dev);
1368 b = (fep->index) ? 128 : 64;
1369
1370 /* Setup interrupt handlers. */
1371 for (idp = id; idp->name; idp++) {
1372 if (request_irq(b+idp->irq, fec_enet_interrupt, IRQF_DISABLED, idp->name, dev) != 0)
1373 printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, b+idp->irq);
1374 }
1375
1376 /* Unmask interrupts at ColdFire 5280/5282 interrupt controller */
1377 {
1378 volatile unsigned char *icrp;
1379 volatile unsigned long *imrp;
1380 int i, ilip;
1381
1382 b = (fep->index) ? MCFICM_INTC1 : MCFICM_INTC0;
1383 icrp = (volatile unsigned char *) (MCF_IPSBAR + b +
1384 MCFINTC_ICR0);
1385 for (i = 23, ilip = 0x28; (i < 36); i++)
1386 icrp[i] = ilip--;
1387
1388 imrp = (volatile unsigned long *) (MCF_IPSBAR + b +
1389 MCFINTC_IMRH);
1390 *imrp &= ~0x0000000f;
1391 imrp = (volatile unsigned long *) (MCF_IPSBAR + b +
1392 MCFINTC_IMRL);
1393 *imrp &= ~0xff800001;
1394 }
1395
1396#if defined(CONFIG_M528x)
1397 /* Set up gpio outputs for MII lines */
1398 {
1399 volatile u16 *gpio_paspar;
1400 volatile u8 *gpio_pehlpar;
1401
1402 gpio_paspar = (volatile u16 *) (MCF_IPSBAR + 0x100056);
1403 gpio_pehlpar = (volatile u16 *) (MCF_IPSBAR + 0x100058);
1404 *gpio_paspar |= 0x0f00;
1405 *gpio_pehlpar = 0xc0;
1406 }
1407#endif
1408
1409#if defined(CONFIG_M527x)
1410 /* Set up gpio outputs for MII lines */
1411 {
1412 volatile u8 *gpio_par_fec;
1413 volatile u16 *gpio_par_feci2c;
1414
1415 gpio_par_feci2c = (volatile u16 *)(MCF_IPSBAR + 0x100082);
1416 /* Set up gpio outputs for FEC0 MII lines */
1417 gpio_par_fec = (volatile u8 *)(MCF_IPSBAR + 0x100078);
1418
1419 *gpio_par_feci2c |= 0x0f00;
1420 *gpio_par_fec |= 0xc0;
1421
1422#if defined(CONFIG_FEC2)
1423 /* Set up gpio outputs for FEC1 MII lines */
1424 gpio_par_fec = (volatile u8 *)(MCF_IPSBAR + 0x100079);
1425
1426 *gpio_par_feci2c |= 0x00a0;
1427 *gpio_par_fec |= 0xc0;
1428#endif /* CONFIG_FEC2 */
1429 }
1430#endif /* CONFIG_M527x */
1431}
1432
1433static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
1434{
1435 volatile fec_t *fecp;
1436
1437 fecp = fep->hwp;
1438 fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04;
1439 fecp->fec_x_cntrl = 0x00;
1440
1441 /*
1442 * Set MII speed to 2.5 MHz
1443 * See 5282 manual section 17.5.4.7: MSCR
1444 */
1445 fep->phy_speed = ((((MCF_CLK / 2) / (2500000 / 10)) + 5) / 10) * 2;
1446 fecp->fec_mii_speed = fep->phy_speed;
1447
1448 fec_restart(dev, 0);
1449}
1450
1451static void __inline__ fec_get_mac(struct net_device *dev)
1452{
1453 struct fec_enet_private *fep = netdev_priv(dev);
1454 volatile fec_t *fecp;
1455 unsigned char *iap, tmpaddr[ETH_ALEN];
1456
1457 fecp = fep->hwp;
1458
1459 if (FEC_FLASHMAC) {
1460 /*
1461 * Get MAC address from FLASH.
1462 * If it is all 1's or 0's, use the default.
1463 */
1464 iap = FEC_FLASHMAC;
1465 if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) &&
1466 (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0))
1467 iap = fec_mac_default;
1468 if ((iap[0] == 0xff) && (iap[1] == 0xff) && (iap[2] == 0xff) &&
1469 (iap[3] == 0xff) && (iap[4] == 0xff) && (iap[5] == 0xff))
1470 iap = fec_mac_default;
1471 } else {
1472 *((unsigned long *) &tmpaddr[0]) = fecp->fec_addr_low;
1473 *((unsigned short *) &tmpaddr[4]) = (fecp->fec_addr_high >> 16);
1474 iap = &tmpaddr[0];
1475 }
1476
1477 memcpy(dev->dev_addr, iap, ETH_ALEN);
1478
1479 /* Adjust MAC if using default MAC address */
1480 if (iap == fec_mac_default)
1481 dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
1482}
1483
1484static void __inline__ fec_disable_phy_intr(void)
1485{
1486}
1487
1488static void __inline__ fec_phy_ack_intr(void)
1489{
1490}
1491
1492/* ------------------------------------------------------------------------- */
1493
1494#elif defined(CONFIG_M520x)
1495
1496/*
1497 * Code specific to Coldfire 520x
1498 */
1499static void __inline__ fec_request_intrs(struct net_device *dev)
1500{
1501 struct fec_enet_private *fep;
1502 int b;
1503 static const struct idesc {
1504 char *name;
1505 unsigned short irq;
1506 } *idp, id[] = {
1507 { "fec(TXF)", 23 },
1508 { "fec(RXF)", 27 },
1509 { "fec(MII)", 29 },
1510 { NULL },
1511 };
1512
1513 fep = netdev_priv(dev);
1514 b = 64 + 13;
1515
1516 /* Setup interrupt handlers. */
1517 for (idp = id; idp->name; idp++) {
1518 if (request_irq(b+idp->irq, fec_enet_interrupt, IRQF_DISABLED, idp->name,dev) != 0)
1519 printk("FEC: Could not allocate %s IRQ(%d)!\n", idp->name, b+idp->irq);
1520 }
1521
1522 /* Unmask interrupts at ColdFire interrupt controller */
1523 {
1524 volatile unsigned char *icrp;
1525 volatile unsigned long *imrp;
1526
1527 icrp = (volatile unsigned char *) (MCF_IPSBAR + MCFICM_INTC0 +
1528 MCFINTC_ICR0);
1529 for (b = 36; (b < 49); b++)
1530 icrp[b] = 0x04;
1531 imrp = (volatile unsigned long *) (MCF_IPSBAR + MCFICM_INTC0 +
1532 MCFINTC_IMRH);
1533 *imrp &= ~0x0001FFF0;
1534 }
1535 *(volatile unsigned char *)(MCF_IPSBAR + MCF_GPIO_PAR_FEC) |= 0xf0;
1536 *(volatile unsigned char *)(MCF_IPSBAR + MCF_GPIO_PAR_FECI2C) |= 0x0f;
1537}
1538
1539static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
1540{
1541 volatile fec_t *fecp;
1542
1543 fecp = fep->hwp;
1544 fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04;
1545 fecp->fec_x_cntrl = 0x00;
1546
1547 /*
1548 * Set MII speed to 2.5 MHz
1549 * See 5282 manual section 17.5.4.7: MSCR
1550 */
1551 fep->phy_speed = ((((MCF_CLK / 2) / (2500000 / 10)) + 5) / 10) * 2;
1552 fecp->fec_mii_speed = fep->phy_speed;
1553
1554 fec_restart(dev, 0);
1555}
1556
1557static void __inline__ fec_get_mac(struct net_device *dev) 1245static void __inline__ fec_get_mac(struct net_device *dev)
1558{ 1246{
1559 struct fec_enet_private *fep = netdev_priv(dev); 1247 struct fec_enet_private *fep = netdev_priv(dev);
@@ -1567,134 +1255,7 @@ static void __inline__ fec_get_mac(struct net_device *dev)
1567 * Get MAC address from FLASH. 1255 * Get MAC address from FLASH.
1568 * If it is all 1's or 0's, use the default. 1256 * If it is all 1's or 0's, use the default.
1569 */ 1257 */
1570 iap = FEC_FLASHMAC; 1258 iap = (unsigned char *)FEC_FLASHMAC;
1571 if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) &&
1572 (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0))
1573 iap = fec_mac_default;
1574 if ((iap[0] == 0xff) && (iap[1] == 0xff) && (iap[2] == 0xff) &&
1575 (iap[3] == 0xff) && (iap[4] == 0xff) && (iap[5] == 0xff))
1576 iap = fec_mac_default;
1577 } else {
1578 *((unsigned long *) &tmpaddr[0]) = fecp->fec_addr_low;
1579 *((unsigned short *) &tmpaddr[4]) = (fecp->fec_addr_high >> 16);
1580 iap = &tmpaddr[0];
1581 }
1582
1583 memcpy(dev->dev_addr, iap, ETH_ALEN);
1584
1585 /* Adjust MAC if using default MAC address */
1586 if (iap == fec_mac_default)
1587 dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
1588}
1589
1590static void __inline__ fec_disable_phy_intr(void)
1591{
1592}
1593
1594static void __inline__ fec_phy_ack_intr(void)
1595{
1596}
1597
1598/* ------------------------------------------------------------------------- */
1599
1600#elif defined(CONFIG_M532x)
1601/*
1602 * Code specific for M532x
1603 */
1604static void __inline__ fec_request_intrs(struct net_device *dev)
1605{
1606 struct fec_enet_private *fep;
1607 int b;
1608 static const struct idesc {
1609 char *name;
1610 unsigned short irq;
1611 } *idp, id[] = {
1612 { "fec(TXF)", 36 },
1613 { "fec(RXF)", 40 },
1614 { "fec(MII)", 42 },
1615 { NULL },
1616 };
1617
1618 fep = netdev_priv(dev);
1619 b = (fep->index) ? 128 : 64;
1620
1621 /* Setup interrupt handlers. */
1622 for (idp = id; idp->name; idp++) {
1623 if (request_irq(b+idp->irq, fec_enet_interrupt, IRQF_DISABLED, idp->name,dev) != 0)
1624 printk("FEC: Could not allocate %s IRQ(%d)!\n",
1625 idp->name, b+idp->irq);
1626 }
1627
1628 /* Unmask interrupts */
1629 MCF_INTC0_ICR36 = 0x2;
1630 MCF_INTC0_ICR37 = 0x2;
1631 MCF_INTC0_ICR38 = 0x2;
1632 MCF_INTC0_ICR39 = 0x2;
1633 MCF_INTC0_ICR40 = 0x2;
1634 MCF_INTC0_ICR41 = 0x2;
1635 MCF_INTC0_ICR42 = 0x2;
1636 MCF_INTC0_ICR43 = 0x2;
1637 MCF_INTC0_ICR44 = 0x2;
1638 MCF_INTC0_ICR45 = 0x2;
1639 MCF_INTC0_ICR46 = 0x2;
1640 MCF_INTC0_ICR47 = 0x2;
1641 MCF_INTC0_ICR48 = 0x2;
1642
1643 MCF_INTC0_IMRH &= ~(
1644 MCF_INTC_IMRH_INT_MASK36 |
1645 MCF_INTC_IMRH_INT_MASK37 |
1646 MCF_INTC_IMRH_INT_MASK38 |
1647 MCF_INTC_IMRH_INT_MASK39 |
1648 MCF_INTC_IMRH_INT_MASK40 |
1649 MCF_INTC_IMRH_INT_MASK41 |
1650 MCF_INTC_IMRH_INT_MASK42 |
1651 MCF_INTC_IMRH_INT_MASK43 |
1652 MCF_INTC_IMRH_INT_MASK44 |
1653 MCF_INTC_IMRH_INT_MASK45 |
1654 MCF_INTC_IMRH_INT_MASK46 |
1655 MCF_INTC_IMRH_INT_MASK47 |
1656 MCF_INTC_IMRH_INT_MASK48 );
1657
1658 /* Set up gpio outputs for MII lines */
1659 MCF_GPIO_PAR_FECI2C |= (0 |
1660 MCF_GPIO_PAR_FECI2C_PAR_MDC_EMDC |
1661 MCF_GPIO_PAR_FECI2C_PAR_MDIO_EMDIO);
1662 MCF_GPIO_PAR_FEC = (0 |
1663 MCF_GPIO_PAR_FEC_PAR_FEC_7W_FEC |
1664 MCF_GPIO_PAR_FEC_PAR_FEC_MII_FEC);
1665}
1666
1667static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
1668{
1669 volatile fec_t *fecp;
1670
1671 fecp = fep->hwp;
1672 fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04;
1673 fecp->fec_x_cntrl = 0x00;
1674
1675 /*
1676 * Set MII speed to 2.5 MHz
1677 */
1678 fep->phy_speed = (MCF_CLK / 3) / (2500000 * 2 ) * 2;
1679 fecp->fec_mii_speed = fep->phy_speed;
1680
1681 fec_restart(dev, 0);
1682}
1683
1684static void __inline__ fec_get_mac(struct net_device *dev)
1685{
1686 struct fec_enet_private *fep = netdev_priv(dev);
1687 volatile fec_t *fecp;
1688 unsigned char *iap, tmpaddr[ETH_ALEN];
1689
1690 fecp = fep->hwp;
1691
1692 if (FEC_FLASHMAC) {
1693 /*
1694 * Get MAC address from FLASH.
1695 * If it is all 1's or 0's, use the default.
1696 */
1697 iap = FEC_FLASHMAC;
1698 if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) && 1259 if ((iap[0] == 0) && (iap[1] == 0) && (iap[2] == 0) &&
1699 (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0)) 1260 (iap[3] == 0) && (iap[4] == 0) && (iap[5] == 0))
1700 iap = fec_mac_default; 1261 iap = fec_mac_default;
@@ -1711,17 +1272,8 @@ static void __inline__ fec_get_mac(struct net_device *dev)
1711 1272
1712 /* Adjust MAC if using default MAC address */ 1273 /* Adjust MAC if using default MAC address */
1713 if (iap == fec_mac_default) 1274 if (iap == fec_mac_default)
1714 dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index; 1275 dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
1715}
1716
1717static void __inline__ fec_disable_phy_intr(void)
1718{
1719}
1720
1721static void __inline__ fec_phy_ack_intr(void)
1722{
1723} 1276}
1724
1725#endif 1277#endif
1726 1278
1727/* ------------------------------------------------------------------------- */ 1279/* ------------------------------------------------------------------------- */
@@ -1927,7 +1479,7 @@ mii_discover_phy(uint mii_reg, struct net_device *dev)
1927 printk("FEC: No PHY device found.\n"); 1479 printk("FEC: No PHY device found.\n");
1928 /* Disable external MII interface */ 1480 /* Disable external MII interface */
1929 fecp->fec_mii_speed = fep->phy_speed = 0; 1481 fecp->fec_mii_speed = fep->phy_speed = 0;
1930#ifdef FREC_LEGACY 1482#ifdef HAVE_mii_link_interrupt
1931 fec_disable_phy_intr(); 1483 fec_disable_phy_intr();
1932#endif 1484#endif
1933 } 1485 }
@@ -2151,7 +1703,7 @@ int __init fec_enet_init(struct net_device *dev, int index)
2151 udelay(10); 1703 udelay(10);
2152 1704
2153 /* Set the Ethernet address */ 1705 /* Set the Ethernet address */
2154#ifdef FEC_LEGACY 1706#ifdef CONFIG_M5272
2155 fec_get_mac(dev); 1707 fec_get_mac(dev);
2156#else 1708#else
2157 { 1709 {
@@ -2235,11 +1787,8 @@ int __init fec_enet_init(struct net_device *dev, int index)
2235 fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t) 1787 fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t)
2236 * RX_RING_SIZE; 1788 * RX_RING_SIZE;
2237 1789
2238#ifdef FEC_LEGACY 1790#ifdef HAVE_mii_link_interrupt
2239 /* Install our interrupt handlers. This varies depending on 1791 fec_request_mii_intr(dev);
2240 * the architecture.
2241 */
2242 fec_request_intrs(dev);
2243#endif 1792#endif
2244 1793
2245 fecp->fec_grp_hash_table_high = 0; 1794 fecp->fec_grp_hash_table_high = 0;
@@ -2265,9 +1814,6 @@ int __init fec_enet_init(struct net_device *dev, int index)
2265 mii_free = mii_cmds; 1814 mii_free = mii_cmds;
2266 1815
2267 /* setup MII interface */ 1816 /* setup MII interface */
2268#ifdef FEC_LEGACY
2269 fec_set_mii(dev, fep);
2270#else
2271 fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04; 1817 fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04;
2272 fecp->fec_x_cntrl = 0x00; 1818 fecp->fec_x_cntrl = 0x00;
2273 1819
@@ -2278,7 +1824,6 @@ int __init fec_enet_init(struct net_device *dev, int index)
2278 / 2500000) / 2) & 0x3F) << 1; 1824 / 2500000) / 2) & 0x3F) << 1;
2279 fecp->fec_mii_speed = fep->phy_speed; 1825 fecp->fec_mii_speed = fep->phy_speed;
2280 fec_restart(dev, 0); 1826 fec_restart(dev, 0);
2281#endif
2282 1827
2283 /* Clear and enable interrupts */ 1828 /* Clear and enable interrupts */
2284 fecp->fec_ievent = 0xffc00000; 1829 fecp->fec_ievent = 0xffc00000;
@@ -2442,36 +1987,6 @@ fec_stop(struct net_device *dev)
2442 fecp->fec_mii_speed = fep->phy_speed; 1987 fecp->fec_mii_speed = fep->phy_speed;
2443} 1988}
2444 1989
2445#ifdef FEC_LEGACY
2446static int __init fec_enet_module_init(void)
2447{
2448 struct net_device *dev;
2449 int i, err;
2450
2451 printk("FEC ENET Version 0.2\n");
2452
2453 for (i = 0; (i < FEC_MAX_PORTS); i++) {
2454 dev = alloc_etherdev(sizeof(struct fec_enet_private));
2455 if (!dev)
2456 return -ENOMEM;
2457 dev->base_addr = (unsigned long)fec_hw[i];
2458 err = fec_enet_init(dev, i);
2459 if (err) {
2460 free_netdev(dev);
2461 continue;
2462 }
2463 if (register_netdev(dev) != 0) {
2464 /* XXX: missing cleanup here */
2465 free_netdev(dev);
2466 return -EIO;
2467 }
2468
2469 printk("%s: ethernet %pM\n", dev->name, dev->dev_addr);
2470 }
2471 return 0;
2472}
2473#else
2474
2475static int __devinit 1990static int __devinit
2476fec_probe(struct platform_device *pdev) 1991fec_probe(struct platform_device *pdev)
2477{ 1992{
@@ -2632,9 +2147,6 @@ fec_enet_cleanup(void)
2632} 2147}
2633 2148
2634module_exit(fec_enet_cleanup); 2149module_exit(fec_enet_cleanup);
2635
2636#endif /* FEC_LEGACY */
2637
2638module_init(fec_enet_module_init); 2150module_init(fec_enet_module_init);
2639 2151
2640MODULE_LICENSE("GPL"); 2152MODULE_LICENSE("GPL");