Commit 26c37681 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by David S. Miller

[NET]: Convert ppc early-init drivers to initcalls. Ack'd by Paul Mackerras.

parent aed0b60e
...@@ -608,7 +608,7 @@ static void set_multicast_list(struct net_device *dev) ...@@ -608,7 +608,7 @@ static void set_multicast_list(struct net_device *dev)
/* Initialize the CPM Ethernet on SCC. /* Initialize the CPM Ethernet on SCC.
*/ */
int __init scc_enet_init(void) static int __init scc_enet_init(void)
{ {
struct net_device *dev; struct net_device *dev;
struct scc_enet_private *cep; struct scc_enet_private *cep;
...@@ -630,15 +630,19 @@ int __init scc_enet_init(void) ...@@ -630,15 +630,19 @@ int __init scc_enet_init(void)
bd = (bd_t *)__res; bd = (bd_t *)__res;
/* Create an Ethernet device instance. /* Allocate some private information.
*/ */
dev = alloc_etherdev(sizeof(*cep)); cep = (struct scc_enet_private *)kmalloc(sizeof(*cep), GFP_KERNEL);
if (!dev) if (cep == NULL)
return -ENOMEM; return -ENOMEM;
cep = dev->priv; __clear_user(cep,sizeof(*cep));
spin_lock_init(&cep->lock); spin_lock_init(&cep->lock);
/* Create an Ethernet device instance.
*/
dev = init_etherdev(0, 0);
/* Get pointer to SCC area in parameter RAM. /* Get pointer to SCC area in parameter RAM.
*/ */
ep = (scc_enet_t *)(&immap->im_dprambase[PROFF_ENET]); ep = (scc_enet_t *)(&immap->im_dprambase[PROFF_ENET]);
...@@ -767,7 +771,6 @@ int __init scc_enet_init(void) ...@@ -767,7 +771,6 @@ int __init scc_enet_init(void)
/* Allocate a page. /* Allocate a page.
*/ */
mem_addr = __get_free_page(GFP_KERNEL); mem_addr = __get_free_page(GFP_KERNEL);
/* BUG: no check for failure */
/* Initialize the BD for every fragment in the page. /* Initialize the BD for every fragment in the page.
*/ */
...@@ -805,7 +808,6 @@ int __init scc_enet_init(void) ...@@ -805,7 +808,6 @@ int __init scc_enet_init(void)
/* Install our interrupt handler. /* Install our interrupt handler.
*/ */
request_irq(SIU_INT_ENET, scc_enet_interrupt, 0, "enet", dev); request_irq(SIU_INT_ENET, scc_enet_interrupt, 0, "enet", dev);
/* BUG: no check for failure */
/* Set GSMR_H to enable all normal operating modes. /* Set GSMR_H to enable all normal operating modes.
* Set GSMR_L to enable Ethernet to MC68160. * Set GSMR_L to enable Ethernet to MC68160.
...@@ -835,6 +837,7 @@ int __init scc_enet_init(void) ...@@ -835,6 +837,7 @@ int __init scc_enet_init(void)
io->iop_pdatc |= PC_EST8260_ENET_NOTFD; io->iop_pdatc |= PC_EST8260_ENET_NOTFD;
dev->base_addr = (unsigned long)ep; dev->base_addr = (unsigned long)ep;
dev->priv = cep;
/* The CPM Ethernet specific entries in the device structure. */ /* The CPM Ethernet specific entries in the device structure. */
dev->open = scc_enet_open; dev->open = scc_enet_open;
...@@ -849,12 +852,6 @@ int __init scc_enet_init(void) ...@@ -849,12 +852,6 @@ int __init scc_enet_init(void)
*/ */
sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT); sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
printk("%s: SCC ENET Version 0.1, ", dev->name); printk("%s: SCC ENET Version 0.1, ", dev->name);
for (i=0; i<5; i++) for (i=0; i<5; i++)
printk("%02x:", dev->dev_addr[i]); printk("%02x:", dev->dev_addr[i]);
...@@ -863,3 +860,4 @@ int __init scc_enet_init(void) ...@@ -863,3 +860,4 @@ int __init scc_enet_init(void)
return 0; return 0;
} }
module_init(scc_enet_init);
...@@ -1323,12 +1323,12 @@ int fcc_enet_set_mac_address(struct net_device *dev, void *p) ...@@ -1323,12 +1323,12 @@ int fcc_enet_set_mac_address(struct net_device *dev, void *p)
/* Initialize the CPM Ethernet on FCC. /* Initialize the CPM Ethernet on FCC.
*/ */
int __init fec_enet_init(void) static int __init fec_enet_init(void)
{ {
struct net_device *dev; struct net_device *dev;
struct fcc_enet_private *cep; struct fcc_enet_private *cep;
fcc_info_t *fip; fcc_info_t *fip;
int i, np, err; int i, np;
volatile immap_t *immap; volatile immap_t *immap;
volatile iop8260_t *io; volatile iop8260_t *io;
...@@ -1339,16 +1339,23 @@ int __init fec_enet_init(void) ...@@ -1339,16 +1339,23 @@ int __init fec_enet_init(void)
fip = fcc_ports; fip = fcc_ports;
while (np-- > 0) { while (np-- > 0) {
/* Create an Ethernet device instance.
/* Allocate some private information.
*/ */
dev = alloc_etherdev(sizeof(*cep)); cep = (struct fcc_enet_private *)
if (!dev) kmalloc(sizeof(*cep), GFP_KERNEL);
if (cep == NULL)
return -ENOMEM; return -ENOMEM;
cep = dev->priv; __clear_user(cep,sizeof(*cep));
spin_lock_init(&cep->lock); spin_lock_init(&cep->lock);
cep->fip = fip; cep->fip = fip;
/* Create an Ethernet device instance.
*/
dev = init_etherdev(0, 0);
dev->priv = cep;
init_fcc_shutdown(fip, cep, immap); init_fcc_shutdown(fip, cep, immap);
init_fcc_ioports(fip, io, immap); init_fcc_ioports(fip, io, immap);
init_fcc_param(fip, dev, immap); init_fcc_param(fip, dev, immap);
...@@ -1369,12 +1376,6 @@ int __init fec_enet_init(void) ...@@ -1369,12 +1376,6 @@ int __init fec_enet_init(void)
init_fcc_startup(fip, dev); init_fcc_startup(fip, dev);
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
printk("%s: FCC ENET Version 0.3, ", dev->name); printk("%s: FCC ENET Version 0.3, ", dev->name);
for (i=0; i<5; i++) for (i=0; i<5; i++)
printk("%02x:", dev->dev_addr[i]); printk("%02x:", dev->dev_addr[i]);
...@@ -1393,6 +1394,7 @@ int __init fec_enet_init(void) ...@@ -1393,6 +1394,7 @@ int __init fec_enet_init(void)
return 0; return 0;
} }
module_init(fec_enet_init);
/* Make sure the device is shut down during initialization. /* Make sure the device is shut down during initialization.
*/ */
......
...@@ -639,11 +639,11 @@ static void set_multicast_list(struct net_device *dev) ...@@ -639,11 +639,11 @@ static void set_multicast_list(struct net_device *dev)
* transmit and receive to make sure we don't catch the CPM with some * transmit and receive to make sure we don't catch the CPM with some
* inconsistent control information. * inconsistent control information.
*/ */
int __init scc_enet_init(void) static int __init scc_enet_init(void)
{ {
struct net_device *dev; struct net_device *dev;
struct scc_enet_private *cep; struct scc_enet_private *cep;
int i, j, k, err; int i, j, k;
unsigned char *eap, *ba; unsigned char *eap, *ba;
dma_addr_t mem_addr; dma_addr_t mem_addr;
bd_t *bd; bd_t *bd;
...@@ -659,13 +659,19 @@ int __init scc_enet_init(void) ...@@ -659,13 +659,19 @@ int __init scc_enet_init(void)
bd = (bd_t *)__res; bd = (bd_t *)__res;
dev = alloc_etherdev(sizeof(*cep)); /* Allocate some private information.
if (!dev) */
cep = (struct scc_enet_private *)kmalloc(sizeof(*cep), GFP_KERNEL);
if (cep == NULL)
return -ENOMEM; return -ENOMEM;
cep = dev->priv; __clear_user(cep,sizeof(*cep));
spin_lock_init(&cep->lock); spin_lock_init(&cep->lock);
/* Create an Ethernet device instance.
*/
dev = init_etherdev(0, 0);
/* Get pointer to SCC area in parameter RAM. /* Get pointer to SCC area in parameter RAM.
*/ */
ep = (scc_enet_t *)(&cp->cp_dparam[PROFF_ENET]); ep = (scc_enet_t *)(&cp->cp_dparam[PROFF_ENET]);
...@@ -835,7 +841,6 @@ int __init scc_enet_init(void) ...@@ -835,7 +841,6 @@ int __init scc_enet_init(void)
/* Allocate a page. /* Allocate a page.
*/ */
ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr); ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr);
/* BUG: no check for failure */
/* Initialize the BD for every fragment in the page. /* Initialize the BD for every fragment in the page.
*/ */
...@@ -934,6 +939,7 @@ int __init scc_enet_init(void) ...@@ -934,6 +939,7 @@ int __init scc_enet_init(void)
#endif #endif
dev->base_addr = (unsigned long)ep; dev->base_addr = (unsigned long)ep;
dev->priv = cep;
#if 0 #if 0
dev->name = "CPM_ENET"; dev->name = "CPM_ENET";
#endif #endif
...@@ -947,12 +953,6 @@ int __init scc_enet_init(void) ...@@ -947,12 +953,6 @@ int __init scc_enet_init(void)
dev->get_stats = scc_enet_get_stats; dev->get_stats = scc_enet_get_stats;
dev->set_multicast_list = set_multicast_list; dev->set_multicast_list = set_multicast_list;
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
/* And last, enable the transmit and receive processing. /* And last, enable the transmit and receive processing.
*/ */
sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT); sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT);
...@@ -964,3 +964,5 @@ int __init scc_enet_init(void) ...@@ -964,3 +964,5 @@ int __init scc_enet_init(void)
return 0; return 0;
} }
module_init(scc_enet_init);
...@@ -1566,11 +1566,11 @@ static void set_multicast_list(struct net_device *dev) ...@@ -1566,11 +1566,11 @@ static void set_multicast_list(struct net_device *dev)
/* Initialize the FEC Ethernet on 860T. /* Initialize the FEC Ethernet on 860T.
*/ */
int __init fec_enet_init(void) static int __init fec_enet_init(void)
{ {
struct net_device *dev; struct net_device *dev;
struct fec_enet_private *fep; struct fec_enet_private *fep;
int i, j, k, err; int i, j, k;
unsigned char *eap, *iap, *ba; unsigned char *eap, *iap, *ba;
unsigned long mem_addr; unsigned long mem_addr;
volatile cbd_t *bdp; volatile cbd_t *bdp;
...@@ -1586,11 +1586,17 @@ int __init fec_enet_init(void) ...@@ -1586,11 +1586,17 @@ int __init fec_enet_init(void)
bd = (bd_t *)__res; bd = (bd_t *)__res;
dev = alloc_etherdev(sizeof(*fep)); /* Allocate some private information.
if (!dev) */
fep = (struct fec_enet_private *)kmalloc(sizeof(*fep), GFP_KERNEL);
if (fep == NULL)
return -ENOMEM; return -ENOMEM;
fep = dev->priv; __clear_user(fep,sizeof(*fep));
/* Create an Ethernet device instance.
*/
dev = init_etherdev(0, 0);
fecp = &(immap->im_cpm.cp_fec); fecp = &(immap->im_cpm.cp_fec);
...@@ -1655,7 +1661,6 @@ int __init fec_enet_init(void) ...@@ -1655,7 +1661,6 @@ int __init fec_enet_init(void)
/* Allocate a page. /* Allocate a page.
*/ */
ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr); ba = (unsigned char *)consistent_alloc(GFP_KERNEL, PAGE_SIZE, &mem_addr);
/* BUG: no check for failure */
/* Initialize the BD for every fragment in the page. /* Initialize the BD for every fragment in the page.
*/ */
...@@ -1710,6 +1715,7 @@ int __init fec_enet_init(void) ...@@ -1710,6 +1715,7 @@ int __init fec_enet_init(void)
#endif #endif
dev->base_addr = (unsigned long)fecp; dev->base_addr = (unsigned long)fecp;
dev->priv = fep;
/* The FEC Ethernet specific entries in the device structure. */ /* The FEC Ethernet specific entries in the device structure. */
dev->open = fec_enet_open; dev->open = fec_enet_open;
...@@ -1746,12 +1752,6 @@ int __init fec_enet_init(void) ...@@ -1746,12 +1752,6 @@ int __init fec_enet_init(void)
fecp->fec_mii_speed = 0; /* turn off MDIO */ fecp->fec_mii_speed = 0; /* turn off MDIO */
#endif /* CONFIG_USE_MDIO */ #endif /* CONFIG_USE_MDIO */
err = register_netdev(dev);
if (err) {
kfree(dev);
return err;
}
printk ("%s: FEC ENET Version 0.2, FEC irq %d" printk ("%s: FEC ENET Version 0.2, FEC irq %d"
#ifdef PHY_INTERRUPT #ifdef PHY_INTERRUPT
", MII irq %d" ", MII irq %d"
...@@ -1782,6 +1782,7 @@ int __init fec_enet_init(void) ...@@ -1782,6 +1782,7 @@ int __init fec_enet_init(void)
return 0; return 0;
} }
module_init(fec_enet_init);
/* This function is called to start or restart the FEC during a link /* This function is called to start or restart the FEC during a link
* change. This only happens when switching between half and full * change. This only happens when switching between half and full
......
...@@ -9,9 +9,6 @@ ...@@ -9,9 +9,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/netlink.h> #include <linux/netlink.h>
extern int scc_enet_init(void);
extern int fec_enet_init(void);
/* /*
* Devices in this list must do new style probing. That is they must * Devices in this list must do new style probing. That is they must
* allocate their own device objects and do their own bus scans. * allocate their own device objects and do their own bus scans.
...@@ -27,12 +24,6 @@ static struct net_probe pci_probes[] __initdata = { ...@@ -27,12 +24,6 @@ static struct net_probe pci_probes[] __initdata = {
/* /*
* Early setup devices * Early setup devices
*/ */
#if defined(CONFIG_SCC_ENET)
{scc_enet_init, 0},
#endif
#if defined(CONFIG_FEC_ENET)
{fec_enet_init, 0},
#endif
{NULL, 0}, {NULL, 0},
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment