diff options
Diffstat (limited to 'drivers/net')
138 files changed, 3027 insertions, 1921 deletions
diff --git a/drivers/net/3c527.c b/drivers/net/3c527.c index 70705d1306b9..eca55c52bdfd 100644 --- a/drivers/net/3c527.c +++ b/drivers/net/3c527.c | |||
@@ -522,7 +522,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot) | |||
522 | lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */ | 522 | lp->tx_len = lp->exec_box->data[9]; /* Transmit list count */ |
523 | lp->rx_len = lp->exec_box->data[11]; /* Receive list count */ | 523 | lp->rx_len = lp->exec_box->data[11]; /* Receive list count */ |
524 | 524 | ||
525 | init_MUTEX_LOCKED(&lp->cmd_mutex); | 525 | sema_init(&lp->cmd_mutex, 0); |
526 | init_completion(&lp->execution_cmd); | 526 | init_completion(&lp->execution_cmd); |
527 | init_completion(&lp->xceiver_cmd); | 527 | init_completion(&lp->xceiver_cmd); |
528 | 528 | ||
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 5a6895320b48..77efe462b921 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2,6 +2,9 @@ | |||
2 | # Network device configuration | 2 | # Network device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | config HAVE_NET_MACB | ||
6 | bool | ||
7 | |||
5 | menuconfig NETDEVICES | 8 | menuconfig NETDEVICES |
6 | default y if UML | 9 | default y if UML |
7 | depends on NET | 10 | depends on NET |
@@ -221,7 +224,7 @@ config MII | |||
221 | 224 | ||
222 | config MACB | 225 | config MACB |
223 | tristate "Atmel MACB support" | 226 | tristate "Atmel MACB support" |
224 | depends on AVR32 || ARCH_AT91SAM9260 || ARCH_AT91SAM9263 || ARCH_AT91SAM9G20 || ARCH_AT91SAM9G45 || ARCH_AT91CAP9 | 227 | depends on HAVE_NET_MACB |
225 | select PHYLIB | 228 | select PHYLIB |
226 | help | 229 | help |
227 | The Atmel MACB ethernet interface is found on many AT32 and AT91 | 230 | The Atmel MACB ethernet interface is found on many AT32 and AT91 |
@@ -928,6 +931,16 @@ config SMC91X | |||
928 | The module will be called smc91x. If you want to compile it as a | 931 | 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>. | 932 | module, say M here and read <file:Documentation/kbuild/modules.txt>. |
930 | 933 | ||
934 | config PXA168_ETH | ||
935 | tristate "Marvell pxa168 ethernet support" | ||
936 | depends on CPU_PXA168 | ||
937 | select PHYLIB | ||
938 | help | ||
939 | This driver supports the pxa168 Ethernet ports. | ||
940 | |||
941 | To compile this driver as a module, choose M here. The module | ||
942 | will be called pxa168_eth. | ||
943 | |||
931 | config NET_NETX | 944 | config NET_NETX |
932 | tristate "NetX Ethernet support" | 945 | tristate "NetX Ethernet support" |
933 | select MII | 946 | select MII |
@@ -2418,7 +2431,7 @@ config UGETH_TX_ON_DEMAND | |||
2418 | 2431 | ||
2419 | config MV643XX_ETH | 2432 | config MV643XX_ETH |
2420 | tristate "Marvell Discovery (643XX) and Orion ethernet support" | 2433 | tristate "Marvell Discovery (643XX) and Orion ethernet support" |
2421 | depends on MV64X60 || PPC32 || PLAT_ORION | 2434 | depends on (MV64X60 || PPC32 || PLAT_ORION) && INET |
2422 | select INET_LRO | 2435 | select INET_LRO |
2423 | select PHYLIB | 2436 | select PHYLIB |
2424 | help | 2437 | help |
@@ -2793,7 +2806,7 @@ config NIU | |||
2793 | 2806 | ||
2794 | config PASEMI_MAC | 2807 | config PASEMI_MAC |
2795 | tristate "PA Semi 1/10Gbit MAC" | 2808 | tristate "PA Semi 1/10Gbit MAC" |
2796 | depends on PPC_PASEMI && PCI | 2809 | depends on PPC_PASEMI && PCI && INET |
2797 | select PHYLIB | 2810 | select PHYLIB |
2798 | select INET_LRO | 2811 | select INET_LRO |
2799 | help | 2812 | help |
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/appletalk/Kconfig b/drivers/net/appletalk/Kconfig index 0a0e0cd81a23..20f97e7017ce 100644 --- a/drivers/net/appletalk/Kconfig +++ b/drivers/net/appletalk/Kconfig | |||
@@ -3,6 +3,7 @@ | |||
3 | # | 3 | # |
4 | config ATALK | 4 | config ATALK |
5 | tristate "Appletalk protocol support" | 5 | tristate "Appletalk protocol support" |
6 | depends on BKL # waiting to be removed from net/appletalk/ddp.c | ||
6 | select LLC | 7 | select LLC |
7 | ---help--- | 8 | ---help--- |
8 | AppleTalk is the protocol that Apple computers can use to communicate | 9 | AppleTalk is the protocol that Apple computers can use to communicate |
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/b44.c b/drivers/net/b44.c index 37617abc1647..efeffdf9e5fa 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; |
@@ -2161,8 +2170,6 @@ static int __devinit b44_init_one(struct ssb_device *sdev, | |||
2161 | dev->irq = sdev->irq; | 2170 | dev->irq = sdev->irq; |
2162 | SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); | 2171 | SET_ETHTOOL_OPS(dev, &b44_ethtool_ops); |
2163 | 2172 | ||
2164 | netif_carrier_off(dev); | ||
2165 | |||
2166 | err = ssb_bus_powerup(sdev->bus, 0); | 2173 | err = ssb_bus_powerup(sdev->bus, 0); |
2167 | if (err) { | 2174 | if (err) { |
2168 | dev_err(sdev->dev, | 2175 | dev_err(sdev->dev, |
@@ -2204,6 +2211,8 @@ static int __devinit b44_init_one(struct ssb_device *sdev, | |||
2204 | goto err_out_powerdown; | 2211 | goto err_out_powerdown; |
2205 | } | 2212 | } |
2206 | 2213 | ||
2214 | netif_carrier_off(dev); | ||
2215 | |||
2207 | ssb_set_drvdata(sdev, dev); | 2216 | ssb_set_drvdata(sdev, dev); |
2208 | 2217 | ||
2209 | /* Chip reset provides power to the b44 MAC & PCI cores, which | 2218 | /* Chip reset provides power to the b44 MAC & PCI cores, which |
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/bfin_mac.c b/drivers/net/bfin_mac.c index 012613fde3f4..03d063554b7f 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <asm/blackfin.h> | 38 | #include <asm/blackfin.h> |
39 | #include <asm/cacheflush.h> | 39 | #include <asm/cacheflush.h> |
40 | #include <asm/portmux.h> | 40 | #include <asm/portmux.h> |
41 | #include <mach/pll.h> | ||
41 | 42 | ||
42 | #include "bfin_mac.h" | 43 | #include "bfin_mac.h" |
43 | 44 | ||
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..e953c6ad6e6d 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; |
@@ -5142,6 +5164,15 @@ int bond_create(struct net *net, const char *name) | |||
5142 | res = dev_alloc_name(bond_dev, "bond%d"); | 5164 | res = dev_alloc_name(bond_dev, "bond%d"); |
5143 | if (res < 0) | 5165 | if (res < 0) |
5144 | goto out; | 5166 | goto out; |
5167 | } else { | ||
5168 | /* | ||
5169 | * If we're given a name to register | ||
5170 | * we need to ensure that its not already | ||
5171 | * registered | ||
5172 | */ | ||
5173 | res = -EEXIST; | ||
5174 | if (__dev_get_by_name(net, name) != NULL) | ||
5175 | goto out; | ||
5145 | } | 5176 | } |
5146 | 5177 | ||
5147 | res = register_netdevice(bond_dev); | 5178 | res = register_netdevice(bond_dev); |
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.c b/drivers/net/caif/caif_spi.c index f5058ff2b210..8427533fe313 100644 --- a/drivers/net/caif/caif_spi.c +++ b/drivers/net/caif/caif_spi.c | |||
@@ -240,13 +240,15 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf, | |||
240 | static const struct file_operations dbgfs_state_fops = { | 240 | static const struct file_operations dbgfs_state_fops = { |
241 | .open = dbgfs_open, | 241 | .open = dbgfs_open, |
242 | .read = dbgfs_state, | 242 | .read = dbgfs_state, |
243 | .owner = THIS_MODULE | 243 | .owner = THIS_MODULE, |
244 | .llseek = default_llseek, | ||
244 | }; | 245 | }; |
245 | 246 | ||
246 | static const struct file_operations dbgfs_frame_fops = { | 247 | static const struct file_operations dbgfs_frame_fops = { |
247 | .open = dbgfs_open, | 248 | .open = dbgfs_open, |
248 | .read = dbgfs_frame, | 249 | .read = dbgfs_frame, |
249 | .owner = THIS_MODULE | 250 | .owner = THIS_MODULE, |
251 | .llseek = default_llseek, | ||
250 | }; | 252 | }; |
251 | 253 | ||
252 | static inline void dev_debugfs_add(struct cfspi *cfspi) | 254 | static inline void dev_debugfs_add(struct cfspi *cfspi) |
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/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c index c327527fbbc8..e2bf10d90add 100644 --- a/drivers/net/cxgb4/cxgb4_main.c +++ b/drivers/net/cxgb4/cxgb4_main.c | |||
@@ -2026,6 +2026,7 @@ static const struct file_operations mem_debugfs_fops = { | |||
2026 | .owner = THIS_MODULE, | 2026 | .owner = THIS_MODULE, |
2027 | .open = mem_open, | 2027 | .open = mem_open, |
2028 | .read = mem_read, | 2028 | .read = mem_read, |
2029 | .llseek = default_llseek, | ||
2029 | }; | 2030 | }; |
2030 | 2031 | ||
2031 | static void __devinit add_debugfs_mem(struct adapter *adap, const char *name, | 2032 | static void __devinit add_debugfs_mem(struct adapter *adap, const char *name, |
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 2b8ef44bd2b1..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)) && |
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index 99a929964e3c..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 | ||
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 897719b49f96..6372610ed240 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -533,8 +533,15 @@ static inline void ehea_fill_skb(struct net_device *dev, | |||
533 | int length = cqe->num_bytes_transfered - 4; /*remove CRC */ | 533 | int length = cqe->num_bytes_transfered - 4; /*remove CRC */ |
534 | 534 | ||
535 | skb_put(skb, length); | 535 | skb_put(skb, length); |
536 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
537 | skb->protocol = eth_type_trans(skb, dev); | 536 | skb->protocol = eth_type_trans(skb, dev); |
537 | |||
538 | /* The packet was not an IPV4 packet so a complemented checksum was | ||
539 | calculated. The value is found in the Internet Checksum field. */ | ||
540 | if (cqe->status & EHEA_CQE_BLIND_CKSUM) { | ||
541 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
542 | skb->csum = csum_unfold(~cqe->inet_checksum_value); | ||
543 | } else | ||
544 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
538 | } | 545 | } |
539 | 546 | ||
540 | static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, | 547 | static inline struct sk_buff *get_skb_by_index(struct sk_buff **skb_array, |
@@ -776,6 +783,53 @@ static int ehea_proc_rwqes(struct net_device *dev, | |||
776 | return processed; | 783 | return processed; |
777 | } | 784 | } |
778 | 785 | ||
786 | #define SWQE_RESTART_CHECK 0xdeadbeaff00d0000ull | ||
787 | |||
788 | static void reset_sq_restart_flag(struct ehea_port *port) | ||
789 | { | ||
790 | int i; | ||
791 | |||
792 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { | ||
793 | struct ehea_port_res *pr = &port->port_res[i]; | ||
794 | pr->sq_restart_flag = 0; | ||
795 | } | ||
796 | } | ||
797 | |||
798 | static void check_sqs(struct ehea_port *port) | ||
799 | { | ||
800 | struct ehea_swqe *swqe; | ||
801 | int swqe_index; | ||
802 | int i, k; | ||
803 | |||
804 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { | ||
805 | struct ehea_port_res *pr = &port->port_res[i]; | ||
806 | k = 0; | ||
807 | swqe = ehea_get_swqe(pr->qp, &swqe_index); | ||
808 | memset(swqe, 0, SWQE_HEADER_SIZE); | ||
809 | atomic_dec(&pr->swqe_avail); | ||
810 | |||
811 | swqe->tx_control |= EHEA_SWQE_PURGE; | ||
812 | swqe->wr_id = SWQE_RESTART_CHECK; | ||
813 | swqe->tx_control |= EHEA_SWQE_SIGNALLED_COMPLETION; | ||
814 | swqe->tx_control |= EHEA_SWQE_IMM_DATA_PRESENT; | ||
815 | swqe->immediate_data_length = 80; | ||
816 | |||
817 | ehea_post_swqe(pr->qp, swqe); | ||
818 | |||
819 | while (pr->sq_restart_flag == 0) { | ||
820 | msleep(5); | ||
821 | if (++k == 100) { | ||
822 | ehea_error("HW/SW queues out of sync"); | ||
823 | ehea_schedule_port_reset(pr->port); | ||
824 | return; | ||
825 | } | ||
826 | } | ||
827 | } | ||
828 | |||
829 | return; | ||
830 | } | ||
831 | |||
832 | |||
779 | static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) | 833 | static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) |
780 | { | 834 | { |
781 | struct sk_buff *skb; | 835 | struct sk_buff *skb; |
@@ -793,6 +847,13 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) | |||
793 | 847 | ||
794 | cqe_counter++; | 848 | cqe_counter++; |
795 | rmb(); | 849 | rmb(); |
850 | |||
851 | if (cqe->wr_id == SWQE_RESTART_CHECK) { | ||
852 | pr->sq_restart_flag = 1; | ||
853 | swqe_av++; | ||
854 | break; | ||
855 | } | ||
856 | |||
796 | if (cqe->status & EHEA_CQE_STAT_ERR_MASK) { | 857 | if (cqe->status & EHEA_CQE_STAT_ERR_MASK) { |
797 | ehea_error("Bad send completion status=0x%04X", | 858 | ehea_error("Bad send completion status=0x%04X", |
798 | cqe->status); | 859 | cqe->status); |
@@ -2675,8 +2736,10 @@ static void ehea_flush_sq(struct ehea_port *port) | |||
2675 | int k = 0; | 2736 | int k = 0; |
2676 | while (atomic_read(&pr->swqe_avail) < swqe_max) { | 2737 | while (atomic_read(&pr->swqe_avail) < swqe_max) { |
2677 | msleep(5); | 2738 | msleep(5); |
2678 | if (++k == 20) | 2739 | if (++k == 20) { |
2740 | ehea_error("WARNING: sq not flushed completely"); | ||
2679 | break; | 2741 | break; |
2742 | } | ||
2680 | } | 2743 | } |
2681 | } | 2744 | } |
2682 | } | 2745 | } |
@@ -2917,6 +2980,7 @@ static void ehea_rereg_mrs(struct work_struct *work) | |||
2917 | port_napi_disable(port); | 2980 | port_napi_disable(port); |
2918 | mutex_unlock(&port->port_lock); | 2981 | mutex_unlock(&port->port_lock); |
2919 | } | 2982 | } |
2983 | reset_sq_restart_flag(port); | ||
2920 | } | 2984 | } |
2921 | 2985 | ||
2922 | /* Unregister old memory region */ | 2986 | /* Unregister old memory region */ |
@@ -2951,6 +3015,7 @@ static void ehea_rereg_mrs(struct work_struct *work) | |||
2951 | mutex_lock(&port->port_lock); | 3015 | mutex_lock(&port->port_lock); |
2952 | port_napi_enable(port); | 3016 | port_napi_enable(port); |
2953 | ret = ehea_restart_qps(dev); | 3017 | ret = ehea_restart_qps(dev); |
3018 | check_sqs(port); | ||
2954 | if (!ret) | 3019 | if (!ret) |
2955 | netif_wake_queue(dev); | 3020 | netif_wake_queue(dev); |
2956 | mutex_unlock(&port->port_lock); | 3021 | mutex_unlock(&port->port_lock); |
diff --git a/drivers/net/ehea/ehea_qmr.h b/drivers/net/ehea/ehea_qmr.h index f608a6c54af5..38104734a3be 100644 --- a/drivers/net/ehea/ehea_qmr.h +++ b/drivers/net/ehea/ehea_qmr.h | |||
@@ -150,6 +150,7 @@ struct ehea_rwqe { | |||
150 | #define EHEA_CQE_TYPE_RQ 0x60 | 150 | #define EHEA_CQE_TYPE_RQ 0x60 |
151 | #define EHEA_CQE_STAT_ERR_MASK 0x700F | 151 | #define EHEA_CQE_STAT_ERR_MASK 0x700F |
152 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF | 152 | #define EHEA_CQE_STAT_FAT_ERR_MASK 0xF |
153 | #define EHEA_CQE_BLIND_CKSUM 0x8000 | ||
153 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 | 154 | #define EHEA_CQE_STAT_ERR_TCP 0x4000 |
154 | #define EHEA_CQE_STAT_ERR_IP 0x2000 | 155 | #define EHEA_CQE_STAT_ERR_IP 0x2000 |
155 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 | 156 | #define EHEA_CQE_STAT_ERR_CRC 0x1000 |
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.c b/drivers/net/fec.c index 768b840aeb6b..cce32d43175f 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -678,24 +678,37 @@ static int fec_enet_mii_probe(struct net_device *dev) | |||
678 | { | 678 | { |
679 | struct fec_enet_private *fep = netdev_priv(dev); | 679 | struct fec_enet_private *fep = netdev_priv(dev); |
680 | struct phy_device *phy_dev = NULL; | 680 | struct phy_device *phy_dev = NULL; |
681 | int ret; | 681 | char mdio_bus_id[MII_BUS_ID_SIZE]; |
682 | char phy_name[MII_BUS_ID_SIZE + 3]; | ||
683 | int phy_id; | ||
682 | 684 | ||
683 | fep->phy_dev = NULL; | 685 | fep->phy_dev = NULL; |
684 | 686 | ||
685 | /* find the first phy */ | 687 | /* check for attached phy */ |
686 | phy_dev = phy_find_first(fep->mii_bus); | 688 | for (phy_id = 0; (phy_id < PHY_MAX_ADDR); phy_id++) { |
687 | if (!phy_dev) { | 689 | if ((fep->mii_bus->phy_mask & (1 << phy_id))) |
688 | printk(KERN_ERR "%s: no PHY found\n", dev->name); | 690 | continue; |
689 | return -ENODEV; | 691 | if (fep->mii_bus->phy_map[phy_id] == NULL) |
692 | continue; | ||
693 | if (fep->mii_bus->phy_map[phy_id]->phy_id == 0) | ||
694 | continue; | ||
695 | strncpy(mdio_bus_id, fep->mii_bus->id, MII_BUS_ID_SIZE); | ||
696 | break; | ||
690 | } | 697 | } |
691 | 698 | ||
692 | /* attach the mac to the phy */ | 699 | if (phy_id >= PHY_MAX_ADDR) { |
693 | ret = phy_connect_direct(dev, phy_dev, | 700 | printk(KERN_INFO "%s: no PHY, assuming direct connection " |
694 | &fec_enet_adjust_link, 0, | 701 | "to switch\n", dev->name); |
695 | PHY_INTERFACE_MODE_MII); | 702 | strncpy(mdio_bus_id, "0", MII_BUS_ID_SIZE); |
696 | if (ret) { | 703 | phy_id = 0; |
697 | printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); | 704 | } |
698 | return ret; | 705 | |
706 | snprintf(phy_name, MII_BUS_ID_SIZE, PHY_ID_FMT, mdio_bus_id, phy_id); | ||
707 | phy_dev = phy_connect(dev, phy_name, &fec_enet_adjust_link, 0, | ||
708 | PHY_INTERFACE_MODE_MII); | ||
709 | if (IS_ERR(phy_dev)) { | ||
710 | printk(KERN_ERR "%s: could not attach to PHY\n", dev->name); | ||
711 | return PTR_ERR(phy_dev); | ||
699 | } | 712 | } |
700 | 713 | ||
701 | /* mask with MAC supported features */ | 714 | /* mask with MAC supported features */ |
@@ -738,7 +751,7 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
738 | fep->mii_bus->read = fec_enet_mdio_read; | 751 | fep->mii_bus->read = fec_enet_mdio_read; |
739 | fep->mii_bus->write = fec_enet_mdio_write; | 752 | fep->mii_bus->write = fec_enet_mdio_write; |
740 | fep->mii_bus->reset = fec_enet_mdio_reset; | 753 | fep->mii_bus->reset = fec_enet_mdio_reset; |
741 | snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id); | 754 | snprintf(fep->mii_bus->id, MII_BUS_ID_SIZE, "%x", pdev->id + 1); |
742 | fep->mii_bus->priv = fep; | 755 | fep->mii_bus->priv = fep; |
743 | fep->mii_bus->parent = &pdev->dev; | 756 | fep->mii_bus->parent = &pdev->dev; |
744 | 757 | ||
@@ -1311,6 +1324,9 @@ fec_probe(struct platform_device *pdev) | |||
1311 | if (ret) | 1324 | if (ret) |
1312 | goto failed_mii_init; | 1325 | goto failed_mii_init; |
1313 | 1326 | ||
1327 | /* Carrier starts down, phylib will bring it up */ | ||
1328 | netif_carrier_off(ndev); | ||
1329 | |||
1314 | ret = register_netdev(ndev); | 1330 | ret = register_netdev(ndev); |
1315 | if (ret) | 1331 | if (ret) |
1316 | goto failed_register; | 1332 | goto failed_register; |
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 4b52c767ad05..3e5d0b6b6516 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -608,7 +608,7 @@ static int sixpack_open(struct tty_struct *tty) | |||
608 | 608 | ||
609 | spin_lock_init(&sp->lock); | 609 | spin_lock_init(&sp->lock); |
610 | atomic_set(&sp->refcnt, 1); | 610 | atomic_set(&sp->refcnt, 1); |
611 | init_MUTEX_LOCKED(&sp->dead_sem); | 611 | sema_init(&sp->dead_sem, 0); |
612 | 612 | ||
613 | /* !!! length of the buffers. MTU is IP MTU, not PACLEN! */ | 613 | /* !!! length of the buffers. MTU is IP MTU, not PACLEN! */ |
614 | 614 | ||
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 66e88bd59caa..4c628393c8b1 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -747,7 +747,7 @@ static int mkiss_open(struct tty_struct *tty) | |||
747 | 747 | ||
748 | spin_lock_init(&ax->buflock); | 748 | spin_lock_init(&ax->buflock); |
749 | atomic_set(&ax->refcnt, 1); | 749 | atomic_set(&ax->refcnt, 1); |
750 | init_MUTEX_LOCKED(&ax->dead_sem); | 750 | sema_init(&ax->dead_sem, 0); |
751 | 751 | ||
752 | ax->tty = tty; | 752 | ax->tty = tty; |
753 | tty->disc_data = ax; | 753 | tty->disc_data = ax; |
diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index 3506fd6ad726..519e19e23955 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c | |||
@@ -2928,7 +2928,7 @@ static int __devinit emac_probe(struct platform_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 |
@@ -2971,7 +2971,7 @@ static int __devexit emac_remove(struct platform_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/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/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/sir_dev.c b/drivers/net/irda/sir_dev.c index 1b051dab7b29..51d74447f8f8 100644 --- a/drivers/net/irda/sir_dev.c +++ b/drivers/net/irda/sir_dev.c | |||
@@ -909,7 +909,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n | |||
909 | dev->tx_skb = NULL; | 909 | dev->tx_skb = NULL; |
910 | 910 | ||
911 | spin_lock_init(&dev->tx_lock); | 911 | spin_lock_init(&dev->tx_lock); |
912 | init_MUTEX(&dev->fsm.sem); | 912 | sema_init(&dev->fsm.sem, 1); |
913 | 913 | ||
914 | dev->drv = drv; | 914 | dev->drv = drv; |
915 | dev->netdev = ndev; | 915 | dev->netdev = ndev; |
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 c7b624711f5e..87f0a93b165c 100644 --- a/drivers/net/ll_temac_main.c +++ b/drivers/net/ll_temac_main.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/of_device.h> | 38 | #include <linux/of_device.h> |
39 | #include <linux/of_mdio.h> | 39 | #include <linux/of_mdio.h> |
40 | #include <linux/of_platform.h> | 40 | #include <linux/of_platform.h> |
41 | #include <linux/of_address.h> | ||
41 | #include <linux/skbuff.h> | 42 | #include <linux/skbuff.h> |
42 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
43 | #include <linux/tcp.h> /* needed for sizeof(tcphdr) */ | 44 | #include <linux/tcp.h> /* needed for sizeof(tcphdr) */ |
@@ -902,8 +903,8 @@ temac_poll_controller(struct net_device *ndev) | |||
902 | disable_irq(lp->tx_irq); | 903 | disable_irq(lp->tx_irq); |
903 | disable_irq(lp->rx_irq); | 904 | disable_irq(lp->rx_irq); |
904 | 905 | ||
905 | ll_temac_rx_irq(lp->tx_irq, lp); | 906 | ll_temac_rx_irq(lp->tx_irq, ndev); |
906 | ll_temac_tx_irq(lp->rx_irq, lp); | 907 | ll_temac_tx_irq(lp->rx_irq, ndev); |
907 | 908 | ||
908 | enable_irq(lp->tx_irq); | 909 | enable_irq(lp->tx_irq); |
909 | enable_irq(lp->rx_irq); | 910 | enable_irq(lp->rx_irq); |
diff --git a/drivers/net/ll_temac_mdio.c b/drivers/net/ll_temac_mdio.c index 5ae28c975b38..8cf9d4f56bb2 100644 --- a/drivers/net/ll_temac_mdio.c +++ b/drivers/net/ll_temac_mdio.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/phy.h> | 10 | #include <linux/phy.h> |
11 | #include <linux/of.h> | 11 | #include <linux/of.h> |
12 | #include <linux/of_device.h> | 12 | #include <linux/of_device.h> |
13 | #include <linux/of_address.h> | ||
13 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
14 | #include <linux/of_mdio.h> | 15 | #include <linux/of_mdio.h> |
15 | 16 | ||
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 bc695d53cdcc..fe6983af6918 100644 --- a/drivers/net/niu.c +++ b/drivers/net/niu.c | |||
@@ -7269,32 +7269,28 @@ static int niu_get_ethtool_tcam_all(struct niu *np, | |||
7269 | struct niu_parent *parent = np->parent; | 7269 | struct niu_parent *parent = np->parent; |
7270 | struct niu_tcam_entry *tp; | 7270 | struct niu_tcam_entry *tp; |
7271 | int i, idx, cnt; | 7271 | int i, idx, cnt; |
7272 | u16 n_entries; | ||
7273 | unsigned long flags; | 7272 | unsigned long flags; |
7274 | 7273 | int ret = 0; | |
7275 | 7274 | ||
7276 | /* put the tcam size here */ | 7275 | /* put the tcam size here */ |
7277 | nfc->data = tcam_get_size(np); | 7276 | nfc->data = tcam_get_size(np); |
7278 | 7277 | ||
7279 | niu_lock_parent(np, flags); | 7278 | niu_lock_parent(np, flags); |
7280 | n_entries = nfc->rule_cnt; | ||
7281 | for (cnt = 0, i = 0; i < nfc->data; i++) { | 7279 | for (cnt = 0, i = 0; i < nfc->data; i++) { |
7282 | idx = tcam_get_index(np, i); | 7280 | idx = tcam_get_index(np, i); |
7283 | tp = &parent->tcam[idx]; | 7281 | tp = &parent->tcam[idx]; |
7284 | if (!tp->valid) | 7282 | if (!tp->valid) |
7285 | continue; | 7283 | continue; |
7284 | if (cnt == nfc->rule_cnt) { | ||
7285 | ret = -EMSGSIZE; | ||
7286 | break; | ||
7287 | } | ||
7286 | rule_locs[cnt] = i; | 7288 | rule_locs[cnt] = i; |
7287 | cnt++; | 7289 | cnt++; |
7288 | } | 7290 | } |
7289 | niu_unlock_parent(np, flags); | 7291 | niu_unlock_parent(np, flags); |
7290 | 7292 | ||
7291 | if (n_entries != cnt) { | 7293 | return ret; |
7292 | /* print warning, this should not happen */ | ||
7293 | netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n", | ||
7294 | np->parent->index, __func__, n_entries, cnt); | ||
7295 | } | ||
7296 | |||
7297 | return 0; | ||
7298 | } | 7294 | } |
7299 | 7295 | ||
7300 | 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, |
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index c683f77c6f42..ff824e11f0b6 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.h> | ||
91 | #include <pcmcia/cistpl.h> | 90 | #include <pcmcia/cistpl.h> |
92 | #include <pcmcia/cisreg.h> | 91 | #include <pcmcia/cisreg.h> |
93 | #include <pcmcia/ciscode.h> | 92 | #include <pcmcia/ciscode.h> |
@@ -280,25 +279,15 @@ static int tc574_probe(struct pcmcia_device *link) | |||
280 | spin_lock_init(&lp->window_lock); | 279 | spin_lock_init(&lp->window_lock); |
281 | link->resource[0]->end = 32; | 280 | link->resource[0]->end = 32; |
282 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; | 281 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; |
283 | link->conf.Attributes = CONF_ENABLE_IRQ; | 282 | link->config_flags |= CONF_ENABLE_IRQ; |
284 | link->conf.IntType = INT_MEMORY_AND_IO; | 283 | link->config_index = 1; |
285 | link->conf.ConfigIndex = 1; | ||
286 | 284 | ||
287 | dev->netdev_ops = &el3_netdev_ops; | 285 | dev->netdev_ops = &el3_netdev_ops; |
288 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 286 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
289 | dev->watchdog_timeo = TX_TIMEOUT; | 287 | dev->watchdog_timeo = TX_TIMEOUT; |
290 | 288 | ||
291 | return tc574_config(link); | 289 | return tc574_config(link); |
292 | } /* tc574_attach */ | 290 | } |
293 | |||
294 | /* | ||
295 | |||
296 | This deletes a driver "instance". The device is de-registered | ||
297 | with Card Services. If it has been released, all local data | ||
298 | structures are freed. Otherwise, the structures will be freed | ||
299 | when the device is released. | ||
300 | |||
301 | */ | ||
302 | 291 | ||
303 | static void tc574_detach(struct pcmcia_device *link) | 292 | static void tc574_detach(struct pcmcia_device *link) |
304 | { | 293 | { |
@@ -313,12 +302,6 @@ static void tc574_detach(struct pcmcia_device *link) | |||
313 | free_netdev(dev); | 302 | free_netdev(dev); |
314 | } /* tc574_detach */ | 303 | } /* tc574_detach */ |
315 | 304 | ||
316 | /* | ||
317 | tc574_config() is scheduled to run after a CARD_INSERTION event | ||
318 | is received, to configure the PCMCIA socket, and to make the | ||
319 | ethernet device available to the system. | ||
320 | */ | ||
321 | |||
322 | static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; | 305 | static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; |
323 | 306 | ||
324 | static int tc574_config(struct pcmcia_device *link) | 307 | static int tc574_config(struct pcmcia_device *link) |
@@ -352,7 +335,7 @@ static int tc574_config(struct pcmcia_device *link) | |||
352 | if (ret) | 335 | if (ret) |
353 | goto failed; | 336 | goto failed; |
354 | 337 | ||
355 | ret = pcmcia_request_configuration(link, &link->conf); | 338 | ret = pcmcia_enable_device(link); |
356 | if (ret) | 339 | if (ret) |
357 | goto failed; | 340 | goto failed; |
358 | 341 | ||
@@ -465,12 +448,6 @@ failed: | |||
465 | 448 | ||
466 | } /* tc574_config */ | 449 | } /* tc574_config */ |
467 | 450 | ||
468 | /* | ||
469 | After a card is removed, tc574_release() will unregister the net | ||
470 | device, and release the PCMCIA configuration. If the device is | ||
471 | still open, this will be postponed until it is closed. | ||
472 | */ | ||
473 | |||
474 | static void tc574_release(struct pcmcia_device *link) | 451 | static void tc574_release(struct pcmcia_device *link) |
475 | { | 452 | { |
476 | pcmcia_disable_device(link); | 453 | pcmcia_disable_device(link); |
@@ -1198,9 +1175,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc574_ids); | |||
1198 | 1175 | ||
1199 | static struct pcmcia_driver tc574_driver = { | 1176 | static struct pcmcia_driver tc574_driver = { |
1200 | .owner = THIS_MODULE, | 1177 | .owner = THIS_MODULE, |
1201 | .drv = { | 1178 | .name = "3c574_cs", |
1202 | .name = "3c574_cs", | ||
1203 | }, | ||
1204 | .probe = tc574_probe, | 1179 | .probe = tc574_probe, |
1205 | .remove = tc574_detach, | 1180 | .remove = tc574_detach, |
1206 | .id_table = tc574_ids, | 1181 | .id_table = tc574_ids, |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 61f9cf2100ff..a07e22295330 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.h> | ||
45 | #include <pcmcia/cistpl.h> | 44 | #include <pcmcia/cistpl.h> |
46 | #include <pcmcia/cisreg.h> | 45 | #include <pcmcia/cisreg.h> |
47 | #include <pcmcia/ciscode.h> | 46 | #include <pcmcia/ciscode.h> |
@@ -176,14 +175,6 @@ static const struct ethtool_ops netdev_ethtool_ops; | |||
176 | 175 | ||
177 | static void tc589_detach(struct pcmcia_device *p_dev); | 176 | static void tc589_detach(struct pcmcia_device *p_dev); |
178 | 177 | ||
179 | /*====================================================================== | ||
180 | |||
181 | tc589_attach() creates an "instance" of the driver, allocating | ||
182 | local data structures for one device. The device is registered | ||
183 | with Card Services. | ||
184 | |||
185 | ======================================================================*/ | ||
186 | |||
187 | static const struct net_device_ops el3_netdev_ops = { | 178 | static const struct net_device_ops el3_netdev_ops = { |
188 | .ndo_open = el3_open, | 179 | .ndo_open = el3_open, |
189 | .ndo_stop = el3_close, | 180 | .ndo_stop = el3_close, |
@@ -216,9 +207,8 @@ static int tc589_probe(struct pcmcia_device *link) | |||
216 | link->resource[0]->end = 16; | 207 | link->resource[0]->end = 16; |
217 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; | 208 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; |
218 | 209 | ||
219 | link->conf.Attributes = CONF_ENABLE_IRQ; | 210 | link->config_flags |= CONF_ENABLE_IRQ; |
220 | link->conf.IntType = INT_MEMORY_AND_IO; | 211 | link->config_index = 1; |
221 | link->conf.ConfigIndex = 1; | ||
222 | 212 | ||
223 | dev->netdev_ops = &el3_netdev_ops; | 213 | dev->netdev_ops = &el3_netdev_ops; |
224 | dev->watchdog_timeo = TX_TIMEOUT; | 214 | dev->watchdog_timeo = TX_TIMEOUT; |
@@ -226,16 +216,7 @@ static int tc589_probe(struct pcmcia_device *link) | |||
226 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 216 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
227 | 217 | ||
228 | return tc589_config(link); | 218 | return tc589_config(link); |
229 | } /* tc589_attach */ | 219 | } |
230 | |||
231 | /*====================================================================== | ||
232 | |||
233 | This deletes a driver "instance". The device is de-registered | ||
234 | with Card Services. If it has been released, all local data | ||
235 | structures are freed. Otherwise, the structures will be freed | ||
236 | when the device is released. | ||
237 | |||
238 | ======================================================================*/ | ||
239 | 220 | ||
240 | static void tc589_detach(struct pcmcia_device *link) | 221 | static void tc589_detach(struct pcmcia_device *link) |
241 | { | 222 | { |
@@ -250,14 +231,6 @@ static void tc589_detach(struct pcmcia_device *link) | |||
250 | free_netdev(dev); | 231 | free_netdev(dev); |
251 | } /* tc589_detach */ | 232 | } /* tc589_detach */ |
252 | 233 | ||
253 | /*====================================================================== | ||
254 | |||
255 | tc589_config() is scheduled to run after a CARD_INSERTION event | ||
256 | is received, to configure the PCMCIA socket, and to make the | ||
257 | ethernet device available to the system. | ||
258 | |||
259 | ======================================================================*/ | ||
260 | |||
261 | static int tc589_config(struct pcmcia_device *link) | 234 | static int tc589_config(struct pcmcia_device *link) |
262 | { | 235 | { |
263 | struct net_device *dev = link->priv; | 236 | struct net_device *dev = link->priv; |
@@ -294,7 +267,7 @@ static int tc589_config(struct pcmcia_device *link) | |||
294 | if (ret) | 267 | if (ret) |
295 | goto failed; | 268 | goto failed; |
296 | 269 | ||
297 | ret = pcmcia_request_configuration(link, &link->conf); | 270 | ret = pcmcia_enable_device(link); |
298 | if (ret) | 271 | if (ret) |
299 | goto failed; | 272 | goto failed; |
300 | 273 | ||
@@ -352,14 +325,6 @@ failed: | |||
352 | return -ENODEV; | 325 | return -ENODEV; |
353 | } /* tc589_config */ | 326 | } /* tc589_config */ |
354 | 327 | ||
355 | /*====================================================================== | ||
356 | |||
357 | After a card is removed, tc589_release() will unregister the net | ||
358 | device, and release the PCMCIA configuration. If the device is | ||
359 | still open, this will be postponed until it is closed. | ||
360 | |||
361 | ======================================================================*/ | ||
362 | |||
363 | static void tc589_release(struct pcmcia_device *link) | 328 | static void tc589_release(struct pcmcia_device *link) |
364 | { | 329 | { |
365 | pcmcia_disable_device(link); | 330 | pcmcia_disable_device(link); |
@@ -955,9 +920,7 @@ MODULE_DEVICE_TABLE(pcmcia, tc589_ids); | |||
955 | 920 | ||
956 | static struct pcmcia_driver tc589_driver = { | 921 | static struct pcmcia_driver tc589_driver = { |
957 | .owner = THIS_MODULE, | 922 | .owner = THIS_MODULE, |
958 | .drv = { | 923 | .name = "3c589_cs", |
959 | .name = "3c589_cs", | ||
960 | }, | ||
961 | .probe = tc589_probe, | 924 | .probe = tc589_probe, |
962 | .remove = tc589_detach, | 925 | .remove = tc589_detach, |
963 | .id_table = tc589_ids, | 926 | .id_table = tc589_ids, |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 5f05ffb240cc..9e8b28b271ae 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.h> | ||
43 | #include <pcmcia/cistpl.h> | 42 | #include <pcmcia/cistpl.h> |
44 | #include <pcmcia/ciscode.h> | 43 | #include <pcmcia/ciscode.h> |
45 | #include <pcmcia/ds.h> | 44 | #include <pcmcia/ds.h> |
@@ -140,14 +139,6 @@ static const struct net_device_ops axnet_netdev_ops = { | |||
140 | .ndo_validate_addr = eth_validate_addr, | 139 | .ndo_validate_addr = eth_validate_addr, |
141 | }; | 140 | }; |
142 | 141 | ||
143 | /*====================================================================== | ||
144 | |||
145 | axnet_attach() creates an "instance" of the driver, allocating | ||
146 | local data structures for one device. The device is registered | ||
147 | with Card Services. | ||
148 | |||
149 | ======================================================================*/ | ||
150 | |||
151 | static int axnet_probe(struct pcmcia_device *link) | 142 | static int axnet_probe(struct pcmcia_device *link) |
152 | { | 143 | { |
153 | axnet_dev_t *info; | 144 | axnet_dev_t *info; |
@@ -166,8 +157,7 @@ static int axnet_probe(struct pcmcia_device *link) | |||
166 | info = PRIV(dev); | 157 | info = PRIV(dev); |
167 | info->p_dev = link; | 158 | info->p_dev = link; |
168 | link->priv = dev; | 159 | link->priv = dev; |
169 | link->conf.Attributes = CONF_ENABLE_IRQ; | 160 | link->config_flags |= CONF_ENABLE_IRQ; |
170 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
171 | 161 | ||
172 | dev->netdev_ops = &axnet_netdev_ops; | 162 | dev->netdev_ops = &axnet_netdev_ops; |
173 | 163 | ||
@@ -177,15 +167,6 @@ static int axnet_probe(struct pcmcia_device *link) | |||
177 | return axnet_config(link); | 167 | return axnet_config(link); |
178 | } /* axnet_attach */ | 168 | } /* axnet_attach */ |
179 | 169 | ||
180 | /*====================================================================== | ||
181 | |||
182 | This deletes a driver "instance". The device is de-registered | ||
183 | with Card Services. If it has been released, all local data | ||
184 | structures are freed. Otherwise, the structures will be freed | ||
185 | when the device is released. | ||
186 | |||
187 | ======================================================================*/ | ||
188 | |||
189 | static void axnet_detach(struct pcmcia_device *link) | 170 | static void axnet_detach(struct pcmcia_device *link) |
190 | { | 171 | { |
191 | struct net_device *dev = link->priv; | 172 | struct net_device *dev = link->priv; |
@@ -231,7 +212,7 @@ static int get_prom(struct pcmcia_device *link) | |||
231 | }; | 212 | }; |
232 | 213 | ||
233 | /* Not much of a test, but the alternatives are messy */ | 214 | /* Not much of a test, but the alternatives are messy */ |
234 | if (link->conf.ConfigBase != 0x03c0) | 215 | if (link->config_base != 0x03c0) |
235 | return 0; | 216 | return 0; |
236 | 217 | ||
237 | axnet_reset_8390(dev); | 218 | axnet_reset_8390(dev); |
@@ -248,14 +229,6 @@ static int get_prom(struct pcmcia_device *link) | |||
248 | return 1; | 229 | return 1; |
249 | } /* get_prom */ | 230 | } /* get_prom */ |
250 | 231 | ||
251 | /*====================================================================== | ||
252 | |||
253 | axnet_config() is scheduled to run after a CARD_INSERTION event | ||
254 | is received, to configure the PCMCIA socket, and to make the | ||
255 | ethernet device available to the system. | ||
256 | |||
257 | ======================================================================*/ | ||
258 | |||
259 | static int try_io_port(struct pcmcia_device *link) | 232 | static int try_io_port(struct pcmcia_device *link) |
260 | { | 233 | { |
261 | int j, ret; | 234 | int j, ret; |
@@ -286,35 +259,16 @@ static int try_io_port(struct pcmcia_device *link) | |||
286 | } | 259 | } |
287 | } | 260 | } |
288 | 261 | ||
289 | static int axnet_configcheck(struct pcmcia_device *p_dev, | 262 | static int axnet_configcheck(struct pcmcia_device *p_dev, void *priv_data) |
290 | cistpl_cftable_entry_t *cfg, | ||
291 | cistpl_cftable_entry_t *dflt, | ||
292 | unsigned int vcc, | ||
293 | void *priv_data) | ||
294 | { | 263 | { |
295 | int i; | 264 | if (p_dev->config_index == 0) |
296 | cistpl_io_t *io = &cfg->io; | 265 | return -EINVAL; |
297 | 266 | ||
298 | if (cfg->index == 0 || cfg->io.nwin == 0) | 267 | p_dev->config_index = 0x05; |
268 | if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32) | ||
299 | return -ENODEV; | 269 | return -ENODEV; |
300 | 270 | ||
301 | p_dev->conf.ConfigIndex = 0x05; | 271 | return try_io_port(p_dev); |
302 | /* For multifunction cards, by convention, we configure the | ||
303 | network function with window 0, and serial with window 1 */ | ||
304 | if (io->nwin > 1) { | ||
305 | i = (io->win[1].len > io->win[0].len); | ||
306 | p_dev->resource[1]->start = io->win[1-i].base; | ||
307 | p_dev->resource[1]->end = io->win[1-i].len; | ||
308 | } else { | ||
309 | i = p_dev->resource[1]->end = 0; | ||
310 | } | ||
311 | p_dev->resource[0]->start = io->win[i].base; | ||
312 | p_dev->resource[0]->end = io->win[i].len; | ||
313 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
314 | if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) | ||
315 | return try_io_port(p_dev); | ||
316 | |||
317 | return -ENODEV; | ||
318 | } | 272 | } |
319 | 273 | ||
320 | static int axnet_config(struct pcmcia_device *link) | 274 | static int axnet_config(struct pcmcia_device *link) |
@@ -326,20 +280,19 @@ static int axnet_config(struct pcmcia_device *link) | |||
326 | dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); | 280 | dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); |
327 | 281 | ||
328 | /* don't trust the CIS on this; Linksys got it wrong */ | 282 | /* don't trust the CIS on this; Linksys got it wrong */ |
329 | link->conf.Present = 0x63; | 283 | link->config_regs = 0x63; |
284 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; | ||
330 | ret = pcmcia_loop_config(link, axnet_configcheck, NULL); | 285 | ret = pcmcia_loop_config(link, axnet_configcheck, NULL); |
331 | if (ret != 0) | 286 | if (ret != 0) |
332 | goto failed; | 287 | goto failed; |
333 | 288 | ||
334 | if (!link->irq) | 289 | if (!link->irq) |
335 | goto failed; | 290 | goto failed; |
291 | |||
292 | if (resource_size(link->resource[1]) == 8) | ||
293 | link->config_flags |= CONF_ENABLE_SPKR; | ||
336 | 294 | ||
337 | if (resource_size(link->resource[1]) == 8) { | 295 | ret = pcmcia_enable_device(link); |
338 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
339 | link->conf.Status = CCSR_AUDIO_ENA; | ||
340 | } | ||
341 | |||
342 | ret = pcmcia_request_configuration(link, &link->conf); | ||
343 | if (ret) | 296 | if (ret) |
344 | goto failed; | 297 | goto failed; |
345 | 298 | ||
@@ -414,14 +367,6 @@ failed: | |||
414 | return -ENODEV; | 367 | return -ENODEV; |
415 | } /* axnet_config */ | 368 | } /* axnet_config */ |
416 | 369 | ||
417 | /*====================================================================== | ||
418 | |||
419 | After a card is removed, axnet_release() will unregister the net | ||
420 | device, and release the PCMCIA configuration. If the device is | ||
421 | still open, this will be postponed until it is closed. | ||
422 | |||
423 | ======================================================================*/ | ||
424 | |||
425 | static void axnet_release(struct pcmcia_device *link) | 370 | static void axnet_release(struct pcmcia_device *link) |
426 | { | 371 | { |
427 | pcmcia_disable_device(link); | 372 | pcmcia_disable_device(link); |
@@ -783,9 +728,7 @@ MODULE_DEVICE_TABLE(pcmcia, axnet_ids); | |||
783 | 728 | ||
784 | static struct pcmcia_driver axnet_cs_driver = { | 729 | static struct pcmcia_driver axnet_cs_driver = { |
785 | .owner = THIS_MODULE, | 730 | .owner = THIS_MODULE, |
786 | .drv = { | 731 | .name = "axnet_cs", |
787 | .name = "axnet_cs", | ||
788 | }, | ||
789 | .probe = axnet_probe, | 732 | .probe = axnet_probe, |
790 | .remove = axnet_detach, | 733 | .remove = axnet_detach, |
791 | .id_table = axnet_ids, | 734 | .id_table = axnet_ids, |
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 3c400cfa82ae..b706a7249477 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.h> | ||
47 | #include <pcmcia/cistpl.h> | 46 | #include <pcmcia/cistpl.h> |
48 | #include <pcmcia/ds.h> | 47 | #include <pcmcia/ds.h> |
49 | 48 | ||
@@ -123,14 +122,6 @@ typedef struct com20020_dev_t { | |||
123 | struct net_device *dev; | 122 | struct net_device *dev; |
124 | } com20020_dev_t; | 123 | } com20020_dev_t; |
125 | 124 | ||
126 | /*====================================================================== | ||
127 | |||
128 | com20020_attach() creates an "instance" of the driver, allocating | ||
129 | local data structures for one device. The device is registered | ||
130 | with Card Services. | ||
131 | |||
132 | ======================================================================*/ | ||
133 | |||
134 | static int com20020_probe(struct pcmcia_device *p_dev) | 125 | static int com20020_probe(struct pcmcia_device *p_dev) |
135 | { | 126 | { |
136 | com20020_dev_t *info; | 127 | com20020_dev_t *info; |
@@ -160,8 +151,7 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
160 | 151 | ||
161 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | 152 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
162 | p_dev->resource[0]->end = 16; | 153 | p_dev->resource[0]->end = 16; |
163 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 154 | p_dev->config_flags |= CONF_ENABLE_IRQ; |
164 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | ||
165 | 155 | ||
166 | info->dev = dev; | 156 | info->dev = dev; |
167 | p_dev->priv = info; | 157 | p_dev->priv = info; |
@@ -174,15 +164,6 @@ fail_alloc_info: | |||
174 | return -ENOMEM; | 164 | return -ENOMEM; |
175 | } /* com20020_attach */ | 165 | } /* com20020_attach */ |
176 | 166 | ||
177 | /*====================================================================== | ||
178 | |||
179 | This deletes a driver "instance". The device is de-registered | ||
180 | with Card Services. If it has been released, all local data | ||
181 | structures are freed. Otherwise, the structures will be freed | ||
182 | when the device is released. | ||
183 | |||
184 | ======================================================================*/ | ||
185 | |||
186 | static void com20020_detach(struct pcmcia_device *link) | 167 | static void com20020_detach(struct pcmcia_device *link) |
187 | { | 168 | { |
188 | struct com20020_dev_t *info = link->priv; | 169 | struct com20020_dev_t *info = link->priv; |
@@ -221,14 +202,6 @@ static void com20020_detach(struct pcmcia_device *link) | |||
221 | 202 | ||
222 | } /* com20020_detach */ | 203 | } /* com20020_detach */ |
223 | 204 | ||
224 | /*====================================================================== | ||
225 | |||
226 | com20020_config() is scheduled to run after a CARD_INSERTION event | ||
227 | is received, to configure the PCMCIA socket, and to make the | ||
228 | device available to the system. | ||
229 | |||
230 | ======================================================================*/ | ||
231 | |||
232 | static int com20020_config(struct pcmcia_device *link) | 205 | static int com20020_config(struct pcmcia_device *link) |
233 | { | 206 | { |
234 | struct arcnet_local *lp; | 207 | struct arcnet_local *lp; |
@@ -282,7 +255,7 @@ static int com20020_config(struct pcmcia_device *link) | |||
282 | 255 | ||
283 | dev->irq = link->irq; | 256 | dev->irq = link->irq; |
284 | 257 | ||
285 | ret = pcmcia_request_configuration(link, &link->conf); | 258 | ret = pcmcia_enable_device(link); |
286 | if (ret) | 259 | if (ret) |
287 | goto failed; | 260 | goto failed; |
288 | 261 | ||
@@ -316,14 +289,6 @@ failed: | |||
316 | return -ENODEV; | 289 | return -ENODEV; |
317 | } /* com20020_config */ | 290 | } /* com20020_config */ |
318 | 291 | ||
319 | /*====================================================================== | ||
320 | |||
321 | After a card is removed, com20020_release() will unregister the net | ||
322 | device, and release the PCMCIA configuration. If the device is | ||
323 | still open, this will be postponed until it is closed. | ||
324 | |||
325 | ======================================================================*/ | ||
326 | |||
327 | static void com20020_release(struct pcmcia_device *link) | 292 | static void com20020_release(struct pcmcia_device *link) |
328 | { | 293 | { |
329 | dev_dbg(&link->dev, "com20020_release\n"); | 294 | dev_dbg(&link->dev, "com20020_release\n"); |
@@ -366,9 +331,7 @@ MODULE_DEVICE_TABLE(pcmcia, com20020_ids); | |||
366 | 331 | ||
367 | static struct pcmcia_driver com20020_cs_driver = { | 332 | static struct pcmcia_driver com20020_cs_driver = { |
368 | .owner = THIS_MODULE, | 333 | .owner = THIS_MODULE, |
369 | .drv = { | 334 | .name = "com20020_cs", |
370 | .name = "com20020_cs", | ||
371 | }, | ||
372 | .probe = com20020_probe, | 335 | .probe = com20020_probe, |
373 | .remove = com20020_detach, | 336 | .remove = com20020_detach, |
374 | .id_table = com20020_ids, | 337 | .id_table = com20020_ids, |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 98fffb03ecd7..1c327598bbe8 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.h> | ||
53 | #include <pcmcia/cistpl.h> | 52 | #include <pcmcia/cistpl.h> |
54 | #include <pcmcia/ciscode.h> | 53 | #include <pcmcia/ciscode.h> |
55 | #include <pcmcia/ds.h> | 54 | #include <pcmcia/ds.h> |
@@ -252,8 +251,7 @@ static int fmvj18x_probe(struct pcmcia_device *link) | |||
252 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | 251 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
253 | 252 | ||
254 | /* General socket configuration */ | 253 | /* General socket configuration */ |
255 | link->conf.Attributes = CONF_ENABLE_IRQ; | 254 | link->config_flags |= CONF_ENABLE_IRQ; |
256 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
257 | 255 | ||
258 | dev->netdev_ops = &fjn_netdev_ops; | 256 | dev->netdev_ops = &fjn_netdev_ops; |
259 | dev->watchdog_timeo = TX_TIMEOUT; | 257 | dev->watchdog_timeo = TX_TIMEOUT; |
@@ -313,7 +311,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link) | |||
313 | ret = pcmcia_request_io(link); | 311 | ret = pcmcia_request_io(link); |
314 | if (ret == 0) { | 312 | if (ret == 0) { |
315 | /* calculate ConfigIndex value */ | 313 | /* calculate ConfigIndex value */ |
316 | link->conf.ConfigIndex = | 314 | link->config_index = |
317 | ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; | 315 | ((link->resource[0]->start & 0x0f0) >> 3) | 0x22; |
318 | return ret; | 316 | return ret; |
319 | } | 317 | } |
@@ -321,11 +319,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link) | |||
321 | return ret; /* RequestIO failed */ | 319 | return ret; /* RequestIO failed */ |
322 | } | 320 | } |
323 | 321 | ||
324 | static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, | 322 | static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, void *priv_data) |
325 | cistpl_cftable_entry_t *cfg, | ||
326 | cistpl_cftable_entry_t *dflt, | ||
327 | unsigned int vcc, | ||
328 | void *priv_data) | ||
329 | { | 323 | { |
330 | return 0; /* strange, but that's what the code did already before... */ | 324 | return 0; /* strange, but that's what the code did already before... */ |
331 | } | 325 | } |
@@ -362,28 +356,28 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
362 | link->card_id == PRODID_TDK_NP9610 || | 356 | link->card_id == PRODID_TDK_NP9610 || |
363 | link->card_id == PRODID_TDK_MN3200) { | 357 | link->card_id == PRODID_TDK_MN3200) { |
364 | /* MultiFunction Card */ | 358 | /* MultiFunction Card */ |
365 | link->conf.ConfigBase = 0x800; | 359 | link->config_base = 0x800; |
366 | link->conf.ConfigIndex = 0x47; | 360 | link->config_index = 0x47; |
367 | link->resource[1]->end = 8; | 361 | link->resource[1]->end = 8; |
368 | } | 362 | } |
369 | break; | 363 | break; |
370 | case MANFID_NEC: | 364 | case MANFID_NEC: |
371 | cardtype = NEC; /* MultiFunction Card */ | 365 | cardtype = NEC; /* MultiFunction Card */ |
372 | link->conf.ConfigBase = 0x800; | 366 | link->config_base = 0x800; |
373 | link->conf.ConfigIndex = 0x47; | 367 | link->config_index = 0x47; |
374 | link->resource[1]->end = 8; | 368 | link->resource[1]->end = 8; |
375 | break; | 369 | break; |
376 | case MANFID_KME: | 370 | case MANFID_KME: |
377 | cardtype = KME; /* MultiFunction Card */ | 371 | cardtype = KME; /* MultiFunction Card */ |
378 | link->conf.ConfigBase = 0x800; | 372 | link->config_base = 0x800; |
379 | link->conf.ConfigIndex = 0x47; | 373 | link->config_index = 0x47; |
380 | link->resource[1]->end = 8; | 374 | link->resource[1]->end = 8; |
381 | break; | 375 | break; |
382 | case MANFID_CONTEC: | 376 | case MANFID_CONTEC: |
383 | cardtype = CONTEC; | 377 | cardtype = CONTEC; |
384 | break; | 378 | break; |
385 | case MANFID_FUJITSU: | 379 | case MANFID_FUJITSU: |
386 | if (link->conf.ConfigBase == 0x0fe0) | 380 | if (link->config_base == 0x0fe0) |
387 | cardtype = MBH10302; | 381 | cardtype = MBH10302; |
388 | else if (link->card_id == PRODID_FUJITSU_MBH10302) | 382 | else if (link->card_id == PRODID_FUJITSU_MBH10302) |
389 | /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), | 383 | /* RATOC REX-5588/9822/4886's PRODID are 0004(=MBH10302), |
@@ -403,10 +397,10 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
403 | case MANFID_FUJITSU: | 397 | case MANFID_FUJITSU: |
404 | if (link->card_id == PRODID_FUJITSU_MBH10304) { | 398 | if (link->card_id == PRODID_FUJITSU_MBH10304) { |
405 | cardtype = XXX10304; /* MBH10304 with buggy CIS */ | 399 | cardtype = XXX10304; /* MBH10304 with buggy CIS */ |
406 | link->conf.ConfigIndex = 0x20; | 400 | link->config_index = 0x20; |
407 | } else { | 401 | } else { |
408 | cardtype = MBH10302; /* NextCom NC5310, etc. */ | 402 | cardtype = MBH10302; /* NextCom NC5310, etc. */ |
409 | link->conf.ConfigIndex = 1; | 403 | link->config_index = 1; |
410 | } | 404 | } |
411 | break; | 405 | break; |
412 | case MANFID_UNGERMANN: | 406 | case MANFID_UNGERMANN: |
@@ -414,7 +408,7 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
414 | break; | 408 | break; |
415 | default: | 409 | default: |
416 | cardtype = MBH10302; | 410 | cardtype = MBH10302; |
417 | link->conf.ConfigIndex = 1; | 411 | link->config_index = 1; |
418 | } | 412 | } |
419 | } | 413 | } |
420 | 414 | ||
@@ -432,7 +426,7 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
432 | ret = pcmcia_request_irq(link, fjn_interrupt); | 426 | ret = pcmcia_request_irq(link, fjn_interrupt); |
433 | if (ret) | 427 | if (ret) |
434 | goto failed; | 428 | goto failed; |
435 | ret = pcmcia_request_configuration(link, &link->conf); | 429 | ret = pcmcia_enable_device(link); |
436 | if (ret) | 430 | if (ret) |
437 | goto failed; | 431 | goto failed; |
438 | 432 | ||
@@ -544,20 +538,18 @@ failed: | |||
544 | 538 | ||
545 | static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | 539 | static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) |
546 | { | 540 | { |
547 | win_req_t req; | ||
548 | u_char __iomem *base; | 541 | u_char __iomem *base; |
549 | int i, j; | 542 | int i, j; |
550 | 543 | ||
551 | /* Allocate a small memory window */ | 544 | /* Allocate a small memory window */ |
552 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 545 | link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
553 | req.Base = 0; req.Size = 0; | 546 | link->resource[2]->start = 0; link->resource[2]->end = 0; |
554 | req.AccessSpeed = 0; | 547 | i = pcmcia_request_window(link, link->resource[2], 0); |
555 | i = pcmcia_request_window(link, &req, &link->win); | ||
556 | if (i != 0) | 548 | if (i != 0) |
557 | return -1; | 549 | return -1; |
558 | 550 | ||
559 | base = ioremap(req.Base, req.Size); | 551 | base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); |
560 | pcmcia_map_mem_page(link, link->win, 0); | 552 | pcmcia_map_mem_page(link, link->resource[2], 0); |
561 | 553 | ||
562 | /* | 554 | /* |
563 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format | 555 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format |
@@ -582,7 +574,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
582 | } | 574 | } |
583 | 575 | ||
584 | iounmap(base); | 576 | iounmap(base); |
585 | j = pcmcia_release_window(link, link->win); | 577 | j = pcmcia_release_window(link, link->resource[2]); |
586 | return (i != 0x200) ? 0 : -1; | 578 | return (i != 0x200) ? 0 : -1; |
587 | 579 | ||
588 | } /* fmvj18x_get_hwinfo */ | 580 | } /* fmvj18x_get_hwinfo */ |
@@ -590,27 +582,26 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
590 | 582 | ||
591 | static int fmvj18x_setup_mfc(struct pcmcia_device *link) | 583 | static int fmvj18x_setup_mfc(struct pcmcia_device *link) |
592 | { | 584 | { |
593 | win_req_t req; | ||
594 | int i; | 585 | int i; |
595 | struct net_device *dev = link->priv; | 586 | struct net_device *dev = link->priv; |
596 | unsigned int ioaddr; | 587 | unsigned int ioaddr; |
597 | local_info_t *lp = netdev_priv(dev); | 588 | local_info_t *lp = netdev_priv(dev); |
598 | 589 | ||
599 | /* Allocate a small memory window */ | 590 | /* Allocate a small memory window */ |
600 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 591 | link->resource[3]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
601 | req.Base = 0; req.Size = 0; | 592 | link->resource[3]->start = link->resource[3]->end = 0; |
602 | req.AccessSpeed = 0; | 593 | i = pcmcia_request_window(link, link->resource[3], 0); |
603 | i = pcmcia_request_window(link, &req, &link->win); | ||
604 | if (i != 0) | 594 | if (i != 0) |
605 | return -1; | 595 | return -1; |
606 | 596 | ||
607 | lp->base = ioremap(req.Base, req.Size); | 597 | lp->base = ioremap(link->resource[3]->start, |
598 | resource_size(link->resource[3])); | ||
608 | if (lp->base == NULL) { | 599 | if (lp->base == NULL) { |
609 | printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); | 600 | printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); |
610 | return -1; | 601 | return -1; |
611 | } | 602 | } |
612 | 603 | ||
613 | i = pcmcia_map_mem_page(link, link->win, 0); | 604 | i = pcmcia_map_mem_page(link, link->resource[3], 0); |
614 | if (i != 0) { | 605 | if (i != 0) { |
615 | iounmap(lp->base); | 606 | iounmap(lp->base); |
616 | lp->base = NULL; | 607 | lp->base = NULL; |
@@ -638,7 +629,6 @@ static void fmvj18x_release(struct pcmcia_device *link) | |||
638 | struct net_device *dev = link->priv; | 629 | struct net_device *dev = link->priv; |
639 | local_info_t *lp = netdev_priv(dev); | 630 | local_info_t *lp = netdev_priv(dev); |
640 | u_char __iomem *tmp; | 631 | u_char __iomem *tmp; |
641 | int j; | ||
642 | 632 | ||
643 | dev_dbg(&link->dev, "fmvj18x_release\n"); | 633 | dev_dbg(&link->dev, "fmvj18x_release\n"); |
644 | 634 | ||
@@ -646,7 +636,6 @@ static void fmvj18x_release(struct pcmcia_device *link) | |||
646 | tmp = lp->base; | 636 | tmp = lp->base; |
647 | lp->base = NULL; /* set NULL before iounmap */ | 637 | lp->base = NULL; /* set NULL before iounmap */ |
648 | iounmap(tmp); | 638 | iounmap(tmp); |
649 | j = pcmcia_release_window(link, link->win); | ||
650 | } | 639 | } |
651 | 640 | ||
652 | pcmcia_disable_device(link); | 641 | pcmcia_disable_device(link); |
@@ -708,9 +697,7 @@ MODULE_DEVICE_TABLE(pcmcia, fmvj18x_ids); | |||
708 | 697 | ||
709 | static struct pcmcia_driver fmvj18x_cs_driver = { | 698 | static struct pcmcia_driver fmvj18x_cs_driver = { |
710 | .owner = THIS_MODULE, | 699 | .owner = THIS_MODULE, |
711 | .drv = { | 700 | .name = "fmvj18x_cs", |
712 | .name = "fmvj18x_cs", | ||
713 | }, | ||
714 | .probe = fmvj18x_probe, | 701 | .probe = fmvj18x_probe, |
715 | .remove = fmvj18x_detach, | 702 | .remove = fmvj18x_detach, |
716 | .id_table = fmvj18x_ids, | 703 | .id_table = fmvj18x_ids, |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index b0d06a3d962f..bf7dff96d881 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.h> | ||
61 | #include <pcmcia/cistpl.h> | 60 | #include <pcmcia/cistpl.h> |
62 | #include <pcmcia/ds.h> | 61 | #include <pcmcia/ds.h> |
63 | 62 | ||
@@ -102,9 +101,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev); | |||
102 | 101 | ||
103 | typedef struct ibmtr_dev_t { | 102 | typedef struct ibmtr_dev_t { |
104 | struct pcmcia_device *p_dev; | 103 | struct pcmcia_device *p_dev; |
105 | struct net_device *dev; | 104 | struct net_device *dev; |
106 | window_handle_t sram_win_handle; | 105 | struct tok_info *ti; |
107 | struct tok_info *ti; | ||
108 | } ibmtr_dev_t; | 106 | } ibmtr_dev_t; |
109 | 107 | ||
110 | static void netdev_get_drvinfo(struct net_device *dev, | 108 | static void netdev_get_drvinfo(struct net_device *dev, |
@@ -123,14 +121,6 @@ static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) { | |||
123 | return tok_interrupt(irq, dev); | 121 | return tok_interrupt(irq, dev); |
124 | }; | 122 | }; |
125 | 123 | ||
126 | /*====================================================================== | ||
127 | |||
128 | ibmtr_attach() creates an "instance" of the driver, allocating | ||
129 | local data structures for one device. The device is registered | ||
130 | with Card Services. | ||
131 | |||
132 | ======================================================================*/ | ||
133 | |||
134 | static int __devinit ibmtr_attach(struct pcmcia_device *link) | 124 | static int __devinit ibmtr_attach(struct pcmcia_device *link) |
135 | { | 125 | { |
136 | ibmtr_dev_t *info; | 126 | ibmtr_dev_t *info; |
@@ -153,9 +143,8 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) | |||
153 | 143 | ||
154 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | 144 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
155 | link->resource[0]->end = 4; | 145 | link->resource[0]->end = 4; |
156 | link->conf.Attributes = CONF_ENABLE_IRQ; | 146 | link->config_flags |= CONF_ENABLE_IRQ; |
157 | link->conf.IntType = INT_MEMORY_AND_IO; | 147 | link->config_regs = PRESENT_OPTION; |
158 | link->conf.Present = PRESENT_OPTION; | ||
159 | 148 | ||
160 | info->dev = dev; | 149 | info->dev = dev; |
161 | 150 | ||
@@ -164,15 +153,6 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) | |||
164 | return ibmtr_config(link); | 153 | return ibmtr_config(link); |
165 | } /* ibmtr_attach */ | 154 | } /* ibmtr_attach */ |
166 | 155 | ||
167 | /*====================================================================== | ||
168 | |||
169 | This deletes a driver "instance". The device is de-registered | ||
170 | with Card Services. If it has been released, all local data | ||
171 | structures are freed. Otherwise, the structures will be freed | ||
172 | when the device is released. | ||
173 | |||
174 | ======================================================================*/ | ||
175 | |||
176 | static void ibmtr_detach(struct pcmcia_device *link) | 156 | static void ibmtr_detach(struct pcmcia_device *link) |
177 | { | 157 | { |
178 | struct ibmtr_dev_t *info = link->priv; | 158 | struct ibmtr_dev_t *info = link->priv; |
@@ -197,26 +177,17 @@ static void ibmtr_detach(struct pcmcia_device *link) | |||
197 | kfree(info); | 177 | kfree(info); |
198 | } /* ibmtr_detach */ | 178 | } /* ibmtr_detach */ |
199 | 179 | ||
200 | /*====================================================================== | ||
201 | |||
202 | ibmtr_config() is scheduled to run after a CARD_INSERTION event | ||
203 | is received, to configure the PCMCIA socket, and to make the | ||
204 | token-ring device available to the system. | ||
205 | |||
206 | ======================================================================*/ | ||
207 | |||
208 | static int __devinit ibmtr_config(struct pcmcia_device *link) | 180 | static int __devinit ibmtr_config(struct pcmcia_device *link) |
209 | { | 181 | { |
210 | ibmtr_dev_t *info = link->priv; | 182 | ibmtr_dev_t *info = link->priv; |
211 | struct net_device *dev = info->dev; | 183 | struct net_device *dev = info->dev; |
212 | struct tok_info *ti = netdev_priv(dev); | 184 | struct tok_info *ti = netdev_priv(dev); |
213 | win_req_t req; | ||
214 | int i, ret; | 185 | int i, ret; |
215 | 186 | ||
216 | dev_dbg(&link->dev, "ibmtr_config\n"); | 187 | dev_dbg(&link->dev, "ibmtr_config\n"); |
217 | 188 | ||
218 | link->conf.ConfigIndex = 0x61; | ||
219 | link->io_lines = 16; | 189 | link->io_lines = 16; |
190 | link->config_index = 0x61; | ||
220 | 191 | ||
221 | /* Determine if this is PRIMARY or ALTERNATE. */ | 192 | /* Determine if this is PRIMARY or ALTERNATE. */ |
222 | 193 | ||
@@ -240,39 +211,39 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
240 | ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); | 211 | ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); |
241 | 212 | ||
242 | /* Allocate the MMIO memory window */ | 213 | /* Allocate the MMIO memory window */ |
243 | req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; | 214 | link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; |
244 | req.Attributes |= WIN_USE_WAIT; | 215 | link->resource[2]->flags |= WIN_USE_WAIT; |
245 | req.Base = 0; | 216 | link->resource[2]->start = 0; |
246 | req.Size = 0x2000; | 217 | link->resource[2]->end = 0x2000; |
247 | req.AccessSpeed = 250; | 218 | ret = pcmcia_request_window(link, link->resource[2], 250); |
248 | ret = pcmcia_request_window(link, &req, &link->win); | ||
249 | if (ret) | 219 | if (ret) |
250 | goto failed; | 220 | goto failed; |
251 | 221 | ||
252 | ret = pcmcia_map_mem_page(link, link->win, mmiobase); | 222 | ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase); |
253 | if (ret) | 223 | if (ret) |
254 | goto failed; | 224 | goto failed; |
255 | ti->mmio = ioremap(req.Base, req.Size); | 225 | ti->mmio = ioremap(link->resource[2]->start, |
226 | resource_size(link->resource[2])); | ||
256 | 227 | ||
257 | /* Allocate the SRAM memory window */ | 228 | /* Allocate the SRAM memory window */ |
258 | req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; | 229 | link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; |
259 | req.Attributes |= WIN_USE_WAIT; | 230 | link->resource[3]->flags |= WIN_USE_WAIT; |
260 | req.Base = 0; | 231 | link->resource[3]->start = 0; |
261 | req.Size = sramsize * 1024; | 232 | link->resource[3]->end = sramsize * 1024; |
262 | req.AccessSpeed = 250; | 233 | ret = pcmcia_request_window(link, link->resource[3], 250); |
263 | ret = pcmcia_request_window(link, &req, &info->sram_win_handle); | ||
264 | if (ret) | 234 | if (ret) |
265 | goto failed; | 235 | goto failed; |
266 | 236 | ||
267 | ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); | 237 | ret = pcmcia_map_mem_page(link, link->resource[3], srambase); |
268 | if (ret) | 238 | if (ret) |
269 | goto failed; | 239 | goto failed; |
270 | 240 | ||
271 | ti->sram_base = srambase >> 12; | 241 | ti->sram_base = srambase >> 12; |
272 | ti->sram_virt = ioremap(req.Base, req.Size); | 242 | ti->sram_virt = ioremap(link->resource[3]->start, |
273 | ti->sram_phys = req.Base; | 243 | resource_size(link->resource[3])); |
244 | ti->sram_phys = link->resource[3]->start; | ||
274 | 245 | ||
275 | ret = pcmcia_request_configuration(link, &link->conf); | 246 | ret = pcmcia_enable_device(link); |
276 | if (ret) | 247 | if (ret) |
277 | goto failed; | 248 | goto failed; |
278 | 249 | ||
@@ -301,14 +272,6 @@ failed: | |||
301 | return -ENODEV; | 272 | return -ENODEV; |
302 | } /* ibmtr_config */ | 273 | } /* ibmtr_config */ |
303 | 274 | ||
304 | /*====================================================================== | ||
305 | |||
306 | After a card is removed, ibmtr_release() will unregister the net | ||
307 | device, and release the PCMCIA configuration. If the device is | ||
308 | still open, this will be postponed until it is closed. | ||
309 | |||
310 | ======================================================================*/ | ||
311 | |||
312 | static void ibmtr_release(struct pcmcia_device *link) | 275 | static void ibmtr_release(struct pcmcia_device *link) |
313 | { | 276 | { |
314 | ibmtr_dev_t *info = link->priv; | 277 | ibmtr_dev_t *info = link->priv; |
@@ -316,7 +279,7 @@ static void ibmtr_release(struct pcmcia_device *link) | |||
316 | 279 | ||
317 | dev_dbg(&link->dev, "ibmtr_release\n"); | 280 | dev_dbg(&link->dev, "ibmtr_release\n"); |
318 | 281 | ||
319 | if (link->win) { | 282 | if (link->resource[2]->end) { |
320 | struct tok_info *ti = netdev_priv(dev); | 283 | struct tok_info *ti = netdev_priv(dev); |
321 | iounmap(ti->mmio); | 284 | iounmap(ti->mmio); |
322 | } | 285 | } |
@@ -398,9 +361,7 @@ MODULE_DEVICE_TABLE(pcmcia, ibmtr_ids); | |||
398 | 361 | ||
399 | static struct pcmcia_driver ibmtr_cs_driver = { | 362 | static struct pcmcia_driver ibmtr_cs_driver = { |
400 | .owner = THIS_MODULE, | 363 | .owner = THIS_MODULE, |
401 | .drv = { | 364 | .name = "ibmtr_cs", |
402 | .name = "ibmtr_cs", | ||
403 | }, | ||
404 | .probe = ibmtr_attach, | 365 | .probe = ibmtr_attach, |
405 | .remove = ibmtr_detach, | 366 | .remove = ibmtr_detach, |
406 | .id_table = ibmtr_ids, | 367 | .id_table = ibmtr_ids, |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 68f2deeb3ade..1eca4f5a6e78 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.h> | ||
150 | #include <pcmcia/cisreg.h> | 149 | #include <pcmcia/cisreg.h> |
151 | #include <pcmcia/cistpl.h> | 150 | #include <pcmcia/cistpl.h> |
152 | #include <pcmcia/ds.h> | 151 | #include <pcmcia/ds.h> |
@@ -435,13 +434,6 @@ static const struct net_device_ops mace_netdev_ops = { | |||
435 | .ndo_validate_addr = eth_validate_addr, | 434 | .ndo_validate_addr = eth_validate_addr, |
436 | }; | 435 | }; |
437 | 436 | ||
438 | /* ---------------------------------------------------------------------------- | ||
439 | nmclan_attach | ||
440 | Creates an "instance" of the driver, allocating local data | ||
441 | structures for one device. The device is registered with Card | ||
442 | Services. | ||
443 | ---------------------------------------------------------------------------- */ | ||
444 | |||
445 | static int nmclan_probe(struct pcmcia_device *link) | 437 | static int nmclan_probe(struct pcmcia_device *link) |
446 | { | 438 | { |
447 | mace_private *lp; | 439 | mace_private *lp; |
@@ -460,10 +452,9 @@ static int nmclan_probe(struct pcmcia_device *link) | |||
460 | spin_lock_init(&lp->bank_lock); | 452 | spin_lock_init(&lp->bank_lock); |
461 | link->resource[0]->end = 32; | 453 | link->resource[0]->end = 32; |
462 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | 454 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
463 | link->conf.Attributes = CONF_ENABLE_IRQ; | 455 | link->config_flags |= CONF_ENABLE_IRQ; |
464 | link->conf.IntType = INT_MEMORY_AND_IO; | 456 | link->config_index = 1; |
465 | link->conf.ConfigIndex = 1; | 457 | link->config_regs = PRESENT_OPTION; |
466 | link->conf.Present = PRESENT_OPTION; | ||
467 | 458 | ||
468 | lp->tx_free_frames=AM2150_MAX_TX_FRAMES; | 459 | lp->tx_free_frames=AM2150_MAX_TX_FRAMES; |
469 | 460 | ||
@@ -474,14 +465,6 @@ static int nmclan_probe(struct pcmcia_device *link) | |||
474 | return nmclan_config(link); | 465 | return nmclan_config(link); |
475 | } /* nmclan_attach */ | 466 | } /* nmclan_attach */ |
476 | 467 | ||
477 | /* ---------------------------------------------------------------------------- | ||
478 | nmclan_detach | ||
479 | This deletes a driver "instance". The device is de-registered | ||
480 | with Card Services. If it has been released, all local data | ||
481 | structures are freed. Otherwise, the structures will be freed | ||
482 | when the device is released. | ||
483 | ---------------------------------------------------------------------------- */ | ||
484 | |||
485 | static void nmclan_detach(struct pcmcia_device *link) | 468 | static void nmclan_detach(struct pcmcia_device *link) |
486 | { | 469 | { |
487 | struct net_device *dev = link->priv; | 470 | struct net_device *dev = link->priv; |
@@ -625,13 +608,6 @@ static int mace_init(mace_private *lp, unsigned int ioaddr, char *enet_addr) | |||
625 | return 0; | 608 | return 0; |
626 | } /* mace_init */ | 609 | } /* mace_init */ |
627 | 610 | ||
628 | /* ---------------------------------------------------------------------------- | ||
629 | nmclan_config | ||
630 | This routine is scheduled to run after a CARD_INSERTION event | ||
631 | is received, to configure the PCMCIA socket, and to make the | ||
632 | ethernet device available to the system. | ||
633 | ---------------------------------------------------------------------------- */ | ||
634 | |||
635 | static int nmclan_config(struct pcmcia_device *link) | 611 | static int nmclan_config(struct pcmcia_device *link) |
636 | { | 612 | { |
637 | struct net_device *dev = link->priv; | 613 | struct net_device *dev = link->priv; |
@@ -650,7 +626,7 @@ static int nmclan_config(struct pcmcia_device *link) | |||
650 | ret = pcmcia_request_exclusive_irq(link, mace_interrupt); | 626 | ret = pcmcia_request_exclusive_irq(link, mace_interrupt); |
651 | if (ret) | 627 | if (ret) |
652 | goto failed; | 628 | goto failed; |
653 | ret = pcmcia_request_configuration(link, &link->conf); | 629 | ret = pcmcia_enable_device(link); |
654 | if (ret) | 630 | if (ret) |
655 | goto failed; | 631 | goto failed; |
656 | 632 | ||
@@ -712,12 +688,6 @@ failed: | |||
712 | return -ENODEV; | 688 | return -ENODEV; |
713 | } /* nmclan_config */ | 689 | } /* nmclan_config */ |
714 | 690 | ||
715 | /* ---------------------------------------------------------------------------- | ||
716 | nmclan_release | ||
717 | After a card is removed, nmclan_release() will unregister the | ||
718 | net device, and release the PCMCIA configuration. If the device | ||
719 | is still open, this will be postponed until it is closed. | ||
720 | ---------------------------------------------------------------------------- */ | ||
721 | static void nmclan_release(struct pcmcia_device *link) | 691 | static void nmclan_release(struct pcmcia_device *link) |
722 | { | 692 | { |
723 | dev_dbg(&link->dev, "nmclan_release\n"); | 693 | dev_dbg(&link->dev, "nmclan_release\n"); |
@@ -1535,9 +1505,7 @@ MODULE_DEVICE_TABLE(pcmcia, nmclan_ids); | |||
1535 | 1505 | ||
1536 | static struct pcmcia_driver nmclan_cs_driver = { | 1506 | static struct pcmcia_driver nmclan_cs_driver = { |
1537 | .owner = THIS_MODULE, | 1507 | .owner = THIS_MODULE, |
1538 | .drv = { | 1508 | .name = "nmclan_cs", |
1539 | .name = "nmclan_cs", | ||
1540 | }, | ||
1541 | .probe = nmclan_probe, | 1509 | .probe = nmclan_probe, |
1542 | .remove = nmclan_detach, | 1510 | .remove = nmclan_detach, |
1543 | .id_table = nmclan_ids, | 1511 | .id_table = nmclan_ids, |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index c3edfe4c2651..5d7d1d3088ae 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.h> | ||
46 | #include <pcmcia/cistpl.h> | 45 | #include <pcmcia/cistpl.h> |
47 | #include <pcmcia/ciscode.h> | 46 | #include <pcmcia/ciscode.h> |
48 | #include <pcmcia/ds.h> | 47 | #include <pcmcia/ds.h> |
@@ -238,14 +237,6 @@ static const struct net_device_ops pcnet_netdev_ops = { | |||
238 | #endif | 237 | #endif |
239 | }; | 238 | }; |
240 | 239 | ||
241 | /*====================================================================== | ||
242 | |||
243 | pcnet_attach() creates an "instance" of the driver, allocating | ||
244 | local data structures for one device. The device is registered | ||
245 | with Card Services. | ||
246 | |||
247 | ======================================================================*/ | ||
248 | |||
249 | static int pcnet_probe(struct pcmcia_device *link) | 240 | static int pcnet_probe(struct pcmcia_device *link) |
250 | { | 241 | { |
251 | pcnet_dev_t *info; | 242 | pcnet_dev_t *info; |
@@ -260,23 +251,13 @@ static int pcnet_probe(struct pcmcia_device *link) | |||
260 | info->p_dev = link; | 251 | info->p_dev = link; |
261 | link->priv = dev; | 252 | link->priv = dev; |
262 | 253 | ||
263 | link->conf.Attributes = CONF_ENABLE_IRQ; | 254 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
264 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
265 | 255 | ||
266 | dev->netdev_ops = &pcnet_netdev_ops; | 256 | dev->netdev_ops = &pcnet_netdev_ops; |
267 | 257 | ||
268 | return pcnet_config(link); | 258 | return pcnet_config(link); |
269 | } /* pcnet_attach */ | 259 | } /* pcnet_attach */ |
270 | 260 | ||
271 | /*====================================================================== | ||
272 | |||
273 | This deletes a driver "instance". The device is de-registered | ||
274 | with Card Services. If it has been released, all local data | ||
275 | structures are freed. Otherwise, the structures will be freed | ||
276 | when the device is released. | ||
277 | |||
278 | ======================================================================*/ | ||
279 | |||
280 | static void pcnet_detach(struct pcmcia_device *link) | 261 | static void pcnet_detach(struct pcmcia_device *link) |
281 | { | 262 | { |
282 | struct net_device *dev = link->priv; | 263 | struct net_device *dev = link->priv; |
@@ -300,22 +281,22 @@ static void pcnet_detach(struct pcmcia_device *link) | |||
300 | static hw_info_t *get_hwinfo(struct pcmcia_device *link) | 281 | static hw_info_t *get_hwinfo(struct pcmcia_device *link) |
301 | { | 282 | { |
302 | struct net_device *dev = link->priv; | 283 | struct net_device *dev = link->priv; |
303 | win_req_t req; | ||
304 | u_char __iomem *base, *virt; | 284 | u_char __iomem *base, *virt; |
305 | int i, j; | 285 | int i, j; |
306 | 286 | ||
307 | /* Allocate a small memory window */ | 287 | /* Allocate a small memory window */ |
308 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 288 | link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
309 | req.Base = 0; req.Size = 0; | 289 | link->resource[2]->start = 0; link->resource[2]->end = 0; |
310 | req.AccessSpeed = 0; | 290 | i = pcmcia_request_window(link, link->resource[2], 0); |
311 | i = pcmcia_request_window(link, &req, &link->win); | ||
312 | if (i != 0) | 291 | if (i != 0) |
313 | return NULL; | 292 | return NULL; |
314 | 293 | ||
315 | virt = ioremap(req.Base, req.Size); | 294 | virt = ioremap(link->resource[2]->start, |
295 | resource_size(link->resource[2])); | ||
316 | for (i = 0; i < NR_INFO; i++) { | 296 | for (i = 0; i < NR_INFO; i++) { |
317 | pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1)); | 297 | pcmcia_map_mem_page(link, link->resource[2], |
318 | base = &virt[hw_info[i].offset & (req.Size-1)]; | 298 | hw_info[i].offset & ~(resource_size(link->resource[2])-1)); |
299 | base = &virt[hw_info[i].offset & (resource_size(link->resource[2])-1)]; | ||
319 | if ((readb(base+0) == hw_info[i].a0) && | 300 | if ((readb(base+0) == hw_info[i].a0) && |
320 | (readb(base+2) == hw_info[i].a1) && | 301 | (readb(base+2) == hw_info[i].a1) && |
321 | (readb(base+4) == hw_info[i].a2)) { | 302 | (readb(base+4) == hw_info[i].a2)) { |
@@ -326,7 +307,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) | |||
326 | } | 307 | } |
327 | 308 | ||
328 | iounmap(virt); | 309 | iounmap(virt); |
329 | j = pcmcia_release_window(link, link->win); | 310 | j = pcmcia_release_window(link, link->resource[2]); |
330 | return (i < NR_INFO) ? hw_info+i : NULL; | 311 | return (i < NR_INFO) ? hw_info+i : NULL; |
331 | } /* get_hwinfo */ | 312 | } /* get_hwinfo */ |
332 | 313 | ||
@@ -421,7 +402,7 @@ static hw_info_t *get_ax88190(struct pcmcia_device *link) | |||
421 | int i, j; | 402 | int i, j; |
422 | 403 | ||
423 | /* Not much of a test, but the alternatives are messy */ | 404 | /* Not much of a test, but the alternatives are messy */ |
424 | if (link->conf.ConfigBase != 0x03c0) | 405 | if (link->config_base != 0x03c0) |
425 | return NULL; | 406 | return NULL; |
426 | 407 | ||
427 | outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */ | 408 | outb_p(0x01, ioaddr + EN0_DCFG); /* Set word-wide access. */ |
@@ -463,14 +444,6 @@ static hw_info_t *get_hwired(struct pcmcia_device *link) | |||
463 | return &default_info; | 444 | return &default_info; |
464 | } /* get_hwired */ | 445 | } /* get_hwired */ |
465 | 446 | ||
466 | /*====================================================================== | ||
467 | |||
468 | pcnet_config() is scheduled to run after a CARD_INSERTION event | ||
469 | is received, to configure the PCMCIA socket, and to make the | ||
470 | ethernet device available to the system. | ||
471 | |||
472 | ======================================================================*/ | ||
473 | |||
474 | static int try_io_port(struct pcmcia_device *link) | 447 | static int try_io_port(struct pcmcia_device *link) |
475 | { | 448 | { |
476 | int j, ret; | 449 | int j, ret; |
@@ -502,100 +475,105 @@ static int try_io_port(struct pcmcia_device *link) | |||
502 | } | 475 | } |
503 | } | 476 | } |
504 | 477 | ||
505 | static int pcnet_confcheck(struct pcmcia_device *p_dev, | 478 | static int pcnet_confcheck(struct pcmcia_device *p_dev, void *priv_data) |
506 | cistpl_cftable_entry_t *cfg, | ||
507 | cistpl_cftable_entry_t *dflt, | ||
508 | unsigned int vcc, | ||
509 | void *priv_data) | ||
510 | { | 479 | { |
511 | int *has_shmem = priv_data; | 480 | int *priv = priv_data; |
512 | int i; | 481 | int try = (*priv & 0x1); |
513 | cistpl_io_t *io = &cfg->io; | 482 | |
483 | *priv &= (p_dev->resource[2]->end >= 0x4000) ? 0x10 : ~0x10; | ||
514 | 484 | ||
515 | if (cfg->index == 0 || cfg->io.nwin == 0) | 485 | if (p_dev->config_index == 0) |
516 | return -EINVAL; | 486 | return -EINVAL; |
517 | 487 | ||
518 | /* For multifunction cards, by convention, we configure the | 488 | if (p_dev->resource[0]->end + p_dev->resource[1]->end < 32) |
519 | network function with window 0, and serial with window 1 */ | 489 | return -EINVAL; |
520 | if (io->nwin > 1) { | 490 | |
521 | i = (io->win[1].len > io->win[0].len); | 491 | if (try) |
522 | p_dev->resource[1]->start = io->win[1-i].base; | 492 | p_dev->io_lines = 16; |
523 | p_dev->resource[1]->end = io->win[1-i].len; | 493 | return try_io_port(p_dev); |
524 | } else { | 494 | } |
525 | i = p_dev->resource[1]->end = 0; | 495 | |
496 | static hw_info_t *pcnet_try_config(struct pcmcia_device *link, | ||
497 | int *has_shmem, int try) | ||
498 | { | ||
499 | struct net_device *dev = link->priv; | ||
500 | hw_info_t *local_hw_info; | ||
501 | pcnet_dev_t *info = PRIV(dev); | ||
502 | int priv = try; | ||
503 | int ret; | ||
504 | |||
505 | ret = pcmcia_loop_config(link, pcnet_confcheck, &priv); | ||
506 | if (ret) { | ||
507 | dev_warn(&link->dev, "no useable port range found\n"); | ||
508 | return NULL; | ||
526 | } | 509 | } |
510 | *has_shmem = (priv & 0x10); | ||
527 | 511 | ||
528 | *has_shmem = ((cfg->mem.nwin == 1) && | 512 | if (!link->irq) |
529 | (cfg->mem.win[0].len >= 0x4000)); | 513 | return NULL; |
530 | p_dev->resource[0]->start = io->win[i].base; | ||
531 | p_dev->resource[0]->end = io->win[i].len; | ||
532 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
533 | if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) | ||
534 | return try_io_port(p_dev); | ||
535 | 514 | ||
536 | return 0; | 515 | if (resource_size(link->resource[1]) == 8) |
516 | link->config_flags |= CONF_ENABLE_SPKR; | ||
517 | |||
518 | if ((link->manf_id == MANFID_IBM) && | ||
519 | (link->card_id == PRODID_IBM_HOME_AND_AWAY)) | ||
520 | link->config_index |= 0x10; | ||
521 | |||
522 | ret = pcmcia_enable_device(link); | ||
523 | if (ret) | ||
524 | return NULL; | ||
525 | |||
526 | dev->irq = link->irq; | ||
527 | dev->base_addr = link->resource[0]->start; | ||
528 | |||
529 | if (info->flags & HAS_MISC_REG) { | ||
530 | if ((if_port == 1) || (if_port == 2)) | ||
531 | dev->if_port = if_port; | ||
532 | else | ||
533 | dev_notice(&link->dev, "invalid if_port requested\n"); | ||
534 | } else | ||
535 | dev->if_port = 0; | ||
536 | |||
537 | if ((link->config_base == 0x03c0) && | ||
538 | (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { | ||
539 | dev_info(&link->dev, | ||
540 | "this is an AX88190 card - use axnet_cs instead.\n"); | ||
541 | return NULL; | ||
542 | } | ||
543 | |||
544 | local_hw_info = get_hwinfo(link); | ||
545 | if (!local_hw_info) | ||
546 | local_hw_info = get_prom(link); | ||
547 | if (!local_hw_info) | ||
548 | local_hw_info = get_dl10019(link); | ||
549 | if (!local_hw_info) | ||
550 | local_hw_info = get_ax88190(link); | ||
551 | if (!local_hw_info) | ||
552 | local_hw_info = get_hwired(link); | ||
553 | |||
554 | return local_hw_info; | ||
537 | } | 555 | } |
538 | 556 | ||
539 | static int pcnet_config(struct pcmcia_device *link) | 557 | static int pcnet_config(struct pcmcia_device *link) |
540 | { | 558 | { |
541 | struct net_device *dev = link->priv; | 559 | struct net_device *dev = link->priv; |
542 | pcnet_dev_t *info = PRIV(dev); | 560 | pcnet_dev_t *info = PRIV(dev); |
543 | int ret, start_pg, stop_pg, cm_offset; | 561 | int start_pg, stop_pg, cm_offset; |
544 | int has_shmem = 0; | 562 | int has_shmem = 0; |
545 | hw_info_t *local_hw_info; | 563 | hw_info_t *local_hw_info; |
546 | 564 | ||
547 | dev_dbg(&link->dev, "pcnet_config\n"); | 565 | dev_dbg(&link->dev, "pcnet_config\n"); |
548 | 566 | ||
549 | ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); | 567 | local_hw_info = pcnet_try_config(link, &has_shmem, 0); |
550 | if (ret) | 568 | if (!local_hw_info) { |
551 | goto failed; | 569 | /* check whether forcing io_lines to 16 helps... */ |
552 | 570 | pcmcia_disable_device(link); | |
553 | if (!link->irq) | 571 | local_hw_info = pcnet_try_config(link, &has_shmem, 1); |
554 | goto failed; | 572 | if (local_hw_info == NULL) { |
555 | 573 | dev_notice(&link->dev, "unable to read hardware net" | |
556 | if (resource_size(link->resource[1]) == 8) { | 574 | " address for io base %#3lx\n", dev->base_addr); |
557 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 575 | goto failed; |
558 | link->conf.Status = CCSR_AUDIO_ENA; | 576 | } |
559 | } | ||
560 | if ((link->manf_id == MANFID_IBM) && | ||
561 | (link->card_id == PRODID_IBM_HOME_AND_AWAY)) | ||
562 | link->conf.ConfigIndex |= 0x10; | ||
563 | |||
564 | ret = pcmcia_request_configuration(link, &link->conf); | ||
565 | if (ret) | ||
566 | goto failed; | ||
567 | dev->irq = link->irq; | ||
568 | dev->base_addr = link->resource[0]->start; | ||
569 | if (info->flags & HAS_MISC_REG) { | ||
570 | if ((if_port == 1) || (if_port == 2)) | ||
571 | dev->if_port = if_port; | ||
572 | else | ||
573 | printk(KERN_NOTICE "pcnet_cs: invalid if_port requested\n"); | ||
574 | } else { | ||
575 | dev->if_port = 0; | ||
576 | } | ||
577 | |||
578 | if ((link->conf.ConfigBase == 0x03c0) && | ||
579 | (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { | ||
580 | printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n"); | ||
581 | printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n"); | ||
582 | goto failed; | ||
583 | } | ||
584 | |||
585 | local_hw_info = get_hwinfo(link); | ||
586 | if (local_hw_info == NULL) | ||
587 | local_hw_info = get_prom(link); | ||
588 | if (local_hw_info == NULL) | ||
589 | local_hw_info = get_dl10019(link); | ||
590 | if (local_hw_info == NULL) | ||
591 | local_hw_info = get_ax88190(link); | ||
592 | if (local_hw_info == NULL) | ||
593 | local_hw_info = get_hwired(link); | ||
594 | |||
595 | if (local_hw_info == NULL) { | ||
596 | printk(KERN_NOTICE "pcnet_cs: unable to read hardware net" | ||
597 | " address for io base %#3lx\n", dev->base_addr); | ||
598 | goto failed; | ||
599 | } | 577 | } |
600 | 578 | ||
601 | info->flags = local_hw_info->flags; | 579 | info->flags = local_hw_info->flags; |
@@ -662,14 +640,6 @@ failed: | |||
662 | return -ENODEV; | 640 | return -ENODEV; |
663 | } /* pcnet_config */ | 641 | } /* pcnet_config */ |
664 | 642 | ||
665 | /*====================================================================== | ||
666 | |||
667 | After a card is removed, pcnet_release() will unregister the net | ||
668 | device, and release the PCMCIA configuration. If the device is | ||
669 | still open, this will be postponed until it is closed. | ||
670 | |||
671 | ======================================================================*/ | ||
672 | |||
673 | static void pcnet_release(struct pcmcia_device *link) | 643 | static void pcnet_release(struct pcmcia_device *link) |
674 | { | 644 | { |
675 | pcnet_dev_t *info = PRIV(link->priv); | 645 | pcnet_dev_t *info = PRIV(link->priv); |
@@ -682,15 +652,6 @@ static void pcnet_release(struct pcmcia_device *link) | |||
682 | pcmcia_disable_device(link); | 652 | pcmcia_disable_device(link); |
683 | } | 653 | } |
684 | 654 | ||
685 | /*====================================================================== | ||
686 | |||
687 | The card status event handler. Mostly, this schedules other | ||
688 | stuff to run after an event is received. A CARD_REMOVAL event | ||
689 | also sets some flags to discourage the net drivers from trying | ||
690 | to talk to the card any more. | ||
691 | |||
692 | ======================================================================*/ | ||
693 | |||
694 | static int pcnet_suspend(struct pcmcia_device *link) | 655 | static int pcnet_suspend(struct pcmcia_device *link) |
695 | { | 656 | { |
696 | struct net_device *dev = link->priv; | 657 | struct net_device *dev = link->priv; |
@@ -1459,7 +1420,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1459 | { | 1420 | { |
1460 | struct net_device *dev = link->priv; | 1421 | struct net_device *dev = link->priv; |
1461 | pcnet_dev_t *info = PRIV(dev); | 1422 | pcnet_dev_t *info = PRIV(dev); |
1462 | win_req_t req; | ||
1463 | int i, window_size, offset, ret; | 1423 | int i, window_size, offset, ret; |
1464 | 1424 | ||
1465 | window_size = (stop_pg - start_pg) << 8; | 1425 | window_size = (stop_pg - start_pg) << 8; |
@@ -1470,22 +1430,22 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1470 | window_size = roundup_pow_of_two(window_size); | 1430 | window_size = roundup_pow_of_two(window_size); |
1471 | 1431 | ||
1472 | /* Allocate a memory window */ | 1432 | /* Allocate a memory window */ |
1473 | req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; | 1433 | link->resource[3]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; |
1474 | req.Attributes |= WIN_USE_WAIT; | 1434 | link->resource[3]->flags |= WIN_USE_WAIT; |
1475 | req.Base = 0; req.Size = window_size; | 1435 | link->resource[3]->start = 0; link->resource[3]->end = window_size; |
1476 | req.AccessSpeed = mem_speed; | 1436 | ret = pcmcia_request_window(link, link->resource[3], mem_speed); |
1477 | ret = pcmcia_request_window(link, &req, &link->win); | ||
1478 | if (ret) | 1437 | if (ret) |
1479 | goto failed; | 1438 | goto failed; |
1480 | 1439 | ||
1481 | offset = (start_pg << 8) + cm_offset; | 1440 | offset = (start_pg << 8) + cm_offset; |
1482 | offset -= offset % window_size; | 1441 | offset -= offset % window_size; |
1483 | ret = pcmcia_map_mem_page(link, link->win, offset); | 1442 | ret = pcmcia_map_mem_page(link, link->resource[3], offset); |
1484 | if (ret) | 1443 | if (ret) |
1485 | goto failed; | 1444 | goto failed; |
1486 | 1445 | ||
1487 | /* Try scribbling on the buffer */ | 1446 | /* Try scribbling on the buffer */ |
1488 | info->base = ioremap(req.Base, window_size); | 1447 | info->base = ioremap(link->resource[3]->start, |
1448 | resource_size(link->resource[3])); | ||
1489 | for (i = 0; i < (TX_PAGES<<8); i += 2) | 1449 | for (i = 0; i < (TX_PAGES<<8); i += 2) |
1490 | __raw_writew((i>>1), info->base+offset+i); | 1450 | __raw_writew((i>>1), info->base+offset+i); |
1491 | udelay(100); | 1451 | udelay(100); |
@@ -1494,19 +1454,20 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1494 | pcnet_reset_8390(dev); | 1454 | pcnet_reset_8390(dev); |
1495 | if (i != (TX_PAGES<<8)) { | 1455 | if (i != (TX_PAGES<<8)) { |
1496 | iounmap(info->base); | 1456 | iounmap(info->base); |
1497 | pcmcia_release_window(link, link->win); | 1457 | pcmcia_release_window(link, link->resource[3]); |
1498 | info->base = NULL; link->win = 0; | 1458 | info->base = NULL; |
1499 | goto failed; | 1459 | goto failed; |
1500 | } | 1460 | } |
1501 | 1461 | ||
1502 | ei_status.mem = info->base + offset; | 1462 | ei_status.mem = info->base + offset; |
1503 | ei_status.priv = req.Size; | 1463 | ei_status.priv = resource_size(link->resource[3]); |
1504 | dev->mem_start = (u_long)ei_status.mem; | 1464 | dev->mem_start = (u_long)ei_status.mem; |
1505 | dev->mem_end = dev->mem_start + req.Size; | 1465 | dev->mem_end = dev->mem_start + resource_size(link->resource[3]); |
1506 | 1466 | ||
1507 | ei_status.tx_start_page = start_pg; | 1467 | ei_status.tx_start_page = start_pg; |
1508 | ei_status.rx_start_page = start_pg + TX_PAGES; | 1468 | ei_status.rx_start_page = start_pg + TX_PAGES; |
1509 | ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); | 1469 | ei_status.stop_page = start_pg + ( |
1470 | (resource_size(link->resource[3]) - offset) >> 8); | ||
1510 | 1471 | ||
1511 | /* set up block i/o functions */ | 1472 | /* set up block i/o functions */ |
1512 | ei_status.get_8390_hdr = &shmem_get_8390_hdr; | 1473 | ei_status.get_8390_hdr = &shmem_get_8390_hdr; |
@@ -1637,6 +1598,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1637 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), | 1598 | PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCETTX", 0x547e66dc, 0x6fc5459b), |
1638 | PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), | 1599 | PCMCIA_DEVICE_PROD_ID12("iPort", "10/100 Ethernet Card", 0x56c538d2, 0x11b0ffc0), |
1639 | PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), | 1600 | PCMCIA_DEVICE_PROD_ID12("KANSAI ELECTRIC CO.,LTD", "KLA-PCM/T", 0xb18dc3b4, 0xcc51a956), |
1601 | PCMCIA_DEVICE_PROD_ID12("KENTRONICS", "KEP-230", 0xaf8144c9, 0x868f6616), | ||
1640 | PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64), | 1602 | PCMCIA_DEVICE_PROD_ID12("KCI", "PE520 PCMCIA Ethernet Adapter", 0xa89b87d3, 0x1eb88e64), |
1641 | PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5), | 1603 | PCMCIA_DEVICE_PROD_ID12("KINGMAX", "EN10T2T", 0x7bcb459a, 0xa5c81fa5), |
1642 | PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3), | 1604 | PCMCIA_DEVICE_PROD_ID12("Kingston", "KNE-PC2", 0x1128e633, 0xce2a89b3), |
@@ -1744,9 +1706,7 @@ MODULE_FIRMWARE("cis/PE-200.cis"); | |||
1744 | MODULE_FIRMWARE("cis/tamarack.cis"); | 1706 | MODULE_FIRMWARE("cis/tamarack.cis"); |
1745 | 1707 | ||
1746 | static struct pcmcia_driver pcnet_driver = { | 1708 | static struct pcmcia_driver pcnet_driver = { |
1747 | .drv = { | 1709 | .name = "pcnet_cs", |
1748 | .name = "pcnet_cs", | ||
1749 | }, | ||
1750 | .probe = pcnet_probe, | 1710 | .probe = pcnet_probe, |
1751 | .remove = pcnet_detach, | 1711 | .remove = pcnet_detach, |
1752 | .owner = THIS_MODULE, | 1712 | .owner = THIS_MODULE, |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 377367d03b41..0af2fc8ec164 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.h> | ||
48 | #include <pcmcia/cistpl.h> | 47 | #include <pcmcia/cistpl.h> |
49 | #include <pcmcia/cisreg.h> | 48 | #include <pcmcia/cisreg.h> |
50 | #include <pcmcia/ciscode.h> | 49 | #include <pcmcia/ciscode.h> |
@@ -300,14 +299,6 @@ static const struct net_device_ops smc_netdev_ops = { | |||
300 | .ndo_validate_addr = eth_validate_addr, | 299 | .ndo_validate_addr = eth_validate_addr, |
301 | }; | 300 | }; |
302 | 301 | ||
303 | /*====================================================================== | ||
304 | |||
305 | smc91c92_attach() creates an "instance" of the driver, allocating | ||
306 | local data structures for one device. The device is registered | ||
307 | with Card Services. | ||
308 | |||
309 | ======================================================================*/ | ||
310 | |||
311 | static int smc91c92_probe(struct pcmcia_device *link) | 302 | static int smc91c92_probe(struct pcmcia_device *link) |
312 | { | 303 | { |
313 | struct smc_private *smc; | 304 | struct smc_private *smc; |
@@ -324,10 +315,6 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
324 | link->priv = dev; | 315 | link->priv = dev; |
325 | 316 | ||
326 | spin_lock_init(&smc->lock); | 317 | spin_lock_init(&smc->lock); |
327 | link->resource[0]->end = 16; | ||
328 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | ||
329 | link->conf.Attributes = CONF_ENABLE_IRQ; | ||
330 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
331 | 318 | ||
332 | /* The SMC91c92-specific entries in the device structure. */ | 319 | /* The SMC91c92-specific entries in the device structure. */ |
333 | dev->netdev_ops = &smc_netdev_ops; | 320 | dev->netdev_ops = &smc_netdev_ops; |
@@ -343,15 +330,6 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
343 | return smc91c92_config(link); | 330 | return smc91c92_config(link); |
344 | } /* smc91c92_attach */ | 331 | } /* smc91c92_attach */ |
345 | 332 | ||
346 | /*====================================================================== | ||
347 | |||
348 | This deletes a driver "instance". The device is de-registered | ||
349 | with Card Services. If it has been released, all local data | ||
350 | structures are freed. Otherwise, the structures will be freed | ||
351 | when the device is released. | ||
352 | |||
353 | ======================================================================*/ | ||
354 | |||
355 | static void smc91c92_detach(struct pcmcia_device *link) | 333 | static void smc91c92_detach(struct pcmcia_device *link) |
356 | { | 334 | { |
357 | struct net_device *dev = link->priv; | 335 | struct net_device *dev = link->priv; |
@@ -412,26 +390,28 @@ static int mhz_3288_power(struct pcmcia_device *link) | |||
412 | mdelay(200); | 390 | mdelay(200); |
413 | 391 | ||
414 | /* Now read and write the COR... */ | 392 | /* Now read and write the COR... */ |
415 | tmp = readb(smc->base + link->conf.ConfigBase + CISREG_COR); | 393 | tmp = readb(smc->base + link->config_base + CISREG_COR); |
416 | udelay(5); | 394 | udelay(5); |
417 | writeb(tmp, smc->base + link->conf.ConfigBase + CISREG_COR); | 395 | writeb(tmp, smc->base + link->config_base + CISREG_COR); |
418 | 396 | ||
419 | return 0; | 397 | return 0; |
420 | } | 398 | } |
421 | 399 | ||
422 | static int mhz_mfc_config_check(struct pcmcia_device *p_dev, | 400 | static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data) |
423 | cistpl_cftable_entry_t *cf, | ||
424 | cistpl_cftable_entry_t *dflt, | ||
425 | unsigned int vcc, | ||
426 | void *priv_data) | ||
427 | { | 401 | { |
428 | int k; | 402 | int k; |
429 | p_dev->resource[1]->start = cf->io.win[0].base; | 403 | p_dev->io_lines = 16; |
404 | p_dev->resource[1]->start = p_dev->resource[0]->start; | ||
405 | p_dev->resource[1]->end = 8; | ||
406 | p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; | ||
407 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | ||
408 | p_dev->resource[0]->end = 16; | ||
409 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
410 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | ||
430 | for (k = 0; k < 0x400; k += 0x10) { | 411 | for (k = 0; k < 0x400; k += 0x10) { |
431 | if (k & 0x80) | 412 | if (k & 0x80) |
432 | continue; | 413 | continue; |
433 | p_dev->resource[0]->start = k ^ 0x300; | 414 | p_dev->resource[0]->start = k ^ 0x300; |
434 | p_dev->io_lines = 16; | ||
435 | if (!pcmcia_request_io(p_dev)) | 415 | if (!pcmcia_request_io(p_dev)) |
436 | return 0; | 416 | return 0; |
437 | } | 417 | } |
@@ -442,14 +422,11 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
442 | { | 422 | { |
443 | struct net_device *dev = link->priv; | 423 | struct net_device *dev = link->priv; |
444 | struct smc_private *smc = netdev_priv(dev); | 424 | struct smc_private *smc = netdev_priv(dev); |
445 | win_req_t req; | ||
446 | unsigned int offset; | 425 | unsigned int offset; |
447 | int i; | 426 | int i; |
448 | 427 | ||
449 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 428 | link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ | |
450 | link->conf.Status = CCSR_AUDIO_ENA; | 429 | CONF_AUTO_SET_IO; |
451 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | ||
452 | link->resource[1]->end = 8; | ||
453 | 430 | ||
454 | /* The Megahertz combo cards have modem-like CIS entries, so | 431 | /* The Megahertz combo cards have modem-like CIS entries, so |
455 | we have to explicitly try a bunch of port combinations. */ | 432 | we have to explicitly try a bunch of port combinations. */ |
@@ -459,16 +436,16 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
459 | dev->base_addr = link->resource[0]->start; | 436 | dev->base_addr = link->resource[0]->start; |
460 | 437 | ||
461 | /* Allocate a memory window, for accessing the ISR */ | 438 | /* Allocate a memory window, for accessing the ISR */ |
462 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 439 | link->resource[2]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
463 | req.Base = req.Size = 0; | 440 | link->resource[2]->start = link->resource[2]->end = 0; |
464 | req.AccessSpeed = 0; | 441 | i = pcmcia_request_window(link, link->resource[2], 0); |
465 | i = pcmcia_request_window(link, &req, &link->win); | ||
466 | if (i != 0) | 442 | if (i != 0) |
467 | return -ENODEV; | 443 | return -ENODEV; |
468 | 444 | ||
469 | smc->base = ioremap(req.Base, req.Size); | 445 | smc->base = ioremap(link->resource[2]->start, |
470 | offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; | 446 | resource_size(link->resource[2])); |
471 | i = pcmcia_map_mem_page(link, link->win, offset); | 447 | offset = (smc->manfid == MANFID_MOTOROLA) ? link->config_base : 0; |
448 | i = pcmcia_map_mem_page(link, link->resource[2], offset); | ||
472 | if ((i == 0) && | 449 | if ((i == 0) && |
473 | (smc->manfid == MANFID_MEGAHERTZ) && | 450 | (smc->manfid == MANFID_MEGAHERTZ) && |
474 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) | 451 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) |
@@ -591,14 +568,12 @@ static int mot_setup(struct pcmcia_device *link) | |||
591 | 568 | ||
592 | /*====================================================================*/ | 569 | /*====================================================================*/ |
593 | 570 | ||
594 | static int smc_configcheck(struct pcmcia_device *p_dev, | 571 | static int smc_configcheck(struct pcmcia_device *p_dev, void *priv_data) |
595 | cistpl_cftable_entry_t *cf, | ||
596 | cistpl_cftable_entry_t *dflt, | ||
597 | unsigned int vcc, | ||
598 | void *priv_data) | ||
599 | { | 572 | { |
600 | p_dev->resource[0]->start = cf->io.win[0].base; | 573 | p_dev->resource[0]->end = 16; |
601 | p_dev->io_lines = cf->io.flags & CISTPL_IO_LINES_MASK; | 574 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
575 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | ||
576 | |||
602 | return pcmcia_request_io(p_dev); | 577 | return pcmcia_request_io(p_dev); |
603 | } | 578 | } |
604 | 579 | ||
@@ -607,7 +582,8 @@ static int smc_config(struct pcmcia_device *link) | |||
607 | struct net_device *dev = link->priv; | 582 | struct net_device *dev = link->priv; |
608 | int i; | 583 | int i; |
609 | 584 | ||
610 | link->resource[0]->end = 16; | 585 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
586 | |||
611 | i = pcmcia_loop_config(link, smc_configcheck, NULL); | 587 | i = pcmcia_loop_config(link, smc_configcheck, NULL); |
612 | if (!i) | 588 | if (!i) |
613 | dev->base_addr = link->resource[0]->start; | 589 | dev->base_addr = link->resource[0]->start; |
@@ -640,15 +616,14 @@ static int osi_config(struct pcmcia_device *link) | |||
640 | static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; | 616 | static const unsigned int com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; |
641 | int i, j; | 617 | int i, j; |
642 | 618 | ||
643 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 619 | link->config_flags |= CONF_ENABLE_SPKR | CONF_ENABLE_IRQ; |
644 | link->conf.Status = CCSR_AUDIO_ENA; | ||
645 | link->resource[0]->end = 64; | 620 | link->resource[0]->end = 64; |
646 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | 621 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
647 | link->resource[1]->end = 8; | 622 | link->resource[1]->end = 8; |
648 | 623 | ||
649 | /* Enable Hard Decode, LAN, Modem */ | 624 | /* Enable Hard Decode, LAN, Modem */ |
650 | link->conf.ConfigIndex = 0x23; | ||
651 | link->io_lines = 16; | 625 | link->io_lines = 16; |
626 | link->config_index = 0x23; | ||
652 | 627 | ||
653 | for (i = j = 0; j < 4; j++) { | 628 | for (i = j = 0; j < 4; j++) { |
654 | link->resource[1]->start = com[j]; | 629 | link->resource[1]->start = com[j]; |
@@ -658,7 +633,7 @@ static int osi_config(struct pcmcia_device *link) | |||
658 | } | 633 | } |
659 | if (i != 0) { | 634 | if (i != 0) { |
660 | /* Fallback: turn off hard decode */ | 635 | /* Fallback: turn off hard decode */ |
661 | link->conf.ConfigIndex = 0x03; | 636 | link->config_index = 0x03; |
662 | link->resource[1]->end = 0; | 637 | link->resource[1]->end = 0; |
663 | i = pcmcia_request_io(link); | 638 | i = pcmcia_request_io(link); |
664 | } | 639 | } |
@@ -817,27 +792,16 @@ static int check_sig(struct pcmcia_device *link) | |||
817 | } | 792 | } |
818 | 793 | ||
819 | if (width) { | 794 | if (width) { |
820 | modconf_t mod = { | ||
821 | .Attributes = CONF_IO_CHANGE_WIDTH, | ||
822 | }; | ||
823 | printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); | 795 | printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); |
824 | 796 | ||
825 | smc91c92_suspend(link); | 797 | smc91c92_suspend(link); |
826 | pcmcia_modify_configuration(link, &mod); | 798 | pcmcia_fixup_iowidth(link); |
827 | smc91c92_resume(link); | 799 | smc91c92_resume(link); |
828 | return check_sig(link); | 800 | return check_sig(link); |
829 | } | 801 | } |
830 | return -ENODEV; | 802 | return -ENODEV; |
831 | } | 803 | } |
832 | 804 | ||
833 | /*====================================================================== | ||
834 | |||
835 | smc91c92_config() is scheduled to run after a CARD_INSERTION event | ||
836 | is received, to configure the PCMCIA socket, and to make the | ||
837 | ethernet device available to the system. | ||
838 | |||
839 | ======================================================================*/ | ||
840 | |||
841 | static int smc91c92_config(struct pcmcia_device *link) | 805 | static int smc91c92_config(struct pcmcia_device *link) |
842 | { | 806 | { |
843 | struct net_device *dev = link->priv; | 807 | struct net_device *dev = link->priv; |
@@ -869,7 +833,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
869 | i = pcmcia_request_irq(link, smc_interrupt); | 833 | i = pcmcia_request_irq(link, smc_interrupt); |
870 | if (i) | 834 | if (i) |
871 | goto config_failed; | 835 | goto config_failed; |
872 | i = pcmcia_request_configuration(link, &link->conf); | 836 | i = pcmcia_enable_device(link); |
873 | if (i) | 837 | if (i) |
874 | goto config_failed; | 838 | goto config_failed; |
875 | 839 | ||
@@ -988,18 +952,10 @@ config_failed: | |||
988 | return -ENODEV; | 952 | return -ENODEV; |
989 | } /* smc91c92_config */ | 953 | } /* smc91c92_config */ |
990 | 954 | ||
991 | /*====================================================================== | ||
992 | |||
993 | After a card is removed, smc91c92_release() will unregister the net | ||
994 | device, and release the PCMCIA configuration. If the device is | ||
995 | still open, this will be postponed until it is closed. | ||
996 | |||
997 | ======================================================================*/ | ||
998 | |||
999 | static void smc91c92_release(struct pcmcia_device *link) | 955 | static void smc91c92_release(struct pcmcia_device *link) |
1000 | { | 956 | { |
1001 | dev_dbg(&link->dev, "smc91c92_release\n"); | 957 | dev_dbg(&link->dev, "smc91c92_release\n"); |
1002 | if (link->win) { | 958 | if (link->resource[2]->end) { |
1003 | struct net_device *dev = link->priv; | 959 | struct net_device *dev = link->priv; |
1004 | struct smc_private *smc = netdev_priv(dev); | 960 | struct smc_private *smc = netdev_priv(dev); |
1005 | iounmap(smc->base); | 961 | iounmap(smc->base); |
@@ -2101,9 +2057,7 @@ MODULE_DEVICE_TABLE(pcmcia, smc91c92_ids); | |||
2101 | 2057 | ||
2102 | static struct pcmcia_driver smc91c92_cs_driver = { | 2058 | static struct pcmcia_driver smc91c92_cs_driver = { |
2103 | .owner = THIS_MODULE, | 2059 | .owner = THIS_MODULE, |
2104 | .drv = { | 2060 | .name = "smc91c92_cs", |
2105 | .name = "smc91c92_cs", | ||
2106 | }, | ||
2107 | .probe = smc91c92_probe, | 2061 | .probe = smc91c92_probe, |
2108 | .remove = smc91c92_detach, | 2062 | .remove = smc91c92_detach, |
2109 | .id_table = smc91c92_ids, | 2063 | .id_table = smc91c92_ids, |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index f5819526b5ee..1fece617c069 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.h> | ||
86 | #include <pcmcia/cistpl.h> | 85 | #include <pcmcia/cistpl.h> |
87 | #include <pcmcia/cisreg.h> | 86 | #include <pcmcia/cisreg.h> |
88 | #include <pcmcia/ciscode.h> | 87 | #include <pcmcia/ciscode.h> |
@@ -267,33 +266,11 @@ static unsigned mii_rd(unsigned int ioaddr, u_char phyaddr, u_char phyreg); | |||
267 | static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, | 266 | static void mii_wr(unsigned int ioaddr, u_char phyaddr, u_char phyreg, |
268 | unsigned data, int len); | 267 | unsigned data, int len); |
269 | 268 | ||
270 | /* | ||
271 | * The event() function is this driver's Card Services event handler. | ||
272 | * It will be called by Card Services when an appropriate card status | ||
273 | * event is received. The config() and release() entry points are | ||
274 | * used to configure or release a socket, in response to card insertion | ||
275 | * and ejection events. They are invoked from the event handler. | ||
276 | */ | ||
277 | |||
278 | static int has_ce2_string(struct pcmcia_device * link); | 269 | static int has_ce2_string(struct pcmcia_device * link); |
279 | static int xirc2ps_config(struct pcmcia_device * link); | 270 | static int xirc2ps_config(struct pcmcia_device * link); |
280 | static void xirc2ps_release(struct pcmcia_device * link); | 271 | static void xirc2ps_release(struct pcmcia_device * link); |
281 | |||
282 | /**************** | ||
283 | * The attach() and detach() entry points are used to create and destroy | ||
284 | * "instances" of the driver, where each instance represents everything | ||
285 | * needed to manage one actual PCMCIA card. | ||
286 | */ | ||
287 | |||
288 | static void xirc2ps_detach(struct pcmcia_device *p_dev); | 272 | static void xirc2ps_detach(struct pcmcia_device *p_dev); |
289 | 273 | ||
290 | /**************** | ||
291 | * You'll also need to prototype all the functions that will actually | ||
292 | * be used to talk to your device. See 'pcmem_cs' for a good example | ||
293 | * of a fully self-sufficient driver; the other drivers rely more or | ||
294 | * less on other parts of the kernel. | ||
295 | */ | ||
296 | |||
297 | static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id); | 274 | static irqreturn_t xirc2ps_interrupt(int irq, void *dev_id); |
298 | 275 | ||
299 | typedef struct local_info_t { | 276 | typedef struct local_info_t { |
@@ -501,16 +478,6 @@ static const struct net_device_ops netdev_ops = { | |||
501 | .ndo_validate_addr = eth_validate_addr, | 478 | .ndo_validate_addr = eth_validate_addr, |
502 | }; | 479 | }; |
503 | 480 | ||
504 | /**************** | ||
505 | * xirc2ps_attach() creates an "instance" of the driver, allocating | ||
506 | * local data structures for one device. The device is registered | ||
507 | * with Card Services. | ||
508 | * | ||
509 | * The dev_link structure is initialized, but we don't actually | ||
510 | * configure the card at this point -- we wait until we receive a | ||
511 | * card insertion event. | ||
512 | */ | ||
513 | |||
514 | static int | 481 | static int |
515 | xirc2ps_probe(struct pcmcia_device *link) | 482 | xirc2ps_probe(struct pcmcia_device *link) |
516 | { | 483 | { |
@@ -529,9 +496,7 @@ xirc2ps_probe(struct pcmcia_device *link) | |||
529 | link->priv = dev; | 496 | link->priv = dev; |
530 | 497 | ||
531 | /* General socket configuration */ | 498 | /* General socket configuration */ |
532 | link->conf.Attributes = CONF_ENABLE_IRQ; | 499 | link->config_index = 1; |
533 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
534 | link->conf.ConfigIndex = 1; | ||
535 | 500 | ||
536 | /* Fill in card specific entries */ | 501 | /* Fill in card specific entries */ |
537 | dev->netdev_ops = &netdev_ops; | 502 | dev->netdev_ops = &netdev_ops; |
@@ -542,13 +507,6 @@ xirc2ps_probe(struct pcmcia_device *link) | |||
542 | return xirc2ps_config(link); | 507 | return xirc2ps_config(link); |
543 | } /* xirc2ps_attach */ | 508 | } /* xirc2ps_attach */ |
544 | 509 | ||
545 | /**************** | ||
546 | * This deletes a driver "instance". The device is de-registered | ||
547 | * with Card Services. If it has been released, all local data | ||
548 | * structures are freed. Otherwise, the structures will be freed | ||
549 | * when the device is released. | ||
550 | */ | ||
551 | |||
552 | static void | 510 | static void |
553 | xirc2ps_detach(struct pcmcia_device *link) | 511 | xirc2ps_detach(struct pcmcia_device *link) |
554 | { | 512 | { |
@@ -667,44 +625,53 @@ has_ce2_string(struct pcmcia_device * p_dev) | |||
667 | } | 625 | } |
668 | 626 | ||
669 | static int | 627 | static int |
670 | xirc2ps_config_modem(struct pcmcia_device *p_dev, | 628 | xirc2ps_config_modem(struct pcmcia_device *p_dev, void *priv_data) |
671 | cistpl_cftable_entry_t *cf, | ||
672 | cistpl_cftable_entry_t *dflt, | ||
673 | unsigned int vcc, | ||
674 | void *priv_data) | ||
675 | { | 629 | { |
676 | unsigned int ioaddr; | 630 | unsigned int ioaddr; |
677 | 631 | ||
678 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | 632 | if ((p_dev->resource[0]->start & 0xf) == 8) |
679 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | 633 | return -ENODEV; |
680 | p_dev->resource[1]->start = cf->io.win[0].base; | 634 | |
681 | p_dev->resource[0]->start = ioaddr; | 635 | p_dev->resource[0]->end = 16; |
682 | if (!pcmcia_request_io(p_dev)) | 636 | p_dev->resource[1]->end = 8; |
683 | return 0; | 637 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
684 | } | 638 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; |
639 | p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; | ||
640 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | ||
641 | p_dev->io_lines = 10; | ||
642 | |||
643 | p_dev->resource[1]->start = p_dev->resource[0]->start; | ||
644 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | ||
645 | p_dev->resource[0]->start = ioaddr; | ||
646 | if (!pcmcia_request_io(p_dev)) | ||
647 | return 0; | ||
685 | } | 648 | } |
686 | return -ENODEV; | 649 | return -ENODEV; |
687 | } | 650 | } |
688 | 651 | ||
689 | static int | 652 | static int |
690 | xirc2ps_config_check(struct pcmcia_device *p_dev, | 653 | xirc2ps_config_check(struct pcmcia_device *p_dev, void *priv_data) |
691 | cistpl_cftable_entry_t *cf, | ||
692 | cistpl_cftable_entry_t *dflt, | ||
693 | unsigned int vcc, | ||
694 | void *priv_data) | ||
695 | { | 654 | { |
696 | int *pass = priv_data; | 655 | int *pass = priv_data; |
656 | resource_size_t tmp = p_dev->resource[1]->start; | ||
697 | 657 | ||
698 | if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { | 658 | tmp += (*pass ? (p_dev->config_index & 0x20 ? -24 : 8) |
699 | p_dev->resource[1]->start = cf->io.win[0].base; | 659 | : (p_dev->config_index & 0x20 ? 8 : -24)); |
700 | p_dev->resource[0]->start = p_dev->resource[1]->start | 660 | |
701 | + (*pass ? (cf->index & 0x20 ? -24:8) | 661 | if ((p_dev->resource[0]->start & 0xf) == 8) |
702 | : (cf->index & 0x20 ? 8:-24)); | 662 | return -ENODEV; |
703 | if (!pcmcia_request_io(p_dev)) | 663 | |
704 | return 0; | 664 | p_dev->resource[0]->end = 18; |
705 | } | 665 | p_dev->resource[1]->end = 8; |
706 | return -ENODEV; | 666 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
667 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; | ||
668 | p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; | ||
669 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | ||
670 | p_dev->io_lines = 10; | ||
707 | 671 | ||
672 | p_dev->resource[1]->start = p_dev->resource[0]->start; | ||
673 | p_dev->resource[0]->start = tmp; | ||
674 | return pcmcia_request_io(p_dev); | ||
708 | } | 675 | } |
709 | 676 | ||
710 | 677 | ||
@@ -727,11 +694,6 @@ static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev, | |||
727 | }; | 694 | }; |
728 | 695 | ||
729 | 696 | ||
730 | /**************** | ||
731 | * xirc2ps_config() is scheduled to run after a CARD_INSERTION event | ||
732 | * is received, to configure the PCMCIA socket, and to make the | ||
733 | * ethernet device available to the system. | ||
734 | */ | ||
735 | static int | 697 | static int |
736 | xirc2ps_config(struct pcmcia_device * link) | 698 | xirc2ps_config(struct pcmcia_device * link) |
737 | { | 699 | { |
@@ -807,32 +769,24 @@ xirc2ps_config(struct pcmcia_device * link) | |||
807 | goto failure; | 769 | goto failure; |
808 | } | 770 | } |
809 | 771 | ||
810 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; | ||
811 | link->io_lines = 10; | ||
812 | if (local->modem) { | 772 | if (local->modem) { |
813 | int pass; | 773 | int pass; |
774 | link->config_flags |= CONF_AUTO_SET_IO; | ||
814 | 775 | ||
815 | if (do_sound) { | ||
816 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
817 | link->conf.Status |= CCSR_AUDIO_ENA; | ||
818 | } | ||
819 | link->resource[1]->end = 8; | ||
820 | link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | ||
821 | if (local->dingo) { | 776 | if (local->dingo) { |
822 | /* Take the Modem IO port from the CIS and scan for a free | 777 | /* Take the Modem IO port from the CIS and scan for a free |
823 | * Ethernet port */ | 778 | * Ethernet port */ |
824 | link->resource[0]->end = 16; /* no Mako stuff anymore */ | ||
825 | if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) | 779 | if (!pcmcia_loop_config(link, xirc2ps_config_modem, NULL)) |
826 | goto port_found; | 780 | goto port_found; |
827 | } else { | 781 | } else { |
828 | link->resource[0]->end = 18; | ||
829 | /* We do 2 passes here: The first one uses the regular mapping and | 782 | /* We do 2 passes here: The first one uses the regular mapping and |
830 | * the second tries again, thereby considering that the 32 ports are | 783 | * the second tries again, thereby considering that the 32 ports are |
831 | * mirrored every 32 bytes. Actually we use a mirrored port for | 784 | * mirrored every 32 bytes. Actually we use a mirrored port for |
832 | * the Mako if (on the first pass) the COR bit 5 is set. | 785 | * the Mako if (on the first pass) the COR bit 5 is set. |
833 | */ | 786 | */ |
834 | for (pass=0; pass < 2; pass++) | 787 | for (pass=0; pass < 2; pass++) |
835 | if (!pcmcia_loop_config(link, xirc2ps_config_check, &pass)) | 788 | if (!pcmcia_loop_config(link, xirc2ps_config_check, |
789 | &pass)) | ||
836 | goto port_found; | 790 | goto port_found; |
837 | /* if special option: | 791 | /* if special option: |
838 | * try to configure as Ethernet only. | 792 | * try to configure as Ethernet only. |
@@ -840,7 +794,9 @@ xirc2ps_config(struct pcmcia_device * link) | |||
840 | } | 794 | } |
841 | printk(KNOT_XIRC "no ports available\n"); | 795 | printk(KNOT_XIRC "no ports available\n"); |
842 | } else { | 796 | } else { |
797 | link->io_lines = 10; | ||
843 | link->resource[0]->end = 16; | 798 | link->resource[0]->end = 16; |
799 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; | ||
844 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { | 800 | for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { |
845 | link->resource[0]->start = ioaddr; | 801 | link->resource[0]->start = ioaddr; |
846 | if (!(err = pcmcia_request_io(link))) | 802 | if (!(err = pcmcia_request_io(link))) |
@@ -861,16 +817,14 @@ xirc2ps_config(struct pcmcia_device * link) | |||
861 | if ((err=pcmcia_request_irq(link, xirc2ps_interrupt))) | 817 | if ((err=pcmcia_request_irq(link, xirc2ps_interrupt))) |
862 | goto config_error; | 818 | goto config_error; |
863 | 819 | ||
864 | /**************** | 820 | link->config_flags |= CONF_ENABLE_IRQ; |
865 | * This actually configures the PCMCIA socket -- setting up | 821 | if (do_sound) |
866 | * the I/O windows and the interrupt mapping. | 822 | link->config_flags |= CONF_ENABLE_SPKR; |
867 | */ | 823 | |
868 | if ((err=pcmcia_request_configuration(link, &link->conf))) | 824 | if ((err = pcmcia_enable_device(link))) |
869 | goto config_error; | 825 | goto config_error; |
870 | 826 | ||
871 | if (local->dingo) { | 827 | if (local->dingo) { |
872 | win_req_t req; | ||
873 | |||
874 | /* Reset the modem's BAR to the correct value | 828 | /* Reset the modem's BAR to the correct value |
875 | * This is necessary because in the RequestConfiguration call, | 829 | * This is necessary because in the RequestConfiguration call, |
876 | * the base address of the ethernet port (BasePort1) is written | 830 | * the base address of the ethernet port (BasePort1) is written |
@@ -890,14 +844,14 @@ xirc2ps_config(struct pcmcia_device * link) | |||
890 | * is at 0x0800. So we allocate a window into the attribute | 844 | * is at 0x0800. So we allocate a window into the attribute |
891 | * memory and write direct to the CIS registers | 845 | * memory and write direct to the CIS registers |
892 | */ | 846 | */ |
893 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 847 | link->resource[2]->flags = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | |
894 | req.Base = req.Size = 0; | 848 | WIN_ENABLE; |
895 | req.AccessSpeed = 0; | 849 | link->resource[2]->start = link->resource[2]->end = 0; |
896 | if ((err = pcmcia_request_window(link, &req, &link->win))) | 850 | if ((err = pcmcia_request_window(link, link->resource[2], 0))) |
897 | goto config_error; | 851 | goto config_error; |
898 | 852 | ||
899 | local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; | 853 | local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800; |
900 | if ((err = pcmcia_map_mem_page(link, link->win, 0))) | 854 | if ((err = pcmcia_map_mem_page(link, link->resource[2], 0))) |
901 | goto config_error; | 855 | goto config_error; |
902 | 856 | ||
903 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet | 857 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet |
@@ -978,17 +932,12 @@ xirc2ps_config(struct pcmcia_device * link) | |||
978 | return -ENODEV; | 932 | return -ENODEV; |
979 | } /* xirc2ps_config */ | 933 | } /* xirc2ps_config */ |
980 | 934 | ||
981 | /**************** | ||
982 | * After a card is removed, xirc2ps_release() will unregister the net | ||
983 | * device, and release the PCMCIA configuration. If the device is | ||
984 | * still open, this will be postponed until it is closed. | ||
985 | */ | ||
986 | static void | 935 | static void |
987 | xirc2ps_release(struct pcmcia_device *link) | 936 | xirc2ps_release(struct pcmcia_device *link) |
988 | { | 937 | { |
989 | dev_dbg(&link->dev, "release\n"); | 938 | dev_dbg(&link->dev, "release\n"); |
990 | 939 | ||
991 | if (link->win) { | 940 | if (link->resource[2]->end) { |
992 | struct net_device *dev = link->priv; | 941 | struct net_device *dev = link->priv; |
993 | local_info_t *local = netdev_priv(dev); | 942 | local_info_t *local = netdev_priv(dev); |
994 | if (local->dingo) | 943 | if (local->dingo) |
@@ -1830,9 +1779,7 @@ MODULE_DEVICE_TABLE(pcmcia, xirc2ps_ids); | |||
1830 | 1779 | ||
1831 | static struct pcmcia_driver xirc2ps_cs_driver = { | 1780 | static struct pcmcia_driver xirc2ps_cs_driver = { |
1832 | .owner = THIS_MODULE, | 1781 | .owner = THIS_MODULE, |
1833 | .drv = { | 1782 | .name = "xirc2ps_cs", |
1834 | .name = "xirc2ps_cs", | ||
1835 | }, | ||
1836 | .probe = xirc2ps_probe, | 1783 | .probe = xirc2ps_probe, |
1837 | .remove = xirc2ps_detach, | 1784 | .remove = xirc2ps_detach, |
1838 | .id_table = xirc2ps_ids, | 1785 | .id_table = xirc2ps_ids, |
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_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_async.c b/drivers/net/ppp_async.c index af50a530daee..78d70a6481bf 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -184,7 +184,7 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
184 | tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); | 184 | tasklet_init(&ap->tsk, ppp_async_process, (unsigned long) ap); |
185 | 185 | ||
186 | atomic_set(&ap->refcnt, 1); | 186 | atomic_set(&ap->refcnt, 1); |
187 | init_MUTEX_LOCKED(&ap->dead_sem); | 187 | sema_init(&ap->dead_sem, 0); |
188 | 188 | ||
189 | ap->chan.private = ap; | 189 | ap->chan.private = ap; |
190 | ap->chan.ops = &async_ops; | 190 | ap->chan.ops = &async_ops; |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 6695a51e09e9..4bddb2afdd15 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -856,7 +856,8 @@ static const struct file_operations ppp_device_fops = { | |||
856 | .poll = ppp_poll, | 856 | .poll = ppp_poll, |
857 | .unlocked_ioctl = ppp_ioctl, | 857 | .unlocked_ioctl = ppp_ioctl, |
858 | .open = ppp_open, | 858 | .open = ppp_open, |
859 | .release = ppp_release | 859 | .release = ppp_release, |
860 | .llseek = noop_llseek, | ||
860 | }; | 861 | }; |
861 | 862 | ||
862 | static __net_init int ppp_init_net(struct net *net) | 863 | static __net_init int ppp_init_net(struct net *net) |
@@ -1314,8 +1315,13 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1314 | hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; | 1315 | hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; |
1315 | i = 0; | 1316 | i = 0; |
1316 | list_for_each_entry(pch, &ppp->channels, clist) { | 1317 | list_for_each_entry(pch, &ppp->channels, clist) { |
1317 | navail += pch->avail = (pch->chan != NULL); | 1318 | if (pch->chan) { |
1318 | pch->speed = pch->chan->speed; | 1319 | pch->avail = 1; |
1320 | navail++; | ||
1321 | pch->speed = pch->chan->speed; | ||
1322 | } else { | ||
1323 | pch->avail = 0; | ||
1324 | } | ||
1319 | if (pch->avail) { | 1325 | if (pch->avail) { |
1320 | if (skb_queue_empty(&pch->file.xq) || | 1326 | if (skb_queue_empty(&pch->file.xq) || |
1321 | !pch->had_frag) { | 1327 | !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 bf6d87adda4f..66eea5972020 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -1983,8 +1983,6 @@ static struct net_device_stats *qlcnic_get_stats(struct net_device *netdev) | |||
1983 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1983 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
1984 | struct net_device_stats *stats = &netdev->stats; | 1984 | struct net_device_stats *stats = &netdev->stats; |
1985 | 1985 | ||
1986 | memset(stats, 0, sizeof(*stats)); | ||
1987 | |||
1988 | stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; | 1986 | stats->rx_packets = adapter->stats.rx_pkts + adapter->stats.lro_pkts; |
1989 | stats->tx_packets = adapter->stats.xmitfinished; | 1987 | stats->tx_packets = adapter->stats.xmitfinished; |
1990 | stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes; | 1988 | stats->rx_bytes = adapter->stats.rxbytes + adapter->stats.lrobytes; |
@@ -2190,9 +2188,16 @@ static int qlcnic_rx_poll(struct napi_struct *napi, int budget) | |||
2190 | #ifdef CONFIG_NET_POLL_CONTROLLER | 2188 | #ifdef CONFIG_NET_POLL_CONTROLLER |
2191 | static void qlcnic_poll_controller(struct net_device *netdev) | 2189 | static void qlcnic_poll_controller(struct net_device *netdev) |
2192 | { | 2190 | { |
2191 | int ring; | ||
2192 | struct qlcnic_host_sds_ring *sds_ring; | ||
2193 | 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 | |||
2194 | disable_irq(adapter->irq); | 2196 | disable_irq(adapter->irq); |
2195 | 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 | } | ||
2196 | enable_irq(adapter->irq); | 2201 | enable_irq(adapter->irq); |
2197 | } | 2202 | } |
2198 | #endif | 2203 | #endif |
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 078bbf4e6f19..992db2fa136e 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1212,7 +1212,8 @@ static void rtl8169_update_counters(struct net_device *dev) | |||
1212 | if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) | 1212 | if ((RTL_R8(ChipCmd) & CmdRxEnb) == 0) |
1213 | return; | 1213 | return; |
1214 | 1214 | ||
1215 | counters = pci_alloc_consistent(tp->pci_dev, sizeof(*counters), &paddr); | 1215 | counters = dma_alloc_coherent(&tp->pci_dev->dev, sizeof(*counters), |
1216 | &paddr, GFP_KERNEL); | ||
1216 | if (!counters) | 1217 | if (!counters) |
1217 | return; | 1218 | return; |
1218 | 1219 | ||
@@ -1233,7 +1234,8 @@ static void rtl8169_update_counters(struct net_device *dev) | |||
1233 | RTL_W32(CounterAddrLow, 0); | 1234 | RTL_W32(CounterAddrLow, 0); |
1234 | RTL_W32(CounterAddrHigh, 0); | 1235 | RTL_W32(CounterAddrHigh, 0); |
1235 | 1236 | ||
1236 | pci_free_consistent(tp->pci_dev, sizeof(*counters), counters, paddr); | 1237 | dma_free_coherent(&tp->pci_dev->dev, sizeof(*counters), counters, |
1238 | paddr); | ||
1237 | } | 1239 | } |
1238 | 1240 | ||
1239 | static void rtl8169_get_ethtool_stats(struct net_device *dev, | 1241 | static void rtl8169_get_ethtool_stats(struct net_device *dev, |
@@ -2934,7 +2936,7 @@ static const struct rtl_cfg_info { | |||
2934 | .hw_start = rtl_hw_start_8168, | 2936 | .hw_start = rtl_hw_start_8168, |
2935 | .region = 2, | 2937 | .region = 2, |
2936 | .align = 8, | 2938 | .align = 8, |
2937 | .intr_event = SYSErr | LinkChg | RxOverflow | | 2939 | .intr_event = SYSErr | RxFIFOOver | LinkChg | RxOverflow | |
2938 | TxErr | TxOK | RxOK | RxErr, | 2940 | TxErr | TxOK | RxOK | RxErr, |
2939 | .napi_event = TxErr | TxOK | RxOK | RxOverflow, | 2941 | .napi_event = TxErr | TxOK | RxOK | RxOverflow, |
2940 | .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, | 2942 | .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, |
@@ -3292,15 +3294,15 @@ static int rtl8169_open(struct net_device *dev) | |||
3292 | 3294 | ||
3293 | /* | 3295 | /* |
3294 | * Rx and Tx desscriptors needs 256 bytes alignment. | 3296 | * Rx and Tx desscriptors needs 256 bytes alignment. |
3295 | * pci_alloc_consistent provides more. | 3297 | * dma_alloc_coherent provides more. |
3296 | */ | 3298 | */ |
3297 | tp->TxDescArray = pci_alloc_consistent(pdev, R8169_TX_RING_BYTES, | 3299 | tp->TxDescArray = dma_alloc_coherent(&pdev->dev, R8169_TX_RING_BYTES, |
3298 | &tp->TxPhyAddr); | 3300 | &tp->TxPhyAddr, GFP_KERNEL); |
3299 | if (!tp->TxDescArray) | 3301 | if (!tp->TxDescArray) |
3300 | goto err_pm_runtime_put; | 3302 | goto err_pm_runtime_put; |
3301 | 3303 | ||
3302 | tp->RxDescArray = pci_alloc_consistent(pdev, R8169_RX_RING_BYTES, | 3304 | tp->RxDescArray = dma_alloc_coherent(&pdev->dev, R8169_RX_RING_BYTES, |
3303 | &tp->RxPhyAddr); | 3305 | &tp->RxPhyAddr, GFP_KERNEL); |
3304 | if (!tp->RxDescArray) | 3306 | if (!tp->RxDescArray) |
3305 | goto err_free_tx_0; | 3307 | goto err_free_tx_0; |
3306 | 3308 | ||
@@ -3334,12 +3336,12 @@ out: | |||
3334 | err_release_ring_2: | 3336 | err_release_ring_2: |
3335 | rtl8169_rx_clear(tp); | 3337 | rtl8169_rx_clear(tp); |
3336 | err_free_rx_1: | 3338 | err_free_rx_1: |
3337 | pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, | 3339 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, |
3338 | tp->RxPhyAddr); | 3340 | tp->RxPhyAddr); |
3339 | tp->RxDescArray = NULL; | 3341 | tp->RxDescArray = NULL; |
3340 | err_free_tx_0: | 3342 | err_free_tx_0: |
3341 | pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, | 3343 | dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray, |
3342 | tp->TxPhyAddr); | 3344 | tp->TxPhyAddr); |
3343 | tp->TxDescArray = NULL; | 3345 | tp->TxDescArray = NULL; |
3344 | err_pm_runtime_put: | 3346 | err_pm_runtime_put: |
3345 | pm_runtime_put_noidle(&pdev->dev); | 3347 | pm_runtime_put_noidle(&pdev->dev); |
@@ -3975,7 +3977,7 @@ static void rtl8169_free_rx_skb(struct rtl8169_private *tp, | |||
3975 | { | 3977 | { |
3976 | struct pci_dev *pdev = tp->pci_dev; | 3978 | struct pci_dev *pdev = tp->pci_dev; |
3977 | 3979 | ||
3978 | pci_unmap_single(pdev, le64_to_cpu(desc->addr), tp->rx_buf_sz, | 3980 | dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), tp->rx_buf_sz, |
3979 | PCI_DMA_FROMDEVICE); | 3981 | PCI_DMA_FROMDEVICE); |
3980 | dev_kfree_skb(*sk_buff); | 3982 | dev_kfree_skb(*sk_buff); |
3981 | *sk_buff = NULL; | 3983 | *sk_buff = NULL; |
@@ -4000,7 +4002,7 @@ static inline void rtl8169_map_to_asic(struct RxDesc *desc, dma_addr_t mapping, | |||
4000 | static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, | 4002 | static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, |
4001 | struct net_device *dev, | 4003 | struct net_device *dev, |
4002 | struct RxDesc *desc, int rx_buf_sz, | 4004 | struct RxDesc *desc, int rx_buf_sz, |
4003 | unsigned int align) | 4005 | unsigned int align, gfp_t gfp) |
4004 | { | 4006 | { |
4005 | struct sk_buff *skb; | 4007 | struct sk_buff *skb; |
4006 | dma_addr_t mapping; | 4008 | dma_addr_t mapping; |
@@ -4008,13 +4010,13 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev, | |||
4008 | 4010 | ||
4009 | pad = align ? align : NET_IP_ALIGN; | 4011 | pad = align ? align : NET_IP_ALIGN; |
4010 | 4012 | ||
4011 | skb = netdev_alloc_skb(dev, rx_buf_sz + pad); | 4013 | skb = __netdev_alloc_skb(dev, rx_buf_sz + pad, gfp); |
4012 | if (!skb) | 4014 | if (!skb) |
4013 | goto err_out; | 4015 | goto err_out; |
4014 | 4016 | ||
4015 | skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); | 4017 | skb_reserve(skb, align ? ((pad - 1) & (unsigned long)skb->data) : pad); |
4016 | 4018 | ||
4017 | mapping = pci_map_single(pdev, skb->data, rx_buf_sz, | 4019 | mapping = dma_map_single(&pdev->dev, skb->data, rx_buf_sz, |
4018 | PCI_DMA_FROMDEVICE); | 4020 | PCI_DMA_FROMDEVICE); |
4019 | 4021 | ||
4020 | rtl8169_map_to_asic(desc, mapping, rx_buf_sz); | 4022 | rtl8169_map_to_asic(desc, mapping, rx_buf_sz); |
@@ -4039,7 +4041,7 @@ static void rtl8169_rx_clear(struct rtl8169_private *tp) | |||
4039 | } | 4041 | } |
4040 | 4042 | ||
4041 | static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, | 4043 | static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, |
4042 | u32 start, u32 end) | 4044 | u32 start, u32 end, gfp_t gfp) |
4043 | { | 4045 | { |
4044 | u32 cur; | 4046 | u32 cur; |
4045 | 4047 | ||
@@ -4054,7 +4056,7 @@ static u32 rtl8169_rx_fill(struct rtl8169_private *tp, struct net_device *dev, | |||
4054 | 4056 | ||
4055 | skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, | 4057 | skb = rtl8169_alloc_rx_skb(tp->pci_dev, dev, |
4056 | tp->RxDescArray + i, | 4058 | tp->RxDescArray + i, |
4057 | tp->rx_buf_sz, tp->align); | 4059 | tp->rx_buf_sz, tp->align, gfp); |
4058 | if (!skb) | 4060 | if (!skb) |
4059 | break; | 4061 | break; |
4060 | 4062 | ||
@@ -4082,7 +4084,7 @@ static int rtl8169_init_ring(struct net_device *dev) | |||
4082 | memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); | 4084 | memset(tp->tx_skb, 0x0, NUM_TX_DESC * sizeof(struct ring_info)); |
4083 | memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); | 4085 | memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); |
4084 | 4086 | ||
4085 | if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) | 4087 | if (rtl8169_rx_fill(tp, dev, 0, NUM_RX_DESC, GFP_KERNEL) != NUM_RX_DESC) |
4086 | goto err_out; | 4088 | goto err_out; |
4087 | 4089 | ||
4088 | rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); | 4090 | rtl8169_mark_as_last_descriptor(tp->RxDescArray + NUM_RX_DESC - 1); |
@@ -4099,7 +4101,8 @@ static void rtl8169_unmap_tx_skb(struct pci_dev *pdev, struct ring_info *tx_skb, | |||
4099 | { | 4101 | { |
4100 | unsigned int len = tx_skb->len; | 4102 | unsigned int len = tx_skb->len; |
4101 | 4103 | ||
4102 | pci_unmap_single(pdev, le64_to_cpu(desc->addr), len, PCI_DMA_TODEVICE); | 4104 | dma_unmap_single(&pdev->dev, le64_to_cpu(desc->addr), len, |
4105 | PCI_DMA_TODEVICE); | ||
4103 | desc->opts1 = 0x00; | 4106 | desc->opts1 = 0x00; |
4104 | desc->opts2 = 0x00; | 4107 | desc->opts2 = 0x00; |
4105 | desc->addr = 0x00; | 4108 | desc->addr = 0x00; |
@@ -4243,7 +4246,8 @@ static int rtl8169_xmit_frags(struct rtl8169_private *tp, struct sk_buff *skb, | |||
4243 | txd = tp->TxDescArray + entry; | 4246 | txd = tp->TxDescArray + entry; |
4244 | len = frag->size; | 4247 | len = frag->size; |
4245 | addr = ((void *) page_address(frag->page)) + frag->page_offset; | 4248 | addr = ((void *) page_address(frag->page)) + frag->page_offset; |
4246 | mapping = pci_map_single(tp->pci_dev, addr, len, PCI_DMA_TODEVICE); | 4249 | mapping = dma_map_single(&tp->pci_dev->dev, addr, len, |
4250 | PCI_DMA_TODEVICE); | ||
4247 | 4251 | ||
4248 | /* anti gcc 2.95.3 bugware (sic) */ | 4252 | /* anti gcc 2.95.3 bugware (sic) */ |
4249 | status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); | 4253 | status = opts1 | len | (RingEnd * !((entry + 1) % NUM_TX_DESC)); |
@@ -4313,7 +4317,8 @@ static netdev_tx_t rtl8169_start_xmit(struct sk_buff *skb, | |||
4313 | tp->tx_skb[entry].skb = skb; | 4317 | tp->tx_skb[entry].skb = skb; |
4314 | } | 4318 | } |
4315 | 4319 | ||
4316 | mapping = pci_map_single(tp->pci_dev, skb->data, len, PCI_DMA_TODEVICE); | 4320 | mapping = dma_map_single(&tp->pci_dev->dev, skb->data, len, |
4321 | PCI_DMA_TODEVICE); | ||
4317 | 4322 | ||
4318 | tp->tx_skb[entry].len = len; | 4323 | tp->tx_skb[entry].len = len; |
4319 | txd->addr = cpu_to_le64(mapping); | 4324 | txd->addr = cpu_to_le64(mapping); |
@@ -4477,8 +4482,8 @@ static inline bool rtl8169_try_rx_copy(struct sk_buff **sk_buff, | |||
4477 | if (!skb) | 4482 | if (!skb) |
4478 | goto out; | 4483 | goto out; |
4479 | 4484 | ||
4480 | pci_dma_sync_single_for_cpu(tp->pci_dev, addr, pkt_size, | 4485 | dma_sync_single_for_cpu(&tp->pci_dev->dev, addr, pkt_size, |
4481 | PCI_DMA_FROMDEVICE); | 4486 | PCI_DMA_FROMDEVICE); |
4482 | skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); | 4487 | skb_copy_from_linear_data(*sk_buff, skb->data, pkt_size); |
4483 | *sk_buff = skb; | 4488 | *sk_buff = skb; |
4484 | done = true; | 4489 | done = true; |
@@ -4549,11 +4554,11 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
4549 | rtl8169_rx_csum(skb, desc); | 4554 | rtl8169_rx_csum(skb, desc); |
4550 | 4555 | ||
4551 | if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { | 4556 | if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { |
4552 | pci_dma_sync_single_for_device(pdev, addr, | 4557 | dma_sync_single_for_device(&pdev->dev, addr, |
4553 | pkt_size, PCI_DMA_FROMDEVICE); | 4558 | pkt_size, PCI_DMA_FROMDEVICE); |
4554 | rtl8169_mark_to_asic(desc, tp->rx_buf_sz); | 4559 | rtl8169_mark_to_asic(desc, tp->rx_buf_sz); |
4555 | } else { | 4560 | } else { |
4556 | pci_unmap_single(pdev, addr, tp->rx_buf_sz, | 4561 | dma_unmap_single(&pdev->dev, addr, tp->rx_buf_sz, |
4557 | PCI_DMA_FROMDEVICE); | 4562 | PCI_DMA_FROMDEVICE); |
4558 | tp->Rx_skbuff[entry] = NULL; | 4563 | tp->Rx_skbuff[entry] = NULL; |
4559 | } | 4564 | } |
@@ -4583,7 +4588,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, | |||
4583 | count = cur_rx - tp->cur_rx; | 4588 | count = cur_rx - tp->cur_rx; |
4584 | tp->cur_rx = cur_rx; | 4589 | tp->cur_rx = cur_rx; |
4585 | 4590 | ||
4586 | delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); | 4591 | delta = rtl8169_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx, GFP_ATOMIC); |
4587 | if (!delta && count) | 4592 | if (!delta && count) |
4588 | netif_info(tp, intr, dev, "no Rx buffer allocated\n"); | 4593 | netif_info(tp, intr, dev, "no Rx buffer allocated\n"); |
4589 | tp->dirty_rx += delta; | 4594 | tp->dirty_rx += delta; |
@@ -4625,8 +4630,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
4625 | } | 4630 | } |
4626 | 4631 | ||
4627 | /* Work around for rx fifo overflow */ | 4632 | /* Work around for rx fifo overflow */ |
4628 | if (unlikely(status & RxFIFOOver) && | 4633 | if (unlikely(status & RxFIFOOver)) { |
4629 | (tp->mac_version == RTL_GIGA_MAC_VER_11)) { | ||
4630 | netif_stop_queue(dev); | 4634 | netif_stop_queue(dev); |
4631 | rtl8169_tx_timeout(dev); | 4635 | rtl8169_tx_timeout(dev); |
4632 | break; | 4636 | break; |
@@ -4770,10 +4774,10 @@ static int rtl8169_close(struct net_device *dev) | |||
4770 | 4774 | ||
4771 | free_irq(dev->irq, dev); | 4775 | free_irq(dev->irq, dev); |
4772 | 4776 | ||
4773 | pci_free_consistent(pdev, R8169_RX_RING_BYTES, tp->RxDescArray, | 4777 | dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, |
4774 | tp->RxPhyAddr); | 4778 | tp->RxPhyAddr); |
4775 | pci_free_consistent(pdev, R8169_TX_RING_BYTES, tp->TxDescArray, | 4779 | dma_free_coherent(&pdev->dev, R8169_TX_RING_BYTES, tp->TxDescArray, |
4776 | tp->TxPhyAddr); | 4780 | tp->TxPhyAddr); |
4777 | tp->TxDescArray = NULL; | 4781 | tp->TxDescArray = NULL; |
4778 | tp->RxDescArray = NULL; | 4782 | tp->RxDescArray = NULL; |
4779 | 4783 | ||
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/skge.c b/drivers/net/skge.c index 40e5c46e7571..465ae7e84507 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/seq_file.h> | 43 | #include <linux/seq_file.h> |
44 | #include <linux/mii.h> | 44 | #include <linux/mii.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/dmi.h> | ||
46 | #include <asm/irq.h> | 47 | #include <asm/irq.h> |
47 | 48 | ||
48 | #include "skge.h" | 49 | #include "skge.h" |
@@ -3868,6 +3869,8 @@ static void __devinit skge_show_addr(struct net_device *dev) | |||
3868 | netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr); | 3869 | netif_info(skge, probe, skge->netdev, "addr %pM\n", dev->dev_addr); |
3869 | } | 3870 | } |
3870 | 3871 | ||
3872 | static int only_32bit_dma; | ||
3873 | |||
3871 | static int __devinit skge_probe(struct pci_dev *pdev, | 3874 | static int __devinit skge_probe(struct pci_dev *pdev, |
3872 | const struct pci_device_id *ent) | 3875 | const struct pci_device_id *ent) |
3873 | { | 3876 | { |
@@ -3889,7 +3892,7 @@ static int __devinit skge_probe(struct pci_dev *pdev, | |||
3889 | 3892 | ||
3890 | pci_set_master(pdev); | 3893 | pci_set_master(pdev); |
3891 | 3894 | ||
3892 | if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { | 3895 | if (!only_32bit_dma && !pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { |
3893 | using_dac = 1; | 3896 | using_dac = 1; |
3894 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); | 3897 | err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); |
3895 | } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { | 3898 | } else if (!(err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { |
@@ -4147,8 +4150,21 @@ static struct pci_driver skge_driver = { | |||
4147 | .shutdown = skge_shutdown, | 4150 | .shutdown = skge_shutdown, |
4148 | }; | 4151 | }; |
4149 | 4152 | ||
4153 | static struct dmi_system_id skge_32bit_dma_boards[] = { | ||
4154 | { | ||
4155 | .ident = "Gigabyte nForce boards", | ||
4156 | .matches = { | ||
4157 | DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co"), | ||
4158 | DMI_MATCH(DMI_BOARD_NAME, "nForce"), | ||
4159 | }, | ||
4160 | }, | ||
4161 | {} | ||
4162 | }; | ||
4163 | |||
4150 | static int __init skge_init_module(void) | 4164 | static int __init skge_init_module(void) |
4151 | { | 4165 | { |
4166 | if (dmi_check_system(skge_32bit_dma_boards)) | ||
4167 | only_32bit_dma = 1; | ||
4152 | skge_debug_init(); | 4168 | skge_debug_init(); |
4153 | return pci_register_driver(&skge_driver); | 4169 | return pci_register_driver(&skge_driver); |
4154 | } | 4170 | } |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 10cf0cbc2185..726df611ee17 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -72,6 +72,7 @@ static const char version[] = | |||
72 | #include <linux/sched.h> | 72 | #include <linux/sched.h> |
73 | #include <linux/delay.h> | 73 | #include <linux/delay.h> |
74 | #include <linux/interrupt.h> | 74 | #include <linux/interrupt.h> |
75 | #include <linux/irq.h> | ||
75 | #include <linux/errno.h> | 76 | #include <linux/errno.h> |
76 | #include <linux/ioport.h> | 77 | #include <linux/ioport.h> |
77 | #include <linux/crc32.h> | 78 | #include <linux/crc32.h> |
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/tg3.c b/drivers/net/tg3.c index bc3af78a869f..1ec4b9e0239a 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -4666,7 +4666,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4666 | desc_idx, *post_ptr); | 4666 | desc_idx, *post_ptr); |
4667 | drop_it_no_recycle: | 4667 | drop_it_no_recycle: |
4668 | /* Other statistics kept track of by card. */ | 4668 | /* Other statistics kept track of by card. */ |
4669 | tp->net_stats.rx_dropped++; | 4669 | tp->rx_dropped++; |
4670 | goto next_pkt; | 4670 | goto next_pkt; |
4671 | } | 4671 | } |
4672 | 4672 | ||
@@ -4726,7 +4726,7 @@ static int tg3_rx(struct tg3_napi *tnapi, int budget) | |||
4726 | if (len > (tp->dev->mtu + ETH_HLEN) && | 4726 | if (len > (tp->dev->mtu + ETH_HLEN) && |
4727 | skb->protocol != htons(ETH_P_8021Q)) { | 4727 | skb->protocol != htons(ETH_P_8021Q)) { |
4728 | dev_kfree_skb(skb); | 4728 | dev_kfree_skb(skb); |
4729 | goto next_pkt; | 4729 | goto drop_it_no_recycle; |
4730 | } | 4730 | } |
4731 | 4731 | ||
4732 | if (desc->type_flags & RXD_FLAG_VLAN && | 4732 | if (desc->type_flags & RXD_FLAG_VLAN && |
@@ -9240,6 +9240,8 @@ static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev, | |||
9240 | stats->rx_missed_errors = old_stats->rx_missed_errors + | 9240 | stats->rx_missed_errors = old_stats->rx_missed_errors + |
9241 | get_stat64(&hw_stats->rx_discards); | 9241 | get_stat64(&hw_stats->rx_discards); |
9242 | 9242 | ||
9243 | stats->rx_dropped = tp->rx_dropped; | ||
9244 | |||
9243 | return stats; | 9245 | return stats; |
9244 | } | 9246 | } |
9245 | 9247 | ||
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 4937bd190964..be7ff138a7f9 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2759,7 +2759,7 @@ struct tg3 { | |||
2759 | 2759 | ||
2760 | 2760 | ||
2761 | /* begin "everything else" cacheline(s) section */ | 2761 | /* begin "everything else" cacheline(s) section */ |
2762 | struct rtnl_link_stats64 net_stats; | 2762 | unsigned long rx_dropped; |
2763 | struct rtnl_link_stats64 net_stats_prev; | 2763 | struct rtnl_link_stats64 net_stats_prev; |
2764 | struct tg3_ethtool_stats estats; | 2764 | struct tg3_ethtool_stats estats; |
2765 | struct tg3_ethtool_stats estats_prev; | 2765 | struct tg3_ethtool_stats estats_prev; |
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/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/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/cosa.c b/drivers/net/wan/cosa.c index 04c6cd4333f1..10bafd59f9c3 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -575,7 +575,7 @@ static int cosa_probe(int base, int irq, int dma) | |||
575 | 575 | ||
576 | /* Initialize the chardev data structures */ | 576 | /* Initialize the chardev data structures */ |
577 | mutex_init(&chan->rlock); | 577 | mutex_init(&chan->rlock); |
578 | init_MUTEX(&chan->wsem); | 578 | sema_init(&chan->wsem, 1); |
579 | 579 | ||
580 | /* Register the network interface */ | 580 | /* Register the network interface */ |
581 | if (!(chan->netdev = alloc_hdlcdev(chan))) { | 581 | if (!(chan->netdev = alloc_hdlcdev(chan))) { |
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c index b1aec3e1892f..9c70b5fa3f51 100644 --- a/drivers/net/wimax/i2400m/debugfs.c +++ b/drivers/net/wimax/i2400m/debugfs.c | |||
@@ -119,6 +119,7 @@ const struct file_operations i2400m_rx_stats_fops = { | |||
119 | .open = i2400m_stats_open, | 119 | .open = i2400m_stats_open, |
120 | .read = i2400m_rx_stats_read, | 120 | .read = i2400m_rx_stats_read, |
121 | .write = i2400m_rx_stats_write, | 121 | .write = i2400m_rx_stats_write, |
122 | .llseek = default_llseek, | ||
122 | }; | 123 | }; |
123 | 124 | ||
124 | 125 | ||
@@ -171,6 +172,7 @@ const struct file_operations i2400m_tx_stats_fops = { | |||
171 | .open = i2400m_stats_open, | 172 | .open = i2400m_stats_open, |
172 | .read = i2400m_tx_stats_read, | 173 | .read = i2400m_tx_stats_read, |
173 | .write = i2400m_tx_stats_write, | 174 | .write = i2400m_tx_stats_write, |
175 | .llseek = default_llseek, | ||
174 | }; | 176 | }; |
175 | 177 | ||
176 | 178 | ||
diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c index 8cc9e319f435..1737d1488b35 100644 --- a/drivers/net/wimax/i2400m/rx.c +++ b/drivers/net/wimax/i2400m/rx.c | |||
@@ -1244,16 +1244,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1244 | int i, result; | 1244 | int i, result; |
1245 | struct device *dev = i2400m_dev(i2400m); | 1245 | struct device *dev = i2400m_dev(i2400m); |
1246 | const struct i2400m_msg_hdr *msg_hdr; | 1246 | const struct i2400m_msg_hdr *msg_hdr; |
1247 | size_t pl_itr, pl_size, skb_len; | 1247 | size_t pl_itr, pl_size; |
1248 | unsigned long flags; | 1248 | unsigned long flags; |
1249 | unsigned num_pls, single_last; | 1249 | unsigned num_pls, single_last, skb_len; |
1250 | 1250 | ||
1251 | skb_len = skb->len; | 1251 | skb_len = skb->len; |
1252 | d_fnstart(4, dev, "(i2400m %p skb %p [size %zu])\n", | 1252 | d_fnstart(4, dev, "(i2400m %p skb %p [size %u])\n", |
1253 | i2400m, skb, skb_len); | 1253 | i2400m, skb, skb_len); |
1254 | result = -EIO; | 1254 | result = -EIO; |
1255 | msg_hdr = (void *) skb->data; | 1255 | msg_hdr = (void *) skb->data; |
1256 | result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb->len); | 1256 | result = i2400m_rx_msg_hdr_check(i2400m, msg_hdr, skb_len); |
1257 | if (result < 0) | 1257 | if (result < 0) |
1258 | goto error_msg_hdr_check; | 1258 | goto error_msg_hdr_check; |
1259 | result = -EIO; | 1259 | result = -EIO; |
@@ -1261,10 +1261,10 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1261 | pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ | 1261 | pl_itr = sizeof(*msg_hdr) + /* Check payload descriptor(s) */ |
1262 | num_pls * sizeof(msg_hdr->pld[0]); | 1262 | num_pls * sizeof(msg_hdr->pld[0]); |
1263 | pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); | 1263 | pl_itr = ALIGN(pl_itr, I2400M_PL_ALIGN); |
1264 | if (pl_itr > skb->len) { /* got all the payload descriptors? */ | 1264 | if (pl_itr > skb_len) { /* got all the payload descriptors? */ |
1265 | dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " | 1265 | dev_err(dev, "RX: HW BUG? message too short (%u bytes) for " |
1266 | "%u payload descriptors (%zu each, total %zu)\n", | 1266 | "%u payload descriptors (%zu each, total %zu)\n", |
1267 | skb->len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); | 1267 | skb_len, num_pls, sizeof(msg_hdr->pld[0]), pl_itr); |
1268 | goto error_pl_descr_short; | 1268 | goto error_pl_descr_short; |
1269 | } | 1269 | } |
1270 | /* Walk each payload payload--check we really got it */ | 1270 | /* Walk each payload payload--check we really got it */ |
@@ -1272,7 +1272,7 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1272 | /* work around old gcc warnings */ | 1272 | /* work around old gcc warnings */ |
1273 | pl_size = i2400m_pld_size(&msg_hdr->pld[i]); | 1273 | pl_size = i2400m_pld_size(&msg_hdr->pld[i]); |
1274 | result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], | 1274 | result = i2400m_rx_pl_descr_check(i2400m, &msg_hdr->pld[i], |
1275 | pl_itr, skb->len); | 1275 | pl_itr, skb_len); |
1276 | if (result < 0) | 1276 | if (result < 0) |
1277 | goto error_pl_descr_check; | 1277 | goto error_pl_descr_check; |
1278 | single_last = num_pls == 1 || i == num_pls - 1; | 1278 | single_last = num_pls == 1 || i == num_pls - 1; |
@@ -1290,16 +1290,16 @@ int i2400m_rx(struct i2400m *i2400m, struct sk_buff *skb) | |||
1290 | if (i < i2400m->rx_pl_min) | 1290 | if (i < i2400m->rx_pl_min) |
1291 | i2400m->rx_pl_min = i; | 1291 | i2400m->rx_pl_min = i; |
1292 | i2400m->rx_num++; | 1292 | i2400m->rx_num++; |
1293 | i2400m->rx_size_acc += skb->len; | 1293 | i2400m->rx_size_acc += skb_len; |
1294 | if (skb->len < i2400m->rx_size_min) | 1294 | if (skb_len < i2400m->rx_size_min) |
1295 | i2400m->rx_size_min = skb->len; | 1295 | i2400m->rx_size_min = skb_len; |
1296 | if (skb->len > i2400m->rx_size_max) | 1296 | if (skb_len > i2400m->rx_size_max) |
1297 | i2400m->rx_size_max = skb->len; | 1297 | i2400m->rx_size_max = skb_len; |
1298 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); | 1298 | spin_unlock_irqrestore(&i2400m->rx_lock, flags); |
1299 | error_pl_descr_check: | 1299 | error_pl_descr_check: |
1300 | error_pl_descr_short: | 1300 | error_pl_descr_short: |
1301 | error_msg_hdr_check: | 1301 | error_msg_hdr_check: |
1302 | d_fnend(4, dev, "(i2400m %p skb %p [size %zu]) = %d\n", | 1302 | d_fnend(4, dev, "(i2400m %p skb %p [size %u]) = %d\n", |
1303 | i2400m, skb, skb_len, result); | 1303 | i2400m, skb, skb_len, result); |
1304 | return result; | 1304 | return result; |
1305 | } | 1305 | } |
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index a105087af963..f9aa1bc0a947 100644 --- a/drivers/net/wireless/adm8211.c +++ b/drivers/net/wireless/adm8211.c | |||
@@ -732,7 +732,7 @@ static int adm8211_rf_set_channel(struct ieee80211_hw *dev, unsigned int chan) | |||
732 | 732 | ||
733 | /* Nothing to do for ADMtek BBP */ | 733 | /* Nothing to do for ADMtek BBP */ |
734 | } else if (priv->bbp_type != ADM8211_TYPE_ADMTEK) | 734 | } else if (priv->bbp_type != ADM8211_TYPE_ADMTEK) |
735 | wiphy_debug(dev->wiphy, "unsupported bbp type %d\n", | 735 | wiphy_debug(dev->wiphy, "unsupported BBP type %d\n", |
736 | priv->bbp_type); | 736 | priv->bbp_type); |
737 | 737 | ||
738 | ADM8211_RESTORE(); | 738 | ADM8211_RESTORE(); |
@@ -1032,7 +1032,7 @@ static int adm8211_hw_init_bbp(struct ieee80211_hw *dev) | |||
1032 | break; | 1032 | break; |
1033 | } | 1033 | } |
1034 | } else | 1034 | } else |
1035 | wiphy_debug(dev->wiphy, "unsupported bbp %d\n", priv->bbp_type); | 1035 | wiphy_debug(dev->wiphy, "unsupported BBP %d\n", priv->bbp_type); |
1036 | 1036 | ||
1037 | ADM8211_CSR_WRITE(SYNRF, 0); | 1037 | ADM8211_CSR_WRITE(SYNRF, 0); |
1038 | 1038 | ||
@@ -1525,7 +1525,7 @@ static int adm8211_start(struct ieee80211_hw *dev) | |||
1525 | retval = request_irq(priv->pdev->irq, adm8211_interrupt, | 1525 | retval = request_irq(priv->pdev->irq, adm8211_interrupt, |
1526 | IRQF_SHARED, "adm8211", dev); | 1526 | IRQF_SHARED, "adm8211", dev); |
1527 | if (retval) { | 1527 | if (retval) { |
1528 | wiphy_err(dev->wiphy, "failed to register irq handler\n"); | 1528 | wiphy_err(dev->wiphy, "failed to register IRQ handler\n"); |
1529 | goto fail; | 1529 | goto fail; |
1530 | } | 1530 | } |
1531 | 1531 | ||
@@ -1902,7 +1902,7 @@ static int __devinit adm8211_probe(struct pci_dev *pdev, | |||
1902 | goto err_free_eeprom; | 1902 | goto err_free_eeprom; |
1903 | } | 1903 | } |
1904 | 1904 | ||
1905 | wiphy_info(dev->wiphy, "hwaddr %pm, rev 0x%02x\n", | 1905 | wiphy_info(dev->wiphy, "hwaddr %pM, Rev 0x%02x\n", |
1906 | dev->wiphy->perm_addr, pdev->revision); | 1906 | dev->wiphy->perm_addr, pdev->revision); |
1907 | 1907 | ||
1908 | return 0; | 1908 | return 0; |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 1d05445d4ba3..ce77575e88b3 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -4430,21 +4430,24 @@ static const struct file_operations proc_statsdelta_ops = { | |||
4430 | .owner = THIS_MODULE, | 4430 | .owner = THIS_MODULE, |
4431 | .read = proc_read, | 4431 | .read = proc_read, |
4432 | .open = proc_statsdelta_open, | 4432 | .open = proc_statsdelta_open, |
4433 | .release = proc_close | 4433 | .release = proc_close, |
4434 | .llseek = default_llseek, | ||
4434 | }; | 4435 | }; |
4435 | 4436 | ||
4436 | static const struct file_operations proc_stats_ops = { | 4437 | static const struct file_operations proc_stats_ops = { |
4437 | .owner = THIS_MODULE, | 4438 | .owner = THIS_MODULE, |
4438 | .read = proc_read, | 4439 | .read = proc_read, |
4439 | .open = proc_stats_open, | 4440 | .open = proc_stats_open, |
4440 | .release = proc_close | 4441 | .release = proc_close, |
4442 | .llseek = default_llseek, | ||
4441 | }; | 4443 | }; |
4442 | 4444 | ||
4443 | static const struct file_operations proc_status_ops = { | 4445 | static const struct file_operations proc_status_ops = { |
4444 | .owner = THIS_MODULE, | 4446 | .owner = THIS_MODULE, |
4445 | .read = proc_read, | 4447 | .read = proc_read, |
4446 | .open = proc_status_open, | 4448 | .open = proc_status_open, |
4447 | .release = proc_close | 4449 | .release = proc_close, |
4450 | .llseek = default_llseek, | ||
4448 | }; | 4451 | }; |
4449 | 4452 | ||
4450 | static const struct file_operations proc_SSID_ops = { | 4453 | static const struct file_operations proc_SSID_ops = { |
@@ -4452,7 +4455,8 @@ static const struct file_operations proc_SSID_ops = { | |||
4452 | .read = proc_read, | 4455 | .read = proc_read, |
4453 | .write = proc_write, | 4456 | .write = proc_write, |
4454 | .open = proc_SSID_open, | 4457 | .open = proc_SSID_open, |
4455 | .release = proc_close | 4458 | .release = proc_close, |
4459 | .llseek = default_llseek, | ||
4456 | }; | 4460 | }; |
4457 | 4461 | ||
4458 | static const struct file_operations proc_BSSList_ops = { | 4462 | static const struct file_operations proc_BSSList_ops = { |
@@ -4460,7 +4464,8 @@ static const struct file_operations proc_BSSList_ops = { | |||
4460 | .read = proc_read, | 4464 | .read = proc_read, |
4461 | .write = proc_write, | 4465 | .write = proc_write, |
4462 | .open = proc_BSSList_open, | 4466 | .open = proc_BSSList_open, |
4463 | .release = proc_close | 4467 | .release = proc_close, |
4468 | .llseek = default_llseek, | ||
4464 | }; | 4469 | }; |
4465 | 4470 | ||
4466 | static const struct file_operations proc_APList_ops = { | 4471 | static const struct file_operations proc_APList_ops = { |
@@ -4468,7 +4473,8 @@ static const struct file_operations proc_APList_ops = { | |||
4468 | .read = proc_read, | 4473 | .read = proc_read, |
4469 | .write = proc_write, | 4474 | .write = proc_write, |
4470 | .open = proc_APList_open, | 4475 | .open = proc_APList_open, |
4471 | .release = proc_close | 4476 | .release = proc_close, |
4477 | .llseek = default_llseek, | ||
4472 | }; | 4478 | }; |
4473 | 4479 | ||
4474 | static const struct file_operations proc_config_ops = { | 4480 | static const struct file_operations proc_config_ops = { |
@@ -4476,7 +4482,8 @@ static const struct file_operations proc_config_ops = { | |||
4476 | .read = proc_read, | 4482 | .read = proc_read, |
4477 | .write = proc_write, | 4483 | .write = proc_write, |
4478 | .open = proc_config_open, | 4484 | .open = proc_config_open, |
4479 | .release = proc_close | 4485 | .release = proc_close, |
4486 | .llseek = default_llseek, | ||
4480 | }; | 4487 | }; |
4481 | 4488 | ||
4482 | static const struct file_operations proc_wepkey_ops = { | 4489 | static const struct file_operations proc_wepkey_ops = { |
@@ -4484,7 +4491,8 @@ static const struct file_operations proc_wepkey_ops = { | |||
4484 | .read = proc_read, | 4491 | .read = proc_read, |
4485 | .write = proc_write, | 4492 | .write = proc_write, |
4486 | .open = proc_wepkey_open, | 4493 | .open = proc_wepkey_open, |
4487 | .release = proc_close | 4494 | .release = proc_close, |
4495 | .llseek = default_llseek, | ||
4488 | }; | 4496 | }; |
4489 | 4497 | ||
4490 | static struct proc_dir_entry *airo_entry; | 4498 | static struct proc_dir_entry *airo_entry; |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 9a121a5b787c..df2484d45474 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.h> | ||
36 | #include <pcmcia/cistpl.h> | 35 | #include <pcmcia/cistpl.h> |
37 | #include <pcmcia/cisreg.h> | 36 | #include <pcmcia/cisreg.h> |
38 | #include <pcmcia/ds.h> | 37 | #include <pcmcia/ds.h> |
@@ -54,58 +53,21 @@ MODULE_SUPPORTED_DEVICE("Aironet 4500, 4800 and Cisco 340 PCMCIA cards"); | |||
54 | 53 | ||
55 | /*====================================================================*/ | 54 | /*====================================================================*/ |
56 | 55 | ||
57 | /* | ||
58 | The event() function is this driver's Card Services event handler. | ||
59 | It will be called by Card Services when an appropriate card status | ||
60 | event is received. The config() and release() entry points are | ||
61 | used to configure or release a socket, in response to card | ||
62 | insertion and ejection events. They are invoked from the airo_cs | ||
63 | event handler. | ||
64 | */ | ||
65 | |||
66 | static int airo_config(struct pcmcia_device *link); | 56 | static int airo_config(struct pcmcia_device *link); |
67 | static void airo_release(struct pcmcia_device *link); | 57 | static void airo_release(struct pcmcia_device *link); |
68 | 58 | ||
69 | /* | ||
70 | The attach() and detach() entry points are used to create and destroy | ||
71 | "instances" of the driver, where each instance represents everything | ||
72 | needed to manage one actual PCMCIA card. | ||
73 | */ | ||
74 | |||
75 | static void airo_detach(struct pcmcia_device *p_dev); | 59 | static void airo_detach(struct pcmcia_device *p_dev); |
76 | 60 | ||
77 | typedef struct local_info_t { | 61 | typedef struct local_info_t { |
78 | struct net_device *eth_dev; | 62 | struct net_device *eth_dev; |
79 | } local_info_t; | 63 | } local_info_t; |
80 | 64 | ||
81 | /*====================================================================== | ||
82 | |||
83 | airo_attach() creates an "instance" of the driver, allocating | ||
84 | local data structures for one device. The device is registered | ||
85 | with Card Services. | ||
86 | |||
87 | The dev_link structure is initialized, but we don't actually | ||
88 | configure the card at this point -- we wait until we receive a | ||
89 | card insertion event. | ||
90 | |||
91 | ======================================================================*/ | ||
92 | |||
93 | static int airo_probe(struct pcmcia_device *p_dev) | 65 | static int airo_probe(struct pcmcia_device *p_dev) |
94 | { | 66 | { |
95 | local_info_t *local; | 67 | local_info_t *local; |
96 | 68 | ||
97 | dev_dbg(&p_dev->dev, "airo_attach()\n"); | 69 | dev_dbg(&p_dev->dev, "airo_attach()\n"); |
98 | 70 | ||
99 | /* | ||
100 | General socket configuration defaults can go here. In this | ||
101 | client, we assume very little, and rely on the CIS for almost | ||
102 | everything. In most clients, many details (i.e., number, sizes, | ||
103 | and attributes of IO windows) are fixed by the nature of the | ||
104 | device, and can be hard-wired here. | ||
105 | */ | ||
106 | p_dev->conf.Attributes = 0; | ||
107 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | ||
108 | |||
109 | /* Allocate space for private device-specific data */ | 71 | /* Allocate space for private device-specific data */ |
110 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 72 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
111 | if (!local) { | 73 | if (!local) { |
@@ -117,15 +79,6 @@ static int airo_probe(struct pcmcia_device *p_dev) | |||
117 | return airo_config(p_dev); | 79 | return airo_config(p_dev); |
118 | } /* airo_attach */ | 80 | } /* airo_attach */ |
119 | 81 | ||
120 | /*====================================================================== | ||
121 | |||
122 | This deletes a driver "instance". The device is de-registered | ||
123 | with Card Services. If it has been released, all local data | ||
124 | structures are freed. Otherwise, the structures will be freed | ||
125 | when the device is released. | ||
126 | |||
127 | ======================================================================*/ | ||
128 | |||
129 | static void airo_detach(struct pcmcia_device *link) | 82 | static void airo_detach(struct pcmcia_device *link) |
130 | { | 83 | { |
131 | dev_dbg(&link->dev, "airo_detach\n"); | 84 | dev_dbg(&link->dev, "airo_detach\n"); |
@@ -140,60 +93,12 @@ static void airo_detach(struct pcmcia_device *link) | |||
140 | kfree(link->priv); | 93 | kfree(link->priv); |
141 | } /* airo_detach */ | 94 | } /* airo_detach */ |
142 | 95 | ||
143 | /*====================================================================== | 96 | static int airo_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) |
144 | |||
145 | airo_config() is scheduled to run after a CARD_INSERTION event | ||
146 | is received, to configure the PCMCIA socket, and to make the | ||
147 | device available to the system. | ||
148 | |||
149 | ======================================================================*/ | ||
150 | |||
151 | static int airo_cs_config_check(struct pcmcia_device *p_dev, | ||
152 | cistpl_cftable_entry_t *cfg, | ||
153 | cistpl_cftable_entry_t *dflt, | ||
154 | unsigned int vcc, | ||
155 | void *priv_data) | ||
156 | { | 97 | { |
157 | if (cfg->index == 0) | 98 | if (p_dev->config_index == 0) |
158 | return -ENODEV; | 99 | return -EINVAL; |
159 | |||
160 | /* Does this card need audio output? */ | ||
161 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
162 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; | ||
163 | p_dev->conf.Status = CCSR_AUDIO_ENA; | ||
164 | } | ||
165 | |||
166 | /* Use power settings for Vcc and Vpp if present */ | ||
167 | /* Note that the CIS values need to be rescaled */ | ||
168 | if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) | ||
169 | p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; | ||
170 | else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) | ||
171 | p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; | ||
172 | |||
173 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
174 | |||
175 | /* IO window settings */ | ||
176 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; | ||
177 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
178 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
179 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
180 | p_dev->resource[0]->flags |= | ||
181 | pcmcia_io_cfg_data_width(io->flags); | ||
182 | p_dev->resource[0]->start = io->win[0].base; | ||
183 | p_dev->resource[0]->end = io->win[0].len; | ||
184 | if (io->nwin > 1) { | ||
185 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; | ||
186 | p_dev->resource[1]->start = io->win[1].base; | ||
187 | p_dev->resource[1]->end = io->win[1].len; | ||
188 | } | ||
189 | } | ||
190 | 100 | ||
191 | /* This reserves IO space but doesn't actually enable it */ | 101 | return pcmcia_request_io(p_dev); |
192 | if (pcmcia_request_io(p_dev) != 0) | ||
193 | return -ENODEV; | ||
194 | |||
195 | /* If we got this far, we're cool! */ | ||
196 | return 0; | ||
197 | } | 102 | } |
198 | 103 | ||
199 | 104 | ||
@@ -206,20 +111,9 @@ static int airo_config(struct pcmcia_device *link) | |||
206 | 111 | ||
207 | dev_dbg(&link->dev, "airo_config\n"); | 112 | dev_dbg(&link->dev, "airo_config\n"); |
208 | 113 | ||
209 | /* | 114 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | |
210 | * In this loop, we scan the CIS for configuration table | 115 | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; |
211 | * entries, each of which describes a valid card | 116 | |
212 | * configuration, including voltage, IO window, memory window, | ||
213 | * and interrupt settings. | ||
214 | * | ||
215 | * We make no assumptions about the card to be configured: we | ||
216 | * use just the information available in the CIS. In an ideal | ||
217 | * world, this would work for any PCMCIA card, but it requires | ||
218 | * a complete and accurate CIS. In practice, a driver usually | ||
219 | * "knows" most of these things without consulting the CIS, | ||
220 | * and most client drivers will only use the CIS to fill in | ||
221 | * implementation-defined details. | ||
222 | */ | ||
223 | ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); | 117 | ret = pcmcia_loop_config(link, airo_cs_config_check, NULL); |
224 | if (ret) | 118 | if (ret) |
225 | goto failed; | 119 | goto failed; |
@@ -227,12 +121,7 @@ static int airo_config(struct pcmcia_device *link) | |||
227 | if (!link->irq) | 121 | if (!link->irq) |
228 | goto failed; | 122 | goto failed; |
229 | 123 | ||
230 | /* | 124 | ret = pcmcia_enable_device(link); |
231 | This actually configures the PCMCIA socket -- setting up | ||
232 | the I/O windows and the interrupt mapping, and putting the | ||
233 | card and host interface into "Memory and IO" mode. | ||
234 | */ | ||
235 | ret = pcmcia_request_configuration(link, &link->conf); | ||
236 | if (ret) | 125 | if (ret) |
237 | goto failed; | 126 | goto failed; |
238 | ((local_info_t *)link->priv)->eth_dev = | 127 | ((local_info_t *)link->priv)->eth_dev = |
@@ -241,17 +130,6 @@ static int airo_config(struct pcmcia_device *link) | |||
241 | if (!((local_info_t *)link->priv)->eth_dev) | 130 | if (!((local_info_t *)link->priv)->eth_dev) |
242 | goto failed; | 131 | goto failed; |
243 | 132 | ||
244 | /* Finally, report what we've done */ | ||
245 | dev_info(&link->dev, "index 0x%02x: ", | ||
246 | link->conf.ConfigIndex); | ||
247 | if (link->conf.Vpp) | ||
248 | printk(", Vpp %d.%d", link->conf.Vpp/10, link->conf.Vpp%10); | ||
249 | printk(", irq %d", link->irq); | ||
250 | if (link->resource[0]) | ||
251 | printk(" & %pR", link->resource[0]); | ||
252 | if (link->resource[1]) | ||
253 | printk(" & %pR", link->resource[1]); | ||
254 | printk("\n"); | ||
255 | return 0; | 133 | return 0; |
256 | 134 | ||
257 | failed: | 135 | failed: |
@@ -259,14 +137,6 @@ static int airo_config(struct pcmcia_device *link) | |||
259 | return -ENODEV; | 137 | return -ENODEV; |
260 | } /* airo_config */ | 138 | } /* airo_config */ |
261 | 139 | ||
262 | /*====================================================================== | ||
263 | |||
264 | After a card is removed, airo_release() will unregister the | ||
265 | device, and release the PCMCIA configuration. If the device is | ||
266 | still open, this will be postponed until it is closed. | ||
267 | |||
268 | ======================================================================*/ | ||
269 | |||
270 | static void airo_release(struct pcmcia_device *link) | 140 | static void airo_release(struct pcmcia_device *link) |
271 | { | 141 | { |
272 | dev_dbg(&link->dev, "airo_release\n"); | 142 | dev_dbg(&link->dev, "airo_release\n"); |
@@ -305,9 +175,7 @@ MODULE_DEVICE_TABLE(pcmcia, airo_ids); | |||
305 | 175 | ||
306 | static struct pcmcia_driver airo_driver = { | 176 | static struct pcmcia_driver airo_driver = { |
307 | .owner = THIS_MODULE, | 177 | .owner = THIS_MODULE, |
308 | .drv = { | 178 | .name = "airo_cs", |
309 | .name = "airo_cs", | ||
310 | }, | ||
311 | .probe = airo_probe, | 179 | .probe = airo_probe, |
312 | .remove = airo_detach, | 180 | .remove = airo_detach, |
313 | .id_table = airo_ids, | 181 | .id_table = airo_ids, |
@@ -315,12 +183,12 @@ static struct pcmcia_driver airo_driver = { | |||
315 | .resume = airo_resume, | 183 | .resume = airo_resume, |
316 | }; | 184 | }; |
317 | 185 | ||
318 | static int airo_cs_init(void) | 186 | static int __init airo_cs_init(void) |
319 | { | 187 | { |
320 | return pcmcia_register_driver(&airo_driver); | 188 | return pcmcia_register_driver(&airo_driver); |
321 | } | 189 | } |
322 | 190 | ||
323 | static void airo_cs_cleanup(void) | 191 | static void __exit airo_cs_cleanup(void) |
324 | { | 192 | { |
325 | pcmcia_unregister_driver(&airo_driver); | 193 | pcmcia_unregister_driver(&airo_driver); |
326 | } | 194 | } |
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c index d5140a87f073..1128fa8c9ed5 100644 --- a/drivers/net/wireless/at76c50x-usb.c +++ b/drivers/net/wireless/at76c50x-usb.c | |||
@@ -655,7 +655,7 @@ static int at76_get_hw_config(struct at76_priv *priv) | |||
655 | exit: | 655 | exit: |
656 | kfree(hwcfg); | 656 | kfree(hwcfg); |
657 | if (ret < 0) | 657 | if (ret < 0) |
658 | wiphy_err(priv->hw->wiphy, "cannot get hw config (error %d)\n", | 658 | wiphy_err(priv->hw->wiphy, "cannot get HW Config (error %d)\n", |
659 | ret); | 659 | ret); |
660 | 660 | ||
661 | return ret; | 661 | return ret; |
@@ -960,7 +960,7 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv) | |||
960 | sizeof(struct mib_mac_addr)); | 960 | sizeof(struct mib_mac_addr)); |
961 | if (ret < 0) { | 961 | if (ret < 0) { |
962 | wiphy_err(priv->hw->wiphy, | 962 | wiphy_err(priv->hw->wiphy, |
963 | "at76_get_mib (mac_addr) failed: %d\n", ret); | 963 | "at76_get_mib (MAC_ADDR) failed: %d\n", ret); |
964 | goto exit; | 964 | goto exit; |
965 | } | 965 | } |
966 | 966 | ||
@@ -989,7 +989,7 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv) | |||
989 | sizeof(struct mib_mac_wep)); | 989 | sizeof(struct mib_mac_wep)); |
990 | if (ret < 0) { | 990 | if (ret < 0) { |
991 | wiphy_err(priv->hw->wiphy, | 991 | wiphy_err(priv->hw->wiphy, |
992 | "at76_get_mib (mac_wep) failed: %d\n", ret); | 992 | "at76_get_mib (MAC_WEP) failed: %d\n", ret); |
993 | goto exit; | 993 | goto exit; |
994 | } | 994 | } |
995 | 995 | ||
@@ -1026,7 +1026,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv) | |||
1026 | sizeof(struct mib_mac_mgmt)); | 1026 | sizeof(struct mib_mac_mgmt)); |
1027 | if (ret < 0) { | 1027 | if (ret < 0) { |
1028 | wiphy_err(priv->hw->wiphy, | 1028 | wiphy_err(priv->hw->wiphy, |
1029 | "at76_get_mib (mac_mgmt) failed: %d\n", ret); | 1029 | "at76_get_mib (MAC_MGMT) failed: %d\n", ret); |
1030 | goto exit; | 1030 | goto exit; |
1031 | } | 1031 | } |
1032 | 1032 | ||
@@ -1062,7 +1062,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv) | |||
1062 | ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac)); | 1062 | ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac)); |
1063 | if (ret < 0) { | 1063 | if (ret < 0) { |
1064 | wiphy_err(priv->hw->wiphy, | 1064 | wiphy_err(priv->hw->wiphy, |
1065 | "at76_get_mib (mac) failed: %d\n", ret); | 1065 | "at76_get_mib (MAC) failed: %d\n", ret); |
1066 | goto exit; | 1066 | goto exit; |
1067 | } | 1067 | } |
1068 | 1068 | ||
@@ -1099,7 +1099,7 @@ static void at76_dump_mib_phy(struct at76_priv *priv) | |||
1099 | ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy)); | 1099 | ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy)); |
1100 | if (ret < 0) { | 1100 | if (ret < 0) { |
1101 | wiphy_err(priv->hw->wiphy, | 1101 | wiphy_err(priv->hw->wiphy, |
1102 | "at76_get_mib (phy) failed: %d\n", ret); | 1102 | "at76_get_mib (PHY) failed: %d\n", ret); |
1103 | goto exit; | 1103 | goto exit; |
1104 | } | 1104 | } |
1105 | 1105 | ||
@@ -1132,7 +1132,7 @@ static void at76_dump_mib_local(struct at76_priv *priv) | |||
1132 | ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local)); | 1132 | ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local)); |
1133 | if (ret < 0) { | 1133 | if (ret < 0) { |
1134 | wiphy_err(priv->hw->wiphy, | 1134 | wiphy_err(priv->hw->wiphy, |
1135 | "at76_get_mib (local) failed: %d\n", ret); | 1135 | "at76_get_mib (LOCAL) failed: %d\n", ret); |
1136 | goto exit; | 1136 | goto exit; |
1137 | } | 1137 | } |
1138 | 1138 | ||
@@ -1158,7 +1158,7 @@ static void at76_dump_mib_mdomain(struct at76_priv *priv) | |||
1158 | sizeof(struct mib_mdomain)); | 1158 | sizeof(struct mib_mdomain)); |
1159 | if (ret < 0) { | 1159 | if (ret < 0) { |
1160 | wiphy_err(priv->hw->wiphy, | 1160 | wiphy_err(priv->hw->wiphy, |
1161 | "at76_get_mib (mdomain) failed: %d\n", ret); | 1161 | "at76_get_mib (MDOMAIN) failed: %d\n", ret); |
1162 | goto exit; | 1162 | goto exit; |
1163 | } | 1163 | } |
1164 | 1164 | ||
@@ -1229,7 +1229,7 @@ static int at76_submit_rx_urb(struct at76_priv *priv) | |||
1229 | struct sk_buff *skb = priv->rx_skb; | 1229 | struct sk_buff *skb = priv->rx_skb; |
1230 | 1230 | ||
1231 | if (!priv->rx_urb) { | 1231 | if (!priv->rx_urb) { |
1232 | wiphy_err(priv->hw->wiphy, "%s: priv->rx_urb is null\n", | 1232 | wiphy_err(priv->hw->wiphy, "%s: priv->rx_urb is NULL\n", |
1233 | __func__); | 1233 | __func__); |
1234 | return -EFAULT; | 1234 | return -EFAULT; |
1235 | } | 1235 | } |
@@ -1792,7 +1792,7 @@ static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1792 | wiphy_err(priv->hw->wiphy, "error in tx submit urb: %d\n", ret); | 1792 | wiphy_err(priv->hw->wiphy, "error in tx submit urb: %d\n", ret); |
1793 | if (ret == -EINVAL) | 1793 | if (ret == -EINVAL) |
1794 | wiphy_err(priv->hw->wiphy, | 1794 | wiphy_err(priv->hw->wiphy, |
1795 | "-einval: tx urb %p hcpriv %p complete %p\n", | 1795 | "-EINVAL: tx urb %p hcpriv %p complete %p\n", |
1796 | priv->tx_urb, | 1796 | priv->tx_urb, |
1797 | priv->tx_urb->hcpriv, priv->tx_urb->complete); | 1797 | priv->tx_urb->hcpriv, priv->tx_urb->complete); |
1798 | } | 1798 | } |
@@ -2310,7 +2310,7 @@ static int at76_init_new_device(struct at76_priv *priv, | |||
2310 | 2310 | ||
2311 | priv->mac80211_registered = 1; | 2311 | priv->mac80211_registered = 1; |
2312 | 2312 | ||
2313 | wiphy_info(priv->hw->wiphy, "usb %s, mac %pm, firmware %d.%d.%d-%d\n", | 2313 | wiphy_info(priv->hw->wiphy, "USB %s, MAC %pM, firmware %d.%d.%d-%d\n", |
2314 | dev_name(&interface->dev), priv->mac_addr, | 2314 | dev_name(&interface->dev), priv->mac_addr, |
2315 | priv->fw_version.major, priv->fw_version.minor, | 2315 | priv->fw_version.major, priv->fw_version.minor, |
2316 | priv->fw_version.patch, priv->fw_version.build); | 2316 | priv->fw_version.patch, priv->fw_version.build); |
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c index c67b05f3bcbd..debfb0fbc7c5 100644 --- a/drivers/net/wireless/ath/ar9170/main.c +++ b/drivers/net/wireless/ath/ar9170/main.c | |||
@@ -245,7 +245,7 @@ static void __ar9170_dump_txstats(struct ar9170 *ar) | |||
245 | { | 245 | { |
246 | int i; | 246 | int i; |
247 | 247 | ||
248 | wiphy_debug(ar->hw->wiphy, "qos queue stats\n"); | 248 | wiphy_debug(ar->hw->wiphy, "QoS queue stats\n"); |
249 | 249 | ||
250 | for (i = 0; i < __AR9170_NUM_TXQ; i++) | 250 | for (i = 0; i < __AR9170_NUM_TXQ; i++) |
251 | wiphy_debug(ar->hw->wiphy, | 251 | wiphy_debug(ar->hw->wiphy, |
@@ -387,7 +387,7 @@ static struct sk_buff *ar9170_get_queued_skb(struct ar9170 *ar, | |||
387 | if (mac && compare_ether_addr(ieee80211_get_DA(hdr), mac)) { | 387 | if (mac && compare_ether_addr(ieee80211_get_DA(hdr), mac)) { |
388 | #ifdef AR9170_QUEUE_DEBUG | 388 | #ifdef AR9170_QUEUE_DEBUG |
389 | wiphy_debug(ar->hw->wiphy, | 389 | wiphy_debug(ar->hw->wiphy, |
390 | "skip frame => da %pm != %pm\n", | 390 | "skip frame => DA %pM != %pM\n", |
391 | mac, ieee80211_get_DA(hdr)); | 391 | mac, ieee80211_get_DA(hdr)); |
392 | ar9170_print_txheader(ar, skb); | 392 | ar9170_print_txheader(ar, skb); |
393 | #endif /* AR9170_QUEUE_DEBUG */ | 393 | #endif /* AR9170_QUEUE_DEBUG */ |
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index 373dcfec689c..d77ce9906b6c 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -1327,6 +1327,10 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf, | |||
1327 | PCI_DMA_TODEVICE); | 1327 | PCI_DMA_TODEVICE); |
1328 | 1328 | ||
1329 | rate = ieee80211_get_tx_rate(sc->hw, info); | 1329 | rate = ieee80211_get_tx_rate(sc->hw, info); |
1330 | if (!rate) { | ||
1331 | ret = -EINVAL; | ||
1332 | goto err_unmap; | ||
1333 | } | ||
1330 | 1334 | ||
1331 | if (info->flags & IEEE80211_TX_CTL_NO_ACK) | 1335 | if (info->flags & IEEE80211_TX_CTL_NO_ACK) |
1332 | flags |= AR5K_TXDESC_NOACK; | 1336 | flags |= AR5K_TXDESC_NOACK; |
diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c index 4cccc29964f6..fb339c3852ee 100644 --- a/drivers/net/wireless/ath/ath5k/debug.c +++ b/drivers/net/wireless/ath/ath5k/debug.c | |||
@@ -271,6 +271,7 @@ static const struct file_operations fops_beacon = { | |||
271 | .write = write_file_beacon, | 271 | .write = write_file_beacon, |
272 | .open = ath5k_debugfs_open, | 272 | .open = ath5k_debugfs_open, |
273 | .owner = THIS_MODULE, | 273 | .owner = THIS_MODULE, |
274 | .llseek = default_llseek, | ||
274 | }; | 275 | }; |
275 | 276 | ||
276 | 277 | ||
@@ -290,6 +291,7 @@ static const struct file_operations fops_reset = { | |||
290 | .write = write_file_reset, | 291 | .write = write_file_reset, |
291 | .open = ath5k_debugfs_open, | 292 | .open = ath5k_debugfs_open, |
292 | .owner = THIS_MODULE, | 293 | .owner = THIS_MODULE, |
294 | .llseek = noop_llseek, | ||
293 | }; | 295 | }; |
294 | 296 | ||
295 | 297 | ||
@@ -369,6 +371,7 @@ static const struct file_operations fops_debug = { | |||
369 | .write = write_file_debug, | 371 | .write = write_file_debug, |
370 | .open = ath5k_debugfs_open, | 372 | .open = ath5k_debugfs_open, |
371 | .owner = THIS_MODULE, | 373 | .owner = THIS_MODULE, |
374 | .llseek = default_llseek, | ||
372 | }; | 375 | }; |
373 | 376 | ||
374 | 377 | ||
@@ -480,6 +483,7 @@ static const struct file_operations fops_antenna = { | |||
480 | .write = write_file_antenna, | 483 | .write = write_file_antenna, |
481 | .open = ath5k_debugfs_open, | 484 | .open = ath5k_debugfs_open, |
482 | .owner = THIS_MODULE, | 485 | .owner = THIS_MODULE, |
486 | .llseek = default_llseek, | ||
483 | }; | 487 | }; |
484 | 488 | ||
485 | 489 | ||
@@ -591,6 +595,7 @@ static const struct file_operations fops_frameerrors = { | |||
591 | .write = write_file_frameerrors, | 595 | .write = write_file_frameerrors, |
592 | .open = ath5k_debugfs_open, | 596 | .open = ath5k_debugfs_open, |
593 | .owner = THIS_MODULE, | 597 | .owner = THIS_MODULE, |
598 | .llseek = default_llseek, | ||
594 | }; | 599 | }; |
595 | 600 | ||
596 | 601 | ||
@@ -748,6 +753,7 @@ static const struct file_operations fops_ani = { | |||
748 | .write = write_file_ani, | 753 | .write = write_file_ani, |
749 | .open = ath5k_debugfs_open, | 754 | .open = ath5k_debugfs_open, |
750 | .owner = THIS_MODULE, | 755 | .owner = THIS_MODULE, |
756 | .llseek = default_llseek, | ||
751 | }; | 757 | }; |
752 | 758 | ||
753 | 759 | ||
@@ -811,6 +817,7 @@ static const struct file_operations fops_queue = { | |||
811 | .write = write_file_queue, | 817 | .write = write_file_queue, |
812 | .open = ath5k_debugfs_open, | 818 | .open = ath5k_debugfs_open, |
813 | .owner = THIS_MODULE, | 819 | .owner = THIS_MODULE, |
820 | .llseek = default_llseek, | ||
814 | }; | 821 | }; |
815 | 822 | ||
816 | 823 | ||
diff --git a/drivers/net/wireless/ath/ath9k/ani.c b/drivers/net/wireless/ath/ath9k/ani.c index cc648b6ae31c..a3d95cca8f0c 100644 --- a/drivers/net/wireless/ath/ath9k/ani.c +++ b/drivers/net/wireless/ath/ath9k/ani.c | |||
@@ -543,7 +543,7 @@ static u8 ath9k_hw_chan_2_clockrate_mhz(struct ath_hw *ah) | |||
543 | if (conf_is_ht40(conf)) | 543 | if (conf_is_ht40(conf)) |
544 | return clockrate * 2; | 544 | return clockrate * 2; |
545 | 545 | ||
546 | return clockrate * 2; | 546 | return clockrate; |
547 | } | 547 | } |
548 | 548 | ||
549 | static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) | 549 | static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah) |
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c index b883b174385b..057fb69ddf7f 100644 --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | |||
@@ -797,7 +797,7 @@ static bool ar9300_uncompress_block(struct ath_hw *ah, | |||
797 | length = block[it+1]; | 797 | length = block[it+1]; |
798 | length &= 0xff; | 798 | length &= 0xff; |
799 | 799 | ||
800 | if (length > 0 && spot >= 0 && spot+length < mdataSize) { | 800 | if (length > 0 && spot >= 0 && spot+length <= mdataSize) { |
801 | ath_print(common, ATH_DBG_EEPROM, | 801 | ath_print(common, ATH_DBG_EEPROM, |
802 | "Restore at %d: spot=%d " | 802 | "Restore at %d: spot=%d " |
803 | "offset=%d length=%d\n", | 803 | "offset=%d length=%d\n", |
diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c index 54aae931424e..cf500bf25ad5 100644 --- a/drivers/net/wireless/ath/ath9k/debug.c +++ b/drivers/net/wireless/ath/ath9k/debug.c | |||
@@ -71,7 +71,8 @@ static const struct file_operations fops_debug = { | |||
71 | .read = read_file_debug, | 71 | .read = read_file_debug, |
72 | .write = write_file_debug, | 72 | .write = write_file_debug, |
73 | .open = ath9k_debugfs_open, | 73 | .open = ath9k_debugfs_open, |
74 | .owner = THIS_MODULE | 74 | .owner = THIS_MODULE, |
75 | .llseek = default_llseek, | ||
75 | }; | 76 | }; |
76 | 77 | ||
77 | #endif | 78 | #endif |
@@ -116,7 +117,8 @@ static const struct file_operations fops_tx_chainmask = { | |||
116 | .read = read_file_tx_chainmask, | 117 | .read = read_file_tx_chainmask, |
117 | .write = write_file_tx_chainmask, | 118 | .write = write_file_tx_chainmask, |
118 | .open = ath9k_debugfs_open, | 119 | .open = ath9k_debugfs_open, |
119 | .owner = THIS_MODULE | 120 | .owner = THIS_MODULE, |
121 | .llseek = default_llseek, | ||
120 | }; | 122 | }; |
121 | 123 | ||
122 | 124 | ||
@@ -158,7 +160,8 @@ static const struct file_operations fops_rx_chainmask = { | |||
158 | .read = read_file_rx_chainmask, | 160 | .read = read_file_rx_chainmask, |
159 | .write = write_file_rx_chainmask, | 161 | .write = write_file_rx_chainmask, |
160 | .open = ath9k_debugfs_open, | 162 | .open = ath9k_debugfs_open, |
161 | .owner = THIS_MODULE | 163 | .owner = THIS_MODULE, |
164 | .llseek = default_llseek, | ||
162 | }; | 165 | }; |
163 | 166 | ||
164 | 167 | ||
@@ -259,7 +262,8 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf, | |||
259 | static const struct file_operations fops_dma = { | 262 | static const struct file_operations fops_dma = { |
260 | .read = read_file_dma, | 263 | .read = read_file_dma, |
261 | .open = ath9k_debugfs_open, | 264 | .open = ath9k_debugfs_open, |
262 | .owner = THIS_MODULE | 265 | .owner = THIS_MODULE, |
266 | .llseek = default_llseek, | ||
263 | }; | 267 | }; |
264 | 268 | ||
265 | 269 | ||
@@ -375,7 +379,8 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf, | |||
375 | static const struct file_operations fops_interrupt = { | 379 | static const struct file_operations fops_interrupt = { |
376 | .read = read_file_interrupt, | 380 | .read = read_file_interrupt, |
377 | .open = ath9k_debugfs_open, | 381 | .open = ath9k_debugfs_open, |
378 | .owner = THIS_MODULE | 382 | .owner = THIS_MODULE, |
383 | .llseek = default_llseek, | ||
379 | }; | 384 | }; |
380 | 385 | ||
381 | void ath_debug_stat_rc(struct ath_softc *sc, int final_rate) | 386 | void ath_debug_stat_rc(struct ath_softc *sc, int final_rate) |
@@ -464,7 +469,8 @@ static ssize_t read_file_rcstat(struct file *file, char __user *user_buf, | |||
464 | static const struct file_operations fops_rcstat = { | 469 | static const struct file_operations fops_rcstat = { |
465 | .read = read_file_rcstat, | 470 | .read = read_file_rcstat, |
466 | .open = ath9k_debugfs_open, | 471 | .open = ath9k_debugfs_open, |
467 | .owner = THIS_MODULE | 472 | .owner = THIS_MODULE, |
473 | .llseek = default_llseek, | ||
468 | }; | 474 | }; |
469 | 475 | ||
470 | static const char * ath_wiphy_state_str(enum ath_wiphy_state state) | 476 | static const char * ath_wiphy_state_str(enum ath_wiphy_state state) |
@@ -623,7 +629,8 @@ static const struct file_operations fops_wiphy = { | |||
623 | .read = read_file_wiphy, | 629 | .read = read_file_wiphy, |
624 | .write = write_file_wiphy, | 630 | .write = write_file_wiphy, |
625 | .open = ath9k_debugfs_open, | 631 | .open = ath9k_debugfs_open, |
626 | .owner = THIS_MODULE | 632 | .owner = THIS_MODULE, |
633 | .llseek = default_llseek, | ||
627 | }; | 634 | }; |
628 | 635 | ||
629 | #define PR(str, elem) \ | 636 | #define PR(str, elem) \ |
@@ -702,7 +709,8 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_txq *txq, | |||
702 | static const struct file_operations fops_xmit = { | 709 | static const struct file_operations fops_xmit = { |
703 | .read = read_file_xmit, | 710 | .read = read_file_xmit, |
704 | .open = ath9k_debugfs_open, | 711 | .open = ath9k_debugfs_open, |
705 | .owner = THIS_MODULE | 712 | .owner = THIS_MODULE, |
713 | .llseek = default_llseek, | ||
706 | }; | 714 | }; |
707 | 715 | ||
708 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | 716 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, |
@@ -814,7 +822,8 @@ void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs) | |||
814 | static const struct file_operations fops_recv = { | 822 | static const struct file_operations fops_recv = { |
815 | .read = read_file_recv, | 823 | .read = read_file_recv, |
816 | .open = ath9k_debugfs_open, | 824 | .open = ath9k_debugfs_open, |
817 | .owner = THIS_MODULE | 825 | .owner = THIS_MODULE, |
826 | .llseek = default_llseek, | ||
818 | }; | 827 | }; |
819 | 828 | ||
820 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, | 829 | static ssize_t read_file_regidx(struct file *file, char __user *user_buf, |
@@ -852,7 +861,8 @@ static const struct file_operations fops_regidx = { | |||
852 | .read = read_file_regidx, | 861 | .read = read_file_regidx, |
853 | .write = write_file_regidx, | 862 | .write = write_file_regidx, |
854 | .open = ath9k_debugfs_open, | 863 | .open = ath9k_debugfs_open, |
855 | .owner = THIS_MODULE | 864 | .owner = THIS_MODULE, |
865 | .llseek = default_llseek, | ||
856 | }; | 866 | }; |
857 | 867 | ||
858 | static ssize_t read_file_regval(struct file *file, char __user *user_buf, | 868 | static ssize_t read_file_regval(struct file *file, char __user *user_buf, |
@@ -894,7 +904,8 @@ static const struct file_operations fops_regval = { | |||
894 | .read = read_file_regval, | 904 | .read = read_file_regval, |
895 | .write = write_file_regval, | 905 | .write = write_file_regval, |
896 | .open = ath9k_debugfs_open, | 906 | .open = ath9k_debugfs_open, |
897 | .owner = THIS_MODULE | 907 | .owner = THIS_MODULE, |
908 | .llseek = default_llseek, | ||
898 | }; | 909 | }; |
899 | 910 | ||
900 | int ath9k_init_debug(struct ath_hw *ah) | 911 | int ath9k_init_debug(struct ath_hw *ah) |
diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h index 7f48df1e2903..0b09db0f8e7d 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ b/drivers/net/wireless/ath/ath9k/eeprom.h | |||
@@ -62,7 +62,7 @@ | |||
62 | 62 | ||
63 | #define SD_NO_CTL 0xE0 | 63 | #define SD_NO_CTL 0xE0 |
64 | #define NO_CTL 0xff | 64 | #define NO_CTL 0xff |
65 | #define CTL_MODE_M 7 | 65 | #define CTL_MODE_M 0xf |
66 | #define CTL_11A 0 | 66 | #define CTL_11A 0 |
67 | #define CTL_11B 1 | 67 | #define CTL_11B 1 |
68 | #define CTL_11G 2 | 68 | #define CTL_11G 2 |
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index 7d09b4b17bbd..bc2ca7d898e9 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c | |||
@@ -536,7 +536,8 @@ static ssize_t read_file_tgt_stats(struct file *file, char __user *user_buf, | |||
536 | static const struct file_operations fops_tgt_stats = { | 536 | static const struct file_operations fops_tgt_stats = { |
537 | .read = read_file_tgt_stats, | 537 | .read = read_file_tgt_stats, |
538 | .open = ath9k_debugfs_open, | 538 | .open = ath9k_debugfs_open, |
539 | .owner = THIS_MODULE | 539 | .owner = THIS_MODULE, |
540 | .llseek = default_llseek, | ||
540 | }; | 541 | }; |
541 | 542 | ||
542 | static ssize_t read_file_xmit(struct file *file, char __user *user_buf, | 543 | static ssize_t read_file_xmit(struct file *file, char __user *user_buf, |
@@ -584,7 +585,8 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf, | |||
584 | static const struct file_operations fops_xmit = { | 585 | static const struct file_operations fops_xmit = { |
585 | .read = read_file_xmit, | 586 | .read = read_file_xmit, |
586 | .open = ath9k_debugfs_open, | 587 | .open = ath9k_debugfs_open, |
587 | .owner = THIS_MODULE | 588 | .owner = THIS_MODULE, |
589 | .llseek = default_llseek, | ||
588 | }; | 590 | }; |
589 | 591 | ||
590 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, | 592 | static ssize_t read_file_recv(struct file *file, char __user *user_buf, |
@@ -613,7 +615,8 @@ static ssize_t read_file_recv(struct file *file, char __user *user_buf, | |||
613 | static const struct file_operations fops_recv = { | 615 | static const struct file_operations fops_recv = { |
614 | .read = read_file_recv, | 616 | .read = read_file_recv, |
615 | .open = ath9k_debugfs_open, | 617 | .open = ath9k_debugfs_open, |
616 | .owner = THIS_MODULE | 618 | .owner = THIS_MODULE, |
619 | .llseek = default_llseek, | ||
617 | }; | 620 | }; |
618 | 621 | ||
619 | int ath9k_htc_init_debug(struct ath_hw *ah) | 622 | int ath9k_htc_init_debug(struct ath_hw *ah) |
diff --git a/drivers/net/wireless/ath/regd.h b/drivers/net/wireless/ath/regd.h index a1c39526161a..345dd9721b41 100644 --- a/drivers/net/wireless/ath/regd.h +++ b/drivers/net/wireless/ath/regd.h | |||
@@ -31,7 +31,6 @@ enum ctl_group { | |||
31 | #define NO_CTL 0xff | 31 | #define NO_CTL 0xff |
32 | #define SD_NO_CTL 0xE0 | 32 | #define SD_NO_CTL 0xE0 |
33 | #define NO_CTL 0xff | 33 | #define NO_CTL 0xff |
34 | #define CTL_MODE_M 7 | ||
35 | #define CTL_11A 0 | 34 | #define CTL_11A 0 |
36 | #define CTL_11B 1 | 35 | #define CTL_11B 1 |
37 | #define CTL_11G 2 | 36 | #define CTL_11G 2 |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 3b632161c106..c96e19da2949 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.h> | ||
46 | #include <pcmcia/cistpl.h> | 45 | #include <pcmcia/cistpl.h> |
47 | #include <pcmcia/cisreg.h> | 46 | #include <pcmcia/cisreg.h> |
48 | #include <pcmcia/ds.h> | 47 | #include <pcmcia/ds.h> |
@@ -64,58 +63,21 @@ MODULE_SUPPORTED_DEVICE("Atmel at76c50x PCMCIA cards"); | |||
64 | 63 | ||
65 | /*====================================================================*/ | 64 | /*====================================================================*/ |
66 | 65 | ||
67 | /* | ||
68 | The event() function is this driver's Card Services event handler. | ||
69 | It will be called by Card Services when an appropriate card status | ||
70 | event is received. The config() and release() entry points are | ||
71 | used to configure or release a socket, in response to card | ||
72 | insertion and ejection events. They are invoked from the atmel_cs | ||
73 | event handler. | ||
74 | */ | ||
75 | |||
76 | static int atmel_config(struct pcmcia_device *link); | 66 | static int atmel_config(struct pcmcia_device *link); |
77 | static void atmel_release(struct pcmcia_device *link); | 67 | static void atmel_release(struct pcmcia_device *link); |
78 | 68 | ||
79 | /* | ||
80 | The attach() and detach() entry points are used to create and destroy | ||
81 | "instances" of the driver, where each instance represents everything | ||
82 | needed to manage one actual PCMCIA card. | ||
83 | */ | ||
84 | |||
85 | static void atmel_detach(struct pcmcia_device *p_dev); | 69 | static void atmel_detach(struct pcmcia_device *p_dev); |
86 | 70 | ||
87 | typedef struct local_info_t { | 71 | typedef struct local_info_t { |
88 | struct net_device *eth_dev; | 72 | struct net_device *eth_dev; |
89 | } local_info_t; | 73 | } local_info_t; |
90 | 74 | ||
91 | /*====================================================================== | ||
92 | |||
93 | atmel_attach() creates an "instance" of the driver, allocating | ||
94 | local data structures for one device. The device is registered | ||
95 | with Card Services. | ||
96 | |||
97 | The dev_link structure is initialized, but we don't actually | ||
98 | configure the card at this point -- we wait until we receive a | ||
99 | card insertion event. | ||
100 | |||
101 | ======================================================================*/ | ||
102 | |||
103 | static int atmel_probe(struct pcmcia_device *p_dev) | 75 | static int atmel_probe(struct pcmcia_device *p_dev) |
104 | { | 76 | { |
105 | local_info_t *local; | 77 | local_info_t *local; |
106 | 78 | ||
107 | dev_dbg(&p_dev->dev, "atmel_attach()\n"); | 79 | dev_dbg(&p_dev->dev, "atmel_attach()\n"); |
108 | 80 | ||
109 | /* | ||
110 | General socket configuration defaults can go here. In this | ||
111 | client, we assume very little, and rely on the CIS for almost | ||
112 | everything. In most clients, many details (i.e., number, sizes, | ||
113 | and attributes of IO windows) are fixed by the nature of the | ||
114 | device, and can be hard-wired here. | ||
115 | */ | ||
116 | p_dev->conf.Attributes = 0; | ||
117 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | ||
118 | |||
119 | /* Allocate space for private device-specific data */ | 81 | /* Allocate space for private device-specific data */ |
120 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); | 82 | local = kzalloc(sizeof(local_info_t), GFP_KERNEL); |
121 | if (!local) { | 83 | if (!local) { |
@@ -127,15 +89,6 @@ static int atmel_probe(struct pcmcia_device *p_dev) | |||
127 | return atmel_config(p_dev); | 89 | return atmel_config(p_dev); |
128 | } /* atmel_attach */ | 90 | } /* atmel_attach */ |
129 | 91 | ||
130 | /*====================================================================== | ||
131 | |||
132 | This deletes a driver "instance". The device is de-registered | ||
133 | with Card Services. If it has been released, all local data | ||
134 | structures are freed. Otherwise, the structures will be freed | ||
135 | when the device is released. | ||
136 | |||
137 | ======================================================================*/ | ||
138 | |||
139 | static void atmel_detach(struct pcmcia_device *link) | 92 | static void atmel_detach(struct pcmcia_device *link) |
140 | { | 93 | { |
141 | dev_dbg(&link->dev, "atmel_detach\n"); | 94 | dev_dbg(&link->dev, "atmel_detach\n"); |
@@ -145,14 +98,6 @@ static void atmel_detach(struct pcmcia_device *link) | |||
145 | kfree(link->priv); | 98 | kfree(link->priv); |
146 | } | 99 | } |
147 | 100 | ||
148 | /*====================================================================== | ||
149 | |||
150 | atmel_config() is scheduled to run after a CARD_INSERTION event | ||
151 | is received, to configure the PCMCIA socket, and to make the | ||
152 | device available to the system. | ||
153 | |||
154 | ======================================================================*/ | ||
155 | |||
156 | /* Call-back function to interrogate PCMCIA-specific information | 101 | /* Call-back function to interrogate PCMCIA-specific information |
157 | about the current existance of the card */ | 102 | about the current existance of the card */ |
158 | static int card_present(void *arg) | 103 | static int card_present(void *arg) |
@@ -165,47 +110,11 @@ static int card_present(void *arg) | |||
165 | return 0; | 110 | return 0; |
166 | } | 111 | } |
167 | 112 | ||
168 | static int atmel_config_check(struct pcmcia_device *p_dev, | 113 | static int atmel_config_check(struct pcmcia_device *p_dev, void *priv_data) |
169 | cistpl_cftable_entry_t *cfg, | ||
170 | cistpl_cftable_entry_t *dflt, | ||
171 | unsigned int vcc, | ||
172 | void *priv_data) | ||
173 | { | 114 | { |
174 | if (cfg->index == 0) | 115 | if (p_dev->config_index == 0) |
175 | return -ENODEV; | 116 | return -EINVAL; |
176 | |||
177 | /* Does this card need audio output? */ | ||
178 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
179 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; | ||
180 | p_dev->conf.Status = CCSR_AUDIO_ENA; | ||
181 | } | ||
182 | 117 | ||
183 | /* Use power settings for Vcc and Vpp if present */ | ||
184 | /* Note that the CIS values need to be rescaled */ | ||
185 | if (cfg->vpp1.present & (1<<CISTPL_POWER_VNOM)) | ||
186 | p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; | ||
187 | else if (dflt->vpp1.present & (1<<CISTPL_POWER_VNOM)) | ||
188 | p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; | ||
189 | |||
190 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
191 | |||
192 | /* IO window settings */ | ||
193 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; | ||
194 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
195 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
196 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
197 | p_dev->resource[0]->flags |= | ||
198 | pcmcia_io_cfg_data_width(io->flags); | ||
199 | p_dev->resource[0]->start = io->win[0].base; | ||
200 | p_dev->resource[0]->end = io->win[0].len; | ||
201 | if (io->nwin > 1) { | ||
202 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; | ||
203 | p_dev->resource[1]->start = io->win[1].base; | ||
204 | p_dev->resource[1]->end = io->win[1].len; | ||
205 | } | ||
206 | } | ||
207 | |||
208 | /* This reserves IO space but doesn't actually enable it */ | ||
209 | return pcmcia_request_io(p_dev); | 118 | return pcmcia_request_io(p_dev); |
210 | } | 119 | } |
211 | 120 | ||
@@ -220,18 +129,9 @@ static int atmel_config(struct pcmcia_device *link) | |||
220 | 129 | ||
221 | dev_dbg(&link->dev, "atmel_config\n"); | 130 | dev_dbg(&link->dev, "atmel_config\n"); |
222 | 131 | ||
223 | /* | 132 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | |
224 | In this loop, we scan the CIS for configuration table entries, | 133 | CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; |
225 | each of which describes a valid card configuration, including | 134 | |
226 | voltage, IO window, memory window, and interrupt settings. | ||
227 | |||
228 | We make no assumptions about the card to be configured: we use | ||
229 | just the information available in the CIS. In an ideal world, | ||
230 | this would work for any PCMCIA card, but it requires a complete | ||
231 | and accurate CIS. In practice, a driver usually "knows" most of | ||
232 | these things without consulting the CIS, and most client drivers | ||
233 | will only use the CIS to fill in implementation-defined details. | ||
234 | */ | ||
235 | if (pcmcia_loop_config(link, atmel_config_check, NULL)) | 135 | if (pcmcia_loop_config(link, atmel_config_check, NULL)) |
236 | goto failed; | 136 | goto failed; |
237 | 137 | ||
@@ -240,12 +140,7 @@ static int atmel_config(struct pcmcia_device *link) | |||
240 | goto failed; | 140 | goto failed; |
241 | } | 141 | } |
242 | 142 | ||
243 | /* | 143 | ret = pcmcia_enable_device(link); |
244 | This actually configures the PCMCIA socket -- setting up | ||
245 | the I/O windows and the interrupt mapping, and putting the | ||
246 | card and host interface into "Memory and IO" mode. | ||
247 | */ | ||
248 | ret = pcmcia_request_configuration(link, &link->conf); | ||
249 | if (ret) | 144 | if (ret) |
250 | goto failed; | 145 | goto failed; |
251 | 146 | ||
@@ -267,14 +162,6 @@ static int atmel_config(struct pcmcia_device *link) | |||
267 | return -ENODEV; | 162 | return -ENODEV; |
268 | } | 163 | } |
269 | 164 | ||
270 | /*====================================================================== | ||
271 | |||
272 | After a card is removed, atmel_release() will unregister the | ||
273 | device, and release the PCMCIA configuration. If the device is | ||
274 | still open, this will be postponed until it is closed. | ||
275 | |||
276 | ======================================================================*/ | ||
277 | |||
278 | static void atmel_release(struct pcmcia_device *link) | 165 | static void atmel_release(struct pcmcia_device *link) |
279 | { | 166 | { |
280 | struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; | 167 | struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; |
@@ -353,9 +240,7 @@ MODULE_DEVICE_TABLE(pcmcia, atmel_ids); | |||
353 | 240 | ||
354 | static struct pcmcia_driver atmel_driver = { | 241 | static struct pcmcia_driver atmel_driver = { |
355 | .owner = THIS_MODULE, | 242 | .owner = THIS_MODULE, |
356 | .drv = { | 243 | .name = "atmel_cs", |
357 | .name = "atmel_cs", | ||
358 | }, | ||
359 | .probe = atmel_probe, | 244 | .probe = atmel_probe, |
360 | .remove = atmel_detach, | 245 | .remove = atmel_detach, |
361 | .id_table = atmel_ids, | 246 | .id_table = atmel_ids, |
@@ -363,12 +248,12 @@ static struct pcmcia_driver atmel_driver = { | |||
363 | .resume = atmel_resume, | 248 | .resume = atmel_resume, |
364 | }; | 249 | }; |
365 | 250 | ||
366 | static int atmel_cs_init(void) | 251 | static int __init atmel_cs_init(void) |
367 | { | 252 | { |
368 | return pcmcia_register_driver(&atmel_driver); | 253 | return pcmcia_register_driver(&atmel_driver); |
369 | } | 254 | } |
370 | 255 | ||
371 | static void atmel_cs_cleanup(void) | 256 | static void __exit atmel_cs_cleanup(void) |
372 | { | 257 | { |
373 | pcmcia_unregister_driver(&atmel_driver); | 258 | pcmcia_unregister_driver(&atmel_driver); |
374 | } | 259 | } |
diff --git a/drivers/net/wireless/b43/debugfs.c b/drivers/net/wireless/b43/debugfs.c index 80b19a44a407..59f59fa40334 100644 --- a/drivers/net/wireless/b43/debugfs.c +++ b/drivers/net/wireless/b43/debugfs.c | |||
@@ -627,6 +627,7 @@ out_unlock: | |||
627 | .open = b43_debugfs_open, \ | 627 | .open = b43_debugfs_open, \ |
628 | .read = b43_debugfs_read, \ | 628 | .read = b43_debugfs_read, \ |
629 | .write = b43_debugfs_write, \ | 629 | .write = b43_debugfs_write, \ |
630 | .llseek = generic_file_llseek, \ | ||
630 | }, \ | 631 | }, \ |
631 | .file_struct_offset = offsetof(struct b43_dfsentry, \ | 632 | .file_struct_offset = offsetof(struct b43_dfsentry, \ |
632 | file_##name), \ | 633 | file_##name), \ |
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index dfbc41d431ff..7dcba5fafdc7 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.h> | ||
30 | #include <pcmcia/cistpl.h> | 29 | #include <pcmcia/cistpl.h> |
31 | #include <pcmcia/ciscode.h> | 30 | #include <pcmcia/ciscode.h> |
32 | #include <pcmcia/ds.h> | 31 | #include <pcmcia/ds.h> |
@@ -63,7 +62,6 @@ static int b43_pcmcia_resume(struct pcmcia_device *dev) | |||
63 | static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | 62 | static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) |
64 | { | 63 | { |
65 | struct ssb_bus *ssb; | 64 | struct ssb_bus *ssb; |
66 | win_req_t win; | ||
67 | int err = -ENOMEM; | 65 | int err = -ENOMEM; |
68 | int res = 0; | 66 | int res = 0; |
69 | 67 | ||
@@ -73,30 +71,28 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
73 | 71 | ||
74 | err = -ENODEV; | 72 | err = -ENODEV; |
75 | 73 | ||
76 | dev->conf.Attributes = CONF_ENABLE_IRQ; | 74 | dev->config_flags |= CONF_ENABLE_IRQ; |
77 | dev->conf.IntType = INT_MEMORY_AND_IO; | ||
78 | 75 | ||
79 | win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | | 76 | dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | |
80 | WIN_USE_WAIT; | 77 | WIN_USE_WAIT; |
81 | win.Base = 0; | 78 | dev->resource[2]->start = 0; |
82 | win.Size = SSB_CORE_SIZE; | 79 | dev->resource[2]->end = SSB_CORE_SIZE; |
83 | win.AccessSpeed = 250; | 80 | res = pcmcia_request_window(dev, dev->resource[2], 250); |
84 | res = pcmcia_request_window(dev, &win, &dev->win); | ||
85 | if (res != 0) | 81 | if (res != 0) |
86 | goto err_kfree_ssb; | 82 | goto err_kfree_ssb; |
87 | 83 | ||
88 | res = pcmcia_map_mem_page(dev, dev->win, 0); | 84 | res = pcmcia_map_mem_page(dev, dev->resource[2], 0); |
89 | if (res != 0) | 85 | if (res != 0) |
90 | goto err_disable; | 86 | goto err_disable; |
91 | 87 | ||
92 | if (!dev->irq) | 88 | if (!dev->irq) |
93 | goto err_disable; | 89 | goto err_disable; |
94 | 90 | ||
95 | res = pcmcia_request_configuration(dev, &dev->conf); | 91 | res = pcmcia_enable_device(dev); |
96 | if (res != 0) | 92 | if (res != 0) |
97 | goto err_disable; | 93 | goto err_disable; |
98 | 94 | ||
99 | err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); | 95 | err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start); |
100 | if (err) | 96 | if (err) |
101 | goto err_disable; | 97 | goto err_disable; |
102 | dev->priv = ssb; | 98 | dev->priv = ssb; |
@@ -125,9 +121,7 @@ static void __devexit b43_pcmcia_remove(struct pcmcia_device *dev) | |||
125 | 121 | ||
126 | static struct pcmcia_driver b43_pcmcia_driver = { | 122 | static struct pcmcia_driver b43_pcmcia_driver = { |
127 | .owner = THIS_MODULE, | 123 | .owner = THIS_MODULE, |
128 | .drv = { | 124 | .name = "b43-pcmcia", |
129 | .name = "b43-pcmcia", | ||
130 | }, | ||
131 | .id_table = b43_pcmcia_tbl, | 125 | .id_table = b43_pcmcia_tbl, |
132 | .probe = b43_pcmcia_probe, | 126 | .probe = b43_pcmcia_probe, |
133 | .remove = __devexit_p(b43_pcmcia_remove), | 127 | .remove = __devexit_p(b43_pcmcia_remove), |
diff --git a/drivers/net/wireless/b43legacy/debugfs.c b/drivers/net/wireless/b43legacy/debugfs.c index 1f85ac569fec..f232618f2cd1 100644 --- a/drivers/net/wireless/b43legacy/debugfs.c +++ b/drivers/net/wireless/b43legacy/debugfs.c | |||
@@ -334,6 +334,7 @@ out_unlock: | |||
334 | .open = b43legacy_debugfs_open, \ | 334 | .open = b43legacy_debugfs_open, \ |
335 | .read = b43legacy_debugfs_read, \ | 335 | .read = b43legacy_debugfs_read, \ |
336 | .write = b43legacy_debugfs_write, \ | 336 | .write = b43legacy_debugfs_write, \ |
337 | .llseek = generic_file_llseek, \ | ||
337 | }, \ | 338 | }, \ |
338 | .file_struct_offset = offsetof(struct b43legacy_dfsentry, \ | 339 | .file_struct_offset = offsetof(struct b43legacy_dfsentry, \ |
339 | file_##name), \ | 340 | file_##name), \ |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index ba54d1b04d22..bd8a4134edeb 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.h> | ||
16 | #include <pcmcia/cistpl.h> | 15 | #include <pcmcia/cistpl.h> |
17 | #include <pcmcia/cisreg.h> | 16 | #include <pcmcia/cisreg.h> |
18 | #include <pcmcia/ds.h> | 17 | #include <pcmcia/ds.h> |
@@ -437,7 +436,6 @@ static int hostap_cs_probe(struct pcmcia_device *p_dev) | |||
437 | int ret; | 436 | int ret; |
438 | 437 | ||
439 | PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); | 438 | PDEBUG(DEBUG_HW, "%s: setting Vcc=33 (constant)\n", dev_info); |
440 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | ||
441 | 439 | ||
442 | ret = prism2_config(p_dev); | 440 | ret = prism2_config(p_dev); |
443 | if (ret) { | 441 | if (ret) { |
@@ -468,74 +466,11 @@ static void prism2_detach(struct pcmcia_device *link) | |||
468 | } | 466 | } |
469 | 467 | ||
470 | 468 | ||
471 | /* run after a CARD_INSERTION event is received to configure the PCMCIA | 469 | static int prism2_config_check(struct pcmcia_device *p_dev, void *priv_data) |
472 | * socket and make the device available to the system */ | ||
473 | |||
474 | static int prism2_config_check(struct pcmcia_device *p_dev, | ||
475 | cistpl_cftable_entry_t *cfg, | ||
476 | cistpl_cftable_entry_t *dflt, | ||
477 | unsigned int vcc, | ||
478 | void *priv_data) | ||
479 | { | 470 | { |
480 | if (cfg->index == 0) | 471 | if (p_dev->config_index == 0) |
481 | return -ENODEV; | 472 | return -EINVAL; |
482 | |||
483 | PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " | ||
484 | "(default 0x%02X)\n", cfg->index, dflt->index); | ||
485 | |||
486 | /* Does this card need audio output? */ | ||
487 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
488 | p_dev->conf.Attributes |= CONF_ENABLE_SPKR; | ||
489 | p_dev->conf.Status = CCSR_AUDIO_ENA; | ||
490 | } | ||
491 | |||
492 | /* Use power settings for Vcc and Vpp if present */ | ||
493 | /* Note that the CIS values need to be rescaled */ | ||
494 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
495 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / | ||
496 | 10000 && !ignore_cis_vcc) { | ||
497 | PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping" | ||
498 | " this entry\n"); | ||
499 | return -ENODEV; | ||
500 | } | ||
501 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
502 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / | ||
503 | 10000 && !ignore_cis_vcc) { | ||
504 | PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " | ||
505 | "- skipping this entry\n"); | ||
506 | return -ENODEV; | ||
507 | } | ||
508 | } | ||
509 | 473 | ||
510 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
511 | p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
512 | else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
513 | p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
514 | |||
515 | /* Do we need to allocate an interrupt? */ | ||
516 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
517 | |||
518 | /* IO window settings */ | ||
519 | PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " | ||
520 | "dflt->io.nwin=%d\n", | ||
521 | cfg->io.nwin, dflt->io.nwin); | ||
522 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; | ||
523 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
524 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
525 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
526 | p_dev->resource[0]->flags |= | ||
527 | pcmcia_io_cfg_data_width(io->flags); | ||
528 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
529 | p_dev->resource[0]->start = io->win[0].base; | ||
530 | p_dev->resource[0]->end = io->win[0].len; | ||
531 | if (io->nwin > 1) { | ||
532 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; | ||
533 | p_dev->resource[1]->start = io->win[1].base; | ||
534 | p_dev->resource[1]->end = io->win[1].len; | ||
535 | } | ||
536 | } | ||
537 | |||
538 | /* This reserves IO space but doesn't actually enable it */ | ||
539 | return pcmcia_request_io(p_dev); | 474 | return pcmcia_request_io(p_dev); |
540 | } | 475 | } |
541 | 476 | ||
@@ -557,6 +492,10 @@ static int prism2_config(struct pcmcia_device *link) | |||
557 | } | 492 | } |
558 | 493 | ||
559 | /* Look for an appropriate configuration table entry in the CIS */ | 494 | /* Look for an appropriate configuration table entry in the CIS */ |
495 | link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_AUDIO | | ||
496 | CONF_AUTO_CHECK_VCC | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; | ||
497 | if (ignore_cis_vcc) | ||
498 | link->config_flags &= ~CONF_AUTO_CHECK_VCC; | ||
560 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); | 499 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); |
561 | if (ret) { | 500 | if (ret) { |
562 | if (!ignore_cis_vcc) | 501 | if (!ignore_cis_vcc) |
@@ -588,12 +527,7 @@ static int prism2_config(struct pcmcia_device *link) | |||
588 | if (ret) | 527 | if (ret) |
589 | goto failed_unlock; | 528 | goto failed_unlock; |
590 | 529 | ||
591 | /* | 530 | ret = pcmcia_enable_device(link); |
592 | * This actually configures the PCMCIA socket -- setting up | ||
593 | * the I/O windows and the interrupt mapping, and putting the | ||
594 | * card and host interface into "Memory and IO" mode. | ||
595 | */ | ||
596 | ret = pcmcia_request_configuration(link, &link->conf); | ||
597 | if (ret) | 531 | if (ret) |
598 | goto failed_unlock; | 532 | goto failed_unlock; |
599 | 533 | ||
@@ -602,20 +536,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
602 | 536 | ||
603 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | 537 | spin_unlock_irqrestore(&local->irq_init_lock, flags); |
604 | 538 | ||
605 | /* Finally, report what we've done */ | ||
606 | printk(KERN_INFO "%s: index 0x%02x: ", | ||
607 | dev_info, link->conf.ConfigIndex); | ||
608 | if (link->conf.Vpp) | ||
609 | printk(", Vpp %d.%d", link->conf.Vpp / 10, | ||
610 | link->conf.Vpp % 10); | ||
611 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | ||
612 | printk(", irq %d", link->irq); | ||
613 | if (link->resource[0]) | ||
614 | printk(" & %pR", link->resource[0]); | ||
615 | if (link->resource[1]) | ||
616 | printk(" & %pR", link->resource[1]); | ||
617 | printk("\n"); | ||
618 | |||
619 | local->shutdown = 0; | 539 | local->shutdown = 0; |
620 | 540 | ||
621 | sandisk_enable_wireless(dev); | 541 | sandisk_enable_wireless(dev); |
@@ -627,7 +547,7 @@ static int prism2_config(struct pcmcia_device *link) | |||
627 | return ret; | 547 | return ret; |
628 | 548 | ||
629 | failed_unlock: | 549 | failed_unlock: |
630 | spin_unlock_irqrestore(&local->irq_init_lock, flags); | 550 | spin_unlock_irqrestore(&local->irq_init_lock, flags); |
631 | failed: | 551 | failed: |
632 | kfree(hw_priv); | 552 | kfree(hw_priv); |
633 | prism2_release((u_long)link); | 553 | prism2_release((u_long)link); |
@@ -779,9 +699,7 @@ MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids); | |||
779 | 699 | ||
780 | 700 | ||
781 | static struct pcmcia_driver hostap_driver = { | 701 | static struct pcmcia_driver hostap_driver = { |
782 | .drv = { | 702 | .name = "hostap_cs", |
783 | .name = "hostap_cs", | ||
784 | }, | ||
785 | .probe = hostap_cs_probe, | 703 | .probe = hostap_cs_probe, |
786 | .remove = prism2_detach, | 704 | .remove = prism2_detach, |
787 | .owner = THIS_MODULE, | 705 | .owner = THIS_MODULE, |
diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c index 1189dbb6e2a6..996e9d7d7586 100644 --- a/drivers/net/wireless/ipw2x00/ipw2100.c +++ b/drivers/net/wireless/ipw2x00/ipw2100.c | |||
@@ -2723,14 +2723,6 @@ static void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
2723 | 2723 | ||
2724 | packet = &priv->rx_buffers[i]; | 2724 | packet = &priv->rx_buffers[i]; |
2725 | 2725 | ||
2726 | /* Sync the DMA for the STATUS buffer so CPU is sure to get | ||
2727 | * the correct values */ | ||
2728 | pci_dma_sync_single_for_cpu(priv->pci_dev, | ||
2729 | sq->nic + | ||
2730 | sizeof(struct ipw2100_status) * i, | ||
2731 | sizeof(struct ipw2100_status), | ||
2732 | PCI_DMA_FROMDEVICE); | ||
2733 | |||
2734 | /* Sync the DMA for the RX buffer so CPU is sure to get | 2726 | /* Sync the DMA for the RX buffer so CPU is sure to get |
2735 | * the correct values */ | 2727 | * the correct values */ |
2736 | pci_dma_sync_single_for_cpu(priv->pci_dev, packet->dma_addr, | 2728 | pci_dma_sync_single_for_cpu(priv->pci_dev, packet->dma_addr, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-1000.c b/drivers/net/wireless/iwlwifi/iwl-1000.c index fec026212326..0b779a41a142 100644 --- a/drivers/net/wireless/iwlwifi/iwl-1000.c +++ b/drivers/net/wireless/iwlwifi/iwl-1000.c | |||
@@ -265,7 +265,7 @@ struct iwl_cfg iwl1000_bgn_cfg = { | |||
265 | .support_ct_kill_exit = true, | 265 | .support_ct_kill_exit = true, |
266 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, | 266 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, |
267 | .chain_noise_scale = 1000, | 267 | .chain_noise_scale = 1000, |
268 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 268 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
269 | .max_event_log_size = 128, | 269 | .max_event_log_size = 128, |
270 | .ucode_tracing = true, | 270 | .ucode_tracing = true, |
271 | .sensitivity_calib_by_driver = true, | 271 | .sensitivity_calib_by_driver = true, |
@@ -297,7 +297,7 @@ struct iwl_cfg iwl1000_bg_cfg = { | |||
297 | .support_ct_kill_exit = true, | 297 | .support_ct_kill_exit = true, |
298 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, | 298 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_EXT_LONG_THRESHOLD_DEF, |
299 | .chain_noise_scale = 1000, | 299 | .chain_noise_scale = 1000, |
300 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 300 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
301 | .max_event_log_size = 128, | 301 | .max_event_log_size = 128, |
302 | .ucode_tracing = true, | 302 | .ucode_tracing = true, |
303 | .sensitivity_calib_by_driver = true, | 303 | .sensitivity_calib_by_driver = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index 8e84a08ff951..293e1dbc166c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -873,6 +873,7 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file, | |||
873 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | 873 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { |
874 | .read = iwl3945_sta_dbgfs_stats_table_read, | 874 | .read = iwl3945_sta_dbgfs_stats_table_read, |
875 | .open = iwl3945_open_file_generic, | 875 | .open = iwl3945_open_file_generic, |
876 | .llseek = default_llseek, | ||
876 | }; | 877 | }; |
877 | 878 | ||
878 | static void iwl3945_add_debugfs(void *priv, void *priv_sta, | 879 | static void iwl3945_add_debugfs(void *priv, void *priv_sta, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 6950a783913b..8ccfcd08218d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -2731,7 +2731,7 @@ static struct iwl_cfg iwl3945_bg_cfg = { | |||
2731 | .led_compensation = 64, | 2731 | .led_compensation = 64, |
2732 | .broken_powersave = true, | 2732 | .broken_powersave = true, |
2733 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | 2733 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
2734 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 2734 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
2735 | .max_event_log_size = 512, | 2735 | .max_event_log_size = 512, |
2736 | .tx_power_by_driver = true, | 2736 | .tx_power_by_driver = true, |
2737 | }; | 2737 | }; |
@@ -2752,7 +2752,7 @@ static struct iwl_cfg iwl3945_abg_cfg = { | |||
2752 | .led_compensation = 64, | 2752 | .led_compensation = 64, |
2753 | .broken_powersave = true, | 2753 | .broken_powersave = true, |
2754 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | 2754 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
2755 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 2755 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
2756 | .max_event_log_size = 512, | 2756 | .max_event_log_size = 512, |
2757 | .tx_power_by_driver = true, | 2757 | .tx_power_by_driver = true, |
2758 | }; | 2758 | }; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index d6da356608fa..d92b72909233 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -2322,7 +2322,7 @@ struct iwl_cfg iwl4965_agn_cfg = { | |||
2322 | .led_compensation = 61, | 2322 | .led_compensation = 61, |
2323 | .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, | 2323 | .chain_noise_num_beacons = IWL4965_CAL_NUM_BEACONS, |
2324 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 2324 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
2325 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 2325 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
2326 | .temperature_kelvin = true, | 2326 | .temperature_kelvin = true, |
2327 | .max_event_log_size = 512, | 2327 | .max_event_log_size = 512, |
2328 | .tx_power_by_driver = true, | 2328 | .tx_power_by_driver = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index aacf3770f075..48bdcd8d2e94 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -510,7 +510,7 @@ struct iwl_cfg iwl5300_agn_cfg = { | |||
510 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 510 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
511 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | 511 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
512 | .chain_noise_scale = 1000, | 512 | .chain_noise_scale = 1000, |
513 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 513 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
514 | .max_event_log_size = 512, | 514 | .max_event_log_size = 512, |
515 | .ucode_tracing = true, | 515 | .ucode_tracing = true, |
516 | .sensitivity_calib_by_driver = true, | 516 | .sensitivity_calib_by_driver = true, |
@@ -541,7 +541,7 @@ struct iwl_cfg iwl5100_bgn_cfg = { | |||
541 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 541 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
542 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | 542 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
543 | .chain_noise_scale = 1000, | 543 | .chain_noise_scale = 1000, |
544 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 544 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
545 | .max_event_log_size = 512, | 545 | .max_event_log_size = 512, |
546 | .ucode_tracing = true, | 546 | .ucode_tracing = true, |
547 | .sensitivity_calib_by_driver = true, | 547 | .sensitivity_calib_by_driver = true, |
@@ -570,7 +570,7 @@ struct iwl_cfg iwl5100_abg_cfg = { | |||
570 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 570 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
571 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | 571 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
572 | .chain_noise_scale = 1000, | 572 | .chain_noise_scale = 1000, |
573 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 573 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
574 | .max_event_log_size = 512, | 574 | .max_event_log_size = 512, |
575 | .ucode_tracing = true, | 575 | .ucode_tracing = true, |
576 | .sensitivity_calib_by_driver = true, | 576 | .sensitivity_calib_by_driver = true, |
@@ -601,7 +601,7 @@ struct iwl_cfg iwl5100_agn_cfg = { | |||
601 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 601 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
602 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | 602 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
603 | .chain_noise_scale = 1000, | 603 | .chain_noise_scale = 1000, |
604 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 604 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
605 | .max_event_log_size = 512, | 605 | .max_event_log_size = 512, |
606 | .ucode_tracing = true, | 606 | .ucode_tracing = true, |
607 | .sensitivity_calib_by_driver = true, | 607 | .sensitivity_calib_by_driver = true, |
@@ -632,7 +632,7 @@ struct iwl_cfg iwl5350_agn_cfg = { | |||
632 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 632 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
633 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | 633 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
634 | .chain_noise_scale = 1000, | 634 | .chain_noise_scale = 1000, |
635 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 635 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
636 | .max_event_log_size = 512, | 636 | .max_event_log_size = 512, |
637 | .ucode_tracing = true, | 637 | .ucode_tracing = true, |
638 | .sensitivity_calib_by_driver = true, | 638 | .sensitivity_calib_by_driver = true, |
@@ -663,7 +663,7 @@ struct iwl_cfg iwl5150_agn_cfg = { | |||
663 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 663 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
664 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | 664 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
665 | .chain_noise_scale = 1000, | 665 | .chain_noise_scale = 1000, |
666 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 666 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
667 | .max_event_log_size = 512, | 667 | .max_event_log_size = 512, |
668 | .ucode_tracing = true, | 668 | .ucode_tracing = true, |
669 | .sensitivity_calib_by_driver = true, | 669 | .sensitivity_calib_by_driver = true, |
@@ -693,7 +693,7 @@ struct iwl_cfg iwl5150_abg_cfg = { | |||
693 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, | 693 | .chain_noise_num_beacons = IWL_CAL_NUM_BEACONS, |
694 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, | 694 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_LONG_THRESHOLD_DEF, |
695 | .chain_noise_scale = 1000, | 695 | .chain_noise_scale = 1000, |
696 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 696 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
697 | .max_event_log_size = 512, | 697 | .max_event_log_size = 512, |
698 | .ucode_tracing = true, | 698 | .ucode_tracing = true, |
699 | .sensitivity_calib_by_driver = true, | 699 | .sensitivity_calib_by_driver = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c index af4fd50f3405..cee06b968de8 100644 --- a/drivers/net/wireless/iwlwifi/iwl-6000.c +++ b/drivers/net/wireless/iwlwifi/iwl-6000.c | |||
@@ -388,7 +388,7 @@ struct iwl_cfg iwl6000g2a_2agn_cfg = { | |||
388 | .support_ct_kill_exit = true, | 388 | .support_ct_kill_exit = true, |
389 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 389 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
390 | .chain_noise_scale = 1000, | 390 | .chain_noise_scale = 1000, |
391 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 391 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
392 | .max_event_log_size = 512, | 392 | .max_event_log_size = 512, |
393 | .ucode_tracing = true, | 393 | .ucode_tracing = true, |
394 | .sensitivity_calib_by_driver = true, | 394 | .sensitivity_calib_by_driver = true, |
@@ -424,7 +424,7 @@ struct iwl_cfg iwl6000g2a_2abg_cfg = { | |||
424 | .support_ct_kill_exit = true, | 424 | .support_ct_kill_exit = true, |
425 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 425 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
426 | .chain_noise_scale = 1000, | 426 | .chain_noise_scale = 1000, |
427 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 427 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
428 | .max_event_log_size = 512, | 428 | .max_event_log_size = 512, |
429 | .sensitivity_calib_by_driver = true, | 429 | .sensitivity_calib_by_driver = true, |
430 | .chain_noise_calib_by_driver = true, | 430 | .chain_noise_calib_by_driver = true, |
@@ -459,7 +459,7 @@ struct iwl_cfg iwl6000g2a_2bg_cfg = { | |||
459 | .support_ct_kill_exit = true, | 459 | .support_ct_kill_exit = true, |
460 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 460 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
461 | .chain_noise_scale = 1000, | 461 | .chain_noise_scale = 1000, |
462 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 462 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
463 | .max_event_log_size = 512, | 463 | .max_event_log_size = 512, |
464 | .sensitivity_calib_by_driver = true, | 464 | .sensitivity_calib_by_driver = true, |
465 | .chain_noise_calib_by_driver = true, | 465 | .chain_noise_calib_by_driver = true, |
@@ -496,7 +496,7 @@ struct iwl_cfg iwl6000g2b_2agn_cfg = { | |||
496 | .support_ct_kill_exit = true, | 496 | .support_ct_kill_exit = true, |
497 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 497 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
498 | .chain_noise_scale = 1000, | 498 | .chain_noise_scale = 1000, |
499 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 499 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
500 | .max_event_log_size = 512, | 500 | .max_event_log_size = 512, |
501 | .sensitivity_calib_by_driver = true, | 501 | .sensitivity_calib_by_driver = true, |
502 | .chain_noise_calib_by_driver = true, | 502 | .chain_noise_calib_by_driver = true, |
@@ -532,7 +532,7 @@ struct iwl_cfg iwl6000g2b_2abg_cfg = { | |||
532 | .support_ct_kill_exit = true, | 532 | .support_ct_kill_exit = true, |
533 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 533 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
534 | .chain_noise_scale = 1000, | 534 | .chain_noise_scale = 1000, |
535 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 535 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
536 | .max_event_log_size = 512, | 536 | .max_event_log_size = 512, |
537 | .sensitivity_calib_by_driver = true, | 537 | .sensitivity_calib_by_driver = true, |
538 | .chain_noise_calib_by_driver = true, | 538 | .chain_noise_calib_by_driver = true, |
@@ -570,7 +570,7 @@ struct iwl_cfg iwl6000g2b_2bgn_cfg = { | |||
570 | .support_ct_kill_exit = true, | 570 | .support_ct_kill_exit = true, |
571 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 571 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
572 | .chain_noise_scale = 1000, | 572 | .chain_noise_scale = 1000, |
573 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 573 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
574 | .max_event_log_size = 512, | 574 | .max_event_log_size = 512, |
575 | .sensitivity_calib_by_driver = true, | 575 | .sensitivity_calib_by_driver = true, |
576 | .chain_noise_calib_by_driver = true, | 576 | .chain_noise_calib_by_driver = true, |
@@ -606,7 +606,7 @@ struct iwl_cfg iwl6000g2b_2bg_cfg = { | |||
606 | .support_ct_kill_exit = true, | 606 | .support_ct_kill_exit = true, |
607 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 607 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
608 | .chain_noise_scale = 1000, | 608 | .chain_noise_scale = 1000, |
609 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 609 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
610 | .max_event_log_size = 512, | 610 | .max_event_log_size = 512, |
611 | .sensitivity_calib_by_driver = true, | 611 | .sensitivity_calib_by_driver = true, |
612 | .chain_noise_calib_by_driver = true, | 612 | .chain_noise_calib_by_driver = true, |
@@ -644,7 +644,7 @@ struct iwl_cfg iwl6000g2b_bgn_cfg = { | |||
644 | .support_ct_kill_exit = true, | 644 | .support_ct_kill_exit = true, |
645 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 645 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
646 | .chain_noise_scale = 1000, | 646 | .chain_noise_scale = 1000, |
647 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 647 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
648 | .max_event_log_size = 512, | 648 | .max_event_log_size = 512, |
649 | .sensitivity_calib_by_driver = true, | 649 | .sensitivity_calib_by_driver = true, |
650 | .chain_noise_calib_by_driver = true, | 650 | .chain_noise_calib_by_driver = true, |
@@ -680,7 +680,7 @@ struct iwl_cfg iwl6000g2b_bg_cfg = { | |||
680 | .support_ct_kill_exit = true, | 680 | .support_ct_kill_exit = true, |
681 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 681 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
682 | .chain_noise_scale = 1000, | 682 | .chain_noise_scale = 1000, |
683 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 683 | .monitor_recover_period = IWL_LONG_MONITORING_PERIOD, |
684 | .max_event_log_size = 512, | 684 | .max_event_log_size = 512, |
685 | .sensitivity_calib_by_driver = true, | 685 | .sensitivity_calib_by_driver = true, |
686 | .chain_noise_calib_by_driver = true, | 686 | .chain_noise_calib_by_driver = true, |
@@ -721,7 +721,7 @@ struct iwl_cfg iwl6000i_2agn_cfg = { | |||
721 | .support_ct_kill_exit = true, | 721 | .support_ct_kill_exit = true, |
722 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 722 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
723 | .chain_noise_scale = 1000, | 723 | .chain_noise_scale = 1000, |
724 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 724 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
725 | .max_event_log_size = 1024, | 725 | .max_event_log_size = 1024, |
726 | .ucode_tracing = true, | 726 | .ucode_tracing = true, |
727 | .sensitivity_calib_by_driver = true, | 727 | .sensitivity_calib_by_driver = true, |
@@ -756,7 +756,7 @@ struct iwl_cfg iwl6000i_2abg_cfg = { | |||
756 | .support_ct_kill_exit = true, | 756 | .support_ct_kill_exit = true, |
757 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 757 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
758 | .chain_noise_scale = 1000, | 758 | .chain_noise_scale = 1000, |
759 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 759 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
760 | .max_event_log_size = 1024, | 760 | .max_event_log_size = 1024, |
761 | .ucode_tracing = true, | 761 | .ucode_tracing = true, |
762 | .sensitivity_calib_by_driver = true, | 762 | .sensitivity_calib_by_driver = true, |
@@ -791,7 +791,7 @@ struct iwl_cfg iwl6000i_2bg_cfg = { | |||
791 | .support_ct_kill_exit = true, | 791 | .support_ct_kill_exit = true, |
792 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 792 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
793 | .chain_noise_scale = 1000, | 793 | .chain_noise_scale = 1000, |
794 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 794 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
795 | .max_event_log_size = 1024, | 795 | .max_event_log_size = 1024, |
796 | .ucode_tracing = true, | 796 | .ucode_tracing = true, |
797 | .sensitivity_calib_by_driver = true, | 797 | .sensitivity_calib_by_driver = true, |
@@ -828,7 +828,7 @@ struct iwl_cfg iwl6050_2agn_cfg = { | |||
828 | .support_ct_kill_exit = true, | 828 | .support_ct_kill_exit = true, |
829 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 829 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
830 | .chain_noise_scale = 1500, | 830 | .chain_noise_scale = 1500, |
831 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 831 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
832 | .max_event_log_size = 1024, | 832 | .max_event_log_size = 1024, |
833 | .ucode_tracing = true, | 833 | .ucode_tracing = true, |
834 | .sensitivity_calib_by_driver = true, | 834 | .sensitivity_calib_by_driver = true, |
@@ -866,7 +866,7 @@ struct iwl_cfg iwl6050g2_bgn_cfg = { | |||
866 | .support_ct_kill_exit = true, | 866 | .support_ct_kill_exit = true, |
867 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 867 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
868 | .chain_noise_scale = 1500, | 868 | .chain_noise_scale = 1500, |
869 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 869 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
870 | .max_event_log_size = 1024, | 870 | .max_event_log_size = 1024, |
871 | .ucode_tracing = true, | 871 | .ucode_tracing = true, |
872 | .sensitivity_calib_by_driver = true, | 872 | .sensitivity_calib_by_driver = true, |
@@ -902,7 +902,7 @@ struct iwl_cfg iwl6050_2abg_cfg = { | |||
902 | .support_ct_kill_exit = true, | 902 | .support_ct_kill_exit = true, |
903 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 903 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
904 | .chain_noise_scale = 1500, | 904 | .chain_noise_scale = 1500, |
905 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 905 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
906 | .max_event_log_size = 1024, | 906 | .max_event_log_size = 1024, |
907 | .ucode_tracing = true, | 907 | .ucode_tracing = true, |
908 | .sensitivity_calib_by_driver = true, | 908 | .sensitivity_calib_by_driver = true, |
@@ -940,7 +940,7 @@ struct iwl_cfg iwl6000_3agn_cfg = { | |||
940 | .support_ct_kill_exit = true, | 940 | .support_ct_kill_exit = true, |
941 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, | 941 | .plcp_delta_threshold = IWL_MAX_PLCP_ERR_THRESHOLD_DEF, |
942 | .chain_noise_scale = 1000, | 942 | .chain_noise_scale = 1000, |
943 | .monitor_recover_period = IWL_MONITORING_PERIOD, | 943 | .monitor_recover_period = IWL_DEF_MONITORING_PERIOD, |
944 | .max_event_log_size = 1024, | 944 | .max_event_log_size = 1024, |
945 | .ucode_tracing = true, | 945 | .ucode_tracing = true, |
946 | .sensitivity_calib_by_driver = true, | 946 | .sensitivity_calib_by_driver = true, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c index 9dd9e64c2b0b..8fd00a6e5120 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c | |||
@@ -1411,7 +1411,7 @@ void iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
1411 | clear_bit(STATUS_SCAN_HW, &priv->status); | 1411 | clear_bit(STATUS_SCAN_HW, &priv->status); |
1412 | clear_bit(STATUS_SCANNING, &priv->status); | 1412 | clear_bit(STATUS_SCANNING, &priv->status); |
1413 | /* inform mac80211 scan aborted */ | 1413 | /* inform mac80211 scan aborted */ |
1414 | queue_work(priv->workqueue, &priv->scan_completed); | 1414 | queue_work(priv->workqueue, &priv->abort_scan); |
1415 | } | 1415 | } |
1416 | 1416 | ||
1417 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, | 1417 | int iwlagn_manage_ibss_station(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 23e5c42e7d7e..a4378ba31ef6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -2873,6 +2873,7 @@ static const struct file_operations rs_sta_dbgfs_scale_table_ops = { | |||
2873 | .write = rs_sta_dbgfs_scale_table_write, | 2873 | .write = rs_sta_dbgfs_scale_table_write, |
2874 | .read = rs_sta_dbgfs_scale_table_read, | 2874 | .read = rs_sta_dbgfs_scale_table_read, |
2875 | .open = open_file_generic, | 2875 | .open = open_file_generic, |
2876 | .llseek = default_llseek, | ||
2876 | }; | 2877 | }; |
2877 | static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | 2878 | static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, |
2878 | char __user *user_buf, size_t count, loff_t *ppos) | 2879 | char __user *user_buf, size_t count, loff_t *ppos) |
@@ -2915,6 +2916,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | |||
2915 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { | 2916 | static const struct file_operations rs_sta_dbgfs_stats_table_ops = { |
2916 | .read = rs_sta_dbgfs_stats_table_read, | 2917 | .read = rs_sta_dbgfs_stats_table_read, |
2917 | .open = open_file_generic, | 2918 | .open = open_file_generic, |
2919 | .llseek = default_llseek, | ||
2918 | }; | 2920 | }; |
2919 | 2921 | ||
2920 | static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, | 2922 | static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, |
@@ -2946,6 +2948,7 @@ static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, | |||
2946 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { | 2948 | static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { |
2947 | .read = rs_sta_dbgfs_rate_scale_data_read, | 2949 | .read = rs_sta_dbgfs_rate_scale_data_read, |
2948 | .open = open_file_generic, | 2950 | .open = open_file_generic, |
2951 | .llseek = default_llseek, | ||
2949 | }; | 2952 | }; |
2950 | 2953 | ||
2951 | static void rs_add_debugfs(void *priv, void *priv_sta, | 2954 | static void rs_add_debugfs(void *priv, void *priv_sta, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index c1882fd8345d..10d7b9b7f064 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -3667,6 +3667,49 @@ out_exit: | |||
3667 | IWL_DEBUG_MAC80211(priv, "leave\n"); | 3667 | IWL_DEBUG_MAC80211(priv, "leave\n"); |
3668 | } | 3668 | } |
3669 | 3669 | ||
3670 | static void iwlagn_configure_filter(struct ieee80211_hw *hw, | ||
3671 | unsigned int changed_flags, | ||
3672 | unsigned int *total_flags, | ||
3673 | u64 multicast) | ||
3674 | { | ||
3675 | struct iwl_priv *priv = hw->priv; | ||
3676 | __le32 filter_or = 0, filter_nand = 0; | ||
3677 | |||
3678 | #define CHK(test, flag) do { \ | ||
3679 | if (*total_flags & (test)) \ | ||
3680 | filter_or |= (flag); \ | ||
3681 | else \ | ||
3682 | filter_nand |= (flag); \ | ||
3683 | } while (0) | ||
3684 | |||
3685 | IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", | ||
3686 | changed_flags, *total_flags); | ||
3687 | |||
3688 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); | ||
3689 | CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); | ||
3690 | CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); | ||
3691 | |||
3692 | #undef CHK | ||
3693 | |||
3694 | mutex_lock(&priv->mutex); | ||
3695 | |||
3696 | priv->staging_rxon.filter_flags &= ~filter_nand; | ||
3697 | priv->staging_rxon.filter_flags |= filter_or; | ||
3698 | |||
3699 | iwlcore_commit_rxon(priv); | ||
3700 | |||
3701 | mutex_unlock(&priv->mutex); | ||
3702 | |||
3703 | /* | ||
3704 | * Receiving all multicast frames is always enabled by the | ||
3705 | * default flags setup in iwl_connection_init_rx_config() | ||
3706 | * since we currently do not support programming multicast | ||
3707 | * filters into the device. | ||
3708 | */ | ||
3709 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | | ||
3710 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | ||
3711 | } | ||
3712 | |||
3670 | static void iwl_mac_flush(struct ieee80211_hw *hw, bool drop) | 3713 | static void iwl_mac_flush(struct ieee80211_hw *hw, bool drop) |
3671 | { | 3714 | { |
3672 | struct iwl_priv *priv = hw->priv; | 3715 | struct iwl_priv *priv = hw->priv; |
@@ -3867,7 +3910,7 @@ static struct ieee80211_ops iwl_hw_ops = { | |||
3867 | .add_interface = iwl_mac_add_interface, | 3910 | .add_interface = iwl_mac_add_interface, |
3868 | .remove_interface = iwl_mac_remove_interface, | 3911 | .remove_interface = iwl_mac_remove_interface, |
3869 | .config = iwl_mac_config, | 3912 | .config = iwl_mac_config, |
3870 | .configure_filter = iwl_configure_filter, | 3913 | .configure_filter = iwlagn_configure_filter, |
3871 | .set_key = iwl_mac_set_key, | 3914 | .set_key = iwl_mac_set_key, |
3872 | .update_tkip_key = iwl_mac_update_tkip_key, | 3915 | .update_tkip_key = iwl_mac_update_tkip_key, |
3873 | .conf_tx = iwl_mac_conf_tx, | 3916 | .conf_tx = iwl_mac_conf_tx, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 2c03c6e20a72..e23c4060a0f0 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -1328,51 +1328,6 @@ out: | |||
1328 | EXPORT_SYMBOL(iwl_apm_init); | 1328 | EXPORT_SYMBOL(iwl_apm_init); |
1329 | 1329 | ||
1330 | 1330 | ||
1331 | |||
1332 | void iwl_configure_filter(struct ieee80211_hw *hw, | ||
1333 | unsigned int changed_flags, | ||
1334 | unsigned int *total_flags, | ||
1335 | u64 multicast) | ||
1336 | { | ||
1337 | struct iwl_priv *priv = hw->priv; | ||
1338 | __le32 filter_or = 0, filter_nand = 0; | ||
1339 | |||
1340 | #define CHK(test, flag) do { \ | ||
1341 | if (*total_flags & (test)) \ | ||
1342 | filter_or |= (flag); \ | ||
1343 | else \ | ||
1344 | filter_nand |= (flag); \ | ||
1345 | } while (0) | ||
1346 | |||
1347 | IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", | ||
1348 | changed_flags, *total_flags); | ||
1349 | |||
1350 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); | ||
1351 | CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); | ||
1352 | CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); | ||
1353 | |||
1354 | #undef CHK | ||
1355 | |||
1356 | mutex_lock(&priv->mutex); | ||
1357 | |||
1358 | priv->staging_rxon.filter_flags &= ~filter_nand; | ||
1359 | priv->staging_rxon.filter_flags |= filter_or; | ||
1360 | |||
1361 | iwlcore_commit_rxon(priv); | ||
1362 | |||
1363 | mutex_unlock(&priv->mutex); | ||
1364 | |||
1365 | /* | ||
1366 | * Receiving all multicast frames is always enabled by the | ||
1367 | * default flags setup in iwl_connection_init_rx_config() | ||
1368 | * since we currently do not support programming multicast | ||
1369 | * filters into the device. | ||
1370 | */ | ||
1371 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | | ||
1372 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | ||
1373 | } | ||
1374 | EXPORT_SYMBOL(iwl_configure_filter); | ||
1375 | |||
1376 | int iwl_set_hw_params(struct iwl_priv *priv) | 1331 | int iwl_set_hw_params(struct iwl_priv *priv) |
1377 | { | 1332 | { |
1378 | priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; | 1333 | priv->hw_params.max_rxq_size = RX_QUEUE_SIZE; |
@@ -2658,6 +2613,11 @@ int iwl_force_reset(struct iwl_priv *priv, int mode, bool external) | |||
2658 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | 2613 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) |
2659 | return -EINVAL; | 2614 | return -EINVAL; |
2660 | 2615 | ||
2616 | if (test_bit(STATUS_SCANNING, &priv->status)) { | ||
2617 | IWL_DEBUG_INFO(priv, "scan in progress.\n"); | ||
2618 | return -EINVAL; | ||
2619 | } | ||
2620 | |||
2661 | if (mode >= IWL_MAX_FORCE_RESET) { | 2621 | if (mode >= IWL_MAX_FORCE_RESET) { |
2662 | IWL_DEBUG_INFO(priv, "invalid reset request.\n"); | 2622 | IWL_DEBUG_INFO(priv, "invalid reset request.\n"); |
2663 | return -EINVAL; | 2623 | return -EINVAL; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h index 4a71dfb10a15..5e6ee3da6bbf 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.h +++ b/drivers/net/wireless/iwlwifi/iwl-core.h | |||
@@ -372,9 +372,6 @@ int iwl_set_decrypted_flag(struct iwl_priv *priv, | |||
372 | u32 decrypt_res, | 372 | u32 decrypt_res, |
373 | struct ieee80211_rx_status *stats); | 373 | struct ieee80211_rx_status *stats); |
374 | void iwl_irq_handle_error(struct iwl_priv *priv); | 374 | void iwl_irq_handle_error(struct iwl_priv *priv); |
375 | void iwl_configure_filter(struct ieee80211_hw *hw, | ||
376 | unsigned int changed_flags, | ||
377 | unsigned int *total_flags, u64 multicast); | ||
378 | int iwl_set_hw_params(struct iwl_priv *priv); | 375 | int iwl_set_hw_params(struct iwl_priv *priv); |
379 | void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif); | 376 | void iwl_post_associate(struct iwl_priv *priv, struct ieee80211_vif *vif); |
380 | void iwl_bss_info_changed(struct ieee80211_hw *hw, | 377 | void iwl_bss_info_changed(struct ieee80211_hw *hw, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c index e96a1bb12783..a32d5d337649 100644 --- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c +++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c | |||
@@ -87,6 +87,7 @@ static int iwl_dbgfs_open_file_generic(struct inode *inode, struct file *file) | |||
87 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 87 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
88 | .read = iwl_dbgfs_##name##_read, \ | 88 | .read = iwl_dbgfs_##name##_read, \ |
89 | .open = iwl_dbgfs_open_file_generic, \ | 89 | .open = iwl_dbgfs_open_file_generic, \ |
90 | .llseek = generic_file_llseek, \ | ||
90 | }; | 91 | }; |
91 | 92 | ||
92 | #define DEBUGFS_WRITE_FILE_OPS(name) \ | 93 | #define DEBUGFS_WRITE_FILE_OPS(name) \ |
@@ -94,6 +95,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
94 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ | 95 | static const struct file_operations iwl_dbgfs_##name##_ops = { \ |
95 | .write = iwl_dbgfs_##name##_write, \ | 96 | .write = iwl_dbgfs_##name##_write, \ |
96 | .open = iwl_dbgfs_open_file_generic, \ | 97 | .open = iwl_dbgfs_open_file_generic, \ |
98 | .llseek = generic_file_llseek, \ | ||
97 | }; | 99 | }; |
98 | 100 | ||
99 | 101 | ||
@@ -104,6 +106,7 @@ static const struct file_operations iwl_dbgfs_##name##_ops = { \ | |||
104 | .write = iwl_dbgfs_##name##_write, \ | 106 | .write = iwl_dbgfs_##name##_write, \ |
105 | .read = iwl_dbgfs_##name##_read, \ | 107 | .read = iwl_dbgfs_##name##_read, \ |
106 | .open = iwl_dbgfs_open_file_generic, \ | 108 | .open = iwl_dbgfs_open_file_generic, \ |
109 | .llseek = generic_file_llseek, \ | ||
107 | }; | 110 | }; |
108 | 111 | ||
109 | static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, | 112 | static ssize_t iwl_dbgfs_tx_statistics_read(struct file *file, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index f35bcad56e36..2e97cd2fa98a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -1049,7 +1049,8 @@ struct iwl_event_log { | |||
1049 | #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) | 1049 | #define IWL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5) |
1050 | 1050 | ||
1051 | /* timer constants use to monitor and recover stuck tx queues in mSecs */ | 1051 | /* timer constants use to monitor and recover stuck tx queues in mSecs */ |
1052 | #define IWL_MONITORING_PERIOD (1000) | 1052 | #define IWL_DEF_MONITORING_PERIOD (1000) |
1053 | #define IWL_LONG_MONITORING_PERIOD (5000) | ||
1053 | #define IWL_ONE_HUNDRED_MSECS (100) | 1054 | #define IWL_ONE_HUNDRED_MSECS (100) |
1054 | #define IWL_SIXTY_SECS (60000) | 1055 | #define IWL_SIXTY_SECS (60000) |
1055 | 1056 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 70c4b8fba0ee..d31661c1ce77 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -3018,7 +3018,7 @@ void iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif) | |||
3018 | clear_bit(STATUS_SCANNING, &priv->status); | 3018 | clear_bit(STATUS_SCANNING, &priv->status); |
3019 | 3019 | ||
3020 | /* inform mac80211 scan aborted */ | 3020 | /* inform mac80211 scan aborted */ |
3021 | queue_work(priv->workqueue, &priv->scan_completed); | 3021 | queue_work(priv->workqueue, &priv->abort_scan); |
3022 | } | 3022 | } |
3023 | 3023 | ||
3024 | static void iwl3945_bg_restart(struct work_struct *data) | 3024 | static void iwl3945_bg_restart(struct work_struct *data) |
@@ -3391,6 +3391,55 @@ static int iwl3945_mac_sta_add(struct ieee80211_hw *hw, | |||
3391 | 3391 | ||
3392 | return 0; | 3392 | return 0; |
3393 | } | 3393 | } |
3394 | |||
3395 | static void iwl3945_configure_filter(struct ieee80211_hw *hw, | ||
3396 | unsigned int changed_flags, | ||
3397 | unsigned int *total_flags, | ||
3398 | u64 multicast) | ||
3399 | { | ||
3400 | struct iwl_priv *priv = hw->priv; | ||
3401 | __le32 filter_or = 0, filter_nand = 0; | ||
3402 | |||
3403 | #define CHK(test, flag) do { \ | ||
3404 | if (*total_flags & (test)) \ | ||
3405 | filter_or |= (flag); \ | ||
3406 | else \ | ||
3407 | filter_nand |= (flag); \ | ||
3408 | } while (0) | ||
3409 | |||
3410 | IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n", | ||
3411 | changed_flags, *total_flags); | ||
3412 | |||
3413 | CHK(FIF_OTHER_BSS | FIF_PROMISC_IN_BSS, RXON_FILTER_PROMISC_MSK); | ||
3414 | CHK(FIF_CONTROL, RXON_FILTER_CTL2HOST_MSK); | ||
3415 | CHK(FIF_BCN_PRBRESP_PROMISC, RXON_FILTER_BCON_AWARE_MSK); | ||
3416 | |||
3417 | #undef CHK | ||
3418 | |||
3419 | mutex_lock(&priv->mutex); | ||
3420 | |||
3421 | priv->staging_rxon.filter_flags &= ~filter_nand; | ||
3422 | priv->staging_rxon.filter_flags |= filter_or; | ||
3423 | |||
3424 | /* | ||
3425 | * Committing directly here breaks for some reason, | ||
3426 | * but we'll eventually commit the filter flags | ||
3427 | * change anyway. | ||
3428 | */ | ||
3429 | |||
3430 | mutex_unlock(&priv->mutex); | ||
3431 | |||
3432 | /* | ||
3433 | * Receiving all multicast frames is always enabled by the | ||
3434 | * default flags setup in iwl_connection_init_rx_config() | ||
3435 | * since we currently do not support programming multicast | ||
3436 | * filters into the device. | ||
3437 | */ | ||
3438 | *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS | | ||
3439 | FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL; | ||
3440 | } | ||
3441 | |||
3442 | |||
3394 | /***************************************************************************** | 3443 | /***************************************************************************** |
3395 | * | 3444 | * |
3396 | * sysfs attributes | 3445 | * sysfs attributes |
@@ -3796,7 +3845,7 @@ static struct ieee80211_ops iwl3945_hw_ops = { | |||
3796 | .add_interface = iwl_mac_add_interface, | 3845 | .add_interface = iwl_mac_add_interface, |
3797 | .remove_interface = iwl_mac_remove_interface, | 3846 | .remove_interface = iwl_mac_remove_interface, |
3798 | .config = iwl_mac_config, | 3847 | .config = iwl_mac_config, |
3799 | .configure_filter = iwl_configure_filter, | 3848 | .configure_filter = iwl3945_configure_filter, |
3800 | .set_key = iwl3945_mac_set_key, | 3849 | .set_key = iwl3945_mac_set_key, |
3801 | .conf_tx = iwl_mac_conf_tx, | 3850 | .conf_tx = iwl_mac_conf_tx, |
3802 | .reset_tsf = iwl_mac_reset_tsf, | 3851 | .reset_tsf = iwl_mac_reset_tsf, |
diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c index 53b0b7711f02..0a0cc9667cd6 100644 --- a/drivers/net/wireless/iwmc3200wifi/debugfs.c +++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c | |||
@@ -402,24 +402,28 @@ static const struct file_operations iwm_debugfs_txq_fops = { | |||
402 | .owner = THIS_MODULE, | 402 | .owner = THIS_MODULE, |
403 | .open = iwm_generic_open, | 403 | .open = iwm_generic_open, |
404 | .read = iwm_debugfs_txq_read, | 404 | .read = iwm_debugfs_txq_read, |
405 | .llseek = default_llseek, | ||
405 | }; | 406 | }; |
406 | 407 | ||
407 | static const struct file_operations iwm_debugfs_tx_credit_fops = { | 408 | static const struct file_operations iwm_debugfs_tx_credit_fops = { |
408 | .owner = THIS_MODULE, | 409 | .owner = THIS_MODULE, |
409 | .open = iwm_generic_open, | 410 | .open = iwm_generic_open, |
410 | .read = iwm_debugfs_tx_credit_read, | 411 | .read = iwm_debugfs_tx_credit_read, |
412 | .llseek = default_llseek, | ||
411 | }; | 413 | }; |
412 | 414 | ||
413 | static const struct file_operations iwm_debugfs_rx_ticket_fops = { | 415 | static const struct file_operations iwm_debugfs_rx_ticket_fops = { |
414 | .owner = THIS_MODULE, | 416 | .owner = THIS_MODULE, |
415 | .open = iwm_generic_open, | 417 | .open = iwm_generic_open, |
416 | .read = iwm_debugfs_rx_ticket_read, | 418 | .read = iwm_debugfs_rx_ticket_read, |
419 | .llseek = default_llseek, | ||
417 | }; | 420 | }; |
418 | 421 | ||
419 | static const struct file_operations iwm_debugfs_fw_err_fops = { | 422 | static const struct file_operations iwm_debugfs_fw_err_fops = { |
420 | .owner = THIS_MODULE, | 423 | .owner = THIS_MODULE, |
421 | .open = iwm_generic_open, | 424 | .open = iwm_generic_open, |
422 | .read = iwm_debugfs_fw_err_read, | 425 | .read = iwm_debugfs_fw_err_read, |
426 | .llseek = default_llseek, | ||
423 | }; | 427 | }; |
424 | 428 | ||
425 | void iwm_debugfs_init(struct iwm_priv *iwm) | 429 | void iwm_debugfs_init(struct iwm_priv *iwm) |
diff --git a/drivers/net/wireless/iwmc3200wifi/sdio.c b/drivers/net/wireless/iwmc3200wifi/sdio.c index edcb52330cf5..56383e7be835 100644 --- a/drivers/net/wireless/iwmc3200wifi/sdio.c +++ b/drivers/net/wireless/iwmc3200wifi/sdio.c | |||
@@ -364,6 +364,7 @@ static const struct file_operations iwm_debugfs_sdio_fops = { | |||
364 | .owner = THIS_MODULE, | 364 | .owner = THIS_MODULE, |
365 | .open = iwm_debugfs_sdio_open, | 365 | .open = iwm_debugfs_sdio_open, |
366 | .read = iwm_debugfs_sdio_read, | 366 | .read = iwm_debugfs_sdio_read, |
367 | .llseek = default_llseek, | ||
367 | }; | 368 | }; |
368 | 369 | ||
369 | static void if_sdio_debugfs_init(struct iwm_priv *iwm, struct dentry *parent_dir) | 370 | static void if_sdio_debugfs_init(struct iwm_priv *iwm, struct dentry *parent_dir) |
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index 651a79c8de8a..fbf3b0332bb7 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c | |||
@@ -696,6 +696,7 @@ out_unlock: | |||
696 | .open = open_file_generic, \ | 696 | .open = open_file_generic, \ |
697 | .read = (fread), \ | 697 | .read = (fread), \ |
698 | .write = (fwrite), \ | 698 | .write = (fwrite), \ |
699 | .llseek = generic_file_llseek, \ | ||
699 | } | 700 | } |
700 | 701 | ||
701 | struct lbs_debugfs_files { | 702 | struct lbs_debugfs_files { |
@@ -961,6 +962,7 @@ static const struct file_operations lbs_debug_fops = { | |||
961 | .open = open_file_generic, | 962 | .open = open_file_generic, |
962 | .write = lbs_debugfs_write, | 963 | .write = lbs_debugfs_write, |
963 | .read = lbs_debugfs_read, | 964 | .read = lbs_debugfs_read, |
965 | .llseek = default_llseek, | ||
964 | }; | 966 | }; |
965 | 967 | ||
966 | /** | 968 | /** |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 9c298396be50..ff1280f41336 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.h> | ||
32 | #include <pcmcia/cistpl.h> | 31 | #include <pcmcia/cistpl.h> |
33 | #include <pcmcia/ds.h> | 32 | #include <pcmcia/ds.h> |
34 | 33 | ||
@@ -761,15 +760,6 @@ static int if_cs_host_to_card(struct lbs_private *priv, | |||
761 | } | 760 | } |
762 | 761 | ||
763 | 762 | ||
764 | /********************************************************************/ | ||
765 | /* Card Services */ | ||
766 | /********************************************************************/ | ||
767 | |||
768 | /* | ||
769 | * After a card is removed, if_cs_release() will unregister the | ||
770 | * device, and release the PCMCIA configuration. If the device is | ||
771 | * still open, this will be postponed until it is closed. | ||
772 | */ | ||
773 | static void if_cs_release(struct pcmcia_device *p_dev) | 763 | static void if_cs_release(struct pcmcia_device *p_dev) |
774 | { | 764 | { |
775 | struct if_cs_card *card = p_dev->priv; | 765 | struct if_cs_card *card = p_dev->priv; |
@@ -785,31 +775,12 @@ static void if_cs_release(struct pcmcia_device *p_dev) | |||
785 | } | 775 | } |
786 | 776 | ||
787 | 777 | ||
788 | /* | 778 | static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data) |
789 | * This creates an "instance" of the driver, allocating local data | ||
790 | * structures for one device. The device is registered with Card | ||
791 | * Services. | ||
792 | * | ||
793 | * The dev_link structure is initialized, but we don't actually | ||
794 | * configure the card at this point -- we wait until we receive a card | ||
795 | * insertion event. | ||
796 | */ | ||
797 | |||
798 | static int if_cs_ioprobe(struct pcmcia_device *p_dev, | ||
799 | cistpl_cftable_entry_t *cfg, | ||
800 | cistpl_cftable_entry_t *dflt, | ||
801 | unsigned int vcc, | ||
802 | void *priv_data) | ||
803 | { | 779 | { |
780 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
804 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; | 781 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; |
805 | p_dev->resource[0]->start = cfg->io.win[0].base; | ||
806 | p_dev->resource[0]->end = cfg->io.win[0].len; | ||
807 | |||
808 | /* Do we need to allocate an interrupt? */ | ||
809 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
810 | 782 | ||
811 | /* IO window settings */ | 783 | if (p_dev->resource[1]->end) { |
812 | if (cfg->io.nwin != 1) { | ||
813 | lbs_pr_err("wrong CIS (check number of IO windows)\n"); | 784 | lbs_pr_err("wrong CIS (check number of IO windows)\n"); |
814 | return -ENODEV; | 785 | return -ENODEV; |
815 | } | 786 | } |
@@ -835,15 +806,13 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
835 | card->p_dev = p_dev; | 806 | card->p_dev = p_dev; |
836 | p_dev->priv = card; | 807 | p_dev->priv = card; |
837 | 808 | ||
838 | p_dev->conf.Attributes = 0; | 809 | p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; |
839 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | ||
840 | 810 | ||
841 | if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { | 811 | if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { |
842 | lbs_pr_err("error in pcmcia_loop_config\n"); | 812 | lbs_pr_err("error in pcmcia_loop_config\n"); |
843 | goto out1; | 813 | goto out1; |
844 | } | 814 | } |
845 | 815 | ||
846 | |||
847 | /* | 816 | /* |
848 | * Allocate an interrupt line. Note that this does not assign | 817 | * Allocate an interrupt line. Note that this does not assign |
849 | * a handler to the interrupt, unless the 'Handler' member of | 818 | * a handler to the interrupt, unless the 'Handler' member of |
@@ -861,14 +830,9 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
861 | goto out1; | 830 | goto out1; |
862 | } | 831 | } |
863 | 832 | ||
864 | /* | 833 | ret = pcmcia_enable_device(p_dev); |
865 | * This actually configures the PCMCIA socket -- setting up | ||
866 | * the I/O windows and the interrupt mapping, and putting the | ||
867 | * card and host interface into "Memory and IO" mode. | ||
868 | */ | ||
869 | ret = pcmcia_request_configuration(p_dev, &p_dev->conf); | ||
870 | if (ret) { | 834 | if (ret) { |
871 | lbs_pr_err("error in pcmcia_request_configuration\n"); | 835 | lbs_pr_err("error in pcmcia_enable_device\n"); |
872 | goto out2; | 836 | goto out2; |
873 | } | 837 | } |
874 | 838 | ||
@@ -962,12 +926,6 @@ out: | |||
962 | } | 926 | } |
963 | 927 | ||
964 | 928 | ||
965 | /* | ||
966 | * This deletes a driver "instance". The device is de-registered with | ||
967 | * Card Services. If it has been released, all local data structures | ||
968 | * are freed. Otherwise, the structures will be freed when the device | ||
969 | * is released. | ||
970 | */ | ||
971 | static void if_cs_detach(struct pcmcia_device *p_dev) | 929 | static void if_cs_detach(struct pcmcia_device *p_dev) |
972 | { | 930 | { |
973 | struct if_cs_card *card = p_dev->priv; | 931 | struct if_cs_card *card = p_dev->priv; |
@@ -1000,9 +958,7 @@ MODULE_DEVICE_TABLE(pcmcia, if_cs_ids); | |||
1000 | 958 | ||
1001 | static struct pcmcia_driver lbs_driver = { | 959 | static struct pcmcia_driver lbs_driver = { |
1002 | .owner = THIS_MODULE, | 960 | .owner = THIS_MODULE, |
1003 | .drv = { | 961 | .name = DRV_NAME, |
1004 | .name = DRV_NAME, | ||
1005 | }, | ||
1006 | .probe = if_cs_probe, | 962 | .probe = if_cs_probe, |
1007 | .remove = if_cs_detach, | 963 | .remove = if_cs_detach, |
1008 | .id_table = if_cs_ids, | 964 | .id_table = if_cs_ids, |
diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index ba854c70ab94..87b634978b35 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c | |||
@@ -128,7 +128,7 @@ struct if_sdio_card { | |||
128 | bool helper_allocated; | 128 | bool helper_allocated; |
129 | bool firmware_allocated; | 129 | bool firmware_allocated; |
130 | 130 | ||
131 | u8 buffer[65536]; | 131 | u8 buffer[65536] __attribute__((aligned(4))); |
132 | 132 | ||
133 | spinlock_t lock; | 133 | spinlock_t lock; |
134 | struct if_sdio_packet *packets; | 134 | struct if_sdio_packet *packets; |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 01ad7f77383a..86fa8abdd66f 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -486,7 +486,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | |||
486 | struct ieee80211_rx_status rx_status; | 486 | struct ieee80211_rx_status rx_status; |
487 | 487 | ||
488 | if (data->idle) { | 488 | if (data->idle) { |
489 | wiphy_debug(hw->wiphy, "trying to tx when idle - reject\n"); | 489 | wiphy_debug(hw->wiphy, "Trying to TX when idle - reject\n"); |
490 | return false; | 490 | return false; |
491 | } | 491 | } |
492 | 492 | ||
diff --git a/drivers/net/wireless/mwl8k.c b/drivers/net/wireless/mwl8k.c index d761ed2d8af4..f152a25be59f 100644 --- a/drivers/net/wireless/mwl8k.c +++ b/drivers/net/wireless/mwl8k.c | |||
@@ -910,14 +910,14 @@ static int mwl8k_rxq_init(struct ieee80211_hw *hw, int index) | |||
910 | 910 | ||
911 | rxq->rxd = pci_alloc_consistent(priv->pdev, size, &rxq->rxd_dma); | 911 | rxq->rxd = pci_alloc_consistent(priv->pdev, size, &rxq->rxd_dma); |
912 | if (rxq->rxd == NULL) { | 912 | if (rxq->rxd == NULL) { |
913 | wiphy_err(hw->wiphy, "failed to alloc rx descriptors\n"); | 913 | wiphy_err(hw->wiphy, "failed to alloc RX descriptors\n"); |
914 | return -ENOMEM; | 914 | return -ENOMEM; |
915 | } | 915 | } |
916 | memset(rxq->rxd, 0, size); | 916 | memset(rxq->rxd, 0, size); |
917 | 917 | ||
918 | rxq->buf = kmalloc(MWL8K_RX_DESCS * sizeof(*rxq->buf), GFP_KERNEL); | 918 | rxq->buf = kmalloc(MWL8K_RX_DESCS * sizeof(*rxq->buf), GFP_KERNEL); |
919 | if (rxq->buf == NULL) { | 919 | if (rxq->buf == NULL) { |
920 | wiphy_err(hw->wiphy, "failed to alloc rx skbuff list\n"); | 920 | wiphy_err(hw->wiphy, "failed to alloc RX skbuff list\n"); |
921 | pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma); | 921 | pci_free_consistent(priv->pdev, size, rxq->rxd, rxq->rxd_dma); |
922 | return -ENOMEM; | 922 | return -ENOMEM; |
923 | } | 923 | } |
@@ -1145,14 +1145,14 @@ static int mwl8k_txq_init(struct ieee80211_hw *hw, int index) | |||
1145 | 1145 | ||
1146 | txq->txd = pci_alloc_consistent(priv->pdev, size, &txq->txd_dma); | 1146 | txq->txd = pci_alloc_consistent(priv->pdev, size, &txq->txd_dma); |
1147 | if (txq->txd == NULL) { | 1147 | if (txq->txd == NULL) { |
1148 | wiphy_err(hw->wiphy, "failed to alloc tx descriptors\n"); | 1148 | wiphy_err(hw->wiphy, "failed to alloc TX descriptors\n"); |
1149 | return -ENOMEM; | 1149 | return -ENOMEM; |
1150 | } | 1150 | } |
1151 | memset(txq->txd, 0, size); | 1151 | memset(txq->txd, 0, size); |
1152 | 1152 | ||
1153 | txq->skb = kmalloc(MWL8K_TX_DESCS * sizeof(*txq->skb), GFP_KERNEL); | 1153 | txq->skb = kmalloc(MWL8K_TX_DESCS * sizeof(*txq->skb), GFP_KERNEL); |
1154 | if (txq->skb == NULL) { | 1154 | if (txq->skb == NULL) { |
1155 | wiphy_err(hw->wiphy, "failed to alloc tx skbuff list\n"); | 1155 | wiphy_err(hw->wiphy, "failed to alloc TX skbuff list\n"); |
1156 | pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma); | 1156 | pci_free_consistent(priv->pdev, size, txq->txd, txq->txd_dma); |
1157 | return -ENOMEM; | 1157 | return -ENOMEM; |
1158 | } | 1158 | } |
@@ -1573,7 +1573,7 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1573 | PCI_DMA_BIDIRECTIONAL); | 1573 | PCI_DMA_BIDIRECTIONAL); |
1574 | 1574 | ||
1575 | if (!timeout) { | 1575 | if (!timeout) { |
1576 | wiphy_err(hw->wiphy, "command %s timeout after %u ms\n", | 1576 | wiphy_err(hw->wiphy, "Command %s timeout after %u ms\n", |
1577 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), | 1577 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), |
1578 | MWL8K_CMD_TIMEOUT_MS); | 1578 | MWL8K_CMD_TIMEOUT_MS); |
1579 | rc = -ETIMEDOUT; | 1579 | rc = -ETIMEDOUT; |
@@ -1584,11 +1584,11 @@ static int mwl8k_post_cmd(struct ieee80211_hw *hw, struct mwl8k_cmd_pkt *cmd) | |||
1584 | 1584 | ||
1585 | rc = cmd->result ? -EINVAL : 0; | 1585 | rc = cmd->result ? -EINVAL : 0; |
1586 | if (rc) | 1586 | if (rc) |
1587 | wiphy_err(hw->wiphy, "command %s error 0x%x\n", | 1587 | wiphy_err(hw->wiphy, "Command %s error 0x%x\n", |
1588 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), | 1588 | mwl8k_cmd_name(cmd->code, buf, sizeof(buf)), |
1589 | le16_to_cpu(cmd->result)); | 1589 | le16_to_cpu(cmd->result)); |
1590 | else if (ms > 2000) | 1590 | else if (ms > 2000) |
1591 | wiphy_notice(hw->wiphy, "command %s took %d ms\n", | 1591 | wiphy_notice(hw->wiphy, "Command %s took %d ms\n", |
1592 | mwl8k_cmd_name(cmd->code, | 1592 | mwl8k_cmd_name(cmd->code, |
1593 | buf, sizeof(buf)), | 1593 | buf, sizeof(buf)), |
1594 | ms); | 1594 | ms); |
@@ -3210,7 +3210,7 @@ static int mwl8k_start(struct ieee80211_hw *hw) | |||
3210 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, | 3210 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, |
3211 | IRQF_SHARED, MWL8K_NAME, hw); | 3211 | IRQF_SHARED, MWL8K_NAME, hw); |
3212 | if (rc) { | 3212 | if (rc) { |
3213 | wiphy_err(hw->wiphy, "failed to register irq handler\n"); | 3213 | wiphy_err(hw->wiphy, "failed to register IRQ handler\n"); |
3214 | return -EIO; | 3214 | return -EIO; |
3215 | } | 3215 | } |
3216 | 3216 | ||
@@ -3926,7 +3926,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
3926 | 3926 | ||
3927 | priv->sram = pci_iomap(pdev, 0, 0x10000); | 3927 | priv->sram = pci_iomap(pdev, 0, 0x10000); |
3928 | if (priv->sram == NULL) { | 3928 | if (priv->sram == NULL) { |
3929 | wiphy_err(hw->wiphy, "cannot map device sram\n"); | 3929 | wiphy_err(hw->wiphy, "Cannot map device SRAM\n"); |
3930 | goto err_iounmap; | 3930 | goto err_iounmap; |
3931 | } | 3931 | } |
3932 | 3932 | ||
@@ -3938,7 +3938,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
3938 | if (priv->regs == NULL) { | 3938 | if (priv->regs == NULL) { |
3939 | priv->regs = pci_iomap(pdev, 2, 0x10000); | 3939 | priv->regs = pci_iomap(pdev, 2, 0x10000); |
3940 | if (priv->regs == NULL) { | 3940 | if (priv->regs == NULL) { |
3941 | wiphy_err(hw->wiphy, "cannot map device registers\n"); | 3941 | wiphy_err(hw->wiphy, "Cannot map device registers\n"); |
3942 | goto err_iounmap; | 3942 | goto err_iounmap; |
3943 | } | 3943 | } |
3944 | } | 3944 | } |
@@ -3950,14 +3950,14 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
3950 | /* Ask userland hotplug daemon for the device firmware */ | 3950 | /* Ask userland hotplug daemon for the device firmware */ |
3951 | rc = mwl8k_request_firmware(priv); | 3951 | rc = mwl8k_request_firmware(priv); |
3952 | if (rc) { | 3952 | if (rc) { |
3953 | wiphy_err(hw->wiphy, "firmware files not found\n"); | 3953 | wiphy_err(hw->wiphy, "Firmware files not found\n"); |
3954 | goto err_stop_firmware; | 3954 | goto err_stop_firmware; |
3955 | } | 3955 | } |
3956 | 3956 | ||
3957 | /* Load firmware into hardware */ | 3957 | /* Load firmware into hardware */ |
3958 | rc = mwl8k_load_firmware(hw); | 3958 | rc = mwl8k_load_firmware(hw); |
3959 | if (rc) { | 3959 | if (rc) { |
3960 | wiphy_err(hw->wiphy, "cannot start firmware\n"); | 3960 | wiphy_err(hw->wiphy, "Cannot start firmware\n"); |
3961 | goto err_stop_firmware; | 3961 | goto err_stop_firmware; |
3962 | } | 3962 | } |
3963 | 3963 | ||
@@ -4047,7 +4047,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
4047 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, | 4047 | rc = request_irq(priv->pdev->irq, mwl8k_interrupt, |
4048 | IRQF_SHARED, MWL8K_NAME, hw); | 4048 | IRQF_SHARED, MWL8K_NAME, hw); |
4049 | if (rc) { | 4049 | if (rc) { |
4050 | wiphy_err(hw->wiphy, "failed to register irq handler\n"); | 4050 | wiphy_err(hw->wiphy, "failed to register IRQ handler\n"); |
4051 | goto err_free_queues; | 4051 | goto err_free_queues; |
4052 | } | 4052 | } |
4053 | 4053 | ||
@@ -4067,7 +4067,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
4067 | rc = mwl8k_cmd_get_hw_spec_sta(hw); | 4067 | rc = mwl8k_cmd_get_hw_spec_sta(hw); |
4068 | } | 4068 | } |
4069 | if (rc) { | 4069 | if (rc) { |
4070 | wiphy_err(hw->wiphy, "cannot initialise firmware\n"); | 4070 | wiphy_err(hw->wiphy, "Cannot initialise firmware\n"); |
4071 | goto err_free_irq; | 4071 | goto err_free_irq; |
4072 | } | 4072 | } |
4073 | 4073 | ||
@@ -4081,14 +4081,14 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
4081 | /* Turn radio off */ | 4081 | /* Turn radio off */ |
4082 | rc = mwl8k_cmd_radio_disable(hw); | 4082 | rc = mwl8k_cmd_radio_disable(hw); |
4083 | if (rc) { | 4083 | if (rc) { |
4084 | wiphy_err(hw->wiphy, "cannot disable\n"); | 4084 | wiphy_err(hw->wiphy, "Cannot disable\n"); |
4085 | goto err_free_irq; | 4085 | goto err_free_irq; |
4086 | } | 4086 | } |
4087 | 4087 | ||
4088 | /* Clear MAC address */ | 4088 | /* Clear MAC address */ |
4089 | rc = mwl8k_cmd_set_mac_addr(hw, NULL, "\x00\x00\x00\x00\x00\x00"); | 4089 | rc = mwl8k_cmd_set_mac_addr(hw, NULL, "\x00\x00\x00\x00\x00\x00"); |
4090 | if (rc) { | 4090 | if (rc) { |
4091 | wiphy_err(hw->wiphy, "cannot clear mac address\n"); | 4091 | wiphy_err(hw->wiphy, "Cannot clear MAC address\n"); |
4092 | goto err_free_irq; | 4092 | goto err_free_irq; |
4093 | } | 4093 | } |
4094 | 4094 | ||
@@ -4098,7 +4098,7 @@ static int __devinit mwl8k_probe(struct pci_dev *pdev, | |||
4098 | 4098 | ||
4099 | rc = ieee80211_register_hw(hw); | 4099 | rc = ieee80211_register_hw(hw); |
4100 | if (rc) { | 4100 | if (rc) { |
4101 | wiphy_err(hw->wiphy, "cannot register device\n"); | 4101 | wiphy_err(hw->wiphy, "Cannot register device\n"); |
4102 | goto err_free_queues; | 4102 | goto err_free_queues; |
4103 | } | 4103 | } |
4104 | 4104 | ||
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index ef46a2d88539..71b3d68b9403 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.h> | ||
21 | #include <pcmcia/cistpl.h> | 20 | #include <pcmcia/cistpl.h> |
22 | #include <pcmcia/cisreg.h> | 21 | #include <pcmcia/cisreg.h> |
23 | #include <pcmcia/ds.h> | 22 | #include <pcmcia/ds.h> |
@@ -93,14 +92,6 @@ orinoco_cs_hard_reset(struct orinoco_private *priv) | |||
93 | /* PCMCIA stuff */ | 92 | /* PCMCIA stuff */ |
94 | /********************************************************************/ | 93 | /********************************************************************/ |
95 | 94 | ||
96 | /* | ||
97 | * This creates an "instance" of the driver, allocating local data | ||
98 | * structures for one device. The device is registered with Card | ||
99 | * Services. | ||
100 | * | ||
101 | * The dev_link structure is initialized, but we don't actually | ||
102 | * configure the card at this point -- we wait until we receive a card | ||
103 | * insertion event. */ | ||
104 | static int | 95 | static int |
105 | orinoco_cs_probe(struct pcmcia_device *link) | 96 | orinoco_cs_probe(struct pcmcia_device *link) |
106 | { | 97 | { |
@@ -117,23 +108,9 @@ orinoco_cs_probe(struct pcmcia_device *link) | |||
117 | card->p_dev = link; | 108 | card->p_dev = link; |
118 | link->priv = priv; | 109 | link->priv = priv; |
119 | 110 | ||
120 | /* General socket configuration defaults can go here. In this | ||
121 | * client, we assume very little, and rely on the CIS for | ||
122 | * almost everything. In most clients, many details (i.e., | ||
123 | * number, sizes, and attributes of IO windows) are fixed by | ||
124 | * the nature of the device, and can be hard-wired here. */ | ||
125 | link->conf.Attributes = 0; | ||
126 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
127 | |||
128 | return orinoco_cs_config(link); | 111 | return orinoco_cs_config(link); |
129 | } /* orinoco_cs_attach */ | 112 | } /* orinoco_cs_attach */ |
130 | 113 | ||
131 | /* | ||
132 | * This deletes a driver "instance". The device is de-registered with | ||
133 | * Card Services. If it has been released, all local data structures | ||
134 | * are freed. Otherwise, the structures will be freed when the device | ||
135 | * is released. | ||
136 | */ | ||
137 | static void orinoco_cs_detach(struct pcmcia_device *link) | 114 | static void orinoco_cs_detach(struct pcmcia_device *link) |
138 | { | 115 | { |
139 | struct orinoco_private *priv = link->priv; | 116 | struct orinoco_private *priv = link->priv; |
@@ -145,76 +122,12 @@ static void orinoco_cs_detach(struct pcmcia_device *link) | |||
145 | free_orinocodev(priv); | 122 | free_orinocodev(priv); |
146 | } /* orinoco_cs_detach */ | 123 | } /* orinoco_cs_detach */ |
147 | 124 | ||
148 | /* | 125 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, void *priv_data) |
149 | * orinoco_cs_config() is scheduled to run after a CARD_INSERTION | ||
150 | * event is received, to configure the PCMCIA socket, and to make the | ||
151 | * device available to the system. | ||
152 | */ | ||
153 | |||
154 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, | ||
155 | cistpl_cftable_entry_t *cfg, | ||
156 | cistpl_cftable_entry_t *dflt, | ||
157 | unsigned int vcc, | ||
158 | void *priv_data) | ||
159 | { | 126 | { |
160 | if (cfg->index == 0) | 127 | if (p_dev->config_index == 0) |
161 | goto next_entry; | 128 | return -EINVAL; |
162 | |||
163 | /* Use power settings for Vcc and Vpp if present */ | ||
164 | /* Note that the CIS values need to be rescaled */ | ||
165 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
166 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { | ||
167 | DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", | ||
168 | __func__, vcc, | ||
169 | cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); | ||
170 | if (!ignore_cis_vcc) | ||
171 | goto next_entry; | ||
172 | } | ||
173 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
174 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { | ||
175 | DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", | ||
176 | __func__, vcc, | ||
177 | dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); | ||
178 | if (!ignore_cis_vcc) | ||
179 | goto next_entry; | ||
180 | } | ||
181 | } | ||
182 | 129 | ||
183 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) | 130 | return pcmcia_request_io(p_dev); |
184 | p_dev->conf.Vpp = | ||
185 | cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
186 | else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
187 | p_dev->conf.Vpp = | ||
188 | dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
189 | |||
190 | /* Do we need to allocate an interrupt? */ | ||
191 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
192 | |||
193 | /* IO window settings */ | ||
194 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; | ||
195 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
196 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
197 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
198 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
199 | p_dev->resource[0]->flags |= | ||
200 | pcmcia_io_cfg_data_width(io->flags); | ||
201 | p_dev->resource[0]->start = io->win[0].base; | ||
202 | p_dev->resource[0]->end = io->win[0].len; | ||
203 | if (io->nwin > 1) { | ||
204 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; | ||
205 | p_dev->resource[1]->start = io->win[1].base; | ||
206 | p_dev->resource[1]->end = io->win[1].len; | ||
207 | } | ||
208 | |||
209 | /* This reserves IO space but doesn't actually enable it */ | ||
210 | if (pcmcia_request_io(p_dev) != 0) | ||
211 | goto next_entry; | ||
212 | } | ||
213 | return 0; | ||
214 | |||
215 | next_entry: | ||
216 | pcmcia_disable_device(p_dev); | ||
217 | return -ENODEV; | ||
218 | }; | 131 | }; |
219 | 132 | ||
220 | static int | 133 | static int |
@@ -225,20 +138,10 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
225 | int ret; | 138 | int ret; |
226 | void __iomem *mem; | 139 | void __iomem *mem; |
227 | 140 | ||
228 | /* | 141 | link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | |
229 | * In this loop, we scan the CIS for configuration table | 142 | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; |
230 | * entries, each of which describes a valid card | 143 | if (ignore_cis_vcc) |
231 | * configuration, including voltage, IO window, memory window, | 144 | link->config_flags &= ~CONF_AUTO_CHECK_VCC; |
232 | * and interrupt settings. | ||
233 | * | ||
234 | * We make no assumptions about the card to be configured: we | ||
235 | * use just the information available in the CIS. In an ideal | ||
236 | * world, this would work for any PCMCIA card, but it requires | ||
237 | * a complete and accurate CIS. In practice, a driver usually | ||
238 | * "knows" most of these things without consulting the CIS, | ||
239 | * and most client drivers will only use the CIS to fill in | ||
240 | * implementation-defined details. | ||
241 | */ | ||
242 | ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); | 145 | ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); |
243 | if (ret) { | 146 | if (ret) { |
244 | if (!ignore_cis_vcc) | 147 | if (!ignore_cis_vcc) |
@@ -262,12 +165,7 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
262 | 165 | ||
263 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 166 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
264 | 167 | ||
265 | /* | 168 | ret = pcmcia_enable_device(link); |
266 | * This actually configures the PCMCIA socket -- setting up | ||
267 | * the I/O windows and the interrupt mapping, and putting the | ||
268 | * card and host interface into "Memory and IO" mode. | ||
269 | */ | ||
270 | ret = pcmcia_request_configuration(link, &link->conf); | ||
271 | if (ret) | 169 | if (ret) |
272 | goto failed; | 170 | goto failed; |
273 | 171 | ||
@@ -291,11 +189,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
291 | return -ENODEV; | 189 | return -ENODEV; |
292 | } /* orinoco_cs_config */ | 190 | } /* orinoco_cs_config */ |
293 | 191 | ||
294 | /* | ||
295 | * After a card is removed, orinoco_cs_release() will unregister the | ||
296 | * device, and release the PCMCIA configuration. If the device is | ||
297 | * still open, this will be postponed until it is closed. | ||
298 | */ | ||
299 | static void | 192 | static void |
300 | orinoco_cs_release(struct pcmcia_device *link) | 193 | orinoco_cs_release(struct pcmcia_device *link) |
301 | { | 194 | { |
@@ -344,12 +237,6 @@ static int orinoco_cs_resume(struct pcmcia_device *link) | |||
344 | /* Module initialization */ | 237 | /* Module initialization */ |
345 | /********************************************************************/ | 238 | /********************************************************************/ |
346 | 239 | ||
347 | /* Can't be declared "const" or the whole __initdata section will | ||
348 | * become const */ | ||
349 | static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION | ||
350 | " (David Gibson <hermes@gibson.dropbear.id.au>, " | ||
351 | "Pavel Roskin <proski@gnu.org>, et al)"; | ||
352 | |||
353 | static struct pcmcia_device_id orinoco_cs_ids[] = { | 240 | static struct pcmcia_device_id orinoco_cs_ids[] = { |
354 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */ | 241 | PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), /* 3Com AirConnect PCI 777A */ |
355 | PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), /* Lucent Orinoco and old Intersil */ | 242 | PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002), /* Lucent Orinoco and old Intersil */ |
@@ -441,9 +328,7 @@ MODULE_DEVICE_TABLE(pcmcia, orinoco_cs_ids); | |||
441 | 328 | ||
442 | static struct pcmcia_driver orinoco_driver = { | 329 | static struct pcmcia_driver orinoco_driver = { |
443 | .owner = THIS_MODULE, | 330 | .owner = THIS_MODULE, |
444 | .drv = { | 331 | .name = DRIVER_NAME, |
445 | .name = DRIVER_NAME, | ||
446 | }, | ||
447 | .probe = orinoco_cs_probe, | 332 | .probe = orinoco_cs_probe, |
448 | .remove = orinoco_cs_detach, | 333 | .remove = orinoco_cs_detach, |
449 | .id_table = orinoco_cs_ids, | 334 | .id_table = orinoco_cs_ids, |
@@ -454,8 +339,6 @@ static struct pcmcia_driver orinoco_driver = { | |||
454 | static int __init | 339 | static int __init |
455 | init_orinoco_cs(void) | 340 | init_orinoco_cs(void) |
456 | { | 341 | { |
457 | printk(KERN_DEBUG "%s\n", version); | ||
458 | |||
459 | return pcmcia_register_driver(&orinoco_driver); | 342 | return pcmcia_register_driver(&orinoco_driver); |
460 | } | 343 | } |
461 | 344 | ||
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index 873877e17e1b..fb859a5ad2eb 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.h> | ||
29 | #include <pcmcia/cistpl.h> | 28 | #include <pcmcia/cistpl.h> |
30 | #include <pcmcia/cisreg.h> | 29 | #include <pcmcia/cisreg.h> |
31 | #include <pcmcia/ds.h> | 30 | #include <pcmcia/ds.h> |
@@ -154,14 +153,6 @@ spectrum_cs_stop_firmware(struct orinoco_private *priv, int idle) | |||
154 | /* PCMCIA stuff */ | 153 | /* PCMCIA stuff */ |
155 | /********************************************************************/ | 154 | /********************************************************************/ |
156 | 155 | ||
157 | /* | ||
158 | * This creates an "instance" of the driver, allocating local data | ||
159 | * structures for one device. The device is registered with Card | ||
160 | * Services. | ||
161 | * | ||
162 | * The dev_link structure is initialized, but we don't actually | ||
163 | * configure the card at this point -- we wait until we receive a card | ||
164 | * insertion event. */ | ||
165 | static int | 156 | static int |
166 | spectrum_cs_probe(struct pcmcia_device *link) | 157 | spectrum_cs_probe(struct pcmcia_device *link) |
167 | { | 158 | { |
@@ -179,23 +170,9 @@ spectrum_cs_probe(struct pcmcia_device *link) | |||
179 | card->p_dev = link; | 170 | card->p_dev = link; |
180 | link->priv = priv; | 171 | link->priv = priv; |
181 | 172 | ||
182 | /* General socket configuration defaults can go here. In this | ||
183 | * client, we assume very little, and rely on the CIS for | ||
184 | * almost everything. In most clients, many details (i.e., | ||
185 | * number, sizes, and attributes of IO windows) are fixed by | ||
186 | * the nature of the device, and can be hard-wired here. */ | ||
187 | link->conf.Attributes = 0; | ||
188 | link->conf.IntType = INT_MEMORY_AND_IO; | ||
189 | |||
190 | return spectrum_cs_config(link); | 173 | return spectrum_cs_config(link); |
191 | } /* spectrum_cs_attach */ | 174 | } /* spectrum_cs_attach */ |
192 | 175 | ||
193 | /* | ||
194 | * This deletes a driver "instance". The device is de-registered with | ||
195 | * Card Services. If it has been released, all local data structures | ||
196 | * are freed. Otherwise, the structures will be freed when the device | ||
197 | * is released. | ||
198 | */ | ||
199 | static void spectrum_cs_detach(struct pcmcia_device *link) | 176 | static void spectrum_cs_detach(struct pcmcia_device *link) |
200 | { | 177 | { |
201 | struct orinoco_private *priv = link->priv; | 178 | struct orinoco_private *priv = link->priv; |
@@ -207,76 +184,13 @@ static void spectrum_cs_detach(struct pcmcia_device *link) | |||
207 | free_orinocodev(priv); | 184 | free_orinocodev(priv); |
208 | } /* spectrum_cs_detach */ | 185 | } /* spectrum_cs_detach */ |
209 | 186 | ||
210 | /* | ||
211 | * spectrum_cs_config() is scheduled to run after a CARD_INSERTION | ||
212 | * event is received, to configure the PCMCIA socket, and to make the | ||
213 | * device available to the system. | ||
214 | */ | ||
215 | |||
216 | static int spectrum_cs_config_check(struct pcmcia_device *p_dev, | 187 | static int spectrum_cs_config_check(struct pcmcia_device *p_dev, |
217 | cistpl_cftable_entry_t *cfg, | ||
218 | cistpl_cftable_entry_t *dflt, | ||
219 | unsigned int vcc, | ||
220 | void *priv_data) | 188 | void *priv_data) |
221 | { | 189 | { |
222 | if (cfg->index == 0) | 190 | if (p_dev->config_index == 0) |
223 | goto next_entry; | 191 | return -EINVAL; |
224 | |||
225 | /* Use power settings for Vcc and Vpp if present */ | ||
226 | /* Note that the CIS values need to be rescaled */ | ||
227 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
228 | if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { | ||
229 | DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", | ||
230 | __func__, vcc, | ||
231 | cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); | ||
232 | if (!ignore_cis_vcc) | ||
233 | goto next_entry; | ||
234 | } | ||
235 | } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { | ||
236 | if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { | ||
237 | DEBUG(2, "%s: Vcc mismatch (vcc = %d, CIS = %d)\n", | ||
238 | __func__, vcc, | ||
239 | dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); | ||
240 | if (!ignore_cis_vcc) | ||
241 | goto next_entry; | ||
242 | } | ||
243 | } | ||
244 | 192 | ||
245 | if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) | 193 | return pcmcia_request_io(p_dev); |
246 | p_dev->conf.Vpp = | ||
247 | cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
248 | else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) | ||
249 | p_dev->conf.Vpp = | ||
250 | dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; | ||
251 | |||
252 | /* Do we need to allocate an interrupt? */ | ||
253 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
254 | |||
255 | /* IO window settings */ | ||
256 | p_dev->resource[0]->end = p_dev->resource[1]->end = 0; | ||
257 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | ||
258 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | ||
259 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
260 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
261 | p_dev->resource[0]->flags |= | ||
262 | pcmcia_io_cfg_data_width(io->flags); | ||
263 | p_dev->resource[0]->start = io->win[0].base; | ||
264 | p_dev->resource[0]->end = io->win[0].len; | ||
265 | if (io->nwin > 1) { | ||
266 | p_dev->resource[1]->flags = p_dev->resource[0]->flags; | ||
267 | p_dev->resource[1]->start = io->win[1].base; | ||
268 | p_dev->resource[1]->end = io->win[1].len; | ||
269 | } | ||
270 | |||
271 | /* This reserves IO space but doesn't actually enable it */ | ||
272 | if (pcmcia_request_io(p_dev) != 0) | ||
273 | goto next_entry; | ||
274 | } | ||
275 | return 0; | ||
276 | |||
277 | next_entry: | ||
278 | pcmcia_disable_device(p_dev); | ||
279 | return -ENODEV; | ||
280 | }; | 194 | }; |
281 | 195 | ||
282 | static int | 196 | static int |
@@ -287,20 +201,10 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
287 | int ret; | 201 | int ret; |
288 | void __iomem *mem; | 202 | void __iomem *mem; |
289 | 203 | ||
290 | /* | 204 | link->config_flags |= CONF_AUTO_SET_VPP | CONF_AUTO_CHECK_VCC | |
291 | * In this loop, we scan the CIS for configuration table | 205 | CONF_AUTO_SET_IO | CONF_ENABLE_IRQ; |
292 | * entries, each of which describes a valid card | 206 | if (ignore_cis_vcc) |
293 | * configuration, including voltage, IO window, memory window, | 207 | link->config_flags &= ~CONF_AUTO_CHECK_VCC; |
294 | * and interrupt settings. | ||
295 | * | ||
296 | * We make no assumptions about the card to be configured: we | ||
297 | * use just the information available in the CIS. In an ideal | ||
298 | * world, this would work for any PCMCIA card, but it requires | ||
299 | * a complete and accurate CIS. In practice, a driver usually | ||
300 | * "knows" most of these things without consulting the CIS, | ||
301 | * and most client drivers will only use the CIS to fill in | ||
302 | * implementation-defined details. | ||
303 | */ | ||
304 | ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); | 208 | ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); |
305 | if (ret) { | 209 | if (ret) { |
306 | if (!ignore_cis_vcc) | 210 | if (!ignore_cis_vcc) |
@@ -325,12 +229,7 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
325 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 229 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
326 | hw->eeprom_pda = true; | 230 | hw->eeprom_pda = true; |
327 | 231 | ||
328 | /* | 232 | ret = pcmcia_enable_device(link); |
329 | * This actually configures the PCMCIA socket -- setting up | ||
330 | * the I/O windows and the interrupt mapping, and putting the | ||
331 | * card and host interface into "Memory and IO" mode. | ||
332 | */ | ||
333 | ret = pcmcia_request_configuration(link, &link->conf); | ||
334 | if (ret) | 233 | if (ret) |
335 | goto failed; | 234 | goto failed; |
336 | 235 | ||
@@ -358,11 +257,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
358 | return -ENODEV; | 257 | return -ENODEV; |
359 | } /* spectrum_cs_config */ | 258 | } /* spectrum_cs_config */ |
360 | 259 | ||
361 | /* | ||
362 | * After a card is removed, spectrum_cs_release() will unregister the | ||
363 | * device, and release the PCMCIA configuration. If the device is | ||
364 | * still open, this will be postponed until it is closed. | ||
365 | */ | ||
366 | static void | 260 | static void |
367 | spectrum_cs_release(struct pcmcia_device *link) | 261 | spectrum_cs_release(struct pcmcia_device *link) |
368 | { | 262 | { |
@@ -407,12 +301,6 @@ spectrum_cs_resume(struct pcmcia_device *link) | |||
407 | /* Module initialization */ | 301 | /* Module initialization */ |
408 | /********************************************************************/ | 302 | /********************************************************************/ |
409 | 303 | ||
410 | /* Can't be declared "const" or the whole __initdata section will | ||
411 | * become const */ | ||
412 | static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION | ||
413 | " (Pavel Roskin <proski@gnu.org>," | ||
414 | " David Gibson <hermes@gibson.dropbear.id.au>, et al)"; | ||
415 | |||
416 | static struct pcmcia_device_id spectrum_cs_ids[] = { | 304 | static struct pcmcia_device_id spectrum_cs_ids[] = { |
417 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */ | 305 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */ |
418 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ | 306 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ |
@@ -423,9 +311,7 @@ MODULE_DEVICE_TABLE(pcmcia, spectrum_cs_ids); | |||
423 | 311 | ||
424 | static struct pcmcia_driver orinoco_driver = { | 312 | static struct pcmcia_driver orinoco_driver = { |
425 | .owner = THIS_MODULE, | 313 | .owner = THIS_MODULE, |
426 | .drv = { | 314 | .name = DRIVER_NAME, |
427 | .name = DRIVER_NAME, | ||
428 | }, | ||
429 | .probe = spectrum_cs_probe, | 315 | .probe = spectrum_cs_probe, |
430 | .remove = spectrum_cs_detach, | 316 | .remove = spectrum_cs_detach, |
431 | .suspend = spectrum_cs_suspend, | 317 | .suspend = spectrum_cs_suspend, |
@@ -436,8 +322,6 @@ static struct pcmcia_driver orinoco_driver = { | |||
436 | static int __init | 322 | static int __init |
437 | init_spectrum_cs(void) | 323 | init_spectrum_cs(void) |
438 | { | 324 | { |
439 | printk(KERN_DEBUG "%s\n", version); | ||
440 | |||
441 | return pcmcia_register_driver(&orinoco_driver); | 325 | return pcmcia_register_driver(&orinoco_driver); |
442 | } | 326 | } |
443 | 327 | ||
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c index d687cb7f2a59..78347041ec40 100644 --- a/drivers/net/wireless/p54/eeprom.c +++ b/drivers/net/wireless/p54/eeprom.c | |||
@@ -167,7 +167,7 @@ static int p54_generate_band(struct ieee80211_hw *dev, | |||
167 | } | 167 | } |
168 | 168 | ||
169 | if (j == 0) { | 169 | if (j == 0) { |
170 | wiphy_err(dev->wiphy, "disabling totally damaged %d GHz band\n", | 170 | wiphy_err(dev->wiphy, "Disabling totally damaged %d GHz band\n", |
171 | (band == IEEE80211_BAND_2GHZ) ? 2 : 5); | 171 | (band == IEEE80211_BAND_2GHZ) ? 2 : 5); |
172 | 172 | ||
173 | ret = -ENODATA; | 173 | ret = -ENODATA; |
@@ -695,12 +695,12 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | |||
695 | u8 perm_addr[ETH_ALEN]; | 695 | u8 perm_addr[ETH_ALEN]; |
696 | 696 | ||
697 | wiphy_warn(dev->wiphy, | 697 | wiphy_warn(dev->wiphy, |
698 | "invalid hwaddr! using randomly generated mac addr\n"); | 698 | "Invalid hwaddr! Using randomly generated MAC addr\n"); |
699 | random_ether_addr(perm_addr); | 699 | random_ether_addr(perm_addr); |
700 | SET_IEEE80211_PERM_ADDR(dev, perm_addr); | 700 | SET_IEEE80211_PERM_ADDR(dev, perm_addr); |
701 | } | 701 | } |
702 | 702 | ||
703 | wiphy_info(dev->wiphy, "hwaddr %pm, mac:isl38%02x rf:%s\n", | 703 | wiphy_info(dev->wiphy, "hwaddr %pM, MAC:isl38%02x RF:%s\n", |
704 | dev->wiphy->perm_addr, priv->version, | 704 | dev->wiphy->perm_addr, priv->version, |
705 | p54_rf_chips[priv->rxhw]); | 705 | p54_rf_chips[priv->rxhw]); |
706 | 706 | ||
diff --git a/drivers/net/wireless/p54/fwio.c b/drivers/net/wireless/p54/fwio.c index 47006bca4852..15b20c29a604 100644 --- a/drivers/net/wireless/p54/fwio.c +++ b/drivers/net/wireless/p54/fwio.c | |||
@@ -125,7 +125,7 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
125 | 125 | ||
126 | if (fw_version) | 126 | if (fw_version) |
127 | wiphy_info(priv->hw->wiphy, | 127 | wiphy_info(priv->hw->wiphy, |
128 | "fw rev %s - softmac protocol %x.%x\n", | 128 | "FW rev %s - Softmac protocol %x.%x\n", |
129 | fw_version, priv->fw_var >> 8, priv->fw_var & 0xff); | 129 | fw_version, priv->fw_var >> 8, priv->fw_var & 0xff); |
130 | 130 | ||
131 | if (priv->fw_var < 0x500) | 131 | if (priv->fw_var < 0x500) |
diff --git a/drivers/net/wireless/p54/led.c b/drivers/net/wireless/p54/led.c index ea91f5cce6b3..3837e1eec5f4 100644 --- a/drivers/net/wireless/p54/led.c +++ b/drivers/net/wireless/p54/led.c | |||
@@ -58,7 +58,7 @@ static void p54_update_leds(struct work_struct *work) | |||
58 | err = p54_set_leds(priv); | 58 | err = p54_set_leds(priv); |
59 | if (err && net_ratelimit()) | 59 | if (err && net_ratelimit()) |
60 | wiphy_err(priv->hw->wiphy, | 60 | wiphy_err(priv->hw->wiphy, |
61 | "failed to update leds (%d).\n", err); | 61 | "failed to update LEDs (%d).\n", err); |
62 | 62 | ||
63 | if (rerun) | 63 | if (rerun) |
64 | ieee80211_queue_delayed_work(priv->hw, &priv->led_work, | 64 | ieee80211_queue_delayed_work(priv->hw, &priv->led_work, |
@@ -103,7 +103,7 @@ static int p54_register_led(struct p54_common *priv, | |||
103 | err = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_dev); | 103 | err = led_classdev_register(wiphy_dev(priv->hw->wiphy), &led->led_dev); |
104 | if (err) | 104 | if (err) |
105 | wiphy_err(priv->hw->wiphy, | 105 | wiphy_err(priv->hw->wiphy, |
106 | "failed to register %s led.\n", name); | 106 | "Failed to register %s LED.\n", name); |
107 | else | 107 | else |
108 | led->registered = 1; | 108 | led->registered = 1; |
109 | 109 | ||
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index 822f8dc26e9c..1eacba4daa5b 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -466,7 +466,7 @@ static int p54p_open(struct ieee80211_hw *dev) | |||
466 | P54P_READ(dev_int); | 466 | P54P_READ(dev_int); |
467 | 467 | ||
468 | if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) { | 468 | if (!wait_for_completion_interruptible_timeout(&priv->boot_comp, HZ)) { |
469 | wiphy_err(dev->wiphy, "cannot boot firmware!\n"); | 469 | wiphy_err(dev->wiphy, "Cannot boot firmware!\n"); |
470 | p54p_stop(dev); | 470 | p54p_stop(dev); |
471 | return -ETIMEDOUT; | 471 | return -ETIMEDOUT; |
472 | } | 472 | } |
diff --git a/drivers/net/wireless/p54/txrx.c b/drivers/net/wireless/p54/txrx.c index 427b46f558ed..0e937dc0c9c4 100644 --- a/drivers/net/wireless/p54/txrx.c +++ b/drivers/net/wireless/p54/txrx.c | |||
@@ -446,7 +446,7 @@ static void p54_rx_frame_sent(struct p54_common *priv, struct sk_buff *skb) | |||
446 | } | 446 | } |
447 | 447 | ||
448 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && | 448 | if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && |
449 | (!payload->status)) | 449 | !(payload->status & P54_TX_FAILED)) |
450 | info->flags |= IEEE80211_TX_STAT_ACK; | 450 | info->flags |= IEEE80211_TX_STAT_ACK; |
451 | if (payload->status & P54_TX_PSM_CANCELLED) | 451 | if (payload->status & P54_TX_PSM_CANCELLED) |
452 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; | 452 | info->flags |= IEEE80211_TX_STAT_TX_FILTERED; |
@@ -540,7 +540,7 @@ static void p54_rx_trap(struct p54_common *priv, struct sk_buff *skb) | |||
540 | case P54_TRAP_BEACON_TX: | 540 | case P54_TRAP_BEACON_TX: |
541 | break; | 541 | break; |
542 | case P54_TRAP_RADAR: | 542 | case P54_TRAP_RADAR: |
543 | wiphy_info(priv->hw->wiphy, "radar (freq:%d mhz)\n", freq); | 543 | wiphy_info(priv->hw->wiphy, "radar (freq:%d MHz)\n", freq); |
544 | break; | 544 | break; |
545 | case P54_TRAP_NO_BEACON: | 545 | case P54_TRAP_NO_BEACON: |
546 | if (priv->vif) | 546 | if (priv->vif) |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 88560d0ae50a..46da03753fd5 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.h> | ||
50 | #include <pcmcia/cistpl.h> | 49 | #include <pcmcia/cistpl.h> |
51 | #include <pcmcia/cisreg.h> | 50 | #include <pcmcia/cisreg.h> |
52 | #include <pcmcia/ds.h> | 51 | #include <pcmcia/ds.h> |
@@ -169,13 +168,6 @@ static int bc; | |||
169 | */ | 168 | */ |
170 | static char *phy_addr = NULL; | 169 | static char *phy_addr = NULL; |
171 | 170 | ||
172 | |||
173 | /* A struct pcmcia_device structure has fields for most things that are needed | ||
174 | to keep track of a socket, but there will usually be some device | ||
175 | specific information that also needs to be kept track of. The | ||
176 | 'priv' pointer in a struct pcmcia_device structure can be used to point to | ||
177 | a device-specific private data structure, like this. | ||
178 | */ | ||
179 | static unsigned int ray_mem_speed = 500; | 171 | static unsigned int ray_mem_speed = 500; |
180 | 172 | ||
181 | /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ | 173 | /* WARNING: THIS DRIVER IS NOT CAPABLE OF HANDLING MULTIPLE DEVICES! */ |
@@ -290,14 +282,6 @@ static const struct net_device_ops ray_netdev_ops = { | |||
290 | .ndo_validate_addr = eth_validate_addr, | 282 | .ndo_validate_addr = eth_validate_addr, |
291 | }; | 283 | }; |
292 | 284 | ||
293 | /*============================================================================= | ||
294 | ray_attach() creates an "instance" of the driver, allocating | ||
295 | local data structures for one device. The device is registered | ||
296 | with Card Services. | ||
297 | The dev_link structure is initialized, but we don't actually | ||
298 | configure the card at this point -- we wait until we receive a | ||
299 | card insertion event. | ||
300 | =============================================================================*/ | ||
301 | static int ray_probe(struct pcmcia_device *p_dev) | 285 | static int ray_probe(struct pcmcia_device *p_dev) |
302 | { | 286 | { |
303 | ray_dev_t *local; | 287 | ray_dev_t *local; |
@@ -318,9 +302,8 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
318 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | 302 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
319 | 303 | ||
320 | /* General socket configuration */ | 304 | /* General socket configuration */ |
321 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 305 | p_dev->config_flags |= CONF_ENABLE_IRQ; |
322 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 306 | p_dev->config_index = 1; |
323 | p_dev->conf.ConfigIndex = 1; | ||
324 | 307 | ||
325 | p_dev->priv = dev; | 308 | p_dev->priv = dev; |
326 | 309 | ||
@@ -353,12 +336,6 @@ fail_alloc_dev: | |||
353 | return -ENOMEM; | 336 | return -ENOMEM; |
354 | } /* ray_attach */ | 337 | } /* ray_attach */ |
355 | 338 | ||
356 | /*============================================================================= | ||
357 | This deletes a driver "instance". The device is de-registered | ||
358 | with Card Services. If it has been released, all local data | ||
359 | structures are freed. Otherwise, the structures will be freed | ||
360 | when the device is released. | ||
361 | =============================================================================*/ | ||
362 | static void ray_detach(struct pcmcia_device *link) | 339 | static void ray_detach(struct pcmcia_device *link) |
363 | { | 340 | { |
364 | struct net_device *dev; | 341 | struct net_device *dev; |
@@ -381,17 +358,11 @@ static void ray_detach(struct pcmcia_device *link) | |||
381 | dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); | 358 | dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); |
382 | } /* ray_detach */ | 359 | } /* ray_detach */ |
383 | 360 | ||
384 | /*============================================================================= | ||
385 | ray_config() is run after a CARD_INSERTION event | ||
386 | is received, to configure the PCMCIA socket, and to make the | ||
387 | ethernet device available to the system. | ||
388 | =============================================================================*/ | ||
389 | #define MAX_TUPLE_SIZE 128 | 361 | #define MAX_TUPLE_SIZE 128 |
390 | static int ray_config(struct pcmcia_device *link) | 362 | static int ray_config(struct pcmcia_device *link) |
391 | { | 363 | { |
392 | int ret = 0; | 364 | int ret = 0; |
393 | int i; | 365 | int i; |
394 | win_req_t req; | ||
395 | struct net_device *dev = (struct net_device *)link->priv; | 366 | struct net_device *dev = (struct net_device *)link->priv; |
396 | ray_dev_t *local = netdev_priv(dev); | 367 | ray_dev_t *local = netdev_priv(dev); |
397 | 368 | ||
@@ -412,54 +383,50 @@ static int ray_config(struct pcmcia_device *link) | |||
412 | goto failed; | 383 | goto failed; |
413 | dev->irq = link->irq; | 384 | dev->irq = link->irq; |
414 | 385 | ||
415 | /* This actually configures the PCMCIA socket -- setting up | 386 | ret = pcmcia_enable_device(link); |
416 | the I/O windows and the interrupt mapping. | ||
417 | */ | ||
418 | ret = pcmcia_request_configuration(link, &link->conf); | ||
419 | if (ret) | 387 | if (ret) |
420 | goto failed; | 388 | goto failed; |
421 | 389 | ||
422 | /*** Set up 32k window for shared memory (transmit and control) ************/ | 390 | /*** Set up 32k window for shared memory (transmit and control) ************/ |
423 | req.Attributes = | 391 | link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; |
424 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; | 392 | link->resource[2]->start = 0; |
425 | req.Base = 0; | 393 | link->resource[2]->end = 0x8000; |
426 | req.Size = 0x8000; | 394 | ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed); |
427 | req.AccessSpeed = ray_mem_speed; | ||
428 | ret = pcmcia_request_window(link, &req, &link->win); | ||
429 | if (ret) | 395 | if (ret) |
430 | goto failed; | 396 | goto failed; |
431 | ret = pcmcia_map_mem_page(link, link->win, 0); | 397 | ret = pcmcia_map_mem_page(link, link->resource[2], 0); |
432 | if (ret) | 398 | if (ret) |
433 | goto failed; | 399 | goto failed; |
434 | local->sram = ioremap(req.Base, req.Size); | 400 | local->sram = ioremap(link->resource[2]->start, |
401 | resource_size(link->resource[2])); | ||
435 | 402 | ||
436 | /*** Set up 16k window for shared memory (receive buffer) ***************/ | 403 | /*** Set up 16k window for shared memory (receive buffer) ***************/ |
437 | req.Attributes = | 404 | link->resource[3]->flags |= |
438 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; | 405 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; |
439 | req.Base = 0; | 406 | link->resource[3]->start = 0; |
440 | req.Size = 0x4000; | 407 | link->resource[3]->end = 0x4000; |
441 | req.AccessSpeed = ray_mem_speed; | 408 | ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed); |
442 | ret = pcmcia_request_window(link, &req, &local->rmem_handle); | ||
443 | if (ret) | 409 | if (ret) |
444 | goto failed; | 410 | goto failed; |
445 | ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); | 411 | ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000); |
446 | if (ret) | 412 | if (ret) |
447 | goto failed; | 413 | goto failed; |
448 | local->rmem = ioremap(req.Base, req.Size); | 414 | local->rmem = ioremap(link->resource[3]->start, |
415 | resource_size(link->resource[3])); | ||
449 | 416 | ||
450 | /*** Set up window for attribute memory ***********************************/ | 417 | /*** Set up window for attribute memory ***********************************/ |
451 | req.Attributes = | 418 | link->resource[4]->flags |= |
452 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; | 419 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; |
453 | req.Base = 0; | 420 | link->resource[4]->start = 0; |
454 | req.Size = 0x1000; | 421 | link->resource[4]->end = 0x1000; |
455 | req.AccessSpeed = ray_mem_speed; | 422 | ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed); |
456 | ret = pcmcia_request_window(link, &req, &local->amem_handle); | ||
457 | if (ret) | 423 | if (ret) |
458 | goto failed; | 424 | goto failed; |
459 | ret = pcmcia_map_mem_page(link, local->amem_handle, 0); | 425 | ret = pcmcia_map_mem_page(link, link->resource[4], 0); |
460 | if (ret) | 426 | if (ret) |
461 | goto failed; | 427 | goto failed; |
462 | local->amem = ioremap(req.Base, req.Size); | 428 | local->amem = ioremap(link->resource[4]->start, |
429 | resource_size(link->resource[4])); | ||
463 | 430 | ||
464 | dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); | 431 | dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); |
465 | dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); | 432 | dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); |
@@ -775,11 +742,7 @@ static void join_net(u_long data) | |||
775 | local->card_status = CARD_DOING_ACQ; | 742 | local->card_status = CARD_DOING_ACQ; |
776 | } | 743 | } |
777 | 744 | ||
778 | /*============================================================================ | 745 | |
779 | After a card is removed, ray_release() will unregister the net | ||
780 | device, and release the PCMCIA configuration. If the device is | ||
781 | still open, this will be postponed until it is closed. | ||
782 | =============================================================================*/ | ||
783 | static void ray_release(struct pcmcia_device *link) | 746 | static void ray_release(struct pcmcia_device *link) |
784 | { | 747 | { |
785 | struct net_device *dev = link->priv; | 748 | struct net_device *dev = link->priv; |
@@ -2802,6 +2765,7 @@ static ssize_t ray_cs_essid_proc_write(struct file *file, | |||
2802 | static const struct file_operations ray_cs_essid_proc_fops = { | 2765 | static const struct file_operations ray_cs_essid_proc_fops = { |
2803 | .owner = THIS_MODULE, | 2766 | .owner = THIS_MODULE, |
2804 | .write = ray_cs_essid_proc_write, | 2767 | .write = ray_cs_essid_proc_write, |
2768 | .llseek = noop_llseek, | ||
2805 | }; | 2769 | }; |
2806 | 2770 | ||
2807 | static ssize_t int_proc_write(struct file *file, const char __user *buffer, | 2771 | static ssize_t int_proc_write(struct file *file, const char __user *buffer, |
@@ -2835,6 +2799,7 @@ static ssize_t int_proc_write(struct file *file, const char __user *buffer, | |||
2835 | static const struct file_operations int_proc_fops = { | 2799 | static const struct file_operations int_proc_fops = { |
2836 | .owner = THIS_MODULE, | 2800 | .owner = THIS_MODULE, |
2837 | .write = int_proc_write, | 2801 | .write = int_proc_write, |
2802 | .llseek = noop_llseek, | ||
2838 | }; | 2803 | }; |
2839 | #endif | 2804 | #endif |
2840 | 2805 | ||
@@ -2847,9 +2812,7 @@ MODULE_DEVICE_TABLE(pcmcia, ray_ids); | |||
2847 | 2812 | ||
2848 | static struct pcmcia_driver ray_driver = { | 2813 | static struct pcmcia_driver ray_driver = { |
2849 | .owner = THIS_MODULE, | 2814 | .owner = THIS_MODULE, |
2850 | .drv = { | 2815 | .name = "ray_cs", |
2851 | .name = "ray_cs", | ||
2852 | }, | ||
2853 | .probe = ray_probe, | 2816 | .probe = ray_probe, |
2854 | .remove = ray_detach, | 2817 | .remove = ray_detach, |
2855 | .id_table = ray_ids, | 2818 | .id_table = ray_ids, |
diff --git a/drivers/net/wireless/ray_cs.h b/drivers/net/wireless/ray_cs.h index 9f01ddb19748..e79848fbcca1 100644 --- a/drivers/net/wireless/ray_cs.h +++ b/drivers/net/wireless/ray_cs.h | |||
@@ -25,8 +25,6 @@ struct beacon_rx { | |||
25 | typedef struct ray_dev_t { | 25 | typedef struct ray_dev_t { |
26 | int card_status; | 26 | int card_status; |
27 | int authentication_state; | 27 | int authentication_state; |
28 | window_handle_t amem_handle; /* handle to window for attribute memory */ | ||
29 | window_handle_t rmem_handle; /* handle to window for rx buffer on card */ | ||
30 | void __iomem *sram; /* pointer to beginning of shared RAM */ | 28 | void __iomem *sram; /* pointer to beginning of shared RAM */ |
31 | void __iomem *amem; /* pointer to attribute mem window */ | 29 | void __iomem *amem; /* pointer to attribute mem window */ |
32 | void __iomem *rmem; /* pointer to receive buffer window */ | 30 | void __iomem *rmem; /* pointer to receive buffer window */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index b0498e7e7aae..cea81e4c5c82 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -315,6 +315,7 @@ static const struct file_operations rt2x00debug_fop_queue_dump = { | |||
315 | .poll = rt2x00debug_poll_queue_dump, | 315 | .poll = rt2x00debug_poll_queue_dump, |
316 | .open = rt2x00debug_open_queue_dump, | 316 | .open = rt2x00debug_open_queue_dump, |
317 | .release = rt2x00debug_release_queue_dump, | 317 | .release = rt2x00debug_release_queue_dump, |
318 | .llseek = default_llseek, | ||
318 | }; | 319 | }; |
319 | 320 | ||
320 | static ssize_t rt2x00debug_read_queue_stats(struct file *file, | 321 | static ssize_t rt2x00debug_read_queue_stats(struct file *file, |
@@ -371,6 +372,7 @@ static const struct file_operations rt2x00debug_fop_queue_stats = { | |||
371 | .read = rt2x00debug_read_queue_stats, | 372 | .read = rt2x00debug_read_queue_stats, |
372 | .open = rt2x00debug_file_open, | 373 | .open = rt2x00debug_file_open, |
373 | .release = rt2x00debug_file_release, | 374 | .release = rt2x00debug_file_release, |
375 | .llseek = default_llseek, | ||
374 | }; | 376 | }; |
375 | 377 | ||
376 | #ifdef CONFIG_RT2X00_LIB_CRYPTO | 378 | #ifdef CONFIG_RT2X00_LIB_CRYPTO |
@@ -423,6 +425,7 @@ static const struct file_operations rt2x00debug_fop_crypto_stats = { | |||
423 | .read = rt2x00debug_read_crypto_stats, | 425 | .read = rt2x00debug_read_crypto_stats, |
424 | .open = rt2x00debug_file_open, | 426 | .open = rt2x00debug_file_open, |
425 | .release = rt2x00debug_file_release, | 427 | .release = rt2x00debug_file_release, |
428 | .llseek = default_llseek, | ||
426 | }; | 429 | }; |
427 | #endif | 430 | #endif |
428 | 431 | ||
@@ -509,6 +512,7 @@ static const struct file_operations rt2x00debug_fop_##__name = {\ | |||
509 | .write = rt2x00debug_write_##__name, \ | 512 | .write = rt2x00debug_write_##__name, \ |
510 | .open = rt2x00debug_file_open, \ | 513 | .open = rt2x00debug_file_open, \ |
511 | .release = rt2x00debug_file_release, \ | 514 | .release = rt2x00debug_file_release, \ |
515 | .llseek = generic_file_llseek, \ | ||
512 | }; | 516 | }; |
513 | 517 | ||
514 | RT2X00DEBUGFS_OPS(csr, "0x%.8x\n", u32); | 518 | RT2X00DEBUGFS_OPS(csr, "0x%.8x\n", u32); |
@@ -542,6 +546,7 @@ static const struct file_operations rt2x00debug_fop_dev_flags = { | |||
542 | .read = rt2x00debug_read_dev_flags, | 546 | .read = rt2x00debug_read_dev_flags, |
543 | .open = rt2x00debug_file_open, | 547 | .open = rt2x00debug_file_open, |
544 | .release = rt2x00debug_file_release, | 548 | .release = rt2x00debug_file_release, |
549 | .llseek = default_llseek, | ||
545 | }; | 550 | }; |
546 | 551 | ||
547 | static struct dentry *rt2x00debug_create_file_driver(const char *name, | 552 | static struct dentry *rt2x00debug_create_file_driver(const char *name, |
diff --git a/drivers/net/wireless/rtl818x/rtl8180_dev.c b/drivers/net/wireless/rtl818x/rtl8180_dev.c index b50c39aaec05..30107ce78dfb 100644 --- a/drivers/net/wireless/rtl818x/rtl8180_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180_dev.c | |||
@@ -445,7 +445,7 @@ static int rtl8180_init_rx_ring(struct ieee80211_hw *dev) | |||
445 | &priv->rx_ring_dma); | 445 | &priv->rx_ring_dma); |
446 | 446 | ||
447 | if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) { | 447 | if (!priv->rx_ring || (unsigned long)priv->rx_ring & 0xFF) { |
448 | wiphy_err(dev->wiphy, "cannot allocate rx ring\n"); | 448 | wiphy_err(dev->wiphy, "Cannot allocate RX ring\n"); |
449 | return -ENOMEM; | 449 | return -ENOMEM; |
450 | } | 450 | } |
451 | 451 | ||
@@ -502,7 +502,7 @@ static int rtl8180_init_tx_ring(struct ieee80211_hw *dev, | |||
502 | 502 | ||
503 | ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); | 503 | ring = pci_alloc_consistent(priv->pdev, sizeof(*ring) * entries, &dma); |
504 | if (!ring || (unsigned long)ring & 0xFF) { | 504 | if (!ring || (unsigned long)ring & 0xFF) { |
505 | wiphy_err(dev->wiphy, "cannot allocate tx ring (prio = %d)\n", | 505 | wiphy_err(dev->wiphy, "Cannot allocate TX ring (prio = %d)\n", |
506 | prio); | 506 | prio); |
507 | return -ENOMEM; | 507 | return -ENOMEM; |
508 | } | 508 | } |
@@ -568,7 +568,7 @@ static int rtl8180_start(struct ieee80211_hw *dev) | |||
568 | ret = request_irq(priv->pdev->irq, rtl8180_interrupt, | 568 | ret = request_irq(priv->pdev->irq, rtl8180_interrupt, |
569 | IRQF_SHARED, KBUILD_MODNAME, dev); | 569 | IRQF_SHARED, KBUILD_MODNAME, dev); |
570 | if (ret) { | 570 | if (ret) { |
571 | wiphy_err(dev->wiphy, "failed to register irq handler\n"); | 571 | wiphy_err(dev->wiphy, "failed to register IRQ handler\n"); |
572 | goto err_free_rings; | 572 | goto err_free_rings; |
573 | } | 573 | } |
574 | 574 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c index 5738a55c1b06..98e0351c1dd6 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_dev.c +++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c | |||
@@ -573,7 +573,7 @@ static int rtl8187_cmd_reset(struct ieee80211_hw *dev) | |||
573 | } while (--i); | 573 | } while (--i); |
574 | 574 | ||
575 | if (!i) { | 575 | if (!i) { |
576 | wiphy_err(dev->wiphy, "reset timeout!\n"); | 576 | wiphy_err(dev->wiphy, "Reset timeout!\n"); |
577 | return -ETIMEDOUT; | 577 | return -ETIMEDOUT; |
578 | } | 578 | } |
579 | 579 | ||
@@ -1526,7 +1526,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf, | |||
1526 | mutex_init(&priv->conf_mutex); | 1526 | mutex_init(&priv->conf_mutex); |
1527 | skb_queue_head_init(&priv->b_tx_status.queue); | 1527 | skb_queue_head_init(&priv->b_tx_status.queue); |
1528 | 1528 | ||
1529 | wiphy_info(dev->wiphy, "hwaddr %pm, %s v%d + %s, rfkill mask %d\n", | 1529 | wiphy_info(dev->wiphy, "hwaddr %pM, %s V%d + %s, rfkill mask %d\n", |
1530 | mac_addr, chip_name, priv->asic_rev, priv->rf->name, | 1530 | mac_addr, chip_name, priv->asic_rev, priv->rf->name, |
1531 | priv->rfkill_mask); | 1531 | priv->rfkill_mask); |
1532 | 1532 | ||
diff --git a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c index fd96f9112322..97eebdcf7eb9 100644 --- a/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c +++ b/drivers/net/wireless/rtl818x/rtl8187_rtl8225.c | |||
@@ -366,7 +366,7 @@ static void rtl8225_rf_init(struct ieee80211_hw *dev) | |||
366 | rtl8225_write(dev, 0x02, 0x044d); | 366 | rtl8225_write(dev, 0x02, 0x044d); |
367 | msleep(100); | 367 | msleep(100); |
368 | if (!(rtl8225_read(dev, 6) & (1 << 7))) | 368 | if (!(rtl8225_read(dev, 6) & (1 << 7))) |
369 | wiphy_warn(dev->wiphy, "rf calibration failed! %x\n", | 369 | wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n", |
370 | rtl8225_read(dev, 6)); | 370 | rtl8225_read(dev, 6)); |
371 | } | 371 | } |
372 | 372 | ||
@@ -735,7 +735,7 @@ static void rtl8225z2_rf_init(struct ieee80211_hw *dev) | |||
735 | rtl8225_write(dev, 0x02, 0x044D); | 735 | rtl8225_write(dev, 0x02, 0x044D); |
736 | msleep(100); | 736 | msleep(100); |
737 | if (!(rtl8225_read(dev, 6) & (1 << 7))) | 737 | if (!(rtl8225_read(dev, 6) & (1 << 7))) |
738 | wiphy_warn(dev->wiphy, "rf calibration failed! %x\n", | 738 | wiphy_warn(dev->wiphy, "RF Calibration Failed! %x\n", |
739 | rtl8225_read(dev, 6)); | 739 | rtl8225_read(dev, 6)); |
740 | } | 740 | } |
741 | 741 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1251_debugfs.c b/drivers/net/wireless/wl12xx/wl1251_debugfs.c index 5e4465ac08fa..fa620a5e5303 100644 --- a/drivers/net/wireless/wl12xx/wl1251_debugfs.c +++ b/drivers/net/wireless/wl12xx/wl1251_debugfs.c | |||
@@ -50,6 +50,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
50 | static const struct file_operations name## _ops = { \ | 50 | static const struct file_operations name## _ops = { \ |
51 | .read = name## _read, \ | 51 | .read = name## _read, \ |
52 | .open = wl1251_open_file_generic, \ | 52 | .open = wl1251_open_file_generic, \ |
53 | .llseek = generic_file_llseek, \ | ||
53 | }; | 54 | }; |
54 | 55 | ||
55 | #define DEBUGFS_ADD(name, parent) \ | 56 | #define DEBUGFS_ADD(name, parent) \ |
@@ -86,6 +87,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \ | |||
86 | static const struct file_operations sub## _ ##name## _ops = { \ | 87 | static const struct file_operations sub## _ ##name## _ops = { \ |
87 | .read = sub## _ ##name## _read, \ | 88 | .read = sub## _ ##name## _read, \ |
88 | .open = wl1251_open_file_generic, \ | 89 | .open = wl1251_open_file_generic, \ |
90 | .llseek = generic_file_llseek, \ | ||
89 | }; | 91 | }; |
90 | 92 | ||
91 | #define DEBUGFS_FWSTATS_ADD(sub, name) \ | 93 | #define DEBUGFS_FWSTATS_ADD(sub, name) \ |
@@ -236,6 +238,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, | |||
236 | static const struct file_operations tx_queue_len_ops = { | 238 | static const struct file_operations tx_queue_len_ops = { |
237 | .read = tx_queue_len_read, | 239 | .read = tx_queue_len_read, |
238 | .open = wl1251_open_file_generic, | 240 | .open = wl1251_open_file_generic, |
241 | .llseek = generic_file_llseek, | ||
239 | }; | 242 | }; |
240 | 243 | ||
241 | static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf, | 244 | static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf, |
@@ -257,6 +260,7 @@ static ssize_t tx_queue_status_read(struct file *file, char __user *userbuf, | |||
257 | static const struct file_operations tx_queue_status_ops = { | 260 | static const struct file_operations tx_queue_status_ops = { |
258 | .read = tx_queue_status_read, | 261 | .read = tx_queue_status_read, |
259 | .open = wl1251_open_file_generic, | 262 | .open = wl1251_open_file_generic, |
263 | .llseek = generic_file_llseek, | ||
260 | }; | 264 | }; |
261 | 265 | ||
262 | static void wl1251_debugfs_delete_files(struct wl1251 *wl) | 266 | static void wl1251_debugfs_delete_files(struct wl1251 *wl) |
diff --git a/drivers/net/wireless/wl12xx/wl1271_debugfs.c b/drivers/net/wireless/wl12xx/wl1271_debugfs.c index c239ef4d0b8d..66c2b90ddfd4 100644 --- a/drivers/net/wireless/wl12xx/wl1271_debugfs.c +++ b/drivers/net/wireless/wl12xx/wl1271_debugfs.c | |||
@@ -51,6 +51,7 @@ static ssize_t name## _read(struct file *file, char __user *userbuf, \ | |||
51 | static const struct file_operations name## _ops = { \ | 51 | static const struct file_operations name## _ops = { \ |
52 | .read = name## _read, \ | 52 | .read = name## _read, \ |
53 | .open = wl1271_open_file_generic, \ | 53 | .open = wl1271_open_file_generic, \ |
54 | .llseek = generic_file_llseek, \ | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | #define DEBUGFS_ADD(name, parent) \ | 57 | #define DEBUGFS_ADD(name, parent) \ |
@@ -87,6 +88,7 @@ static ssize_t sub## _ ##name## _read(struct file *file, \ | |||
87 | static const struct file_operations sub## _ ##name## _ops = { \ | 88 | static const struct file_operations sub## _ ##name## _ops = { \ |
88 | .read = sub## _ ##name## _read, \ | 89 | .read = sub## _ ##name## _read, \ |
89 | .open = wl1271_open_file_generic, \ | 90 | .open = wl1271_open_file_generic, \ |
91 | .llseek = generic_file_llseek, \ | ||
90 | }; | 92 | }; |
91 | 93 | ||
92 | #define DEBUGFS_FWSTATS_ADD(sub, name) \ | 94 | #define DEBUGFS_FWSTATS_ADD(sub, name) \ |
@@ -237,6 +239,7 @@ static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf, | |||
237 | static const struct file_operations tx_queue_len_ops = { | 239 | static const struct file_operations tx_queue_len_ops = { |
238 | .read = tx_queue_len_read, | 240 | .read = tx_queue_len_read, |
239 | .open = wl1271_open_file_generic, | 241 | .open = wl1271_open_file_generic, |
242 | .llseek = default_llseek, | ||
240 | }; | 243 | }; |
241 | 244 | ||
242 | static ssize_t gpio_power_read(struct file *file, char __user *user_buf, | 245 | static ssize_t gpio_power_read(struct file *file, char __user *user_buf, |
@@ -291,7 +294,8 @@ out: | |||
291 | static const struct file_operations gpio_power_ops = { | 294 | static const struct file_operations gpio_power_ops = { |
292 | .read = gpio_power_read, | 295 | .read = gpio_power_read, |
293 | .write = gpio_power_write, | 296 | .write = gpio_power_write, |
294 | .open = wl1271_open_file_generic | 297 | .open = wl1271_open_file_generic, |
298 | .llseek = default_llseek, | ||
295 | }; | 299 | }; |
296 | 300 | ||
297 | static void wl1271_debugfs_delete_files(struct wl1271 *wl) | 301 | static void wl1271_debugfs_delete_files(struct wl1271 *wl) |
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index a1cc2d498a1c..ca3f8961fa27 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.h> | ||
52 | #include <pcmcia/cistpl.h> | 51 | #include <pcmcia/cistpl.h> |
53 | #include <pcmcia/cisreg.h> | 52 | #include <pcmcia/cisreg.h> |
54 | #include <pcmcia/ds.h> | 53 | #include <pcmcia/ds.h> |
@@ -78,13 +77,6 @@ | |||
78 | #define WL3501_RESUME 0 | 77 | #define WL3501_RESUME 0 |
79 | #define WL3501_SUSPEND 1 | 78 | #define WL3501_SUSPEND 1 |
80 | 79 | ||
81 | /* | ||
82 | * The event() function is this driver's Card Services event handler. It will | ||
83 | * be called by Card Services when an appropriate card status event is | ||
84 | * received. The config() and release() entry points are used to configure or | ||
85 | * release a socket, in response to card insertion and ejection events. They | ||
86 | * are invoked from the wl24 event handler. | ||
87 | */ | ||
88 | static int wl3501_config(struct pcmcia_device *link); | 80 | static int wl3501_config(struct pcmcia_device *link); |
89 | static void wl3501_release(struct pcmcia_device *link); | 81 | static void wl3501_release(struct pcmcia_device *link); |
90 | 82 | ||
@@ -1869,15 +1861,6 @@ static const struct net_device_ops wl3501_netdev_ops = { | |||
1869 | .ndo_validate_addr = eth_validate_addr, | 1861 | .ndo_validate_addr = eth_validate_addr, |
1870 | }; | 1862 | }; |
1871 | 1863 | ||
1872 | /** | ||
1873 | * wl3501_attach - creates an "instance" of the driver | ||
1874 | * | ||
1875 | * Creates an "instance" of the driver, allocating local data structures for | ||
1876 | * one device. The device is registered with Card Services. | ||
1877 | * | ||
1878 | * The dev_link structure is initialized, but we don't actually configure the | ||
1879 | * card at this point -- we wait until we receive a card insertion event. | ||
1880 | */ | ||
1881 | static int wl3501_probe(struct pcmcia_device *p_dev) | 1864 | static int wl3501_probe(struct pcmcia_device *p_dev) |
1882 | { | 1865 | { |
1883 | struct net_device *dev; | 1866 | struct net_device *dev; |
@@ -1888,9 +1871,8 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
1888 | p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; | 1871 | p_dev->resource[0]->flags = IO_DATA_PATH_WIDTH_8; |
1889 | 1872 | ||
1890 | /* General socket configuration */ | 1873 | /* General socket configuration */ |
1891 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 1874 | p_dev->config_flags = CONF_ENABLE_IRQ; |
1892 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 1875 | p_dev->config_index = 1; |
1893 | p_dev->conf.ConfigIndex = 1; | ||
1894 | 1876 | ||
1895 | dev = alloc_etherdev(sizeof(struct wl3501_card)); | 1877 | dev = alloc_etherdev(sizeof(struct wl3501_card)); |
1896 | if (!dev) | 1878 | if (!dev) |
@@ -1914,14 +1896,6 @@ out_link: | |||
1914 | return -ENOMEM; | 1896 | return -ENOMEM; |
1915 | } | 1897 | } |
1916 | 1898 | ||
1917 | /** | ||
1918 | * wl3501_config - configure the PCMCIA socket and make eth device available | ||
1919 | * @link - FILL_IN | ||
1920 | * | ||
1921 | * wl3501_config() is scheduled to run after a CARD_INSERTION event is | ||
1922 | * received, to configure the PCMCIA socket, and to make the ethernet device | ||
1923 | * available to the system. | ||
1924 | */ | ||
1925 | static int wl3501_config(struct pcmcia_device *link) | 1899 | static int wl3501_config(struct pcmcia_device *link) |
1926 | { | 1900 | { |
1927 | struct net_device *dev = link->priv; | 1901 | struct net_device *dev = link->priv; |
@@ -1952,10 +1926,7 @@ static int wl3501_config(struct pcmcia_device *link) | |||
1952 | if (ret) | 1926 | if (ret) |
1953 | goto failed; | 1927 | goto failed; |
1954 | 1928 | ||
1955 | /* This actually configures the PCMCIA socket -- setting up the I/O | 1929 | ret = pcmcia_enable_device(link); |
1956 | * windows and the interrupt mapping. */ | ||
1957 | |||
1958 | ret = pcmcia_request_configuration(link, &link->conf); | ||
1959 | if (ret) | 1930 | if (ret) |
1960 | goto failed; | 1931 | goto failed; |
1961 | 1932 | ||
@@ -2010,14 +1981,6 @@ failed: | |||
2010 | return -ENODEV; | 1981 | return -ENODEV; |
2011 | } | 1982 | } |
2012 | 1983 | ||
2013 | /** | ||
2014 | * wl3501_release - unregister the net, release PCMCIA configuration | ||
2015 | * @arg - link | ||
2016 | * | ||
2017 | * After a card is removed, wl3501_release() will unregister the net device, | ||
2018 | * and release the PCMCIA configuration. If the device is still open, this | ||
2019 | * will be postponed until it is closed. | ||
2020 | */ | ||
2021 | static void wl3501_release(struct pcmcia_device *link) | 1984 | static void wl3501_release(struct pcmcia_device *link) |
2022 | { | 1985 | { |
2023 | pcmcia_disable_device(link); | 1986 | pcmcia_disable_device(link); |
@@ -2056,9 +2019,7 @@ MODULE_DEVICE_TABLE(pcmcia, wl3501_ids); | |||
2056 | 2019 | ||
2057 | static struct pcmcia_driver wl3501_driver = { | 2020 | static struct pcmcia_driver wl3501_driver = { |
2058 | .owner = THIS_MODULE, | 2021 | .owner = THIS_MODULE, |
2059 | .drv = { | 2022 | .name = "wl3501_cs", |
2060 | .name = "wl3501_cs", | ||
2061 | }, | ||
2062 | .probe = wl3501_probe, | 2023 | .probe = wl3501_probe, |
2063 | .remove = wl3501_detach, | 2024 | .remove = wl3501_detach, |
2064 | .id_table = wl3501_ids, | 2025 | .id_table = wl3501_ids, |