aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-09-09 02:49:04 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-09 02:49:04 -0400
commite199e6136ce6b151e6638ae93dca60748424d900 (patch)
tree0d66e0b5d227c36b005e4f5537f4bbcfc6ed4904 /drivers/net
parent972c40b5bee429c84ba727f8ac0a08292bc5dc3d (diff)
parentd56557af19867edb8c0e96f8e26399698a08857f (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/Kconfig4
-rw-r--r--drivers/net/arm/ixp4xx_eth.c2
-rw-r--r--drivers/net/au1000_eth.c31
-rw-r--r--drivers/net/can/mscan/mpc5xxx_can.c18
-rw-r--r--drivers/net/can/sja1000/sja1000_of_platform.c4
-rw-r--r--drivers/net/e1000e/netdev.c16
-rw-r--r--drivers/net/ehea/ehea.h4
-rw-r--r--drivers/net/ehea/ehea_main.c12
-rw-r--r--drivers/net/fec_mpc52xx.c8
-rw-r--r--drivers/net/fec_mpc52xx_phy.c4
-rw-r--r--drivers/net/fs_enet/fs_enet-main.c4
-rw-r--r--drivers/net/fs_enet/mac-fcc.c2
-rw-r--r--drivers/net/fs_enet/mac-fec.c2
-rw-r--r--drivers/net/fs_enet/mac-scc.c2
-rw-r--r--drivers/net/fs_enet/mii-bitbang.c4
-rw-r--r--drivers/net/fs_enet/mii-fec.c4
-rw-r--r--drivers/net/fsl_pq_mdio.c5
-rw-r--r--drivers/net/gianfar.c10
-rw-r--r--drivers/net/gianfar.h2
-rw-r--r--drivers/net/greth.c6
-rw-r--r--drivers/net/greth.h2
-rw-r--r--drivers/net/ibm_newemac/core.c10
-rw-r--r--drivers/net/ibm_newemac/core.h12
-rw-r--r--drivers/net/ibm_newemac/debug.c2
-rw-r--r--drivers/net/ibm_newemac/mal.c4
-rw-r--r--drivers/net/ibm_newemac/mal.h2
-rw-r--r--drivers/net/ibm_newemac/rgmii.c18
-rw-r--r--drivers/net/ibm_newemac/rgmii.h16
-rw-r--r--drivers/net/ibm_newemac/tah.c14
-rw-r--r--drivers/net/ibm_newemac/tah.h12
-rw-r--r--drivers/net/ibm_newemac/zmii.c18
-rw-r--r--drivers/net/ibm_newemac/zmii.h16
-rw-r--r--drivers/net/irda/sh_irda.c6
-rw-r--r--drivers/net/ll_temac_main.c8
-rw-r--r--drivers/net/myri10ge/myri10ge.c54
-rw-r--r--drivers/net/myri_sbus.c10
-rw-r--r--drivers/net/myri_sbus.h2
-rw-r--r--drivers/net/niu.c23
-rw-r--r--drivers/net/niu.h4
-rw-r--r--drivers/net/pcmcia/3c574_cs.c14
-rw-r--r--drivers/net/pcmcia/3c589_cs.c14
-rw-r--r--drivers/net/pcmcia/axnet_cs.c48
-rw-r--r--drivers/net/pcmcia/com20020_cs.c22
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c48
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c29
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c32
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c63
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c71
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c60
-rw-r--r--drivers/net/phy/mdio-gpio.c4
-rw-r--r--drivers/net/r8169.c16
-rw-r--r--drivers/net/smc91x.h37
-rw-r--r--drivers/net/sunbmac.c24
-rw-r--r--drivers/net/sunbmac.h4
-rw-r--r--drivers/net/sunhme.c32
-rw-r--r--drivers/net/sunhme.h2
-rw-r--r--drivers/net/sunlance.c26
-rw-r--r--drivers/net/sunqe.c26
-rw-r--r--drivers/net/sunqe.h4
-rw-r--r--drivers/net/ucc_geth.c8
-rw-r--r--drivers/net/usb/ipheth.c5
-rw-r--r--drivers/net/wan/ixp4xx_hss.c2
-rw-r--r--drivers/net/wireless/airo_cs.c74
-rw-r--r--drivers/net/wireless/atmel_cs.c25
-rw-r--r--drivers/net/wireless/b43/pcmcia.c13
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c136
-rw-r--r--drivers/net/wireless/libertas/cfg.c2
-rw-r--r--drivers/net/wireless/libertas/if_cs.c16
-rw-r--r--drivers/net/wireless/libertas/if_sdio.c32
-rw-r--r--drivers/net/wireless/libertas/if_usb.c3
-rw-r--r--drivers/net/wireless/libertas_tf/if_usb.c3
-rw-r--r--drivers/net/wireless/orinoco/orinoco_cs.c30
-rw-r--r--drivers/net/wireless/orinoco/spectrum_cs.c62
-rw-r--r--drivers/net/wireless/ray_cs.c27
-rw-r--r--drivers/net/wireless/wl3501_cs.c24
-rw-r--r--drivers/net/xilinx_emaclite.c8
76 files changed, 616 insertions, 807 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index fe581566cb26..2cc81a54cbf3 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -484,7 +484,7 @@ config XTENSA_XT2000_SONIC
484 484
485config MIPS_AU1X00_ENET 485config MIPS_AU1X00_ENET
486 tristate "MIPS AU1000 Ethernet support" 486 tristate "MIPS AU1000 Ethernet support"
487 depends on SOC_AU1X00 487 depends on MIPS_ALCHEMY
488 select PHYLIB 488 select PHYLIB
489 select CRC32 489 select CRC32
490 help 490 help
@@ -914,7 +914,7 @@ config SMC91X
914 tristate "SMC 91C9x/91C1xxx support" 914 tristate "SMC 91C9x/91C1xxx support"
915 select CRC32 915 select CRC32
916 select MII 916 select MII
917 depends on ARM || REDWOOD_5 || REDWOOD_6 || M32R || SUPERH || \ 917 depends on ARM || M32R || SUPERH || \
918 MIPS || BLACKFIN || MN10300 || COLDFIRE 918 MIPS || BLACKFIN || MN10300 || COLDFIRE
919 help 919 help
920 This is a driver for SMC's 91x series of Ethernet chipsets, 920 This is a driver for SMC's 91x series of Ethernet chipsets,
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 4f1cc7164ad9..6028226a7270 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -241,7 +241,7 @@ static inline void memcpy_swab32(u32 *dest, u32 *src, int cnt)
241 241
242static spinlock_t mdio_lock; 242static spinlock_t mdio_lock;
243static struct eth_regs __iomem *mdio_regs; /* mdio command and status only */ 243static struct eth_regs __iomem *mdio_regs; /* mdio command and status only */
244struct mii_bus *mdio_bus; 244static struct mii_bus *mdio_bus;
245static int ports_open; 245static int ports_open;
246static struct port *npe_port_tab[MAX_NPES]; 246static struct port *npe_port_tab[MAX_NPES];
247static struct dma_pool *dma_pool; 247static struct dma_pool *dma_pool;
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c
index 386d4feec652..15ae6df2ff00 100644
--- a/drivers/net/au1000_eth.c
+++ b/drivers/net/au1000_eth.c
@@ -104,14 +104,6 @@ MODULE_VERSION(DRV_VERSION);
104 * complete immediately. 104 * complete immediately.
105 */ 105 */
106 106
107/* These addresses are only used if yamon doesn't tell us what
108 * the mac address is, and the mac address is not passed on the
109 * command line.
110 */
111static unsigned char au1000_mac_addr[6] __devinitdata = {
112 0x00, 0x50, 0xc2, 0x0c, 0x30, 0x00
113};
114
115struct au1000_private *au_macs[NUM_ETH_INTERFACES]; 107struct au1000_private *au_macs[NUM_ETH_INTERFACES];
116 108
117/* 109/*
@@ -1002,7 +994,6 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1002 db_dest_t *pDB, *pDBfree; 994 db_dest_t *pDB, *pDBfree;
1003 int irq, i, err = 0; 995 int irq, i, err = 0;
1004 struct resource *base, *macen; 996 struct resource *base, *macen;
1005 char ethaddr[6];
1006 997
1007 base = platform_get_resource(pdev, IORESOURCE_MEM, 0); 998 base = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1008 if (!base) { 999 if (!base) {
@@ -1079,24 +1070,13 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1079 } 1070 }
1080 aup->mac_id = pdev->id; 1071 aup->mac_id = pdev->id;
1081 1072
1082 if (pdev->id == 0) { 1073 if (pdev->id == 0)
1083 if (prom_get_ethernet_addr(ethaddr) == 0)
1084 memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
1085 else {
1086 netdev_info(dev, "No MAC address found\n");
1087 /* Use the hard coded MAC addresses */
1088 }
1089
1090 au1000_setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR); 1074 au1000_setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
1091 } else if (pdev->id == 1) 1075 else if (pdev->id == 1)
1092 au1000_setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR); 1076 au1000_setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
1093 1077
1094 /* 1078 /* set a random MAC now in case platform_data doesn't provide one */
1095 * Assign to the Ethernet ports two consecutive MAC addresses 1079 random_ether_addr(dev->dev_addr);
1096 * to match those that are printed on their stickers
1097 */
1098 memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
1099 dev->dev_addr[5] += pdev->id;
1100 1080
1101 *aup->enable = 0; 1081 *aup->enable = 0;
1102 aup->mac_enabled = 0; 1082 aup->mac_enabled = 0;
@@ -1106,6 +1086,9 @@ static int __devinit au1000_probe(struct platform_device *pdev)
1106 dev_info(&pdev->dev, "no platform_data passed, PHY search on MAC0\n"); 1086 dev_info(&pdev->dev, "no platform_data passed, PHY search on MAC0\n");
1107 aup->phy1_search_mac0 = 1; 1087 aup->phy1_search_mac0 = 1;
1108 } else { 1088 } else {
1089 if (is_valid_ether_addr(pd->mac))
1090 memcpy(dev->dev_addr, pd->mac, 6);
1091
1109 aup->phy_static_config = pd->phy_static_config; 1092 aup->phy_static_config = pd->phy_static_config;
1110 aup->phy_search_highest_addr = pd->phy_search_highest_addr; 1093 aup->phy_search_highest_addr = pd->phy_search_highest_addr;
1111 aup->phy1_search_mac0 = pd->phy1_search_mac0; 1094 aup->phy1_search_mac0 = pd->phy1_search_mac0;
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index af753936e835..b1bdc909090f 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -38,7 +38,7 @@
38 38
39struct mpc5xxx_can_data { 39struct mpc5xxx_can_data {
40 unsigned int type; 40 unsigned int type;
41 u32 (*get_clock)(struct of_device *ofdev, const char *clock_name, 41 u32 (*get_clock)(struct platform_device *ofdev, const char *clock_name,
42 int *mscan_clksrc); 42 int *mscan_clksrc);
43}; 43};
44 44
@@ -48,7 +48,7 @@ static struct of_device_id __devinitdata mpc52xx_cdm_ids[] = {
48 {} 48 {}
49}; 49};
50 50
51static u32 __devinit mpc52xx_can_get_clock(struct of_device *ofdev, 51static u32 __devinit mpc52xx_can_get_clock(struct platform_device *ofdev,
52 const char *clock_name, 52 const char *clock_name,
53 int *mscan_clksrc) 53 int *mscan_clksrc)
54{ 54{
@@ -101,7 +101,7 @@ static u32 __devinit mpc52xx_can_get_clock(struct of_device *ofdev,
101 return freq; 101 return freq;
102} 102}
103#else /* !CONFIG_PPC_MPC52xx */ 103#else /* !CONFIG_PPC_MPC52xx */
104static u32 __devinit mpc52xx_can_get_clock(struct of_device *ofdev, 104static u32 __devinit mpc52xx_can_get_clock(struct platform_device *ofdev,
105 const char *clock_name, 105 const char *clock_name,
106 int *mscan_clksrc) 106 int *mscan_clksrc)
107{ 107{
@@ -129,7 +129,7 @@ static struct of_device_id __devinitdata mpc512x_clock_ids[] = {
129 {} 129 {}
130}; 130};
131 131
132static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev, 132static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
133 const char *clock_name, 133 const char *clock_name,
134 int *mscan_clksrc) 134 int *mscan_clksrc)
135{ 135{
@@ -239,7 +239,7 @@ exit_unmap:
239 return freq; 239 return freq;
240} 240}
241#else /* !CONFIG_PPC_MPC512x */ 241#else /* !CONFIG_PPC_MPC512x */
242static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev, 242static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
243 const char *clock_name, 243 const char *clock_name,
244 int *mscan_clksrc) 244 int *mscan_clksrc)
245{ 245{
@@ -247,7 +247,7 @@ static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev,
247} 247}
248#endif /* CONFIG_PPC_MPC512x */ 248#endif /* CONFIG_PPC_MPC512x */
249 249
250static int __devinit mpc5xxx_can_probe(struct of_device *ofdev, 250static int __devinit mpc5xxx_can_probe(struct platform_device *ofdev,
251 const struct of_device_id *id) 251 const struct of_device_id *id)
252{ 252{
253 struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data; 253 struct mpc5xxx_can_data *data = (struct mpc5xxx_can_data *)id->data;
@@ -317,7 +317,7 @@ exit_unmap_mem:
317 return err; 317 return err;
318} 318}
319 319
320static int __devexit mpc5xxx_can_remove(struct of_device *ofdev) 320static int __devexit mpc5xxx_can_remove(struct platform_device *ofdev)
321{ 321{
322 struct net_device *dev = dev_get_drvdata(&ofdev->dev); 322 struct net_device *dev = dev_get_drvdata(&ofdev->dev);
323 struct mscan_priv *priv = netdev_priv(dev); 323 struct mscan_priv *priv = netdev_priv(dev);
@@ -334,7 +334,7 @@ static int __devexit mpc5xxx_can_remove(struct of_device *ofdev)
334 334
335#ifdef CONFIG_PM 335#ifdef CONFIG_PM
336static struct mscan_regs saved_regs; 336static struct mscan_regs saved_regs;
337static int mpc5xxx_can_suspend(struct of_device *ofdev, pm_message_t state) 337static int mpc5xxx_can_suspend(struct platform_device *ofdev, pm_message_t state)
338{ 338{
339 struct net_device *dev = dev_get_drvdata(&ofdev->dev); 339 struct net_device *dev = dev_get_drvdata(&ofdev->dev);
340 struct mscan_priv *priv = netdev_priv(dev); 340 struct mscan_priv *priv = netdev_priv(dev);
@@ -345,7 +345,7 @@ static int mpc5xxx_can_suspend(struct of_device *ofdev, pm_message_t state)
345 return 0; 345 return 0;
346} 346}
347 347
348static int mpc5xxx_can_resume(struct of_device *ofdev) 348static int mpc5xxx_can_resume(struct platform_device *ofdev)
349{ 349{
350 struct net_device *dev = dev_get_drvdata(&ofdev->dev); 350 struct net_device *dev = dev_get_drvdata(&ofdev->dev);
351 struct mscan_priv *priv = netdev_priv(dev); 351 struct mscan_priv *priv = netdev_priv(dev);
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c
index ac1a83d7c204..5bfccfdf3bbb 100644
--- a/drivers/net/can/sja1000/sja1000_of_platform.c
+++ b/drivers/net/can/sja1000/sja1000_of_platform.c
@@ -67,7 +67,7 @@ static void sja1000_ofp_write_reg(const struct sja1000_priv *priv,
67 out_8(priv->reg_base + reg, val); 67 out_8(priv->reg_base + reg, val);
68} 68}
69 69
70static int __devexit sja1000_ofp_remove(struct of_device *ofdev) 70static int __devexit sja1000_ofp_remove(struct platform_device *ofdev)
71{ 71{
72 struct net_device *dev = dev_get_drvdata(&ofdev->dev); 72 struct net_device *dev = dev_get_drvdata(&ofdev->dev);
73 struct sja1000_priv *priv = netdev_priv(dev); 73 struct sja1000_priv *priv = netdev_priv(dev);
@@ -87,7 +87,7 @@ static int __devexit sja1000_ofp_remove(struct of_device *ofdev)
87 return 0; 87 return 0;
88} 88}
89 89
90static int __devinit sja1000_ofp_probe(struct of_device *ofdev, 90static int __devinit sja1000_ofp_probe(struct platform_device *ofdev,
91 const struct of_device_id *id) 91 const struct of_device_id *id)
92{ 92{
93 struct device_node *np = ofdev->dev.of_node; 93 struct device_node *np = ofdev->dev.of_node;
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index c3dd590d87b2..2b8ef44bd2b1 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -5829,11 +5829,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
5829 5829
5830 e1000_print_device_info(adapter); 5830 e1000_print_device_info(adapter);
5831 5831
5832 if (pci_dev_run_wake(pdev)) { 5832 if (pci_dev_run_wake(pdev))
5833 pm_runtime_set_active(&pdev->dev); 5833 pm_runtime_put_noidle(&pdev->dev);
5834 pm_runtime_enable(&pdev->dev);
5835 }
5836 pm_schedule_suspend(&pdev->dev, MSEC_PER_SEC);
5837 5834
5838 return 0; 5835 return 0;
5839 5836
@@ -5879,8 +5876,6 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
5879 struct e1000_adapter *adapter = netdev_priv(netdev); 5876 struct e1000_adapter *adapter = netdev_priv(netdev);
5880 bool down = test_bit(__E1000_DOWN, &adapter->state); 5877 bool down = test_bit(__E1000_DOWN, &adapter->state);
5881 5878
5882 pm_runtime_get_sync(&pdev->dev);
5883
5884 /* 5879 /*
5885 * flush_scheduled work may reschedule our watchdog task, so 5880 * flush_scheduled work may reschedule our watchdog task, so
5886 * explicitly disable watchdog tasks from being rescheduled 5881 * explicitly disable watchdog tasks from being rescheduled
@@ -5905,11 +5900,8 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
5905 clear_bit(__E1000_DOWN, &adapter->state); 5900 clear_bit(__E1000_DOWN, &adapter->state);
5906 unregister_netdev(netdev); 5901 unregister_netdev(netdev);
5907 5902
5908 if (pci_dev_run_wake(pdev)) { 5903 if (pci_dev_run_wake(pdev))
5909 pm_runtime_disable(&pdev->dev); 5904 pm_runtime_get_noresume(&pdev->dev);
5910 pm_runtime_set_suspended(&pdev->dev);
5911 }
5912 pm_runtime_put_noidle(&pdev->dev);
5913 5905
5914 /* 5906 /*
5915 * Release control of h/w to f/w. If f/w is AMT enabled, this 5907 * Release control of h/w to f/w. If f/w is AMT enabled, this
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 2ce67f6152cd..1846623c6ae6 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -414,7 +414,7 @@ struct ehea_port_res {
414 414
415struct ehea_adapter { 415struct ehea_adapter {
416 u64 handle; 416 u64 handle;
417 struct of_device *ofdev; 417 struct platform_device *ofdev;
418 struct ehea_port *port[EHEA_MAX_PORTS]; 418 struct ehea_port *port[EHEA_MAX_PORTS];
419 struct ehea_eq *neq; /* notification event queue */ 419 struct ehea_eq *neq; /* notification event queue */
420 struct tasklet_struct neq_tasklet; 420 struct tasklet_struct neq_tasklet;
@@ -466,7 +466,7 @@ struct ehea_port {
466 struct net_device *netdev; 466 struct net_device *netdev;
467 struct net_device_stats stats; 467 struct net_device_stats stats;
468 struct ehea_port_res port_res[EHEA_MAX_PORT_RES]; 468 struct ehea_port_res port_res[EHEA_MAX_PORT_RES];
469 struct of_device ofdev; /* Open Firmware Device */ 469 struct platform_device ofdev; /* Open Firmware Device */
470 struct ehea_mc_list *mc_list; /* Multicast MAC addresses */ 470 struct ehea_mc_list *mc_list; /* Multicast MAC addresses */
471 struct vlan_group *vgrp; 471 struct vlan_group *vgrp;
472 struct ehea_eq *qp_eq; 472 struct ehea_eq *qp_eq;
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index adb5994c125f..a333b42111b8 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -107,10 +107,10 @@ struct ehea_fw_handle_array ehea_fw_handles;
107struct ehea_bcmc_reg_array ehea_bcmc_regs; 107struct ehea_bcmc_reg_array ehea_bcmc_regs;
108 108
109 109
110static int __devinit ehea_probe_adapter(struct of_device *dev, 110static int __devinit ehea_probe_adapter(struct platform_device *dev,
111 const struct of_device_id *id); 111 const struct of_device_id *id);
112 112
113static int __devexit ehea_remove(struct of_device *dev); 113static int __devexit ehea_remove(struct platform_device *dev);
114 114
115static struct of_device_id ehea_device_table[] = { 115static struct of_device_id ehea_device_table[] = {
116 { 116 {
@@ -3434,7 +3434,7 @@ static ssize_t ehea_remove_port(struct device *dev,
3434static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); 3434static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port);
3435static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); 3435static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port);
3436 3436
3437int ehea_create_device_sysfs(struct of_device *dev) 3437int ehea_create_device_sysfs(struct platform_device *dev)
3438{ 3438{
3439 int ret = device_create_file(&dev->dev, &dev_attr_probe_port); 3439 int ret = device_create_file(&dev->dev, &dev_attr_probe_port);
3440 if (ret) 3440 if (ret)
@@ -3445,13 +3445,13 @@ out:
3445 return ret; 3445 return ret;
3446} 3446}
3447 3447
3448void ehea_remove_device_sysfs(struct of_device *dev) 3448void ehea_remove_device_sysfs(struct platform_device *dev)
3449{ 3449{
3450 device_remove_file(&dev->dev, &dev_attr_probe_port); 3450 device_remove_file(&dev->dev, &dev_attr_probe_port);
3451 device_remove_file(&dev->dev, &dev_attr_remove_port); 3451 device_remove_file(&dev->dev, &dev_attr_remove_port);
3452} 3452}
3453 3453
3454static int __devinit ehea_probe_adapter(struct of_device *dev, 3454static int __devinit ehea_probe_adapter(struct platform_device *dev,
3455 const struct of_device_id *id) 3455 const struct of_device_id *id)
3456{ 3456{
3457 struct ehea_adapter *adapter; 3457 struct ehea_adapter *adapter;
@@ -3550,7 +3550,7 @@ out:
3550 return ret; 3550 return ret;
3551} 3551}
3552 3552
3553static int __devexit ehea_remove(struct of_device *dev) 3553static int __devexit ehea_remove(struct platform_device *dev)
3554{ 3554{
3555 struct ehea_adapter *adapter = dev_get_drvdata(&dev->dev); 3555 struct ehea_adapter *adapter = dev_get_drvdata(&dev->dev);
3556 int i; 3556 int i;
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index d1a5b17b2a95..e3e10b4add9c 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -850,7 +850,7 @@ static const struct net_device_ops mpc52xx_fec_netdev_ops = {
850/* ======================================================================== */ 850/* ======================================================================== */
851 851
852static int __devinit 852static int __devinit
853mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) 853mpc52xx_fec_probe(struct platform_device *op, const struct of_device_id *match)
854{ 854{
855 int rv; 855 int rv;
856 struct net_device *ndev; 856 struct net_device *ndev;
@@ -995,7 +995,7 @@ err_netdev:
995} 995}
996 996
997static int 997static int
998mpc52xx_fec_remove(struct of_device *op) 998mpc52xx_fec_remove(struct platform_device *op)
999{ 999{
1000 struct net_device *ndev; 1000 struct net_device *ndev;
1001 struct mpc52xx_fec_priv *priv; 1001 struct mpc52xx_fec_priv *priv;
@@ -1025,7 +1025,7 @@ mpc52xx_fec_remove(struct of_device *op)
1025} 1025}
1026 1026
1027#ifdef CONFIG_PM 1027#ifdef CONFIG_PM
1028static int mpc52xx_fec_of_suspend(struct of_device *op, pm_message_t state) 1028static int mpc52xx_fec_of_suspend(struct platform_device *op, pm_message_t state)
1029{ 1029{
1030 struct net_device *dev = dev_get_drvdata(&op->dev); 1030 struct net_device *dev = dev_get_drvdata(&op->dev);
1031 1031
@@ -1035,7 +1035,7 @@ static int mpc52xx_fec_of_suspend(struct of_device *op, pm_message_t state)
1035 return 0; 1035 return 0;
1036} 1036}
1037 1037
1038static int mpc52xx_fec_of_resume(struct of_device *op) 1038static int mpc52xx_fec_of_resume(struct platform_device *op)
1039{ 1039{
1040 struct net_device *dev = dev_get_drvdata(&op->dev); 1040 struct net_device *dev = dev_get_drvdata(&op->dev);
1041 1041
diff --git a/drivers/net/fec_mpc52xx_phy.c b/drivers/net/fec_mpc52xx_phy.c
index dbaf72cbb233..0b4cb6f15984 100644
--- a/drivers/net/fec_mpc52xx_phy.c
+++ b/drivers/net/fec_mpc52xx_phy.c
@@ -61,7 +61,7 @@ static int mpc52xx_fec_mdio_write(struct mii_bus *bus, int phy_id, int reg,
61 data | FEC_MII_WRITE_FRAME); 61 data | FEC_MII_WRITE_FRAME);
62} 62}
63 63
64static int mpc52xx_fec_mdio_probe(struct of_device *of, 64static int mpc52xx_fec_mdio_probe(struct platform_device *of,
65 const struct of_device_id *match) 65 const struct of_device_id *match)
66{ 66{
67 struct device *dev = &of->dev; 67 struct device *dev = &of->dev;
@@ -122,7 +122,7 @@ static int mpc52xx_fec_mdio_probe(struct of_device *of,
122 return err; 122 return err;
123} 123}
124 124
125static int mpc52xx_fec_mdio_remove(struct of_device *of) 125static int mpc52xx_fec_mdio_remove(struct platform_device *of)
126{ 126{
127 struct device *dev = &of->dev; 127 struct device *dev = &of->dev;
128 struct mii_bus *bus = dev_get_drvdata(dev); 128 struct mii_bus *bus = dev_get_drvdata(dev);
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c
index f08cff9020bd..d6e3111959ab 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -997,7 +997,7 @@ static const struct net_device_ops fs_enet_netdev_ops = {
997#endif 997#endif
998}; 998};
999 999
1000static int __devinit fs_enet_probe(struct of_device *ofdev, 1000static int __devinit fs_enet_probe(struct platform_device *ofdev,
1001 const struct of_device_id *match) 1001 const struct of_device_id *match)
1002{ 1002{
1003 struct net_device *ndev; 1003 struct net_device *ndev;
@@ -1105,7 +1105,7 @@ out_free_fpi:
1105 return ret; 1105 return ret;
1106} 1106}
1107 1107
1108static int fs_enet_remove(struct of_device *ofdev) 1108static int fs_enet_remove(struct platform_device *ofdev)
1109{ 1109{
1110 struct net_device *ndev = dev_get_drvdata(&ofdev->dev); 1110 struct net_device *ndev = dev_get_drvdata(&ofdev->dev);
1111 struct fs_enet_private *fep = netdev_priv(ndev); 1111 struct fs_enet_private *fep = netdev_priv(ndev);
diff --git a/drivers/net/fs_enet/mac-fcc.c b/drivers/net/fs_enet/mac-fcc.c
index 48e91b6242ce..7a84e45487e8 100644
--- a/drivers/net/fs_enet/mac-fcc.c
+++ b/drivers/net/fs_enet/mac-fcc.c
@@ -84,7 +84,7 @@ static inline int fcc_cr_cmd(struct fs_enet_private *fep, u32 op)
84 84
85static int do_pd_setup(struct fs_enet_private *fep) 85static int do_pd_setup(struct fs_enet_private *fep)
86{ 86{
87 struct of_device *ofdev = to_of_device(fep->dev); 87 struct platform_device *ofdev = to_platform_device(fep->dev);
88 struct fs_platform_info *fpi = fep->fpi; 88 struct fs_platform_info *fpi = fep->fpi;
89 int ret = -EINVAL; 89 int ret = -EINVAL;
90 90
diff --git a/drivers/net/fs_enet/mac-fec.c b/drivers/net/fs_enet/mac-fec.c
index 7ca1642276d0..61035fc5599b 100644
--- a/drivers/net/fs_enet/mac-fec.c
+++ b/drivers/net/fs_enet/mac-fec.c
@@ -96,7 +96,7 @@ static int whack_reset(struct fec __iomem *fecp)
96 96
97static int do_pd_setup(struct fs_enet_private *fep) 97static int do_pd_setup(struct fs_enet_private *fep)
98{ 98{
99 struct of_device *ofdev = to_of_device(fep->dev); 99 struct platform_device *ofdev = to_platform_device(fep->dev);
100 100
101 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); 101 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
102 if (fep->interrupt == NO_IRQ) 102 if (fep->interrupt == NO_IRQ)
diff --git a/drivers/net/fs_enet/mac-scc.c b/drivers/net/fs_enet/mac-scc.c
index a3c44544846d..22a02a767069 100644
--- a/drivers/net/fs_enet/mac-scc.c
+++ b/drivers/net/fs_enet/mac-scc.c
@@ -96,7 +96,7 @@ static inline int scc_cr_cmd(struct fs_enet_private *fep, u32 op)
96 96
97static int do_pd_setup(struct fs_enet_private *fep) 97static int do_pd_setup(struct fs_enet_private *fep)
98{ 98{
99 struct of_device *ofdev = to_of_device(fep->dev); 99 struct platform_device *ofdev = to_platform_device(fep->dev);
100 100
101 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); 101 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL);
102 if (fep->interrupt == NO_IRQ) 102 if (fep->interrupt == NO_IRQ)
diff --git a/drivers/net/fs_enet/mii-bitbang.c b/drivers/net/fs_enet/mii-bitbang.c
index 3607340f3da7..3cda2b515471 100644
--- a/drivers/net/fs_enet/mii-bitbang.c
+++ b/drivers/net/fs_enet/mii-bitbang.c
@@ -150,7 +150,7 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus,
150 return 0; 150 return 0;
151} 151}
152 152
153static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, 153static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev,
154 const struct of_device_id *match) 154 const struct of_device_id *match)
155{ 155{
156 struct mii_bus *new_bus; 156 struct mii_bus *new_bus;
@@ -200,7 +200,7 @@ out:
200 return ret; 200 return ret;
201} 201}
202 202
203static int fs_enet_mdio_remove(struct of_device *ofdev) 203static int fs_enet_mdio_remove(struct platform_device *ofdev)
204{ 204{
205 struct mii_bus *bus = dev_get_drvdata(&ofdev->dev); 205 struct mii_bus *bus = dev_get_drvdata(&ofdev->dev);
206 struct bb_info *bitbang = bus->priv; 206 struct bb_info *bitbang = bus->priv;
diff --git a/drivers/net/fs_enet/mii-fec.c b/drivers/net/fs_enet/mii-fec.c
index bddffd169b93..dbb9c48623df 100644
--- a/drivers/net/fs_enet/mii-fec.c
+++ b/drivers/net/fs_enet/mii-fec.c
@@ -101,7 +101,7 @@ static int fs_enet_fec_mii_reset(struct mii_bus *bus)
101 return 0; 101 return 0;
102} 102}
103 103
104static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, 104static int __devinit fs_enet_mdio_probe(struct platform_device *ofdev,
105 const struct of_device_id *match) 105 const struct of_device_id *match)
106{ 106{
107 struct resource res; 107 struct resource res;
@@ -192,7 +192,7 @@ out:
192 return ret; 192 return ret;
193} 193}
194 194
195static int fs_enet_mdio_remove(struct of_device *ofdev) 195static int fs_enet_mdio_remove(struct platform_device *ofdev)
196{ 196{
197 struct mii_bus *bus = dev_get_drvdata(&ofdev->dev); 197 struct mii_bus *bus = dev_get_drvdata(&ofdev->dev);
198 struct fec_info *fec = bus->priv; 198 struct fec_info *fec = bus->priv;
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
index b4c41d72c423..d4bf91aac25f 100644
--- a/drivers/net/fsl_pq_mdio.c
+++ b/drivers/net/fsl_pq_mdio.c
@@ -35,6 +35,7 @@
35#include <linux/mii.h> 35#include <linux/mii.h>
36#include <linux/phy.h> 36#include <linux/phy.h>
37#include <linux/of.h> 37#include <linux/of.h>
38#include <linux/of_address.h>
38#include <linux/of_mdio.h> 39#include <linux/of_mdio.h>
39#include <linux/of_platform.h> 40#include <linux/of_platform.h>
40 41
@@ -264,7 +265,7 @@ static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id)
264#endif 265#endif
265 266
266 267
267static int fsl_pq_mdio_probe(struct of_device *ofdev, 268static int fsl_pq_mdio_probe(struct platform_device *ofdev,
268 const struct of_device_id *match) 269 const struct of_device_id *match)
269{ 270{
270 struct device_node *np = ofdev->dev.of_node; 271 struct device_node *np = ofdev->dev.of_node;
@@ -424,7 +425,7 @@ err_free_priv:
424} 425}
425 426
426 427
427static int fsl_pq_mdio_remove(struct of_device *ofdev) 428static int fsl_pq_mdio_remove(struct platform_device *ofdev)
428{ 429{
429 struct device *device = &ofdev->dev; 430 struct device *device = &ofdev->dev;
430 struct mii_bus *bus = dev_get_drvdata(device); 431 struct mii_bus *bus = dev_get_drvdata(device);
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index a1b6301bc674..4f7c3f3ca234 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -122,9 +122,9 @@ static irqreturn_t gfar_interrupt(int irq, void *dev_id);
122static void adjust_link(struct net_device *dev); 122static void adjust_link(struct net_device *dev);
123static void init_registers(struct net_device *dev); 123static void init_registers(struct net_device *dev);
124static int init_phy(struct net_device *dev); 124static int init_phy(struct net_device *dev);
125static int gfar_probe(struct of_device *ofdev, 125static int gfar_probe(struct platform_device *ofdev,
126 const struct of_device_id *match); 126 const struct of_device_id *match);
127static int gfar_remove(struct of_device *ofdev); 127static int gfar_remove(struct platform_device *ofdev);
128static void free_skb_resources(struct gfar_private *priv); 128static void free_skb_resources(struct gfar_private *priv);
129static void gfar_set_multi(struct net_device *dev); 129static void gfar_set_multi(struct net_device *dev);
130static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); 130static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr);
@@ -605,7 +605,7 @@ static int gfar_parse_group(struct device_node *np,
605 return 0; 605 return 0;
606} 606}
607 607
608static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev) 608static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
609{ 609{
610 const char *model; 610 const char *model;
611 const char *ctype; 611 const char *ctype;
@@ -959,7 +959,7 @@ static void gfar_detect_errata(struct gfar_private *priv)
959 959
960/* Set up the ethernet device structure, private data, 960/* Set up the ethernet device structure, private data,
961 * and anything else we need before we start */ 961 * and anything else we need before we start */
962static int gfar_probe(struct of_device *ofdev, 962static int gfar_probe(struct platform_device *ofdev,
963 const struct of_device_id *match) 963 const struct of_device_id *match)
964{ 964{
965 u32 tempval; 965 u32 tempval;
@@ -1238,7 +1238,7 @@ register_fail:
1238 return err; 1238 return err;
1239} 1239}
1240 1240
1241static int gfar_remove(struct of_device *ofdev) 1241static int gfar_remove(struct platform_device *ofdev)
1242{ 1242{
1243 struct gfar_private *priv = dev_get_drvdata(&ofdev->dev); 1243 struct gfar_private *priv = dev_get_drvdata(&ofdev->dev);
1244 1244
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 710810e2adb4..68984eb88ae0 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -1054,7 +1054,7 @@ struct gfar_private {
1054 1054
1055 struct device_node *node; 1055 struct device_node *node;
1056 struct net_device *ndev; 1056 struct net_device *ndev;
1057 struct of_device *ofdev; 1057 struct platform_device *ofdev;
1058 enum gfar_errata errata; 1058 enum gfar_errata errata;
1059 1059
1060 struct gfar_priv_grp gfargrp[MAXGROUPS]; 1060 struct gfar_priv_grp gfargrp[MAXGROUPS];
diff --git a/drivers/net/greth.c b/drivers/net/greth.c
index 4d09eab3548e..f15c64f1cd38 100644
--- a/drivers/net/greth.c
+++ b/drivers/net/greth.c
@@ -1373,7 +1373,7 @@ error:
1373} 1373}
1374 1374
1375/* Initialize the GRETH MAC */ 1375/* Initialize the GRETH MAC */
1376static int __devinit greth_of_probe(struct of_device *ofdev, const struct of_device_id *match) 1376static int __devinit greth_of_probe(struct platform_device *ofdev, const struct of_device_id *match)
1377{ 1377{
1378 struct net_device *dev; 1378 struct net_device *dev;
1379 struct greth_private *greth; 1379 struct greth_private *greth;
@@ -1412,7 +1412,7 @@ static int __devinit greth_of_probe(struct of_device *ofdev, const struct of_dev
1412 } 1412 }
1413 1413
1414 regs = (struct greth_regs *) greth->regs; 1414 regs = (struct greth_regs *) greth->regs;
1415 greth->irq = ofdev->irqs[0]; 1415 greth->irq = ofdev->archdata.irqs[0];
1416 1416
1417 dev_set_drvdata(greth->dev, dev); 1417 dev_set_drvdata(greth->dev, dev);
1418 SET_NETDEV_DEV(dev, greth->dev); 1418 SET_NETDEV_DEV(dev, greth->dev);
@@ -1572,7 +1572,7 @@ error1:
1572 return err; 1572 return err;
1573} 1573}
1574 1574
1575static int __devexit greth_of_remove(struct of_device *of_dev) 1575static int __devexit greth_of_remove(struct platform_device *of_dev)
1576{ 1576{
1577 struct net_device *ndev = dev_get_drvdata(&of_dev->dev); 1577 struct net_device *ndev = dev_get_drvdata(&of_dev->dev);
1578 struct greth_private *greth = netdev_priv(ndev); 1578 struct greth_private *greth = netdev_priv(ndev);
diff --git a/drivers/net/greth.h b/drivers/net/greth.h
index 973388d6abca..03ad903cd676 100644
--- a/drivers/net/greth.h
+++ b/drivers/net/greth.h
@@ -118,7 +118,7 @@ struct greth_private {
118 118
119 int irq; 119 int irq;
120 120
121 struct device *dev; /* Pointer to of_device->dev */ 121 struct device *dev; /* Pointer to platform_device->dev */
122 struct net_device *netdev; 122 struct net_device *netdev;
123 struct napi_struct napi; 123 struct napi_struct napi;
124 spinlock_t devlock; 124 spinlock_t devlock;
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c
index 0f1d4e96cf89..3506fd6ad726 100644
--- a/drivers/net/ibm_newemac/core.c
+++ b/drivers/net/ibm_newemac/core.c
@@ -2245,7 +2245,7 @@ static int emac_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
2245struct emac_depentry { 2245struct emac_depentry {
2246 u32 phandle; 2246 u32 phandle;
2247 struct device_node *node; 2247 struct device_node *node;
2248 struct of_device *ofdev; 2248 struct platform_device *ofdev;
2249 void *drvdata; 2249 void *drvdata;
2250}; 2250};
2251 2251
@@ -2339,11 +2339,11 @@ static int __devinit emac_wait_deps(struct emac_instance *dev)
2339 deps[EMAC_DEP_MDIO_IDX].phandle = dev->mdio_ph; 2339 deps[EMAC_DEP_MDIO_IDX].phandle = dev->mdio_ph;
2340 if (dev->blist && dev->blist > emac_boot_list) 2340 if (dev->blist && dev->blist > emac_boot_list)
2341 deps[EMAC_DEP_PREV_IDX].phandle = 0xffffffffu; 2341 deps[EMAC_DEP_PREV_IDX].phandle = 0xffffffffu;
2342 bus_register_notifier(&of_platform_bus_type, &emac_of_bus_notifier); 2342 bus_register_notifier(&platform_bus_type, &emac_of_bus_notifier);
2343 wait_event_timeout(emac_probe_wait, 2343 wait_event_timeout(emac_probe_wait,
2344 emac_check_deps(dev, deps), 2344 emac_check_deps(dev, deps),
2345 EMAC_PROBE_DEP_TIMEOUT); 2345 EMAC_PROBE_DEP_TIMEOUT);
2346 bus_unregister_notifier(&of_platform_bus_type, &emac_of_bus_notifier); 2346 bus_unregister_notifier(&platform_bus_type, &emac_of_bus_notifier);
2347 err = emac_check_deps(dev, deps) ? 0 : -ENODEV; 2347 err = emac_check_deps(dev, deps) ? 0 : -ENODEV;
2348 for (i = 0; i < EMAC_DEP_COUNT; i++) { 2348 for (i = 0; i < EMAC_DEP_COUNT; i++) {
2349 if (deps[i].node) 2349 if (deps[i].node)
@@ -2719,7 +2719,7 @@ static const struct net_device_ops emac_gige_netdev_ops = {
2719 .ndo_change_mtu = emac_change_mtu, 2719 .ndo_change_mtu = emac_change_mtu,
2720}; 2720};
2721 2721
2722static int __devinit emac_probe(struct of_device *ofdev, 2722static int __devinit emac_probe(struct platform_device *ofdev,
2723 const struct of_device_id *match) 2723 const struct of_device_id *match)
2724{ 2724{
2725 struct net_device *ndev; 2725 struct net_device *ndev;
@@ -2941,7 +2941,7 @@ static int __devinit emac_probe(struct of_device *ofdev,
2941 return err; 2941 return err;
2942} 2942}
2943 2943
2944static int __devexit emac_remove(struct of_device *ofdev) 2944static int __devexit emac_remove(struct platform_device *ofdev)
2945{ 2945{
2946 struct emac_instance *dev = dev_get_drvdata(&ofdev->dev); 2946 struct emac_instance *dev = dev_get_drvdata(&ofdev->dev);
2947 2947
diff --git a/drivers/net/ibm_newemac/core.h b/drivers/net/ibm_newemac/core.h
index b1cbe6fdfc7a..9e37e3d9c51d 100644
--- a/drivers/net/ibm_newemac/core.h
+++ b/drivers/net/ibm_newemac/core.h
@@ -170,12 +170,12 @@ struct emac_instance {
170 struct net_device *ndev; 170 struct net_device *ndev;
171 struct resource rsrc_regs; 171 struct resource rsrc_regs;
172 struct emac_regs __iomem *emacp; 172 struct emac_regs __iomem *emacp;
173 struct of_device *ofdev; 173 struct platform_device *ofdev;
174 struct device_node **blist; /* bootlist entry */ 174 struct device_node **blist; /* bootlist entry */
175 175
176 /* MAL linkage */ 176 /* MAL linkage */
177 u32 mal_ph; 177 u32 mal_ph;
178 struct of_device *mal_dev; 178 struct platform_device *mal_dev;
179 u32 mal_rx_chan; 179 u32 mal_rx_chan;
180 u32 mal_tx_chan; 180 u32 mal_tx_chan;
181 struct mal_instance *mal; 181 struct mal_instance *mal;
@@ -196,24 +196,24 @@ struct emac_instance {
196 196
197 /* Shared MDIO if any */ 197 /* Shared MDIO if any */
198 u32 mdio_ph; 198 u32 mdio_ph;
199 struct of_device *mdio_dev; 199 struct platform_device *mdio_dev;
200 struct emac_instance *mdio_instance; 200 struct emac_instance *mdio_instance;
201 struct mutex mdio_lock; 201 struct mutex mdio_lock;
202 202
203 /* ZMII infos if any */ 203 /* ZMII infos if any */
204 u32 zmii_ph; 204 u32 zmii_ph;
205 u32 zmii_port; 205 u32 zmii_port;
206 struct of_device *zmii_dev; 206 struct platform_device *zmii_dev;
207 207
208 /* RGMII infos if any */ 208 /* RGMII infos if any */
209 u32 rgmii_ph; 209 u32 rgmii_ph;
210 u32 rgmii_port; 210 u32 rgmii_port;
211 struct of_device *rgmii_dev; 211 struct platform_device *rgmii_dev;
212 212
213 /* TAH infos if any */ 213 /* TAH infos if any */
214 u32 tah_ph; 214 u32 tah_ph;
215 u32 tah_port; 215 u32 tah_port;
216 struct of_device *tah_dev; 216 struct platform_device *tah_dev;
217 217
218 /* IRQs */ 218 /* IRQs */
219 int wol_irq; 219 int wol_irq;
diff --git a/drivers/net/ibm_newemac/debug.c b/drivers/net/ibm_newemac/debug.c
index 3995fafc1e08..8c6c1e2a8750 100644
--- a/drivers/net/ibm_newemac/debug.c
+++ b/drivers/net/ibm_newemac/debug.c
@@ -238,7 +238,7 @@ void emac_dbg_dump_all(void)
238} 238}
239 239
240#if defined(CONFIG_MAGIC_SYSRQ) 240#if defined(CONFIG_MAGIC_SYSRQ)
241static void emac_sysrq_handler(int key, struct tty_struct *tty) 241static void emac_sysrq_handler(int key)
242{ 242{
243 emac_dbg_dump_all(); 243 emac_dbg_dump_all();
244} 244}
diff --git a/drivers/net/ibm_newemac/mal.c b/drivers/net/ibm_newemac/mal.c
index fcff9e0bd382..d5717e2123e1 100644
--- a/drivers/net/ibm_newemac/mal.c
+++ b/drivers/net/ibm_newemac/mal.c
@@ -517,7 +517,7 @@ void *mal_dump_regs(struct mal_instance *mal, void *buf)
517 return regs + 1; 517 return regs + 1;
518} 518}
519 519
520static int __devinit mal_probe(struct of_device *ofdev, 520static int __devinit mal_probe(struct platform_device *ofdev,
521 const struct of_device_id *match) 521 const struct of_device_id *match)
522{ 522{
523 struct mal_instance *mal; 523 struct mal_instance *mal;
@@ -730,7 +730,7 @@ static int __devinit mal_probe(struct of_device *ofdev,
730 return err; 730 return err;
731} 731}
732 732
733static int __devexit mal_remove(struct of_device *ofdev) 733static int __devexit mal_remove(struct platform_device *ofdev)
734{ 734{
735 struct mal_instance *mal = dev_get_drvdata(&ofdev->dev); 735 struct mal_instance *mal = dev_get_drvdata(&ofdev->dev);
736 736
diff --git a/drivers/net/ibm_newemac/mal.h b/drivers/net/ibm_newemac/mal.h
index 9ededfbf0726..66084214bf45 100644
--- a/drivers/net/ibm_newemac/mal.h
+++ b/drivers/net/ibm_newemac/mal.h
@@ -210,7 +210,7 @@ struct mal_instance {
210 dma_addr_t bd_dma; 210 dma_addr_t bd_dma;
211 struct mal_descriptor *bd_virt; 211 struct mal_descriptor *bd_virt;
212 212
213 struct of_device *ofdev; 213 struct platform_device *ofdev;
214 int index; 214 int index;
215 spinlock_t lock; 215 spinlock_t lock;
216 216
diff --git a/drivers/net/ibm_newemac/rgmii.c b/drivers/net/ibm_newemac/rgmii.c
index 108919bcdf13..dd61798897ac 100644
--- a/drivers/net/ibm_newemac/rgmii.c
+++ b/drivers/net/ibm_newemac/rgmii.c
@@ -93,7 +93,7 @@ static inline u32 rgmii_mode_mask(int mode, int input)
93 } 93 }
94} 94}
95 95
96int __devinit rgmii_attach(struct of_device *ofdev, int input, int mode) 96int __devinit rgmii_attach(struct platform_device *ofdev, int input, int mode)
97{ 97{
98 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); 98 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
99 struct rgmii_regs __iomem *p = dev->base; 99 struct rgmii_regs __iomem *p = dev->base;
@@ -122,7 +122,7 @@ int __devinit rgmii_attach(struct of_device *ofdev, int input, int mode)
122 return 0; 122 return 0;
123} 123}
124 124
125void rgmii_set_speed(struct of_device *ofdev, int input, int speed) 125void rgmii_set_speed(struct platform_device *ofdev, int input, int speed)
126{ 126{
127 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); 127 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
128 struct rgmii_regs __iomem *p = dev->base; 128 struct rgmii_regs __iomem *p = dev->base;
@@ -144,7 +144,7 @@ void rgmii_set_speed(struct of_device *ofdev, int input, int speed)
144 mutex_unlock(&dev->lock); 144 mutex_unlock(&dev->lock);
145} 145}
146 146
147void rgmii_get_mdio(struct of_device *ofdev, int input) 147void rgmii_get_mdio(struct platform_device *ofdev, int input)
148{ 148{
149 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); 149 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
150 struct rgmii_regs __iomem *p = dev->base; 150 struct rgmii_regs __iomem *p = dev->base;
@@ -165,7 +165,7 @@ void rgmii_get_mdio(struct of_device *ofdev, int input)
165 DBG2(dev, " fer = 0x%08x\n", fer); 165 DBG2(dev, " fer = 0x%08x\n", fer);
166} 166}
167 167
168void rgmii_put_mdio(struct of_device *ofdev, int input) 168void rgmii_put_mdio(struct platform_device *ofdev, int input)
169{ 169{
170 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); 170 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
171 struct rgmii_regs __iomem *p = dev->base; 171 struct rgmii_regs __iomem *p = dev->base;
@@ -186,7 +186,7 @@ void rgmii_put_mdio(struct of_device *ofdev, int input)
186 mutex_unlock(&dev->lock); 186 mutex_unlock(&dev->lock);
187} 187}
188 188
189void rgmii_detach(struct of_device *ofdev, int input) 189void rgmii_detach(struct platform_device *ofdev, int input)
190{ 190{
191 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); 191 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
192 struct rgmii_regs __iomem *p; 192 struct rgmii_regs __iomem *p;
@@ -206,13 +206,13 @@ void rgmii_detach(struct of_device *ofdev, int input)
206 mutex_unlock(&dev->lock); 206 mutex_unlock(&dev->lock);
207} 207}
208 208
209int rgmii_get_regs_len(struct of_device *ofdev) 209int rgmii_get_regs_len(struct platform_device *ofdev)
210{ 210{
211 return sizeof(struct emac_ethtool_regs_subhdr) + 211 return sizeof(struct emac_ethtool_regs_subhdr) +
212 sizeof(struct rgmii_regs); 212 sizeof(struct rgmii_regs);
213} 213}
214 214
215void *rgmii_dump_regs(struct of_device *ofdev, void *buf) 215void *rgmii_dump_regs(struct platform_device *ofdev, void *buf)
216{ 216{
217 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); 217 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
218 struct emac_ethtool_regs_subhdr *hdr = buf; 218 struct emac_ethtool_regs_subhdr *hdr = buf;
@@ -228,7 +228,7 @@ void *rgmii_dump_regs(struct of_device *ofdev, void *buf)
228} 228}
229 229
230 230
231static int __devinit rgmii_probe(struct of_device *ofdev, 231static int __devinit rgmii_probe(struct platform_device *ofdev,
232 const struct of_device_id *match) 232 const struct of_device_id *match)
233{ 233{
234 struct device_node *np = ofdev->dev.of_node; 234 struct device_node *np = ofdev->dev.of_node;
@@ -293,7 +293,7 @@ static int __devinit rgmii_probe(struct of_device *ofdev,
293 return rc; 293 return rc;
294} 294}
295 295
296static int __devexit rgmii_remove(struct of_device *ofdev) 296static int __devexit rgmii_remove(struct platform_device *ofdev)
297{ 297{
298 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); 298 struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev);
299 299
diff --git a/drivers/net/ibm_newemac/rgmii.h b/drivers/net/ibm_newemac/rgmii.h
index c4a4b358a270..d69799049865 100644
--- a/drivers/net/ibm_newemac/rgmii.h
+++ b/drivers/net/ibm_newemac/rgmii.h
@@ -51,20 +51,20 @@ struct rgmii_instance {
51 int users; 51 int users;
52 52
53 /* OF device instance */ 53 /* OF device instance */
54 struct of_device *ofdev; 54 struct platform_device *ofdev;
55}; 55};
56 56
57#ifdef CONFIG_IBM_NEW_EMAC_RGMII 57#ifdef CONFIG_IBM_NEW_EMAC_RGMII
58 58
59extern int rgmii_init(void); 59extern int rgmii_init(void);
60extern void rgmii_exit(void); 60extern void rgmii_exit(void);
61extern int rgmii_attach(struct of_device *ofdev, int input, int mode); 61extern int rgmii_attach(struct platform_device *ofdev, int input, int mode);
62extern void rgmii_detach(struct of_device *ofdev, int input); 62extern void rgmii_detach(struct platform_device *ofdev, int input);
63extern void rgmii_get_mdio(struct of_device *ofdev, int input); 63extern void rgmii_get_mdio(struct platform_device *ofdev, int input);
64extern void rgmii_put_mdio(struct of_device *ofdev, int input); 64extern void rgmii_put_mdio(struct platform_device *ofdev, int input);
65extern void rgmii_set_speed(struct of_device *ofdev, int input, int speed); 65extern void rgmii_set_speed(struct platform_device *ofdev, int input, int speed);
66extern int rgmii_get_regs_len(struct of_device *ofdev); 66extern int rgmii_get_regs_len(struct platform_device *ofdev);
67extern void *rgmii_dump_regs(struct of_device *ofdev, void *buf); 67extern void *rgmii_dump_regs(struct platform_device *ofdev, void *buf);
68 68
69#else 69#else
70 70
diff --git a/drivers/net/ibm_newemac/tah.c b/drivers/net/ibm_newemac/tah.c
index 044637144c43..299aa49490c0 100644
--- a/drivers/net/ibm_newemac/tah.c
+++ b/drivers/net/ibm_newemac/tah.c
@@ -23,7 +23,7 @@
23#include "emac.h" 23#include "emac.h"
24#include "core.h" 24#include "core.h"
25 25
26int __devinit tah_attach(struct of_device *ofdev, int channel) 26int __devinit tah_attach(struct platform_device *ofdev, int channel)
27{ 27{
28 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); 28 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev);
29 29
@@ -35,7 +35,7 @@ int __devinit tah_attach(struct of_device *ofdev, int channel)
35 return 0; 35 return 0;
36} 36}
37 37
38void tah_detach(struct of_device *ofdev, int channel) 38void tah_detach(struct platform_device *ofdev, int channel)
39{ 39{
40 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); 40 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev);
41 41
@@ -44,7 +44,7 @@ void tah_detach(struct of_device *ofdev, int channel)
44 mutex_unlock(&dev->lock); 44 mutex_unlock(&dev->lock);
45} 45}
46 46
47void tah_reset(struct of_device *ofdev) 47void tah_reset(struct platform_device *ofdev)
48{ 48{
49 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); 49 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev);
50 struct tah_regs __iomem *p = dev->base; 50 struct tah_regs __iomem *p = dev->base;
@@ -66,13 +66,13 @@ void tah_reset(struct of_device *ofdev)
66 TAH_MR_DIG); 66 TAH_MR_DIG);
67} 67}
68 68
69int tah_get_regs_len(struct of_device *ofdev) 69int tah_get_regs_len(struct platform_device *ofdev)
70{ 70{
71 return sizeof(struct emac_ethtool_regs_subhdr) + 71 return sizeof(struct emac_ethtool_regs_subhdr) +
72 sizeof(struct tah_regs); 72 sizeof(struct tah_regs);
73} 73}
74 74
75void *tah_dump_regs(struct of_device *ofdev, void *buf) 75void *tah_dump_regs(struct platform_device *ofdev, void *buf)
76{ 76{
77 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); 77 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev);
78 struct emac_ethtool_regs_subhdr *hdr = buf; 78 struct emac_ethtool_regs_subhdr *hdr = buf;
@@ -87,7 +87,7 @@ void *tah_dump_regs(struct of_device *ofdev, void *buf)
87 return regs + 1; 87 return regs + 1;
88} 88}
89 89
90static int __devinit tah_probe(struct of_device *ofdev, 90static int __devinit tah_probe(struct platform_device *ofdev,
91 const struct of_device_id *match) 91 const struct of_device_id *match)
92{ 92{
93 struct device_node *np = ofdev->dev.of_node; 93 struct device_node *np = ofdev->dev.of_node;
@@ -139,7 +139,7 @@ static int __devinit tah_probe(struct of_device *ofdev,
139 return rc; 139 return rc;
140} 140}
141 141
142static int __devexit tah_remove(struct of_device *ofdev) 142static int __devexit tah_remove(struct platform_device *ofdev)
143{ 143{
144 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); 144 struct tah_instance *dev = dev_get_drvdata(&ofdev->dev);
145 145
diff --git a/drivers/net/ibm_newemac/tah.h b/drivers/net/ibm_newemac/tah.h
index a068b5658dad..61dbeca006d1 100644
--- a/drivers/net/ibm_newemac/tah.h
+++ b/drivers/net/ibm_newemac/tah.h
@@ -48,7 +48,7 @@ struct tah_instance {
48 int users; 48 int users;
49 49
50 /* OF device instance */ 50 /* OF device instance */
51 struct of_device *ofdev; 51 struct platform_device *ofdev;
52}; 52};
53 53
54 54
@@ -74,11 +74,11 @@ struct tah_instance {
74 74
75extern int tah_init(void); 75extern int tah_init(void);
76extern void tah_exit(void); 76extern void tah_exit(void);
77extern int tah_attach(struct of_device *ofdev, int channel); 77extern int tah_attach(struct platform_device *ofdev, int channel);
78extern void tah_detach(struct of_device *ofdev, int channel); 78extern void tah_detach(struct platform_device *ofdev, int channel);
79extern void tah_reset(struct of_device *ofdev); 79extern void tah_reset(struct platform_device *ofdev);
80extern int tah_get_regs_len(struct of_device *ofdev); 80extern int tah_get_regs_len(struct platform_device *ofdev);
81extern void *tah_dump_regs(struct of_device *ofdev, void *buf); 81extern void *tah_dump_regs(struct platform_device *ofdev, void *buf);
82 82
83#else 83#else
84 84
diff --git a/drivers/net/ibm_newemac/zmii.c b/drivers/net/ibm_newemac/zmii.c
index 046dcd069c45..34ed6ee8ca8a 100644
--- a/drivers/net/ibm_newemac/zmii.c
+++ b/drivers/net/ibm_newemac/zmii.c
@@ -82,7 +82,7 @@ static inline u32 zmii_mode_mask(int mode, int input)
82 } 82 }
83} 83}
84 84
85int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode) 85int __devinit zmii_attach(struct platform_device *ofdev, int input, int *mode)
86{ 86{
87 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); 87 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev);
88 struct zmii_regs __iomem *p = dev->base; 88 struct zmii_regs __iomem *p = dev->base;
@@ -148,7 +148,7 @@ int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode)
148 return 0; 148 return 0;
149} 149}
150 150
151void zmii_get_mdio(struct of_device *ofdev, int input) 151void zmii_get_mdio(struct platform_device *ofdev, int input)
152{ 152{
153 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); 153 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev);
154 u32 fer; 154 u32 fer;
@@ -161,7 +161,7 @@ void zmii_get_mdio(struct of_device *ofdev, int input)
161 out_be32(&dev->base->fer, fer | ZMII_FER_MDI(input)); 161 out_be32(&dev->base->fer, fer | ZMII_FER_MDI(input));
162} 162}
163 163
164void zmii_put_mdio(struct of_device *ofdev, int input) 164void zmii_put_mdio(struct platform_device *ofdev, int input)
165{ 165{
166 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); 166 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev);
167 167
@@ -170,7 +170,7 @@ void zmii_put_mdio(struct of_device *ofdev, int input)
170} 170}
171 171
172 172
173void zmii_set_speed(struct of_device *ofdev, int input, int speed) 173void zmii_set_speed(struct platform_device *ofdev, int input, int speed)
174{ 174{
175 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); 175 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev);
176 u32 ssr; 176 u32 ssr;
@@ -191,7 +191,7 @@ void zmii_set_speed(struct of_device *ofdev, int input, int speed)
191 mutex_unlock(&dev->lock); 191 mutex_unlock(&dev->lock);
192} 192}
193 193
194void zmii_detach(struct of_device *ofdev, int input) 194void zmii_detach(struct platform_device *ofdev, int input)
195{ 195{
196 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); 196 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev);
197 197
@@ -210,13 +210,13 @@ void zmii_detach(struct of_device *ofdev, int input)
210 mutex_unlock(&dev->lock); 210 mutex_unlock(&dev->lock);
211} 211}
212 212
213int zmii_get_regs_len(struct of_device *ofdev) 213int zmii_get_regs_len(struct platform_device *ofdev)
214{ 214{
215 return sizeof(struct emac_ethtool_regs_subhdr) + 215 return sizeof(struct emac_ethtool_regs_subhdr) +
216 sizeof(struct zmii_regs); 216 sizeof(struct zmii_regs);
217} 217}
218 218
219void *zmii_dump_regs(struct of_device *ofdev, void *buf) 219void *zmii_dump_regs(struct platform_device *ofdev, void *buf)
220{ 220{
221 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); 221 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev);
222 struct emac_ethtool_regs_subhdr *hdr = buf; 222 struct emac_ethtool_regs_subhdr *hdr = buf;
@@ -231,7 +231,7 @@ void *zmii_dump_regs(struct of_device *ofdev, void *buf)
231 return regs + 1; 231 return regs + 1;
232} 232}
233 233
234static int __devinit zmii_probe(struct of_device *ofdev, 234static int __devinit zmii_probe(struct platform_device *ofdev,
235 const struct of_device_id *match) 235 const struct of_device_id *match)
236{ 236{
237 struct device_node *np = ofdev->dev.of_node; 237 struct device_node *np = ofdev->dev.of_node;
@@ -286,7 +286,7 @@ static int __devinit zmii_probe(struct of_device *ofdev,
286 return rc; 286 return rc;
287} 287}
288 288
289static int __devexit zmii_remove(struct of_device *ofdev) 289static int __devexit zmii_remove(struct platform_device *ofdev)
290{ 290{
291 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); 291 struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev);
292 292
diff --git a/drivers/net/ibm_newemac/zmii.h b/drivers/net/ibm_newemac/zmii.h
index 6c9beba0c4b6..1333fa2b2781 100644
--- a/drivers/net/ibm_newemac/zmii.h
+++ b/drivers/net/ibm_newemac/zmii.h
@@ -48,20 +48,20 @@ struct zmii_instance {
48 u32 fer_save; 48 u32 fer_save;
49 49
50 /* OF device instance */ 50 /* OF device instance */
51 struct of_device *ofdev; 51 struct platform_device *ofdev;
52}; 52};
53 53
54#ifdef CONFIG_IBM_NEW_EMAC_ZMII 54#ifdef CONFIG_IBM_NEW_EMAC_ZMII
55 55
56extern int zmii_init(void); 56extern int zmii_init(void);
57extern void zmii_exit(void); 57extern void zmii_exit(void);
58extern int zmii_attach(struct of_device *ofdev, int input, int *mode); 58extern int zmii_attach(struct platform_device *ofdev, int input, int *mode);
59extern void zmii_detach(struct of_device *ofdev, int input); 59extern void zmii_detach(struct platform_device *ofdev, int input);
60extern void zmii_get_mdio(struct of_device *ofdev, int input); 60extern void zmii_get_mdio(struct platform_device *ofdev, int input);
61extern void zmii_put_mdio(struct of_device *ofdev, int input); 61extern void zmii_put_mdio(struct platform_device *ofdev, int input);
62extern void zmii_set_speed(struct of_device *ofdev, int input, int speed); 62extern void zmii_set_speed(struct platform_device *ofdev, int input, int speed);
63extern int zmii_get_regs_len(struct of_device *ocpdev); 63extern int zmii_get_regs_len(struct platform_device *ocpdev);
64extern void *zmii_dump_regs(struct of_device *ofdev, void *buf); 64extern void *zmii_dump_regs(struct platform_device *ofdev, void *buf);
65 65
66#else 66#else
67# define zmii_init() 0 67# define zmii_init() 0
diff --git a/drivers/net/irda/sh_irda.c b/drivers/net/irda/sh_irda.c
index edd5666f0ffb..9e3f4f54281d 100644
--- a/drivers/net/irda/sh_irda.c
+++ b/drivers/net/irda/sh_irda.c
@@ -748,7 +748,6 @@ static int __devinit sh_irda_probe(struct platform_device *pdev)
748 struct net_device *ndev; 748 struct net_device *ndev;
749 struct sh_irda_self *self; 749 struct sh_irda_self *self;
750 struct resource *res; 750 struct resource *res;
751 char clk_name[8];
752 int irq; 751 int irq;
753 int err = -ENOMEM; 752 int err = -ENOMEM;
754 753
@@ -775,10 +774,9 @@ static int __devinit sh_irda_probe(struct platform_device *pdev)
775 if (err) 774 if (err)
776 goto err_mem_2; 775 goto err_mem_2;
777 776
778 snprintf(clk_name, sizeof(clk_name), "irda%d", pdev->id); 777 self->clk = clk_get(&pdev->dev, NULL);
779 self->clk = clk_get(&pdev->dev, clk_name);
780 if (IS_ERR(self->clk)) { 778 if (IS_ERR(self->clk)) {
781 dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); 779 dev_err(&pdev->dev, "cannot get irda clock\n");
782 goto err_mem_3; 780 goto err_mem_3;
783 } 781 }
784 782
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c
index 09b813f1c3cd..bdf2149e5296 100644
--- a/drivers/net/ll_temac_main.c
+++ b/drivers/net/ll_temac_main.c
@@ -159,7 +159,7 @@ static void temac_dma_dcr_out(struct temac_local *lp, int reg, u32 value)
159 * temac_dcr_setup - If the DMA is DCR based, then setup the address and 159 * temac_dcr_setup - If the DMA is DCR based, then setup the address and
160 * I/O functions 160 * I/O functions
161 */ 161 */
162static int temac_dcr_setup(struct temac_local *lp, struct of_device *op, 162static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op,
163 struct device_node *np) 163 struct device_node *np)
164{ 164{
165 unsigned int dcrs; 165 unsigned int dcrs;
@@ -184,7 +184,7 @@ static int temac_dcr_setup(struct temac_local *lp, struct of_device *op,
184 * temac_dcr_setup - This is a stub for when DCR is not supported, 184 * temac_dcr_setup - This is a stub for when DCR is not supported,
185 * such as with MicroBlaze 185 * such as with MicroBlaze
186 */ 186 */
187static int temac_dcr_setup(struct temac_local *lp, struct of_device *op, 187static int temac_dcr_setup(struct temac_local *lp, struct platform_device *op,
188 struct device_node *np) 188 struct device_node *np)
189{ 189{
190 return -1; 190 return -1;
@@ -952,7 +952,7 @@ static const struct attribute_group temac_attr_group = {
952}; 952};
953 953
954static int __init 954static int __init
955temac_of_probe(struct of_device *op, const struct of_device_id *match) 955temac_of_probe(struct platform_device *op, const struct of_device_id *match)
956{ 956{
957 struct device_node *np; 957 struct device_node *np;
958 struct temac_local *lp; 958 struct temac_local *lp;
@@ -1094,7 +1094,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match)
1094 return rc; 1094 return rc;
1095} 1095}
1096 1096
1097static int __devexit temac_of_remove(struct of_device *op) 1097static int __devexit temac_of_remove(struct platform_device *op)
1098{ 1098{
1099 struct net_device *ndev = dev_get_drvdata(&op->dev); 1099 struct net_device *ndev = dev_get_drvdata(&op->dev);
1100 struct temac_local *lp = netdev_priv(ndev); 1100 struct temac_local *lp = netdev_priv(ndev);
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index d771d1650d60..fb2c0927d3cc 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -239,6 +239,7 @@ struct myri10ge_priv {
239 int watchdog_resets; 239 int watchdog_resets;
240 int watchdog_pause; 240 int watchdog_pause;
241 int pause; 241 int pause;
242 bool fw_name_allocated;
242 char *fw_name; 243 char *fw_name;
243 char eeprom_strings[MYRI10GE_EEPROM_STRINGS_SIZE]; 244 char eeprom_strings[MYRI10GE_EEPROM_STRINGS_SIZE];
244 char *product_code_string; 245 char *product_code_string;
@@ -271,6 +272,7 @@ MODULE_FIRMWARE("myri10ge_eth_z8e.dat");
271MODULE_FIRMWARE("myri10ge_rss_ethp_z8e.dat"); 272MODULE_FIRMWARE("myri10ge_rss_ethp_z8e.dat");
272MODULE_FIRMWARE("myri10ge_rss_eth_z8e.dat"); 273MODULE_FIRMWARE("myri10ge_rss_eth_z8e.dat");
273 274
275/* Careful: must be accessed under kparam_block_sysfs_write */
274static char *myri10ge_fw_name = NULL; 276static char *myri10ge_fw_name = NULL;
275module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR); 277module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR);
276MODULE_PARM_DESC(myri10ge_fw_name, "Firmware image name"); 278MODULE_PARM_DESC(myri10ge_fw_name, "Firmware image name");
@@ -376,6 +378,14 @@ static inline void put_be32(__be32 val, __be32 __iomem * p)
376 378
377static struct net_device_stats *myri10ge_get_stats(struct net_device *dev); 379static struct net_device_stats *myri10ge_get_stats(struct net_device *dev);
378 380
381static void set_fw_name(struct myri10ge_priv *mgp, char *name, bool allocated)
382{
383 if (mgp->fw_name_allocated)
384 kfree(mgp->fw_name);
385 mgp->fw_name = name;
386 mgp->fw_name_allocated = allocated;
387}
388
379static int 389static int
380myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, 390myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
381 struct myri10ge_cmd *data, int atomic) 391 struct myri10ge_cmd *data, int atomic)
@@ -747,7 +757,7 @@ static int myri10ge_load_firmware(struct myri10ge_priv *mgp, int adopt)
747 dev_warn(&mgp->pdev->dev, "via hotplug\n"); 757 dev_warn(&mgp->pdev->dev, "via hotplug\n");
748 } 758 }
749 759
750 mgp->fw_name = "adopted"; 760 set_fw_name(mgp, "adopted", false);
751 mgp->tx_boundary = 2048; 761 mgp->tx_boundary = 2048;
752 myri10ge_dummy_rdma(mgp, 1); 762 myri10ge_dummy_rdma(mgp, 1);
753 status = myri10ge_get_firmware_capabilities(mgp); 763 status = myri10ge_get_firmware_capabilities(mgp);
@@ -3233,7 +3243,7 @@ static void myri10ge_firmware_probe(struct myri10ge_priv *mgp)
3233 * load the optimized firmware (which assumes aligned PCIe 3243 * load the optimized firmware (which assumes aligned PCIe
3234 * completions) in order to see if it works on this host. 3244 * completions) in order to see if it works on this host.
3235 */ 3245 */
3236 mgp->fw_name = myri10ge_fw_aligned; 3246 set_fw_name(mgp, myri10ge_fw_aligned, false);
3237 status = myri10ge_load_firmware(mgp, 1); 3247 status = myri10ge_load_firmware(mgp, 1);
3238 if (status != 0) { 3248 if (status != 0) {
3239 goto abort; 3249 goto abort;
@@ -3261,7 +3271,7 @@ static void myri10ge_firmware_probe(struct myri10ge_priv *mgp)
3261abort: 3271abort:
3262 /* fall back to using the unaligned firmware */ 3272 /* fall back to using the unaligned firmware */
3263 mgp->tx_boundary = 2048; 3273 mgp->tx_boundary = 2048;
3264 mgp->fw_name = myri10ge_fw_unaligned; 3274 set_fw_name(mgp, myri10ge_fw_unaligned, false);
3265 3275
3266} 3276}
3267 3277
@@ -3284,7 +3294,7 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
3284 dev_info(&mgp->pdev->dev, "PCIE x%d Link\n", 3294 dev_info(&mgp->pdev->dev, "PCIE x%d Link\n",
3285 link_width); 3295 link_width);
3286 mgp->tx_boundary = 4096; 3296 mgp->tx_boundary = 4096;
3287 mgp->fw_name = myri10ge_fw_aligned; 3297 set_fw_name(mgp, myri10ge_fw_aligned, false);
3288 } else { 3298 } else {
3289 myri10ge_firmware_probe(mgp); 3299 myri10ge_firmware_probe(mgp);
3290 } 3300 }
@@ -3293,22 +3303,29 @@ static void myri10ge_select_firmware(struct myri10ge_priv *mgp)
3293 dev_info(&mgp->pdev->dev, 3303 dev_info(&mgp->pdev->dev,
3294 "Assuming aligned completions (forced)\n"); 3304 "Assuming aligned completions (forced)\n");
3295 mgp->tx_boundary = 4096; 3305 mgp->tx_boundary = 4096;
3296 mgp->fw_name = myri10ge_fw_aligned; 3306 set_fw_name(mgp, myri10ge_fw_aligned, false);
3297 } else { 3307 } else {
3298 dev_info(&mgp->pdev->dev, 3308 dev_info(&mgp->pdev->dev,
3299 "Assuming unaligned completions (forced)\n"); 3309 "Assuming unaligned completions (forced)\n");
3300 mgp->tx_boundary = 2048; 3310 mgp->tx_boundary = 2048;
3301 mgp->fw_name = myri10ge_fw_unaligned; 3311 set_fw_name(mgp, myri10ge_fw_unaligned, false);
3302 } 3312 }
3303 } 3313 }
3314
3315 kparam_block_sysfs_write(myri10ge_fw_name);
3304 if (myri10ge_fw_name != NULL) { 3316 if (myri10ge_fw_name != NULL) {
3305 overridden = 1; 3317 char *fw_name = kstrdup(myri10ge_fw_name, GFP_KERNEL);
3306 mgp->fw_name = myri10ge_fw_name; 3318 if (fw_name) {
3319 overridden = 1;
3320 set_fw_name(mgp, fw_name, true);
3321 }
3307 } 3322 }
3323 kparam_unblock_sysfs_write(myri10ge_fw_name);
3324
3308 if (mgp->board_number < MYRI10GE_MAX_BOARDS && 3325 if (mgp->board_number < MYRI10GE_MAX_BOARDS &&
3309 myri10ge_fw_names[mgp->board_number] != NULL && 3326 myri10ge_fw_names[mgp->board_number] != NULL &&
3310 strlen(myri10ge_fw_names[mgp->board_number])) { 3327 strlen(myri10ge_fw_names[mgp->board_number])) {
3311 mgp->fw_name = myri10ge_fw_names[mgp->board_number]; 3328 set_fw_name(mgp, myri10ge_fw_names[mgp->board_number], false);
3312 overridden = 1; 3329 overridden = 1;
3313 } 3330 }
3314 if (overridden) 3331 if (overridden)
@@ -3660,6 +3677,7 @@ static void myri10ge_probe_slices(struct myri10ge_priv *mgp)
3660 struct myri10ge_cmd cmd; 3677 struct myri10ge_cmd cmd;
3661 struct pci_dev *pdev = mgp->pdev; 3678 struct pci_dev *pdev = mgp->pdev;
3662 char *old_fw; 3679 char *old_fw;
3680 bool old_allocated;
3663 int i, status, ncpus, msix_cap; 3681 int i, status, ncpus, msix_cap;
3664 3682
3665 mgp->num_slices = 1; 3683 mgp->num_slices = 1;
@@ -3672,17 +3690,23 @@ static void myri10ge_probe_slices(struct myri10ge_priv *mgp)
3672 3690
3673 /* try to load the slice aware rss firmware */ 3691 /* try to load the slice aware rss firmware */
3674 old_fw = mgp->fw_name; 3692 old_fw = mgp->fw_name;
3693 old_allocated = mgp->fw_name_allocated;
3694 /* don't free old_fw if we override it. */
3695 mgp->fw_name_allocated = false;
3696
3675 if (myri10ge_fw_name != NULL) { 3697 if (myri10ge_fw_name != NULL) {
3676 dev_info(&mgp->pdev->dev, "overriding rss firmware to %s\n", 3698 dev_info(&mgp->pdev->dev, "overriding rss firmware to %s\n",
3677 myri10ge_fw_name); 3699 myri10ge_fw_name);
3678 mgp->fw_name = myri10ge_fw_name; 3700 set_fw_name(mgp, myri10ge_fw_name, false);
3679 } else if (old_fw == myri10ge_fw_aligned) 3701 } else if (old_fw == myri10ge_fw_aligned)
3680 mgp->fw_name = myri10ge_fw_rss_aligned; 3702 set_fw_name(mgp, myri10ge_fw_rss_aligned, false);
3681 else 3703 else
3682 mgp->fw_name = myri10ge_fw_rss_unaligned; 3704 set_fw_name(mgp, myri10ge_fw_rss_unaligned, false);
3683 status = myri10ge_load_firmware(mgp, 0); 3705 status = myri10ge_load_firmware(mgp, 0);
3684 if (status != 0) { 3706 if (status != 0) {
3685 dev_info(&pdev->dev, "Rss firmware not found\n"); 3707 dev_info(&pdev->dev, "Rss firmware not found\n");
3708 if (old_allocated)
3709 kfree(old_fw);
3686 return; 3710 return;
3687 } 3711 }
3688 3712
@@ -3747,6 +3771,8 @@ static void myri10ge_probe_slices(struct myri10ge_priv *mgp)
3747 mgp->num_slices); 3771 mgp->num_slices);
3748 if (status == 0) { 3772 if (status == 0) {
3749 pci_disable_msix(pdev); 3773 pci_disable_msix(pdev);
3774 if (old_allocated)
3775 kfree(old_fw);
3750 return; 3776 return;
3751 } 3777 }
3752 if (status > 0) 3778 if (status > 0)
@@ -3763,7 +3789,7 @@ disable_msix:
3763 3789
3764abort_with_fw: 3790abort_with_fw:
3765 mgp->num_slices = 1; 3791 mgp->num_slices = 1;
3766 mgp->fw_name = old_fw; 3792 set_fw_name(mgp, old_fw, old_allocated);
3767 myri10ge_load_firmware(mgp, 0); 3793 myri10ge_load_firmware(mgp, 0);
3768} 3794}
3769 3795
@@ -3993,6 +4019,7 @@ abort_with_enabled:
3993 pci_disable_device(pdev); 4019 pci_disable_device(pdev);
3994 4020
3995abort_with_netdev: 4021abort_with_netdev:
4022 set_fw_name(mgp, NULL, false);
3996 free_netdev(netdev); 4023 free_netdev(netdev);
3997 return status; 4024 return status;
3998} 4025}
@@ -4037,6 +4064,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
4037 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd), 4064 dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
4038 mgp->cmd, mgp->cmd_bus); 4065 mgp->cmd, mgp->cmd_bus);
4039 4066
4067 set_fw_name(mgp, NULL, false);
4040 free_netdev(netdev); 4068 free_netdev(netdev);
4041 pci_disable_device(pdev); 4069 pci_disable_device(pdev);
4042 pci_set_drvdata(pdev, NULL); 4070 pci_set_drvdata(pdev, NULL);
diff --git a/drivers/net/myri_sbus.c b/drivers/net/myri_sbus.c
index 1a57c3da1f49..617f898ba5f0 100644
--- a/drivers/net/myri_sbus.c
+++ b/drivers/net/myri_sbus.c
@@ -926,7 +926,7 @@ static const struct net_device_ops myri_ops = {
926 .ndo_validate_addr = eth_validate_addr, 926 .ndo_validate_addr = eth_validate_addr,
927}; 927};
928 928
929static int __devinit myri_sbus_probe(struct of_device *op, const struct of_device_id *match) 929static int __devinit myri_sbus_probe(struct platform_device *op, const struct of_device_id *match)
930{ 930{
931 struct device_node *dp = op->dev.of_node; 931 struct device_node *dp = op->dev.of_node;
932 static unsigned version_printed; 932 static unsigned version_printed;
@@ -1079,7 +1079,7 @@ static int __devinit myri_sbus_probe(struct of_device *op, const struct of_devic
1079 1079
1080 mp->dev = dev; 1080 mp->dev = dev;
1081 dev->watchdog_timeo = 5*HZ; 1081 dev->watchdog_timeo = 5*HZ;
1082 dev->irq = op->irqs[0]; 1082 dev->irq = op->archdata.irqs[0];
1083 dev->netdev_ops = &myri_ops; 1083 dev->netdev_ops = &myri_ops;
1084 1084
1085 /* Register interrupt handler now. */ 1085 /* Register interrupt handler now. */
@@ -1124,7 +1124,7 @@ err:
1124 return -ENODEV; 1124 return -ENODEV;
1125} 1125}
1126 1126
1127static int __devexit myri_sbus_remove(struct of_device *op) 1127static int __devexit myri_sbus_remove(struct platform_device *op)
1128{ 1128{
1129 struct myri_eth *mp = dev_get_drvdata(&op->dev); 1129 struct myri_eth *mp = dev_get_drvdata(&op->dev);
1130 struct net_device *net_dev = mp->dev; 1130 struct net_device *net_dev = mp->dev;
@@ -1172,12 +1172,12 @@ static struct of_platform_driver myri_sbus_driver = {
1172 1172
1173static int __init myri_sbus_init(void) 1173static int __init myri_sbus_init(void)
1174{ 1174{
1175 return of_register_driver(&myri_sbus_driver, &of_bus_type); 1175 return of_register_platform_driver(&myri_sbus_driver);
1176} 1176}
1177 1177
1178static void __exit myri_sbus_exit(void) 1178static void __exit myri_sbus_exit(void)
1179{ 1179{
1180 of_unregister_driver(&myri_sbus_driver); 1180 of_unregister_platform_driver(&myri_sbus_driver);
1181} 1181}
1182 1182
1183module_init(myri_sbus_init); 1183module_init(myri_sbus_init);
diff --git a/drivers/net/myri_sbus.h b/drivers/net/myri_sbus.h
index ff363e95d9cf..80a2fa5cf757 100644
--- a/drivers/net/myri_sbus.h
+++ b/drivers/net/myri_sbus.h
@@ -288,7 +288,7 @@ struct myri_eth {
288 struct myri_eeprom eeprom; /* Local copy of EEPROM. */ 288 struct myri_eeprom eeprom; /* Local copy of EEPROM. */
289 unsigned int reg_size; /* Size of register space. */ 289 unsigned int reg_size; /* Size of register space. */
290 unsigned int shmem_base; /* Offset to shared ram. */ 290 unsigned int shmem_base; /* Offset to shared ram. */
291 struct of_device *myri_op; /* Our OF device struct. */ 291 struct platform_device *myri_op; /* Our OF device struct. */
292}; 292};
293 293
294/* We use this to acquire receive skb's that we can DMA directly into. */ 294/* We use this to acquire receive skb's that we can DMA directly into. */
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index 340cbec48943..fe6983af6918 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -28,10 +28,7 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29 29
30#include <linux/io.h> 30#include <linux/io.h>
31
32#ifdef CONFIG_SPARC64
33#include <linux/of_device.h> 31#include <linux/of_device.h>
34#endif
35 32
36#include "niu.h" 33#include "niu.h"
37 34
@@ -9102,7 +9099,7 @@ retry:
9102static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map) 9099static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map)
9103{ 9100{
9104#ifdef CONFIG_SPARC64 9101#ifdef CONFIG_SPARC64
9105 struct of_device *op = np->op; 9102 struct platform_device *op = np->op;
9106 const u32 *int_prop; 9103 const u32 *int_prop;
9107 int i; 9104 int i;
9108 9105
@@ -9110,12 +9107,12 @@ static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map)
9110 if (!int_prop) 9107 if (!int_prop)
9111 return -ENODEV; 9108 return -ENODEV;
9112 9109
9113 for (i = 0; i < op->num_irqs; i++) { 9110 for (i = 0; i < op->archdata.num_irqs; i++) {
9114 ldg_num_map[i] = int_prop[i]; 9111 ldg_num_map[i] = int_prop[i];
9115 np->ldg[i].irq = op->irqs[i]; 9112 np->ldg[i].irq = op->archdata.irqs[i];
9116 } 9113 }
9117 9114
9118 np->num_ldg = op->num_irqs; 9115 np->num_ldg = op->archdata.num_irqs;
9119 9116
9120 return 0; 9117 return 0;
9121#else 9118#else
@@ -9687,7 +9684,7 @@ static void __devinit niu_driver_version(void)
9687 9684
9688static struct net_device * __devinit niu_alloc_and_init( 9685static struct net_device * __devinit niu_alloc_and_init(
9689 struct device *gen_dev, struct pci_dev *pdev, 9686 struct device *gen_dev, struct pci_dev *pdev,
9690 struct of_device *op, const struct niu_ops *ops, 9687 struct platform_device *op, const struct niu_ops *ops,
9691 u8 port) 9688 u8 port)
9692{ 9689{
9693 struct net_device *dev; 9690 struct net_device *dev;
@@ -10063,7 +10060,7 @@ static const struct niu_ops niu_phys_ops = {
10063 .unmap_single = niu_phys_unmap_single, 10060 .unmap_single = niu_phys_unmap_single,
10064}; 10061};
10065 10062
10066static int __devinit niu_of_probe(struct of_device *op, 10063static int __devinit niu_of_probe(struct platform_device *op,
10067 const struct of_device_id *match) 10064 const struct of_device_id *match)
10068{ 10065{
10069 union niu_parent_id parent_id; 10066 union niu_parent_id parent_id;
@@ -10178,7 +10175,7 @@ err_out:
10178 return err; 10175 return err;
10179} 10176}
10180 10177
10181static int __devexit niu_of_remove(struct of_device *op) 10178static int __devexit niu_of_remove(struct platform_device *op)
10182{ 10179{
10183 struct net_device *dev = dev_get_drvdata(&op->dev); 10180 struct net_device *dev = dev_get_drvdata(&op->dev);
10184 10181
@@ -10245,14 +10242,14 @@ static int __init niu_init(void)
10245 niu_debug = netif_msg_init(debug, NIU_MSG_DEFAULT); 10242 niu_debug = netif_msg_init(debug, NIU_MSG_DEFAULT);
10246 10243
10247#ifdef CONFIG_SPARC64 10244#ifdef CONFIG_SPARC64
10248 err = of_register_driver(&niu_of_driver, &of_bus_type); 10245 err = of_register_platform_driver(&niu_of_driver);
10249#endif 10246#endif
10250 10247
10251 if (!err) { 10248 if (!err) {
10252 err = pci_register_driver(&niu_pci_driver); 10249 err = pci_register_driver(&niu_pci_driver);
10253#ifdef CONFIG_SPARC64 10250#ifdef CONFIG_SPARC64
10254 if (err) 10251 if (err)
10255 of_unregister_driver(&niu_of_driver); 10252 of_unregister_platform_driver(&niu_of_driver);
10256#endif 10253#endif
10257 } 10254 }
10258 10255
@@ -10263,7 +10260,7 @@ static void __exit niu_exit(void)
10263{ 10260{
10264 pci_unregister_driver(&niu_pci_driver); 10261 pci_unregister_driver(&niu_pci_driver);
10265#ifdef CONFIG_SPARC64 10262#ifdef CONFIG_SPARC64
10266 of_unregister_driver(&niu_of_driver); 10263 of_unregister_platform_driver(&niu_of_driver);
10267#endif 10264#endif
10268} 10265}
10269 10266
diff --git a/drivers/net/niu.h b/drivers/net/niu.h
index d6715465f35d..a41fa8ebe05f 100644
--- a/drivers/net/niu.h
+++ b/drivers/net/niu.h
@@ -3236,7 +3236,7 @@ struct niu_phy_ops {
3236 int (*link_status)(struct niu *np, int *); 3236 int (*link_status)(struct niu *np, int *);
3237}; 3237};
3238 3238
3239struct of_device; 3239struct platform_device;
3240struct niu { 3240struct niu {
3241 void __iomem *regs; 3241 void __iomem *regs;
3242 struct net_device *dev; 3242 struct net_device *dev;
@@ -3297,7 +3297,7 @@ struct niu {
3297 struct niu_vpd vpd; 3297 struct niu_vpd vpd;
3298 u32 eeprom_len; 3298 u32 eeprom_len;
3299 3299
3300 struct of_device *op; 3300 struct platform_device *op;
3301 void __iomem *vir_regs_1; 3301 void __iomem *vir_regs_1;
3302 void __iomem *vir_regs_2; 3302 void __iomem *vir_regs_2;
3303}; 3303};
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 10ee106a1617..c683f77c6f42 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -87,7 +87,6 @@ earlier 3Com products.
87#include <linux/bitops.h> 87#include <linux/bitops.h>
88#include <linux/mii.h> 88#include <linux/mii.h>
89 89
90#include <pcmcia/cs_types.h>
91#include <pcmcia/cs.h> 90#include <pcmcia/cs.h>
92#include <pcmcia/cistpl.h> 91#include <pcmcia/cistpl.h>
93#include <pcmcia/cisreg.h> 92#include <pcmcia/cisreg.h>
@@ -279,8 +278,8 @@ static int tc574_probe(struct pcmcia_device *link)
279 lp->p_dev = link; 278 lp->p_dev = link;
280 279
281 spin_lock_init(&lp->window_lock); 280 spin_lock_init(&lp->window_lock);
282 link->io.NumPorts1 = 32; 281 link->resource[0]->end = 32;
283 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 282 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
284 link->conf.Attributes = CONF_ENABLE_IRQ; 283 link->conf.Attributes = CONF_ENABLE_IRQ;
285 link->conf.IntType = INT_MEMORY_AND_IO; 284 link->conf.IntType = INT_MEMORY_AND_IO;
286 link->conf.ConfigIndex = 1; 285 link->conf.ConfigIndex = 1;
@@ -338,10 +337,11 @@ static int tc574_config(struct pcmcia_device *link)
338 337
339 dev_dbg(&link->dev, "3c574_config()\n"); 338 dev_dbg(&link->dev, "3c574_config()\n");
340 339
341 link->io.IOAddrLines = 16; 340 link->io_lines = 16;
341
342 for (i = j = 0; j < 0x400; j += 0x20) { 342 for (i = j = 0; j < 0x400; j += 0x20) {
343 link->io.BasePort1 = j ^ 0x300; 343 link->resource[0]->start = j ^ 0x300;
344 i = pcmcia_request_io(link, &link->io); 344 i = pcmcia_request_io(link);
345 if (i == 0) 345 if (i == 0)
346 break; 346 break;
347 } 347 }
@@ -357,7 +357,7 @@ static int tc574_config(struct pcmcia_device *link)
357 goto failed; 357 goto failed;
358 358
359 dev->irq = link->irq; 359 dev->irq = link->irq;
360 dev->base_addr = link->io.BasePort1; 360 dev->base_addr = link->resource[0]->start;
361 361
362 ioaddr = dev->base_addr; 362 ioaddr = dev->base_addr;
363 363
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index ce63c3773b4c..61f9cf2100ff 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -41,7 +41,6 @@
41#include <linux/bitops.h> 41#include <linux/bitops.h>
42#include <linux/jiffies.h> 42#include <linux/jiffies.h>
43 43
44#include <pcmcia/cs_types.h>
45#include <pcmcia/cs.h> 44#include <pcmcia/cs.h>
46#include <pcmcia/cistpl.h> 45#include <pcmcia/cistpl.h>
47#include <pcmcia/cisreg.h> 46#include <pcmcia/cisreg.h>
@@ -214,8 +213,8 @@ static int tc589_probe(struct pcmcia_device *link)
214 lp->p_dev = link; 213 lp->p_dev = link;
215 214
216 spin_lock_init(&lp->lock); 215 spin_lock_init(&lp->lock);
217 link->io.NumPorts1 = 16; 216 link->resource[0]->end = 16;
218 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 217 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
219 218
220 link->conf.Attributes = CONF_ENABLE_IRQ; 219 link->conf.Attributes = CONF_ENABLE_IRQ;
221 link->conf.IntType = INT_MEMORY_AND_IO; 220 link->conf.IntType = INT_MEMORY_AND_IO;
@@ -278,12 +277,13 @@ static int tc589_config(struct pcmcia_device *link)
278 "3Com card??\n"); 277 "3Com card??\n");
279 multi = (link->card_id == PRODID_3COM_3C562); 278 multi = (link->card_id == PRODID_3COM_3C562);
280 279
280 link->io_lines = 16;
281
281 /* For the 3c562, the base address must be xx00-xx7f */ 282 /* For the 3c562, the base address must be xx00-xx7f */
282 link->io.IOAddrLines = 16;
283 for (i = j = 0; j < 0x400; j += 0x10) { 283 for (i = j = 0; j < 0x400; j += 0x10) {
284 if (multi && (j & 0x80)) continue; 284 if (multi && (j & 0x80)) continue;
285 link->io.BasePort1 = j ^ 0x300; 285 link->resource[0]->start = j ^ 0x300;
286 i = pcmcia_request_io(link, &link->io); 286 i = pcmcia_request_io(link);
287 if (i == 0) 287 if (i == 0)
288 break; 288 break;
289 } 289 }
@@ -299,7 +299,7 @@ static int tc589_config(struct pcmcia_device *link)
299 goto failed; 299 goto failed;
300 300
301 dev->irq = link->irq; 301 dev->irq = link->irq;
302 dev->base_addr = link->io.BasePort1; 302 dev->base_addr = link->resource[0]->start;
303 ioaddr = dev->base_addr; 303 ioaddr = dev->base_addr;
304 EL3WINDOW(0); 304 EL3WINDOW(0);
305 305
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 33525bf2a3d3..5f05ffb240cc 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -39,7 +39,6 @@
39#include <linux/mii.h> 39#include <linux/mii.h>
40#include "../8390.h" 40#include "../8390.h"
41 41
42#include <pcmcia/cs_types.h>
43#include <pcmcia/cs.h> 42#include <pcmcia/cs.h>
44#include <pcmcia/cistpl.h> 43#include <pcmcia/cistpl.h>
45#include <pcmcia/ciscode.h> 44#include <pcmcia/ciscode.h>
@@ -260,28 +259,30 @@ static int get_prom(struct pcmcia_device *link)
260static int try_io_port(struct pcmcia_device *link) 259static int try_io_port(struct pcmcia_device *link)
261{ 260{
262 int j, ret; 261 int j, ret;
263 if (link->io.NumPorts1 == 32) { 262 link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
264 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 263 link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
264 if (link->resource[0]->end == 32) {
265 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
265 /* for master/slave multifunction cards */ 266 /* for master/slave multifunction cards */
266 if (link->io.NumPorts2 > 0) 267 if (link->resource[1]->end > 0)
267 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 268 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
268 } else { 269 } else {
269 /* This should be two 16-port windows */ 270 /* This should be two 16-port windows */
270 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 271 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
271 link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 272 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
272 } 273 }
273 if (link->io.BasePort1 == 0) { 274 if (link->resource[0]->start == 0) {
274 link->io.IOAddrLines = 16;
275 for (j = 0; j < 0x400; j += 0x20) { 275 for (j = 0; j < 0x400; j += 0x20) {
276 link->io.BasePort1 = j ^ 0x300; 276 link->resource[0]->start = j ^ 0x300;
277 link->io.BasePort2 = (j ^ 0x300) + 0x10; 277 link->resource[1]->start = (j ^ 0x300) + 0x10;
278 ret = pcmcia_request_io(link, &link->io); 278 link->io_lines = 16;
279 ret = pcmcia_request_io(link);
279 if (ret == 0) 280 if (ret == 0)
280 return ret; 281 return ret;
281 } 282 }
282 return ret; 283 return ret;
283 } else { 284 } else {
284 return pcmcia_request_io(link, &link->io); 285 return pcmcia_request_io(link);
285 } 286 }
286} 287}
287 288
@@ -302,15 +303,15 @@ static int axnet_configcheck(struct pcmcia_device *p_dev,
302 network function with window 0, and serial with window 1 */ 303 network function with window 0, and serial with window 1 */
303 if (io->nwin > 1) { 304 if (io->nwin > 1) {
304 i = (io->win[1].len > io->win[0].len); 305 i = (io->win[1].len > io->win[0].len);
305 p_dev->io.BasePort2 = io->win[1-i].base; 306 p_dev->resource[1]->start = io->win[1-i].base;
306 p_dev->io.NumPorts2 = io->win[1-i].len; 307 p_dev->resource[1]->end = io->win[1-i].len;
307 } else { 308 } else {
308 i = p_dev->io.NumPorts2 = 0; 309 i = p_dev->resource[1]->end = 0;
309 } 310 }
310 p_dev->io.BasePort1 = io->win[i].base; 311 p_dev->resource[0]->start = io->win[i].base;
311 p_dev->io.NumPorts1 = io->win[i].len; 312 p_dev->resource[0]->end = io->win[i].len;
312 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 313 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
313 if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) 314 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
314 return try_io_port(p_dev); 315 return try_io_port(p_dev);
315 316
316 return -ENODEV; 317 return -ENODEV;
@@ -333,7 +334,7 @@ static int axnet_config(struct pcmcia_device *link)
333 if (!link->irq) 334 if (!link->irq)
334 goto failed; 335 goto failed;
335 336
336 if (link->io.NumPorts2 == 8) { 337 if (resource_size(link->resource[1]) == 8) {
337 link->conf.Attributes |= CONF_ENABLE_SPKR; 338 link->conf.Attributes |= CONF_ENABLE_SPKR;
338 link->conf.Status = CCSR_AUDIO_ENA; 339 link->conf.Status = CCSR_AUDIO_ENA;
339 } 340 }
@@ -343,7 +344,7 @@ static int axnet_config(struct pcmcia_device *link)
343 goto failed; 344 goto failed;
344 345
345 dev->irq = link->irq; 346 dev->irq = link->irq;
346 dev->base_addr = link->io.BasePort1; 347 dev->base_addr = link->resource[0]->start;
347 348
348 if (!get_prom(link)) { 349 if (!get_prom(link)) {
349 printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n"); 350 printk(KERN_NOTICE "axnet_cs: this is not an AX88190 card!\n");
@@ -379,8 +380,7 @@ static int axnet_config(struct pcmcia_device *link)
379 /* Maybe PHY is in power down mode. (PPD_SET = 1) 380 /* Maybe PHY is in power down mode. (PPD_SET = 1)
380 Bit 2 of CCSR is active low. */ 381 Bit 2 of CCSR is active low. */
381 if (i == 32) { 382 if (i == 32) {
382 conf_reg_t reg = { 0, CS_WRITE, CISREG_CCSR, 0x04 }; 383 pcmcia_write_config_byte(link, CISREG_CCSR, 0x04);
383 pcmcia_access_configuration_register(link, &reg);
384 for (i = 0; i < 32; i++) { 384 for (i = 0; i < 32; i++) {
385 j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1); 385 j = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 1);
386 j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2); 386 j2 = mdio_read(dev->base_addr + AXNET_MII_EEP, i, 2);
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c
index 5643f94541bc..3c400cfa82ae 100644
--- a/drivers/net/pcmcia/com20020_cs.c
+++ b/drivers/net/pcmcia/com20020_cs.c
@@ -43,7 +43,6 @@
43#include <linux/arcdevice.h> 43#include <linux/arcdevice.h>
44#include <linux/com20020.h> 44#include <linux/com20020.h>
45 45
46#include <pcmcia/cs_types.h>
47#include <pcmcia/cs.h> 46#include <pcmcia/cs.h>
48#include <pcmcia/cistpl.h> 47#include <pcmcia/cistpl.h>
49#include <pcmcia/ds.h> 48#include <pcmcia/ds.h>
@@ -159,9 +158,8 @@ static int com20020_probe(struct pcmcia_device *p_dev)
159 /* fill in our module parameters as defaults */ 158 /* fill in our module parameters as defaults */
160 dev->dev_addr[0] = node; 159 dev->dev_addr[0] = node;
161 160
162 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 161 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
163 p_dev->io.NumPorts1 = 16; 162 p_dev->resource[0]->end = 16;
164 p_dev->io.IOAddrLines = 16;
165 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 163 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
166 p_dev->conf.IntType = INT_MEMORY_AND_IO; 164 p_dev->conf.IntType = INT_MEMORY_AND_IO;
167 165
@@ -246,20 +244,24 @@ static int com20020_config(struct pcmcia_device *link)
246 244
247 dev_dbg(&link->dev, "com20020_config\n"); 245 dev_dbg(&link->dev, "com20020_config\n");
248 246
249 dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1); 247 dev_dbg(&link->dev, "baseport1 is %Xh\n",
248 (unsigned int) link->resource[0]->start);
249
250 i = -ENODEV; 250 i = -ENODEV;
251 if (!link->io.BasePort1) 251 link->io_lines = 16;
252
253 if (!link->resource[0]->start)
252 { 254 {
253 for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) 255 for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10)
254 { 256 {
255 link->io.BasePort1 = ioaddr; 257 link->resource[0]->start = ioaddr;
256 i = pcmcia_request_io(link, &link->io); 258 i = pcmcia_request_io(link);
257 if (i == 0) 259 if (i == 0)
258 break; 260 break;
259 } 261 }
260 } 262 }
261 else 263 else
262 i = pcmcia_request_io(link, &link->io); 264 i = pcmcia_request_io(link);
263 265
264 if (i != 0) 266 if (i != 0)
265 { 267 {
@@ -267,7 +269,7 @@ static int com20020_config(struct pcmcia_device *link)
267 goto failed; 269 goto failed;
268 } 270 }
269 271
270 ioaddr = dev->base_addr = link->io.BasePort1; 272 ioaddr = dev->base_addr = link->resource[0]->start;
271 dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr); 273 dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr);
272 274
273 dev_dbg(&link->dev, "request IRQ %d\n", 275 dev_dbg(&link->dev, "request IRQ %d\n",
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 7c27c50211a5..98fffb03ecd7 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -49,7 +49,6 @@
49#include <linux/ioport.h> 49#include <linux/ioport.h>
50#include <linux/crc32.h> 50#include <linux/crc32.h>
51 51
52#include <pcmcia/cs_types.h>
53#include <pcmcia/cs.h> 52#include <pcmcia/cs.h>
54#include <pcmcia/cistpl.h> 53#include <pcmcia/cistpl.h>
55#include <pcmcia/ciscode.h> 54#include <pcmcia/ciscode.h>
@@ -249,9 +248,8 @@ static int fmvj18x_probe(struct pcmcia_device *link)
249 lp->base = NULL; 248 lp->base = NULL;
250 249
251 /* The io structure describes IO port mapping */ 250 /* The io structure describes IO port mapping */
252 link->io.NumPorts1 = 32; 251 link->resource[0]->end = 32;
253 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 252 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
254 link->io.IOAddrLines = 5;
255 253
256 /* General socket configuration */ 254 /* General socket configuration */
257 link->conf.Attributes = CONF_ENABLE_IRQ; 255 link->conf.Attributes = CONF_ENABLE_IRQ;
@@ -289,13 +287,13 @@ static int mfc_try_io_port(struct pcmcia_device *link)
289 { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 287 { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
290 288
291 for (i = 0; i < 5; i++) { 289 for (i = 0; i < 5; i++) {
292 link->io.BasePort2 = serial_base[i]; 290 link->resource[1]->start = serial_base[i];
293 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 291 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
294 if (link->io.BasePort2 == 0) { 292 if (link->resource[1]->start == 0) {
295 link->io.NumPorts2 = 0; 293 link->resource[1]->end = 0;
296 printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); 294 printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n");
297 } 295 }
298 ret = pcmcia_request_io(link, &link->io); 296 ret = pcmcia_request_io(link);
299 if (ret == 0) 297 if (ret == 0)
300 return ret; 298 return ret;
301 } 299 }
@@ -311,12 +309,12 @@ static int ungermann_try_io_port(struct pcmcia_device *link)
311 0x380,0x3c0 only for ioport. 309 0x380,0x3c0 only for ioport.
312 */ 310 */
313 for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) { 311 for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) {
314 link->io.BasePort1 = ioaddr; 312 link->resource[0]->start = ioaddr;
315 ret = pcmcia_request_io(link, &link->io); 313 ret = pcmcia_request_io(link);
316 if (ret == 0) { 314 if (ret == 0) {
317 /* calculate ConfigIndex value */ 315 /* calculate ConfigIndex value */
318 link->conf.ConfigIndex = 316 link->conf.ConfigIndex =
319 ((link->io.BasePort1 & 0x0f0) >> 3) | 0x22; 317 ((link->resource[0]->start & 0x0f0) >> 3) | 0x22;
320 return ret; 318 return ret;
321 } 319 }
322 } 320 }
@@ -346,6 +344,8 @@ static int fmvj18x_config(struct pcmcia_device *link)
346 344
347 dev_dbg(&link->dev, "fmvj18x_config\n"); 345 dev_dbg(&link->dev, "fmvj18x_config\n");
348 346
347 link->io_lines = 5;
348
349 len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); 349 len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf);
350 kfree(buf); 350 kfree(buf);
351 351
@@ -364,20 +364,20 @@ static int fmvj18x_config(struct pcmcia_device *link)
364 /* MultiFunction Card */ 364 /* MultiFunction Card */
365 link->conf.ConfigBase = 0x800; 365 link->conf.ConfigBase = 0x800;
366 link->conf.ConfigIndex = 0x47; 366 link->conf.ConfigIndex = 0x47;
367 link->io.NumPorts2 = 8; 367 link->resource[1]->end = 8;
368 } 368 }
369 break; 369 break;
370 case MANFID_NEC: 370 case MANFID_NEC:
371 cardtype = NEC; /* MultiFunction Card */ 371 cardtype = NEC; /* MultiFunction Card */
372 link->conf.ConfigBase = 0x800; 372 link->conf.ConfigBase = 0x800;
373 link->conf.ConfigIndex = 0x47; 373 link->conf.ConfigIndex = 0x47;
374 link->io.NumPorts2 = 8; 374 link->resource[1]->end = 8;
375 break; 375 break;
376 case MANFID_KME: 376 case MANFID_KME:
377 cardtype = KME; /* MultiFunction Card */ 377 cardtype = KME; /* MultiFunction Card */
378 link->conf.ConfigBase = 0x800; 378 link->conf.ConfigBase = 0x800;
379 link->conf.ConfigIndex = 0x47; 379 link->conf.ConfigIndex = 0x47;
380 link->io.NumPorts2 = 8; 380 link->resource[1]->end = 8;
381 break; 381 break;
382 case MANFID_CONTEC: 382 case MANFID_CONTEC:
383 cardtype = CONTEC; 383 cardtype = CONTEC;
@@ -418,14 +418,14 @@ static int fmvj18x_config(struct pcmcia_device *link)
418 } 418 }
419 } 419 }
420 420
421 if (link->io.NumPorts2 != 0) { 421 if (link->resource[1]->end != 0) {
422 ret = mfc_try_io_port(link); 422 ret = mfc_try_io_port(link);
423 if (ret != 0) goto failed; 423 if (ret != 0) goto failed;
424 } else if (cardtype == UNGERMANN) { 424 } else if (cardtype == UNGERMANN) {
425 ret = ungermann_try_io_port(link); 425 ret = ungermann_try_io_port(link);
426 if (ret != 0) goto failed; 426 if (ret != 0) goto failed;
427 } else { 427 } else {
428 ret = pcmcia_request_io(link, &link->io); 428 ret = pcmcia_request_io(link);
429 if (ret) 429 if (ret)
430 goto failed; 430 goto failed;
431 } 431 }
@@ -437,9 +437,9 @@ static int fmvj18x_config(struct pcmcia_device *link)
437 goto failed; 437 goto failed;
438 438
439 dev->irq = link->irq; 439 dev->irq = link->irq;
440 dev->base_addr = link->io.BasePort1; 440 dev->base_addr = link->resource[0]->start;
441 441
442 if (link->io.BasePort2 != 0) { 442 if (resource_size(link->resource[1]) != 0) {
443 ret = fmvj18x_setup_mfc(link); 443 ret = fmvj18x_setup_mfc(link);
444 if (ret != 0) goto failed; 444 if (ret != 0) goto failed;
445 } 445 }
@@ -545,7 +545,6 @@ failed:
545static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) 545static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
546{ 546{
547 win_req_t req; 547 win_req_t req;
548 memreq_t mem;
549 u_char __iomem *base; 548 u_char __iomem *base;
550 int i, j; 549 int i, j;
551 550
@@ -558,9 +557,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
558 return -1; 557 return -1;
559 558
560 base = ioremap(req.Base, req.Size); 559 base = ioremap(req.Base, req.Size);
561 mem.Page = 0; 560 pcmcia_map_mem_page(link, link->win, 0);
562 mem.CardOffset = 0;
563 pcmcia_map_mem_page(link, link->win, &mem);
564 561
565 /* 562 /*
566 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format 563 * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format
@@ -594,7 +591,6 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id)
594static int fmvj18x_setup_mfc(struct pcmcia_device *link) 591static int fmvj18x_setup_mfc(struct pcmcia_device *link)
595{ 592{
596 win_req_t req; 593 win_req_t req;
597 memreq_t mem;
598 int i; 594 int i;
599 struct net_device *dev = link->priv; 595 struct net_device *dev = link->priv;
600 unsigned int ioaddr; 596 unsigned int ioaddr;
@@ -614,9 +610,7 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link)
614 return -1; 610 return -1;
615 } 611 }
616 612
617 mem.Page = 0; 613 i = pcmcia_map_mem_page(link, link->win, 0);
618 mem.CardOffset = 0;
619 i = pcmcia_map_mem_page(link, link->win, &mem);
620 if (i != 0) { 614 if (i != 0) {
621 iounmap(lp->base); 615 iounmap(lp->base);
622 lp->base = NULL; 616 lp->base = NULL;
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 67ee9851a8ed..b0d06a3d962f 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -57,7 +57,6 @@
57#include <linux/trdevice.h> 57#include <linux/trdevice.h>
58#include <linux/ibmtr.h> 58#include <linux/ibmtr.h>
59 59
60#include <pcmcia/cs_types.h>
61#include <pcmcia/cs.h> 60#include <pcmcia/cs.h>
62#include <pcmcia/cistpl.h> 61#include <pcmcia/cistpl.h>
63#include <pcmcia/ds.h> 62#include <pcmcia/ds.h>
@@ -152,9 +151,8 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
152 link->priv = info; 151 link->priv = info;
153 info->ti = netdev_priv(dev); 152 info->ti = netdev_priv(dev);
154 153
155 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 154 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
156 link->io.NumPorts1 = 4; 155 link->resource[0]->end = 4;
157 link->io.IOAddrLines = 16;
158 link->conf.Attributes = CONF_ENABLE_IRQ; 156 link->conf.Attributes = CONF_ENABLE_IRQ;
159 link->conf.IntType = INT_MEMORY_AND_IO; 157 link->conf.IntType = INT_MEMORY_AND_IO;
160 link->conf.Present = PRESENT_OPTION; 158 link->conf.Present = PRESENT_OPTION;
@@ -213,26 +211,26 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
213 struct net_device *dev = info->dev; 211 struct net_device *dev = info->dev;
214 struct tok_info *ti = netdev_priv(dev); 212 struct tok_info *ti = netdev_priv(dev);
215 win_req_t req; 213 win_req_t req;
216 memreq_t mem;
217 int i, ret; 214 int i, ret;
218 215
219 dev_dbg(&link->dev, "ibmtr_config\n"); 216 dev_dbg(&link->dev, "ibmtr_config\n");
220 217
221 link->conf.ConfigIndex = 0x61; 218 link->conf.ConfigIndex = 0x61;
219 link->io_lines = 16;
222 220
223 /* Determine if this is PRIMARY or ALTERNATE. */ 221 /* Determine if this is PRIMARY or ALTERNATE. */
224 222
225 /* Try PRIMARY card at 0xA20-0xA23 */ 223 /* Try PRIMARY card at 0xA20-0xA23 */
226 link->io.BasePort1 = 0xA20; 224 link->resource[0]->start = 0xA20;
227 i = pcmcia_request_io(link, &link->io); 225 i = pcmcia_request_io(link);
228 if (i != 0) { 226 if (i != 0) {
229 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ 227 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
230 link->io.BasePort1 = 0xA24; 228 link->resource[0]->start = 0xA24;
231 ret = pcmcia_request_io(link, &link->io); 229 ret = pcmcia_request_io(link);
232 if (ret) 230 if (ret)
233 goto failed; 231 goto failed;
234 } 232 }
235 dev->base_addr = link->io.BasePort1; 233 dev->base_addr = link->resource[0]->start;
236 234
237 ret = pcmcia_request_exclusive_irq(link, ibmtr_interrupt); 235 ret = pcmcia_request_exclusive_irq(link, ibmtr_interrupt);
238 if (ret) 236 if (ret)
@@ -251,9 +249,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
251 if (ret) 249 if (ret)
252 goto failed; 250 goto failed;
253 251
254 mem.CardOffset = mmiobase; 252 ret = pcmcia_map_mem_page(link, link->win, mmiobase);
255 mem.Page = 0;
256 ret = pcmcia_map_mem_page(link, link->win, &mem);
257 if (ret) 253 if (ret)
258 goto failed; 254 goto failed;
259 ti->mmio = ioremap(req.Base, req.Size); 255 ti->mmio = ioremap(req.Base, req.Size);
@@ -268,13 +264,11 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
268 if (ret) 264 if (ret)
269 goto failed; 265 goto failed;
270 266
271 mem.CardOffset = srambase; 267 ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase);
272 mem.Page = 0;
273 ret = pcmcia_map_mem_page(link, info->sram_win_handle, &mem);
274 if (ret) 268 if (ret)
275 goto failed; 269 goto failed;
276 270
277 ti->sram_base = mem.CardOffset >> 12; 271 ti->sram_base = srambase >> 12;
278 ti->sram_virt = ioremap(req.Base, req.Size); 272 ti->sram_virt = ioremap(req.Base, req.Size);
279 ti->sram_phys = req.Base; 273 ti->sram_phys = req.Base;
280 274
@@ -325,7 +319,6 @@ static void ibmtr_release(struct pcmcia_device *link)
325 if (link->win) { 319 if (link->win) {
326 struct tok_info *ti = netdev_priv(dev); 320 struct tok_info *ti = netdev_priv(dev);
327 iounmap(ti->mmio); 321 iounmap(ti->mmio);
328 pcmcia_release_window(link, info->sram_win_handle);
329 } 322 }
330 pcmcia_disable_device(link); 323 pcmcia_disable_device(link);
331} 324}
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 9b63dec549cb..68f2deeb3ade 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -146,7 +146,6 @@ Include Files
146#include <linux/ioport.h> 146#include <linux/ioport.h>
147#include <linux/bitops.h> 147#include <linux/bitops.h>
148 148
149#include <pcmcia/cs_types.h>
150#include <pcmcia/cs.h> 149#include <pcmcia/cs.h>
151#include <pcmcia/cisreg.h> 150#include <pcmcia/cisreg.h>
152#include <pcmcia/cistpl.h> 151#include <pcmcia/cistpl.h>
@@ -459,9 +458,8 @@ static int nmclan_probe(struct pcmcia_device *link)
459 link->priv = dev; 458 link->priv = dev;
460 459
461 spin_lock_init(&lp->bank_lock); 460 spin_lock_init(&lp->bank_lock);
462 link->io.NumPorts1 = 32; 461 link->resource[0]->end = 32;
463 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 462 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
464 link->io.IOAddrLines = 5;
465 link->conf.Attributes = CONF_ENABLE_IRQ; 463 link->conf.Attributes = CONF_ENABLE_IRQ;
466 link->conf.IntType = INT_MEMORY_AND_IO; 464 link->conf.IntType = INT_MEMORY_AND_IO;
467 link->conf.ConfigIndex = 1; 465 link->conf.ConfigIndex = 1;
@@ -645,7 +643,8 @@ static int nmclan_config(struct pcmcia_device *link)
645 643
646 dev_dbg(&link->dev, "nmclan_config\n"); 644 dev_dbg(&link->dev, "nmclan_config\n");
647 645
648 ret = pcmcia_request_io(link, &link->io); 646 link->io_lines = 5;
647 ret = pcmcia_request_io(link);
649 if (ret) 648 if (ret)
650 goto failed; 649 goto failed;
651 ret = pcmcia_request_exclusive_irq(link, mace_interrupt); 650 ret = pcmcia_request_exclusive_irq(link, mace_interrupt);
@@ -656,7 +655,7 @@ static int nmclan_config(struct pcmcia_device *link)
656 goto failed; 655 goto failed;
657 656
658 dev->irq = link->irq; 657 dev->irq = link->irq;
659 dev->base_addr = link->io.BasePort1; 658 dev->base_addr = link->resource[0]->start;
660 659
661 ioaddr = dev->base_addr; 660 ioaddr = dev->base_addr;
662 661
@@ -758,29 +757,20 @@ static void nmclan_reset(struct net_device *dev)
758 757
759#if RESET_XILINX 758#if RESET_XILINX
760 struct pcmcia_device *link = &lp->link; 759 struct pcmcia_device *link = &lp->link;
761 conf_reg_t reg; 760 u8 OrigCorValue;
762 u_long OrigCorValue;
763 761
764 /* Save original COR value */ 762 /* Save original COR value */
765 reg.Function = 0; 763 pcmcia_read_config_byte(link, CISREG_COR, &OrigCorValue);
766 reg.Action = CS_READ;
767 reg.Offset = CISREG_COR;
768 reg.Value = 0;
769 pcmcia_access_configuration_register(link, &reg);
770 OrigCorValue = reg.Value;
771 764
772 /* Reset Xilinx */ 765 /* Reset Xilinx */
773 reg.Action = CS_WRITE; 766 dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%x, resetting...\n",
774 reg.Offset = CISREG_COR;
775 dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n",
776 OrigCorValue); 767 OrigCorValue);
777 reg.Value = COR_SOFT_RESET; 768 pcmcia_write_config_byte(link, CISREG_COR, COR_SOFT_RESET);
778 pcmcia_access_configuration_register(link, &reg);
779 /* Need to wait for 20 ms for PCMCIA to finish reset. */ 769 /* Need to wait for 20 ms for PCMCIA to finish reset. */
780 770
781 /* Restore original COR configuration index */ 771 /* Restore original COR configuration index */
782 reg.Value = COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK); 772 pcmcia_write_config_byte(link, CISREG_COR,
783 pcmcia_access_configuration_register(link, &reg); 773 (COR_LEVEL_REQ | (OrigCorValue & COR_CONFIG_MASK)));
784 /* Xilinx is now completely reset along with the MACE chip. */ 774 /* Xilinx is now completely reset along with the MACE chip. */
785 lp->tx_free_frames=AM2150_MAX_TX_FRAMES; 775 lp->tx_free_frames=AM2150_MAX_TX_FRAMES;
786 776
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 7fd8c55288c9..49279b0ee526 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -42,7 +42,6 @@
42#include <linux/mii.h> 42#include <linux/mii.h>
43#include "../8390.h" 43#include "../8390.h"
44 44
45#include <pcmcia/cs_types.h>
46#include <pcmcia/cs.h> 45#include <pcmcia/cs.h>
47#include <pcmcia/cistpl.h> 46#include <pcmcia/cistpl.h>
48#include <pcmcia/ciscode.h> 47#include <pcmcia/ciscode.h>
@@ -113,8 +112,6 @@ static int setup_dma_config(struct pcmcia_device *link, int start_pg,
113 112
114static void pcnet_detach(struct pcmcia_device *p_dev); 113static void pcnet_detach(struct pcmcia_device *p_dev);
115 114
116static dev_info_t dev_info = "pcnet_cs";
117
118/*====================================================================*/ 115/*====================================================================*/
119 116
120typedef struct hw_info_t { 117typedef struct hw_info_t {
@@ -304,7 +301,6 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
304{ 301{
305 struct net_device *dev = link->priv; 302 struct net_device *dev = link->priv;
306 win_req_t req; 303 win_req_t req;
307 memreq_t mem;
308 u_char __iomem *base, *virt; 304 u_char __iomem *base, *virt;
309 int i, j; 305 int i, j;
310 306
@@ -317,10 +313,8 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link)
317 return NULL; 313 return NULL;
318 314
319 virt = ioremap(req.Base, req.Size); 315 virt = ioremap(req.Base, req.Size);
320 mem.Page = 0;
321 for (i = 0; i < NR_INFO; i++) { 316 for (i = 0; i < NR_INFO; i++) {
322 mem.CardOffset = hw_info[i].offset & ~(req.Size-1); 317 pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1));
323 pcmcia_map_mem_page(link, link->win, &mem);
324 base = &virt[hw_info[i].offset & (req.Size-1)]; 318 base = &virt[hw_info[i].offset & (req.Size-1)];
325 if ((readb(base+0) == hw_info[i].a0) && 319 if ((readb(base+0) == hw_info[i].a0) &&
326 (readb(base+2) == hw_info[i].a1) && 320 (readb(base+2) == hw_info[i].a1) &&
@@ -480,29 +474,31 @@ static hw_info_t *get_hwired(struct pcmcia_device *link)
480static int try_io_port(struct pcmcia_device *link) 474static int try_io_port(struct pcmcia_device *link)
481{ 475{
482 int j, ret; 476 int j, ret;
483 if (link->io.NumPorts1 == 32) { 477 link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
484 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 478 link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
485 if (link->io.NumPorts2 > 0) { 479 if (link->resource[0]->end == 32) {
480 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
481 if (link->resource[1]->end > 0) {
486 /* for master/slave multifunction cards */ 482 /* for master/slave multifunction cards */
487 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 483 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
488 } 484 }
489 } else { 485 } else {
490 /* This should be two 16-port windows */ 486 /* This should be two 16-port windows */
491 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 487 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
492 link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 488 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
493 } 489 }
494 if (link->io.BasePort1 == 0) { 490 if (link->resource[0]->start == 0) {
495 link->io.IOAddrLines = 16;
496 for (j = 0; j < 0x400; j += 0x20) { 491 for (j = 0; j < 0x400; j += 0x20) {
497 link->io.BasePort1 = j ^ 0x300; 492 link->resource[0]->start = j ^ 0x300;
498 link->io.BasePort2 = (j ^ 0x300) + 0x10; 493 link->resource[1]->start = (j ^ 0x300) + 0x10;
499 ret = pcmcia_request_io(link, &link->io); 494 link->io_lines = 16;
495 ret = pcmcia_request_io(link);
500 if (ret == 0) 496 if (ret == 0)
501 return ret; 497 return ret;
502 } 498 }
503 return ret; 499 return ret;
504 } else { 500 } else {
505 return pcmcia_request_io(link, &link->io); 501 return pcmcia_request_io(link);
506 } 502 }
507} 503}
508 504
@@ -523,18 +519,18 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev,
523 network function with window 0, and serial with window 1 */ 519 network function with window 0, and serial with window 1 */
524 if (io->nwin > 1) { 520 if (io->nwin > 1) {
525 i = (io->win[1].len > io->win[0].len); 521 i = (io->win[1].len > io->win[0].len);
526 p_dev->io.BasePort2 = io->win[1-i].base; 522 p_dev->resource[1]->start = io->win[1-i].base;
527 p_dev->io.NumPorts2 = io->win[1-i].len; 523 p_dev->resource[1]->end = io->win[1-i].len;
528 } else { 524 } else {
529 i = p_dev->io.NumPorts2 = 0; 525 i = p_dev->resource[1]->end = 0;
530 } 526 }
531 527
532 *has_shmem = ((cfg->mem.nwin == 1) && 528 *has_shmem = ((cfg->mem.nwin == 1) &&
533 (cfg->mem.win[0].len >= 0x4000)); 529 (cfg->mem.win[0].len >= 0x4000));
534 p_dev->io.BasePort1 = io->win[i].base; 530 p_dev->resource[0]->start = io->win[i].base;
535 p_dev->io.NumPorts1 = io->win[i].len; 531 p_dev->resource[0]->end = io->win[i].len;
536 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 532 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
537 if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) 533 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
538 return try_io_port(p_dev); 534 return try_io_port(p_dev);
539 535
540 return 0; 536 return 0;
@@ -557,7 +553,7 @@ static int pcnet_config(struct pcmcia_device *link)
557 if (!link->irq) 553 if (!link->irq)
558 goto failed; 554 goto failed;
559 555
560 if (link->io.NumPorts2 == 8) { 556 if (resource_size(link->resource[1]) == 8) {
561 link->conf.Attributes |= CONF_ENABLE_SPKR; 557 link->conf.Attributes |= CONF_ENABLE_SPKR;
562 link->conf.Status = CCSR_AUDIO_ENA; 558 link->conf.Status = CCSR_AUDIO_ENA;
563 } 559 }
@@ -569,7 +565,7 @@ static int pcnet_config(struct pcmcia_device *link)
569 if (ret) 565 if (ret)
570 goto failed; 566 goto failed;
571 dev->irq = link->irq; 567 dev->irq = link->irq;
572 dev->base_addr = link->io.BasePort1; 568 dev->base_addr = link->resource[0]->start;
573 if (info->flags & HAS_MISC_REG) { 569 if (info->flags & HAS_MISC_REG) {
574 if ((if_port == 1) || (if_port == 2)) 570 if ((if_port == 1) || (if_port == 2))
575 dev->if_port = if_port; 571 dev->if_port = if_port;
@@ -956,7 +952,7 @@ static int pcnet_open(struct net_device *dev)
956 set_misc_reg(dev); 952 set_misc_reg(dev);
957 953
958 outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */ 954 outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */
959 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev); 955 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev->name, dev);
960 if (ret) 956 if (ret)
961 return ret; 957 return ret;
962 958
@@ -1464,7 +1460,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1464 struct net_device *dev = link->priv; 1460 struct net_device *dev = link->priv;
1465 pcnet_dev_t *info = PRIV(dev); 1461 pcnet_dev_t *info = PRIV(dev);
1466 win_req_t req; 1462 win_req_t req;
1467 memreq_t mem;
1468 int i, window_size, offset, ret; 1463 int i, window_size, offset, ret;
1469 1464
1470 window_size = (stop_pg - start_pg) << 8; 1465 window_size = (stop_pg - start_pg) << 8;
@@ -1483,11 +1478,9 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg,
1483 if (ret) 1478 if (ret)
1484 goto failed; 1479 goto failed;
1485 1480
1486 mem.CardOffset = (start_pg << 8) + cm_offset; 1481 offset = (start_pg << 8) + cm_offset;
1487 offset = mem.CardOffset % window_size; 1482 offset -= offset % window_size;
1488 mem.CardOffset -= offset; 1483 ret = pcmcia_map_mem_page(link, link->win, offset);
1489 mem.Page = 0;
1490 ret = pcmcia_map_mem_page(link, link->win, &mem);
1491 if (ret) 1484 if (ret)
1492 goto failed; 1485 goto failed;
1493 1486
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 307cd1721e91..377367d03b41 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -44,7 +44,6 @@
44#include <linux/jiffies.h> 44#include <linux/jiffies.h>
45#include <linux/firmware.h> 45#include <linux/firmware.h>
46 46
47#include <pcmcia/cs_types.h>
48#include <pcmcia/cs.h> 47#include <pcmcia/cs.h>
49#include <pcmcia/cistpl.h> 48#include <pcmcia/cistpl.h>
50#include <pcmcia/cisreg.h> 49#include <pcmcia/cisreg.h>
@@ -325,9 +324,8 @@ static int smc91c92_probe(struct pcmcia_device *link)
325 link->priv = dev; 324 link->priv = dev;
326 325
327 spin_lock_init(&smc->lock); 326 spin_lock_init(&smc->lock);
328 link->io.NumPorts1 = 16; 327 link->resource[0]->end = 16;
329 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 328 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
330 link->io.IOAddrLines = 4;
331 link->conf.Attributes = CONF_ENABLE_IRQ; 329 link->conf.Attributes = CONF_ENABLE_IRQ;
332 link->conf.IntType = INT_MEMORY_AND_IO; 330 link->conf.IntType = INT_MEMORY_AND_IO;
333 331
@@ -428,12 +426,13 @@ static int mhz_mfc_config_check(struct pcmcia_device *p_dev,
428 void *priv_data) 426 void *priv_data)
429{ 427{
430 int k; 428 int k;
431 p_dev->io.BasePort2 = cf->io.win[0].base; 429 p_dev->resource[1]->start = cf->io.win[0].base;
432 for (k = 0; k < 0x400; k += 0x10) { 430 for (k = 0; k < 0x400; k += 0x10) {
433 if (k & 0x80) 431 if (k & 0x80)
434 continue; 432 continue;
435 p_dev->io.BasePort1 = k ^ 0x300; 433 p_dev->resource[0]->start = k ^ 0x300;
436 if (!pcmcia_request_io(p_dev, &p_dev->io)) 434 p_dev->io_lines = 16;
435 if (!pcmcia_request_io(p_dev))
437 return 0; 436 return 0;
438 } 437 }
439 return -ENODEV; 438 return -ENODEV;
@@ -444,21 +443,20 @@ static int mhz_mfc_config(struct pcmcia_device *link)
444 struct net_device *dev = link->priv; 443 struct net_device *dev = link->priv;
445 struct smc_private *smc = netdev_priv(dev); 444 struct smc_private *smc = netdev_priv(dev);
446 win_req_t req; 445 win_req_t req;
447 memreq_t mem; 446 unsigned int offset;
448 int i; 447 int i;
449 448
450 link->conf.Attributes |= CONF_ENABLE_SPKR; 449 link->conf.Attributes |= CONF_ENABLE_SPKR;
451 link->conf.Status = CCSR_AUDIO_ENA; 450 link->conf.Status = CCSR_AUDIO_ENA;
452 link->io.IOAddrLines = 16; 451 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
453 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 452 link->resource[1]->end = 8;
454 link->io.NumPorts2 = 8;
455 453
456 /* The Megahertz combo cards have modem-like CIS entries, so 454 /* The Megahertz combo cards have modem-like CIS entries, so
457 we have to explicitly try a bunch of port combinations. */ 455 we have to explicitly try a bunch of port combinations. */
458 if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) 456 if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL))
459 return -ENODEV; 457 return -ENODEV;
460 458
461 dev->base_addr = link->io.BasePort1; 459 dev->base_addr = link->resource[0]->start;
462 460
463 /* Allocate a memory window, for accessing the ISR */ 461 /* Allocate a memory window, for accessing the ISR */
464 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; 462 req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE;
@@ -469,11 +467,8 @@ static int mhz_mfc_config(struct pcmcia_device *link)
469 return -ENODEV; 467 return -ENODEV;
470 468
471 smc->base = ioremap(req.Base, req.Size); 469 smc->base = ioremap(req.Base, req.Size);
472 mem.CardOffset = mem.Page = 0; 470 offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0;
473 if (smc->manfid == MANFID_MOTOROLA) 471 i = pcmcia_map_mem_page(link, link->win, offset);
474 mem.CardOffset = link->conf.ConfigBase;
475 i = pcmcia_map_mem_page(link, link->win, &mem);
476
477 if ((i == 0) && 472 if ((i == 0) &&
478 (smc->manfid == MANFID_MEGAHERTZ) && 473 (smc->manfid == MANFID_MEGAHERTZ) &&
479 (smc->cardid == PRODID_MEGAHERTZ_EM3288)) 474 (smc->cardid == PRODID_MEGAHERTZ_EM3288))
@@ -546,7 +541,7 @@ static void mot_config(struct pcmcia_device *link)
546 struct net_device *dev = link->priv; 541 struct net_device *dev = link->priv;
547 struct smc_private *smc = netdev_priv(dev); 542 struct smc_private *smc = netdev_priv(dev);
548 unsigned int ioaddr = dev->base_addr; 543 unsigned int ioaddr = dev->base_addr;
549 unsigned int iouart = link->io.BasePort2; 544 unsigned int iouart = link->resource[1]->start;
550 545
551 /* Set UART base address and force map with COR bit 1 */ 546 /* Set UART base address and force map with COR bit 1 */
552 writeb(iouart & 0xff, smc->base + MOT_UART + CISREG_IOBASE_0); 547 writeb(iouart & 0xff, smc->base + MOT_UART + CISREG_IOBASE_0);
@@ -602,9 +597,9 @@ static int smc_configcheck(struct pcmcia_device *p_dev,
602 unsigned int vcc, 597 unsigned int vcc,
603 void *priv_data) 598 void *priv_data)
604{ 599{
605 p_dev->io.BasePort1 = cf->io.win[0].base; 600 p_dev->resource[0]->start = cf->io.win[0].base;
606 p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; 601 p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK;
607 return pcmcia_request_io(p_dev, &p_dev->io); 602 return pcmcia_request_io(p_dev);
608} 603}
609 604
610static int smc_config(struct pcmcia_device *link) 605static int smc_config(struct pcmcia_device *link)
@@ -612,10 +607,10 @@ static int smc_config(struct pcmcia_device *link)
612 struct net_device *dev = link->priv; 607 struct net_device *dev = link->priv;
613 int i; 608 int i;
614 609
615 link->io.NumPorts1 = 16; 610 link->resource[0]->end = 16;
616 i = pcmcia_loop_config(link, smc_configcheck, NULL); 611 i = pcmcia_loop_config(link, smc_configcheck, NULL);
617 if (!i) 612 if (!i)
618 dev->base_addr = link->io.BasePort1; 613 dev->base_addr = link->resource[0]->start;
619 614
620 return i; 615 return i;
621} 616}
@@ -647,27 +642,27 @@ static int osi_config(struct pcmcia_device *link)
647 642
648 link->conf.Attributes |= CONF_ENABLE_SPKR; 643 link->conf.Attributes |= CONF_ENABLE_SPKR;
649 link->conf.Status = CCSR_AUDIO_ENA; 644 link->conf.Status = CCSR_AUDIO_ENA;
650 link->io.NumPorts1 = 64; 645 link->resource[0]->end = 64;
651 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 646 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
652 link->io.NumPorts2 = 8; 647 link->resource[1]->end = 8;
653 link->io.IOAddrLines = 16;
654 648
655 /* Enable Hard Decode, LAN, Modem */ 649 /* Enable Hard Decode, LAN, Modem */
656 link->conf.ConfigIndex = 0x23; 650 link->conf.ConfigIndex = 0x23;
651 link->io_lines = 16;
657 652
658 for (i = j = 0; j < 4; j++) { 653 for (i = j = 0; j < 4; j++) {
659 link->io.BasePort2 = com[j]; 654 link->resource[1]->start = com[j];
660 i = pcmcia_request_io(link, &link->io); 655 i = pcmcia_request_io(link);
661 if (i == 0) 656 if (i == 0)
662 break; 657 break;
663 } 658 }
664 if (i != 0) { 659 if (i != 0) {
665 /* Fallback: turn off hard decode */ 660 /* Fallback: turn off hard decode */
666 link->conf.ConfigIndex = 0x03; 661 link->conf.ConfigIndex = 0x03;
667 link->io.NumPorts2 = 0; 662 link->resource[1]->end = 0;
668 i = pcmcia_request_io(link, &link->io); 663 i = pcmcia_request_io(link);
669 } 664 }
670 dev->base_addr = link->io.BasePort1 + 0x10; 665 dev->base_addr = link->resource[0]->start + 0x10;
671 return i; 666 return i;
672} 667}
673 668
@@ -684,7 +679,7 @@ static int osi_load_firmware(struct pcmcia_device *link)
684 679
685 /* Download the Seven of Diamonds firmware */ 680 /* Download the Seven of Diamonds firmware */
686 for (i = 0; i < fw->size; i++) { 681 for (i = 0; i < fw->size; i++) {
687 outb(fw->data[i], link->io.BasePort1 + 2); 682 outb(fw->data[i], link->resource[0]->start + 2);
688 udelay(50); 683 udelay(50);
689 } 684 }
690 release_firmware(fw); 685 release_firmware(fw);
@@ -726,12 +721,12 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid)
726 return rc; 721 return rc;
727 } else if (manfid == MANFID_OSITECH) { 722 } else if (manfid == MANFID_OSITECH) {
728 /* Make sure both functions are powered up */ 723 /* Make sure both functions are powered up */
729 set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); 724 set_bits(0x300, link->resource[0]->start + OSITECH_AUI_PWR);
730 /* Now, turn on the interrupt for both card functions */ 725 /* Now, turn on the interrupt for both card functions */
731 set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); 726 set_bits(0x300, link->resource[0]->start + OSITECH_RESET_ISR);
732 dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", 727 dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n",
733 inw(link->io.BasePort1 + OSITECH_AUI_PWR), 728 inw(link->resource[0]->start + OSITECH_AUI_PWR),
734 inw(link->io.BasePort1 + OSITECH_RESET_ISR)); 729 inw(link->resource[0]->start + OSITECH_RESET_ISR));
735 } 730 }
736 return 0; 731 return 0;
737} 732}
@@ -804,7 +799,7 @@ static int check_sig(struct pcmcia_device *link)
804 } 799 }
805 800
806 /* Try setting bus width */ 801 /* Try setting bus width */
807 width = (link->io.Attributes1 == IO_DATA_PATH_WIDTH_AUTO); 802 width = (link->resource[0]->flags == IO_DATA_PATH_WIDTH_AUTO);
808 s = inb(ioaddr + CONFIG); 803 s = inb(ioaddr + CONFIG);
809 if (width) 804 if (width)
810 s |= CFG_16BIT; 805 s |= CFG_16BIT;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index b6c3644888cd..f5819526b5ee 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -82,7 +82,6 @@
82#include <linux/bitops.h> 82#include <linux/bitops.h>
83#include <linux/mii.h> 83#include <linux/mii.h>
84 84
85#include <pcmcia/cs_types.h>
86#include <pcmcia/cs.h> 85#include <pcmcia/cs.h>
87#include <pcmcia/cistpl.h> 86#include <pcmcia/cistpl.h>
88#include <pcmcia/cisreg.h> 87#include <pcmcia/cisreg.h>
@@ -678,9 +677,9 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev,
678 677
679 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 678 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) {
680 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 679 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
681 p_dev->io.BasePort2 = cf->io.win[0].base; 680 p_dev->resource[1]->start = cf->io.win[0].base;
682 p_dev->io.BasePort1 = ioaddr; 681 p_dev->resource[0]->start = ioaddr;
683 if (!pcmcia_request_io(p_dev, &p_dev->io)) 682 if (!pcmcia_request_io(p_dev))
684 return 0; 683 return 0;
685 } 684 }
686 } 685 }
@@ -697,11 +696,11 @@ xirc2ps_config_check(struct pcmcia_device *p_dev,
697 int *pass = priv_data; 696 int *pass = priv_data;
698 697
699 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { 698 if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) {
700 p_dev->io.BasePort2 = cf->io.win[0].base; 699 p_dev->resource[1]->start = cf->io.win[0].base;
701 p_dev->io.BasePort1 = p_dev->io.BasePort2 700 p_dev->resource[0]->start = p_dev->resource[1]->start
702 + (*pass ? (cf->index & 0x20 ? -24:8) 701 + (*pass ? (cf->index & 0x20 ? -24:8)
703 : (cf->index & 0x20 ? 8:-24)); 702 : (cf->index & 0x20 ? 8:-24));
704 if (!pcmcia_request_io(p_dev, &p_dev->io)) 703 if (!pcmcia_request_io(p_dev))
705 return 0; 704 return 0;
706 } 705 }
707 return -ENODEV; 706 return -ENODEV;
@@ -808,8 +807,8 @@ xirc2ps_config(struct pcmcia_device * link)
808 goto failure; 807 goto failure;
809 } 808 }
810 809
811 link->io.IOAddrLines =10; 810 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16;
812 link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 811 link->io_lines = 10;
813 if (local->modem) { 812 if (local->modem) {
814 int pass; 813 int pass;
815 814
@@ -817,16 +816,16 @@ xirc2ps_config(struct pcmcia_device * link)
817 link->conf.Attributes |= CONF_ENABLE_SPKR; 816 link->conf.Attributes |= CONF_ENABLE_SPKR;
818 link->conf.Status |= CCSR_AUDIO_ENA; 817 link->conf.Status |= CCSR_AUDIO_ENA;
819 } 818 }
820 link->io.NumPorts2 = 8; 819 link->resource[1]->end = 8;
821 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 820 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
822 if (local->dingo) { 821 if (local->dingo) {
823 /* Take the Modem IO port from the CIS and scan for a free 822 /* Take the Modem IO port from the CIS and scan for a free
824 * Ethernet port */ 823 * Ethernet port */
825 link->io.NumPorts1 = 16; /* no Mako stuff anymore */ 824 link->resource[0]->end = 16; /* no Mako stuff anymore */
826 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) 825 if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL))
827 goto port_found; 826 goto port_found;
828 } else { 827 } else {
829 link->io.NumPorts1 = 18; 828 link->resource[0]->end = 18;
830 /* We do 2 passes here: The first one uses the regular mapping and 829 /* We do 2 passes here: The first one uses the regular mapping and
831 * the second tries again, thereby considering that the 32 ports are 830 * the second tries again, thereby considering that the 32 ports are
832 * mirrored every 32 bytes. Actually we use a mirrored port for 831 * mirrored every 32 bytes. Actually we use a mirrored port for
@@ -841,14 +840,14 @@ xirc2ps_config(struct pcmcia_device * link)
841 } 840 }
842 printk(KNOT_XIRC "no ports available\n"); 841 printk(KNOT_XIRC "no ports available\n");
843 } else { 842 } else {
844 link->io.NumPorts1 = 16; 843 link->resource[0]->end = 16;
845 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { 844 for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) {
846 link->io.BasePort1 = ioaddr; 845 link->resource[0]->start = ioaddr;
847 if (!(err=pcmcia_request_io(link, &link->io))) 846 if (!(err = pcmcia_request_io(link)))
848 goto port_found; 847 goto port_found;
849 } 848 }
850 link->io.BasePort1 = 0; /* let CS decide */ 849 link->resource[0]->start = 0; /* let CS decide */
851 if ((err=pcmcia_request_io(link, &link->io))) 850 if ((err = pcmcia_request_io(link)))
852 goto config_error; 851 goto config_error;
853 } 852 }
854 port_found: 853 port_found:
@@ -870,24 +869,21 @@ xirc2ps_config(struct pcmcia_device * link)
870 goto config_error; 869 goto config_error;
871 870
872 if (local->dingo) { 871 if (local->dingo) {
873 conf_reg_t reg;
874 win_req_t req; 872 win_req_t req;
875 memreq_t mem;
876 873
877 /* Reset the modem's BAR to the correct value 874 /* Reset the modem's BAR to the correct value
878 * This is necessary because in the RequestConfiguration call, 875 * This is necessary because in the RequestConfiguration call,
879 * the base address of the ethernet port (BasePort1) is written 876 * the base address of the ethernet port (BasePort1) is written
880 * to the BAR registers of the modem. 877 * to the BAR registers of the modem.
881 */ 878 */
882 reg.Action = CS_WRITE; 879 err = pcmcia_write_config_byte(link, CISREG_IOBASE_0, (u8)
883 reg.Offset = CISREG_IOBASE_0; 880 link->resource[1]->start & 0xff);
884 reg.Value = link->io.BasePort2 & 0xff; 881 if (err)
885 if ((err = pcmcia_access_configuration_register(link, &reg)))
886 goto config_error; 882 goto config_error;
887 reg.Action = CS_WRITE; 883
888 reg.Offset = CISREG_IOBASE_1; 884 err = pcmcia_write_config_byte(link, CISREG_IOBASE_1,
889 reg.Value = (link->io.BasePort2 >> 8) & 0xff; 885 (link->resource[1]->start >> 8) & 0xff);
890 if ((err = pcmcia_access_configuration_register(link, &reg))) 886 if (err)
891 goto config_error; 887 goto config_error;
892 888
893 /* There is no config entry for the Ethernet part which 889 /* There is no config entry for the Ethernet part which
@@ -901,16 +897,14 @@ xirc2ps_config(struct pcmcia_device * link)
901 goto config_error; 897 goto config_error;
902 898
903 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; 899 local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800;
904 mem.CardOffset = 0x0; 900 if ((err = pcmcia_map_mem_page(link, link->win, 0)))
905 mem.Page = 0;
906 if ((err = pcmcia_map_mem_page(link, link->win, &mem)))
907 goto config_error; 901 goto config_error;
908 902
909 /* Setup the CCRs; there are no infos in the CIS about the Ethernet 903 /* Setup the CCRs; there are no infos in the CIS about the Ethernet
910 * part. 904 * part.
911 */ 905 */
912 writeb(0x47, local->dingo_ccr + CISREG_COR); 906 writeb(0x47, local->dingo_ccr + CISREG_COR);
913 ioaddr = link->io.BasePort1; 907 ioaddr = link->resource[0]->start;
914 writeb(ioaddr & 0xff , local->dingo_ccr + CISREG_IOBASE_0); 908 writeb(ioaddr & 0xff , local->dingo_ccr + CISREG_IOBASE_0);
915 writeb((ioaddr >> 8)&0xff , local->dingo_ccr + CISREG_IOBASE_1); 909 writeb((ioaddr >> 8)&0xff , local->dingo_ccr + CISREG_IOBASE_1);
916 910
@@ -957,7 +951,7 @@ xirc2ps_config(struct pcmcia_device * link)
957 951
958 /* we can now register the device with the net subsystem */ 952 /* we can now register the device with the net subsystem */
959 dev->irq = link->irq; 953 dev->irq = link->irq;
960 dev->base_addr = link->io.BasePort1; 954 dev->base_addr = link->resource[0]->start;
961 955
962 if (local->dingo) 956 if (local->dingo)
963 do_reset(dev, 1); /* a kludge to make the cem56 work */ 957 do_reset(dev, 1); /* a kludge to make the cem56 work */
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index fc5fef2a8175..f62c7b717bc8 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -188,7 +188,7 @@ static int __devexit mdio_gpio_remove(struct platform_device *pdev)
188 188
189#ifdef CONFIG_OF_GPIO 189#ifdef CONFIG_OF_GPIO
190 190
191static int __devinit mdio_ofgpio_probe(struct of_device *ofdev, 191static int __devinit mdio_ofgpio_probe(struct platform_device *ofdev,
192 const struct of_device_id *match) 192 const struct of_device_id *match)
193{ 193{
194 struct mdio_gpio_platform_data *pdata; 194 struct mdio_gpio_platform_data *pdata;
@@ -224,7 +224,7 @@ out_free:
224 return -ENODEV; 224 return -ENODEV;
225} 225}
226 226
227static int __devexit mdio_ofgpio_remove(struct of_device *ofdev) 227static int __devexit mdio_ofgpio_remove(struct platform_device *ofdev)
228{ 228{
229 mdio_gpio_bus_destroy(&ofdev->dev); 229 mdio_gpio_bus_destroy(&ofdev->dev);
230 kfree(ofdev->dev.platform_data); 230 kfree(ofdev->dev.platform_data);
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 35540411990d..078bbf4e6f19 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -3219,11 +3219,8 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
3219 3219
3220 device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL); 3220 device_set_wakeup_enable(&pdev->dev, tp->features & RTL_FEATURE_WOL);
3221 3221
3222 if (pci_dev_run_wake(pdev)) { 3222 if (pci_dev_run_wake(pdev))
3223 pm_runtime_set_active(&pdev->dev); 3223 pm_runtime_put_noidle(&pdev->dev);
3224 pm_runtime_enable(&pdev->dev);
3225 }
3226 pm_runtime_idle(&pdev->dev);
3227 3224
3228out: 3225out:
3229 return rc; 3226 return rc;
@@ -3246,17 +3243,12 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev)
3246 struct net_device *dev = pci_get_drvdata(pdev); 3243 struct net_device *dev = pci_get_drvdata(pdev);
3247 struct rtl8169_private *tp = netdev_priv(dev); 3244 struct rtl8169_private *tp = netdev_priv(dev);
3248 3245
3249 pm_runtime_get_sync(&pdev->dev);
3250
3251 flush_scheduled_work(); 3246 flush_scheduled_work();
3252 3247
3253 unregister_netdev(dev); 3248 unregister_netdev(dev);
3254 3249
3255 if (pci_dev_run_wake(pdev)) { 3250 if (pci_dev_run_wake(pdev))
3256 pm_runtime_disable(&pdev->dev); 3251 pm_runtime_get_noresume(&pdev->dev);
3257 pm_runtime_set_suspended(&pdev->dev);
3258 }
3259 pm_runtime_put_noidle(&pdev->dev);
3260 3252
3261 /* restore original MAC address */ 3253 /* restore original MAC address */
3262 rtl_rar_set(tp, dev->perm_addr); 3254 rtl_rar_set(tp, dev->perm_addr);
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index 8d2772cc42f2..ee747919a766 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -83,43 +83,6 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
83 } 83 }
84} 84}
85 85
86#elif defined(CONFIG_REDWOOD_5) || defined(CONFIG_REDWOOD_6)
87
88/* We can only do 16-bit reads and writes in the static memory space. */
89#define SMC_CAN_USE_8BIT 0
90#define SMC_CAN_USE_16BIT 1
91#define SMC_CAN_USE_32BIT 0
92#define SMC_NOWAIT 1
93
94#define SMC_IO_SHIFT 0
95
96#define SMC_inw(a, r) in_be16((volatile u16 *)((a) + (r)))
97#define SMC_outw(v, a, r) out_be16((volatile u16 *)((a) + (r)), v)
98#define SMC_insw(a, r, p, l) \
99 do { \
100 unsigned long __port = (a) + (r); \
101 u16 *__p = (u16 *)(p); \
102 int __l = (l); \
103 insw(__port, __p, __l); \
104 while (__l > 0) { \
105 *__p = swab16(*__p); \
106 __p++; \
107 __l--; \
108 } \
109 } while (0)
110#define SMC_outsw(a, r, p, l) \
111 do { \
112 unsigned long __port = (a) + (r); \
113 u16 *__p = (u16 *)(p); \
114 int __l = (l); \
115 while (__l > 0) { \
116 /* Believe it or not, the swab isn't needed. */ \
117 outw( /* swab16 */ (*__p++), __port); \
118 __l--; \
119 } \
120 } while (0)
121#define SMC_IRQ_FLAGS (0)
122
123#elif defined(CONFIG_SA1100_PLEB) 86#elif defined(CONFIG_SA1100_PLEB)
124/* We can only do 16-bit reads and writes in the static memory space. */ 87/* We can only do 16-bit reads and writes in the static memory space. */
125#define SMC_CAN_USE_8BIT 1 88#define SMC_CAN_USE_8BIT 1
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index 367e96f317d4..618643e3ca3e 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -97,7 +97,7 @@ static int qec_global_reset(void __iomem *gregs)
97 97
98static void qec_init(struct bigmac *bp) 98static void qec_init(struct bigmac *bp)
99{ 99{
100 struct of_device *qec_op = bp->qec_op; 100 struct platform_device *qec_op = bp->qec_op;
101 void __iomem *gregs = bp->gregs; 101 void __iomem *gregs = bp->gregs;
102 u8 bsizes = bp->bigmac_bursts; 102 u8 bsizes = bp->bigmac_bursts;
103 u32 regval; 103 u32 regval;
@@ -1083,8 +1083,8 @@ static const struct net_device_ops bigmac_ops = {
1083 .ndo_validate_addr = eth_validate_addr, 1083 .ndo_validate_addr = eth_validate_addr,
1084}; 1084};
1085 1085
1086static int __devinit bigmac_ether_init(struct of_device *op, 1086static int __devinit bigmac_ether_init(struct platform_device *op,
1087 struct of_device *qec_op) 1087 struct platform_device *qec_op)
1088{ 1088{
1089 static int version_printed; 1089 static int version_printed;
1090 struct net_device *dev; 1090 struct net_device *dev;
@@ -1201,7 +1201,7 @@ static int __devinit bigmac_ether_init(struct of_device *op,
1201 dev->watchdog_timeo = 5*HZ; 1201 dev->watchdog_timeo = 5*HZ;
1202 1202
1203 /* Finish net device registration. */ 1203 /* Finish net device registration. */
1204 dev->irq = bp->bigmac_op->irqs[0]; 1204 dev->irq = bp->bigmac_op->archdata.irqs[0];
1205 dev->dma = 0; 1205 dev->dma = 0;
1206 1206
1207 if (register_netdev(dev)) { 1207 if (register_netdev(dev)) {
@@ -1242,25 +1242,25 @@ fail_and_cleanup:
1242/* QEC can be the parent of either QuadEthernet or a BigMAC. We want 1242/* QEC can be the parent of either QuadEthernet or a BigMAC. We want
1243 * the latter. 1243 * the latter.
1244 */ 1244 */
1245static int __devinit bigmac_sbus_probe(struct of_device *op, 1245static int __devinit bigmac_sbus_probe(struct platform_device *op,
1246 const struct of_device_id *match) 1246 const struct of_device_id *match)
1247{ 1247{
1248 struct device *parent = op->dev.parent; 1248 struct device *parent = op->dev.parent;
1249 struct of_device *qec_op; 1249 struct platform_device *qec_op;
1250 1250
1251 qec_op = to_of_device(parent); 1251 qec_op = to_platform_device(parent);
1252 1252
1253 return bigmac_ether_init(op, qec_op); 1253 return bigmac_ether_init(op, qec_op);
1254} 1254}
1255 1255
1256static int __devexit bigmac_sbus_remove(struct of_device *op) 1256static int __devexit bigmac_sbus_remove(struct platform_device *op)
1257{ 1257{
1258 struct bigmac *bp = dev_get_drvdata(&op->dev); 1258 struct bigmac *bp = dev_get_drvdata(&op->dev);
1259 struct device *parent = op->dev.parent; 1259 struct device *parent = op->dev.parent;
1260 struct net_device *net_dev = bp->dev; 1260 struct net_device *net_dev = bp->dev;
1261 struct of_device *qec_op; 1261 struct platform_device *qec_op;
1262 1262
1263 qec_op = to_of_device(parent); 1263 qec_op = to_platform_device(parent);
1264 1264
1265 unregister_netdev(net_dev); 1265 unregister_netdev(net_dev);
1266 1266
@@ -1301,12 +1301,12 @@ static struct of_platform_driver bigmac_sbus_driver = {
1301 1301
1302static int __init bigmac_init(void) 1302static int __init bigmac_init(void)
1303{ 1303{
1304 return of_register_driver(&bigmac_sbus_driver, &of_bus_type); 1304 return of_register_platform_driver(&bigmac_sbus_driver);
1305} 1305}
1306 1306
1307static void __exit bigmac_exit(void) 1307static void __exit bigmac_exit(void)
1308{ 1308{
1309 of_unregister_driver(&bigmac_sbus_driver); 1309 of_unregister_platform_driver(&bigmac_sbus_driver);
1310} 1310}
1311 1311
1312module_init(bigmac_init); 1312module_init(bigmac_init);
diff --git a/drivers/net/sunbmac.h b/drivers/net/sunbmac.h
index 8840bc0b840b..8db88945b889 100644
--- a/drivers/net/sunbmac.h
+++ b/drivers/net/sunbmac.h
@@ -329,8 +329,8 @@ struct bigmac {
329 unsigned int timer_ticks; 329 unsigned int timer_ticks;
330 330
331 struct net_device_stats enet_stats; 331 struct net_device_stats enet_stats;
332 struct of_device *qec_op; 332 struct platform_device *qec_op;
333 struct of_device *bigmac_op; 333 struct platform_device *bigmac_op;
334 struct net_device *dev; 334 struct net_device *dev;
335}; 335};
336 336
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 3d9650b8d38f..bd0df1c14955 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -1591,7 +1591,7 @@ static int happy_meal_init(struct happy_meal *hp)
1591 */ 1591 */
1592#ifdef CONFIG_SBUS 1592#ifdef CONFIG_SBUS
1593 if ((hp->happy_flags & HFLAG_PCI) == 0) { 1593 if ((hp->happy_flags & HFLAG_PCI) == 0) {
1594 struct of_device *op = hp->happy_dev; 1594 struct platform_device *op = hp->happy_dev;
1595 if (sbus_can_dma_64bit()) { 1595 if (sbus_can_dma_64bit()) {
1596 sbus_set_sbus64(&op->dev, 1596 sbus_set_sbus64(&op->dev,
1597 hp->happy_bursts); 1597 hp->happy_bursts);
@@ -2480,7 +2480,7 @@ static void hme_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info
2480#ifdef CONFIG_SBUS 2480#ifdef CONFIG_SBUS
2481 else { 2481 else {
2482 const struct linux_prom_registers *regs; 2482 const struct linux_prom_registers *regs;
2483 struct of_device *op = hp->happy_dev; 2483 struct platform_device *op = hp->happy_dev;
2484 regs = of_get_property(op->dev.of_node, "regs", NULL); 2484 regs = of_get_property(op->dev.of_node, "regs", NULL);
2485 if (regs) 2485 if (regs)
2486 sprintf(info->bus_info, "SBUS:%d", 2486 sprintf(info->bus_info, "SBUS:%d",
@@ -2515,13 +2515,13 @@ static int hme_version_printed;
2515 * 2515 *
2516 * Return NULL on failure. 2516 * Return NULL on failure.
2517 */ 2517 */
2518static struct quattro * __devinit quattro_sbus_find(struct of_device *child) 2518static struct quattro * __devinit quattro_sbus_find(struct platform_device *child)
2519{ 2519{
2520 struct device *parent = child->dev.parent; 2520 struct device *parent = child->dev.parent;
2521 struct of_device *op; 2521 struct platform_device *op;
2522 struct quattro *qp; 2522 struct quattro *qp;
2523 2523
2524 op = to_of_device(parent); 2524 op = to_platform_device(parent);
2525 qp = dev_get_drvdata(&op->dev); 2525 qp = dev_get_drvdata(&op->dev);
2526 if (qp) 2526 if (qp)
2527 return qp; 2527 return qp;
@@ -2551,7 +2551,7 @@ static int __init quattro_sbus_register_irqs(void)
2551 struct quattro *qp; 2551 struct quattro *qp;
2552 2552
2553 for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { 2553 for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) {
2554 struct of_device *op = qp->quattro_dev; 2554 struct platform_device *op = qp->quattro_dev;
2555 int err, qfe_slot, skip = 0; 2555 int err, qfe_slot, skip = 0;
2556 2556
2557 for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) { 2557 for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) {
@@ -2561,7 +2561,7 @@ static int __init quattro_sbus_register_irqs(void)
2561 if (skip) 2561 if (skip)
2562 continue; 2562 continue;
2563 2563
2564 err = request_irq(op->irqs[0], 2564 err = request_irq(op->archdata.irqs[0],
2565 quattro_sbus_interrupt, 2565 quattro_sbus_interrupt,
2566 IRQF_SHARED, "Quattro", 2566 IRQF_SHARED, "Quattro",
2567 qp); 2567 qp);
@@ -2580,7 +2580,7 @@ static void quattro_sbus_free_irqs(void)
2580 struct quattro *qp; 2580 struct quattro *qp;
2581 2581
2582 for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) { 2582 for (qp = qfe_sbus_list; qp != NULL; qp = qp->next) {
2583 struct of_device *op = qp->quattro_dev; 2583 struct platform_device *op = qp->quattro_dev;
2584 int qfe_slot, skip = 0; 2584 int qfe_slot, skip = 0;
2585 2585
2586 for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) { 2586 for (qfe_slot = 0; qfe_slot < 4; qfe_slot++) {
@@ -2590,7 +2590,7 @@ static void quattro_sbus_free_irqs(void)
2590 if (skip) 2590 if (skip)
2591 continue; 2591 continue;
2592 2592
2593 free_irq(op->irqs[0], qp); 2593 free_irq(op->archdata.irqs[0], qp);
2594 } 2594 }
2595} 2595}
2596#endif /* CONFIG_SBUS */ 2596#endif /* CONFIG_SBUS */
@@ -2639,7 +2639,7 @@ static const struct net_device_ops hme_netdev_ops = {
2639}; 2639};
2640 2640
2641#ifdef CONFIG_SBUS 2641#ifdef CONFIG_SBUS
2642static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe) 2642static int __devinit happy_meal_sbus_probe_one(struct platform_device *op, int is_qfe)
2643{ 2643{
2644 struct device_node *dp = op->dev.of_node, *sbus_dp; 2644 struct device_node *dp = op->dev.of_node, *sbus_dp;
2645 struct quattro *qp = NULL; 2645 struct quattro *qp = NULL;
@@ -2648,7 +2648,7 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
2648 int i, qfe_slot = -1; 2648 int i, qfe_slot = -1;
2649 int err = -ENODEV; 2649 int err = -ENODEV;
2650 2650
2651 sbus_dp = to_of_device(op->dev.parent)->dev.of_node; 2651 sbus_dp = op->dev.parent->of_node;
2652 2652
2653 /* We can match PCI devices too, do not accept those here. */ 2653 /* We can match PCI devices too, do not accept those here. */
2654 if (strcmp(sbus_dp->name, "sbus")) 2654 if (strcmp(sbus_dp->name, "sbus"))
@@ -2790,7 +2790,7 @@ static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe)
2790 /* Happy Meal can do it all... */ 2790 /* Happy Meal can do it all... */
2791 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; 2791 dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM;
2792 2792
2793 dev->irq = op->irqs[0]; 2793 dev->irq = op->archdata.irqs[0];
2794 2794
2795#if defined(CONFIG_SBUS) && defined(CONFIG_PCI) 2795#if defined(CONFIG_SBUS) && defined(CONFIG_PCI)
2796 /* Hook up SBUS register/descriptor accessors. */ 2796 /* Hook up SBUS register/descriptor accessors. */
@@ -3235,7 +3235,7 @@ static void happy_meal_pci_exit(void)
3235#endif 3235#endif
3236 3236
3237#ifdef CONFIG_SBUS 3237#ifdef CONFIG_SBUS
3238static int __devinit hme_sbus_probe(struct of_device *op, const struct of_device_id *match) 3238static int __devinit hme_sbus_probe(struct platform_device *op, const struct of_device_id *match)
3239{ 3239{
3240 struct device_node *dp = op->dev.of_node; 3240 struct device_node *dp = op->dev.of_node;
3241 const char *model = of_get_property(dp, "model", NULL); 3241 const char *model = of_get_property(dp, "model", NULL);
@@ -3247,7 +3247,7 @@ static int __devinit hme_sbus_probe(struct of_device *op, const struct of_device
3247 return happy_meal_sbus_probe_one(op, is_qfe); 3247 return happy_meal_sbus_probe_one(op, is_qfe);
3248} 3248}
3249 3249
3250static int __devexit hme_sbus_remove(struct of_device *op) 3250static int __devexit hme_sbus_remove(struct platform_device *op)
3251{ 3251{
3252 struct happy_meal *hp = dev_get_drvdata(&op->dev); 3252 struct happy_meal *hp = dev_get_drvdata(&op->dev);
3253 struct net_device *net_dev = hp->dev; 3253 struct net_device *net_dev = hp->dev;
@@ -3304,7 +3304,7 @@ static int __init happy_meal_sbus_init(void)
3304{ 3304{
3305 int err; 3305 int err;
3306 3306
3307 err = of_register_driver(&hme_sbus_driver, &of_bus_type); 3307 err = of_register_platform_driver(&hme_sbus_driver);
3308 if (!err) 3308 if (!err)
3309 err = quattro_sbus_register_irqs(); 3309 err = quattro_sbus_register_irqs();
3310 3310
@@ -3313,7 +3313,7 @@ static int __init happy_meal_sbus_init(void)
3313 3313
3314static void happy_meal_sbus_exit(void) 3314static void happy_meal_sbus_exit(void)
3315{ 3315{
3316 of_unregister_driver(&hme_sbus_driver); 3316 of_unregister_platform_driver(&hme_sbus_driver);
3317 quattro_sbus_free_irqs(); 3317 quattro_sbus_free_irqs();
3318 3318
3319 while (qfe_sbus_list) { 3319 while (qfe_sbus_list) {
diff --git a/drivers/net/sunhme.h b/drivers/net/sunhme.h
index efd2ca0fcad3..756b5bf3aa89 100644
--- a/drivers/net/sunhme.h
+++ b/drivers/net/sunhme.h
@@ -407,7 +407,7 @@ struct happy_meal {
407 void (*write_rxd)(struct happy_meal_rxd *, u32, u32); 407 void (*write_rxd)(struct happy_meal_rxd *, u32, u32);
408#endif 408#endif
409 409
410 /* This is either an of_device or a pci_dev. */ 410 /* This is either an platform_device or a pci_dev. */
411 void *happy_dev; 411 void *happy_dev;
412 struct device *dma_dev; 412 struct device *dma_dev;
413 413
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 7d9c33dd9d1a..8dcb858f2168 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -250,7 +250,7 @@ struct lance_private {
250 int rx_new, tx_new; 250 int rx_new, tx_new;
251 int rx_old, tx_old; 251 int rx_old, tx_old;
252 252
253 struct of_device *ledma; /* If set this points to ledma */ 253 struct platform_device *ledma; /* If set this points to ledma */
254 char tpe; /* cable-selection is TPE */ 254 char tpe; /* cable-selection is TPE */
255 char auto_select; /* cable-selection by carrier */ 255 char auto_select; /* cable-selection by carrier */
256 char burst_sizes; /* ledma SBus burst sizes */ 256 char burst_sizes; /* ledma SBus burst sizes */
@@ -265,8 +265,8 @@ struct lance_private {
265 char *name; 265 char *name;
266 dma_addr_t init_block_dvma; 266 dma_addr_t init_block_dvma;
267 struct net_device *dev; /* Backpointer */ 267 struct net_device *dev; /* Backpointer */
268 struct of_device *op; 268 struct platform_device *op;
269 struct of_device *lebuffer; 269 struct platform_device *lebuffer;
270 struct timer_list multicast_timer; 270 struct timer_list multicast_timer;
271}; 271};
272 272
@@ -1272,7 +1272,7 @@ static void lance_free_hwresources(struct lance_private *lp)
1272 if (lp->lregs) 1272 if (lp->lregs)
1273 of_iounmap(&lp->op->resource[0], lp->lregs, LANCE_REG_SIZE); 1273 of_iounmap(&lp->op->resource[0], lp->lregs, LANCE_REG_SIZE);
1274 if (lp->dregs) { 1274 if (lp->dregs) {
1275 struct of_device *ledma = lp->ledma; 1275 struct platform_device *ledma = lp->ledma;
1276 1276
1277 of_iounmap(&ledma->resource[0], lp->dregs, 1277 of_iounmap(&ledma->resource[0], lp->dregs,
1278 resource_size(&ledma->resource[0])); 1278 resource_size(&ledma->resource[0]));
@@ -1319,9 +1319,9 @@ static const struct net_device_ops sparc_lance_ops = {
1319 .ndo_validate_addr = eth_validate_addr, 1319 .ndo_validate_addr = eth_validate_addr,
1320}; 1320};
1321 1321
1322static int __devinit sparc_lance_probe_one(struct of_device *op, 1322static int __devinit sparc_lance_probe_one(struct platform_device *op,
1323 struct of_device *ledma, 1323 struct platform_device *ledma,
1324 struct of_device *lebuffer) 1324 struct platform_device *lebuffer)
1325{ 1325{
1326 struct device_node *dp = op->dev.of_node; 1326 struct device_node *dp = op->dev.of_node;
1327 static unsigned version_printed; 1327 static unsigned version_printed;
@@ -1474,7 +1474,7 @@ no_link_test:
1474 dev->ethtool_ops = &sparc_lance_ethtool_ops; 1474 dev->ethtool_ops = &sparc_lance_ethtool_ops;
1475 dev->netdev_ops = &sparc_lance_ops; 1475 dev->netdev_ops = &sparc_lance_ops;
1476 1476
1477 dev->irq = op->irqs[0]; 1477 dev->irq = op->archdata.irqs[0];
1478 1478
1479 /* We cannot sleep if the chip is busy during a 1479 /* We cannot sleep if the chip is busy during a
1480 * multicast list update event, because such events 1480 * multicast list update event, because such events
@@ -1503,9 +1503,9 @@ fail:
1503 return -ENODEV; 1503 return -ENODEV;
1504} 1504}
1505 1505
1506static int __devinit sunlance_sbus_probe(struct of_device *op, const struct of_device_id *match) 1506static int __devinit sunlance_sbus_probe(struct platform_device *op, const struct of_device_id *match)
1507{ 1507{
1508 struct of_device *parent = to_of_device(op->dev.parent); 1508 struct platform_device *parent = to_platform_device(op->dev.parent);
1509 struct device_node *parent_dp = parent->dev.of_node; 1509 struct device_node *parent_dp = parent->dev.of_node;
1510 int err; 1510 int err;
1511 1511
@@ -1519,7 +1519,7 @@ static int __devinit sunlance_sbus_probe(struct of_device *op, const struct of_d
1519 return err; 1519 return err;
1520} 1520}
1521 1521
1522static int __devexit sunlance_sbus_remove(struct of_device *op) 1522static int __devexit sunlance_sbus_remove(struct platform_device *op)
1523{ 1523{
1524 struct lance_private *lp = dev_get_drvdata(&op->dev); 1524 struct lance_private *lp = dev_get_drvdata(&op->dev);
1525 struct net_device *net_dev = lp->dev; 1525 struct net_device *net_dev = lp->dev;
@@ -1558,12 +1558,12 @@ static struct of_platform_driver sunlance_sbus_driver = {
1558/* Find all the lance cards on the system and initialize them */ 1558/* Find all the lance cards on the system and initialize them */
1559static int __init sparc_lance_init(void) 1559static int __init sparc_lance_init(void)
1560{ 1560{
1561 return of_register_driver(&sunlance_sbus_driver, &of_bus_type); 1561 return of_register_platform_driver(&sunlance_sbus_driver);
1562} 1562}
1563 1563
1564static void __exit sparc_lance_exit(void) 1564static void __exit sparc_lance_exit(void)
1565{ 1565{
1566 of_unregister_driver(&sunlance_sbus_driver); 1566 of_unregister_platform_driver(&sunlance_sbus_driver);
1567} 1567}
1568 1568
1569module_init(sparc_lance_init); 1569module_init(sparc_lance_init);
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index 72b579c8d812..72e65d4666ef 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -689,7 +689,7 @@ static void qe_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
689{ 689{
690 const struct linux_prom_registers *regs; 690 const struct linux_prom_registers *regs;
691 struct sunqe *qep = netdev_priv(dev); 691 struct sunqe *qep = netdev_priv(dev);
692 struct of_device *op; 692 struct platform_device *op;
693 693
694 strcpy(info->driver, "sunqe"); 694 strcpy(info->driver, "sunqe");
695 strcpy(info->version, "3.0"); 695 strcpy(info->version, "3.0");
@@ -720,7 +720,7 @@ static const struct ethtool_ops qe_ethtool_ops = {
720}; 720};
721 721
722/* This is only called once at boot time for each card probed. */ 722/* This is only called once at boot time for each card probed. */
723static void qec_init_once(struct sunqec *qecp, struct of_device *op) 723static void qec_init_once(struct sunqec *qecp, struct platform_device *op)
724{ 724{
725 u8 bsizes = qecp->qec_bursts; 725 u8 bsizes = qecp->qec_bursts;
726 726
@@ -770,9 +770,9 @@ static u8 __devinit qec_get_burst(struct device_node *dp)
770 return bsizes; 770 return bsizes;
771} 771}
772 772
773static struct sunqec * __devinit get_qec(struct of_device *child) 773static struct sunqec * __devinit get_qec(struct platform_device *child)
774{ 774{
775 struct of_device *op = to_of_device(child->dev.parent); 775 struct platform_device *op = to_platform_device(child->dev.parent);
776 struct sunqec *qecp; 776 struct sunqec *qecp;
777 777
778 qecp = dev_get_drvdata(&op->dev); 778 qecp = dev_get_drvdata(&op->dev);
@@ -803,7 +803,7 @@ static struct sunqec * __devinit get_qec(struct of_device *child)
803 803
804 qec_init_once(qecp, op); 804 qec_init_once(qecp, op);
805 805
806 if (request_irq(op->irqs[0], qec_interrupt, 806 if (request_irq(op->archdata.irqs[0], qec_interrupt,
807 IRQF_SHARED, "qec", (void *) qecp)) { 807 IRQF_SHARED, "qec", (void *) qecp)) {
808 printk(KERN_ERR "qec: Can't register irq.\n"); 808 printk(KERN_ERR "qec: Can't register irq.\n");
809 goto fail; 809 goto fail;
@@ -836,7 +836,7 @@ static const struct net_device_ops qec_ops = {
836 .ndo_validate_addr = eth_validate_addr, 836 .ndo_validate_addr = eth_validate_addr,
837}; 837};
838 838
839static int __devinit qec_ether_init(struct of_device *op) 839static int __devinit qec_ether_init(struct platform_device *op)
840{ 840{
841 static unsigned version_printed; 841 static unsigned version_printed;
842 struct net_device *dev; 842 struct net_device *dev;
@@ -901,7 +901,7 @@ static int __devinit qec_ether_init(struct of_device *op)
901 SET_NETDEV_DEV(dev, &op->dev); 901 SET_NETDEV_DEV(dev, &op->dev);
902 902
903 dev->watchdog_timeo = 5*HZ; 903 dev->watchdog_timeo = 5*HZ;
904 dev->irq = op->irqs[0]; 904 dev->irq = op->archdata.irqs[0];
905 dev->dma = 0; 905 dev->dma = 0;
906 dev->ethtool_ops = &qe_ethtool_ops; 906 dev->ethtool_ops = &qe_ethtool_ops;
907 dev->netdev_ops = &qec_ops; 907 dev->netdev_ops = &qec_ops;
@@ -941,12 +941,12 @@ fail:
941 return res; 941 return res;
942} 942}
943 943
944static int __devinit qec_sbus_probe(struct of_device *op, const struct of_device_id *match) 944static int __devinit qec_sbus_probe(struct platform_device *op, const struct of_device_id *match)
945{ 945{
946 return qec_ether_init(op); 946 return qec_ether_init(op);
947} 947}
948 948
949static int __devexit qec_sbus_remove(struct of_device *op) 949static int __devexit qec_sbus_remove(struct platform_device *op)
950{ 950{
951 struct sunqe *qp = dev_get_drvdata(&op->dev); 951 struct sunqe *qp = dev_get_drvdata(&op->dev);
952 struct net_device *net_dev = qp->dev; 952 struct net_device *net_dev = qp->dev;
@@ -988,18 +988,18 @@ static struct of_platform_driver qec_sbus_driver = {
988 988
989static int __init qec_init(void) 989static int __init qec_init(void)
990{ 990{
991 return of_register_driver(&qec_sbus_driver, &of_bus_type); 991 return of_register_platform_driver(&qec_sbus_driver);
992} 992}
993 993
994static void __exit qec_exit(void) 994static void __exit qec_exit(void)
995{ 995{
996 of_unregister_driver(&qec_sbus_driver); 996 of_unregister_platform_driver(&qec_sbus_driver);
997 997
998 while (root_qec_dev) { 998 while (root_qec_dev) {
999 struct sunqec *next = root_qec_dev->next_module; 999 struct sunqec *next = root_qec_dev->next_module;
1000 struct of_device *op = root_qec_dev->op; 1000 struct platform_device *op = root_qec_dev->op;
1001 1001
1002 free_irq(op->irqs[0], (void *) root_qec_dev); 1002 free_irq(op->archdata.irqs[0], (void *) root_qec_dev);
1003 of_iounmap(&op->resource[0], root_qec_dev->gregs, 1003 of_iounmap(&op->resource[0], root_qec_dev->gregs,
1004 GLOB_REG_SIZE); 1004 GLOB_REG_SIZE);
1005 kfree(root_qec_dev); 1005 kfree(root_qec_dev);
diff --git a/drivers/net/sunqe.h b/drivers/net/sunqe.h
index 5813a7b2faa5..581781b6b2fa 100644
--- a/drivers/net/sunqe.h
+++ b/drivers/net/sunqe.h
@@ -314,7 +314,7 @@ struct sunqec {
314 void __iomem *gregs; /* QEC Global Registers */ 314 void __iomem *gregs; /* QEC Global Registers */
315 struct sunqe *qes[4]; /* Each child MACE */ 315 struct sunqe *qes[4]; /* Each child MACE */
316 unsigned int qec_bursts; /* Support burst sizes */ 316 unsigned int qec_bursts; /* Support burst sizes */
317 struct of_device *op; /* QEC's OF device */ 317 struct platform_device *op; /* QEC's OF device */
318 struct sunqec *next_module; /* List of all QECs in system */ 318 struct sunqec *next_module; /* List of all QECs in system */
319}; 319};
320 320
@@ -342,7 +342,7 @@ struct sunqe {
342 __u32 buffers_dvma; /* DVMA visible address. */ 342 __u32 buffers_dvma; /* DVMA visible address. */
343 struct sunqec *parent; 343 struct sunqec *parent;
344 u8 mconfig; /* Base MACE mconfig value */ 344 u8 mconfig; /* Base MACE mconfig value */
345 struct of_device *op; /* QE's OF device struct */ 345 struct platform_device *op; /* QE's OF device struct */
346 struct net_device *dev; /* QE's netdevice struct */ 346 struct net_device *dev; /* QE's netdevice struct */
347 int channel; /* Who am I? */ 347 int channel; /* Who am I? */
348}; 348};
diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 8d532f9b50d0..a4c3f5708246 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3601,7 +3601,7 @@ static void ucc_geth_timeout(struct net_device *dev)
3601 3601
3602#ifdef CONFIG_PM 3602#ifdef CONFIG_PM
3603 3603
3604static int ucc_geth_suspend(struct of_device *ofdev, pm_message_t state) 3604static int ucc_geth_suspend(struct platform_device *ofdev, pm_message_t state)
3605{ 3605{
3606 struct net_device *ndev = dev_get_drvdata(&ofdev->dev); 3606 struct net_device *ndev = dev_get_drvdata(&ofdev->dev);
3607 struct ucc_geth_private *ugeth = netdev_priv(ndev); 3607 struct ucc_geth_private *ugeth = netdev_priv(ndev);
@@ -3629,7 +3629,7 @@ static int ucc_geth_suspend(struct of_device *ofdev, pm_message_t state)
3629 return 0; 3629 return 0;
3630} 3630}
3631 3631
3632static int ucc_geth_resume(struct of_device *ofdev) 3632static int ucc_geth_resume(struct platform_device *ofdev)
3633{ 3633{
3634 struct net_device *ndev = dev_get_drvdata(&ofdev->dev); 3634 struct net_device *ndev = dev_get_drvdata(&ofdev->dev);
3635 struct ucc_geth_private *ugeth = netdev_priv(ndev); 3635 struct ucc_geth_private *ugeth = netdev_priv(ndev);
@@ -3732,7 +3732,7 @@ static const struct net_device_ops ucc_geth_netdev_ops = {
3732#endif 3732#endif
3733}; 3733};
3734 3734
3735static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *match) 3735static int ucc_geth_probe(struct platform_device* ofdev, const struct of_device_id *match)
3736{ 3736{
3737 struct device *device = &ofdev->dev; 3737 struct device *device = &ofdev->dev;
3738 struct device_node *np = ofdev->dev.of_node; 3738 struct device_node *np = ofdev->dev.of_node;
@@ -3954,7 +3954,7 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
3954 return 0; 3954 return 0;
3955} 3955}
3956 3956
3957static int ucc_geth_remove(struct of_device* ofdev) 3957static int ucc_geth_remove(struct platform_device* ofdev)
3958{ 3958{
3959 struct device *device = &ofdev->dev; 3959 struct device *device = &ofdev->dev;
3960 struct net_device *dev = dev_get_drvdata(device); 3960 struct net_device *dev = dev_get_drvdata(device);
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 08e7b6abacdd..8ed30fa35d0a 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -58,6 +58,7 @@
58#define USB_PRODUCT_IPHONE 0x1290 58#define USB_PRODUCT_IPHONE 0x1290
59#define USB_PRODUCT_IPHONE_3G 0x1292 59#define USB_PRODUCT_IPHONE_3G 0x1292
60#define USB_PRODUCT_IPHONE_3GS 0x1294 60#define USB_PRODUCT_IPHONE_3GS 0x1294
61#define USB_PRODUCT_IPHONE_4 0x1297
61 62
62#define IPHETH_USBINTF_CLASS 255 63#define IPHETH_USBINTF_CLASS 255
63#define IPHETH_USBINTF_SUBCLASS 253 64#define IPHETH_USBINTF_SUBCLASS 253
@@ -92,6 +93,10 @@ static struct usb_device_id ipheth_table[] = {
92 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_3GS, 93 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_3GS,
93 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, 94 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
94 IPHETH_USBINTF_PROTO) }, 95 IPHETH_USBINTF_PROTO) },
96 { USB_DEVICE_AND_INTERFACE_INFO(
97 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4,
98 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
99 IPHETH_USBINTF_PROTO) },
95 { } 100 { }
96}; 101};
97MODULE_DEVICE_TABLE(usb, ipheth_table); 102MODULE_DEVICE_TABLE(usb, ipheth_table);
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index 88e363033e23..6c571e198835 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -396,7 +396,7 @@ static void hss_config(struct port *port)
396 msg.cmd = PORT_CONFIG_WRITE; 396 msg.cmd = PORT_CONFIG_WRITE;
397 msg.hss_port = port->id; 397 msg.hss_port = port->id;
398 msg.index = HSS_CONFIG_TX_PCR; 398 msg.index = HSS_CONFIG_TX_PCR;
399 msg.data32 = PCR_FRM_SYNC_OUTPUT_RISING | PCR_MSB_ENDIAN | 399 msg.data32 = PCR_FRM_PULSE_DISABLED | PCR_MSB_ENDIAN |
400 PCR_TX_DATA_ENABLE | PCR_SOF_NO_FBIT; 400 PCR_TX_DATA_ENABLE | PCR_SOF_NO_FBIT;
401 if (port->clock_type == CLOCK_INT) 401 if (port->clock_type == CLOCK_INT)
402 msg.data32 |= PCR_SYNC_CLK_DIR_OUTPUT; 402 msg.data32 |= PCR_SYNC_CLK_DIR_OUTPUT;
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c
index 33bdc6a84e81..9a121a5b787c 100644
--- a/drivers/net/wireless/airo_cs.c
+++ b/drivers/net/wireless/airo_cs.c
@@ -32,7 +32,6 @@
32#include <linux/timer.h> 32#include <linux/timer.h>
33#include <linux/netdevice.h> 33#include <linux/netdevice.h>
34 34
35#include <pcmcia/cs_types.h>
36#include <pcmcia/cs.h> 35#include <pcmcia/cs.h>
37#include <pcmcia/cistpl.h> 36#include <pcmcia/cistpl.h>
38#include <pcmcia/cisreg.h> 37#include <pcmcia/cisreg.h>
@@ -155,8 +154,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
155 unsigned int vcc, 154 unsigned int vcc,
156 void *priv_data) 155 void *priv_data)
157{ 156{
158 win_req_t *req = priv_data;
159
160 if (cfg->index == 0) 157 if (cfg->index == 0)
161 return -ENODEV; 158 return -ENODEV;
162 159
@@ -176,52 +173,25 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
176 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 173 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
177 174
178 /* IO window settings */ 175 /* IO window settings */
179 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 176 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
180 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 177 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
181 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 178 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
182 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 179 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
183 if (!(io->flags & CISTPL_IO_8BIT)) 180 p_dev->resource[0]->flags |=
184 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 181 pcmcia_io_cfg_data_width(io->flags);
185 if (!(io->flags & CISTPL_IO_16BIT)) 182 p_dev->resource[0]->start = io->win[0].base;
186 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 183 p_dev->resource[0]->end = io->win[0].len;
187 p_dev->io.BasePort1 = io->win[0].base;
188 p_dev->io.NumPorts1 = io->win[0].len;
189 if (io->nwin > 1) { 184 if (io->nwin > 1) {
190 p_dev->io.Attributes2 = p_dev->io.Attributes1; 185 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
191 p_dev->io.BasePort2 = io->win[1].base; 186 p_dev->resource[1]->start = io->win[1].base;
192 p_dev->io.NumPorts2 = io->win[1].len; 187 p_dev->resource[1]->end = io->win[1].len;
193 } 188 }
194 } 189 }
195 190
196 /* This reserves IO space but doesn't actually enable it */ 191 /* This reserves IO space but doesn't actually enable it */
197 if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 192 if (pcmcia_request_io(p_dev) != 0)
198 return -ENODEV; 193 return -ENODEV;
199 194
200 /*
201 Now set up a common memory window, if needed. There is room
202 in the struct pcmcia_device structure for one memory window handle,
203 but if the base addresses need to be saved, or if multiple
204 windows are needed, the info should go in the private data
205 structure for this device.
206
207 Note that the memory window base is a physical address, and
208 needs to be mapped to virtual space with ioremap() before it
209 is used.
210 */
211 if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) {
212 cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem;
213 memreq_t map;
214 req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM;
215 req->Base = mem->win[0].host_addr;
216 req->Size = mem->win[0].len;
217 req->AccessSpeed = 0;
218 if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0)
219 return -ENODEV;
220 map.Page = 0;
221 map.CardOffset = mem->win[0].card_addr;
222 if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0)
223 return -ENODEV;
224 }
225 /* If we got this far, we're cool! */ 195 /* If we got this far, we're cool! */
226 return 0; 196 return 0;
227} 197}
@@ -230,17 +200,12 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
230static int airo_config(struct pcmcia_device *link) 200static int airo_config(struct pcmcia_device *link)
231{ 201{
232 local_info_t *dev; 202 local_info_t *dev;
233 win_req_t *req;
234 int ret; 203 int ret;
235 204
236 dev = link->priv; 205 dev = link->priv;
237 206
238 dev_dbg(&link->dev, "airo_config\n"); 207 dev_dbg(&link->dev, "airo_config\n");
239 208
240 req = kzalloc(sizeof(win_req_t), GFP_KERNEL);
241 if (!req)
242 return -ENOMEM;
243
244 /* 209 /*
245 * In this loop, we scan the CIS for configuration table 210 * In this loop, we scan the CIS for configuration table
246 * entries, each of which describes a valid card 211 * entries, each of which describes a valid card
@@ -255,7 +220,7 @@ static int airo_config(struct pcmcia_device *link)
255 * and most client drivers will only use the CIS to fill in 220 * and most client drivers will only use the CIS to fill in
256 * implementation-defined details. 221 * implementation-defined details.
257 */ 222 */
258 ret = pcmcia_loop_config(link, airo_cs_config_check, req); 223 ret = pcmcia_loop_config(link, airo_cs_config_check, NULL);
259 if (ret) 224 if (ret)
260 goto failed; 225 goto failed;
261 226
@@ -272,7 +237,7 @@ static int airo_config(struct pcmcia_device *link)
272 goto failed; 237 goto failed;
273 ((local_info_t *)link->priv)->eth_dev = 238 ((local_info_t *)link->priv)->eth_dev =
274 init_airo_card(link->irq, 239 init_airo_card(link->irq,
275 link->io.BasePort1, 1, &link->dev); 240 link->resource[0]->start, 1, &link->dev);
276 if (!((local_info_t *)link->priv)->eth_dev) 241 if (!((local_info_t *)link->priv)->eth_dev)
277 goto failed; 242 goto failed;
278 243
@@ -282,22 +247,15 @@ static int airo_config(struct pcmcia_device *link)
282 if (link->conf.Vpp) 247 if (link->conf.Vpp)
283 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); 248 printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10);
284 printk(", irq %d", link->irq); 249 printk(", irq %d", link->irq);
285 if (link->io.NumPorts1) 250 if (link->resource[0])
286 printk(", io 0x%04x-0x%04x", link->io.BasePort1, 251 printk(" & %pR", link->resource[0]);
287 link->io.BasePort1+link->io.NumPorts1-1); 252 if (link->resource[1])
288 if (link->io.NumPorts2) 253 printk(" & %pR", link->resource[1]);
289 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
290 link->io.BasePort2+link->io.NumPorts2-1);
291 if (link->win)
292 printk(", mem 0x%06lx-0x%06lx", req->Base,
293 req->Base+req->Size-1);
294 printk("\n"); 254 printk("\n");
295 kfree(req);
296 return 0; 255 return 0;
297 256
298 failed: 257 failed:
299 airo_release(link); 258 airo_release(link);
300 kfree(req);
301 return -ENODEV; 259 return -ENODEV;
302} /* airo_config */ 260} /* airo_config */
303 261
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
index c2746fc7f2be..3b632161c106 100644
--- a/drivers/net/wireless/atmel_cs.c
+++ b/drivers/net/wireless/atmel_cs.c
@@ -42,7 +42,6 @@
42#include <linux/moduleparam.h> 42#include <linux/moduleparam.h>
43#include <linux/device.h> 43#include <linux/device.h>
44 44
45#include <pcmcia/cs_types.h>
46#include <pcmcia/cs.h> 45#include <pcmcia/cs.h>
47#include <pcmcia/cistpl.h> 46#include <pcmcia/cistpl.h>
48#include <pcmcia/cisreg.h> 47#include <pcmcia/cisreg.h>
@@ -191,25 +190,23 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
191 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 190 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
192 191
193 /* IO window settings */ 192 /* IO window settings */
194 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 193 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
195 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 194 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
196 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 195 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
197 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 196 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
198 if (!(io->flags & CISTPL_IO_8BIT)) 197 p_dev->resource[0]->flags |=
199 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 198 pcmcia_io_cfg_data_width(io->flags);
200 if (!(io->flags & CISTPL_IO_16BIT)) 199 p_dev->resource[0]->start = io->win[0].base;
201 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 200 p_dev->resource[0]->end = io->win[0].len;
202 p_dev->io.BasePort1 = io->win[0].base;
203 p_dev->io.NumPorts1 = io->win[0].len;
204 if (io->nwin > 1) { 201 if (io->nwin > 1) {
205 p_dev->io.Attributes2 = p_dev->io.Attributes1; 202 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
206 p_dev->io.BasePort2 = io->win[1].base; 203 p_dev->resource[1]->start = io->win[1].base;
207 p_dev->io.NumPorts2 = io->win[1].len; 204 p_dev->resource[1]->end = io->win[1].len;
208 } 205 }
209 } 206 }
210 207
211 /* This reserves IO space but doesn't actually enable it */ 208 /* This reserves IO space but doesn't actually enable it */
212 return pcmcia_request_io(p_dev, &p_dev->io); 209 return pcmcia_request_io(p_dev);
213} 210}
214 211
215static int atmel_config(struct pcmcia_device *link) 212static int atmel_config(struct pcmcia_device *link)
@@ -254,7 +251,7 @@ static int atmel_config(struct pcmcia_device *link)
254 251
255 ((local_info_t*)link->priv)->eth_dev = 252 ((local_info_t*)link->priv)->eth_dev =
256 init_atmel_card(link->irq, 253 init_atmel_card(link->irq,
257 link->io.BasePort1, 254 link->resource[0]->start,
258 did ? did->driver_info : ATMEL_FW_TYPE_NONE, 255 did ? did->driver_info : ATMEL_FW_TYPE_NONE,
259 &link->dev, 256 &link->dev,
260 card_present, 257 card_present,
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c
index 0e99b634267c..dfbc41d431ff 100644
--- a/drivers/net/wireless/b43/pcmcia.c
+++ b/drivers/net/wireless/b43/pcmcia.c
@@ -26,7 +26,6 @@
26#include <linux/ssb/ssb.h> 26#include <linux/ssb/ssb.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28 28
29#include <pcmcia/cs_types.h>
30#include <pcmcia/cs.h> 29#include <pcmcia/cs.h>
31#include <pcmcia/cistpl.h> 30#include <pcmcia/cistpl.h>
32#include <pcmcia/ciscode.h> 31#include <pcmcia/ciscode.h>
@@ -65,7 +64,6 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
65{ 64{
66 struct ssb_bus *ssb; 65 struct ssb_bus *ssb;
67 win_req_t win; 66 win_req_t win;
68 memreq_t mem;
69 int err = -ENOMEM; 67 int err = -ENOMEM;
70 int res = 0; 68 int res = 0;
71 69
@@ -78,12 +76,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
78 dev->conf.Attributes = CONF_ENABLE_IRQ; 76 dev->conf.Attributes = CONF_ENABLE_IRQ;
79 dev->conf.IntType = INT_MEMORY_AND_IO; 77 dev->conf.IntType = INT_MEMORY_AND_IO;
80 78
81 dev->io.BasePort2 = 0; 79 win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 |
82 dev->io.NumPorts2 = 0;
83 dev->io.Attributes2 = 0;
84
85 win.Attributes = WIN_ADDR_SPACE_MEM | WIN_MEMORY_TYPE_CM |
86 WIN_ENABLE | WIN_DATA_WIDTH_16 |
87 WIN_USE_WAIT; 80 WIN_USE_WAIT;
88 win.Base = 0; 81 win.Base = 0;
89 win.Size = SSB_CORE_SIZE; 82 win.Size = SSB_CORE_SIZE;
@@ -92,9 +85,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev)
92 if (res != 0) 85 if (res != 0)
93 goto err_kfree_ssb; 86 goto err_kfree_ssb;
94 87
95 mem.CardOffset = 0; 88 res = pcmcia_map_mem_page(dev, dev->win, 0);
96 mem.Page = 0;
97 res = pcmcia_map_mem_page(dev, dev->win, &mem);
98 if (res != 0) 89 if (res != 0)
99 goto err_disable; 90 goto err_disable;
100 91
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 29b31a694b59..ba54d1b04d22 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -12,7 +12,6 @@
12#include <linux/wireless.h> 12#include <linux/wireless.h>
13#include <net/iw_handler.h> 13#include <net/iw_handler.h>
14 14
15#include <pcmcia/cs_types.h>
16#include <pcmcia/cs.h> 15#include <pcmcia/cs.h>
17#include <pcmcia/cistpl.h> 16#include <pcmcia/cistpl.h>
18#include <pcmcia/cisreg.h> 17#include <pcmcia/cisreg.h>
@@ -23,7 +22,7 @@
23#include "hostap_wlan.h" 22#include "hostap_wlan.h"
24 23
25 24
26static dev_info_t dev_info = "hostap_cs"; 25static char *dev_info = "hostap_cs";
27 26
28MODULE_AUTHOR("Jouni Malinen"); 27MODULE_AUTHOR("Jouni Malinen");
29MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " 28MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN "
@@ -225,27 +224,18 @@ static int prism2_pccard_card_present(local_info_t *local)
225static void sandisk_set_iobase(local_info_t *local) 224static void sandisk_set_iobase(local_info_t *local)
226{ 225{
227 int res; 226 int res;
228 conf_reg_t reg;
229 struct hostap_cs_priv *hw_priv = local->hw_priv; 227 struct hostap_cs_priv *hw_priv = local->hw_priv;
230 228
231 reg.Function = 0; 229 res = pcmcia_write_config_byte(hw_priv->link, 0x10,
232 reg.Action = CS_WRITE; 230 hw_priv->link->resource[0]->start & 0x00ff);
233 reg.Offset = 0x10; /* 0x3f0 IO base 1 */
234 reg.Value = hw_priv->link->io.BasePort1 & 0x00ff;
235 res = pcmcia_access_configuration_register(hw_priv->link,
236 &reg);
237 if (res != 0) { 231 if (res != 0) {
238 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" 232 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -"
239 " res=%d\n", res); 233 " res=%d\n", res);
240 } 234 }
241 udelay(10); 235 udelay(10);
242 236
243 reg.Function = 0; 237 res = pcmcia_write_config_byte(hw_priv->link, 0x12,
244 reg.Action = CS_WRITE; 238 (hw_priv->link->resource[0]->start >> 8) & 0x00ff);
245 reg.Offset = 0x12; /* 0x3f2 IO base 2 */
246 reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8;
247 res = pcmcia_access_configuration_register(hw_priv->link,
248 &reg);
249 if (res != 0) { 239 if (res != 0) {
250 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" 240 printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -"
251 " res=%d\n", res); 241 " res=%d\n", res);
@@ -271,12 +261,11 @@ static void sandisk_write_hcr(local_info_t *local, int hcr)
271static int sandisk_enable_wireless(struct net_device *dev) 261static int sandisk_enable_wireless(struct net_device *dev)
272{ 262{
273 int res, ret = 0; 263 int res, ret = 0;
274 conf_reg_t reg;
275 struct hostap_interface *iface = netdev_priv(dev); 264 struct hostap_interface *iface = netdev_priv(dev);
276 local_info_t *local = iface->local; 265 local_info_t *local = iface->local;
277 struct hostap_cs_priv *hw_priv = local->hw_priv; 266 struct hostap_cs_priv *hw_priv = local->hw_priv;
278 267
279 if (hw_priv->link->io.NumPorts1 < 0x42) { 268 if (resource_size(hw_priv->link->resource[0]) < 0x42) {
280 /* Not enough ports to be SanDisk multi-function card */ 269 /* Not enough ports to be SanDisk multi-function card */
281 ret = -ENODEV; 270 ret = -ENODEV;
282 goto done; 271 goto done;
@@ -298,12 +287,8 @@ static int sandisk_enable_wireless(struct net_device *dev)
298 " - using vendor-specific initialization\n", dev->name); 287 " - using vendor-specific initialization\n", dev->name);
299 hw_priv->sandisk_connectplus = 1; 288 hw_priv->sandisk_connectplus = 1;
300 289
301 reg.Function = 0; 290 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
302 reg.Action = CS_WRITE; 291 COR_SOFT_RESET);
303 reg.Offset = CISREG_COR;
304 reg.Value = COR_SOFT_RESET;
305 res = pcmcia_access_configuration_register(hw_priv->link,
306 &reg);
307 if (res != 0) { 292 if (res != 0) {
308 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 293 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
309 dev->name, res); 294 dev->name, res);
@@ -311,16 +296,13 @@ static int sandisk_enable_wireless(struct net_device *dev)
311 } 296 }
312 mdelay(5); 297 mdelay(5);
313 298
314 reg.Function = 0;
315 reg.Action = CS_WRITE;
316 reg.Offset = CISREG_COR;
317 /* 299 /*
318 * Do not enable interrupts here to avoid some bogus events. Interrupts 300 * Do not enable interrupts here to avoid some bogus events. Interrupts
319 * will be enabled during the first cor_sreset call. 301 * will be enabled during the first cor_sreset call.
320 */ 302 */
321 reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; 303 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
322 res = pcmcia_access_configuration_register(hw_priv->link, 304 (COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE |
323 &reg); 305 COR_FUNC_ENA));
324 if (res != 0) { 306 if (res != 0) {
325 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", 307 printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n",
326 dev->name, res); 308 dev->name, res);
@@ -343,30 +325,23 @@ done:
343static void prism2_pccard_cor_sreset(local_info_t *local) 325static void prism2_pccard_cor_sreset(local_info_t *local)
344{ 326{
345 int res; 327 int res;
346 conf_reg_t reg; 328 u8 val;
347 struct hostap_cs_priv *hw_priv = local->hw_priv; 329 struct hostap_cs_priv *hw_priv = local->hw_priv;
348 330
349 if (!prism2_pccard_card_present(local)) 331 if (!prism2_pccard_card_present(local))
350 return; 332 return;
351 333
352 reg.Function = 0; 334 res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &val);
353 reg.Action = CS_READ;
354 reg.Offset = CISREG_COR;
355 reg.Value = 0;
356 res = pcmcia_access_configuration_register(hw_priv->link,
357 &reg);
358 if (res != 0) { 335 if (res != 0) {
359 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", 336 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n",
360 res); 337 res);
361 return; 338 return;
362 } 339 }
363 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n", 340 printk(KERN_DEBUG "prism2_pccard_cor_sreset: original COR %02x\n",
364 reg.Value); 341 val);
365 342
366 reg.Action = CS_WRITE; 343 val |= COR_SOFT_RESET;
367 reg.Value |= COR_SOFT_RESET; 344 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val);
368 res = pcmcia_access_configuration_register(hw_priv->link,
369 &reg);
370 if (res != 0) { 345 if (res != 0) {
371 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", 346 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n",
372 res); 347 res);
@@ -375,11 +350,10 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
375 350
376 mdelay(hw_priv->sandisk_connectplus ? 5 : 2); 351 mdelay(hw_priv->sandisk_connectplus ? 5 : 2);
377 352
378 reg.Value &= ~COR_SOFT_RESET; 353 val &= ~COR_SOFT_RESET;
379 if (hw_priv->sandisk_connectplus) 354 if (hw_priv->sandisk_connectplus)
380 reg.Value |= COR_IREQ_ENA; 355 val |= COR_IREQ_ENA;
381 res = pcmcia_access_configuration_register(hw_priv->link, 356 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR, val);
382 &reg);
383 if (res != 0) { 357 if (res != 0) {
384 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", 358 printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n",
385 res); 359 res);
@@ -396,8 +370,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local)
396static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) 370static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
397{ 371{
398 int res; 372 int res;
399 conf_reg_t reg; 373 u8 old_cor;
400 int old_cor;
401 struct hostap_cs_priv *hw_priv = local->hw_priv; 374 struct hostap_cs_priv *hw_priv = local->hw_priv;
402 375
403 if (!prism2_pccard_card_present(local)) 376 if (!prism2_pccard_card_present(local))
@@ -408,25 +381,17 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
408 return; 381 return;
409 } 382 }
410 383
411 reg.Function = 0; 384 res = pcmcia_read_config_byte(hw_priv->link, CISREG_COR, &old_cor);
412 reg.Action = CS_READ;
413 reg.Offset = CISREG_COR;
414 reg.Value = 0;
415 res = pcmcia_access_configuration_register(hw_priv->link,
416 &reg);
417 if (res != 0) { 385 if (res != 0) {
418 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " 386 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 "
419 "(%d)\n", res); 387 "(%d)\n", res);
420 return; 388 return;
421 } 389 }
422 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n", 390 printk(KERN_DEBUG "prism2_pccard_genesis_sreset: original COR %02x\n",
423 reg.Value); 391 old_cor);
424 old_cor = reg.Value;
425 392
426 reg.Action = CS_WRITE; 393 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
427 reg.Value |= COR_SOFT_RESET; 394 old_cor | COR_SOFT_RESET);
428 res = pcmcia_access_configuration_register(hw_priv->link,
429 &reg);
430 if (res != 0) { 395 if (res != 0) {
431 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " 396 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 "
432 "(%d)\n", res); 397 "(%d)\n", res);
@@ -436,11 +401,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
436 mdelay(10); 401 mdelay(10);
437 402
438 /* Setup Genesis mode */ 403 /* Setup Genesis mode */
439 reg.Action = CS_WRITE; 404 res = pcmcia_write_config_byte(hw_priv->link, CISREG_CCSR, hcr);
440 reg.Value = hcr;
441 reg.Offset = CISREG_CCSR;
442 res = pcmcia_access_configuration_register(hw_priv->link,
443 &reg);
444 if (res != 0) { 405 if (res != 0) {
445 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " 406 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 "
446 "(%d)\n", res); 407 "(%d)\n", res);
@@ -448,11 +409,8 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr)
448 } 409 }
449 mdelay(10); 410 mdelay(10);
450 411
451 reg.Action = CS_WRITE; 412 res = pcmcia_write_config_byte(hw_priv->link, CISREG_COR,
452 reg.Offset = CISREG_COR; 413 old_cor & ~COR_SOFT_RESET);
453 reg.Value = old_cor & ~COR_SOFT_RESET;
454 res = pcmcia_access_configuration_register(hw_priv->link,
455 &reg);
456 if (res != 0) { 414 if (res != 0) {
457 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " 415 printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 "
458 "(%d)\n", res); 416 "(%d)\n", res);
@@ -561,30 +519,24 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
561 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " 519 PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d "
562 "dflt->io.nwin=%d\n", 520 "dflt->io.nwin=%d\n",
563 cfg->io.nwin, dflt->io.nwin); 521 cfg->io.nwin, dflt->io.nwin);
564 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 522 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
565 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 523 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
566 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 524 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
567 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 525 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
568 PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, " 526 p_dev->resource[0]->flags |=
569 "io.base=0x%04x, len=%d\n", io->flags, 527 pcmcia_io_cfg_data_width(io->flags);
570 io->win[0].base, io->win[0].len); 528 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
571 if (!(io->flags & CISTPL_IO_8BIT)) 529 p_dev->resource[0]->start = io->win[0].base;
572 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 530 p_dev->resource[0]->end = io->win[0].len;
573 if (!(io->flags & CISTPL_IO_16BIT))
574 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
575 p_dev->io.IOAddrLines = io->flags &
576 CISTPL_IO_LINES_MASK;
577 p_dev->io.BasePort1 = io->win[0].base;
578 p_dev->io.NumPorts1 = io->win[0].len;
579 if (io->nwin > 1) { 531 if (io->nwin > 1) {
580 p_dev->io.Attributes2 = p_dev->io.Attributes1; 532 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
581 p_dev->io.BasePort2 = io->win[1].base; 533 p_dev->resource[1]->start = io->win[1].base;
582 p_dev->io.NumPorts2 = io->win[1].len; 534 p_dev->resource[1]->end = io->win[1].len;
583 } 535 }
584 } 536 }
585 537
586 /* This reserves IO space but doesn't actually enable it */ 538 /* This reserves IO space but doesn't actually enable it */
587 return pcmcia_request_io(p_dev, &p_dev->io); 539 return pcmcia_request_io(p_dev);
588} 540}
589 541
590static int prism2_config(struct pcmcia_device *link) 542static int prism2_config(struct pcmcia_device *link)
@@ -646,7 +598,7 @@ static int prism2_config(struct pcmcia_device *link)
646 goto failed_unlock; 598 goto failed_unlock;
647 599
648 dev->irq = link->irq; 600 dev->irq = link->irq;
649 dev->base_addr = link->io.BasePort1; 601 dev->base_addr = link->resource[0]->start;
650 602
651 spin_unlock_irqrestore(&local->irq_init_lock, flags); 603 spin_unlock_irqrestore(&local->irq_init_lock, flags);
652 604
@@ -658,12 +610,10 @@ static int prism2_config(struct pcmcia_device *link)
658 link->conf.Vpp % 10); 610 link->conf.Vpp % 10);
659 if (link->conf.Attributes & CONF_ENABLE_IRQ) 611 if (link->conf.Attributes & CONF_ENABLE_IRQ)
660 printk(", irq %d", link->irq); 612 printk(", irq %d", link->irq);
661 if (link->io.NumPorts1) 613 if (link->resource[0])
662 printk(", io 0x%04x-0x%04x", link->io.BasePort1, 614 printk(" & %pR", link->resource[0]);
663 link->io.BasePort1+link->io.NumPorts1-1); 615 if (link->resource[1])
664 if (link->io.NumPorts2) 616 printk(" & %pR", link->resource[1]);
665 printk(" & 0x%04x-0x%04x", link->io.BasePort2,
666 link->io.BasePort2+link->io.NumPorts2-1);
667 printk("\n"); 617 printk("\n");
668 618
669 local->shutdown = 0; 619 local->shutdown = 0;
diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
index 51a96f5a342d..3e82f1627209 100644
--- a/drivers/net/wireless/libertas/cfg.c
+++ b/drivers/net/wireless/libertas/cfg.c
@@ -6,6 +6,8 @@
6 * 6 *
7 */ 7 */
8 8
9#include <linux/sched.h>
10#include <linux/wait.h>
9#include <linux/slab.h> 11#include <linux/slab.h>
10#include <linux/sched.h> 12#include <linux/sched.h>
11#include <linux/ieee80211.h> 13#include <linux/ieee80211.h>
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c
index 08e4e3908003..9c298396be50 100644
--- a/drivers/net/wireless/libertas/if_cs.c
+++ b/drivers/net/wireless/libertas/if_cs.c
@@ -28,7 +28,6 @@
28#include <linux/firmware.h> 28#include <linux/firmware.h>
29#include <linux/netdevice.h> 29#include <linux/netdevice.h>
30 30
31#include <pcmcia/cs_types.h>
32#include <pcmcia/cs.h> 31#include <pcmcia/cs.h>
33#include <pcmcia/cistpl.h> 32#include <pcmcia/cistpl.h>
34#include <pcmcia/ds.h> 33#include <pcmcia/ds.h>
@@ -802,9 +801,9 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev,
802 unsigned int vcc, 801 unsigned int vcc,
803 void *priv_data) 802 void *priv_data)
804{ 803{
805 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 804 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
806 p_dev->io.BasePort1 = cfg->io.win[0].base; 805 p_dev->resource[0]->start = cfg->io.win[0].base;
807 p_dev->io.NumPorts1 = cfg->io.win[0].len; 806 p_dev->resource[0]->end = cfg->io.win[0].len;
808 807
809 /* Do we need to allocate an interrupt? */ 808 /* Do we need to allocate an interrupt? */
810 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 809 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
@@ -816,7 +815,7 @@ static int if_cs_ioprobe(struct pcmcia_device *p_dev,
816 } 815 }
817 816
818 /* This reserves IO space but doesn't actually enable it */ 817 /* This reserves IO space but doesn't actually enable it */
819 return pcmcia_request_io(p_dev, &p_dev->io); 818 return pcmcia_request_io(p_dev);
820} 819}
821 820
822static int if_cs_probe(struct pcmcia_device *p_dev) 821static int if_cs_probe(struct pcmcia_device *p_dev)
@@ -854,7 +853,8 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
854 goto out1; 853 goto out1;
855 854
856 /* Initialize io access */ 855 /* Initialize io access */
857 card->iobase = ioport_map(p_dev->io.BasePort1, p_dev->io.NumPorts1); 856 card->iobase = ioport_map(p_dev->resource[0]->start,
857 resource_size(p_dev->resource[0]));
858 if (!card->iobase) { 858 if (!card->iobase) {
859 lbs_pr_err("error in ioport_map\n"); 859 lbs_pr_err("error in ioport_map\n");
860 ret = -EIO; 860 ret = -EIO;
@@ -873,9 +873,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev)
873 } 873 }
874 874
875 /* Finally, report what we've done */ 875 /* Finally, report what we've done */
876 lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n", 876 lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]);
877 p_dev->irq, p_dev->io.BasePort1,
878 p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1);
879 877
880 /* 878 /*
881 * Most of the libertas cards can do unaligned register access, but some 879 * Most of the libertas cards can do unaligned register access, but some
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c
index 382f2371a1ab..87b634978b35 100644
--- a/drivers/net/wireless/libertas/if_sdio.c
+++ b/drivers/net/wireless/libertas/if_sdio.c
@@ -125,6 +125,8 @@ struct if_sdio_card {
125 125
126 const char *helper; 126 const char *helper;
127 const char *firmware; 127 const char *firmware;
128 bool helper_allocated;
129 bool firmware_allocated;
128 130
129 u8 buffer[65536] __attribute__((aligned(4))); 131 u8 buffer[65536] __attribute__((aligned(4)));
130 132
@@ -984,16 +986,34 @@ static int if_sdio_probe(struct sdio_func *func,
984 card->helper = if_sdio_models[i].helper; 986 card->helper = if_sdio_models[i].helper;
985 card->firmware = if_sdio_models[i].firmware; 987 card->firmware = if_sdio_models[i].firmware;
986 988
989 kparam_block_sysfs_write(helper_name);
987 if (lbs_helper_name) { 990 if (lbs_helper_name) {
991 char *helper = kstrdup(lbs_helper_name, GFP_KERNEL);
992 if (!helper) {
993 kparam_unblock_sysfs_write(helper_name);
994 ret = -ENOMEM;
995 goto free;
996 }
988 lbs_deb_sdio("overriding helper firmware: %s\n", 997 lbs_deb_sdio("overriding helper firmware: %s\n",
989 lbs_helper_name); 998 lbs_helper_name);
990 card->helper = lbs_helper_name; 999 card->helper = helper;
1000 card->helper_allocated = true;
991 } 1001 }
1002 kparam_unblock_sysfs_write(helper_name);
992 1003
1004 kparam_block_sysfs_write(fw_name);
993 if (lbs_fw_name) { 1005 if (lbs_fw_name) {
1006 char *fw_name = kstrdup(lbs_fw_name, GFP_KERNEL);
1007 if (!fw_name) {
1008 kparam_unblock_sysfs_write(fw_name);
1009 ret = -ENOMEM;
1010 goto free;
1011 }
994 lbs_deb_sdio("overriding firmware: %s\n", lbs_fw_name); 1012 lbs_deb_sdio("overriding firmware: %s\n", lbs_fw_name);
995 card->firmware = lbs_fw_name; 1013 card->firmware = fw_name;
1014 card->firmware_allocated = true;
996 } 1015 }
1016 kparam_unblock_sysfs_write(fw_name);
997 1017
998 sdio_claim_host(func); 1018 sdio_claim_host(func);
999 1019
@@ -1127,6 +1147,10 @@ free:
1127 kfree(packet); 1147 kfree(packet);
1128 } 1148 }
1129 1149
1150 if (card->helper_allocated)
1151 kfree(card->helper);
1152 if (card->firmware_allocated)
1153 kfree(card->firmware);
1130 kfree(card); 1154 kfree(card);
1131 1155
1132 goto out; 1156 goto out;
@@ -1177,6 +1201,10 @@ static void if_sdio_remove(struct sdio_func *func)
1177 kfree(packet); 1201 kfree(packet);
1178 } 1202 }
1179 1203
1204 if (card->helper_allocated)
1205 kfree(card->helper);
1206 if (card->firmware_allocated)
1207 kfree(card->firmware);
1180 kfree(card); 1208 kfree(card);
1181 1209
1182 lbs_deb_leave(LBS_DEB_SDIO); 1210 lbs_deb_leave(LBS_DEB_SDIO);
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 07ece9d26c63..3ff61063671a 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -289,10 +289,13 @@ static int if_usb_probe(struct usb_interface *intf,
289 } 289 }
290 290
291 /* Upload firmware */ 291 /* Upload firmware */
292 kparam_block_sysfs_write(fw_name);
292 if (__if_usb_prog_firmware(cardp, lbs_fw_name, BOOT_CMD_FW_BY_USB)) { 293 if (__if_usb_prog_firmware(cardp, lbs_fw_name, BOOT_CMD_FW_BY_USB)) {
294 kparam_unblock_sysfs_write(fw_name);
293 lbs_deb_usbd(&udev->dev, "FW upload failed\n"); 295 lbs_deb_usbd(&udev->dev, "FW upload failed\n");
294 goto err_prog_firmware; 296 goto err_prog_firmware;
295 } 297 }
298 kparam_unblock_sysfs_write(fw_name);
296 299
297 if (!(priv = lbs_add_card(cardp, &udev->dev))) 300 if (!(priv = lbs_add_card(cardp, &udev->dev)))
298 goto err_prog_firmware; 301 goto err_prog_firmware;
diff --git a/drivers/net/wireless/libertas_tf/if_usb.c b/drivers/net/wireless/libertas_tf/if_usb.c
index b172f5d87a3b..41a4f214ade1 100644
--- a/drivers/net/wireless/libertas_tf/if_usb.c
+++ b/drivers/net/wireless/libertas_tf/if_usb.c
@@ -811,12 +811,15 @@ static int if_usb_prog_firmware(struct if_usb_card *cardp)
811 811
812 lbtf_deb_enter(LBTF_DEB_USB); 812 lbtf_deb_enter(LBTF_DEB_USB);
813 813
814 kparam_block_sysfs_write(fw_name);
814 ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev); 815 ret = request_firmware(&cardp->fw, lbtf_fw_name, &cardp->udev->dev);
815 if (ret < 0) { 816 if (ret < 0) {
816 pr_err("request_firmware() failed with %#x\n", ret); 817 pr_err("request_firmware() failed with %#x\n", ret);
817 pr_err("firmware %s not found\n", lbtf_fw_name); 818 pr_err("firmware %s not found\n", lbtf_fw_name);
819 kparam_unblock_sysfs_write(fw_name);
818 goto done; 820 goto done;
819 } 821 }
822 kparam_unblock_sysfs_write(fw_name);
820 823
821 if (check_fwfile_format(cardp->fw->data, cardp->fw->size)) 824 if (check_fwfile_format(cardp->fw->data, cardp->fw->size))
822 goto release_fw; 825 goto release_fw;
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c
index b16d5db52a4d..ef46a2d88539 100644
--- a/drivers/net/wireless/orinoco/orinoco_cs.c
+++ b/drivers/net/wireless/orinoco/orinoco_cs.c
@@ -17,7 +17,6 @@
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <pcmcia/cs_types.h>
21#include <pcmcia/cs.h> 20#include <pcmcia/cs.h>
22#include <pcmcia/cistpl.h> 21#include <pcmcia/cistpl.h>
23#include <pcmcia/cisreg.h> 22#include <pcmcia/cisreg.h>
@@ -192,25 +191,23 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
192 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 191 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
193 192
194 /* IO window settings */ 193 /* IO window settings */
195 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 194 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
196 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 195 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
197 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 196 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
198 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 197 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
199 if (!(io->flags & CISTPL_IO_8BIT)) 198 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
200 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 199 p_dev->resource[0]->flags |=
201 if (!(io->flags & CISTPL_IO_16BIT)) 200 pcmcia_io_cfg_data_width(io->flags);
202 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 201 p_dev->resource[0]->start = io->win[0].base;
203 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 202 p_dev->resource[0]->end = io->win[0].len;
204 p_dev->io.BasePort1 = io->win[0].base;
205 p_dev->io.NumPorts1 = io->win[0].len;
206 if (io->nwin > 1) { 203 if (io->nwin > 1) {
207 p_dev->io.Attributes2 = p_dev->io.Attributes1; 204 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
208 p_dev->io.BasePort2 = io->win[1].base; 205 p_dev->resource[1]->start = io->win[1].base;
209 p_dev->io.NumPorts2 = io->win[1].len; 206 p_dev->resource[1]->end = io->win[1].len;
210 } 207 }
211 208
212 /* This reserves IO space but doesn't actually enable it */ 209 /* This reserves IO space but doesn't actually enable it */
213 if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 210 if (pcmcia_request_io(p_dev) != 0)
214 goto next_entry; 211 goto next_entry;
215 } 212 }
216 return 0; 213 return 0;
@@ -258,7 +255,8 @@ orinoco_cs_config(struct pcmcia_device *link)
258 /* We initialize the hermes structure before completing PCMCIA 255 /* We initialize the hermes structure before completing PCMCIA
259 * configuration just in case the interrupt handler gets 256 * configuration just in case the interrupt handler gets
260 * called. */ 257 * called. */
261 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); 258 mem = ioport_map(link->resource[0]->start,
259 resource_size(link->resource[0]));
262 if (!mem) 260 if (!mem)
263 goto failed; 261 goto failed;
264 262
@@ -280,7 +278,7 @@ orinoco_cs_config(struct pcmcia_device *link)
280 } 278 }
281 279
282 /* Register an interface with the stack */ 280 /* Register an interface with the stack */
283 if (orinoco_if_add(priv, link->io.BasePort1, 281 if (orinoco_if_add(priv, link->resource[0]->start,
284 link->irq, NULL) != 0) { 282 link->irq, NULL) != 0) {
285 printk(KERN_ERR PFX "orinoco_if_add() failed\n"); 283 printk(KERN_ERR PFX "orinoco_if_add() failed\n");
286 goto failed; 284 goto failed;
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c
index b51a9adc80f6..873877e17e1b 100644
--- a/drivers/net/wireless/orinoco/spectrum_cs.c
+++ b/drivers/net/wireless/orinoco/spectrum_cs.c
@@ -25,7 +25,6 @@
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <pcmcia/cs_types.h>
29#include <pcmcia/cs.h> 28#include <pcmcia/cs.h>
30#include <pcmcia/cistpl.h> 29#include <pcmcia/cistpl.h>
31#include <pcmcia/cisreg.h> 30#include <pcmcia/cisreg.h>
@@ -80,35 +79,27 @@ static int
80spectrum_reset(struct pcmcia_device *link, int idle) 79spectrum_reset(struct pcmcia_device *link, int idle)
81{ 80{
82 int ret; 81 int ret;
83 conf_reg_t reg; 82 u8 save_cor;
84 u_int save_cor; 83 u8 ccsr;
85 84
86 /* Doing it if hardware is gone is guaranteed crash */ 85 /* Doing it if hardware is gone is guaranteed crash */
87 if (!pcmcia_dev_present(link)) 86 if (!pcmcia_dev_present(link))
88 return -ENODEV; 87 return -ENODEV;
89 88
90 /* Save original COR value */ 89 /* Save original COR value */
91 reg.Function = 0; 90 ret = pcmcia_read_config_byte(link, CISREG_COR, &save_cor);
92 reg.Action = CS_READ;
93 reg.Offset = CISREG_COR;
94 ret = pcmcia_access_configuration_register(link, &reg);
95 if (ret) 91 if (ret)
96 goto failed; 92 goto failed;
97 save_cor = reg.Value;
98 93
99 /* Soft-Reset card */ 94 /* Soft-Reset card */
100 reg.Action = CS_WRITE; 95 ret = pcmcia_write_config_byte(link, CISREG_COR,
101 reg.Offset = CISREG_COR; 96 (save_cor | COR_SOFT_RESET));
102 reg.Value = (save_cor | COR_SOFT_RESET);
103 ret = pcmcia_access_configuration_register(link, &reg);
104 if (ret) 97 if (ret)
105 goto failed; 98 goto failed;
106 udelay(1000); 99 udelay(1000);
107 100
108 /* Read CCSR */ 101 /* Read CCSR */
109 reg.Action = CS_READ; 102 ret = pcmcia_read_config_byte(link, CISREG_CCSR, &ccsr);
110 reg.Offset = CISREG_CCSR;
111 ret = pcmcia_access_configuration_register(link, &reg);
112 if (ret) 103 if (ret)
113 goto failed; 104 goto failed;
114 105
@@ -116,19 +107,15 @@ spectrum_reset(struct pcmcia_device *link, int idle)
116 * Start or stop the firmware. Memory width bit should be 107 * Start or stop the firmware. Memory width bit should be
117 * preserved from the value we've just read. 108 * preserved from the value we've just read.
118 */ 109 */
119 reg.Action = CS_WRITE; 110 ccsr = (idle ? HCR_IDLE : HCR_RUN) | (ccsr & HCR_MEM16);
120 reg.Offset = CISREG_CCSR; 111 ret = pcmcia_write_config_byte(link, CISREG_CCSR, ccsr);
121 reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16);
122 ret = pcmcia_access_configuration_register(link, &reg);
123 if (ret) 112 if (ret)
124 goto failed; 113 goto failed;
125 udelay(1000); 114 udelay(1000);
126 115
127 /* Restore original COR configuration index */ 116 /* Restore original COR configuration index */
128 reg.Action = CS_WRITE; 117 ret = pcmcia_write_config_byte(link, CISREG_COR,
129 reg.Offset = CISREG_COR; 118 (save_cor & ~COR_SOFT_RESET));
130 reg.Value = (save_cor & ~COR_SOFT_RESET);
131 ret = pcmcia_access_configuration_register(link, &reg);
132 if (ret) 119 if (ret)
133 goto failed; 120 goto failed;
134 udelay(1000); 121 udelay(1000);
@@ -266,25 +253,23 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev,
266 p_dev->conf.Attributes |= CONF_ENABLE_IRQ; 253 p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
267 254
268 /* IO window settings */ 255 /* IO window settings */
269 p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; 256 p_dev->resource[0]->end = p_dev->resource[1]->end = 0;
270 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { 257 if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) {
271 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; 258 cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io;
272 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 259 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
273 if (!(io->flags & CISTPL_IO_8BIT)) 260 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
274 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; 261 p_dev->resource[0]->flags |=
275 if (!(io->flags & CISTPL_IO_16BIT)) 262 pcmcia_io_cfg_data_width(io->flags);
276 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 263 p_dev->resource[0]->start = io->win[0].base;
277 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 264 p_dev->resource[0]->end = io->win[0].len;
278 p_dev->io.BasePort1 = io->win[0].base;
279 p_dev->io.NumPorts1 = io->win[0].len;
280 if (io->nwin > 1) { 265 if (io->nwin > 1) {
281 p_dev->io.Attributes2 = p_dev->io.Attributes1; 266 p_dev->resource[1]->flags = p_dev->resource[0]->flags;
282 p_dev->io.BasePort2 = io->win[1].base; 267 p_dev->resource[1]->start = io->win[1].base;
283 p_dev->io.NumPorts2 = io->win[1].len; 268 p_dev->resource[1]->end = io->win[1].len;
284 } 269 }
285 270
286 /* This reserves IO space but doesn't actually enable it */ 271 /* This reserves IO space but doesn't actually enable it */
287 if (pcmcia_request_io(p_dev, &p_dev->io) != 0) 272 if (pcmcia_request_io(p_dev) != 0)
288 goto next_entry; 273 goto next_entry;
289 } 274 }
290 return 0; 275 return 0;
@@ -332,7 +317,8 @@ spectrum_cs_config(struct pcmcia_device *link)
332 /* We initialize the hermes structure before completing PCMCIA 317 /* We initialize the hermes structure before completing PCMCIA
333 * configuration just in case the interrupt handler gets 318 * configuration just in case the interrupt handler gets
334 * called. */ 319 * called. */
335 mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); 320 mem = ioport_map(link->resource[0]->start,
321 resource_size(link->resource[0]));
336 if (!mem) 322 if (!mem)
337 goto failed; 323 goto failed;
338 324
@@ -359,7 +345,7 @@ spectrum_cs_config(struct pcmcia_device *link)
359 } 345 }
360 346
361 /* Register an interface with the stack */ 347 /* Register an interface with the stack */
362 if (orinoco_if_add(priv, link->io.BasePort1, 348 if (orinoco_if_add(priv, link->resource[0]->start,
363 link->irq, NULL) != 0) { 349 link->irq, NULL) != 0) {
364 printk(KERN_ERR PFX "orinoco_if_add() failed\n"); 350 printk(KERN_ERR PFX "orinoco_if_add() failed\n");
365 goto failed; 351 goto failed;
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 9c38fc331dca..88560d0ae50a 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -46,7 +46,6 @@
46#include <linux/ethtool.h> 46#include <linux/ethtool.h>
47#include <linux/ieee80211.h> 47#include <linux/ieee80211.h>
48 48
49#include <pcmcia/cs_types.h>
50#include <pcmcia/cs.h> 49#include <pcmcia/cs.h>
51#include <pcmcia/cistpl.h> 50#include <pcmcia/cistpl.h>
52#include <pcmcia/cisreg.h> 51#include <pcmcia/cisreg.h>
@@ -315,9 +314,8 @@ static int ray_probe(struct pcmcia_device *p_dev)
315 local->finder = p_dev; 314 local->finder = p_dev;
316 315
317 /* The io structure describes IO port mapping. None used here */ 316 /* The io structure describes IO port mapping. None used here */
318 p_dev->io.NumPorts1 = 0; 317 p_dev->resource[0]->end = 0;
319 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 318 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
320 p_dev->io.IOAddrLines = 5;
321 319
322 /* General socket configuration */ 320 /* General socket configuration */
323 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 321 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
@@ -394,7 +392,6 @@ static int ray_config(struct pcmcia_device *link)
394 int ret = 0; 392 int ret = 0;
395 int i; 393 int i;
396 win_req_t req; 394 win_req_t req;
397 memreq_t mem;
398 struct net_device *dev = (struct net_device *)link->priv; 395 struct net_device *dev = (struct net_device *)link->priv;
399 ray_dev_t *local = netdev_priv(dev); 396 ray_dev_t *local = netdev_priv(dev);
400 397
@@ -431,9 +428,7 @@ static int ray_config(struct pcmcia_device *link)
431 ret = pcmcia_request_window(link, &req, &link->win); 428 ret = pcmcia_request_window(link, &req, &link->win);
432 if (ret) 429 if (ret)
433 goto failed; 430 goto failed;
434 mem.CardOffset = 0x0000; 431 ret = pcmcia_map_mem_page(link, link->win, 0);
435 mem.Page = 0;
436 ret = pcmcia_map_mem_page(link, link->win, &mem);
437 if (ret) 432 if (ret)
438 goto failed; 433 goto failed;
439 local->sram = ioremap(req.Base, req.Size); 434 local->sram = ioremap(req.Base, req.Size);
@@ -447,9 +442,7 @@ static int ray_config(struct pcmcia_device *link)
447 ret = pcmcia_request_window(link, &req, &local->rmem_handle); 442 ret = pcmcia_request_window(link, &req, &local->rmem_handle);
448 if (ret) 443 if (ret)
449 goto failed; 444 goto failed;
450 mem.CardOffset = 0x8000; 445 ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000);
451 mem.Page = 0;
452 ret = pcmcia_map_mem_page(link, local->rmem_handle, &mem);
453 if (ret) 446 if (ret)
454 goto failed; 447 goto failed;
455 local->rmem = ioremap(req.Base, req.Size); 448 local->rmem = ioremap(req.Base, req.Size);
@@ -463,9 +456,7 @@ static int ray_config(struct pcmcia_device *link)
463 ret = pcmcia_request_window(link, &req, &local->amem_handle); 456 ret = pcmcia_request_window(link, &req, &local->amem_handle);
464 if (ret) 457 if (ret)
465 goto failed; 458 goto failed;
466 mem.CardOffset = 0x0000; 459 ret = pcmcia_map_mem_page(link, local->amem_handle, 0);
467 mem.Page = 0;
468 ret = pcmcia_map_mem_page(link, local->amem_handle, &mem);
469 if (ret) 460 if (ret)
470 goto failed; 461 goto failed;
471 local->amem = ioremap(req.Base, req.Size); 462 local->amem = ioremap(req.Base, req.Size);
@@ -793,7 +784,6 @@ static void ray_release(struct pcmcia_device *link)
793{ 784{
794 struct net_device *dev = link->priv; 785 struct net_device *dev = link->priv;
795 ray_dev_t *local = netdev_priv(dev); 786 ray_dev_t *local = netdev_priv(dev);
796 int i;
797 787
798 dev_dbg(&link->dev, "ray_release\n"); 788 dev_dbg(&link->dev, "ray_release\n");
799 789
@@ -802,13 +792,6 @@ static void ray_release(struct pcmcia_device *link)
802 iounmap(local->sram); 792 iounmap(local->sram);
803 iounmap(local->rmem); 793 iounmap(local->rmem);
804 iounmap(local->amem); 794 iounmap(local->amem);
805 /* Do bother checking to see if these succeed or not */
806 i = pcmcia_release_window(link, local->amem_handle);
807 if (i != 0)
808 dev_dbg(&link->dev, "ReleaseWindow(local->amem) ret = %x\n", i);
809 i = pcmcia_release_window(link, local->rmem_handle);
810 if (i != 0)
811 dev_dbg(&link->dev, "ReleaseWindow(local->rmem) ret = %x\n", i);
812 pcmcia_disable_device(link); 795 pcmcia_disable_device(link);
813 796
814 dev_dbg(&link->dev, "ray_release ending\n"); 797 dev_dbg(&link->dev, "ray_release ending\n");
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index 376c6b964a9c..a1cc2d498a1c 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -48,7 +48,6 @@
48 48
49#include <net/iw_handler.h> 49#include <net/iw_handler.h>
50 50
51#include <pcmcia/cs_types.h>
52#include <pcmcia/cs.h> 51#include <pcmcia/cs.h>
53#include <pcmcia/cistpl.h> 52#include <pcmcia/cistpl.h>
54#include <pcmcia/cisreg.h> 53#include <pcmcia/cisreg.h>
@@ -89,13 +88,6 @@
89static int wl3501_config(struct pcmcia_device *link); 88static int wl3501_config(struct pcmcia_device *link);
90static void wl3501_release(struct pcmcia_device *link); 89static void wl3501_release(struct pcmcia_device *link);
91 90
92/*
93 * The dev_info variable is the "key" that is used to match up this
94 * device driver with appropriate cards, through the card configuration
95 * database.
96 */
97static dev_info_t wl3501_dev_info = "wl3501_cs";
98
99static const struct { 91static const struct {
100 int reg_domain; 92 int reg_domain;
101 int min, max, deflt; 93 int min, max, deflt;
@@ -1421,7 +1413,7 @@ static struct iw_statistics *wl3501_get_wireless_stats(struct net_device *dev)
1421 1413
1422static void wl3501_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) 1414static void wl3501_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1423{ 1415{
1424 strlcpy(info->driver, wl3501_dev_info, sizeof(info->driver)); 1416 strlcpy(info->driver, "wl3501_cs", sizeof(info->driver));
1425} 1417}
1426 1418
1427static const struct ethtool_ops ops = { 1419static const struct ethtool_ops ops = {
@@ -1892,9 +1884,8 @@ static int wl3501_probe(struct pcmcia_device *p_dev)
1892 struct wl3501_card *this; 1884 struct wl3501_card *this;
1893 1885
1894 /* The io structure describes IO port mapping */ 1886 /* The io structure describes IO port mapping */
1895 p_dev->io.NumPorts1 = 16; 1887 p_dev->resource[0]->end = 16;
1896 p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 1888 p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8;
1897 p_dev->io.IOAddrLines = 5;
1898 1889
1899 /* General socket configuration */ 1890 /* General socket configuration */
1900 p_dev->conf.Attributes = CONF_ENABLE_IRQ; 1891 p_dev->conf.Attributes = CONF_ENABLE_IRQ;
@@ -1940,13 +1931,14 @@ static int wl3501_config(struct pcmcia_device *link)
1940 /* Try allocating IO ports. This tries a few fixed addresses. If you 1931 /* Try allocating IO ports. This tries a few fixed addresses. If you
1941 * want, you can also read the card's config table to pick addresses -- 1932 * want, you can also read the card's config table to pick addresses --
1942 * see the serial driver for an example. */ 1933 * see the serial driver for an example. */
1934 link->io_lines = 5;
1943 1935
1944 for (j = 0x280; j < 0x400; j += 0x20) { 1936 for (j = 0x280; j < 0x400; j += 0x20) {
1945 /* The '^0x300' is so that we probe 0x300-0x3ff first, then 1937 /* The '^0x300' is so that we probe 0x300-0x3ff first, then
1946 * 0x200-0x2ff, and so on, because this seems safer */ 1938 * 0x200-0x2ff, and so on, because this seems safer */
1947 link->io.BasePort1 = j; 1939 link->resource[0]->start = j;
1948 link->io.BasePort2 = link->io.BasePort1 + 0x10; 1940 link->resource[1]->start = link->resource[0]->start + 0x10;
1949 i = pcmcia_request_io(link, &link->io); 1941 i = pcmcia_request_io(link);
1950 if (i == 0) 1942 if (i == 0)
1951 break; 1943 break;
1952 } 1944 }
@@ -1968,7 +1960,7 @@ static int wl3501_config(struct pcmcia_device *link)
1968 goto failed; 1960 goto failed;
1969 1961
1970 dev->irq = link->irq; 1962 dev->irq = link->irq;
1971 dev->base_addr = link->io.BasePort1; 1963 dev->base_addr = link->resource[0]->start;
1972 SET_NETDEV_DEV(dev, &link->dev); 1964 SET_NETDEV_DEV(dev, &link->dev);
1973 if (register_netdev(dev)) { 1965 if (register_netdev(dev)) {
1974 printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); 1966 printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n");
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index d04c5b262050..ecbbb688eba0 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -20,7 +20,7 @@
20#include <linux/skbuff.h> 20#include <linux/skbuff.h>
21#include <linux/io.h> 21#include <linux/io.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23 23#include <linux/of_address.h>
24#include <linux/of_device.h> 24#include <linux/of_device.h>
25#include <linux/of_platform.h> 25#include <linux/of_platform.h>
26#include <linux/of_mdio.h> 26#include <linux/of_mdio.h>
@@ -1086,7 +1086,7 @@ static void xemaclite_remove_ndev(struct net_device *ndev)
1086 * 1086 *
1087 * Return: Value of the parameter if the parameter is found, or 0 otherwise 1087 * Return: Value of the parameter if the parameter is found, or 0 otherwise
1088 */ 1088 */
1089static bool get_bool(struct of_device *ofdev, const char *s) 1089static bool get_bool(struct platform_device *ofdev, const char *s)
1090{ 1090{
1091 u32 *p = (u32 *)of_get_property(ofdev->dev.of_node, s, NULL); 1091 u32 *p = (u32 *)of_get_property(ofdev->dev.of_node, s, NULL);
1092 1092
@@ -1115,7 +1115,7 @@ static struct net_device_ops xemaclite_netdev_ops;
1115 * Return: 0, if the driver is bound to the Emaclite device, or 1115 * Return: 0, if the driver is bound to the Emaclite device, or
1116 * a negative error if there is failure. 1116 * a negative error if there is failure.
1117 */ 1117 */
1118static int __devinit xemaclite_of_probe(struct of_device *ofdev, 1118static int __devinit xemaclite_of_probe(struct platform_device *ofdev,
1119 const struct of_device_id *match) 1119 const struct of_device_id *match)
1120{ 1120{
1121 struct resource r_irq; /* Interrupt resources */ 1121 struct resource r_irq; /* Interrupt resources */
@@ -1240,7 +1240,7 @@ error2:
1240 * 1240 *
1241 * Return: 0, always. 1241 * Return: 0, always.
1242 */ 1242 */
1243static int __devexit xemaclite_of_remove(struct of_device *of_dev) 1243static int __devexit xemaclite_of_remove(struct platform_device *of_dev)
1244{ 1244{
1245 struct device *dev = &of_dev->dev; 1245 struct device *dev = &of_dev->dev;
1246 struct net_device *ndev = dev_get_drvdata(dev); 1246 struct net_device *ndev = dev_get_drvdata(dev);