diff options
Diffstat (limited to 'drivers/net')
124 files changed, 2915 insertions, 1081 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index c754d88e5ec9..179871d9e71f 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -633,7 +633,11 @@ struct vortex_private { | |||
633 | open:1, | 633 | open:1, |
634 | medialock:1, | 634 | medialock:1, |
635 | must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ | 635 | must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ |
636 | large_frames:1; /* accept large frames */ | 636 | large_frames:1, /* accept large frames */ |
637 | handling_irq:1; /* private in_irq indicator */ | ||
638 | /* {get|set}_wol operations are already serialized by rtnl. | ||
639 | * no additional locking is required for the enable_wol and acpi_set_WOL() | ||
640 | */ | ||
637 | int drv_flags; | 641 | int drv_flags; |
638 | u16 status_enable; | 642 | u16 status_enable; |
639 | u16 intr_enable; | 643 | u16 intr_enable; |
@@ -646,7 +650,7 @@ struct vortex_private { | |||
646 | u16 io_size; /* Size of PCI region (for release_region) */ | 650 | u16 io_size; /* Size of PCI region (for release_region) */ |
647 | 651 | ||
648 | /* Serialises access to hardware other than MII and variables below. | 652 | /* Serialises access to hardware other than MII and variables below. |
649 | * The lock hierarchy is rtnl_lock > lock > mii_lock > window_lock. */ | 653 | * The lock hierarchy is rtnl_lock > {lock, mii_lock} > window_lock. */ |
650 | spinlock_t lock; | 654 | spinlock_t lock; |
651 | 655 | ||
652 | spinlock_t mii_lock; /* Serialises access to MII */ | 656 | spinlock_t mii_lock; /* Serialises access to MII */ |
@@ -1993,10 +1997,9 @@ vortex_error(struct net_device *dev, int status) | |||
1993 | } | 1997 | } |
1994 | } | 1998 | } |
1995 | 1999 | ||
1996 | if (status & RxEarly) { /* Rx early is unused. */ | 2000 | if (status & RxEarly) /* Rx early is unused. */ |
1997 | vortex_rx(dev); | ||
1998 | iowrite16(AckIntr | RxEarly, ioaddr + EL3_CMD); | 2001 | iowrite16(AckIntr | RxEarly, ioaddr + EL3_CMD); |
1999 | } | 2002 | |
2000 | if (status & StatsFull) { /* Empty statistics. */ | 2003 | if (status & StatsFull) { /* Empty statistics. */ |
2001 | static int DoneDidThat; | 2004 | static int DoneDidThat; |
2002 | if (vortex_debug > 4) | 2005 | if (vortex_debug > 4) |
@@ -2133,6 +2136,15 @@ boomerang_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2133 | dev->name, vp->cur_tx); | 2136 | dev->name, vp->cur_tx); |
2134 | } | 2137 | } |
2135 | 2138 | ||
2139 | /* | ||
2140 | * We can't allow a recursion from our interrupt handler back into the | ||
2141 | * tx routine, as they take the same spin lock, and that causes | ||
2142 | * deadlock. Just return NETDEV_TX_BUSY and let the stack try again in | ||
2143 | * a bit | ||
2144 | */ | ||
2145 | if (vp->handling_irq) | ||
2146 | return NETDEV_TX_BUSY; | ||
2147 | |||
2136 | if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) { | 2148 | if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) { |
2137 | if (vortex_debug > 0) | 2149 | if (vortex_debug > 0) |
2138 | pr_warning("%s: BUG! Tx Ring full, refusing to send buffer.\n", | 2150 | pr_warning("%s: BUG! Tx Ring full, refusing to send buffer.\n", |
@@ -2288,7 +2300,12 @@ vortex_interrupt(int irq, void *dev_id) | |||
2288 | if (status & (HostError | RxEarly | StatsFull | TxComplete | IntReq)) { | 2300 | if (status & (HostError | RxEarly | StatsFull | TxComplete | IntReq)) { |
2289 | if (status == 0xffff) | 2301 | if (status == 0xffff) |
2290 | break; | 2302 | break; |
2303 | if (status & RxEarly) | ||
2304 | vortex_rx(dev); | ||
2305 | spin_unlock(&vp->window_lock); | ||
2291 | vortex_error(dev, status); | 2306 | vortex_error(dev, status); |
2307 | spin_lock(&vp->window_lock); | ||
2308 | window_set(vp, 7); | ||
2292 | } | 2309 | } |
2293 | 2310 | ||
2294 | if (--work_done < 0) { | 2311 | if (--work_done < 0) { |
@@ -2335,11 +2352,13 @@ boomerang_interrupt(int irq, void *dev_id) | |||
2335 | 2352 | ||
2336 | ioaddr = vp->ioaddr; | 2353 | ioaddr = vp->ioaddr; |
2337 | 2354 | ||
2355 | |||
2338 | /* | 2356 | /* |
2339 | * It seems dopey to put the spinlock this early, but we could race against vortex_tx_timeout | 2357 | * It seems dopey to put the spinlock this early, but we could race against vortex_tx_timeout |
2340 | * and boomerang_start_xmit | 2358 | * and boomerang_start_xmit |
2341 | */ | 2359 | */ |
2342 | spin_lock(&vp->lock); | 2360 | spin_lock(&vp->lock); |
2361 | vp->handling_irq = 1; | ||
2343 | 2362 | ||
2344 | status = ioread16(ioaddr + EL3_STATUS); | 2363 | status = ioread16(ioaddr + EL3_STATUS); |
2345 | 2364 | ||
@@ -2447,6 +2466,7 @@ boomerang_interrupt(int irq, void *dev_id) | |||
2447 | pr_debug("%s: exiting interrupt, status %4.4x.\n", | 2466 | pr_debug("%s: exiting interrupt, status %4.4x.\n", |
2448 | dev->name, status); | 2467 | dev->name, status); |
2449 | handler_exit: | 2468 | handler_exit: |
2469 | vp->handling_irq = 0; | ||
2450 | spin_unlock(&vp->lock); | 2470 | spin_unlock(&vp->lock); |
2451 | return IRQ_HANDLED; | 2471 | return IRQ_HANDLED; |
2452 | } | 2472 | } |
@@ -2922,28 +2942,31 @@ static void vortex_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
2922 | { | 2942 | { |
2923 | struct vortex_private *vp = netdev_priv(dev); | 2943 | struct vortex_private *vp = netdev_priv(dev); |
2924 | 2944 | ||
2925 | spin_lock_irq(&vp->lock); | 2945 | if (!VORTEX_PCI(vp)) |
2946 | return; | ||
2947 | |||
2926 | wol->supported = WAKE_MAGIC; | 2948 | wol->supported = WAKE_MAGIC; |
2927 | 2949 | ||
2928 | wol->wolopts = 0; | 2950 | wol->wolopts = 0; |
2929 | if (vp->enable_wol) | 2951 | if (vp->enable_wol) |
2930 | wol->wolopts |= WAKE_MAGIC; | 2952 | wol->wolopts |= WAKE_MAGIC; |
2931 | spin_unlock_irq(&vp->lock); | ||
2932 | } | 2953 | } |
2933 | 2954 | ||
2934 | static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 2955 | static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
2935 | { | 2956 | { |
2936 | struct vortex_private *vp = netdev_priv(dev); | 2957 | struct vortex_private *vp = netdev_priv(dev); |
2958 | |||
2959 | if (!VORTEX_PCI(vp)) | ||
2960 | return -EOPNOTSUPP; | ||
2961 | |||
2937 | if (wol->wolopts & ~WAKE_MAGIC) | 2962 | if (wol->wolopts & ~WAKE_MAGIC) |
2938 | return -EINVAL; | 2963 | return -EINVAL; |
2939 | 2964 | ||
2940 | spin_lock_irq(&vp->lock); | ||
2941 | if (wol->wolopts & WAKE_MAGIC) | 2965 | if (wol->wolopts & WAKE_MAGIC) |
2942 | vp->enable_wol = 1; | 2966 | vp->enable_wol = 1; |
2943 | else | 2967 | else |
2944 | vp->enable_wol = 0; | 2968 | vp->enable_wol = 0; |
2945 | acpi_set_WOL(dev); | 2969 | acpi_set_WOL(dev); |
2946 | spin_unlock_irq(&vp->lock); | ||
2947 | 2970 | ||
2948 | return 0; | 2971 | return 0; |
2949 | } | 2972 | } |
@@ -2971,7 +2994,6 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
2971 | { | 2994 | { |
2972 | int err; | 2995 | int err; |
2973 | struct vortex_private *vp = netdev_priv(dev); | 2996 | struct vortex_private *vp = netdev_priv(dev); |
2974 | unsigned long flags; | ||
2975 | pci_power_t state = 0; | 2997 | pci_power_t state = 0; |
2976 | 2998 | ||
2977 | if(VORTEX_PCI(vp)) | 2999 | if(VORTEX_PCI(vp)) |
@@ -2981,9 +3003,7 @@ static int vortex_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
2981 | 3003 | ||
2982 | if(state != 0) | 3004 | if(state != 0) |
2983 | pci_set_power_state(VORTEX_PCI(vp), PCI_D0); | 3005 | pci_set_power_state(VORTEX_PCI(vp), PCI_D0); |
2984 | spin_lock_irqsave(&vp->lock, flags); | ||
2985 | err = generic_mii_ioctl(&vp->mii, if_mii(rq), cmd, NULL); | 3006 | err = generic_mii_ioctl(&vp->mii, if_mii(rq), cmd, NULL); |
2986 | spin_unlock_irqrestore(&vp->lock, flags); | ||
2987 | if(state != 0) | 3007 | if(state != 0) |
2988 | pci_set_power_state(VORTEX_PCI(vp), state); | 3008 | pci_set_power_state(VORTEX_PCI(vp), state); |
2989 | 3009 | ||
@@ -3188,6 +3208,9 @@ static void acpi_set_WOL(struct net_device *dev) | |||
3188 | return; | 3208 | return; |
3189 | } | 3209 | } |
3190 | 3210 | ||
3211 | if (VORTEX_PCI(vp)->current_state < PCI_D3hot) | ||
3212 | return; | ||
3213 | |||
3191 | /* Change the power state to D3; RxEnable doesn't take effect. */ | 3214 | /* Change the power state to D3; RxEnable doesn't take effect. */ |
3192 | pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot); | 3215 | pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot); |
3193 | } | 3216 | } |
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index ebe68395ecf8..2cc81a54cbf3 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -484,7 +484,7 @@ config XTENSA_XT2000_SONIC | |||
484 | 484 | ||
485 | config MIPS_AU1X00_ENET | 485 | config 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, |
@@ -928,6 +928,16 @@ config SMC91X | |||
928 | The module will be called smc91x. If you want to compile it as a | 928 | The module will be called smc91x. If you want to compile it as a |
929 | module, say M here and read <file:Documentation/kbuild/modules.txt>. | 929 | module, say M here and read <file:Documentation/kbuild/modules.txt>. |
930 | 930 | ||
931 | config PXA168_ETH | ||
932 | tristate "Marvell pxa168 ethernet support" | ||
933 | depends on CPU_PXA168 | ||
934 | select PHYLIB | ||
935 | help | ||
936 | This driver supports the pxa168 Ethernet ports. | ||
937 | |||
938 | To compile this driver as a module, choose M here. The module | ||
939 | will be called pxa168_eth. | ||
940 | |||
931 | config NET_NETX | 941 | config NET_NETX |
932 | tristate "NetX Ethernet support" | 942 | tristate "NetX Ethernet support" |
933 | select MII | 943 | select MII |
diff --git a/drivers/net/Makefile b/drivers/net/Makefile index 56e8c27f77ce..3e8f150c4b14 100644 --- a/drivers/net/Makefile +++ b/drivers/net/Makefile | |||
@@ -244,6 +244,7 @@ obj-$(CONFIG_MYRI10GE) += myri10ge/ | |||
244 | obj-$(CONFIG_SMC91X) += smc91x.o | 244 | obj-$(CONFIG_SMC91X) += smc91x.o |
245 | obj-$(CONFIG_SMC911X) += smc911x.o | 245 | obj-$(CONFIG_SMC911X) += smc911x.o |
246 | obj-$(CONFIG_SMSC911X) += smsc911x.o | 246 | obj-$(CONFIG_SMSC911X) += smsc911x.o |
247 | obj-$(CONFIG_PXA168_ETH) += pxa168_eth.o | ||
247 | obj-$(CONFIG_BFIN_MAC) += bfin_mac.o | 248 | obj-$(CONFIG_BFIN_MAC) += bfin_mac.o |
248 | obj-$(CONFIG_DM9000) += dm9000.o | 249 | obj-$(CONFIG_DM9000) += dm9000.o |
249 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o | 250 | obj-$(CONFIG_PASEMI_MAC) += pasemi_mac_driver.o |
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 | ||
242 | static spinlock_t mdio_lock; | 242 | static spinlock_t mdio_lock; |
243 | static struct eth_regs __iomem *mdio_regs; /* mdio command and status only */ | 243 | static struct eth_regs __iomem *mdio_regs; /* mdio command and status only */ |
244 | struct mii_bus *mdio_bus; | 244 | static struct mii_bus *mdio_bus; |
245 | static int ports_open; | 245 | static int ports_open; |
246 | static struct port *npe_port_tab[MAX_NPES]; | 246 | static struct port *npe_port_tab[MAX_NPES]; |
247 | static struct dma_pool *dma_pool; | 247 | static struct dma_pool *dma_pool; |
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c index 63b9ba0cc67e..c73be2848319 100644 --- a/drivers/net/atlx/atl1.c +++ b/drivers/net/atlx/atl1.c | |||
@@ -1251,6 +1251,12 @@ static void atl1_free_ring_resources(struct atl1_adapter *adapter) | |||
1251 | 1251 | ||
1252 | rrd_ring->desc = NULL; | 1252 | rrd_ring->desc = NULL; |
1253 | rrd_ring->dma = 0; | 1253 | rrd_ring->dma = 0; |
1254 | |||
1255 | adapter->cmb.dma = 0; | ||
1256 | adapter->cmb.cmb = NULL; | ||
1257 | |||
1258 | adapter->smb.dma = 0; | ||
1259 | adapter->smb.smb = NULL; | ||
1254 | } | 1260 | } |
1255 | 1261 | ||
1256 | static void atl1_setup_mac_ctrl(struct atl1_adapter *adapter) | 1262 | static void atl1_setup_mac_ctrl(struct atl1_adapter *adapter) |
@@ -2847,10 +2853,11 @@ static int atl1_resume(struct pci_dev *pdev) | |||
2847 | pci_enable_wake(pdev, PCI_D3cold, 0); | 2853 | pci_enable_wake(pdev, PCI_D3cold, 0); |
2848 | 2854 | ||
2849 | atl1_reset_hw(&adapter->hw); | 2855 | atl1_reset_hw(&adapter->hw); |
2850 | adapter->cmb.cmb->int_stats = 0; | ||
2851 | 2856 | ||
2852 | if (netif_running(netdev)) | 2857 | if (netif_running(netdev)) { |
2858 | adapter->cmb.cmb->int_stats = 0; | ||
2853 | atl1_up(adapter); | 2859 | atl1_up(adapter); |
2860 | } | ||
2854 | netif_device_attach(netdev); | 2861 | netif_device_attach(netdev); |
2855 | 2862 | ||
2856 | return 0; | 2863 | return 0; |
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 | */ | ||
111 | static unsigned char au1000_mac_addr[6] __devinitdata = { | ||
112 | 0x00, 0x50, 0xc2, 0x0c, 0x30, 0x00 | ||
113 | }; | ||
114 | |||
115 | struct au1000_private *au_macs[NUM_ETH_INTERFACES]; | 107 | struct 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/b44.c b/drivers/net/b44.c index 37617abc1647..1e620e287ae0 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -848,6 +848,15 @@ static int b44_poll(struct napi_struct *napi, int budget) | |||
848 | b44_tx(bp); | 848 | b44_tx(bp); |
849 | /* spin_unlock(&bp->tx_lock); */ | 849 | /* spin_unlock(&bp->tx_lock); */ |
850 | } | 850 | } |
851 | if (bp->istat & ISTAT_RFO) { /* fast recovery, in ~20msec */ | ||
852 | bp->istat &= ~ISTAT_RFO; | ||
853 | b44_disable_ints(bp); | ||
854 | ssb_device_enable(bp->sdev, 0); /* resets ISTAT_RFO */ | ||
855 | b44_init_rings(bp); | ||
856 | b44_init_hw(bp, B44_FULL_RESET_SKIP_PHY); | ||
857 | netif_wake_queue(bp->dev); | ||
858 | } | ||
859 | |||
851 | spin_unlock_irqrestore(&bp->lock, flags); | 860 | spin_unlock_irqrestore(&bp->lock, flags); |
852 | 861 | ||
853 | work_done = 0; | 862 | work_done = 0; |
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h index 99197bd54da5..53306bf3f401 100644 --- a/drivers/net/benet/be.h +++ b/drivers/net/benet/be.h | |||
@@ -181,6 +181,7 @@ struct be_drvr_stats { | |||
181 | u64 be_rx_bytes_prev; | 181 | u64 be_rx_bytes_prev; |
182 | u64 be_rx_pkts; | 182 | u64 be_rx_pkts; |
183 | u32 be_rx_rate; | 183 | u32 be_rx_rate; |
184 | u32 be_rx_mcast_pkt; | ||
184 | /* number of non ether type II frames dropped where | 185 | /* number of non ether type II frames dropped where |
185 | * frame len > length field of Mac Hdr */ | 186 | * frame len > length field of Mac Hdr */ |
186 | u32 be_802_3_dropped_frames; | 187 | u32 be_802_3_dropped_frames; |
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 3d305494a606..34abcc9403d6 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -140,10 +140,8 @@ int be_process_mcc(struct be_adapter *adapter, int *status) | |||
140 | while ((compl = be_mcc_compl_get(adapter))) { | 140 | while ((compl = be_mcc_compl_get(adapter))) { |
141 | if (compl->flags & CQE_FLAGS_ASYNC_MASK) { | 141 | if (compl->flags & CQE_FLAGS_ASYNC_MASK) { |
142 | /* Interpret flags as an async trailer */ | 142 | /* Interpret flags as an async trailer */ |
143 | BUG_ON(!is_link_state_evt(compl->flags)); | 143 | if (is_link_state_evt(compl->flags)) |
144 | 144 | be_async_link_state_process(adapter, | |
145 | /* Interpret compl as a async link evt */ | ||
146 | be_async_link_state_process(adapter, | ||
147 | (struct be_async_event_link_state *) compl); | 145 | (struct be_async_event_link_state *) compl); |
148 | } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { | 146 | } else if (compl->flags & CQE_FLAGS_COMPLETED_MASK) { |
149 | *status = be_mcc_compl_process(adapter, compl); | 147 | *status = be_mcc_compl_process(adapter, compl); |
@@ -207,7 +205,7 @@ static int be_mbox_db_ready_wait(struct be_adapter *adapter, void __iomem *db) | |||
207 | 205 | ||
208 | if (msecs > 4000) { | 206 | if (msecs > 4000) { |
209 | dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); | 207 | dev_err(&adapter->pdev->dev, "mbox poll timed out\n"); |
210 | be_dump_ue(adapter); | 208 | be_detect_dump_ue(adapter); |
211 | return -1; | 209 | return -1; |
212 | } | 210 | } |
213 | 211 | ||
diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h index bdc10a28cfda..ad1e6fac60c5 100644 --- a/drivers/net/benet/be_cmds.h +++ b/drivers/net/benet/be_cmds.h | |||
@@ -992,5 +992,5 @@ extern int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, | |||
992 | extern int be_cmd_get_phy_info(struct be_adapter *adapter, | 992 | extern int be_cmd_get_phy_info(struct be_adapter *adapter, |
993 | struct be_dma_mem *cmd); | 993 | struct be_dma_mem *cmd); |
994 | extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); | 994 | extern int be_cmd_set_qos(struct be_adapter *adapter, u32 bps, u32 domain); |
995 | extern void be_dump_ue(struct be_adapter *adapter); | 995 | extern void be_detect_dump_ue(struct be_adapter *adapter); |
996 | 996 | ||
diff --git a/drivers/net/benet/be_ethtool.c b/drivers/net/benet/be_ethtool.c index cd16243c7c36..13f0abbc5205 100644 --- a/drivers/net/benet/be_ethtool.c +++ b/drivers/net/benet/be_ethtool.c | |||
@@ -60,6 +60,7 @@ static const struct be_ethtool_stat et_stats[] = { | |||
60 | {DRVSTAT_INFO(be_rx_events)}, | 60 | {DRVSTAT_INFO(be_rx_events)}, |
61 | {DRVSTAT_INFO(be_tx_compl)}, | 61 | {DRVSTAT_INFO(be_tx_compl)}, |
62 | {DRVSTAT_INFO(be_rx_compl)}, | 62 | {DRVSTAT_INFO(be_rx_compl)}, |
63 | {DRVSTAT_INFO(be_rx_mcast_pkt)}, | ||
63 | {DRVSTAT_INFO(be_ethrx_post_fail)}, | 64 | {DRVSTAT_INFO(be_ethrx_post_fail)}, |
64 | {DRVSTAT_INFO(be_802_3_dropped_frames)}, | 65 | {DRVSTAT_INFO(be_802_3_dropped_frames)}, |
65 | {DRVSTAT_INFO(be_802_3_malformed_frames)}, | 66 | {DRVSTAT_INFO(be_802_3_malformed_frames)}, |
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h index 5d38046402b2..a2ec5df0d733 100644 --- a/drivers/net/benet/be_hw.h +++ b/drivers/net/benet/be_hw.h | |||
@@ -167,8 +167,11 @@ | |||
167 | #define FLASH_FCoE_BIOS_START_g3 (13631488) | 167 | #define FLASH_FCoE_BIOS_START_g3 (13631488) |
168 | #define FLASH_REDBOOT_START_g3 (262144) | 168 | #define FLASH_REDBOOT_START_g3 (262144) |
169 | 169 | ||
170 | 170 | /************* Rx Packet Type Encoding **************/ | |
171 | 171 | #define BE_UNICAST_PACKET 0 | |
172 | #define BE_MULTICAST_PACKET 1 | ||
173 | #define BE_BROADCAST_PACKET 2 | ||
174 | #define BE_RSVD_PACKET 3 | ||
172 | 175 | ||
173 | /* | 176 | /* |
174 | * BE descriptors: host memory data structures whose formats | 177 | * BE descriptors: host memory data structures whose formats |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 74e146f470c6..6eda7a022256 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -247,6 +247,7 @@ void netdev_stats_update(struct be_adapter *adapter) | |||
247 | dev_stats->tx_packets = drvr_stats(adapter)->be_tx_pkts; | 247 | dev_stats->tx_packets = drvr_stats(adapter)->be_tx_pkts; |
248 | dev_stats->rx_bytes = drvr_stats(adapter)->be_rx_bytes; | 248 | dev_stats->rx_bytes = drvr_stats(adapter)->be_rx_bytes; |
249 | dev_stats->tx_bytes = drvr_stats(adapter)->be_tx_bytes; | 249 | dev_stats->tx_bytes = drvr_stats(adapter)->be_tx_bytes; |
250 | dev_stats->multicast = drvr_stats(adapter)->be_rx_mcast_pkt; | ||
250 | 251 | ||
251 | /* bad pkts received */ | 252 | /* bad pkts received */ |
252 | dev_stats->rx_errors = port_stats->rx_crc_errors + | 253 | dev_stats->rx_errors = port_stats->rx_crc_errors + |
@@ -294,7 +295,6 @@ void netdev_stats_update(struct be_adapter *adapter) | |||
294 | /* no space available in linux */ | 295 | /* no space available in linux */ |
295 | dev_stats->tx_dropped = 0; | 296 | dev_stats->tx_dropped = 0; |
296 | 297 | ||
297 | dev_stats->multicast = port_stats->rx_multicast_frames; | ||
298 | dev_stats->collisions = 0; | 298 | dev_stats->collisions = 0; |
299 | 299 | ||
300 | /* detailed tx_errors */ | 300 | /* detailed tx_errors */ |
@@ -848,7 +848,7 @@ static void be_rx_rate_update(struct be_adapter *adapter) | |||
848 | } | 848 | } |
849 | 849 | ||
850 | static void be_rx_stats_update(struct be_adapter *adapter, | 850 | static void be_rx_stats_update(struct be_adapter *adapter, |
851 | u32 pktsize, u16 numfrags) | 851 | u32 pktsize, u16 numfrags, u8 pkt_type) |
852 | { | 852 | { |
853 | struct be_drvr_stats *stats = drvr_stats(adapter); | 853 | struct be_drvr_stats *stats = drvr_stats(adapter); |
854 | 854 | ||
@@ -856,6 +856,9 @@ static void be_rx_stats_update(struct be_adapter *adapter, | |||
856 | stats->be_rx_frags += numfrags; | 856 | stats->be_rx_frags += numfrags; |
857 | stats->be_rx_bytes += pktsize; | 857 | stats->be_rx_bytes += pktsize; |
858 | stats->be_rx_pkts++; | 858 | stats->be_rx_pkts++; |
859 | |||
860 | if (pkt_type == BE_MULTICAST_PACKET) | ||
861 | stats->be_rx_mcast_pkt++; | ||
859 | } | 862 | } |
860 | 863 | ||
861 | static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso) | 864 | static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso) |
@@ -925,9 +928,11 @@ static void skb_fill_rx_data(struct be_adapter *adapter, | |||
925 | u16 rxq_idx, i, j; | 928 | u16 rxq_idx, i, j; |
926 | u32 pktsize, hdr_len, curr_frag_len, size; | 929 | u32 pktsize, hdr_len, curr_frag_len, size; |
927 | u8 *start; | 930 | u8 *start; |
931 | u8 pkt_type; | ||
928 | 932 | ||
929 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); | 933 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); |
930 | pktsize = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp); | 934 | pktsize = AMAP_GET_BITS(struct amap_eth_rx_compl, pktsize, rxcp); |
935 | pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp); | ||
931 | 936 | ||
932 | page_info = get_rx_page_info(adapter, rxq_idx); | 937 | page_info = get_rx_page_info(adapter, rxq_idx); |
933 | 938 | ||
@@ -993,7 +998,7 @@ static void skb_fill_rx_data(struct be_adapter *adapter, | |||
993 | BUG_ON(j > MAX_SKB_FRAGS); | 998 | BUG_ON(j > MAX_SKB_FRAGS); |
994 | 999 | ||
995 | done: | 1000 | done: |
996 | be_rx_stats_update(adapter, pktsize, num_rcvd); | 1001 | be_rx_stats_update(adapter, pktsize, num_rcvd, pkt_type); |
997 | } | 1002 | } |
998 | 1003 | ||
999 | /* Process the RX completion indicated by rxcp when GRO is disabled */ | 1004 | /* Process the RX completion indicated by rxcp when GRO is disabled */ |
@@ -1060,6 +1065,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter, | |||
1060 | u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len; | 1065 | u32 num_rcvd, pkt_size, remaining, vlanf, curr_frag_len; |
1061 | u16 i, rxq_idx = 0, vid, j; | 1066 | u16 i, rxq_idx = 0, vid, j; |
1062 | u8 vtm; | 1067 | u8 vtm; |
1068 | u8 pkt_type; | ||
1063 | 1069 | ||
1064 | num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp); | 1070 | num_rcvd = AMAP_GET_BITS(struct amap_eth_rx_compl, numfrags, rxcp); |
1065 | /* Is it a flush compl that has no data */ | 1071 | /* Is it a flush compl that has no data */ |
@@ -1070,6 +1076,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter, | |||
1070 | vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); | 1076 | vlanf = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp); |
1071 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); | 1077 | rxq_idx = AMAP_GET_BITS(struct amap_eth_rx_compl, fragndx, rxcp); |
1072 | vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); | 1078 | vtm = AMAP_GET_BITS(struct amap_eth_rx_compl, vtm, rxcp); |
1079 | pkt_type = AMAP_GET_BITS(struct amap_eth_rx_compl, cast_enc, rxcp); | ||
1073 | 1080 | ||
1074 | /* vlanf could be wrongly set in some cards. | 1081 | /* vlanf could be wrongly set in some cards. |
1075 | * ignore if vtm is not set */ | 1082 | * ignore if vtm is not set */ |
@@ -1125,7 +1132,7 @@ static void be_rx_compl_process_gro(struct be_adapter *adapter, | |||
1125 | vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid); | 1132 | vlan_gro_frags(&eq_obj->napi, adapter->vlan_grp, vid); |
1126 | } | 1133 | } |
1127 | 1134 | ||
1128 | be_rx_stats_update(adapter, pkt_size, num_rcvd); | 1135 | be_rx_stats_update(adapter, pkt_size, num_rcvd, pkt_type); |
1129 | } | 1136 | } |
1130 | 1137 | ||
1131 | static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter) | 1138 | static struct be_eth_rx_compl *be_rx_compl_get(struct be_adapter *adapter) |
@@ -1743,26 +1750,7 @@ static int be_poll_tx_mcc(struct napi_struct *napi, int budget) | |||
1743 | return 1; | 1750 | return 1; |
1744 | } | 1751 | } |
1745 | 1752 | ||
1746 | static inline bool be_detect_ue(struct be_adapter *adapter) | 1753 | void be_detect_dump_ue(struct be_adapter *adapter) |
1747 | { | ||
1748 | u32 online0 = 0, online1 = 0; | ||
1749 | |||
1750 | pci_read_config_dword(adapter->pdev, PCICFG_ONLINE0, &online0); | ||
1751 | |||
1752 | pci_read_config_dword(adapter->pdev, PCICFG_ONLINE1, &online1); | ||
1753 | |||
1754 | if (!online0 || !online1) { | ||
1755 | adapter->ue_detected = true; | ||
1756 | dev_err(&adapter->pdev->dev, | ||
1757 | "UE Detected!! online0=%d online1=%d\n", | ||
1758 | online0, online1); | ||
1759 | return true; | ||
1760 | } | ||
1761 | |||
1762 | return false; | ||
1763 | } | ||
1764 | |||
1765 | void be_dump_ue(struct be_adapter *adapter) | ||
1766 | { | 1754 | { |
1767 | u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask; | 1755 | u32 ue_status_lo, ue_status_hi, ue_status_lo_mask, ue_status_hi_mask; |
1768 | u32 i; | 1756 | u32 i; |
@@ -1779,6 +1767,11 @@ void be_dump_ue(struct be_adapter *adapter) | |||
1779 | ue_status_lo = (ue_status_lo & (~ue_status_lo_mask)); | 1767 | ue_status_lo = (ue_status_lo & (~ue_status_lo_mask)); |
1780 | ue_status_hi = (ue_status_hi & (~ue_status_hi_mask)); | 1768 | ue_status_hi = (ue_status_hi & (~ue_status_hi_mask)); |
1781 | 1769 | ||
1770 | if (ue_status_lo || ue_status_hi) { | ||
1771 | adapter->ue_detected = true; | ||
1772 | dev_err(&adapter->pdev->dev, "UE Detected!!\n"); | ||
1773 | } | ||
1774 | |||
1782 | if (ue_status_lo) { | 1775 | if (ue_status_lo) { |
1783 | for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { | 1776 | for (i = 0; ue_status_lo; ue_status_lo >>= 1, i++) { |
1784 | if (ue_status_lo & 1) | 1777 | if (ue_status_lo & 1) |
@@ -1814,10 +1807,8 @@ static void be_worker(struct work_struct *work) | |||
1814 | adapter->rx_post_starved = false; | 1807 | adapter->rx_post_starved = false; |
1815 | be_post_rx_frags(adapter); | 1808 | be_post_rx_frags(adapter); |
1816 | } | 1809 | } |
1817 | if (!adapter->ue_detected) { | 1810 | if (!adapter->ue_detected) |
1818 | if (be_detect_ue(adapter)) | 1811 | be_detect_dump_ue(adapter); |
1819 | be_dump_ue(adapter); | ||
1820 | } | ||
1821 | 1812 | ||
1822 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); | 1813 | schedule_delayed_work(&adapter->work, msecs_to_jiffies(1000)); |
1823 | } | 1814 | } |
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 53af9c93e75c..0c2d96ed561c 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h | |||
@@ -20,8 +20,8 @@ | |||
20 | * (you will need to reboot afterwards) */ | 20 | * (you will need to reboot afterwards) */ |
21 | /* #define BNX2X_STOP_ON_ERROR */ | 21 | /* #define BNX2X_STOP_ON_ERROR */ |
22 | 22 | ||
23 | #define DRV_MODULE_VERSION "1.52.53-3" | 23 | #define DRV_MODULE_VERSION "1.52.53-4" |
24 | #define DRV_MODULE_RELDATE "2010/18/04" | 24 | #define DRV_MODULE_RELDATE "2010/16/08" |
25 | #define BNX2X_BC_VER 0x040200 | 25 | #define BNX2X_BC_VER 0x040200 |
26 | 26 | ||
27 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | 27 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) |
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index b4ec2b02a465..f8c3f08e4ce7 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
@@ -4328,10 +4328,12 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
4328 | val |= aeu_gpio_mask; | 4328 | val |= aeu_gpio_mask; |
4329 | REG_WR(bp, offset, val); | 4329 | REG_WR(bp, offset, val); |
4330 | } | 4330 | } |
4331 | bp->port.need_hw_lock = 1; | ||
4331 | break; | 4332 | break; |
4332 | 4333 | ||
4333 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: | ||
4334 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727: | 4334 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727: |
4335 | bp->port.need_hw_lock = 1; | ||
4336 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: | ||
4335 | /* add SPIO 5 to group 0 */ | 4337 | /* add SPIO 5 to group 0 */ |
4336 | { | 4338 | { |
4337 | u32 reg_addr = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 : | 4339 | u32 reg_addr = (port ? MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0 : |
@@ -4341,7 +4343,10 @@ static int bnx2x_init_port(struct bnx2x *bp) | |||
4341 | REG_WR(bp, reg_addr, val); | 4343 | REG_WR(bp, reg_addr, val); |
4342 | } | 4344 | } |
4343 | break; | 4345 | break; |
4344 | 4346 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072: | |
4347 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073: | ||
4348 | bp->port.need_hw_lock = 1; | ||
4349 | break; | ||
4345 | default: | 4350 | default: |
4346 | break; | 4351 | break; |
4347 | } | 4352 | } |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 822f586d72af..0ddf4c66afe2 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2466,6 +2466,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac | |||
2466 | if (!(dev->flags & IFF_MASTER)) | 2466 | if (!(dev->flags & IFF_MASTER)) |
2467 | goto out; | 2467 | goto out; |
2468 | 2468 | ||
2469 | if (!pskb_may_pull(skb, sizeof(struct lacpdu))) | ||
2470 | goto out; | ||
2471 | |||
2469 | read_lock(&bond->lock); | 2472 | read_lock(&bond->lock); |
2470 | slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev), | 2473 | slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev), |
2471 | orig_dev); | 2474 | orig_dev); |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index c746b331771d..26bb118c4533 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -362,6 +362,9 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct | |||
362 | goto out; | 362 | goto out; |
363 | } | 363 | } |
364 | 364 | ||
365 | if (!pskb_may_pull(skb, arp_hdr_len(bond_dev))) | ||
366 | goto out; | ||
367 | |||
365 | if (skb->len < sizeof(struct arp_pkt)) { | 368 | if (skb->len < sizeof(struct arp_pkt)) { |
366 | pr_debug("Packet is too small to be an ARP\n"); | 369 | pr_debug("Packet is too small to be an ARP\n"); |
367 | goto out; | 370 | goto out; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 2cc4cfc31892..3b16f62d5606 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2797,9 +2797,15 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2797 | * so it can wait | 2797 | * so it can wait |
2798 | */ | 2798 | */ |
2799 | bond_for_each_slave(bond, slave, i) { | 2799 | bond_for_each_slave(bond, slave, i) { |
2800 | unsigned long trans_start = dev_trans_start(slave->dev); | ||
2801 | |||
2800 | if (slave->link != BOND_LINK_UP) { | 2802 | if (slave->link != BOND_LINK_UP) { |
2801 | if (time_before_eq(jiffies, dev_trans_start(slave->dev) + delta_in_ticks) && | 2803 | if (time_in_range(jiffies, |
2802 | time_before_eq(jiffies, slave->dev->last_rx + delta_in_ticks)) { | 2804 | trans_start - delta_in_ticks, |
2805 | trans_start + delta_in_ticks) && | ||
2806 | time_in_range(jiffies, | ||
2807 | slave->dev->last_rx - delta_in_ticks, | ||
2808 | slave->dev->last_rx + delta_in_ticks)) { | ||
2803 | 2809 | ||
2804 | slave->link = BOND_LINK_UP; | 2810 | slave->link = BOND_LINK_UP; |
2805 | slave->state = BOND_STATE_ACTIVE; | 2811 | slave->state = BOND_STATE_ACTIVE; |
@@ -2827,8 +2833,12 @@ void bond_loadbalance_arp_mon(struct work_struct *work) | |||
2827 | * when the source ip is 0, so don't take the link down | 2833 | * when the source ip is 0, so don't take the link down |
2828 | * if we don't know our ip yet | 2834 | * if we don't know our ip yet |
2829 | */ | 2835 | */ |
2830 | if (time_after_eq(jiffies, dev_trans_start(slave->dev) + 2*delta_in_ticks) || | 2836 | if (!time_in_range(jiffies, |
2831 | (time_after_eq(jiffies, slave->dev->last_rx + 2*delta_in_ticks))) { | 2837 | trans_start - delta_in_ticks, |
2838 | trans_start + 2 * delta_in_ticks) || | ||
2839 | !time_in_range(jiffies, | ||
2840 | slave->dev->last_rx - delta_in_ticks, | ||
2841 | slave->dev->last_rx + 2 * delta_in_ticks)) { | ||
2832 | 2842 | ||
2833 | slave->link = BOND_LINK_DOWN; | 2843 | slave->link = BOND_LINK_DOWN; |
2834 | slave->state = BOND_STATE_BACKUP; | 2844 | slave->state = BOND_STATE_BACKUP; |
@@ -2883,13 +2893,16 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) | |||
2883 | { | 2893 | { |
2884 | struct slave *slave; | 2894 | struct slave *slave; |
2885 | int i, commit = 0; | 2895 | int i, commit = 0; |
2896 | unsigned long trans_start; | ||
2886 | 2897 | ||
2887 | bond_for_each_slave(bond, slave, i) { | 2898 | bond_for_each_slave(bond, slave, i) { |
2888 | slave->new_link = BOND_LINK_NOCHANGE; | 2899 | slave->new_link = BOND_LINK_NOCHANGE; |
2889 | 2900 | ||
2890 | if (slave->link != BOND_LINK_UP) { | 2901 | if (slave->link != BOND_LINK_UP) { |
2891 | if (time_before_eq(jiffies, slave_last_rx(bond, slave) + | 2902 | if (time_in_range(jiffies, |
2892 | delta_in_ticks)) { | 2903 | slave_last_rx(bond, slave) - delta_in_ticks, |
2904 | slave_last_rx(bond, slave) + delta_in_ticks)) { | ||
2905 | |||
2893 | slave->new_link = BOND_LINK_UP; | 2906 | slave->new_link = BOND_LINK_UP; |
2894 | commit++; | 2907 | commit++; |
2895 | } | 2908 | } |
@@ -2902,8 +2915,9 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) | |||
2902 | * active. This avoids bouncing, as the last receive | 2915 | * active. This avoids bouncing, as the last receive |
2903 | * times need a full ARP monitor cycle to be updated. | 2916 | * times need a full ARP monitor cycle to be updated. |
2904 | */ | 2917 | */ |
2905 | if (!time_after_eq(jiffies, slave->jiffies + | 2918 | if (time_in_range(jiffies, |
2906 | 2 * delta_in_ticks)) | 2919 | slave->jiffies - delta_in_ticks, |
2920 | slave->jiffies + 2 * delta_in_ticks)) | ||
2907 | continue; | 2921 | continue; |
2908 | 2922 | ||
2909 | /* | 2923 | /* |
@@ -2921,8 +2935,10 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) | |||
2921 | */ | 2935 | */ |
2922 | if (slave->state == BOND_STATE_BACKUP && | 2936 | if (slave->state == BOND_STATE_BACKUP && |
2923 | !bond->current_arp_slave && | 2937 | !bond->current_arp_slave && |
2924 | time_after(jiffies, slave_last_rx(bond, slave) + | 2938 | !time_in_range(jiffies, |
2925 | 3 * delta_in_ticks)) { | 2939 | slave_last_rx(bond, slave) - delta_in_ticks, |
2940 | slave_last_rx(bond, slave) + 3 * delta_in_ticks)) { | ||
2941 | |||
2926 | slave->new_link = BOND_LINK_DOWN; | 2942 | slave->new_link = BOND_LINK_DOWN; |
2927 | commit++; | 2943 | commit++; |
2928 | } | 2944 | } |
@@ -2933,11 +2949,15 @@ static int bond_ab_arp_inspect(struct bonding *bond, int delta_in_ticks) | |||
2933 | * - (more than 2*delta since receive AND | 2949 | * - (more than 2*delta since receive AND |
2934 | * the bond has an IP address) | 2950 | * the bond has an IP address) |
2935 | */ | 2951 | */ |
2952 | trans_start = dev_trans_start(slave->dev); | ||
2936 | if ((slave->state == BOND_STATE_ACTIVE) && | 2953 | if ((slave->state == BOND_STATE_ACTIVE) && |
2937 | (time_after_eq(jiffies, dev_trans_start(slave->dev) + | 2954 | (!time_in_range(jiffies, |
2938 | 2 * delta_in_ticks) || | 2955 | trans_start - delta_in_ticks, |
2939 | (time_after_eq(jiffies, slave_last_rx(bond, slave) | 2956 | trans_start + 2 * delta_in_ticks) || |
2940 | + 2 * delta_in_ticks)))) { | 2957 | !time_in_range(jiffies, |
2958 | slave_last_rx(bond, slave) - delta_in_ticks, | ||
2959 | slave_last_rx(bond, slave) + 2 * delta_in_ticks))) { | ||
2960 | |||
2941 | slave->new_link = BOND_LINK_DOWN; | 2961 | slave->new_link = BOND_LINK_DOWN; |
2942 | commit++; | 2962 | commit++; |
2943 | } | 2963 | } |
@@ -2956,6 +2976,7 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
2956 | { | 2976 | { |
2957 | struct slave *slave; | 2977 | struct slave *slave; |
2958 | int i; | 2978 | int i; |
2979 | unsigned long trans_start; | ||
2959 | 2980 | ||
2960 | bond_for_each_slave(bond, slave, i) { | 2981 | bond_for_each_slave(bond, slave, i) { |
2961 | switch (slave->new_link) { | 2982 | switch (slave->new_link) { |
@@ -2963,10 +2984,11 @@ static void bond_ab_arp_commit(struct bonding *bond, int delta_in_ticks) | |||
2963 | continue; | 2984 | continue; |
2964 | 2985 | ||
2965 | case BOND_LINK_UP: | 2986 | case BOND_LINK_UP: |
2987 | trans_start = dev_trans_start(slave->dev); | ||
2966 | if ((!bond->curr_active_slave && | 2988 | if ((!bond->curr_active_slave && |
2967 | time_before_eq(jiffies, | 2989 | time_in_range(jiffies, |
2968 | dev_trans_start(slave->dev) + | 2990 | trans_start - delta_in_ticks, |
2969 | delta_in_ticks)) || | 2991 | trans_start + delta_in_ticks)) || |
2970 | bond->curr_active_slave != slave) { | 2992 | bond->curr_active_slave != slave) { |
2971 | slave->link = BOND_LINK_UP; | 2993 | slave->link = BOND_LINK_UP; |
2972 | bond->current_arp_slave = NULL; | 2994 | bond->current_arp_slave = NULL; |
diff --git a/drivers/net/caif/Kconfig b/drivers/net/caif/Kconfig index 631a6242b011..75bfc3a9d95f 100644 --- a/drivers/net/caif/Kconfig +++ b/drivers/net/caif/Kconfig | |||
@@ -15,7 +15,7 @@ config CAIF_TTY | |||
15 | 15 | ||
16 | config CAIF_SPI_SLAVE | 16 | config CAIF_SPI_SLAVE |
17 | tristate "CAIF SPI transport driver for slave interface" | 17 | tristate "CAIF SPI transport driver for slave interface" |
18 | depends on CAIF | 18 | depends on CAIF && HAS_DMA |
19 | default n | 19 | default n |
20 | ---help--- | 20 | ---help--- |
21 | The CAIF Link layer SPI Protocol driver for Slave SPI interface. | 21 | The CAIF Link layer SPI Protocol driver for Slave SPI interface. |
diff --git a/drivers/net/caif/caif_spi_slave.c b/drivers/net/caif/caif_spi_slave.c index 077ccf840edf..2111dbfea6fe 100644 --- a/drivers/net/caif/caif_spi_slave.c +++ b/drivers/net/caif/caif_spi_slave.c | |||
@@ -22,13 +22,13 @@ | |||
22 | #include <net/caif/caif_spi.h> | 22 | #include <net/caif/caif_spi.h> |
23 | 23 | ||
24 | #ifndef CONFIG_CAIF_SPI_SYNC | 24 | #ifndef CONFIG_CAIF_SPI_SYNC |
25 | #define SPI_DATA_POS SPI_CMD_SZ | 25 | #define SPI_DATA_POS 0 |
26 | static inline int forward_to_spi_cmd(struct cfspi *cfspi) | 26 | static inline int forward_to_spi_cmd(struct cfspi *cfspi) |
27 | { | 27 | { |
28 | return cfspi->rx_cpck_len; | 28 | return cfspi->rx_cpck_len; |
29 | } | 29 | } |
30 | #else | 30 | #else |
31 | #define SPI_DATA_POS 0 | 31 | #define SPI_DATA_POS SPI_CMD_SZ |
32 | static inline int forward_to_spi_cmd(struct cfspi *cfspi) | 32 | static inline int forward_to_spi_cmd(struct cfspi *cfspi) |
33 | { | 33 | { |
34 | return 0; | 34 | return 0; |
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 | ||
39 | struct mpc5xxx_can_data { | 39 | struct 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 | ||
51 | static u32 __devinit mpc52xx_can_get_clock(struct of_device *ofdev, | 51 | static 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 */ |
104 | static u32 __devinit mpc52xx_can_get_clock(struct of_device *ofdev, | 104 | static 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 | ||
132 | static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev, | 132 | static 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 */ |
242 | static u32 __devinit mpc512x_can_get_clock(struct of_device *ofdev, | 242 | static 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 | ||
250 | static int __devinit mpc5xxx_can_probe(struct of_device *ofdev, | 250 | static 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 | ||
320 | static int __devexit mpc5xxx_can_remove(struct of_device *ofdev) | 320 | static 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 |
336 | static struct mscan_regs saved_regs; | 336 | static struct mscan_regs saved_regs; |
337 | static int mpc5xxx_can_suspend(struct of_device *ofdev, pm_message_t state) | 337 | static 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 | ||
348 | static int mpc5xxx_can_resume(struct of_device *ofdev) | 348 | static 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 | ||
70 | static int __devexit sja1000_ofp_remove(struct of_device *ofdev) | 70 | static 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 | ||
90 | static int __devinit sja1000_ofp_probe(struct of_device *ofdev, | 90 | static 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/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index ad19585d960b..f208712c0b90 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -2296,6 +2296,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) | |||
2296 | case CHELSIO_GET_QSET_NUM:{ | 2296 | case CHELSIO_GET_QSET_NUM:{ |
2297 | struct ch_reg edata; | 2297 | struct ch_reg edata; |
2298 | 2298 | ||
2299 | memset(&edata, 0, sizeof(struct ch_reg)); | ||
2300 | |||
2299 | edata.cmd = CHELSIO_GET_QSET_NUM; | 2301 | edata.cmd = CHELSIO_GET_QSET_NUM; |
2300 | edata.val = pi->nqsets; | 2302 | edata.val = pi->nqsets; |
2301 | if (copy_to_user(useraddr, &edata, sizeof(edata))) | 2303 | if (copy_to_user(useraddr, &edata, sizeof(edata))) |
diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c index a4a0d2b6eb1c..d3d4a57e2450 100644 --- a/drivers/net/e1000e/82571.c +++ b/drivers/net/e1000e/82571.c | |||
@@ -936,12 +936,14 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw) | |||
936 | ew32(IMC, 0xffffffff); | 936 | ew32(IMC, 0xffffffff); |
937 | icr = er32(ICR); | 937 | icr = er32(ICR); |
938 | 938 | ||
939 | /* Install any alternate MAC address into RAR0 */ | 939 | if (hw->mac.type == e1000_82571) { |
940 | ret_val = e1000_check_alt_mac_addr_generic(hw); | 940 | /* Install any alternate MAC address into RAR0 */ |
941 | if (ret_val) | 941 | ret_val = e1000_check_alt_mac_addr_generic(hw); |
942 | return ret_val; | 942 | if (ret_val) |
943 | return ret_val; | ||
943 | 944 | ||
944 | e1000e_set_laa_state_82571(hw, true); | 945 | e1000e_set_laa_state_82571(hw, true); |
946 | } | ||
945 | 947 | ||
946 | /* Reinitialize the 82571 serdes link state machine */ | 948 | /* Reinitialize the 82571 serdes link state machine */ |
947 | if (hw->phy.media_type == e1000_media_type_internal_serdes) | 949 | if (hw->phy.media_type == e1000_media_type_internal_serdes) |
@@ -1618,14 +1620,16 @@ static s32 e1000_read_mac_addr_82571(struct e1000_hw *hw) | |||
1618 | { | 1620 | { |
1619 | s32 ret_val = 0; | 1621 | s32 ret_val = 0; |
1620 | 1622 | ||
1621 | /* | 1623 | if (hw->mac.type == e1000_82571) { |
1622 | * If there's an alternate MAC address place it in RAR0 | 1624 | /* |
1623 | * so that it will override the Si installed default perm | 1625 | * If there's an alternate MAC address place it in RAR0 |
1624 | * address. | 1626 | * so that it will override the Si installed default perm |
1625 | */ | 1627 | * address. |
1626 | ret_val = e1000_check_alt_mac_addr_generic(hw); | 1628 | */ |
1627 | if (ret_val) | 1629 | ret_val = e1000_check_alt_mac_addr_generic(hw); |
1628 | goto out; | 1630 | if (ret_val) |
1631 | goto out; | ||
1632 | } | ||
1629 | 1633 | ||
1630 | ret_val = e1000_read_mac_addr_generic(hw); | 1634 | ret_val = e1000_read_mac_addr_generic(hw); |
1631 | 1635 | ||
@@ -1833,6 +1837,7 @@ struct e1000_info e1000_82573_info = { | |||
1833 | | FLAG_HAS_SMART_POWER_DOWN | 1837 | | FLAG_HAS_SMART_POWER_DOWN |
1834 | | FLAG_HAS_AMT | 1838 | | FLAG_HAS_AMT |
1835 | | FLAG_HAS_SWSM_ON_LOAD, | 1839 | | FLAG_HAS_SWSM_ON_LOAD, |
1840 | .flags2 = FLAG2_DISABLE_ASPM_L1, | ||
1836 | .pba = 20, | 1841 | .pba = 20, |
1837 | .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, | 1842 | .max_hw_frame_size = ETH_FRAME_LEN + ETH_FCS_LEN, |
1838 | .get_variants = e1000_get_variants_82571, | 1843 | .get_variants = e1000_get_variants_82571, |
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index 307a72f483ee..93b3bedae8d2 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
@@ -621,6 +621,7 @@ | |||
621 | #define E1000_FLASH_UPDATES 2000 | 621 | #define E1000_FLASH_UPDATES 2000 |
622 | 622 | ||
623 | /* NVM Word Offsets */ | 623 | /* NVM Word Offsets */ |
624 | #define NVM_COMPAT 0x0003 | ||
624 | #define NVM_ID_LED_SETTINGS 0x0004 | 625 | #define NVM_ID_LED_SETTINGS 0x0004 |
625 | #define NVM_INIT_CONTROL2_REG 0x000F | 626 | #define NVM_INIT_CONTROL2_REG 0x000F |
626 | #define NVM_INIT_CONTROL3_PORT_B 0x0014 | 627 | #define NVM_INIT_CONTROL3_PORT_B 0x0014 |
@@ -643,6 +644,9 @@ | |||
643 | /* Mask bits for fields in Word 0x1a of the NVM */ | 644 | /* Mask bits for fields in Word 0x1a of the NVM */ |
644 | #define NVM_WORD1A_ASPM_MASK 0x000C | 645 | #define NVM_WORD1A_ASPM_MASK 0x000C |
645 | 646 | ||
647 | /* Mask bits for fields in Word 0x03 of the EEPROM */ | ||
648 | #define NVM_COMPAT_LOM 0x0800 | ||
649 | |||
646 | /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ | 650 | /* For checksumming, the sum of all words in the NVM should equal 0xBABA. */ |
647 | #define NVM_SUM 0xBABA | 651 | #define NVM_SUM 0xBABA |
648 | 652 | ||
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 66ed08f726fb..ba302a5c2c30 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -57,6 +57,7 @@ enum e1e_registers { | |||
57 | E1000_SCTL = 0x00024, /* SerDes Control - RW */ | 57 | E1000_SCTL = 0x00024, /* SerDes Control - RW */ |
58 | E1000_FCAL = 0x00028, /* Flow Control Address Low - RW */ | 58 | E1000_FCAL = 0x00028, /* Flow Control Address Low - RW */ |
59 | E1000_FCAH = 0x0002C, /* Flow Control Address High -RW */ | 59 | E1000_FCAH = 0x0002C, /* Flow Control Address High -RW */ |
60 | E1000_FEXTNVM4 = 0x00024, /* Future Extended NVM 4 - RW */ | ||
60 | E1000_FEXTNVM = 0x00028, /* Future Extended NVM - RW */ | 61 | E1000_FEXTNVM = 0x00028, /* Future Extended NVM - RW */ |
61 | E1000_FCT = 0x00030, /* Flow Control Type - RW */ | 62 | E1000_FCT = 0x00030, /* Flow Control Type - RW */ |
62 | E1000_VET = 0x00038, /* VLAN Ether Type - RW */ | 63 | E1000_VET = 0x00038, /* VLAN Ether Type - RW */ |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 63930d12711c..57b5435599ab 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -105,6 +105,10 @@ | |||
105 | #define E1000_FEXTNVM_SW_CONFIG 1 | 105 | #define E1000_FEXTNVM_SW_CONFIG 1 |
106 | #define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M :/ */ | 106 | #define E1000_FEXTNVM_SW_CONFIG_ICH8M (1 << 27) /* Bit redefined for ICH8M :/ */ |
107 | 107 | ||
108 | #define E1000_FEXTNVM4_BEACON_DURATION_MASK 0x7 | ||
109 | #define E1000_FEXTNVM4_BEACON_DURATION_8USEC 0x7 | ||
110 | #define E1000_FEXTNVM4_BEACON_DURATION_16USEC 0x3 | ||
111 | |||
108 | #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL | 112 | #define PCIE_ICH8_SNOOP_ALL PCIE_NO_SNOOP_ALL |
109 | 113 | ||
110 | #define E1000_ICH_RAR_ENTRIES 7 | 114 | #define E1000_ICH_RAR_ENTRIES 7 |
@@ -125,6 +129,7 @@ | |||
125 | 129 | ||
126 | /* SMBus Address Phy Register */ | 130 | /* SMBus Address Phy Register */ |
127 | #define HV_SMB_ADDR PHY_REG(768, 26) | 131 | #define HV_SMB_ADDR PHY_REG(768, 26) |
132 | #define HV_SMB_ADDR_MASK 0x007F | ||
128 | #define HV_SMB_ADDR_PEC_EN 0x0200 | 133 | #define HV_SMB_ADDR_PEC_EN 0x0200 |
129 | #define HV_SMB_ADDR_VALID 0x0080 | 134 | #define HV_SMB_ADDR_VALID 0x0080 |
130 | 135 | ||
@@ -237,6 +242,8 @@ static s32 e1000_k1_gig_workaround_hv(struct e1000_hw *hw, bool link); | |||
237 | static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); | 242 | static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw); |
238 | static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); | 243 | static bool e1000_check_mng_mode_ich8lan(struct e1000_hw *hw); |
239 | static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); | 244 | static bool e1000_check_mng_mode_pchlan(struct e1000_hw *hw); |
245 | static s32 e1000_k1_workaround_lv(struct e1000_hw *hw); | ||
246 | static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate); | ||
240 | 247 | ||
241 | static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) | 248 | static inline u16 __er16flash(struct e1000_hw *hw, unsigned long reg) |
242 | { | 249 | { |
@@ -272,7 +279,7 @@ static inline void __ew32flash(struct e1000_hw *hw, unsigned long reg, u32 val) | |||
272 | static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | 279 | static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) |
273 | { | 280 | { |
274 | struct e1000_phy_info *phy = &hw->phy; | 281 | struct e1000_phy_info *phy = &hw->phy; |
275 | u32 ctrl; | 282 | u32 ctrl, fwsm; |
276 | s32 ret_val = 0; | 283 | s32 ret_val = 0; |
277 | 284 | ||
278 | phy->addr = 1; | 285 | phy->addr = 1; |
@@ -294,7 +301,8 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
294 | * disabled, then toggle the LANPHYPC Value bit to force | 301 | * disabled, then toggle the LANPHYPC Value bit to force |
295 | * the interconnect to PCIe mode. | 302 | * the interconnect to PCIe mode. |
296 | */ | 303 | */ |
297 | if (!(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { | 304 | fwsm = er32(FWSM); |
305 | if (!(fwsm & E1000_ICH_FWSM_FW_VALID)) { | ||
298 | ctrl = er32(CTRL); | 306 | ctrl = er32(CTRL); |
299 | ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; | 307 | ctrl |= E1000_CTRL_LANPHYPC_OVERRIDE; |
300 | ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; | 308 | ctrl &= ~E1000_CTRL_LANPHYPC_VALUE; |
@@ -303,6 +311,13 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
303 | ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; | 311 | ctrl &= ~E1000_CTRL_LANPHYPC_OVERRIDE; |
304 | ew32(CTRL, ctrl); | 312 | ew32(CTRL, ctrl); |
305 | msleep(50); | 313 | msleep(50); |
314 | |||
315 | /* | ||
316 | * Gate automatic PHY configuration by hardware on | ||
317 | * non-managed 82579 | ||
318 | */ | ||
319 | if (hw->mac.type == e1000_pch2lan) | ||
320 | e1000_gate_hw_phy_config_ich8lan(hw, true); | ||
306 | } | 321 | } |
307 | 322 | ||
308 | /* | 323 | /* |
@@ -315,6 +330,13 @@ static s32 e1000_init_phy_params_pchlan(struct e1000_hw *hw) | |||
315 | if (ret_val) | 330 | if (ret_val) |
316 | goto out; | 331 | goto out; |
317 | 332 | ||
333 | /* Ungate automatic PHY configuration on non-managed 82579 */ | ||
334 | if ((hw->mac.type == e1000_pch2lan) && | ||
335 | !(fwsm & E1000_ICH_FWSM_FW_VALID)) { | ||
336 | msleep(10); | ||
337 | e1000_gate_hw_phy_config_ich8lan(hw, false); | ||
338 | } | ||
339 | |||
318 | phy->id = e1000_phy_unknown; | 340 | phy->id = e1000_phy_unknown; |
319 | ret_val = e1000e_get_phy_id(hw); | 341 | ret_val = e1000e_get_phy_id(hw); |
320 | if (ret_val) | 342 | if (ret_val) |
@@ -561,13 +583,10 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter) | |||
561 | if (mac->type == e1000_ich8lan) | 583 | if (mac->type == e1000_ich8lan) |
562 | e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true); | 584 | e1000e_set_kmrn_lock_loss_workaround_ich8lan(hw, true); |
563 | 585 | ||
564 | /* Disable PHY configuration by hardware, config by software */ | 586 | /* Gate automatic PHY configuration by hardware on managed 82579 */ |
565 | if (mac->type == e1000_pch2lan) { | 587 | if ((mac->type == e1000_pch2lan) && |
566 | u32 extcnf_ctrl = er32(EXTCNF_CTRL); | 588 | (er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) |
567 | 589 | e1000_gate_hw_phy_config_ich8lan(hw, true); | |
568 | extcnf_ctrl |= E1000_EXTCNF_CTRL_GATE_PHY_CFG; | ||
569 | ew32(EXTCNF_CTRL, extcnf_ctrl); | ||
570 | } | ||
571 | 590 | ||
572 | return 0; | 591 | return 0; |
573 | } | 592 | } |
@@ -652,6 +671,12 @@ static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) | |||
652 | goto out; | 671 | goto out; |
653 | } | 672 | } |
654 | 673 | ||
674 | if (hw->mac.type == e1000_pch2lan) { | ||
675 | ret_val = e1000_k1_workaround_lv(hw); | ||
676 | if (ret_val) | ||
677 | goto out; | ||
678 | } | ||
679 | |||
655 | /* | 680 | /* |
656 | * Check if there was DownShift, must be checked | 681 | * Check if there was DownShift, must be checked |
657 | * immediately after link-up | 682 | * immediately after link-up |
@@ -895,6 +920,34 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) | |||
895 | } | 920 | } |
896 | 921 | ||
897 | /** | 922 | /** |
923 | * e1000_write_smbus_addr - Write SMBus address to PHY needed during Sx states | ||
924 | * @hw: pointer to the HW structure | ||
925 | * | ||
926 | * Assumes semaphore already acquired. | ||
927 | * | ||
928 | **/ | ||
929 | static s32 e1000_write_smbus_addr(struct e1000_hw *hw) | ||
930 | { | ||
931 | u16 phy_data; | ||
932 | u32 strap = er32(STRAP); | ||
933 | s32 ret_val = 0; | ||
934 | |||
935 | strap &= E1000_STRAP_SMBUS_ADDRESS_MASK; | ||
936 | |||
937 | ret_val = e1000_read_phy_reg_hv_locked(hw, HV_SMB_ADDR, &phy_data); | ||
938 | if (ret_val) | ||
939 | goto out; | ||
940 | |||
941 | phy_data &= ~HV_SMB_ADDR_MASK; | ||
942 | phy_data |= (strap >> E1000_STRAP_SMBUS_ADDRESS_SHIFT); | ||
943 | phy_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID; | ||
944 | ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR, phy_data); | ||
945 | |||
946 | out: | ||
947 | return ret_val; | ||
948 | } | ||
949 | |||
950 | /** | ||
898 | * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration | 951 | * e1000_sw_lcd_config_ich8lan - SW-based LCD Configuration |
899 | * @hw: pointer to the HW structure | 952 | * @hw: pointer to the HW structure |
900 | * | 953 | * |
@@ -903,7 +956,6 @@ static s32 e1000_check_reset_block_ich8lan(struct e1000_hw *hw) | |||
903 | **/ | 956 | **/ |
904 | static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) | 957 | static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) |
905 | { | 958 | { |
906 | struct e1000_adapter *adapter = hw->adapter; | ||
907 | struct e1000_phy_info *phy = &hw->phy; | 959 | struct e1000_phy_info *phy = &hw->phy; |
908 | u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask; | 960 | u32 i, data, cnf_size, cnf_base_addr, sw_cfg_mask; |
909 | s32 ret_val = 0; | 961 | s32 ret_val = 0; |
@@ -921,7 +973,8 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) | |||
921 | if (phy->type != e1000_phy_igp_3) | 973 | if (phy->type != e1000_phy_igp_3) |
922 | return ret_val; | 974 | return ret_val; |
923 | 975 | ||
924 | if (adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_AMT) { | 976 | if ((hw->adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_AMT) || |
977 | (hw->adapter->pdev->device == E1000_DEV_ID_ICH8_IGP_C)) { | ||
925 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; | 978 | sw_cfg_mask = E1000_FEXTNVM_SW_CONFIG; |
926 | break; | 979 | break; |
927 | } | 980 | } |
@@ -961,21 +1014,16 @@ static s32 e1000_sw_lcd_config_ich8lan(struct e1000_hw *hw) | |||
961 | cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; | 1014 | cnf_base_addr = data & E1000_EXTCNF_CTRL_EXT_CNF_POINTER_MASK; |
962 | cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; | 1015 | cnf_base_addr >>= E1000_EXTCNF_CTRL_EXT_CNF_POINTER_SHIFT; |
963 | 1016 | ||
964 | if (!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && | 1017 | if ((!(data & E1000_EXTCNF_CTRL_OEM_WRITE_ENABLE) && |
965 | ((hw->mac.type == e1000_pchlan) || | 1018 | (hw->mac.type == e1000_pchlan)) || |
966 | (hw->mac.type == e1000_pch2lan))) { | 1019 | (hw->mac.type == e1000_pch2lan)) { |
967 | /* | 1020 | /* |
968 | * HW configures the SMBus address and LEDs when the | 1021 | * HW configures the SMBus address and LEDs when the |
969 | * OEM and LCD Write Enable bits are set in the NVM. | 1022 | * OEM and LCD Write Enable bits are set in the NVM. |
970 | * When both NVM bits are cleared, SW will configure | 1023 | * When both NVM bits are cleared, SW will configure |
971 | * them instead. | 1024 | * them instead. |
972 | */ | 1025 | */ |
973 | data = er32(STRAP); | 1026 | ret_val = e1000_write_smbus_addr(hw); |
974 | data &= E1000_STRAP_SMBUS_ADDRESS_MASK; | ||
975 | reg_data = data >> E1000_STRAP_SMBUS_ADDRESS_SHIFT; | ||
976 | reg_data |= HV_SMB_ADDR_PEC_EN | HV_SMB_ADDR_VALID; | ||
977 | ret_val = e1000_write_phy_reg_hv_locked(hw, HV_SMB_ADDR, | ||
978 | reg_data); | ||
979 | if (ret_val) | 1027 | if (ret_val) |
980 | goto out; | 1028 | goto out; |
981 | 1029 | ||
@@ -1440,10 +1488,6 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) | |||
1440 | goto out; | 1488 | goto out; |
1441 | 1489 | ||
1442 | /* Enable jumbo frame workaround in the PHY */ | 1490 | /* Enable jumbo frame workaround in the PHY */ |
1443 | e1e_rphy(hw, PHY_REG(769, 20), &data); | ||
1444 | ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14)); | ||
1445 | if (ret_val) | ||
1446 | goto out; | ||
1447 | e1e_rphy(hw, PHY_REG(769, 23), &data); | 1491 | e1e_rphy(hw, PHY_REG(769, 23), &data); |
1448 | data &= ~(0x7F << 5); | 1492 | data &= ~(0x7F << 5); |
1449 | data |= (0x37 << 5); | 1493 | data |= (0x37 << 5); |
@@ -1452,7 +1496,6 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) | |||
1452 | goto out; | 1496 | goto out; |
1453 | e1e_rphy(hw, PHY_REG(769, 16), &data); | 1497 | e1e_rphy(hw, PHY_REG(769, 16), &data); |
1454 | data &= ~(1 << 13); | 1498 | data &= ~(1 << 13); |
1455 | data |= (1 << 12); | ||
1456 | ret_val = e1e_wphy(hw, PHY_REG(769, 16), data); | 1499 | ret_val = e1e_wphy(hw, PHY_REG(769, 16), data); |
1457 | if (ret_val) | 1500 | if (ret_val) |
1458 | goto out; | 1501 | goto out; |
@@ -1477,7 +1520,7 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) | |||
1477 | 1520 | ||
1478 | mac_reg = er32(RCTL); | 1521 | mac_reg = er32(RCTL); |
1479 | mac_reg &= ~E1000_RCTL_SECRC; | 1522 | mac_reg &= ~E1000_RCTL_SECRC; |
1480 | ew32(FFLT_DBG, mac_reg); | 1523 | ew32(RCTL, mac_reg); |
1481 | 1524 | ||
1482 | ret_val = e1000e_read_kmrn_reg(hw, | 1525 | ret_val = e1000e_read_kmrn_reg(hw, |
1483 | E1000_KMRNCTRLSTA_CTRL_OFFSET, | 1526 | E1000_KMRNCTRLSTA_CTRL_OFFSET, |
@@ -1503,17 +1546,12 @@ s32 e1000_lv_jumbo_workaround_ich8lan(struct e1000_hw *hw, bool enable) | |||
1503 | goto out; | 1546 | goto out; |
1504 | 1547 | ||
1505 | /* Write PHY register values back to h/w defaults */ | 1548 | /* Write PHY register values back to h/w defaults */ |
1506 | e1e_rphy(hw, PHY_REG(769, 20), &data); | ||
1507 | ret_val = e1e_wphy(hw, PHY_REG(769, 20), data & ~(1 << 14)); | ||
1508 | if (ret_val) | ||
1509 | goto out; | ||
1510 | e1e_rphy(hw, PHY_REG(769, 23), &data); | 1549 | e1e_rphy(hw, PHY_REG(769, 23), &data); |
1511 | data &= ~(0x7F << 5); | 1550 | data &= ~(0x7F << 5); |
1512 | ret_val = e1e_wphy(hw, PHY_REG(769, 23), data); | 1551 | ret_val = e1e_wphy(hw, PHY_REG(769, 23), data); |
1513 | if (ret_val) | 1552 | if (ret_val) |
1514 | goto out; | 1553 | goto out; |
1515 | e1e_rphy(hw, PHY_REG(769, 16), &data); | 1554 | e1e_rphy(hw, PHY_REG(769, 16), &data); |
1516 | data &= ~(1 << 12); | ||
1517 | data |= (1 << 13); | 1555 | data |= (1 << 13); |
1518 | ret_val = e1e_wphy(hw, PHY_REG(769, 16), data); | 1556 | ret_val = e1e_wphy(hw, PHY_REG(769, 16), data); |
1519 | if (ret_val) | 1557 | if (ret_val) |
@@ -1559,6 +1597,69 @@ out: | |||
1559 | } | 1597 | } |
1560 | 1598 | ||
1561 | /** | 1599 | /** |
1600 | * e1000_k1_gig_workaround_lv - K1 Si workaround | ||
1601 | * @hw: pointer to the HW structure | ||
1602 | * | ||
1603 | * Workaround to set the K1 beacon duration for 82579 parts | ||
1604 | **/ | ||
1605 | static s32 e1000_k1_workaround_lv(struct e1000_hw *hw) | ||
1606 | { | ||
1607 | s32 ret_val = 0; | ||
1608 | u16 status_reg = 0; | ||
1609 | u32 mac_reg; | ||
1610 | |||
1611 | if (hw->mac.type != e1000_pch2lan) | ||
1612 | goto out; | ||
1613 | |||
1614 | /* Set K1 beacon duration based on 1Gbps speed or otherwise */ | ||
1615 | ret_val = e1e_rphy(hw, HV_M_STATUS, &status_reg); | ||
1616 | if (ret_val) | ||
1617 | goto out; | ||
1618 | |||
1619 | if ((status_reg & (HV_M_STATUS_LINK_UP | HV_M_STATUS_AUTONEG_COMPLETE)) | ||
1620 | == (HV_M_STATUS_LINK_UP | HV_M_STATUS_AUTONEG_COMPLETE)) { | ||
1621 | mac_reg = er32(FEXTNVM4); | ||
1622 | mac_reg &= ~E1000_FEXTNVM4_BEACON_DURATION_MASK; | ||
1623 | |||
1624 | if (status_reg & HV_M_STATUS_SPEED_1000) | ||
1625 | mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_8USEC; | ||
1626 | else | ||
1627 | mac_reg |= E1000_FEXTNVM4_BEACON_DURATION_16USEC; | ||
1628 | |||
1629 | ew32(FEXTNVM4, mac_reg); | ||
1630 | } | ||
1631 | |||
1632 | out: | ||
1633 | return ret_val; | ||
1634 | } | ||
1635 | |||
1636 | /** | ||
1637 | * e1000_gate_hw_phy_config_ich8lan - disable PHY config via hardware | ||
1638 | * @hw: pointer to the HW structure | ||
1639 | * @gate: boolean set to true to gate, false to ungate | ||
1640 | * | ||
1641 | * Gate/ungate the automatic PHY configuration via hardware; perform | ||
1642 | * the configuration via software instead. | ||
1643 | **/ | ||
1644 | static void e1000_gate_hw_phy_config_ich8lan(struct e1000_hw *hw, bool gate) | ||
1645 | { | ||
1646 | u32 extcnf_ctrl; | ||
1647 | |||
1648 | if (hw->mac.type != e1000_pch2lan) | ||
1649 | return; | ||
1650 | |||
1651 | extcnf_ctrl = er32(EXTCNF_CTRL); | ||
1652 | |||
1653 | if (gate) | ||
1654 | extcnf_ctrl |= E1000_EXTCNF_CTRL_GATE_PHY_CFG; | ||
1655 | else | ||
1656 | extcnf_ctrl &= ~E1000_EXTCNF_CTRL_GATE_PHY_CFG; | ||
1657 | |||
1658 | ew32(EXTCNF_CTRL, extcnf_ctrl); | ||
1659 | return; | ||
1660 | } | ||
1661 | |||
1662 | /** | ||
1562 | * e1000_lan_init_done_ich8lan - Check for PHY config completion | 1663 | * e1000_lan_init_done_ich8lan - Check for PHY config completion |
1563 | * @hw: pointer to the HW structure | 1664 | * @hw: pointer to the HW structure |
1564 | * | 1665 | * |
@@ -1602,6 +1703,9 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw) | |||
1602 | if (e1000_check_reset_block(hw)) | 1703 | if (e1000_check_reset_block(hw)) |
1603 | goto out; | 1704 | goto out; |
1604 | 1705 | ||
1706 | /* Allow time for h/w to get to quiescent state after reset */ | ||
1707 | msleep(10); | ||
1708 | |||
1605 | /* Perform any necessary post-reset workarounds */ | 1709 | /* Perform any necessary post-reset workarounds */ |
1606 | switch (hw->mac.type) { | 1710 | switch (hw->mac.type) { |
1607 | case e1000_pchlan: | 1711 | case e1000_pchlan: |
@@ -1630,6 +1734,13 @@ static s32 e1000_post_phy_reset_ich8lan(struct e1000_hw *hw) | |||
1630 | /* Configure the LCD with the OEM bits in NVM */ | 1734 | /* Configure the LCD with the OEM bits in NVM */ |
1631 | ret_val = e1000_oem_bits_config_ich8lan(hw, true); | 1735 | ret_val = e1000_oem_bits_config_ich8lan(hw, true); |
1632 | 1736 | ||
1737 | /* Ungate automatic PHY configuration on non-managed 82579 */ | ||
1738 | if ((hw->mac.type == e1000_pch2lan) && | ||
1739 | !(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) { | ||
1740 | msleep(10); | ||
1741 | e1000_gate_hw_phy_config_ich8lan(hw, false); | ||
1742 | } | ||
1743 | |||
1633 | out: | 1744 | out: |
1634 | return ret_val; | 1745 | return ret_val; |
1635 | } | 1746 | } |
@@ -1646,6 +1757,11 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
1646 | { | 1757 | { |
1647 | s32 ret_val = 0; | 1758 | s32 ret_val = 0; |
1648 | 1759 | ||
1760 | /* Gate automatic PHY configuration by hardware on non-managed 82579 */ | ||
1761 | if ((hw->mac.type == e1000_pch2lan) && | ||
1762 | !(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) | ||
1763 | e1000_gate_hw_phy_config_ich8lan(hw, true); | ||
1764 | |||
1649 | ret_val = e1000e_phy_hw_reset_generic(hw); | 1765 | ret_val = e1000e_phy_hw_reset_generic(hw); |
1650 | if (ret_val) | 1766 | if (ret_val) |
1651 | goto out; | 1767 | goto out; |
@@ -2910,6 +3026,14 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2910 | * external PHY is reset. | 3026 | * external PHY is reset. |
2911 | */ | 3027 | */ |
2912 | ctrl |= E1000_CTRL_PHY_RST; | 3028 | ctrl |= E1000_CTRL_PHY_RST; |
3029 | |||
3030 | /* | ||
3031 | * Gate automatic PHY configuration by hardware on | ||
3032 | * non-managed 82579 | ||
3033 | */ | ||
3034 | if ((hw->mac.type == e1000_pch2lan) && | ||
3035 | !(er32(FWSM) & E1000_ICH_FWSM_FW_VALID)) | ||
3036 | e1000_gate_hw_phy_config_ich8lan(hw, true); | ||
2913 | } | 3037 | } |
2914 | ret_val = e1000_acquire_swflag_ich8lan(hw); | 3038 | ret_val = e1000_acquire_swflag_ich8lan(hw); |
2915 | e_dbg("Issuing a global reset to ich8lan\n"); | 3039 | e_dbg("Issuing a global reset to ich8lan\n"); |
@@ -3460,13 +3584,20 @@ void e1000e_gig_downshift_workaround_ich8lan(struct e1000_hw *hw) | |||
3460 | void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw) | 3584 | void e1000e_disable_gig_wol_ich8lan(struct e1000_hw *hw) |
3461 | { | 3585 | { |
3462 | u32 phy_ctrl; | 3586 | u32 phy_ctrl; |
3587 | s32 ret_val; | ||
3463 | 3588 | ||
3464 | phy_ctrl = er32(PHY_CTRL); | 3589 | phy_ctrl = er32(PHY_CTRL); |
3465 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | E1000_PHY_CTRL_GBE_DISABLE; | 3590 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU | E1000_PHY_CTRL_GBE_DISABLE; |
3466 | ew32(PHY_CTRL, phy_ctrl); | 3591 | ew32(PHY_CTRL, phy_ctrl); |
3467 | 3592 | ||
3468 | if (hw->mac.type >= e1000_pchlan) | 3593 | if (hw->mac.type >= e1000_pchlan) { |
3469 | e1000_phy_hw_reset_ich8lan(hw); | 3594 | e1000_oem_bits_config_ich8lan(hw, true); |
3595 | ret_val = hw->phy.ops.acquire(hw); | ||
3596 | if (ret_val) | ||
3597 | return; | ||
3598 | e1000_write_smbus_addr(hw); | ||
3599 | hw->phy.ops.release(hw); | ||
3600 | } | ||
3470 | } | 3601 | } |
3471 | 3602 | ||
3472 | /** | 3603 | /** |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index df4a27922931..0fd4eb5ac5fb 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -183,6 +183,16 @@ s32 e1000_check_alt_mac_addr_generic(struct e1000_hw *hw) | |||
183 | u16 offset, nvm_alt_mac_addr_offset, nvm_data; | 183 | u16 offset, nvm_alt_mac_addr_offset, nvm_data; |
184 | u8 alt_mac_addr[ETH_ALEN]; | 184 | u8 alt_mac_addr[ETH_ALEN]; |
185 | 185 | ||
186 | ret_val = e1000_read_nvm(hw, NVM_COMPAT, 1, &nvm_data); | ||
187 | if (ret_val) | ||
188 | goto out; | ||
189 | |||
190 | /* Check for LOM (vs. NIC) or one of two valid mezzanine cards */ | ||
191 | if (!((nvm_data & NVM_COMPAT_LOM) || | ||
192 | (hw->adapter->pdev->device == E1000_DEV_ID_82571EB_SERDES_DUAL) || | ||
193 | (hw->adapter->pdev->device == E1000_DEV_ID_82571EB_SERDES_QUAD))) | ||
194 | goto out; | ||
195 | |||
186 | ret_val = e1000_read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1, | 196 | ret_val = e1000_read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1, |
187 | &nvm_alt_mac_addr_offset); | 197 | &nvm_alt_mac_addr_offset); |
188 | if (ret_val) { | 198 | if (ret_val) { |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index c3dd590d87b2..e561d15c3eb1 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -2704,6 +2704,16 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
2704 | u32 psrctl = 0; | 2704 | u32 psrctl = 0; |
2705 | u32 pages = 0; | 2705 | u32 pages = 0; |
2706 | 2706 | ||
2707 | /* Workaround Si errata on 82579 - configure jumbo frame flow */ | ||
2708 | if (hw->mac.type == e1000_pch2lan) { | ||
2709 | s32 ret_val; | ||
2710 | |||
2711 | if (adapter->netdev->mtu > ETH_DATA_LEN) | ||
2712 | ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, true); | ||
2713 | else | ||
2714 | ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, false); | ||
2715 | } | ||
2716 | |||
2707 | /* Program MC offset vector base */ | 2717 | /* Program MC offset vector base */ |
2708 | rctl = er32(RCTL); | 2718 | rctl = er32(RCTL); |
2709 | rctl &= ~(3 << E1000_RCTL_MO_SHIFT); | 2719 | rctl &= ~(3 << E1000_RCTL_MO_SHIFT); |
@@ -2744,16 +2754,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter) | |||
2744 | e1e_wphy(hw, 22, phy_data); | 2754 | e1e_wphy(hw, 22, phy_data); |
2745 | } | 2755 | } |
2746 | 2756 | ||
2747 | /* Workaround Si errata on 82579 - configure jumbo frame flow */ | ||
2748 | if (hw->mac.type == e1000_pch2lan) { | ||
2749 | s32 ret_val; | ||
2750 | |||
2751 | if (rctl & E1000_RCTL_LPE) | ||
2752 | ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, true); | ||
2753 | else | ||
2754 | ret_val = e1000_lv_jumbo_workaround_ich8lan(hw, false); | ||
2755 | } | ||
2756 | |||
2757 | /* Setup buffer sizes */ | 2757 | /* Setup buffer sizes */ |
2758 | rctl &= ~E1000_RCTL_SZ_4096; | 2758 | rctl &= ~E1000_RCTL_SZ_4096; |
2759 | rctl |= E1000_RCTL_BSEX; | 2759 | rctl |= E1000_RCTL_BSEX; |
@@ -4833,6 +4833,15 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
4833 | return -EINVAL; | 4833 | return -EINVAL; |
4834 | } | 4834 | } |
4835 | 4835 | ||
4836 | /* Jumbo frame workaround on 82579 requires CRC be stripped */ | ||
4837 | if ((adapter->hw.mac.type == e1000_pch2lan) && | ||
4838 | !(adapter->flags2 & FLAG2_CRC_STRIPPING) && | ||
4839 | (new_mtu > ETH_DATA_LEN)) { | ||
4840 | e_err("Jumbo Frames not supported on 82579 when CRC " | ||
4841 | "stripping is disabled.\n"); | ||
4842 | return -EINVAL; | ||
4843 | } | ||
4844 | |||
4836 | /* 82573 Errata 17 */ | 4845 | /* 82573 Errata 17 */ |
4837 | if (((adapter->hw.mac.type == e1000_82573) || | 4846 | if (((adapter->hw.mac.type == e1000_82573) || |
4838 | (adapter->hw.mac.type == e1000_82574)) && | 4847 | (adapter->hw.mac.type == e1000_82574)) && |
@@ -5829,11 +5838,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
5829 | 5838 | ||
5830 | e1000_print_device_info(adapter); | 5839 | e1000_print_device_info(adapter); |
5831 | 5840 | ||
5832 | if (pci_dev_run_wake(pdev)) { | 5841 | if (pci_dev_run_wake(pdev)) |
5833 | pm_runtime_set_active(&pdev->dev); | 5842 | pm_runtime_put_noidle(&pdev->dev); |
5834 | pm_runtime_enable(&pdev->dev); | ||
5835 | } | ||
5836 | pm_schedule_suspend(&pdev->dev, MSEC_PER_SEC); | ||
5837 | 5843 | ||
5838 | return 0; | 5844 | return 0; |
5839 | 5845 | ||
@@ -5879,8 +5885,6 @@ static void __devexit e1000_remove(struct pci_dev *pdev) | |||
5879 | struct e1000_adapter *adapter = netdev_priv(netdev); | 5885 | struct e1000_adapter *adapter = netdev_priv(netdev); |
5880 | bool down = test_bit(__E1000_DOWN, &adapter->state); | 5886 | bool down = test_bit(__E1000_DOWN, &adapter->state); |
5881 | 5887 | ||
5882 | pm_runtime_get_sync(&pdev->dev); | ||
5883 | |||
5884 | /* | 5888 | /* |
5885 | * flush_scheduled work may reschedule our watchdog task, so | 5889 | * flush_scheduled work may reschedule our watchdog task, so |
5886 | * explicitly disable watchdog tasks from being rescheduled | 5890 | * explicitly disable watchdog tasks from being rescheduled |
@@ -5905,11 +5909,8 @@ static void __devexit e1000_remove(struct pci_dev *pdev) | |||
5905 | clear_bit(__E1000_DOWN, &adapter->state); | 5909 | clear_bit(__E1000_DOWN, &adapter->state); |
5906 | unregister_netdev(netdev); | 5910 | unregister_netdev(netdev); |
5907 | 5911 | ||
5908 | if (pci_dev_run_wake(pdev)) { | 5912 | if (pci_dev_run_wake(pdev)) |
5909 | pm_runtime_disable(&pdev->dev); | 5913 | pm_runtime_get_noresume(&pdev->dev); |
5910 | pm_runtime_set_suspended(&pdev->dev); | ||
5911 | } | ||
5912 | pm_runtime_put_noidle(&pdev->dev); | ||
5913 | 5914 | ||
5914 | /* | 5915 | /* |
5915 | * Release control of h/w to f/w. If f/w is AMT enabled, this | 5916 | * 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 0060e422f171..1846623c6ae6 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #include <asm/io.h> | 40 | #include <asm/io.h> |
41 | 41 | ||
42 | #define DRV_NAME "ehea" | 42 | #define DRV_NAME "ehea" |
43 | #define DRV_VERSION "EHEA_0105" | 43 | #define DRV_VERSION "EHEA_0106" |
44 | 44 | ||
45 | /* eHEA capability flags */ | 45 | /* eHEA capability flags */ |
46 | #define DLPAR_PORT_ADD_REM 1 | 46 | #define DLPAR_PORT_ADD_REM 1 |
@@ -400,6 +400,7 @@ struct ehea_port_res { | |||
400 | u32 poll_counter; | 400 | u32 poll_counter; |
401 | struct net_lro_mgr lro_mgr; | 401 | struct net_lro_mgr lro_mgr; |
402 | struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS]; | 402 | struct net_lro_desc lro_desc[MAX_LRO_DESCRIPTORS]; |
403 | int sq_restart_flag; | ||
403 | }; | 404 | }; |
404 | 405 | ||
405 | 406 | ||
@@ -413,7 +414,7 @@ struct ehea_port_res { | |||
413 | 414 | ||
414 | struct ehea_adapter { | 415 | struct ehea_adapter { |
415 | u64 handle; | 416 | u64 handle; |
416 | struct of_device *ofdev; | 417 | struct platform_device *ofdev; |
417 | struct ehea_port *port[EHEA_MAX_PORTS]; | 418 | struct ehea_port *port[EHEA_MAX_PORTS]; |
418 | struct ehea_eq *neq; /* notification event queue */ | 419 | struct ehea_eq *neq; /* notification event queue */ |
419 | struct tasklet_struct neq_tasklet; | 420 | struct tasklet_struct neq_tasklet; |
@@ -465,7 +466,7 @@ struct ehea_port { | |||
465 | struct net_device *netdev; | 466 | struct net_device *netdev; |
466 | struct net_device_stats stats; | 467 | struct net_device_stats stats; |
467 | struct ehea_port_res port_res[EHEA_MAX_PORT_RES]; | 468 | struct ehea_port_res port_res[EHEA_MAX_PORT_RES]; |
468 | struct of_device ofdev; /* Open Firmware Device */ | 469 | struct platform_device ofdev; /* Open Firmware Device */ |
469 | struct ehea_mc_list *mc_list; /* Multicast MAC addresses */ | 470 | struct ehea_mc_list *mc_list; /* Multicast MAC addresses */ |
470 | struct vlan_group *vgrp; | 471 | struct vlan_group *vgrp; |
471 | 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 3beba70b7dea..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; | |||
107 | struct ehea_bcmc_reg_array ehea_bcmc_regs; | 107 | struct ehea_bcmc_reg_array ehea_bcmc_regs; |
108 | 108 | ||
109 | 109 | ||
110 | static int __devinit ehea_probe_adapter(struct of_device *dev, | 110 | static 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 | ||
113 | static int __devexit ehea_remove(struct of_device *dev); | 113 | static int __devexit ehea_remove(struct platform_device *dev); |
114 | 114 | ||
115 | static struct of_device_id ehea_device_table[] = { | 115 | static struct of_device_id ehea_device_table[] = { |
116 | { | 116 | { |
@@ -776,6 +776,53 @@ static int ehea_proc_rwqes(struct net_device *dev, | |||
776 | return processed; | 776 | return processed; |
777 | } | 777 | } |
778 | 778 | ||
779 | #define SWQE_RESTART_CHECK 0xdeadbeaff00d0000ull | ||
780 | |||
781 | static void reset_sq_restart_flag(struct ehea_port *port) | ||
782 | { | ||
783 | int i; | ||
784 | |||
785 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { | ||
786 | struct ehea_port_res *pr = &port->port_res[i]; | ||
787 | pr->sq_restart_flag = 0; | ||
788 | } | ||
789 | } | ||
790 | |||
791 | static void check_sqs(struct ehea_port *port) | ||
792 | { | ||
793 | struct ehea_swqe *swqe; | ||
794 | int swqe_index; | ||
795 | int i, k; | ||
796 | |||
797 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { | ||
798 | struct ehea_port_res *pr = &port->port_res[i]; | ||
799 | k = 0; | ||
800 | swqe = ehea_get_swqe(pr->qp, &swqe_index); | ||
801 | memset(swqe, 0, SWQE_HEADER_SIZE); | ||
802 | atomic_dec(&pr->swqe_avail); | ||
803 | |||
804 | swqe->tx_control |= EHEA_SWQE_PURGE; | ||
805 | swqe->wr_id = SWQE_RESTART_CHECK; | ||
806 | swqe->tx_control |= EHEA_SWQE_SIGNALLED_COMPLETION; | ||
807 | swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT; | ||
808 | swqe->immediate_data_length = 80; | ||
809 | |||
810 | ehea_post_swqe(pr->qp, swqe); | ||
811 | |||
812 | while (pr->sq_restart_flag == 0) { | ||
813 | msleep(5); | ||
814 | if (++k == 100) { | ||
815 | ehea_error("HW/SW queues out of sync"); | ||
816 | ehea_schedule_port_reset(pr->port); | ||
817 | return; | ||
818 | } | ||
819 | } | ||
820 | } | ||
821 | |||
822 | return; | ||
823 | } | ||
824 | |||
825 | |||
779 | static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) | 826 | static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) |
780 | { | 827 | { |
781 | struct sk_buff *skb; | 828 | struct sk_buff *skb; |
@@ -793,6 +840,13 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) | |||
793 | 840 | ||
794 | cqe_counter++; | 841 | cqe_counter++; |
795 | rmb(); | 842 | rmb(); |
843 | |||
844 | if (cqe->wr_id == SWQE_RESTART_CHECK) { | ||
845 | pr->sq_restart_flag = 1; | ||
846 | swqe_av++; | ||
847 | break; | ||
848 | } | ||
849 | |||
796 | if (cqe->status & EHEA_CQE_STAT_ERR_MASK) { | 850 | if (cqe->status & EHEA_CQE_STAT_ERR_MASK) { |
797 | ehea_error("Bad send completion status=0x%04X", | 851 | ehea_error("Bad send completion status=0x%04X", |
798 | cqe->status); | 852 | cqe->status); |
@@ -2675,8 +2729,10 @@ static void ehea_flush_sq(struct ehea_port *port) | |||
2675 | int k = 0; | 2729 | int k = 0; |
2676 | while (atomic_read(&pr->swqe_avail) < swqe_max) { | 2730 | while (atomic_read(&pr->swqe_avail) < swqe_max) { |
2677 | msleep(5); | 2731 | msleep(5); |
2678 | if (++k == 20) | 2732 | if (++k == 20) { |
2733 | ehea_error("WARNING: sq not flushed completely"); | ||
2679 | break; | 2734 | break; |
2735 | } | ||
2680 | } | 2736 | } |
2681 | } | 2737 | } |
2682 | } | 2738 | } |
@@ -2917,6 +2973,7 @@ static void ehea_rereg_mrs(struct work_struct *work) | |||
2917 | port_napi_disable(port); | 2973 | port_napi_disable(port); |
2918 | mutex_unlock(&port->port_lock); | 2974 | mutex_unlock(&port->port_lock); |
2919 | } | 2975 | } |
2976 | reset_sq_restart_flag(port); | ||
2920 | } | 2977 | } |
2921 | 2978 | ||
2922 | /* Unregister old memory region */ | 2979 | /* Unregister old memory region */ |
@@ -2951,6 +3008,7 @@ static void ehea_rereg_mrs(struct work_struct *work) | |||
2951 | mutex_lock(&port->port_lock); | 3008 | mutex_lock(&port->port_lock); |
2952 | port_napi_enable(port); | 3009 | port_napi_enable(port); |
2953 | ret = ehea_restart_qps(dev); | 3010 | ret = ehea_restart_qps(dev); |
3011 | check_sqs(port); | ||
2954 | if (!ret) | 3012 | if (!ret) |
2955 | netif_wake_queue(dev); | 3013 | netif_wake_queue(dev); |
2956 | mutex_unlock(&port->port_lock); | 3014 | mutex_unlock(&port->port_lock); |
@@ -3376,7 +3434,7 @@ static ssize_t ehea_remove_port(struct device *dev, | |||
3376 | static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); | 3434 | static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); |
3377 | static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); | 3435 | static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); |
3378 | 3436 | ||
3379 | int ehea_create_device_sysfs(struct of_device *dev) | 3437 | int ehea_create_device_sysfs(struct platform_device *dev) |
3380 | { | 3438 | { |
3381 | int ret = device_create_file(&dev->dev, &dev_attr_probe_port); | 3439 | int ret = device_create_file(&dev->dev, &dev_attr_probe_port); |
3382 | if (ret) | 3440 | if (ret) |
@@ -3387,13 +3445,13 @@ out: | |||
3387 | return ret; | 3445 | return ret; |
3388 | } | 3446 | } |
3389 | 3447 | ||
3390 | void ehea_remove_device_sysfs(struct of_device *dev) | 3448 | void ehea_remove_device_sysfs(struct platform_device *dev) |
3391 | { | 3449 | { |
3392 | device_remove_file(&dev->dev, &dev_attr_probe_port); | 3450 | device_remove_file(&dev->dev, &dev_attr_probe_port); |
3393 | device_remove_file(&dev->dev, &dev_attr_remove_port); | 3451 | device_remove_file(&dev->dev, &dev_attr_remove_port); |
3394 | } | 3452 | } |
3395 | 3453 | ||
3396 | static int __devinit ehea_probe_adapter(struct of_device *dev, | 3454 | static int __devinit ehea_probe_adapter(struct platform_device *dev, |
3397 | const struct of_device_id *id) | 3455 | const struct of_device_id *id) |
3398 | { | 3456 | { |
3399 | struct ehea_adapter *adapter; | 3457 | struct ehea_adapter *adapter; |
@@ -3492,7 +3550,7 @@ out: | |||
3492 | return ret; | 3550 | return ret; |
3493 | } | 3551 | } |
3494 | 3552 | ||
3495 | static int __devexit ehea_remove(struct of_device *dev) | 3553 | static int __devexit ehea_remove(struct platform_device *dev) |
3496 | { | 3554 | { |
3497 | struct ehea_adapter *adapter = dev_get_drvdata(&dev->dev); | 3555 | struct ehea_adapter *adapter = dev_get_drvdata(&dev->dev); |
3498 | int i; | 3556 | int i; |
diff --git a/drivers/net/eql.c b/drivers/net/eql.c index dda2c7944da9..0cb1cf9cf4b0 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c | |||
@@ -555,6 +555,8 @@ static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mcp) | |||
555 | equalizer_t *eql; | 555 | equalizer_t *eql; |
556 | master_config_t mc; | 556 | master_config_t mc; |
557 | 557 | ||
558 | memset(&mc, 0, sizeof(master_config_t)); | ||
559 | |||
558 | if (eql_is_master(dev)) { | 560 | if (eql_is_master(dev)) { |
559 | eql = netdev_priv(dev); | 561 | eql = netdev_priv(dev); |
560 | mc.max_slaves = eql->max_slaves; | 562 | mc.max_slaves = eql->max_slaves; |
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 | ||
852 | static int __devinit | 852 | static int __devinit |
853 | mpc52xx_fec_probe(struct of_device *op, const struct of_device_id *match) | 853 | mpc52xx_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 | ||
997 | static int | 997 | static int |
998 | mpc52xx_fec_remove(struct of_device *op) | 998 | mpc52xx_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 |
1028 | static int mpc52xx_fec_of_suspend(struct of_device *op, pm_message_t state) | 1028 | static 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 | ||
1038 | static int mpc52xx_fec_of_resume(struct of_device *op) | 1038 | static 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 | ||
64 | static int mpc52xx_fec_mdio_probe(struct of_device *of, | 64 | static 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 | ||
125 | static int mpc52xx_fec_mdio_remove(struct of_device *of) | 125 | static 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 | ||
1000 | static int __devinit fs_enet_probe(struct of_device *ofdev, | 1000 | static 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 | ||
1108 | static int fs_enet_remove(struct of_device *ofdev) | 1108 | static 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 | ||
85 | static int do_pd_setup(struct fs_enet_private *fep) | 85 | static 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 | ||
97 | static int do_pd_setup(struct fs_enet_private *fep) | 97 | static 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 | ||
97 | static int do_pd_setup(struct fs_enet_private *fep) | 97 | static 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 | ||
153 | static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, | 153 | static 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 | ||
203 | static int fs_enet_mdio_remove(struct of_device *ofdev) | 203 | static 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 | ||
104 | static int __devinit fs_enet_mdio_probe(struct of_device *ofdev, | 104 | static 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 | ||
195 | static int fs_enet_mdio_remove(struct of_device *ofdev) | 195 | static 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 | ||
267 | static int fsl_pq_mdio_probe(struct of_device *ofdev, | 268 | static 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 | ||
427 | static int fsl_pq_mdio_remove(struct of_device *ofdev) | 428 | static 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); | |||
122 | static void adjust_link(struct net_device *dev); | 122 | static void adjust_link(struct net_device *dev); |
123 | static void init_registers(struct net_device *dev); | 123 | static void init_registers(struct net_device *dev); |
124 | static int init_phy(struct net_device *dev); | 124 | static int init_phy(struct net_device *dev); |
125 | static int gfar_probe(struct of_device *ofdev, | 125 | static int gfar_probe(struct platform_device *ofdev, |
126 | const struct of_device_id *match); | 126 | const struct of_device_id *match); |
127 | static int gfar_remove(struct of_device *ofdev); | 127 | static int gfar_remove(struct platform_device *ofdev); |
128 | static void free_skb_resources(struct gfar_private *priv); | 128 | static void free_skb_resources(struct gfar_private *priv); |
129 | static void gfar_set_multi(struct net_device *dev); | 129 | static void gfar_set_multi(struct net_device *dev); |
130 | static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr); | 130 | static 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 | ||
608 | static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev) | 608 | static 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 */ |
962 | static int gfar_probe(struct of_device *ofdev, | 962 | static 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 | ||
1241 | static int gfar_remove(struct of_device *ofdev) | 1241 | static 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 */ |
1376 | static int __devinit greth_of_probe(struct of_device *ofdev, const struct of_device_id *match) | 1376 | static 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 | ||
1575 | static int __devexit greth_of_remove(struct of_device *of_dev) | 1575 | static 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..519e19e23955 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) | |||
2245 | struct emac_depentry { | 2245 | struct 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 | ||
2722 | static int __devinit emac_probe(struct of_device *ofdev, | 2722 | static 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; |
@@ -2928,7 +2928,7 @@ static int __devinit emac_probe(struct of_device *ofdev, | |||
2928 | if (dev->emac_irq != NO_IRQ) | 2928 | if (dev->emac_irq != NO_IRQ) |
2929 | irq_dispose_mapping(dev->emac_irq); | 2929 | irq_dispose_mapping(dev->emac_irq); |
2930 | err_free: | 2930 | err_free: |
2931 | kfree(ndev); | 2931 | free_netdev(ndev); |
2932 | err_gone: | 2932 | err_gone: |
2933 | /* if we were on the bootlist, remove us as we won't show up and | 2933 | /* if we were on the bootlist, remove us as we won't show up and |
2934 | * wake up all waiters to notify them in case they were waiting | 2934 | * wake up all waiters to notify them in case they were waiting |
@@ -2941,7 +2941,7 @@ static int __devinit emac_probe(struct of_device *ofdev, | |||
2941 | return err; | 2941 | return err; |
2942 | } | 2942 | } |
2943 | 2943 | ||
2944 | static int __devexit emac_remove(struct of_device *ofdev) | 2944 | static 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 | ||
@@ -2971,7 +2971,7 @@ static int __devexit emac_remove(struct of_device *ofdev) | |||
2971 | if (dev->emac_irq != NO_IRQ) | 2971 | if (dev->emac_irq != NO_IRQ) |
2972 | irq_dispose_mapping(dev->emac_irq); | 2972 | irq_dispose_mapping(dev->emac_irq); |
2973 | 2973 | ||
2974 | kfree(dev->ndev); | 2974 | free_netdev(dev->ndev); |
2975 | 2975 | ||
2976 | return 0; | 2976 | return 0; |
2977 | } | 2977 | } |
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) |
241 | static void emac_sysrq_handler(int key, struct tty_struct *tty) | 241 | static 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 | ||
520 | static int __devinit mal_probe(struct of_device *ofdev, | 520 | static 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 | ||
733 | static int __devexit mal_remove(struct of_device *ofdev) | 733 | static 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 | ||
96 | int __devinit rgmii_attach(struct of_device *ofdev, int input, int mode) | 96 | int __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 | ||
125 | void rgmii_set_speed(struct of_device *ofdev, int input, int speed) | 125 | void 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 | ||
147 | void rgmii_get_mdio(struct of_device *ofdev, int input) | 147 | void 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 | ||
168 | void rgmii_put_mdio(struct of_device *ofdev, int input) | 168 | void 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 | ||
189 | void rgmii_detach(struct of_device *ofdev, int input) | 189 | void 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 | ||
209 | int rgmii_get_regs_len(struct of_device *ofdev) | 209 | int 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 | ||
215 | void *rgmii_dump_regs(struct of_device *ofdev, void *buf) | 215 | void *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 | ||
231 | static int __devinit rgmii_probe(struct of_device *ofdev, | 231 | static 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 | ||
296 | static int __devexit rgmii_remove(struct of_device *ofdev) | 296 | static 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 | ||
59 | extern int rgmii_init(void); | 59 | extern int rgmii_init(void); |
60 | extern void rgmii_exit(void); | 60 | extern void rgmii_exit(void); |
61 | extern int rgmii_attach(struct of_device *ofdev, int input, int mode); | 61 | extern int rgmii_attach(struct platform_device *ofdev, int input, int mode); |
62 | extern void rgmii_detach(struct of_device *ofdev, int input); | 62 | extern void rgmii_detach(struct platform_device *ofdev, int input); |
63 | extern void rgmii_get_mdio(struct of_device *ofdev, int input); | 63 | extern void rgmii_get_mdio(struct platform_device *ofdev, int input); |
64 | extern void rgmii_put_mdio(struct of_device *ofdev, int input); | 64 | extern void rgmii_put_mdio(struct platform_device *ofdev, int input); |
65 | extern void rgmii_set_speed(struct of_device *ofdev, int input, int speed); | 65 | extern void rgmii_set_speed(struct platform_device *ofdev, int input, int speed); |
66 | extern int rgmii_get_regs_len(struct of_device *ofdev); | 66 | extern int rgmii_get_regs_len(struct platform_device *ofdev); |
67 | extern void *rgmii_dump_regs(struct of_device *ofdev, void *buf); | 67 | extern 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 | ||
26 | int __devinit tah_attach(struct of_device *ofdev, int channel) | 26 | int __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 | ||
38 | void tah_detach(struct of_device *ofdev, int channel) | 38 | void 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 | ||
47 | void tah_reset(struct of_device *ofdev) | 47 | void 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 | ||
69 | int tah_get_regs_len(struct of_device *ofdev) | 69 | int 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 | ||
75 | void *tah_dump_regs(struct of_device *ofdev, void *buf) | 75 | void *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 | ||
90 | static int __devinit tah_probe(struct of_device *ofdev, | 90 | static 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 | ||
142 | static int __devexit tah_remove(struct of_device *ofdev) | 142 | static 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 | ||
75 | extern int tah_init(void); | 75 | extern int tah_init(void); |
76 | extern void tah_exit(void); | 76 | extern void tah_exit(void); |
77 | extern int tah_attach(struct of_device *ofdev, int channel); | 77 | extern int tah_attach(struct platform_device *ofdev, int channel); |
78 | extern void tah_detach(struct of_device *ofdev, int channel); | 78 | extern void tah_detach(struct platform_device *ofdev, int channel); |
79 | extern void tah_reset(struct of_device *ofdev); | 79 | extern void tah_reset(struct platform_device *ofdev); |
80 | extern int tah_get_regs_len(struct of_device *ofdev); | 80 | extern int tah_get_regs_len(struct platform_device *ofdev); |
81 | extern void *tah_dump_regs(struct of_device *ofdev, void *buf); | 81 | extern 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 | ||
85 | int __devinit zmii_attach(struct of_device *ofdev, int input, int *mode) | 85 | int __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 | ||
151 | void zmii_get_mdio(struct of_device *ofdev, int input) | 151 | void 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 | ||
164 | void zmii_put_mdio(struct of_device *ofdev, int input) | 164 | void 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 | ||
173 | void zmii_set_speed(struct of_device *ofdev, int input, int speed) | 173 | void 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 | ||
194 | void zmii_detach(struct of_device *ofdev, int input) | 194 | void 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 | ||
213 | int zmii_get_regs_len(struct of_device *ofdev) | 213 | int 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 | ||
219 | void *zmii_dump_regs(struct of_device *ofdev, void *buf) | 219 | void *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 | ||
234 | static int __devinit zmii_probe(struct of_device *ofdev, | 234 | static 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 | ||
289 | static int __devexit zmii_remove(struct of_device *ofdev) | 289 | static 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 | ||
56 | extern int zmii_init(void); | 56 | extern int zmii_init(void); |
57 | extern void zmii_exit(void); | 57 | extern void zmii_exit(void); |
58 | extern int zmii_attach(struct of_device *ofdev, int input, int *mode); | 58 | extern int zmii_attach(struct platform_device *ofdev, int input, int *mode); |
59 | extern void zmii_detach(struct of_device *ofdev, int input); | 59 | extern void zmii_detach(struct platform_device *ofdev, int input); |
60 | extern void zmii_get_mdio(struct of_device *ofdev, int input); | 60 | extern void zmii_get_mdio(struct platform_device *ofdev, int input); |
61 | extern void zmii_put_mdio(struct of_device *ofdev, int input); | 61 | extern void zmii_put_mdio(struct platform_device *ofdev, int input); |
62 | extern void zmii_set_speed(struct of_device *ofdev, int input, int speed); | 62 | extern void zmii_set_speed(struct platform_device *ofdev, int input, int speed); |
63 | extern int zmii_get_regs_len(struct of_device *ocpdev); | 63 | extern int zmii_get_regs_len(struct platform_device *ocpdev); |
64 | extern void *zmii_dump_regs(struct of_device *ofdev, void *buf); | 64 | extern 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/ibmveth.c b/drivers/net/ibmveth.c index 2602852cc55a..4734c939ad03 100644 --- a/drivers/net/ibmveth.c +++ b/drivers/net/ibmveth.c | |||
@@ -1113,7 +1113,8 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu) | |||
1113 | struct ibmveth_adapter *adapter = netdev_priv(dev); | 1113 | struct ibmveth_adapter *adapter = netdev_priv(dev); |
1114 | struct vio_dev *viodev = adapter->vdev; | 1114 | struct vio_dev *viodev = adapter->vdev; |
1115 | int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; | 1115 | int new_mtu_oh = new_mtu + IBMVETH_BUFF_OH; |
1116 | int i; | 1116 | int i, rc; |
1117 | int need_restart = 0; | ||
1117 | 1118 | ||
1118 | if (new_mtu < IBMVETH_MAX_MTU) | 1119 | if (new_mtu < IBMVETH_MAX_MTU) |
1119 | return -EINVAL; | 1120 | return -EINVAL; |
@@ -1127,35 +1128,32 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu) | |||
1127 | 1128 | ||
1128 | /* Deactivate all the buffer pools so that the next loop can activate | 1129 | /* Deactivate all the buffer pools so that the next loop can activate |
1129 | only the buffer pools necessary to hold the new MTU */ | 1130 | only the buffer pools necessary to hold the new MTU */ |
1130 | for (i = 0; i < IbmVethNumBufferPools; i++) | 1131 | if (netif_running(adapter->netdev)) { |
1131 | if (adapter->rx_buff_pool[i].active) { | 1132 | need_restart = 1; |
1132 | ibmveth_free_buffer_pool(adapter, | 1133 | adapter->pool_config = 1; |
1133 | &adapter->rx_buff_pool[i]); | 1134 | ibmveth_close(adapter->netdev); |
1134 | adapter->rx_buff_pool[i].active = 0; | 1135 | adapter->pool_config = 0; |
1135 | } | 1136 | } |
1136 | 1137 | ||
1137 | /* Look for an active buffer pool that can hold the new MTU */ | 1138 | /* Look for an active buffer pool that can hold the new MTU */ |
1138 | for(i = 0; i<IbmVethNumBufferPools; i++) { | 1139 | for(i = 0; i<IbmVethNumBufferPools; i++) { |
1139 | adapter->rx_buff_pool[i].active = 1; | 1140 | adapter->rx_buff_pool[i].active = 1; |
1140 | 1141 | ||
1141 | if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { | 1142 | if (new_mtu_oh < adapter->rx_buff_pool[i].buff_size) { |
1142 | if (netif_running(adapter->netdev)) { | ||
1143 | adapter->pool_config = 1; | ||
1144 | ibmveth_close(adapter->netdev); | ||
1145 | adapter->pool_config = 0; | ||
1146 | dev->mtu = new_mtu; | ||
1147 | vio_cmo_set_dev_desired(viodev, | ||
1148 | ibmveth_get_desired_dma | ||
1149 | (viodev)); | ||
1150 | return ibmveth_open(adapter->netdev); | ||
1151 | } | ||
1152 | dev->mtu = new_mtu; | 1143 | dev->mtu = new_mtu; |
1153 | vio_cmo_set_dev_desired(viodev, | 1144 | vio_cmo_set_dev_desired(viodev, |
1154 | ibmveth_get_desired_dma | 1145 | ibmveth_get_desired_dma |
1155 | (viodev)); | 1146 | (viodev)); |
1147 | if (need_restart) { | ||
1148 | return ibmveth_open(adapter->netdev); | ||
1149 | } | ||
1156 | return 0; | 1150 | return 0; |
1157 | } | 1151 | } |
1158 | } | 1152 | } |
1153 | |||
1154 | if (need_restart && (rc = ibmveth_open(adapter->netdev))) | ||
1155 | return rc; | ||
1156 | |||
1159 | return -EINVAL; | 1157 | return -EINVAL; |
1160 | } | 1158 | } |
1161 | 1159 | ||
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/ks8851.c b/drivers/net/ks8851.c index b4fb07a6f13f..51919fcd50c2 100644 --- a/drivers/net/ks8851.c +++ b/drivers/net/ks8851.c | |||
@@ -503,30 +503,33 @@ static void ks8851_rx_pkts(struct ks8851_net *ks) | |||
503 | ks8851_wrreg16(ks, KS_RXQCR, | 503 | ks8851_wrreg16(ks, KS_RXQCR, |
504 | ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE); | 504 | ks->rc_rxqcr | RXQCR_SDA | RXQCR_ADRFE); |
505 | 505 | ||
506 | if (rxlen > 0) { | 506 | if (rxlen > 4) { |
507 | skb = netdev_alloc_skb(ks->netdev, rxlen + 2 + 8); | 507 | unsigned int rxalign; |
508 | if (!skb) { | 508 | |
509 | /* todo - dump frame and move on */ | 509 | rxlen -= 4; |
510 | } | 510 | rxalign = ALIGN(rxlen, 4); |
511 | skb = netdev_alloc_skb_ip_align(ks->netdev, rxalign); | ||
512 | if (skb) { | ||
511 | 513 | ||
512 | /* two bytes to ensure ip is aligned, and four bytes | 514 | /* 4 bytes of status header + 4 bytes of |
513 | * for the status header and 4 bytes of garbage */ | 515 | * garbage: we put them before ethernet |
514 | skb_reserve(skb, 2 + 4 + 4); | 516 | * header, so that they are copied, |
517 | * but ignored. | ||
518 | */ | ||
515 | 519 | ||
516 | rxpkt = skb_put(skb, rxlen - 4) - 8; | 520 | rxpkt = skb_put(skb, rxlen) - 8; |
517 | 521 | ||
518 | /* align the packet length to 4 bytes, and add 4 bytes | 522 | ks8851_rdfifo(ks, rxpkt, rxalign + 8); |
519 | * as we're getting the rx status header as well */ | ||
520 | ks8851_rdfifo(ks, rxpkt, ALIGN(rxlen, 4) + 8); | ||
521 | 523 | ||
522 | if (netif_msg_pktdata(ks)) | 524 | if (netif_msg_pktdata(ks)) |
523 | ks8851_dbg_dumpkkt(ks, rxpkt); | 525 | ks8851_dbg_dumpkkt(ks, rxpkt); |
524 | 526 | ||
525 | skb->protocol = eth_type_trans(skb, ks->netdev); | 527 | skb->protocol = eth_type_trans(skb, ks->netdev); |
526 | netif_rx(skb); | 528 | netif_rx(skb); |
527 | 529 | ||
528 | ks->netdev->stats.rx_packets++; | 530 | ks->netdev->stats.rx_packets++; |
529 | ks->netdev->stats.rx_bytes += rxlen - 4; | 531 | ks->netdev->stats.rx_bytes += rxlen; |
532 | } | ||
530 | } | 533 | } |
531 | 534 | ||
532 | ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); | 535 | ks8851_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr); |
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c index 4eea3f70c5cf..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 | */ |
162 | static int temac_dcr_setup(struct temac_local *lp, struct of_device *op, | 162 | static 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 | */ |
187 | static int temac_dcr_setup(struct temac_local *lp, struct of_device *op, | 187 | static 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; |
@@ -902,8 +902,8 @@ temac_poll_controller(struct net_device *ndev) | |||
902 | disable_irq(lp->tx_irq); | 902 | disable_irq(lp->tx_irq); |
903 | disable_irq(lp->rx_irq); | 903 | disable_irq(lp->rx_irq); |
904 | 904 | ||
905 | ll_temac_rx_irq(lp->tx_irq, lp); | 905 | ll_temac_rx_irq(lp->tx_irq, ndev); |
906 | ll_temac_tx_irq(lp->rx_irq, lp); | 906 | ll_temac_tx_irq(lp->rx_irq, ndev); |
907 | 907 | ||
908 | enable_irq(lp->tx_irq); | 908 | enable_irq(lp->tx_irq); |
909 | enable_irq(lp->rx_irq); | 909 | enable_irq(lp->rx_irq); |
@@ -952,7 +952,7 @@ static const struct attribute_group temac_attr_group = { | |||
952 | }; | 952 | }; |
953 | 953 | ||
954 | static int __init | 954 | static int __init |
955 | temac_of_probe(struct of_device *op, const struct of_device_id *match) | 955 | temac_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 | ||
1097 | static int __devexit temac_of_remove(struct of_device *op) | 1097 | static 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"); | |||
271 | MODULE_FIRMWARE("myri10ge_rss_ethp_z8e.dat"); | 272 | MODULE_FIRMWARE("myri10ge_rss_ethp_z8e.dat"); |
272 | MODULE_FIRMWARE("myri10ge_rss_eth_z8e.dat"); | 273 | MODULE_FIRMWARE("myri10ge_rss_eth_z8e.dat"); |
273 | 274 | ||
275 | /* Careful: must be accessed under kparam_block_sysfs_write */ | ||
274 | static char *myri10ge_fw_name = NULL; | 276 | static char *myri10ge_fw_name = NULL; |
275 | module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR); | 277 | module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR); |
276 | MODULE_PARM_DESC(myri10ge_fw_name, "Firmware image name"); | 278 | MODULE_PARM_DESC(myri10ge_fw_name, "Firmware image name"); |
@@ -376,6 +378,14 @@ static inline void put_be32(__be32 val, __be32 __iomem * p) | |||
376 | 378 | ||
377 | static struct net_device_stats *myri10ge_get_stats(struct net_device *dev); | 379 | static struct net_device_stats *myri10ge_get_stats(struct net_device *dev); |
378 | 380 | ||
381 | static 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 | |||
379 | static int | 389 | static int |
380 | myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd, | 390 | myri10ge_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) | |||
3261 | abort: | 3271 | abort: |
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 | ||
3764 | abort_with_fw: | 3790 | abort_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 | ||
3995 | abort_with_netdev: | 4021 | abort_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 | ||
929 | static int __devinit myri_sbus_probe(struct of_device *op, const struct of_device_id *match) | 929 | static 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 | ||
1127 | static int __devexit myri_sbus_remove(struct of_device *op) | 1127 | static 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 | ||
1173 | static int __init myri_sbus_init(void) | 1173 | static 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 | ||
1178 | static void __exit myri_sbus_exit(void) | 1178 | static 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 | ||
1183 | module_init(myri_sbus_init); | 1183 | module_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/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index ffa1b9ce1cc5..6dca3574e355 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -53,8 +53,8 @@ | |||
53 | 53 | ||
54 | #define _NETXEN_NIC_LINUX_MAJOR 4 | 54 | #define _NETXEN_NIC_LINUX_MAJOR 4 |
55 | #define _NETXEN_NIC_LINUX_MINOR 0 | 55 | #define _NETXEN_NIC_LINUX_MINOR 0 |
56 | #define _NETXEN_NIC_LINUX_SUBVERSION 73 | 56 | #define _NETXEN_NIC_LINUX_SUBVERSION 74 |
57 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.73" | 57 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.74" |
58 | 58 | ||
59 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) | 59 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) |
60 | #define _major(v) (((v) >> 24) & 0xff) | 60 | #define _major(v) (((v) >> 24) & 0xff) |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index c865dda2adf1..b075a35b85d4 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -1540,7 +1540,6 @@ netxen_process_rcv(struct netxen_adapter *adapter, | |||
1540 | if (pkt_offset) | 1540 | if (pkt_offset) |
1541 | skb_pull(skb, pkt_offset); | 1541 | skb_pull(skb, pkt_offset); |
1542 | 1542 | ||
1543 | skb->truesize = skb->len + sizeof(struct sk_buff); | ||
1544 | skb->protocol = eth_type_trans(skb, netdev); | 1543 | skb->protocol = eth_type_trans(skb, netdev); |
1545 | 1544 | ||
1546 | napi_gro_receive(&sds_ring->napi, skb); | 1545 | napi_gro_receive(&sds_ring->napi, skb); |
@@ -1602,8 +1601,6 @@ netxen_process_lro(struct netxen_adapter *adapter, | |||
1602 | 1601 | ||
1603 | skb_put(skb, lro_length + data_offset); | 1602 | skb_put(skb, lro_length + data_offset); |
1604 | 1603 | ||
1605 | skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb); | ||
1606 | |||
1607 | skb_pull(skb, l2_hdr_offset); | 1604 | skb_pull(skb, l2_hdr_offset); |
1608 | skb->protocol = eth_type_trans(skb, netdev); | 1605 | skb->protocol = eth_type_trans(skb, netdev); |
1609 | 1606 | ||
@@ -1805,8 +1802,6 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, | |||
1805 | netxen_ctx_msg msg = 0; | 1802 | netxen_ctx_msg msg = 0; |
1806 | struct list_head *head; | 1803 | struct list_head *head; |
1807 | 1804 | ||
1808 | spin_lock(&rds_ring->lock); | ||
1809 | |||
1810 | producer = rds_ring->producer; | 1805 | producer = rds_ring->producer; |
1811 | 1806 | ||
1812 | head = &rds_ring->free_list; | 1807 | head = &rds_ring->free_list; |
@@ -1853,8 +1848,6 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, | |||
1853 | NETXEN_RCV_PRODUCER_OFFSET), msg); | 1848 | NETXEN_RCV_PRODUCER_OFFSET), msg); |
1854 | } | 1849 | } |
1855 | } | 1850 | } |
1856 | |||
1857 | spin_unlock(&rds_ring->lock); | ||
1858 | } | 1851 | } |
1859 | 1852 | ||
1860 | static void | 1853 | static void |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index fd86e18604e6..73d314592230 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -2032,8 +2032,6 @@ struct net_device_stats *netxen_nic_get_stats(struct net_device *netdev) | |||
2032 | struct netxen_adapter *adapter = netdev_priv(netdev); | 2032 | struct netxen_adapter *adapter = netdev_priv(netdev); |
2033 | struct net_device_stats *stats = &netdev->stats; | 2033 | struct net_device_stats *stats = &netdev->stats; |
2034 | 2034 | ||
2035 | memset(stats, 0, sizeof(*stats)); | ||
2036 | |||
2037 | stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; | 2035 | stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; |
2038 | stats->tx_packets = adapter->stats.xmitfinished; | 2036 | stats->tx_packets = adapter->stats.xmitfinished; |
2039 | stats->rx_bytes = adapter->stats.rxbytes; | 2037 | stats->rx_bytes = adapter->stats.rxbytes; |
@@ -2133,9 +2131,16 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget) | |||
2133 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2131 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2134 | static void netxen_nic_poll_controller(struct net_device *netdev) | 2132 | static void netxen_nic_poll_controller(struct net_device *netdev) |
2135 | { | 2133 | { |
2134 | int ring; | ||
2135 | struct nx_host_sds_ring *sds_ring; | ||
2136 | struct netxen_adapter *adapter = netdev_priv(netdev); | 2136 | struct netxen_adapter *adapter = netdev_priv(netdev); |
2137 | struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; | ||
2138 | |||
2137 | disable_irq(adapter->irq); | 2139 | disable_irq(adapter->irq); |
2138 | netxen_intr(adapter->irq, adapter); | 2140 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
2141 | sds_ring = &recv_ctx->sds_rings[ring]; | ||
2142 | netxen_intr(adapter->irq, sds_ring); | ||
2143 | } | ||
2139 | enable_irq(adapter->irq); | 2144 | enable_irq(adapter->irq); |
2140 | } | 2145 | } |
2141 | #endif | 2146 | #endif |
diff --git a/drivers/net/niu.c b/drivers/net/niu.c index b9b950845b0e..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 | ||
@@ -7272,32 +7269,28 @@ static int niu_get_ethtool_tcam_all(struct niu *np, | |||
7272 | struct niu_parent *parent = np->parent; | 7269 | struct niu_parent *parent = np->parent; |
7273 | struct niu_tcam_entry *tp; | 7270 | struct niu_tcam_entry *tp; |
7274 | int i, idx, cnt; | 7271 | int i, idx, cnt; |
7275 | u16 n_entries; | ||
7276 | unsigned long flags; | 7272 | unsigned long flags; |
7277 | 7273 | int ret = 0; | |
7278 | 7274 | ||
7279 | /* put the tcam size here */ | 7275 | /* put the tcam size here */ |
7280 | nfc->data = tcam_get_size(np); | 7276 | nfc->data = tcam_get_size(np); |
7281 | 7277 | ||
7282 | niu_lock_parent(np, flags); | 7278 | niu_lock_parent(np, flags); |
7283 | n_entries = nfc->rule_cnt; | ||
7284 | for (cnt = 0, i = 0; i < nfc->data; i++) { | 7279 | for (cnt = 0, i = 0; i < nfc->data; i++) { |
7285 | idx = tcam_get_index(np, i); | 7280 | idx = tcam_get_index(np, i); |
7286 | tp = &parent->tcam[idx]; | 7281 | tp = &parent->tcam[idx]; |
7287 | if (!tp->valid) | 7282 | if (!tp->valid) |
7288 | continue; | 7283 | continue; |
7284 | if (cnt == nfc->rule_cnt) { | ||
7285 | ret = -EMSGSIZE; | ||
7286 | break; | ||
7287 | } | ||
7289 | rule_locs[cnt] = i; | 7288 | rule_locs[cnt] = i; |
7290 | cnt++; | 7289 | cnt++; |
7291 | } | 7290 | } |
7292 | niu_unlock_parent(np, flags); | 7291 | niu_unlock_parent(np, flags); |
7293 | 7292 | ||
7294 | if (n_entries != cnt) { | 7293 | return ret; |
7295 | /* print warning, this should not happen */ | ||
7296 | netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n", | ||
7297 | np->parent->index, __func__, n_entries, cnt); | ||
7298 | } | ||
7299 | |||
7300 | return 0; | ||
7301 | } | 7294 | } |
7302 | 7295 | ||
7303 | static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, | 7296 | static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, |
@@ -9106,7 +9099,7 @@ retry: | |||
9106 | static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map) | 9099 | static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map) |
9107 | { | 9100 | { |
9108 | #ifdef CONFIG_SPARC64 | 9101 | #ifdef CONFIG_SPARC64 |
9109 | struct of_device *op = np->op; | 9102 | struct platform_device *op = np->op; |
9110 | const u32 *int_prop; | 9103 | const u32 *int_prop; |
9111 | int i; | 9104 | int i; |
9112 | 9105 | ||
@@ -9114,12 +9107,12 @@ static int __devinit niu_n2_irq_init(struct niu *np, u8 *ldg_num_map) | |||
9114 | if (!int_prop) | 9107 | if (!int_prop) |
9115 | return -ENODEV; | 9108 | return -ENODEV; |
9116 | 9109 | ||
9117 | for (i = 0; i < op->num_irqs; i++) { | 9110 | for (i = 0; i < op->archdata.num_irqs; i++) { |
9118 | ldg_num_map[i] = int_prop[i]; | 9111 | ldg_num_map[i] = int_prop[i]; |
9119 | np->ldg[i].irq = op->irqs[i]; | 9112 | np->ldg[i].irq = op->archdata.irqs[i]; |
9120 | } | 9113 | } |
9121 | 9114 | ||
9122 | np->num_ldg = op->num_irqs; | 9115 | np->num_ldg = op->archdata.num_irqs; |
9123 | 9116 | ||
9124 | return 0; | 9117 | return 0; |
9125 | #else | 9118 | #else |
@@ -9691,7 +9684,7 @@ static void __devinit niu_driver_version(void) | |||
9691 | 9684 | ||
9692 | static struct net_device * __devinit niu_alloc_and_init( | 9685 | static struct net_device * __devinit niu_alloc_and_init( |
9693 | struct device *gen_dev, struct pci_dev *pdev, | 9686 | struct device *gen_dev, struct pci_dev *pdev, |
9694 | struct of_device *op, const struct niu_ops *ops, | 9687 | struct platform_device *op, const struct niu_ops *ops, |
9695 | u8 port) | 9688 | u8 port) |
9696 | { | 9689 | { |
9697 | struct net_device *dev; | 9690 | struct net_device *dev; |
@@ -10067,7 +10060,7 @@ static const struct niu_ops niu_phys_ops = { | |||
10067 | .unmap_single = niu_phys_unmap_single, | 10060 | .unmap_single = niu_phys_unmap_single, |
10068 | }; | 10061 | }; |
10069 | 10062 | ||
10070 | static int __devinit niu_of_probe(struct of_device *op, | 10063 | static int __devinit niu_of_probe(struct platform_device *op, |
10071 | const struct of_device_id *match) | 10064 | const struct of_device_id *match) |
10072 | { | 10065 | { |
10073 | union niu_parent_id parent_id; | 10066 | union niu_parent_id parent_id; |
@@ -10182,7 +10175,7 @@ err_out: | |||
10182 | return err; | 10175 | return err; |
10183 | } | 10176 | } |
10184 | 10177 | ||
10185 | static int __devexit niu_of_remove(struct of_device *op) | 10178 | static int __devexit niu_of_remove(struct platform_device *op) |
10186 | { | 10179 | { |
10187 | struct net_device *dev = dev_get_drvdata(&op->dev); | 10180 | struct net_device *dev = dev_get_drvdata(&op->dev); |
10188 | 10181 | ||
@@ -10249,14 +10242,14 @@ static int __init niu_init(void) | |||
10249 | niu_debug = netif_msg_init(debug, NIU_MSG_DEFAULT); | 10242 | niu_debug = netif_msg_init(debug, NIU_MSG_DEFAULT); |
10250 | 10243 | ||
10251 | #ifdef CONFIG_SPARC64 | 10244 | #ifdef CONFIG_SPARC64 |
10252 | err = of_register_driver(&niu_of_driver, &of_bus_type); | 10245 | err = of_register_platform_driver(&niu_of_driver); |
10253 | #endif | 10246 | #endif |
10254 | 10247 | ||
10255 | if (!err) { | 10248 | if (!err) { |
10256 | err = pci_register_driver(&niu_pci_driver); | 10249 | err = pci_register_driver(&niu_pci_driver); |
10257 | #ifdef CONFIG_SPARC64 | 10250 | #ifdef CONFIG_SPARC64 |
10258 | if (err) | 10251 | if (err) |
10259 | of_unregister_driver(&niu_of_driver); | 10252 | of_unregister_platform_driver(&niu_of_driver); |
10260 | #endif | 10253 | #endif |
10261 | } | 10254 | } |
10262 | 10255 | ||
@@ -10267,7 +10260,7 @@ static void __exit niu_exit(void) | |||
10267 | { | 10260 | { |
10268 | pci_unregister_driver(&niu_pci_driver); | 10261 | pci_unregister_driver(&niu_pci_driver); |
10269 | #ifdef CONFIG_SPARC64 | 10262 | #ifdef CONFIG_SPARC64 |
10270 | of_unregister_driver(&niu_of_driver); | 10263 | of_unregister_platform_driver(&niu_of_driver); |
10271 | #endif | 10264 | #endif |
10272 | } | 10265 | } |
10273 | 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 | ||
3239 | struct of_device; | 3239 | struct platform_device; |
3240 | struct niu { | 3240 | struct 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) | |||
260 | static int try_io_port(struct pcmcia_device *link) | 259 | static 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, ®); | ||
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: | |||
545 | static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | 545 | static 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) | |||
594 | static int fmvj18x_setup_mfc(struct pcmcia_device *link) | 591 | static 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, ®); | ||
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, ®); | ||
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, ®); | 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 bfdef72c5d5e..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 | ||
114 | static void pcnet_detach(struct pcmcia_device *p_dev); | 113 | static void pcnet_detach(struct pcmcia_device *p_dev); |
115 | 114 | ||
116 | static dev_info_t dev_info = "pcnet_cs"; | ||
117 | |||
118 | /*====================================================================*/ | 115 | /*====================================================================*/ |
119 | 116 | ||
120 | typedef struct hw_info_t { | 117 | typedef 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) | |||
480 | static int try_io_port(struct pcmcia_device *link) | 474 | static 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 | ||
@@ -1644,6 +1637,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1644 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), | 1637 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), |
1645 | PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), | 1638 | PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), |
1646 | PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), | 1639 | PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), |
1640 | PCMCIA_DEVICE_PROD_ID12("KENTRONICS", "KEP-230", 0xaf8144c9, 0x868f6616), | ||
1647 | PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64), | 1641 | PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64), |
1648 | PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5), | 1642 | PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5), |
1649 | PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3), | 1643 | PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3), |
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 | ||
610 | static int smc_config(struct pcmcia_device *link) | 605 | static 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, ®))) | ||
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, ®))) | 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/Kconfig b/drivers/net/phy/Kconfig index a527e37728cd..eb799b36c86a 100644 --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig | |||
@@ -5,7 +5,7 @@ | |||
5 | menuconfig PHYLIB | 5 | menuconfig PHYLIB |
6 | tristate "PHY Device support and infrastructure" | 6 | tristate "PHY Device support and infrastructure" |
7 | depends on !S390 | 7 | depends on !S390 |
8 | depends on NET_ETHERNET | 8 | depends on NETDEVICES |
9 | help | 9 | help |
10 | Ethernet controllers are usually attached to PHY | 10 | Ethernet controllers are usually attached to PHY |
11 | devices. This option provides infrastructure for | 11 | devices. This option provides infrastructure for |
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 | ||
191 | static int __devinit mdio_ofgpio_probe(struct of_device *ofdev, | 191 | static 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 | ||
227 | static int __devexit mdio_ofgpio_remove(struct of_device *ofdev) | 227 | static 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/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 6a6b8199a0d6..6c58da2b882c 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -308,7 +308,7 @@ static int mdio_bus_suspend(struct device *dev) | |||
308 | * may call phy routines that try to grab the same lock, and that may | 308 | * may call phy routines that try to grab the same lock, and that may |
309 | * lead to a deadlock. | 309 | * lead to a deadlock. |
310 | */ | 310 | */ |
311 | if (phydev->attached_dev) | 311 | if (phydev->attached_dev && phydev->adjust_link) |
312 | phy_stop_machine(phydev); | 312 | phy_stop_machine(phydev); |
313 | 313 | ||
314 | if (!mdio_bus_phy_may_suspend(phydev)) | 314 | if (!mdio_bus_phy_may_suspend(phydev)) |
@@ -331,7 +331,7 @@ static int mdio_bus_resume(struct device *dev) | |||
331 | return ret; | 331 | return ret; |
332 | 332 | ||
333 | no_resume: | 333 | no_resume: |
334 | if (phydev->attached_dev) | 334 | if (phydev->attached_dev && phydev->adjust_link) |
335 | phy_start_machine(phydev, NULL); | 335 | phy_start_machine(phydev, NULL); |
336 | 336 | ||
337 | return 0; | 337 | return 0; |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 5130db8f5c4e..1bb16cb79433 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -301,7 +301,7 @@ EXPORT_SYMBOL(phy_ethtool_gset); | |||
301 | /** | 301 | /** |
302 | * phy_mii_ioctl - generic PHY MII ioctl interface | 302 | * phy_mii_ioctl - generic PHY MII ioctl interface |
303 | * @phydev: the phy_device struct | 303 | * @phydev: the phy_device struct |
304 | * @mii_data: MII ioctl data | 304 | * @ifr: &struct ifreq for socket ioctl's |
305 | * @cmd: ioctl cmd to execute | 305 | * @cmd: ioctl cmd to execute |
306 | * | 306 | * |
307 | * Note that this function is currently incompatible with the | 307 | * Note that this function is currently incompatible with the |
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index c0761197c07e..16ddc77313cb 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c | |||
@@ -466,6 +466,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | |||
466 | 466 | ||
467 | phydev->interface = interface; | 467 | phydev->interface = interface; |
468 | 468 | ||
469 | phydev->state = PHY_READY; | ||
470 | |||
469 | /* Do initial configuration here, now that | 471 | /* Do initial configuration here, now that |
470 | * we have certain key parameters | 472 | * we have certain key parameters |
471 | * (dev_flags and interface) */ | 473 | * (dev_flags and interface) */ |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 6695a51e09e9..736b91703b3e 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -1314,8 +1314,13 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1314 | hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; | 1314 | hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; |
1315 | i = 0; | 1315 | i = 0; |
1316 | list_for_each_entry(pch, &ppp->channels, clist) { | 1316 | list_for_each_entry(pch, &ppp->channels, clist) { |
1317 | navail += pch->avail = (pch->chan != NULL); | 1317 | if (pch->chan) { |
1318 | pch->speed = pch->chan->speed; | 1318 | pch->avail = 1; |
1319 | navail++; | ||
1320 | pch->speed = pch->chan->speed; | ||
1321 | } else { | ||
1322 | pch->avail = 0; | ||
1323 | } | ||
1319 | if (pch->avail) { | 1324 | if (pch->avail) { |
1320 | if (skb_queue_empty(&pch->file.xq) || | 1325 | if (skb_queue_empty(&pch->file.xq) || |
1321 | !pch->had_frag) { | 1326 | !pch->had_frag) { |
diff --git a/drivers/net/pxa168_eth.c b/drivers/net/pxa168_eth.c new file mode 100644 index 000000000000..85eddda276bd --- /dev/null +++ b/drivers/net/pxa168_eth.c | |||
@@ -0,0 +1,1666 @@ | |||
1 | /* | ||
2 | * PXA168 ethernet driver. | ||
3 | * Most of the code is derived from mv643xx ethernet driver. | ||
4 | * | ||
5 | * Copyright (C) 2010 Marvell International Ltd. | ||
6 | * Sachin Sanap <ssanap@marvell.com> | ||
7 | * Philip Rakity <prakity@marvell.com> | ||
8 | * Mark Brown <markb@marvell.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version 2 | ||
13 | * of the License, or (at your option) any later version. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | * You should have received a copy of the GNU General Public License | ||
21 | * along with this program; if not, write to the Free Software | ||
22 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
23 | */ | ||
24 | |||
25 | #include <linux/init.h> | ||
26 | #include <linux/dma-mapping.h> | ||
27 | #include <linux/in.h> | ||
28 | #include <linux/ip.h> | ||
29 | #include <linux/tcp.h> | ||
30 | #include <linux/udp.h> | ||
31 | #include <linux/etherdevice.h> | ||
32 | #include <linux/bitops.h> | ||
33 | #include <linux/delay.h> | ||
34 | #include <linux/ethtool.h> | ||
35 | #include <linux/platform_device.h> | ||
36 | #include <linux/module.h> | ||
37 | #include <linux/kernel.h> | ||
38 | #include <linux/workqueue.h> | ||
39 | #include <linux/clk.h> | ||
40 | #include <linux/phy.h> | ||
41 | #include <linux/io.h> | ||
42 | #include <linux/types.h> | ||
43 | #include <asm/pgtable.h> | ||
44 | #include <asm/system.h> | ||
45 | #include <linux/delay.h> | ||
46 | #include <linux/dma-mapping.h> | ||
47 | #include <asm/cacheflush.h> | ||
48 | #include <linux/pxa168_eth.h> | ||
49 | |||
50 | #define DRIVER_NAME "pxa168-eth" | ||
51 | #define DRIVER_VERSION "0.3" | ||
52 | |||
53 | /* | ||
54 | * Registers | ||
55 | */ | ||
56 | |||
57 | #define PHY_ADDRESS 0x0000 | ||
58 | #define SMI 0x0010 | ||
59 | #define PORT_CONFIG 0x0400 | ||
60 | #define PORT_CONFIG_EXT 0x0408 | ||
61 | #define PORT_COMMAND 0x0410 | ||
62 | #define PORT_STATUS 0x0418 | ||
63 | #define HTPR 0x0428 | ||
64 | #define SDMA_CONFIG 0x0440 | ||
65 | #define SDMA_CMD 0x0448 | ||
66 | #define INT_CAUSE 0x0450 | ||
67 | #define INT_W_CLEAR 0x0454 | ||
68 | #define INT_MASK 0x0458 | ||
69 | #define ETH_F_RX_DESC_0 0x0480 | ||
70 | #define ETH_C_RX_DESC_0 0x04A0 | ||
71 | #define ETH_C_TX_DESC_1 0x04E4 | ||
72 | |||
73 | /* smi register */ | ||
74 | #define SMI_BUSY (1 << 28) /* 0 - Write, 1 - Read */ | ||
75 | #define SMI_R_VALID (1 << 27) /* 0 - Write, 1 - Read */ | ||
76 | #define SMI_OP_W (0 << 26) /* Write operation */ | ||
77 | #define SMI_OP_R (1 << 26) /* Read operation */ | ||
78 | |||
79 | #define PHY_WAIT_ITERATIONS 10 | ||
80 | |||
81 | #define PXA168_ETH_PHY_ADDR_DEFAULT 0 | ||
82 | /* RX & TX descriptor command */ | ||
83 | #define BUF_OWNED_BY_DMA (1 << 31) | ||
84 | |||
85 | /* RX descriptor status */ | ||
86 | #define RX_EN_INT (1 << 23) | ||
87 | #define RX_FIRST_DESC (1 << 17) | ||
88 | #define RX_LAST_DESC (1 << 16) | ||
89 | #define RX_ERROR (1 << 15) | ||
90 | |||
91 | /* TX descriptor command */ | ||
92 | #define TX_EN_INT (1 << 23) | ||
93 | #define TX_GEN_CRC (1 << 22) | ||
94 | #define TX_ZERO_PADDING (1 << 18) | ||
95 | #define TX_FIRST_DESC (1 << 17) | ||
96 | #define TX_LAST_DESC (1 << 16) | ||
97 | #define TX_ERROR (1 << 15) | ||
98 | |||
99 | /* SDMA_CMD */ | ||
100 | #define SDMA_CMD_AT (1 << 31) | ||
101 | #define SDMA_CMD_TXDL (1 << 24) | ||
102 | #define SDMA_CMD_TXDH (1 << 23) | ||
103 | #define SDMA_CMD_AR (1 << 15) | ||
104 | #define SDMA_CMD_ERD (1 << 7) | ||
105 | |||
106 | /* Bit definitions of the Port Config Reg */ | ||
107 | #define PCR_HS (1 << 12) | ||
108 | #define PCR_EN (1 << 7) | ||
109 | #define PCR_PM (1 << 0) | ||
110 | |||
111 | /* Bit definitions of the Port Config Extend Reg */ | ||
112 | #define PCXR_2BSM (1 << 28) | ||
113 | #define PCXR_DSCP_EN (1 << 21) | ||
114 | #define PCXR_MFL_1518 (0 << 14) | ||
115 | #define PCXR_MFL_1536 (1 << 14) | ||
116 | #define PCXR_MFL_2048 (2 << 14) | ||
117 | #define PCXR_MFL_64K (3 << 14) | ||
118 | #define PCXR_FLP (1 << 11) | ||
119 | #define PCXR_PRIO_TX_OFF 3 | ||
120 | #define PCXR_TX_HIGH_PRI (7 << PCXR_PRIO_TX_OFF) | ||
121 | |||
122 | /* Bit definitions of the SDMA Config Reg */ | ||
123 | #define SDCR_BSZ_OFF 12 | ||
124 | #define SDCR_BSZ8 (3 << SDCR_BSZ_OFF) | ||
125 | #define SDCR_BSZ4 (2 << SDCR_BSZ_OFF) | ||
126 | #define SDCR_BSZ2 (1 << SDCR_BSZ_OFF) | ||
127 | #define SDCR_BSZ1 (0 << SDCR_BSZ_OFF) | ||
128 | #define SDCR_BLMR (1 << 6) | ||
129 | #define SDCR_BLMT (1 << 7) | ||
130 | #define SDCR_RIFB (1 << 9) | ||
131 | #define SDCR_RC_OFF 2 | ||
132 | #define SDCR_RC_MAX_RETRANS (0xf << SDCR_RC_OFF) | ||
133 | |||
134 | /* | ||
135 | * Bit definitions of the Interrupt Cause Reg | ||
136 | * and Interrupt MASK Reg is the same | ||
137 | */ | ||
138 | #define ICR_RXBUF (1 << 0) | ||
139 | #define ICR_TXBUF_H (1 << 2) | ||
140 | #define ICR_TXBUF_L (1 << 3) | ||
141 | #define ICR_TXEND_H (1 << 6) | ||
142 | #define ICR_TXEND_L (1 << 7) | ||
143 | #define ICR_RXERR (1 << 8) | ||
144 | #define ICR_TXERR_H (1 << 10) | ||
145 | #define ICR_TXERR_L (1 << 11) | ||
146 | #define ICR_TX_UDR (1 << 13) | ||
147 | #define ICR_MII_CH (1 << 28) | ||
148 | |||
149 | #define ALL_INTS (ICR_TXBUF_H | ICR_TXBUF_L | ICR_TX_UDR |\ | ||
150 | ICR_TXERR_H | ICR_TXERR_L |\ | ||
151 | ICR_TXEND_H | ICR_TXEND_L |\ | ||
152 | ICR_RXBUF | ICR_RXERR | ICR_MII_CH) | ||
153 | |||
154 | #define ETH_HW_IP_ALIGN 2 /* hw aligns IP header */ | ||
155 | |||
156 | #define NUM_RX_DESCS 64 | ||
157 | #define NUM_TX_DESCS 64 | ||
158 | |||
159 | #define HASH_ADD 0 | ||
160 | #define HASH_DELETE 1 | ||
161 | #define HASH_ADDR_TABLE_SIZE 0x4000 /* 16K (1/2K address - PCR_HS == 1) */ | ||
162 | #define HOP_NUMBER 12 | ||
163 | |||
164 | /* Bit definitions for Port status */ | ||
165 | #define PORT_SPEED_100 (1 << 0) | ||
166 | #define FULL_DUPLEX (1 << 1) | ||
167 | #define FLOW_CONTROL_ENABLED (1 << 2) | ||
168 | #define LINK_UP (1 << 3) | ||
169 | |||
170 | /* Bit definitions for work to be done */ | ||
171 | #define WORK_LINK (1 << 0) | ||
172 | #define WORK_TX_DONE (1 << 1) | ||
173 | |||
174 | /* | ||
175 | * Misc definitions. | ||
176 | */ | ||
177 | #define SKB_DMA_REALIGN ((PAGE_SIZE - NET_SKB_PAD) % SMP_CACHE_BYTES) | ||
178 | |||
179 | struct rx_desc { | ||
180 | u32 cmd_sts; /* Descriptor command status */ | ||
181 | u16 byte_cnt; /* Descriptor buffer byte count */ | ||
182 | u16 buf_size; /* Buffer size */ | ||
183 | u32 buf_ptr; /* Descriptor buffer pointer */ | ||
184 | u32 next_desc_ptr; /* Next descriptor pointer */ | ||
185 | }; | ||
186 | |||
187 | struct tx_desc { | ||
188 | u32 cmd_sts; /* Command/status field */ | ||
189 | u16 reserved; | ||
190 | u16 byte_cnt; /* buffer byte count */ | ||
191 | u32 buf_ptr; /* pointer to buffer for this descriptor */ | ||
192 | u32 next_desc_ptr; /* Pointer to next descriptor */ | ||
193 | }; | ||
194 | |||
195 | struct pxa168_eth_private { | ||
196 | int port_num; /* User Ethernet port number */ | ||
197 | |||
198 | int rx_resource_err; /* Rx ring resource error flag */ | ||
199 | |||
200 | /* Next available and first returning Rx resource */ | ||
201 | int rx_curr_desc_q, rx_used_desc_q; | ||
202 | |||
203 | /* Next available and first returning Tx resource */ | ||
204 | int tx_curr_desc_q, tx_used_desc_q; | ||
205 | |||
206 | struct rx_desc *p_rx_desc_area; | ||
207 | dma_addr_t rx_desc_dma; | ||
208 | int rx_desc_area_size; | ||
209 | struct sk_buff **rx_skb; | ||
210 | |||
211 | struct tx_desc *p_tx_desc_area; | ||
212 | dma_addr_t tx_desc_dma; | ||
213 | int tx_desc_area_size; | ||
214 | struct sk_buff **tx_skb; | ||
215 | |||
216 | struct work_struct tx_timeout_task; | ||
217 | |||
218 | struct net_device *dev; | ||
219 | struct napi_struct napi; | ||
220 | u8 work_todo; | ||
221 | int skb_size; | ||
222 | |||
223 | struct net_device_stats stats; | ||
224 | /* Size of Tx Ring per queue */ | ||
225 | int tx_ring_size; | ||
226 | /* Number of tx descriptors in use */ | ||
227 | int tx_desc_count; | ||
228 | /* Size of Rx Ring per queue */ | ||
229 | int rx_ring_size; | ||
230 | /* Number of rx descriptors in use */ | ||
231 | int rx_desc_count; | ||
232 | |||
233 | /* | ||
234 | * Used in case RX Ring is empty, which can occur when | ||
235 | * system does not have resources (skb's) | ||
236 | */ | ||
237 | struct timer_list timeout; | ||
238 | struct mii_bus *smi_bus; | ||
239 | struct phy_device *phy; | ||
240 | |||
241 | /* clock */ | ||
242 | struct clk *clk; | ||
243 | struct pxa168_eth_platform_data *pd; | ||
244 | /* | ||
245 | * Ethernet controller base address. | ||
246 | */ | ||
247 | void __iomem *base; | ||
248 | |||
249 | /* Pointer to the hardware address filter table */ | ||
250 | void *htpr; | ||
251 | dma_addr_t htpr_dma; | ||
252 | }; | ||
253 | |||
254 | struct addr_table_entry { | ||
255 | __le32 lo; | ||
256 | __le32 hi; | ||
257 | }; | ||
258 | |||
259 | /* Bit fields of a Hash Table Entry */ | ||
260 | enum hash_table_entry { | ||
261 | HASH_ENTRY_VALID = 1, | ||
262 | SKIP = 2, | ||
263 | HASH_ENTRY_RECEIVE_DISCARD = 4, | ||
264 | HASH_ENTRY_RECEIVE_DISCARD_BIT = 2 | ||
265 | }; | ||
266 | |||
267 | static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); | ||
268 | static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd); | ||
269 | static int pxa168_init_hw(struct pxa168_eth_private *pep); | ||
270 | static void eth_port_reset(struct net_device *dev); | ||
271 | static void eth_port_start(struct net_device *dev); | ||
272 | static int pxa168_eth_open(struct net_device *dev); | ||
273 | static int pxa168_eth_stop(struct net_device *dev); | ||
274 | static int ethernet_phy_setup(struct net_device *dev); | ||
275 | |||
276 | static inline u32 rdl(struct pxa168_eth_private *pep, int offset) | ||
277 | { | ||
278 | return readl(pep->base + offset); | ||
279 | } | ||
280 | |||
281 | static inline void wrl(struct pxa168_eth_private *pep, int offset, u32 data) | ||
282 | { | ||
283 | writel(data, pep->base + offset); | ||
284 | } | ||
285 | |||
286 | static void abort_dma(struct pxa168_eth_private *pep) | ||
287 | { | ||
288 | int delay; | ||
289 | int max_retries = 40; | ||
290 | |||
291 | do { | ||
292 | wrl(pep, SDMA_CMD, SDMA_CMD_AR | SDMA_CMD_AT); | ||
293 | udelay(100); | ||
294 | |||
295 | delay = 10; | ||
296 | while ((rdl(pep, SDMA_CMD) & (SDMA_CMD_AR | SDMA_CMD_AT)) | ||
297 | && delay-- > 0) { | ||
298 | udelay(10); | ||
299 | } | ||
300 | } while (max_retries-- > 0 && delay <= 0); | ||
301 | |||
302 | if (max_retries <= 0) | ||
303 | printk(KERN_ERR "%s : DMA Stuck\n", __func__); | ||
304 | } | ||
305 | |||
306 | static int ethernet_phy_get(struct pxa168_eth_private *pep) | ||
307 | { | ||
308 | unsigned int reg_data; | ||
309 | |||
310 | reg_data = rdl(pep, PHY_ADDRESS); | ||
311 | |||
312 | return (reg_data >> (5 * pep->port_num)) & 0x1f; | ||
313 | } | ||
314 | |||
315 | static void ethernet_phy_set_addr(struct pxa168_eth_private *pep, int phy_addr) | ||
316 | { | ||
317 | u32 reg_data; | ||
318 | int addr_shift = 5 * pep->port_num; | ||
319 | |||
320 | reg_data = rdl(pep, PHY_ADDRESS); | ||
321 | reg_data &= ~(0x1f << addr_shift); | ||
322 | reg_data |= (phy_addr & 0x1f) << addr_shift; | ||
323 | wrl(pep, PHY_ADDRESS, reg_data); | ||
324 | } | ||
325 | |||
326 | static void ethernet_phy_reset(struct pxa168_eth_private *pep) | ||
327 | { | ||
328 | int data; | ||
329 | |||
330 | data = phy_read(pep->phy, MII_BMCR); | ||
331 | if (data < 0) | ||
332 | return; | ||
333 | |||
334 | data |= BMCR_RESET; | ||
335 | if (phy_write(pep->phy, MII_BMCR, data) < 0) | ||
336 | return; | ||
337 | |||
338 | do { | ||
339 | data = phy_read(pep->phy, MII_BMCR); | ||
340 | } while (data >= 0 && data & BMCR_RESET); | ||
341 | } | ||
342 | |||
343 | static void rxq_refill(struct net_device *dev) | ||
344 | { | ||
345 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
346 | struct sk_buff *skb; | ||
347 | struct rx_desc *p_used_rx_desc; | ||
348 | int used_rx_desc; | ||
349 | |||
350 | while (pep->rx_desc_count < pep->rx_ring_size) { | ||
351 | int size; | ||
352 | |||
353 | skb = dev_alloc_skb(pep->skb_size); | ||
354 | if (!skb) | ||
355 | break; | ||
356 | if (SKB_DMA_REALIGN) | ||
357 | skb_reserve(skb, SKB_DMA_REALIGN); | ||
358 | pep->rx_desc_count++; | ||
359 | /* Get 'used' Rx descriptor */ | ||
360 | used_rx_desc = pep->rx_used_desc_q; | ||
361 | p_used_rx_desc = &pep->p_rx_desc_area[used_rx_desc]; | ||
362 | size = skb->end - skb->data; | ||
363 | p_used_rx_desc->buf_ptr = dma_map_single(NULL, | ||
364 | skb->data, | ||
365 | size, | ||
366 | DMA_FROM_DEVICE); | ||
367 | p_used_rx_desc->buf_size = size; | ||
368 | pep->rx_skb[used_rx_desc] = skb; | ||
369 | |||
370 | /* Return the descriptor to DMA ownership */ | ||
371 | wmb(); | ||
372 | p_used_rx_desc->cmd_sts = BUF_OWNED_BY_DMA | RX_EN_INT; | ||
373 | wmb(); | ||
374 | |||
375 | /* Move the used descriptor pointer to the next descriptor */ | ||
376 | pep->rx_used_desc_q = (used_rx_desc + 1) % pep->rx_ring_size; | ||
377 | |||
378 | /* Any Rx return cancels the Rx resource error status */ | ||
379 | pep->rx_resource_err = 0; | ||
380 | |||
381 | skb_reserve(skb, ETH_HW_IP_ALIGN); | ||
382 | } | ||
383 | |||
384 | /* | ||
385 | * If RX ring is empty of SKB, set a timer to try allocating | ||
386 | * again at a later time. | ||
387 | */ | ||
388 | if (pep->rx_desc_count == 0) { | ||
389 | pep->timeout.expires = jiffies + (HZ / 10); | ||
390 | add_timer(&pep->timeout); | ||
391 | } | ||
392 | } | ||
393 | |||
394 | static inline void rxq_refill_timer_wrapper(unsigned long data) | ||
395 | { | ||
396 | struct pxa168_eth_private *pep = (void *)data; | ||
397 | napi_schedule(&pep->napi); | ||
398 | } | ||
399 | |||
400 | static inline u8 flip_8_bits(u8 x) | ||
401 | { | ||
402 | return (((x) & 0x01) << 3) | (((x) & 0x02) << 1) | ||
403 | | (((x) & 0x04) >> 1) | (((x) & 0x08) >> 3) | ||
404 | | (((x) & 0x10) << 3) | (((x) & 0x20) << 1) | ||
405 | | (((x) & 0x40) >> 1) | (((x) & 0x80) >> 3); | ||
406 | } | ||
407 | |||
408 | static void nibble_swap_every_byte(unsigned char *mac_addr) | ||
409 | { | ||
410 | int i; | ||
411 | for (i = 0; i < ETH_ALEN; i++) { | ||
412 | mac_addr[i] = ((mac_addr[i] & 0x0f) << 4) | | ||
413 | ((mac_addr[i] & 0xf0) >> 4); | ||
414 | } | ||
415 | } | ||
416 | |||
417 | static void inverse_every_nibble(unsigned char *mac_addr) | ||
418 | { | ||
419 | int i; | ||
420 | for (i = 0; i < ETH_ALEN; i++) | ||
421 | mac_addr[i] = flip_8_bits(mac_addr[i]); | ||
422 | } | ||
423 | |||
424 | /* | ||
425 | * ---------------------------------------------------------------------------- | ||
426 | * This function will calculate the hash function of the address. | ||
427 | * Inputs | ||
428 | * mac_addr_orig - MAC address. | ||
429 | * Outputs | ||
430 | * return the calculated entry. | ||
431 | */ | ||
432 | static u32 hash_function(unsigned char *mac_addr_orig) | ||
433 | { | ||
434 | u32 hash_result; | ||
435 | u32 addr0; | ||
436 | u32 addr1; | ||
437 | u32 addr2; | ||
438 | u32 addr3; | ||
439 | unsigned char mac_addr[ETH_ALEN]; | ||
440 | |||
441 | /* Make a copy of MAC address since we are going to performe bit | ||
442 | * operations on it | ||
443 | */ | ||
444 | memcpy(mac_addr, mac_addr_orig, ETH_ALEN); | ||
445 | |||
446 | nibble_swap_every_byte(mac_addr); | ||
447 | inverse_every_nibble(mac_addr); | ||
448 | |||
449 | addr0 = (mac_addr[5] >> 2) & 0x3f; | ||
450 | addr1 = (mac_addr[5] & 0x03) | (((mac_addr[4] & 0x7f)) << 2); | ||
451 | addr2 = ((mac_addr[4] & 0x80) >> 7) | mac_addr[3] << 1; | ||
452 | addr3 = (mac_addr[2] & 0xff) | ((mac_addr[1] & 1) << 8); | ||
453 | |||
454 | hash_result = (addr0 << 9) | (addr1 ^ addr2 ^ addr3); | ||
455 | hash_result = hash_result & 0x07ff; | ||
456 | return hash_result; | ||
457 | } | ||
458 | |||
459 | /* | ||
460 | * ---------------------------------------------------------------------------- | ||
461 | * This function will add/del an entry to the address table. | ||
462 | * Inputs | ||
463 | * pep - ETHERNET . | ||
464 | * mac_addr - MAC address. | ||
465 | * skip - if 1, skip this address.Used in case of deleting an entry which is a | ||
466 | * part of chain in the hash table.We cant just delete the entry since | ||
467 | * that will break the chain.We need to defragment the tables time to | ||
468 | * time. | ||
469 | * rd - 0 Discard packet upon match. | ||
470 | * - 1 Receive packet upon match. | ||
471 | * Outputs | ||
472 | * address table entry is added/deleted. | ||
473 | * 0 if success. | ||
474 | * -ENOSPC if table full | ||
475 | */ | ||
476 | static int add_del_hash_entry(struct pxa168_eth_private *pep, | ||
477 | unsigned char *mac_addr, | ||
478 | u32 rd, u32 skip, int del) | ||
479 | { | ||
480 | struct addr_table_entry *entry, *start; | ||
481 | u32 new_high; | ||
482 | u32 new_low; | ||
483 | u32 i; | ||
484 | |||
485 | new_low = (((mac_addr[1] >> 4) & 0xf) << 15) | ||
486 | | (((mac_addr[1] >> 0) & 0xf) << 11) | ||
487 | | (((mac_addr[0] >> 4) & 0xf) << 7) | ||
488 | | (((mac_addr[0] >> 0) & 0xf) << 3) | ||
489 | | (((mac_addr[3] >> 4) & 0x1) << 31) | ||
490 | | (((mac_addr[3] >> 0) & 0xf) << 27) | ||
491 | | (((mac_addr[2] >> 4) & 0xf) << 23) | ||
492 | | (((mac_addr[2] >> 0) & 0xf) << 19) | ||
493 | | (skip << SKIP) | (rd << HASH_ENTRY_RECEIVE_DISCARD_BIT) | ||
494 | | HASH_ENTRY_VALID; | ||
495 | |||
496 | new_high = (((mac_addr[5] >> 4) & 0xf) << 15) | ||
497 | | (((mac_addr[5] >> 0) & 0xf) << 11) | ||
498 | | (((mac_addr[4] >> 4) & 0xf) << 7) | ||
499 | | (((mac_addr[4] >> 0) & 0xf) << 3) | ||
500 | | (((mac_addr[3] >> 5) & 0x7) << 0); | ||
501 | |||
502 | /* | ||
503 | * Pick the appropriate table, start scanning for free/reusable | ||
504 | * entries at the index obtained by hashing the specified MAC address | ||
505 | */ | ||
506 | start = (struct addr_table_entry *)(pep->htpr); | ||
507 | entry = start + hash_function(mac_addr); | ||
508 | for (i = 0; i < HOP_NUMBER; i++) { | ||
509 | if (!(le32_to_cpu(entry->lo) & HASH_ENTRY_VALID)) { | ||
510 | break; | ||
511 | } else { | ||
512 | /* if same address put in same position */ | ||
513 | if (((le32_to_cpu(entry->lo) & 0xfffffff8) == | ||
514 | (new_low & 0xfffffff8)) && | ||
515 | (le32_to_cpu(entry->hi) == new_high)) { | ||
516 | break; | ||
517 | } | ||
518 | } | ||
519 | if (entry == start + 0x7ff) | ||
520 | entry = start; | ||
521 | else | ||
522 | entry++; | ||
523 | } | ||
524 | |||
525 | if (((le32_to_cpu(entry->lo) & 0xfffffff8) != (new_low & 0xfffffff8)) && | ||
526 | (le32_to_cpu(entry->hi) != new_high) && del) | ||
527 | return 0; | ||
528 | |||
529 | if (i == HOP_NUMBER) { | ||
530 | if (!del) { | ||
531 | printk(KERN_INFO "%s: table section is full, need to " | ||
532 | "move to 16kB implementation?\n", | ||
533 | __FILE__); | ||
534 | return -ENOSPC; | ||
535 | } else | ||
536 | return 0; | ||
537 | } | ||
538 | |||
539 | /* | ||
540 | * Update the selected entry | ||
541 | */ | ||
542 | if (del) { | ||
543 | entry->hi = 0; | ||
544 | entry->lo = 0; | ||
545 | } else { | ||
546 | entry->hi = cpu_to_le32(new_high); | ||
547 | entry->lo = cpu_to_le32(new_low); | ||
548 | } | ||
549 | |||
550 | return 0; | ||
551 | } | ||
552 | |||
553 | /* | ||
554 | * ---------------------------------------------------------------------------- | ||
555 | * Create an addressTable entry from MAC address info | ||
556 | * found in the specifed net_device struct | ||
557 | * | ||
558 | * Input : pointer to ethernet interface network device structure | ||
559 | * Output : N/A | ||
560 | */ | ||
561 | static void update_hash_table_mac_address(struct pxa168_eth_private *pep, | ||
562 | unsigned char *oaddr, | ||
563 | unsigned char *addr) | ||
564 | { | ||
565 | /* Delete old entry */ | ||
566 | if (oaddr) | ||
567 | add_del_hash_entry(pep, oaddr, 1, 0, HASH_DELETE); | ||
568 | /* Add new entry */ | ||
569 | add_del_hash_entry(pep, addr, 1, 0, HASH_ADD); | ||
570 | } | ||
571 | |||
572 | static int init_hash_table(struct pxa168_eth_private *pep) | ||
573 | { | ||
574 | /* | ||
575 | * Hardware expects CPU to build a hash table based on a predefined | ||
576 | * hash function and populate it based on hardware address. The | ||
577 | * location of the hash table is identified by 32-bit pointer stored | ||
578 | * in HTPR internal register. Two possible sizes exists for the hash | ||
579 | * table 8kB (256kB of DRAM required (4 x 64 kB banks)) and 1/2kB | ||
580 | * (16kB of DRAM required (4 x 4 kB banks)).We currently only support | ||
581 | * 1/2kB. | ||
582 | */ | ||
583 | /* TODO: Add support for 8kB hash table and alternative hash | ||
584 | * function.Driver can dynamically switch to them if the 1/2kB hash | ||
585 | * table is full. | ||
586 | */ | ||
587 | if (pep->htpr == NULL) { | ||
588 | pep->htpr = dma_alloc_coherent(pep->dev->dev.parent, | ||
589 | HASH_ADDR_TABLE_SIZE, | ||
590 | &pep->htpr_dma, GFP_KERNEL); | ||
591 | if (pep->htpr == NULL) | ||
592 | return -ENOMEM; | ||
593 | } | ||
594 | memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE); | ||
595 | wrl(pep, HTPR, pep->htpr_dma); | ||
596 | return 0; | ||
597 | } | ||
598 | |||
599 | static void pxa168_eth_set_rx_mode(struct net_device *dev) | ||
600 | { | ||
601 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
602 | struct netdev_hw_addr *ha; | ||
603 | u32 val; | ||
604 | |||
605 | val = rdl(pep, PORT_CONFIG); | ||
606 | if (dev->flags & IFF_PROMISC) | ||
607 | val |= PCR_PM; | ||
608 | else | ||
609 | val &= ~PCR_PM; | ||
610 | wrl(pep, PORT_CONFIG, val); | ||
611 | |||
612 | /* | ||
613 | * Remove the old list of MAC address and add dev->addr | ||
614 | * and multicast address. | ||
615 | */ | ||
616 | memset(pep->htpr, 0, HASH_ADDR_TABLE_SIZE); | ||
617 | update_hash_table_mac_address(pep, NULL, dev->dev_addr); | ||
618 | |||
619 | netdev_for_each_mc_addr(ha, dev) | ||
620 | update_hash_table_mac_address(pep, NULL, ha->addr); | ||
621 | } | ||
622 | |||
623 | static int pxa168_eth_set_mac_address(struct net_device *dev, void *addr) | ||
624 | { | ||
625 | struct sockaddr *sa = addr; | ||
626 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
627 | unsigned char oldMac[ETH_ALEN]; | ||
628 | |||
629 | if (!is_valid_ether_addr(sa->sa_data)) | ||
630 | return -EINVAL; | ||
631 | memcpy(oldMac, dev->dev_addr, ETH_ALEN); | ||
632 | memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN); | ||
633 | netif_addr_lock_bh(dev); | ||
634 | update_hash_table_mac_address(pep, oldMac, dev->dev_addr); | ||
635 | netif_addr_unlock_bh(dev); | ||
636 | return 0; | ||
637 | } | ||
638 | |||
639 | static void eth_port_start(struct net_device *dev) | ||
640 | { | ||
641 | unsigned int val = 0; | ||
642 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
643 | int tx_curr_desc, rx_curr_desc; | ||
644 | |||
645 | /* Perform PHY reset, if there is a PHY. */ | ||
646 | if (pep->phy != NULL) { | ||
647 | struct ethtool_cmd cmd; | ||
648 | |||
649 | pxa168_get_settings(pep->dev, &cmd); | ||
650 | ethernet_phy_reset(pep); | ||
651 | pxa168_set_settings(pep->dev, &cmd); | ||
652 | } | ||
653 | |||
654 | /* Assignment of Tx CTRP of given queue */ | ||
655 | tx_curr_desc = pep->tx_curr_desc_q; | ||
656 | wrl(pep, ETH_C_TX_DESC_1, | ||
657 | (u32) (pep->tx_desc_dma + tx_curr_desc * sizeof(struct tx_desc))); | ||
658 | |||
659 | /* Assignment of Rx CRDP of given queue */ | ||
660 | rx_curr_desc = pep->rx_curr_desc_q; | ||
661 | wrl(pep, ETH_C_RX_DESC_0, | ||
662 | (u32) (pep->rx_desc_dma + rx_curr_desc * sizeof(struct rx_desc))); | ||
663 | |||
664 | wrl(pep, ETH_F_RX_DESC_0, | ||
665 | (u32) (pep->rx_desc_dma + rx_curr_desc * sizeof(struct rx_desc))); | ||
666 | |||
667 | /* Clear all interrupts */ | ||
668 | wrl(pep, INT_CAUSE, 0); | ||
669 | |||
670 | /* Enable all interrupts for receive, transmit and error. */ | ||
671 | wrl(pep, INT_MASK, ALL_INTS); | ||
672 | |||
673 | val = rdl(pep, PORT_CONFIG); | ||
674 | val |= PCR_EN; | ||
675 | wrl(pep, PORT_CONFIG, val); | ||
676 | |||
677 | /* Start RX DMA engine */ | ||
678 | val = rdl(pep, SDMA_CMD); | ||
679 | val |= SDMA_CMD_ERD; | ||
680 | wrl(pep, SDMA_CMD, val); | ||
681 | } | ||
682 | |||
683 | static void eth_port_reset(struct net_device *dev) | ||
684 | { | ||
685 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
686 | unsigned int val = 0; | ||
687 | |||
688 | /* Stop all interrupts for receive, transmit and error. */ | ||
689 | wrl(pep, INT_MASK, 0); | ||
690 | |||
691 | /* Clear all interrupts */ | ||
692 | wrl(pep, INT_CAUSE, 0); | ||
693 | |||
694 | /* Stop RX DMA */ | ||
695 | val = rdl(pep, SDMA_CMD); | ||
696 | val &= ~SDMA_CMD_ERD; /* abort dma command */ | ||
697 | |||
698 | /* Abort any transmit and receive operations and put DMA | ||
699 | * in idle state. | ||
700 | */ | ||
701 | abort_dma(pep); | ||
702 | |||
703 | /* Disable port */ | ||
704 | val = rdl(pep, PORT_CONFIG); | ||
705 | val &= ~PCR_EN; | ||
706 | wrl(pep, PORT_CONFIG, val); | ||
707 | } | ||
708 | |||
709 | /* | ||
710 | * txq_reclaim - Free the tx desc data for completed descriptors | ||
711 | * If force is non-zero, frees uncompleted descriptors as well | ||
712 | */ | ||
713 | static int txq_reclaim(struct net_device *dev, int force) | ||
714 | { | ||
715 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
716 | struct tx_desc *desc; | ||
717 | u32 cmd_sts; | ||
718 | struct sk_buff *skb; | ||
719 | int tx_index; | ||
720 | dma_addr_t addr; | ||
721 | int count; | ||
722 | int released = 0; | ||
723 | |||
724 | netif_tx_lock(dev); | ||
725 | |||
726 | pep->work_todo &= ~WORK_TX_DONE; | ||
727 | while (pep->tx_desc_count > 0) { | ||
728 | tx_index = pep->tx_used_desc_q; | ||
729 | desc = &pep->p_tx_desc_area[tx_index]; | ||
730 | cmd_sts = desc->cmd_sts; | ||
731 | if (!force && (cmd_sts & BUF_OWNED_BY_DMA)) { | ||
732 | if (released > 0) { | ||
733 | goto txq_reclaim_end; | ||
734 | } else { | ||
735 | released = -1; | ||
736 | goto txq_reclaim_end; | ||
737 | } | ||
738 | } | ||
739 | pep->tx_used_desc_q = (tx_index + 1) % pep->tx_ring_size; | ||
740 | pep->tx_desc_count--; | ||
741 | addr = desc->buf_ptr; | ||
742 | count = desc->byte_cnt; | ||
743 | skb = pep->tx_skb[tx_index]; | ||
744 | if (skb) | ||
745 | pep->tx_skb[tx_index] = NULL; | ||
746 | |||
747 | if (cmd_sts & TX_ERROR) { | ||
748 | if (net_ratelimit()) | ||
749 | printk(KERN_ERR "%s: Error in TX\n", dev->name); | ||
750 | dev->stats.tx_errors++; | ||
751 | } | ||
752 | dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE); | ||
753 | if (skb) | ||
754 | dev_kfree_skb_irq(skb); | ||
755 | released++; | ||
756 | } | ||
757 | txq_reclaim_end: | ||
758 | netif_tx_unlock(dev); | ||
759 | return released; | ||
760 | } | ||
761 | |||
762 | static void pxa168_eth_tx_timeout(struct net_device *dev) | ||
763 | { | ||
764 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
765 | |||
766 | printk(KERN_INFO "%s: TX timeout desc_count %d\n", | ||
767 | dev->name, pep->tx_desc_count); | ||
768 | |||
769 | schedule_work(&pep->tx_timeout_task); | ||
770 | } | ||
771 | |||
772 | static void pxa168_eth_tx_timeout_task(struct work_struct *work) | ||
773 | { | ||
774 | struct pxa168_eth_private *pep = container_of(work, | ||
775 | struct pxa168_eth_private, | ||
776 | tx_timeout_task); | ||
777 | struct net_device *dev = pep->dev; | ||
778 | pxa168_eth_stop(dev); | ||
779 | pxa168_eth_open(dev); | ||
780 | } | ||
781 | |||
782 | static int rxq_process(struct net_device *dev, int budget) | ||
783 | { | ||
784 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
785 | struct net_device_stats *stats = &dev->stats; | ||
786 | unsigned int received_packets = 0; | ||
787 | struct sk_buff *skb; | ||
788 | |||
789 | while (budget-- > 0) { | ||
790 | int rx_next_curr_desc, rx_curr_desc, rx_used_desc; | ||
791 | struct rx_desc *rx_desc; | ||
792 | unsigned int cmd_sts; | ||
793 | |||
794 | /* Do not process Rx ring in case of Rx ring resource error */ | ||
795 | if (pep->rx_resource_err) | ||
796 | break; | ||
797 | rx_curr_desc = pep->rx_curr_desc_q; | ||
798 | rx_used_desc = pep->rx_used_desc_q; | ||
799 | rx_desc = &pep->p_rx_desc_area[rx_curr_desc]; | ||
800 | cmd_sts = rx_desc->cmd_sts; | ||
801 | rmb(); | ||
802 | if (cmd_sts & (BUF_OWNED_BY_DMA)) | ||
803 | break; | ||
804 | skb = pep->rx_skb[rx_curr_desc]; | ||
805 | pep->rx_skb[rx_curr_desc] = NULL; | ||
806 | |||
807 | rx_next_curr_desc = (rx_curr_desc + 1) % pep->rx_ring_size; | ||
808 | pep->rx_curr_desc_q = rx_next_curr_desc; | ||
809 | |||
810 | /* Rx descriptors exhausted. */ | ||
811 | /* Set the Rx ring resource error flag */ | ||
812 | if (rx_next_curr_desc == rx_used_desc) | ||
813 | pep->rx_resource_err = 1; | ||
814 | pep->rx_desc_count--; | ||
815 | dma_unmap_single(NULL, rx_desc->buf_ptr, | ||
816 | rx_desc->buf_size, | ||
817 | DMA_FROM_DEVICE); | ||
818 | received_packets++; | ||
819 | /* | ||
820 | * Update statistics. | ||
821 | * Note byte count includes 4 byte CRC count | ||
822 | */ | ||
823 | stats->rx_packets++; | ||
824 | stats->rx_bytes += rx_desc->byte_cnt; | ||
825 | /* | ||
826 | * In case received a packet without first / last bits on OR | ||
827 | * the error summary bit is on, the packets needs to be droped. | ||
828 | */ | ||
829 | if (((cmd_sts & (RX_FIRST_DESC | RX_LAST_DESC)) != | ||
830 | (RX_FIRST_DESC | RX_LAST_DESC)) | ||
831 | || (cmd_sts & RX_ERROR)) { | ||
832 | |||
833 | stats->rx_dropped++; | ||
834 | if ((cmd_sts & (RX_FIRST_DESC | RX_LAST_DESC)) != | ||
835 | (RX_FIRST_DESC | RX_LAST_DESC)) { | ||
836 | if (net_ratelimit()) | ||
837 | printk(KERN_ERR | ||
838 | "%s: Rx pkt on multiple desc\n", | ||
839 | dev->name); | ||
840 | } | ||
841 | if (cmd_sts & RX_ERROR) | ||
842 | stats->rx_errors++; | ||
843 | dev_kfree_skb_irq(skb); | ||
844 | } else { | ||
845 | /* | ||
846 | * The -4 is for the CRC in the trailer of the | ||
847 | * received packet | ||
848 | */ | ||
849 | skb_put(skb, rx_desc->byte_cnt - 4); | ||
850 | skb->protocol = eth_type_trans(skb, dev); | ||
851 | netif_receive_skb(skb); | ||
852 | } | ||
853 | dev->last_rx = jiffies; | ||
854 | } | ||
855 | /* Fill RX ring with skb's */ | ||
856 | rxq_refill(dev); | ||
857 | return received_packets; | ||
858 | } | ||
859 | |||
860 | static int pxa168_eth_collect_events(struct pxa168_eth_private *pep, | ||
861 | struct net_device *dev) | ||
862 | { | ||
863 | u32 icr; | ||
864 | int ret = 0; | ||
865 | |||
866 | icr = rdl(pep, INT_CAUSE); | ||
867 | if (icr == 0) | ||
868 | return IRQ_NONE; | ||
869 | |||
870 | wrl(pep, INT_CAUSE, ~icr); | ||
871 | if (icr & (ICR_TXBUF_H | ICR_TXBUF_L)) { | ||
872 | pep->work_todo |= WORK_TX_DONE; | ||
873 | ret = 1; | ||
874 | } | ||
875 | if (icr & ICR_RXBUF) | ||
876 | ret = 1; | ||
877 | if (icr & ICR_MII_CH) { | ||
878 | pep->work_todo |= WORK_LINK; | ||
879 | ret = 1; | ||
880 | } | ||
881 | return ret; | ||
882 | } | ||
883 | |||
884 | static void handle_link_event(struct pxa168_eth_private *pep) | ||
885 | { | ||
886 | struct net_device *dev = pep->dev; | ||
887 | u32 port_status; | ||
888 | int speed; | ||
889 | int duplex; | ||
890 | int fc; | ||
891 | |||
892 | port_status = rdl(pep, PORT_STATUS); | ||
893 | if (!(port_status & LINK_UP)) { | ||
894 | if (netif_carrier_ok(dev)) { | ||
895 | printk(KERN_INFO "%s: link down\n", dev->name); | ||
896 | netif_carrier_off(dev); | ||
897 | txq_reclaim(dev, 1); | ||
898 | } | ||
899 | return; | ||
900 | } | ||
901 | if (port_status & PORT_SPEED_100) | ||
902 | speed = 100; | ||
903 | else | ||
904 | speed = 10; | ||
905 | |||
906 | duplex = (port_status & FULL_DUPLEX) ? 1 : 0; | ||
907 | fc = (port_status & FLOW_CONTROL_ENABLED) ? 1 : 0; | ||
908 | printk(KERN_INFO "%s: link up, %d Mb/s, %s duplex, " | ||
909 | "flow control %sabled\n", dev->name, | ||
910 | speed, duplex ? "full" : "half", fc ? "en" : "dis"); | ||
911 | if (!netif_carrier_ok(dev)) | ||
912 | netif_carrier_on(dev); | ||
913 | } | ||
914 | |||
915 | static irqreturn_t pxa168_eth_int_handler(int irq, void *dev_id) | ||
916 | { | ||
917 | struct net_device *dev = (struct net_device *)dev_id; | ||
918 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
919 | |||
920 | if (unlikely(!pxa168_eth_collect_events(pep, dev))) | ||
921 | return IRQ_NONE; | ||
922 | /* Disable interrupts */ | ||
923 | wrl(pep, INT_MASK, 0); | ||
924 | napi_schedule(&pep->napi); | ||
925 | return IRQ_HANDLED; | ||
926 | } | ||
927 | |||
928 | static void pxa168_eth_recalc_skb_size(struct pxa168_eth_private *pep) | ||
929 | { | ||
930 | int skb_size; | ||
931 | |||
932 | /* | ||
933 | * Reserve 2+14 bytes for an ethernet header (the hardware | ||
934 | * automatically prepends 2 bytes of dummy data to each | ||
935 | * received packet), 16 bytes for up to four VLAN tags, and | ||
936 | * 4 bytes for the trailing FCS -- 36 bytes total. | ||
937 | */ | ||
938 | skb_size = pep->dev->mtu + 36; | ||
939 | |||
940 | /* | ||
941 | * Make sure that the skb size is a multiple of 8 bytes, as | ||
942 | * the lower three bits of the receive descriptor's buffer | ||
943 | * size field are ignored by the hardware. | ||
944 | */ | ||
945 | pep->skb_size = (skb_size + 7) & ~7; | ||
946 | |||
947 | /* | ||
948 | * If NET_SKB_PAD is smaller than a cache line, | ||
949 | * netdev_alloc_skb() will cause skb->data to be misaligned | ||
950 | * to a cache line boundary. If this is the case, include | ||
951 | * some extra space to allow re-aligning the data area. | ||
952 | */ | ||
953 | pep->skb_size += SKB_DMA_REALIGN; | ||
954 | |||
955 | } | ||
956 | |||
957 | static int set_port_config_ext(struct pxa168_eth_private *pep) | ||
958 | { | ||
959 | int skb_size; | ||
960 | |||
961 | pxa168_eth_recalc_skb_size(pep); | ||
962 | if (pep->skb_size <= 1518) | ||
963 | skb_size = PCXR_MFL_1518; | ||
964 | else if (pep->skb_size <= 1536) | ||
965 | skb_size = PCXR_MFL_1536; | ||
966 | else if (pep->skb_size <= 2048) | ||
967 | skb_size = PCXR_MFL_2048; | ||
968 | else | ||
969 | skb_size = PCXR_MFL_64K; | ||
970 | |||
971 | /* Extended Port Configuration */ | ||
972 | wrl(pep, | ||
973 | PORT_CONFIG_EXT, PCXR_2BSM | /* Two byte prefix aligns IP hdr */ | ||
974 | PCXR_DSCP_EN | /* Enable DSCP in IP */ | ||
975 | skb_size | PCXR_FLP | /* do not force link pass */ | ||
976 | PCXR_TX_HIGH_PRI); /* Transmit - high priority queue */ | ||
977 | |||
978 | return 0; | ||
979 | } | ||
980 | |||
981 | static int pxa168_init_hw(struct pxa168_eth_private *pep) | ||
982 | { | ||
983 | int err = 0; | ||
984 | |||
985 | /* Disable interrupts */ | ||
986 | wrl(pep, INT_MASK, 0); | ||
987 | wrl(pep, INT_CAUSE, 0); | ||
988 | /* Write to ICR to clear interrupts. */ | ||
989 | wrl(pep, INT_W_CLEAR, 0); | ||
990 | /* Abort any transmit and receive operations and put DMA | ||
991 | * in idle state. | ||
992 | */ | ||
993 | abort_dma(pep); | ||
994 | /* Initialize address hash table */ | ||
995 | err = init_hash_table(pep); | ||
996 | if (err) | ||
997 | return err; | ||
998 | /* SDMA configuration */ | ||
999 | wrl(pep, SDMA_CONFIG, SDCR_BSZ8 | /* Burst size = 32 bytes */ | ||
1000 | SDCR_RIFB | /* Rx interrupt on frame */ | ||
1001 | SDCR_BLMT | /* Little endian transmit */ | ||
1002 | SDCR_BLMR | /* Little endian receive */ | ||
1003 | SDCR_RC_MAX_RETRANS); /* Max retransmit count */ | ||
1004 | /* Port Configuration */ | ||
1005 | wrl(pep, PORT_CONFIG, PCR_HS); /* Hash size is 1/2kb */ | ||
1006 | set_port_config_ext(pep); | ||
1007 | |||
1008 | return err; | ||
1009 | } | ||
1010 | |||
1011 | static int rxq_init(struct net_device *dev) | ||
1012 | { | ||
1013 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1014 | struct rx_desc *p_rx_desc; | ||
1015 | int size = 0, i = 0; | ||
1016 | int rx_desc_num = pep->rx_ring_size; | ||
1017 | |||
1018 | /* Allocate RX skb rings */ | ||
1019 | pep->rx_skb = kmalloc(sizeof(*pep->rx_skb) * pep->rx_ring_size, | ||
1020 | GFP_KERNEL); | ||
1021 | if (!pep->rx_skb) { | ||
1022 | printk(KERN_ERR "%s: Cannot alloc RX skb ring\n", dev->name); | ||
1023 | return -ENOMEM; | ||
1024 | } | ||
1025 | /* Allocate RX ring */ | ||
1026 | pep->rx_desc_count = 0; | ||
1027 | size = pep->rx_ring_size * sizeof(struct rx_desc); | ||
1028 | pep->rx_desc_area_size = size; | ||
1029 | pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, | ||
1030 | &pep->rx_desc_dma, GFP_KERNEL); | ||
1031 | if (!pep->p_rx_desc_area) { | ||
1032 | printk(KERN_ERR "%s: Cannot alloc RX ring (size %d bytes)\n", | ||
1033 | dev->name, size); | ||
1034 | goto out; | ||
1035 | } | ||
1036 | memset((void *)pep->p_rx_desc_area, 0, size); | ||
1037 | /* initialize the next_desc_ptr links in the Rx descriptors ring */ | ||
1038 | p_rx_desc = (struct rx_desc *)pep->p_rx_desc_area; | ||
1039 | for (i = 0; i < rx_desc_num; i++) { | ||
1040 | p_rx_desc[i].next_desc_ptr = pep->rx_desc_dma + | ||
1041 | ((i + 1) % rx_desc_num) * sizeof(struct rx_desc); | ||
1042 | } | ||
1043 | /* Save Rx desc pointer to driver struct. */ | ||
1044 | pep->rx_curr_desc_q = 0; | ||
1045 | pep->rx_used_desc_q = 0; | ||
1046 | pep->rx_desc_area_size = rx_desc_num * sizeof(struct rx_desc); | ||
1047 | return 0; | ||
1048 | out: | ||
1049 | kfree(pep->rx_skb); | ||
1050 | return -ENOMEM; | ||
1051 | } | ||
1052 | |||
1053 | static void rxq_deinit(struct net_device *dev) | ||
1054 | { | ||
1055 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1056 | int curr; | ||
1057 | |||
1058 | /* Free preallocated skb's on RX rings */ | ||
1059 | for (curr = 0; pep->rx_desc_count && curr < pep->rx_ring_size; curr++) { | ||
1060 | if (pep->rx_skb[curr]) { | ||
1061 | dev_kfree_skb(pep->rx_skb[curr]); | ||
1062 | pep->rx_desc_count--; | ||
1063 | } | ||
1064 | } | ||
1065 | if (pep->rx_desc_count) | ||
1066 | printk(KERN_ERR | ||
1067 | "Error in freeing Rx Ring. %d skb's still\n", | ||
1068 | pep->rx_desc_count); | ||
1069 | /* Free RX ring */ | ||
1070 | if (pep->p_rx_desc_area) | ||
1071 | dma_free_coherent(pep->dev->dev.parent, pep->rx_desc_area_size, | ||
1072 | pep->p_rx_desc_area, pep->rx_desc_dma); | ||
1073 | kfree(pep->rx_skb); | ||
1074 | } | ||
1075 | |||
1076 | static int txq_init(struct net_device *dev) | ||
1077 | { | ||
1078 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1079 | struct tx_desc *p_tx_desc; | ||
1080 | int size = 0, i = 0; | ||
1081 | int tx_desc_num = pep->tx_ring_size; | ||
1082 | |||
1083 | pep->tx_skb = kmalloc(sizeof(*pep->tx_skb) * pep->tx_ring_size, | ||
1084 | GFP_KERNEL); | ||
1085 | if (!pep->tx_skb) { | ||
1086 | printk(KERN_ERR "%s: Cannot alloc TX skb ring\n", dev->name); | ||
1087 | return -ENOMEM; | ||
1088 | } | ||
1089 | /* Allocate TX ring */ | ||
1090 | pep->tx_desc_count = 0; | ||
1091 | size = pep->tx_ring_size * sizeof(struct tx_desc); | ||
1092 | pep->tx_desc_area_size = size; | ||
1093 | pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size, | ||
1094 | &pep->tx_desc_dma, GFP_KERNEL); | ||
1095 | if (!pep->p_tx_desc_area) { | ||
1096 | printk(KERN_ERR "%s: Cannot allocate Tx Ring (size %d bytes)\n", | ||
1097 | dev->name, size); | ||
1098 | goto out; | ||
1099 | } | ||
1100 | memset((void *)pep->p_tx_desc_area, 0, pep->tx_desc_area_size); | ||
1101 | /* Initialize the next_desc_ptr links in the Tx descriptors ring */ | ||
1102 | p_tx_desc = (struct tx_desc *)pep->p_tx_desc_area; | ||
1103 | for (i = 0; i < tx_desc_num; i++) { | ||
1104 | p_tx_desc[i].next_desc_ptr = pep->tx_desc_dma + | ||
1105 | ((i + 1) % tx_desc_num) * sizeof(struct tx_desc); | ||
1106 | } | ||
1107 | pep->tx_curr_desc_q = 0; | ||
1108 | pep->tx_used_desc_q = 0; | ||
1109 | pep->tx_desc_area_size = tx_desc_num * sizeof(struct tx_desc); | ||
1110 | return 0; | ||
1111 | out: | ||
1112 | kfree(pep->tx_skb); | ||
1113 | return -ENOMEM; | ||
1114 | } | ||
1115 | |||
1116 | static void txq_deinit(struct net_device *dev) | ||
1117 | { | ||
1118 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1119 | |||
1120 | /* Free outstanding skb's on TX ring */ | ||
1121 | txq_reclaim(dev, 1); | ||
1122 | BUG_ON(pep->tx_used_desc_q != pep->tx_curr_desc_q); | ||
1123 | /* Free TX ring */ | ||
1124 | if (pep->p_tx_desc_area) | ||
1125 | dma_free_coherent(pep->dev->dev.parent, pep->tx_desc_area_size, | ||
1126 | pep->p_tx_desc_area, pep->tx_desc_dma); | ||
1127 | kfree(pep->tx_skb); | ||
1128 | } | ||
1129 | |||
1130 | static int pxa168_eth_open(struct net_device *dev) | ||
1131 | { | ||
1132 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1133 | int err; | ||
1134 | |||
1135 | err = request_irq(dev->irq, pxa168_eth_int_handler, | ||
1136 | IRQF_DISABLED, dev->name, dev); | ||
1137 | if (err) { | ||
1138 | dev_printk(KERN_ERR, &dev->dev, "can't assign irq\n"); | ||
1139 | return -EAGAIN; | ||
1140 | } | ||
1141 | pep->rx_resource_err = 0; | ||
1142 | err = rxq_init(dev); | ||
1143 | if (err != 0) | ||
1144 | goto out_free_irq; | ||
1145 | err = txq_init(dev); | ||
1146 | if (err != 0) | ||
1147 | goto out_free_rx_skb; | ||
1148 | pep->rx_used_desc_q = 0; | ||
1149 | pep->rx_curr_desc_q = 0; | ||
1150 | |||
1151 | /* Fill RX ring with skb's */ | ||
1152 | rxq_refill(dev); | ||
1153 | pep->rx_used_desc_q = 0; | ||
1154 | pep->rx_curr_desc_q = 0; | ||
1155 | netif_carrier_off(dev); | ||
1156 | eth_port_start(dev); | ||
1157 | napi_enable(&pep->napi); | ||
1158 | return 0; | ||
1159 | out_free_rx_skb: | ||
1160 | rxq_deinit(dev); | ||
1161 | out_free_irq: | ||
1162 | free_irq(dev->irq, dev); | ||
1163 | return err; | ||
1164 | } | ||
1165 | |||
1166 | static int pxa168_eth_stop(struct net_device *dev) | ||
1167 | { | ||
1168 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1169 | eth_port_reset(dev); | ||
1170 | |||
1171 | /* Disable interrupts */ | ||
1172 | wrl(pep, INT_MASK, 0); | ||
1173 | wrl(pep, INT_CAUSE, 0); | ||
1174 | /* Write to ICR to clear interrupts. */ | ||
1175 | wrl(pep, INT_W_CLEAR, 0); | ||
1176 | napi_disable(&pep->napi); | ||
1177 | del_timer_sync(&pep->timeout); | ||
1178 | netif_carrier_off(dev); | ||
1179 | free_irq(dev->irq, dev); | ||
1180 | rxq_deinit(dev); | ||
1181 | txq_deinit(dev); | ||
1182 | |||
1183 | return 0; | ||
1184 | } | ||
1185 | |||
1186 | static int pxa168_eth_change_mtu(struct net_device *dev, int mtu) | ||
1187 | { | ||
1188 | int retval; | ||
1189 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1190 | |||
1191 | if ((mtu > 9500) || (mtu < 68)) | ||
1192 | return -EINVAL; | ||
1193 | |||
1194 | dev->mtu = mtu; | ||
1195 | retval = set_port_config_ext(pep); | ||
1196 | |||
1197 | if (!netif_running(dev)) | ||
1198 | return 0; | ||
1199 | |||
1200 | /* | ||
1201 | * Stop and then re-open the interface. This will allocate RX | ||
1202 | * skbs of the new MTU. | ||
1203 | * There is a possible danger that the open will not succeed, | ||
1204 | * due to memory being full. | ||
1205 | */ | ||
1206 | pxa168_eth_stop(dev); | ||
1207 | if (pxa168_eth_open(dev)) { | ||
1208 | dev_printk(KERN_ERR, &dev->dev, | ||
1209 | "fatal error on re-opening device after " | ||
1210 | "MTU change\n"); | ||
1211 | } | ||
1212 | |||
1213 | return 0; | ||
1214 | } | ||
1215 | |||
1216 | static int eth_alloc_tx_desc_index(struct pxa168_eth_private *pep) | ||
1217 | { | ||
1218 | int tx_desc_curr; | ||
1219 | |||
1220 | tx_desc_curr = pep->tx_curr_desc_q; | ||
1221 | pep->tx_curr_desc_q = (tx_desc_curr + 1) % pep->tx_ring_size; | ||
1222 | BUG_ON(pep->tx_curr_desc_q == pep->tx_used_desc_q); | ||
1223 | pep->tx_desc_count++; | ||
1224 | |||
1225 | return tx_desc_curr; | ||
1226 | } | ||
1227 | |||
1228 | static int pxa168_rx_poll(struct napi_struct *napi, int budget) | ||
1229 | { | ||
1230 | struct pxa168_eth_private *pep = | ||
1231 | container_of(napi, struct pxa168_eth_private, napi); | ||
1232 | struct net_device *dev = pep->dev; | ||
1233 | int work_done = 0; | ||
1234 | |||
1235 | if (unlikely(pep->work_todo & WORK_LINK)) { | ||
1236 | pep->work_todo &= ~(WORK_LINK); | ||
1237 | handle_link_event(pep); | ||
1238 | } | ||
1239 | /* | ||
1240 | * We call txq_reclaim every time since in NAPI interupts are disabled | ||
1241 | * and due to this we miss the TX_DONE interrupt,which is not updated in | ||
1242 | * interrupt status register. | ||
1243 | */ | ||
1244 | txq_reclaim(dev, 0); | ||
1245 | if (netif_queue_stopped(dev) | ||
1246 | && pep->tx_ring_size - pep->tx_desc_count > 1) { | ||
1247 | netif_wake_queue(dev); | ||
1248 | } | ||
1249 | work_done = rxq_process(dev, budget); | ||
1250 | if (work_done < budget) { | ||
1251 | napi_complete(napi); | ||
1252 | wrl(pep, INT_MASK, ALL_INTS); | ||
1253 | } | ||
1254 | |||
1255 | return work_done; | ||
1256 | } | ||
1257 | |||
1258 | static int pxa168_eth_start_xmit(struct sk_buff *skb, struct net_device *dev) | ||
1259 | { | ||
1260 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1261 | struct net_device_stats *stats = &dev->stats; | ||
1262 | struct tx_desc *desc; | ||
1263 | int tx_index; | ||
1264 | int length; | ||
1265 | |||
1266 | tx_index = eth_alloc_tx_desc_index(pep); | ||
1267 | desc = &pep->p_tx_desc_area[tx_index]; | ||
1268 | length = skb->len; | ||
1269 | pep->tx_skb[tx_index] = skb; | ||
1270 | desc->byte_cnt = length; | ||
1271 | desc->buf_ptr = dma_map_single(NULL, skb->data, length, DMA_TO_DEVICE); | ||
1272 | wmb(); | ||
1273 | desc->cmd_sts = BUF_OWNED_BY_DMA | TX_GEN_CRC | TX_FIRST_DESC | | ||
1274 | TX_ZERO_PADDING | TX_LAST_DESC | TX_EN_INT; | ||
1275 | wmb(); | ||
1276 | wrl(pep, SDMA_CMD, SDMA_CMD_TXDH | SDMA_CMD_ERD); | ||
1277 | |||
1278 | stats->tx_bytes += skb->len; | ||
1279 | stats->tx_packets++; | ||
1280 | dev->trans_start = jiffies; | ||
1281 | if (pep->tx_ring_size - pep->tx_desc_count <= 1) { | ||
1282 | /* We handled the current skb, but now we are out of space.*/ | ||
1283 | netif_stop_queue(dev); | ||
1284 | } | ||
1285 | |||
1286 | return NETDEV_TX_OK; | ||
1287 | } | ||
1288 | |||
1289 | static int smi_wait_ready(struct pxa168_eth_private *pep) | ||
1290 | { | ||
1291 | int i = 0; | ||
1292 | |||
1293 | /* wait for the SMI register to become available */ | ||
1294 | for (i = 0; rdl(pep, SMI) & SMI_BUSY; i++) { | ||
1295 | if (i == PHY_WAIT_ITERATIONS) | ||
1296 | return -ETIMEDOUT; | ||
1297 | msleep(10); | ||
1298 | } | ||
1299 | |||
1300 | return 0; | ||
1301 | } | ||
1302 | |||
1303 | static int pxa168_smi_read(struct mii_bus *bus, int phy_addr, int regnum) | ||
1304 | { | ||
1305 | struct pxa168_eth_private *pep = bus->priv; | ||
1306 | int i = 0; | ||
1307 | int val; | ||
1308 | |||
1309 | if (smi_wait_ready(pep)) { | ||
1310 | printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n"); | ||
1311 | return -ETIMEDOUT; | ||
1312 | } | ||
1313 | wrl(pep, SMI, (phy_addr << 16) | (regnum << 21) | SMI_OP_R); | ||
1314 | /* now wait for the data to be valid */ | ||
1315 | for (i = 0; !((val = rdl(pep, SMI)) & SMI_R_VALID); i++) { | ||
1316 | if (i == PHY_WAIT_ITERATIONS) { | ||
1317 | printk(KERN_WARNING | ||
1318 | "pxa168_eth: SMI bus read not valid\n"); | ||
1319 | return -ENODEV; | ||
1320 | } | ||
1321 | msleep(10); | ||
1322 | } | ||
1323 | |||
1324 | return val & 0xffff; | ||
1325 | } | ||
1326 | |||
1327 | static int pxa168_smi_write(struct mii_bus *bus, int phy_addr, int regnum, | ||
1328 | u16 value) | ||
1329 | { | ||
1330 | struct pxa168_eth_private *pep = bus->priv; | ||
1331 | |||
1332 | if (smi_wait_ready(pep)) { | ||
1333 | printk(KERN_WARNING "pxa168_eth: SMI bus busy timeout\n"); | ||
1334 | return -ETIMEDOUT; | ||
1335 | } | ||
1336 | |||
1337 | wrl(pep, SMI, (phy_addr << 16) | (regnum << 21) | | ||
1338 | SMI_OP_W | (value & 0xffff)); | ||
1339 | |||
1340 | if (smi_wait_ready(pep)) { | ||
1341 | printk(KERN_ERR "pxa168_eth: SMI bus busy timeout\n"); | ||
1342 | return -ETIMEDOUT; | ||
1343 | } | ||
1344 | |||
1345 | return 0; | ||
1346 | } | ||
1347 | |||
1348 | static int pxa168_eth_do_ioctl(struct net_device *dev, struct ifreq *ifr, | ||
1349 | int cmd) | ||
1350 | { | ||
1351 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1352 | if (pep->phy != NULL) | ||
1353 | return phy_mii_ioctl(pep->phy, ifr, cmd); | ||
1354 | |||
1355 | return -EOPNOTSUPP; | ||
1356 | } | ||
1357 | |||
1358 | static struct phy_device *phy_scan(struct pxa168_eth_private *pep, int phy_addr) | ||
1359 | { | ||
1360 | struct mii_bus *bus = pep->smi_bus; | ||
1361 | struct phy_device *phydev; | ||
1362 | int start; | ||
1363 | int num; | ||
1364 | int i; | ||
1365 | |||
1366 | if (phy_addr == PXA168_ETH_PHY_ADDR_DEFAULT) { | ||
1367 | /* Scan entire range */ | ||
1368 | start = ethernet_phy_get(pep); | ||
1369 | num = 32; | ||
1370 | } else { | ||
1371 | /* Use phy addr specific to platform */ | ||
1372 | start = phy_addr & 0x1f; | ||
1373 | num = 1; | ||
1374 | } | ||
1375 | phydev = NULL; | ||
1376 | for (i = 0; i < num; i++) { | ||
1377 | int addr = (start + i) & 0x1f; | ||
1378 | if (bus->phy_map[addr] == NULL) | ||
1379 | mdiobus_scan(bus, addr); | ||
1380 | |||
1381 | if (phydev == NULL) { | ||
1382 | phydev = bus->phy_map[addr]; | ||
1383 | if (phydev != NULL) | ||
1384 | ethernet_phy_set_addr(pep, addr); | ||
1385 | } | ||
1386 | } | ||
1387 | |||
1388 | return phydev; | ||
1389 | } | ||
1390 | |||
1391 | static void phy_init(struct pxa168_eth_private *pep, int speed, int duplex) | ||
1392 | { | ||
1393 | struct phy_device *phy = pep->phy; | ||
1394 | ethernet_phy_reset(pep); | ||
1395 | |||
1396 | phy_attach(pep->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_MII); | ||
1397 | |||
1398 | if (speed == 0) { | ||
1399 | phy->autoneg = AUTONEG_ENABLE; | ||
1400 | phy->speed = 0; | ||
1401 | phy->duplex = 0; | ||
1402 | phy->supported &= PHY_BASIC_FEATURES; | ||
1403 | phy->advertising = phy->supported | ADVERTISED_Autoneg; | ||
1404 | } else { | ||
1405 | phy->autoneg = AUTONEG_DISABLE; | ||
1406 | phy->advertising = 0; | ||
1407 | phy->speed = speed; | ||
1408 | phy->duplex = duplex; | ||
1409 | } | ||
1410 | phy_start_aneg(phy); | ||
1411 | } | ||
1412 | |||
1413 | static int ethernet_phy_setup(struct net_device *dev) | ||
1414 | { | ||
1415 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1416 | |||
1417 | if (pep->pd->init) | ||
1418 | pep->pd->init(); | ||
1419 | pep->phy = phy_scan(pep, pep->pd->phy_addr & 0x1f); | ||
1420 | if (pep->phy != NULL) | ||
1421 | phy_init(pep, pep->pd->speed, pep->pd->duplex); | ||
1422 | update_hash_table_mac_address(pep, NULL, dev->dev_addr); | ||
1423 | |||
1424 | return 0; | ||
1425 | } | ||
1426 | |||
1427 | static int pxa168_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
1428 | { | ||
1429 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1430 | int err; | ||
1431 | |||
1432 | err = phy_read_status(pep->phy); | ||
1433 | if (err == 0) | ||
1434 | err = phy_ethtool_gset(pep->phy, cmd); | ||
1435 | |||
1436 | return err; | ||
1437 | } | ||
1438 | |||
1439 | static int pxa168_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | ||
1440 | { | ||
1441 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1442 | |||
1443 | return phy_ethtool_sset(pep->phy, cmd); | ||
1444 | } | ||
1445 | |||
1446 | static void pxa168_get_drvinfo(struct net_device *dev, | ||
1447 | struct ethtool_drvinfo *info) | ||
1448 | { | ||
1449 | strncpy(info->driver, DRIVER_NAME, 32); | ||
1450 | strncpy(info->version, DRIVER_VERSION, 32); | ||
1451 | strncpy(info->fw_version, "N/A", 32); | ||
1452 | strncpy(info->bus_info, "N/A", 32); | ||
1453 | } | ||
1454 | |||
1455 | static u32 pxa168_get_link(struct net_device *dev) | ||
1456 | { | ||
1457 | return !!netif_carrier_ok(dev); | ||
1458 | } | ||
1459 | |||
1460 | static const struct ethtool_ops pxa168_ethtool_ops = { | ||
1461 | .get_settings = pxa168_get_settings, | ||
1462 | .set_settings = pxa168_set_settings, | ||
1463 | .get_drvinfo = pxa168_get_drvinfo, | ||
1464 | .get_link = pxa168_get_link, | ||
1465 | }; | ||
1466 | |||
1467 | static const struct net_device_ops pxa168_eth_netdev_ops = { | ||
1468 | .ndo_open = pxa168_eth_open, | ||
1469 | .ndo_stop = pxa168_eth_stop, | ||
1470 | .ndo_start_xmit = pxa168_eth_start_xmit, | ||
1471 | .ndo_set_rx_mode = pxa168_eth_set_rx_mode, | ||
1472 | .ndo_set_mac_address = pxa168_eth_set_mac_address, | ||
1473 | .ndo_validate_addr = eth_validate_addr, | ||
1474 | .ndo_do_ioctl = pxa168_eth_do_ioctl, | ||
1475 | .ndo_change_mtu = pxa168_eth_change_mtu, | ||
1476 | .ndo_tx_timeout = pxa168_eth_tx_timeout, | ||
1477 | }; | ||
1478 | |||
1479 | static int pxa168_eth_probe(struct platform_device *pdev) | ||
1480 | { | ||
1481 | struct pxa168_eth_private *pep = NULL; | ||
1482 | struct net_device *dev = NULL; | ||
1483 | struct resource *res; | ||
1484 | struct clk *clk; | ||
1485 | int err; | ||
1486 | |||
1487 | printk(KERN_NOTICE "PXA168 10/100 Ethernet Driver\n"); | ||
1488 | |||
1489 | clk = clk_get(&pdev->dev, "MFUCLK"); | ||
1490 | if (IS_ERR(clk)) { | ||
1491 | printk(KERN_ERR "%s: Fast Ethernet failed to get clock\n", | ||
1492 | DRIVER_NAME); | ||
1493 | return -ENODEV; | ||
1494 | } | ||
1495 | clk_enable(clk); | ||
1496 | |||
1497 | dev = alloc_etherdev(sizeof(struct pxa168_eth_private)); | ||
1498 | if (!dev) { | ||
1499 | err = -ENOMEM; | ||
1500 | goto err_clk; | ||
1501 | } | ||
1502 | |||
1503 | platform_set_drvdata(pdev, dev); | ||
1504 | pep = netdev_priv(dev); | ||
1505 | pep->dev = dev; | ||
1506 | pep->clk = clk; | ||
1507 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1508 | if (res == NULL) { | ||
1509 | err = -ENODEV; | ||
1510 | goto err_netdev; | ||
1511 | } | ||
1512 | pep->base = ioremap(res->start, res->end - res->start + 1); | ||
1513 | if (pep->base == NULL) { | ||
1514 | err = -ENOMEM; | ||
1515 | goto err_netdev; | ||
1516 | } | ||
1517 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | ||
1518 | BUG_ON(!res); | ||
1519 | dev->irq = res->start; | ||
1520 | dev->netdev_ops = &pxa168_eth_netdev_ops; | ||
1521 | dev->watchdog_timeo = 2 * HZ; | ||
1522 | dev->base_addr = 0; | ||
1523 | SET_ETHTOOL_OPS(dev, &pxa168_ethtool_ops); | ||
1524 | |||
1525 | INIT_WORK(&pep->tx_timeout_task, pxa168_eth_tx_timeout_task); | ||
1526 | |||
1527 | printk(KERN_INFO "%s:Using random mac address\n", DRIVER_NAME); | ||
1528 | random_ether_addr(dev->dev_addr); | ||
1529 | |||
1530 | pep->pd = pdev->dev.platform_data; | ||
1531 | pep->rx_ring_size = NUM_RX_DESCS; | ||
1532 | if (pep->pd->rx_queue_size) | ||
1533 | pep->rx_ring_size = pep->pd->rx_queue_size; | ||
1534 | |||
1535 | pep->tx_ring_size = NUM_TX_DESCS; | ||
1536 | if (pep->pd->tx_queue_size) | ||
1537 | pep->tx_ring_size = pep->pd->tx_queue_size; | ||
1538 | |||
1539 | pep->port_num = pep->pd->port_number; | ||
1540 | /* Hardware supports only 3 ports */ | ||
1541 | BUG_ON(pep->port_num > 2); | ||
1542 | netif_napi_add(dev, &pep->napi, pxa168_rx_poll, pep->rx_ring_size); | ||
1543 | |||
1544 | memset(&pep->timeout, 0, sizeof(struct timer_list)); | ||
1545 | init_timer(&pep->timeout); | ||
1546 | pep->timeout.function = rxq_refill_timer_wrapper; | ||
1547 | pep->timeout.data = (unsigned long)pep; | ||
1548 | |||
1549 | pep->smi_bus = mdiobus_alloc(); | ||
1550 | if (pep->smi_bus == NULL) { | ||
1551 | err = -ENOMEM; | ||
1552 | goto err_base; | ||
1553 | } | ||
1554 | pep->smi_bus->priv = pep; | ||
1555 | pep->smi_bus->name = "pxa168_eth smi"; | ||
1556 | pep->smi_bus->read = pxa168_smi_read; | ||
1557 | pep->smi_bus->write = pxa168_smi_write; | ||
1558 | snprintf(pep->smi_bus->id, MII_BUS_ID_SIZE, "%d", pdev->id); | ||
1559 | pep->smi_bus->parent = &pdev->dev; | ||
1560 | pep->smi_bus->phy_mask = 0xffffffff; | ||
1561 | err = mdiobus_register(pep->smi_bus); | ||
1562 | if (err) | ||
1563 | goto err_free_mdio; | ||
1564 | |||
1565 | pxa168_init_hw(pep); | ||
1566 | err = ethernet_phy_setup(dev); | ||
1567 | if (err) | ||
1568 | goto err_mdiobus; | ||
1569 | SET_NETDEV_DEV(dev, &pdev->dev); | ||
1570 | err = register_netdev(dev); | ||
1571 | if (err) | ||
1572 | goto err_mdiobus; | ||
1573 | return 0; | ||
1574 | |||
1575 | err_mdiobus: | ||
1576 | mdiobus_unregister(pep->smi_bus); | ||
1577 | err_free_mdio: | ||
1578 | mdiobus_free(pep->smi_bus); | ||
1579 | err_base: | ||
1580 | iounmap(pep->base); | ||
1581 | err_netdev: | ||
1582 | free_netdev(dev); | ||
1583 | err_clk: | ||
1584 | clk_disable(clk); | ||
1585 | clk_put(clk); | ||
1586 | return err; | ||
1587 | } | ||
1588 | |||
1589 | static int pxa168_eth_remove(struct platform_device *pdev) | ||
1590 | { | ||
1591 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1592 | struct pxa168_eth_private *pep = netdev_priv(dev); | ||
1593 | |||
1594 | if (pep->htpr) { | ||
1595 | dma_free_coherent(pep->dev->dev.parent, HASH_ADDR_TABLE_SIZE, | ||
1596 | pep->htpr, pep->htpr_dma); | ||
1597 | pep->htpr = NULL; | ||
1598 | } | ||
1599 | if (pep->clk) { | ||
1600 | clk_disable(pep->clk); | ||
1601 | clk_put(pep->clk); | ||
1602 | pep->clk = NULL; | ||
1603 | } | ||
1604 | if (pep->phy != NULL) | ||
1605 | phy_detach(pep->phy); | ||
1606 | |||
1607 | iounmap(pep->base); | ||
1608 | pep->base = NULL; | ||
1609 | mdiobus_unregister(pep->smi_bus); | ||
1610 | mdiobus_free(pep->smi_bus); | ||
1611 | unregister_netdev(dev); | ||
1612 | flush_scheduled_work(); | ||
1613 | free_netdev(dev); | ||
1614 | platform_set_drvdata(pdev, NULL); | ||
1615 | return 0; | ||
1616 | } | ||
1617 | |||
1618 | static void pxa168_eth_shutdown(struct platform_device *pdev) | ||
1619 | { | ||
1620 | struct net_device *dev = platform_get_drvdata(pdev); | ||
1621 | eth_port_reset(dev); | ||
1622 | } | ||
1623 | |||
1624 | #ifdef CONFIG_PM | ||
1625 | static int pxa168_eth_resume(struct platform_device *pdev) | ||
1626 | { | ||
1627 | return -ENOSYS; | ||
1628 | } | ||
1629 | |||
1630 | static int pxa168_eth_suspend(struct platform_device *pdev, pm_message_t state) | ||
1631 | { | ||
1632 | return -ENOSYS; | ||
1633 | } | ||
1634 | |||
1635 | #else | ||
1636 | #define pxa168_eth_resume NULL | ||
1637 | #define pxa168_eth_suspend NULL | ||
1638 | #endif | ||
1639 | |||
1640 | static struct platform_driver pxa168_eth_driver = { | ||
1641 | .probe = pxa168_eth_probe, | ||
1642 | .remove = pxa168_eth_remove, | ||
1643 | .shutdown = pxa168_eth_shutdown, | ||
1644 | .resume = pxa168_eth_resume, | ||
1645 | .suspend = pxa168_eth_suspend, | ||
1646 | .driver = { | ||
1647 | .name = DRIVER_NAME, | ||
1648 | }, | ||
1649 | }; | ||
1650 | |||
1651 | static int __init pxa168_init_module(void) | ||
1652 | { | ||
1653 | return platform_driver_register(&pxa168_eth_driver); | ||
1654 | } | ||
1655 | |||
1656 | static void __exit pxa168_cleanup_module(void) | ||
1657 | { | ||
1658 | platform_driver_unregister(&pxa168_eth_driver); | ||
1659 | } | ||
1660 | |||
1661 | module_init(pxa168_init_module); | ||
1662 | module_exit(pxa168_cleanup_module); | ||
1663 | |||
1664 | MODULE_LICENSE("GPL"); | ||
1665 | MODULE_DESCRIPTION("Ethernet driver for Marvell PXA168"); | ||
1666 | MODULE_ALIAS("platform:pxa168_eth"); | ||
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c index 75ba744b173c..2c7cf0b64811 100644 --- a/drivers/net/qlcnic/qlcnic_init.c +++ b/drivers/net/qlcnic/qlcnic_init.c | |||
@@ -1316,7 +1316,7 @@ qlcnic_alloc_rx_skb(struct qlcnic_adapter *adapter, | |||
1316 | return -ENOMEM; | 1316 | return -ENOMEM; |
1317 | } | 1317 | } |
1318 | 1318 | ||
1319 | skb_reserve(skb, 2); | 1319 | skb_reserve(skb, NET_IP_ALIGN); |
1320 | 1320 | ||
1321 | dma = pci_map_single(pdev, skb->data, | 1321 | dma = pci_map_single(pdev, skb->data, |
1322 | rds_ring->dma_size, PCI_DMA_FROMDEVICE); | 1322 | rds_ring->dma_size, PCI_DMA_FROMDEVICE); |
@@ -1404,7 +1404,6 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter, | |||
1404 | if (pkt_offset) | 1404 | if (pkt_offset) |
1405 | skb_pull(skb, pkt_offset); | 1405 | skb_pull(skb, pkt_offset); |
1406 | 1406 | ||
1407 | skb->truesize = skb->len + sizeof(struct sk_buff); | ||
1408 | skb->protocol = eth_type_trans(skb, netdev); | 1407 | skb->protocol = eth_type_trans(skb, netdev); |
1409 | 1408 | ||
1410 | napi_gro_receive(&sds_ring->napi, skb); | 1409 | napi_gro_receive(&sds_ring->napi, skb); |
@@ -1466,8 +1465,6 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter, | |||
1466 | 1465 | ||
1467 | skb_put(skb, lro_length + data_offset); | 1466 | skb_put(skb, lro_length + data_offset); |
1468 | 1467 | ||
1469 | skb->truesize = skb->len + sizeof(struct sk_buff) + skb_headroom(skb); | ||
1470 | |||
1471 | skb_pull(skb, l2_hdr_offset); | 1468 | skb_pull(skb, l2_hdr_offset); |
1472 | skb->protocol = eth_type_trans(skb, netdev); | 1469 | skb->protocol = eth_type_trans(skb, netdev); |
1473 | 1470 | ||
@@ -1700,8 +1697,6 @@ qlcnic_process_rcv_diag(struct qlcnic_adapter *adapter, | |||
1700 | if (pkt_offset) | 1697 | if (pkt_offset) |
1701 | skb_pull(skb, pkt_offset); | 1698 | skb_pull(skb, pkt_offset); |
1702 | 1699 | ||
1703 | skb->truesize = skb->len + sizeof(struct sk_buff); | ||
1704 | |||
1705 | if (!qlcnic_check_loopback_buff(skb->data)) | 1700 | if (!qlcnic_check_loopback_buff(skb->data)) |
1706 | adapter->diag_cnt++; | 1701 | adapter->diag_cnt++; |
1707 | 1702 | ||
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index b9615bd745ea..66eea5972020 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -473,48 +473,58 @@ qlcnic_cleanup_pci_map(struct qlcnic_adapter *adapter) | |||
473 | static int | 473 | static int |
474 | qlcnic_init_pci_info(struct qlcnic_adapter *adapter) | 474 | qlcnic_init_pci_info(struct qlcnic_adapter *adapter) |
475 | { | 475 | { |
476 | struct qlcnic_pci_info pci_info[QLCNIC_MAX_PCI_FUNC]; | 476 | struct qlcnic_pci_info *pci_info; |
477 | int i, ret = 0, err; | 477 | int i, ret = 0, err; |
478 | u8 pfn; | 478 | u8 pfn; |
479 | 479 | ||
480 | if (!adapter->npars) | 480 | pci_info = kcalloc(QLCNIC_MAX_PCI_FUNC, sizeof(*pci_info), GFP_KERNEL); |
481 | adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) * | 481 | if (!pci_info) |
482 | QLCNIC_MAX_PCI_FUNC, GFP_KERNEL); | ||
483 | if (!adapter->npars) | ||
484 | return -ENOMEM; | 482 | return -ENOMEM; |
485 | 483 | ||
486 | if (!adapter->eswitch) | 484 | adapter->npars = kzalloc(sizeof(struct qlcnic_npar_info) * |
487 | adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) * | 485 | QLCNIC_MAX_PCI_FUNC, GFP_KERNEL); |
486 | if (!adapter->npars) { | ||
487 | err = -ENOMEM; | ||
488 | goto err_pci_info; | ||
489 | } | ||
490 | |||
491 | adapter->eswitch = kzalloc(sizeof(struct qlcnic_eswitch) * | ||
488 | QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL); | 492 | QLCNIC_NIU_MAX_XG_PORTS, GFP_KERNEL); |
489 | if (!adapter->eswitch) { | 493 | if (!adapter->eswitch) { |
490 | err = -ENOMEM; | 494 | err = -ENOMEM; |
491 | goto err_eswitch; | 495 | goto err_npars; |
492 | } | 496 | } |
493 | 497 | ||
494 | ret = qlcnic_get_pci_info(adapter, pci_info); | 498 | ret = qlcnic_get_pci_info(adapter, pci_info); |
495 | if (!ret) { | 499 | if (ret) |
496 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { | 500 | goto err_eswitch; |
497 | pfn = pci_info[i].id; | ||
498 | if (pfn > QLCNIC_MAX_PCI_FUNC) | ||
499 | return QL_STATUS_INVALID_PARAM; | ||
500 | adapter->npars[pfn].active = pci_info[i].active; | ||
501 | adapter->npars[pfn].type = pci_info[i].type; | ||
502 | adapter->npars[pfn].phy_port = pci_info[i].default_port; | ||
503 | adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN; | ||
504 | adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw; | ||
505 | adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw; | ||
506 | } | ||
507 | |||
508 | for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++) | ||
509 | adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE; | ||
510 | 501 | ||
511 | return ret; | 502 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { |
503 | pfn = pci_info[i].id; | ||
504 | if (pfn > QLCNIC_MAX_PCI_FUNC) | ||
505 | return QL_STATUS_INVALID_PARAM; | ||
506 | adapter->npars[pfn].active = pci_info[i].active; | ||
507 | adapter->npars[pfn].type = pci_info[i].type; | ||
508 | adapter->npars[pfn].phy_port = pci_info[i].default_port; | ||
509 | adapter->npars[pfn].mac_learning = DEFAULT_MAC_LEARN; | ||
510 | adapter->npars[pfn].min_bw = pci_info[i].tx_min_bw; | ||
511 | adapter->npars[pfn].max_bw = pci_info[i].tx_max_bw; | ||
512 | } | 512 | } |
513 | 513 | ||
514 | for (i = 0; i < QLCNIC_NIU_MAX_XG_PORTS; i++) | ||
515 | adapter->eswitch[i].flags |= QLCNIC_SWITCH_ENABLE; | ||
516 | |||
517 | kfree(pci_info); | ||
518 | return 0; | ||
519 | |||
520 | err_eswitch: | ||
514 | kfree(adapter->eswitch); | 521 | kfree(adapter->eswitch); |
515 | adapter->eswitch = NULL; | 522 | adapter->eswitch = NULL; |
516 | err_eswitch: | 523 | err_npars: |
517 | kfree(adapter->npars); | 524 | kfree(adapter->npars); |
525 | adapter->npars = NULL; | ||
526 | err_pci_info: | ||
527 | kfree(pci_info); | ||
518 | 528 | ||
519 | return ret; | 529 | return ret; |
520 | } | 530 | } |
@@ -1973,8 +1983,6 @@ static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev) | |||
1973 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1983 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1974 | struct net_device_stats *stats = &netdev->stats; | 1984 | struct net_device_stats *stats = &netdev->stats; |
1975 | 1985 | ||
1976 | memset(stats, 0, sizeof(*stats)); | ||
1977 | |||
1978 | stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; | 1986 | stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; |
1979 | stats->tx_packets = adapter->stats.xmitfinished; | 1987 | stats->tx_packets = adapter->stats.xmitfinished; |
1980 | stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes; | 1988 | stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes; |
@@ -2180,9 +2188,16 @@ static int qlcnic_rx_poll(struct napi_struct *napi, int budget) | |||
2180 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2188 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2181 | static void qlcnic_poll_controller(struct net_device *netdev) | 2189 | static void qlcnic_poll_controller(struct net_device *netdev) |
2182 | { | 2190 | { |
2191 | int ring; | ||
2192 | struct qlcnic_host_sds_ring *sds_ring; | ||
2183 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 2193 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
2194 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | ||
2195 | |||
2184 | disable_irq(adapter->irq); | 2196 | disable_irq(adapter->irq); |
2185 | qlcnic_intr(adapter->irq, adapter); | 2197 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
2198 | sds_ring = &recv_ctx->sds_rings[ring]; | ||
2199 | qlcnic_intr(adapter->irq, sds_ring); | ||
2200 | } | ||
2186 | enable_irq(adapter->irq); | 2201 | enable_irq(adapter->irq); |
2187 | } | 2202 | } |
2188 | #endif | 2203 | #endif |
@@ -3361,15 +3376,21 @@ qlcnic_sysfs_read_pci_config(struct file *file, struct kobject *kobj, | |||
3361 | struct device *dev = container_of(kobj, struct device, kobj); | 3376 | struct device *dev = container_of(kobj, struct device, kobj); |
3362 | struct qlcnic_adapter *adapter = dev_get_drvdata(dev); | 3377 | struct qlcnic_adapter *adapter = dev_get_drvdata(dev); |
3363 | struct qlcnic_pci_func_cfg pci_cfg[QLCNIC_MAX_PCI_FUNC]; | 3378 | struct qlcnic_pci_func_cfg pci_cfg[QLCNIC_MAX_PCI_FUNC]; |
3364 | struct qlcnic_pci_info pci_info[QLCNIC_MAX_PCI_FUNC]; | 3379 | struct qlcnic_pci_info *pci_info; |
3365 | int i, ret; | 3380 | int i, ret; |
3366 | 3381 | ||
3367 | if (size != sizeof(pci_cfg)) | 3382 | if (size != sizeof(pci_cfg)) |
3368 | return QL_STATUS_INVALID_PARAM; | 3383 | return QL_STATUS_INVALID_PARAM; |
3369 | 3384 | ||
3385 | pci_info = kcalloc(QLCNIC_MAX_PCI_FUNC, sizeof(*pci_info), GFP_KERNEL); | ||
3386 | if (!pci_info) | ||
3387 | return -ENOMEM; | ||
3388 | |||
3370 | ret = qlcnic_get_pci_info(adapter, pci_info); | 3389 | ret = qlcnic_get_pci_info(adapter, pci_info); |
3371 | if (ret) | 3390 | if (ret) { |
3391 | kfree(pci_info); | ||
3372 | return ret; | 3392 | return ret; |
3393 | } | ||
3373 | 3394 | ||
3374 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC ; i++) { | 3395 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC ; i++) { |
3375 | pci_cfg[i].pci_func = pci_info[i].id; | 3396 | pci_cfg[i].pci_func = pci_info[i].id; |
@@ -3380,8 +3401,8 @@ qlcnic_sysfs_read_pci_config(struct file *file, struct kobject *kobj, | |||
3380 | memcpy(&pci_cfg[i].def_mac_addr, &pci_info[i].mac, ETH_ALEN); | 3401 | memcpy(&pci_cfg[i].def_mac_addr, &pci_info[i].mac, ETH_ALEN); |
3381 | } | 3402 | } |
3382 | memcpy(buf, &pci_cfg, size); | 3403 | memcpy(buf, &pci_cfg, size); |
3404 | kfree(pci_info); | ||
3383 | return size; | 3405 | return size; |
3384 | |||
3385 | } | 3406 | } |
3386 | static struct bin_attribute bin_attr_npar_config = { | 3407 | static struct bin_attribute bin_attr_npar_config = { |
3387 | .attr = {.name = "npar_config", .mode = (S_IRUGO | S_IWUSR)}, | 3408 | .attr = {.name = "npar_config", .mode = (S_IRUGO | S_IWUSR)}, |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 8d63f69b27d9..5f89e83501f4 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -3919,12 +3919,12 @@ static int ql_adapter_down(struct ql_adapter *qdev) | |||
3919 | for (i = 0; i < qdev->rss_ring_count; i++) | 3919 | for (i = 0; i < qdev->rss_ring_count; i++) |
3920 | netif_napi_del(&qdev->rx_ring[i].napi); | 3920 | netif_napi_del(&qdev->rx_ring[i].napi); |
3921 | 3921 | ||
3922 | ql_free_rx_buffers(qdev); | ||
3923 | |||
3924 | status = ql_adapter_reset(qdev); | 3922 | status = ql_adapter_reset(qdev); |
3925 | if (status) | 3923 | if (status) |
3926 | netif_err(qdev, ifdown, qdev->ndev, "reset(func #%d) FAILED!\n", | 3924 | netif_err(qdev, ifdown, qdev->ndev, "reset(func #%d) FAILED!\n", |
3927 | qdev->func); | 3925 | qdev->func); |
3926 | ql_free_rx_buffers(qdev); | ||
3927 | |||
3928 | return status; | 3928 | return status; |
3929 | } | 3929 | } |
3930 | 3930 | ||
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 35540411990d..a0da4a17b025 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -2934,7 +2934,7 @@ static const struct rtl_cfg_info { | |||
2934 | .hw_start = rtl_hw_start_8168, | 2934 | .hw_start = rtl_hw_start_8168, |
2935 | .region = 2, | 2935 | .region = 2, |
2936 | .align = 8, | 2936 | .align = 8, |
2937 | .intr_event = SYSErr | LinkChg | RxOverflow | | 2937 | .intr_event = SYSErr | RxFIFOOver | LinkChg | RxOverflow | |
2938 | TxErr | TxOK | RxOK | RxErr, | 2938 | TxErr | TxOK | RxOK | RxErr, |
2939 | .napi_event = TxErr | TxOK | RxOK | RxOverflow, | 2939 | .napi_event = TxErr | TxOK | RxOK | RxOverflow, |
2940 | .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, | 2940 | .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, |
@@ -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 | ||
3228 | out: | 3225 | out: |
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); |
@@ -4633,8 +4625,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
4633 | } | 4625 | } |
4634 | 4626 | ||
4635 | /* Work around for rx fifo overflow */ | 4627 | /* Work around for rx fifo overflow */ |
4636 | if (unlikely(status & RxFIFOOver) && | 4628 | if (unlikely(status & RxFIFOOver)) { |
4637 | (tp->mac_version == RTL_GIGA_MAC_VER_11)) { | ||
4638 | netif_stop_queue(dev); | 4629 | netif_stop_queue(dev); |
4639 | rtl8169_tx_timeout(dev); | 4630 | rtl8169_tx_timeout(dev); |
4640 | break; | 4631 | break; |
diff --git a/drivers/net/rionet.c b/drivers/net/rionet.c index 07eb884ff982..44150f2f7bfd 100644 --- a/drivers/net/rionet.c +++ b/drivers/net/rionet.c | |||
@@ -384,7 +384,7 @@ static void rionet_remove(struct rio_dev *rdev) | |||
384 | free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? | 384 | free_pages((unsigned long)rionet_active, rdev->net->hport->sys_size ? |
385 | __ilog2(sizeof(void *)) + 4 : 0); | 385 | __ilog2(sizeof(void *)) + 4 : 0); |
386 | unregister_netdev(ndev); | 386 | unregister_netdev(ndev); |
387 | kfree(ndev); | 387 | free_netdev(ndev); |
388 | 388 | ||
389 | list_for_each_entry_safe(peer, tmp, &rionet_peers, node) { | 389 | list_for_each_entry_safe(peer, tmp, &rionet_peers, node) { |
390 | list_del(&peer->node); | 390 | list_del(&peer->node); |
diff --git a/drivers/net/sgiseeq.c b/drivers/net/sgiseeq.c index cc4bd8c65f8b..9265315baa0b 100644 --- a/drivers/net/sgiseeq.c +++ b/drivers/net/sgiseeq.c | |||
@@ -804,7 +804,7 @@ static int __devinit sgiseeq_probe(struct platform_device *pdev) | |||
804 | err_out_free_page: | 804 | err_out_free_page: |
805 | free_page((unsigned long) sp->srings); | 805 | free_page((unsigned long) sp->srings); |
806 | err_out_free_dev: | 806 | err_out_free_dev: |
807 | kfree(dev); | 807 | free_netdev(dev); |
808 | 808 | ||
809 | err_out: | 809 | err_out: |
810 | return err; | 810 | return err; |
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index f5a9eb1df593..79fd02bc69fd 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
@@ -1437,7 +1437,7 @@ static const struct net_device_ops sh_eth_netdev_ops = { | |||
1437 | 1437 | ||
1438 | static int sh_eth_drv_probe(struct platform_device *pdev) | 1438 | static int sh_eth_drv_probe(struct platform_device *pdev) |
1439 | { | 1439 | { |
1440 | int ret, i, devno = 0; | 1440 | int ret, devno = 0; |
1441 | struct resource *res; | 1441 | struct resource *res; |
1442 | struct net_device *ndev = NULL; | 1442 | struct net_device *ndev = NULL; |
1443 | struct sh_eth_private *mdp; | 1443 | struct sh_eth_private *mdp; |
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/smsc911x.c b/drivers/net/smsc911x.c index 0909ae934ad0..8150ba154116 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
@@ -58,6 +58,7 @@ | |||
58 | 58 | ||
59 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
60 | MODULE_VERSION(SMSC_DRV_VERSION); | 60 | MODULE_VERSION(SMSC_DRV_VERSION); |
61 | MODULE_ALIAS("platform:smsc911x"); | ||
61 | 62 | ||
62 | #if USE_DEBUG > 0 | 63 | #if USE_DEBUG > 0 |
63 | static int debug = 16; | 64 | static int debug = 16; |
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index bbb7951b9c4c..ea0461eb2dbe 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
@@ -1865,15 +1865,15 @@ static int stmmac_resume(struct platform_device *pdev) | |||
1865 | if (!netif_running(dev)) | 1865 | if (!netif_running(dev)) |
1866 | return 0; | 1866 | return 0; |
1867 | 1867 | ||
1868 | spin_lock(&priv->lock); | ||
1869 | |||
1870 | if (priv->shutdown) { | 1868 | if (priv->shutdown) { |
1871 | /* Re-open the interface and re-init the MAC/DMA | 1869 | /* Re-open the interface and re-init the MAC/DMA |
1872 | and the rings. */ | 1870 | and the rings (i.e. on hibernation stage) */ |
1873 | stmmac_open(dev); | 1871 | stmmac_open(dev); |
1874 | goto out_resume; | 1872 | return 0; |
1875 | } | 1873 | } |
1876 | 1874 | ||
1875 | spin_lock(&priv->lock); | ||
1876 | |||
1877 | /* Power Down bit, into the PM register, is cleared | 1877 | /* Power Down bit, into the PM register, is cleared |
1878 | * automatically as soon as a magic packet or a Wake-up frame | 1878 | * automatically as soon as a magic packet or a Wake-up frame |
1879 | * is received. Anyway, it's better to manually clear | 1879 | * is received. Anyway, it's better to manually clear |
@@ -1901,7 +1901,6 @@ static int stmmac_resume(struct platform_device *pdev) | |||
1901 | 1901 | ||
1902 | netif_start_queue(dev); | 1902 | netif_start_queue(dev); |
1903 | 1903 | ||
1904 | out_resume: | ||
1905 | spin_unlock(&priv->lock); | 1904 | spin_unlock(&priv->lock); |
1906 | return 0; | 1905 | return 0; |
1907 | } | 1906 | } |
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 | ||
98 | static void qec_init(struct bigmac *bp) | 98 | static 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 | ||
1086 | static int __devinit bigmac_ether_init(struct of_device *op, | 1086 | static 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 | */ |
1245 | static int __devinit bigmac_sbus_probe(struct of_device *op, | 1245 | static 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 | ||
1256 | static int __devexit bigmac_sbus_remove(struct of_device *op) | 1256 | static 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 | ||
1302 | static int __init bigmac_init(void) | 1302 | static 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 | ||
1307 | static void __exit bigmac_exit(void) | 1307 | static 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 | ||
1312 | module_init(bigmac_init); | 1312 | module_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 | */ |
2518 | static struct quattro * __devinit quattro_sbus_find(struct of_device *child) | 2518 | static 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 |
2642 | static int __devinit happy_meal_sbus_probe_one(struct of_device *op, int is_qfe) | 2642 | static 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 |
3238 | static int __devinit hme_sbus_probe(struct of_device *op, const struct of_device_id *match) | 3238 | static 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 | ||
3250 | static int __devexit hme_sbus_remove(struct of_device *op) | 3250 | static 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 | ||
3314 | static void happy_meal_sbus_exit(void) | 3314 | static 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 | ||
1322 | static int __devinit sparc_lance_probe_one(struct of_device *op, | 1322 | static 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 | ||
1506 | static int __devinit sunlance_sbus_probe(struct of_device *op, const struct of_device_id *match) | 1506 | static 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 | ||
1522 | static int __devexit sunlance_sbus_remove(struct of_device *op) | 1522 | static 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 */ |
1559 | static int __init sparc_lance_init(void) | 1559 | static 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 | ||
1564 | static void __exit sparc_lance_exit(void) | 1564 | static 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 | ||
1569 | module_init(sparc_lance_init); | 1569 | module_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. */ |
723 | static void qec_init_once(struct sunqec *qecp, struct of_device *op) | 723 | static 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 | ||
773 | static struct sunqec * __devinit get_qec(struct of_device *child) | 773 | static 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 | ||
839 | static int __devinit qec_ether_init(struct of_device *op) | 839 | static 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 | ||
944 | static int __devinit qec_sbus_probe(struct of_device *op, const struct of_device_id *match) | 944 | static 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 | ||
949 | static int __devexit qec_sbus_remove(struct of_device *op) | 949 | static 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 | ||
989 | static int __init qec_init(void) | 989 | static 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 | ||
994 | static void __exit qec_exit(void) | 994 | static 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/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 5efa57757a2c..6888e3d41462 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -243,6 +243,7 @@ enum { | |||
243 | NWayState = (1 << 14) | (1 << 13) | (1 << 12), | 243 | NWayState = (1 << 14) | (1 << 13) | (1 << 12), |
244 | NWayRestart = (1 << 12), | 244 | NWayRestart = (1 << 12), |
245 | NonselPortActive = (1 << 9), | 245 | NonselPortActive = (1 << 9), |
246 | SelPortActive = (1 << 8), | ||
246 | LinkFailStatus = (1 << 2), | 247 | LinkFailStatus = (1 << 2), |
247 | NetCxnErr = (1 << 1), | 248 | NetCxnErr = (1 << 1), |
248 | }; | 249 | }; |
@@ -363,7 +364,9 @@ static u16 t21040_csr15[] = { 0, 0, 0x0006, 0x0000, 0x0000, }; | |||
363 | 364 | ||
364 | /* 21041 transceiver register settings: TP AUTO, BNC, AUI, TP, TP FD*/ | 365 | /* 21041 transceiver register settings: TP AUTO, BNC, AUI, TP, TP FD*/ |
365 | static u16 t21041_csr13[] = { 0xEF01, 0xEF09, 0xEF09, 0xEF01, 0xEF09, }; | 366 | static u16 t21041_csr13[] = { 0xEF01, 0xEF09, 0xEF09, 0xEF01, 0xEF09, }; |
366 | static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x6F3F, 0x6F3D, }; | 367 | static u16 t21041_csr14[] = { 0xFFFF, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, }; |
368 | /* If on-chip autonegotiation is broken, use half-duplex (FF3F) instead */ | ||
369 | static u16 t21041_csr14_brk[] = { 0xFF3F, 0xF7FD, 0xF7FD, 0x7F3F, 0x7F3D, }; | ||
367 | static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; | 370 | static u16 t21041_csr15[] = { 0x0008, 0x0006, 0x000E, 0x0008, 0x0008, }; |
368 | 371 | ||
369 | 372 | ||
@@ -1064,6 +1067,9 @@ static void de21041_media_timer (unsigned long data) | |||
1064 | unsigned int carrier; | 1067 | unsigned int carrier; |
1065 | unsigned long flags; | 1068 | unsigned long flags; |
1066 | 1069 | ||
1070 | /* clear port active bits */ | ||
1071 | dw32(SIAStatus, NonselPortActive | SelPortActive); | ||
1072 | |||
1067 | carrier = (status & NetCxnErr) ? 0 : 1; | 1073 | carrier = (status & NetCxnErr) ? 0 : 1; |
1068 | 1074 | ||
1069 | if (carrier) { | 1075 | if (carrier) { |
@@ -1158,14 +1164,29 @@ no_link_yet: | |||
1158 | static void de_media_interrupt (struct de_private *de, u32 status) | 1164 | static void de_media_interrupt (struct de_private *de, u32 status) |
1159 | { | 1165 | { |
1160 | if (status & LinkPass) { | 1166 | if (status & LinkPass) { |
1167 | /* Ignore if current media is AUI or BNC and we can't use TP */ | ||
1168 | if ((de->media_type == DE_MEDIA_AUI || | ||
1169 | de->media_type == DE_MEDIA_BNC) && | ||
1170 | (de->media_lock || | ||
1171 | !de_ok_to_advertise(de, DE_MEDIA_TP_AUTO))) | ||
1172 | return; | ||
1173 | /* If current media is not TP, change it to TP */ | ||
1174 | if ((de->media_type == DE_MEDIA_AUI || | ||
1175 | de->media_type == DE_MEDIA_BNC)) { | ||
1176 | de->media_type = DE_MEDIA_TP_AUTO; | ||
1177 | de_stop_rxtx(de); | ||
1178 | de_set_media(de); | ||
1179 | de_start_rxtx(de); | ||
1180 | } | ||
1161 | de_link_up(de); | 1181 | de_link_up(de); |
1162 | mod_timer(&de->media_timer, jiffies + DE_TIMER_LINK); | 1182 | mod_timer(&de->media_timer, jiffies + DE_TIMER_LINK); |
1163 | return; | 1183 | return; |
1164 | } | 1184 | } |
1165 | 1185 | ||
1166 | BUG_ON(!(status & LinkFail)); | 1186 | BUG_ON(!(status & LinkFail)); |
1167 | 1187 | /* Mark the link as down only if current media is TP */ | |
1168 | if (netif_carrier_ok(de->dev)) { | 1188 | if (netif_carrier_ok(de->dev) && de->media_type != DE_MEDIA_AUI && |
1189 | de->media_type != DE_MEDIA_BNC) { | ||
1169 | de_link_down(de); | 1190 | de_link_down(de); |
1170 | mod_timer(&de->media_timer, jiffies + DE_TIMER_NO_LINK); | 1191 | mod_timer(&de->media_timer, jiffies + DE_TIMER_NO_LINK); |
1171 | } | 1192 | } |
@@ -1229,6 +1250,7 @@ static void de_adapter_sleep (struct de_private *de) | |||
1229 | if (de->de21040) | 1250 | if (de->de21040) |
1230 | return; | 1251 | return; |
1231 | 1252 | ||
1253 | dw32(CSR13, 0); /* Reset phy */ | ||
1232 | pci_read_config_dword(de->pdev, PCIPM, &pmctl); | 1254 | pci_read_config_dword(de->pdev, PCIPM, &pmctl); |
1233 | pmctl |= PM_Sleep; | 1255 | pmctl |= PM_Sleep; |
1234 | pci_write_config_dword(de->pdev, PCIPM, pmctl); | 1256 | pci_write_config_dword(de->pdev, PCIPM, pmctl); |
@@ -1574,12 +1596,15 @@ static int __de_set_settings(struct de_private *de, struct ethtool_cmd *ecmd) | |||
1574 | return 0; /* nothing to change */ | 1596 | return 0; /* nothing to change */ |
1575 | 1597 | ||
1576 | de_link_down(de); | 1598 | de_link_down(de); |
1599 | mod_timer(&de->media_timer, jiffies + DE_TIMER_NO_LINK); | ||
1577 | de_stop_rxtx(de); | 1600 | de_stop_rxtx(de); |
1578 | 1601 | ||
1579 | de->media_type = new_media; | 1602 | de->media_type = new_media; |
1580 | de->media_lock = media_lock; | 1603 | de->media_lock = media_lock; |
1581 | de->media_advertise = ecmd->advertising; | 1604 | de->media_advertise = ecmd->advertising; |
1582 | de_set_media(de); | 1605 | de_set_media(de); |
1606 | if (netif_running(de->dev)) | ||
1607 | de_start_rxtx(de); | ||
1583 | 1608 | ||
1584 | return 0; | 1609 | return 0; |
1585 | } | 1610 | } |
@@ -1911,8 +1936,14 @@ fill_defaults: | |||
1911 | for (i = 0; i < DE_MAX_MEDIA; i++) { | 1936 | for (i = 0; i < DE_MAX_MEDIA; i++) { |
1912 | if (de->media[i].csr13 == 0xffff) | 1937 | if (de->media[i].csr13 == 0xffff) |
1913 | de->media[i].csr13 = t21041_csr13[i]; | 1938 | de->media[i].csr13 = t21041_csr13[i]; |
1914 | if (de->media[i].csr14 == 0xffff) | 1939 | if (de->media[i].csr14 == 0xffff) { |
1915 | de->media[i].csr14 = t21041_csr14[i]; | 1940 | /* autonegotiation is broken at least on some chip |
1941 | revisions - rev. 0x21 works, 0x11 does not */ | ||
1942 | if (de->pdev->revision < 0x20) | ||
1943 | de->media[i].csr14 = t21041_csr14_brk[i]; | ||
1944 | else | ||
1945 | de->media[i].csr14 = t21041_csr14[i]; | ||
1946 | } | ||
1916 | if (de->media[i].csr15 == 0xffff) | 1947 | if (de->media[i].csr15 == 0xffff) |
1917 | de->media[i].csr15 = t21041_csr15[i]; | 1948 | de->media[i].csr15 = t21041_csr15[i]; |
1918 | } | 1949 | } |
@@ -2158,6 +2189,8 @@ static int de_resume (struct pci_dev *pdev) | |||
2158 | dev_err(&dev->dev, "pci_enable_device failed in resume\n"); | 2189 | dev_err(&dev->dev, "pci_enable_device failed in resume\n"); |
2159 | goto out; | 2190 | goto out; |
2160 | } | 2191 | } |
2192 | pci_set_master(pdev); | ||
2193 | de_init_rings(de); | ||
2161 | de_init_hw(de); | 2194 | de_init_hw(de); |
2162 | out_attach: | 2195 | out_attach: |
2163 | netif_device_attach(dev); | 2196 | netif_device_attach(dev); |
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 | ||
3604 | static int ucc_geth_suspend(struct of_device *ofdev, pm_message_t state) | 3604 | static 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 | ||
3632 | static int ucc_geth_resume(struct of_device *ofdev) | 3632 | static 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 | ||
3735 | static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *match) | 3735 | static 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 | ||
3957 | static int ucc_geth_remove(struct of_device* ofdev) | 3957 | static 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/hso.c b/drivers/net/usb/hso.c index 6efca66b8766..1cd752f9a6e1 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -1652,6 +1652,8 @@ static int hso_get_count(struct hso_serial *serial, | |||
1652 | struct uart_icount cnow; | 1652 | struct uart_icount cnow; |
1653 | struct hso_tiocmget *tiocmget = serial->tiocmget; | 1653 | struct hso_tiocmget *tiocmget = serial->tiocmget; |
1654 | 1654 | ||
1655 | memset(&icount, 0, sizeof(struct serial_icounter_struct)); | ||
1656 | |||
1655 | if (!tiocmget) | 1657 | if (!tiocmget) |
1656 | return -ENOENT; | 1658 | return -ENOENT; |
1657 | spin_lock_irq(&serial->serial_lock); | 1659 | spin_lock_irq(&serial->serial_lock); |
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index 08e7b6abacdd..b2bcf99e6f08 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 | }; |
97 | MODULE_DEVICE_TABLE(usb, ipheth_table); | 102 | MODULE_DEVICE_TABLE(usb, ipheth_table); |
@@ -424,10 +429,6 @@ static const struct net_device_ops ipheth_netdev_ops = { | |||
424 | .ndo_get_stats = &ipheth_stats, | 429 | .ndo_get_stats = &ipheth_stats, |
425 | }; | 430 | }; |
426 | 431 | ||
427 | static struct device_type ipheth_type = { | ||
428 | .name = "wwan", | ||
429 | }; | ||
430 | |||
431 | static int ipheth_probe(struct usb_interface *intf, | 432 | static int ipheth_probe(struct usb_interface *intf, |
432 | const struct usb_device_id *id) | 433 | const struct usb_device_id *id) |
433 | { | 434 | { |
@@ -445,7 +446,7 @@ static int ipheth_probe(struct usb_interface *intf, | |||
445 | 446 | ||
446 | netdev->netdev_ops = &ipheth_netdev_ops; | 447 | netdev->netdev_ops = &ipheth_netdev_ops; |
447 | netdev->watchdog_timeo = IPHETH_TX_TIMEOUT; | 448 | netdev->watchdog_timeo = IPHETH_TX_TIMEOUT; |
448 | strcpy(netdev->name, "wwan%d"); | 449 | strcpy(netdev->name, "eth%d"); |
449 | 450 | ||
450 | dev = netdev_priv(netdev); | 451 | dev = netdev_priv(netdev); |
451 | dev->udev = udev; | 452 | dev->udev = udev; |
@@ -495,7 +496,6 @@ static int ipheth_probe(struct usb_interface *intf, | |||
495 | 496 | ||
496 | SET_NETDEV_DEV(netdev, &intf->dev); | 497 | SET_NETDEV_DEV(netdev, &intf->dev); |
497 | SET_ETHTOOL_OPS(netdev, &ops); | 498 | SET_ETHTOOL_OPS(netdev, &ops); |
498 | SET_NETDEV_DEVTYPE(netdev, &ipheth_type); | ||
499 | 499 | ||
500 | retval = register_netdev(netdev); | 500 | retval = register_netdev(netdev); |
501 | if (retval) { | 501 | if (retval) { |
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 7f62e2dea28f..ca7fc9df1ccf 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c | |||
@@ -315,7 +315,7 @@ EXPORT_SYMBOL_GPL(usbnet_defer_kevent); | |||
315 | 315 | ||
316 | static void rx_complete (struct urb *urb); | 316 | static void rx_complete (struct urb *urb); |
317 | 317 | ||
318 | static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) | 318 | static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) |
319 | { | 319 | { |
320 | struct sk_buff *skb; | 320 | struct sk_buff *skb; |
321 | struct skb_data *entry; | 321 | struct skb_data *entry; |
@@ -327,7 +327,7 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) | |||
327 | netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); | 327 | netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); |
328 | usbnet_defer_kevent (dev, EVENT_RX_MEMORY); | 328 | usbnet_defer_kevent (dev, EVENT_RX_MEMORY); |
329 | usb_free_urb (urb); | 329 | usb_free_urb (urb); |
330 | return; | 330 | return -ENOMEM; |
331 | } | 331 | } |
332 | skb_reserve (skb, NET_IP_ALIGN); | 332 | skb_reserve (skb, NET_IP_ALIGN); |
333 | 333 | ||
@@ -357,6 +357,9 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) | |||
357 | netif_dbg(dev, ifdown, dev->net, "device gone\n"); | 357 | netif_dbg(dev, ifdown, dev->net, "device gone\n"); |
358 | netif_device_detach (dev->net); | 358 | netif_device_detach (dev->net); |
359 | break; | 359 | break; |
360 | case -EHOSTUNREACH: | ||
361 | retval = -ENOLINK; | ||
362 | break; | ||
360 | default: | 363 | default: |
361 | netif_dbg(dev, rx_err, dev->net, | 364 | netif_dbg(dev, rx_err, dev->net, |
362 | "rx submit, %d\n", retval); | 365 | "rx submit, %d\n", retval); |
@@ -374,6 +377,7 @@ static void rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) | |||
374 | dev_kfree_skb_any (skb); | 377 | dev_kfree_skb_any (skb); |
375 | usb_free_urb (urb); | 378 | usb_free_urb (urb); |
376 | } | 379 | } |
380 | return retval; | ||
377 | } | 381 | } |
378 | 382 | ||
379 | 383 | ||
@@ -912,6 +916,7 @@ fail_halt: | |||
912 | /* tasklet could resubmit itself forever if memory is tight */ | 916 | /* tasklet could resubmit itself forever if memory is tight */ |
913 | if (test_bit (EVENT_RX_MEMORY, &dev->flags)) { | 917 | if (test_bit (EVENT_RX_MEMORY, &dev->flags)) { |
914 | struct urb *urb = NULL; | 918 | struct urb *urb = NULL; |
919 | int resched = 1; | ||
915 | 920 | ||
916 | if (netif_running (dev->net)) | 921 | if (netif_running (dev->net)) |
917 | urb = usb_alloc_urb (0, GFP_KERNEL); | 922 | urb = usb_alloc_urb (0, GFP_KERNEL); |
@@ -922,10 +927,12 @@ fail_halt: | |||
922 | status = usb_autopm_get_interface(dev->intf); | 927 | status = usb_autopm_get_interface(dev->intf); |
923 | if (status < 0) | 928 | if (status < 0) |
924 | goto fail_lowmem; | 929 | goto fail_lowmem; |
925 | rx_submit (dev, urb, GFP_KERNEL); | 930 | if (rx_submit (dev, urb, GFP_KERNEL) == -ENOLINK) |
931 | resched = 0; | ||
926 | usb_autopm_put_interface(dev->intf); | 932 | usb_autopm_put_interface(dev->intf); |
927 | fail_lowmem: | 933 | fail_lowmem: |
928 | tasklet_schedule (&dev->bh); | 934 | if (resched) |
935 | tasklet_schedule (&dev->bh); | ||
929 | } | 936 | } |
930 | } | 937 | } |
931 | 938 | ||
@@ -1175,8 +1182,11 @@ static void usbnet_bh (unsigned long param) | |||
1175 | // don't refill the queue all at once | 1182 | // don't refill the queue all at once |
1176 | for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) { | 1183 | for (i = 0; i < 10 && dev->rxq.qlen < qlen; i++) { |
1177 | urb = usb_alloc_urb (0, GFP_ATOMIC); | 1184 | urb = usb_alloc_urb (0, GFP_ATOMIC); |
1178 | if (urb != NULL) | 1185 | if (urb != NULL) { |
1179 | rx_submit (dev, urb, GFP_ATOMIC); | 1186 | if (rx_submit (dev, urb, GFP_ATOMIC) == |
1187 | -ENOLINK) | ||
1188 | return; | ||
1189 | } | ||
1180 | } | 1190 | } |
1181 | if (temp != dev->rxq.qlen) | 1191 | if (temp != dev->rxq.qlen) |
1182 | netif_dbg(dev, link, dev->net, | 1192 | netif_dbg(dev, link, dev->net, |
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c index fd69095ef6e3..f53412368ce1 100644 --- a/drivers/net/via-velocity.c +++ b/drivers/net/via-velocity.c | |||
@@ -2824,7 +2824,7 @@ static int __devinit velocity_found1(struct pci_dev *pdev, const struct pci_devi | |||
2824 | netif_napi_add(dev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT); | 2824 | netif_napi_add(dev, &vptr->napi, velocity_poll, VELOCITY_NAPI_WEIGHT); |
2825 | 2825 | ||
2826 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER | | 2826 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER | |
2827 | NETIF_F_HW_VLAN_RX | NETIF_F_IP_CSUM | NETIF_F_SG; | 2827 | NETIF_F_HW_VLAN_RX | NETIF_F_IP_CSUM; |
2828 | 2828 | ||
2829 | ret = register_netdev(dev); | 2829 | ret = register_netdev(dev); |
2830 | if (ret < 0) | 2830 | if (ret < 0) |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index ad7719fe6d0a..e050bd65e037 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -885,20 +885,21 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, | |||
885 | * Receive a frame through the DMA | 885 | * Receive a frame through the DMA |
886 | */ | 886 | */ |
887 | static inline void | 887 | static inline void |
888 | fst_rx_dma(struct fst_card_info *card, unsigned char *skb, | 888 | fst_rx_dma(struct fst_card_info *card, dma_addr_t skb, |
889 | unsigned char *mem, int len) | 889 | dma_addr_t mem, int len) |
890 | { | 890 | { |
891 | /* | 891 | /* |
892 | * This routine will setup the DMA and start it | 892 | * This routine will setup the DMA and start it |
893 | */ | 893 | */ |
894 | 894 | ||
895 | dbg(DBG_RX, "In fst_rx_dma %p %p %d\n", skb, mem, len); | 895 | dbg(DBG_RX, "In fst_rx_dma %lx %lx %d\n", |
896 | (unsigned long) skb, (unsigned long) mem, len); | ||
896 | if (card->dmarx_in_progress) { | 897 | if (card->dmarx_in_progress) { |
897 | dbg(DBG_ASS, "In fst_rx_dma while dma in progress\n"); | 898 | dbg(DBG_ASS, "In fst_rx_dma while dma in progress\n"); |
898 | } | 899 | } |
899 | 900 | ||
900 | outl((unsigned long) skb, card->pci_conf + DMAPADR0); /* Copy to here */ | 901 | outl(skb, card->pci_conf + DMAPADR0); /* Copy to here */ |
901 | outl((unsigned long) mem, card->pci_conf + DMALADR0); /* from here */ | 902 | outl(mem, card->pci_conf + DMALADR0); /* from here */ |
902 | outl(len, card->pci_conf + DMASIZ0); /* for this length */ | 903 | outl(len, card->pci_conf + DMASIZ0); /* for this length */ |
903 | outl(0x00000000c, card->pci_conf + DMADPR0); /* In this direction */ | 904 | outl(0x00000000c, card->pci_conf + DMADPR0); /* In this direction */ |
904 | 905 | ||
@@ -1309,8 +1310,8 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port) | |||
1309 | card->dma_port_rx = port; | 1310 | card->dma_port_rx = port; |
1310 | card->dma_len_rx = len; | 1311 | card->dma_len_rx = len; |
1311 | card->dma_rxpos = rxp; | 1312 | card->dma_rxpos = rxp; |
1312 | fst_rx_dma(card, (char *) card->rx_dma_handle_card, | 1313 | fst_rx_dma(card, card->rx_dma_handle_card, |
1313 | (char *) BUF_OFFSET(rxBuffer[pi][rxp][0]), len); | 1314 | BUF_OFFSET(rxBuffer[pi][rxp][0]), len); |
1314 | } | 1315 | } |
1315 | if (rxp != port->rxpos) { | 1316 | if (rxp != port->rxpos) { |
1316 | dbg(DBG_ASS, "About to increment rxpos by more than 1\n"); | 1317 | dbg(DBG_ASS, "About to increment rxpos by more than 1\n"); |
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, | |||
230 | static int airo_config(struct pcmcia_device *link) | 200 | static 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 | ||
215 | static int atmel_config(struct pcmcia_device *link) | 212 | static 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 | ||
26 | static dev_info_t dev_info = "hostap_cs"; | 25 | static char *dev_info = "hostap_cs"; |
27 | 26 | ||
28 | MODULE_AUTHOR("Jouni Malinen"); | 27 | MODULE_AUTHOR("Jouni Malinen"); |
29 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " | 28 | MODULE_DESCRIPTION("Support for Intersil Prism2-based 802.11 wireless LAN " |
@@ -225,27 +224,18 @@ static int prism2_pccard_card_present(local_info_t *local) | |||
225 | static void sandisk_set_iobase(local_info_t *local) | 224 | static 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 | ®); | ||
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 | ®); | ||
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) | |||
271 | static int sandisk_enable_wireless(struct net_device *dev) | 261 | static 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 | ®); | ||
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 | ®); | 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: | |||
343 | static void prism2_pccard_cor_sreset(local_info_t *local) | 325 | static 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 | ®); | ||
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 | ®); | ||
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 | ®); | ||
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) | |||
396 | static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) | 370 | static 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 | ®); | ||
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 | ®); | ||
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 | ®); | ||
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 | ®); | ||
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 | ||
590 | static int prism2_config(struct pcmcia_device *link) | 542 | static 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 | ||
822 | static int if_cs_probe(struct pcmcia_device *p_dev) | 821 | static 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 | |||
80 | spectrum_reset(struct pcmcia_device *link, int idle) | 79 | spectrum_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, ®); | ||
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, ®); | ||
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, ®); | ||
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, ®); | ||
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, ®); | ||
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 @@ | |||
89 | static int wl3501_config(struct pcmcia_device *link); | 88 | static int wl3501_config(struct pcmcia_device *link); |
90 | static void wl3501_release(struct pcmcia_device *link); | 89 | static 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 | */ | ||
97 | static dev_info_t wl3501_dev_info = "wl3501_cs"; | ||
98 | |||
99 | static const struct { | 91 | static 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 | ||
1422 | static void wl3501_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) | 1414 | static 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 | ||
1427 | static const struct ethtool_ops ops = { | 1419 | static 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 | */ |
1089 | static bool get_bool(struct of_device *ofdev, const char *s) | 1089 | static 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 | */ |
1118 | static int __devinit xemaclite_of_probe(struct of_device *ofdev, | 1118 | static 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 | */ |
1243 | static int __devexit xemaclite_of_remove(struct of_device *of_dev) | 1243 | static 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); |