diff options
Diffstat (limited to 'drivers/net')
51 files changed, 1218 insertions, 1658 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index e19ca4bb7510..b2f71f79baaf 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -975,7 +975,7 @@ config ENC28J60_WRITEVERIFY | |||
975 | 975 | ||
976 | config ETHOC | 976 | config ETHOC |
977 | tristate "OpenCores 10/100 Mbps Ethernet MAC support" | 977 | tristate "OpenCores 10/100 Mbps Ethernet MAC support" |
978 | depends on NET_ETHERNET && HAS_IOMEM | 978 | depends on NET_ETHERNET && HAS_IOMEM && HAS_DMA |
979 | select MII | 979 | select MII |
980 | select PHYLIB | 980 | select PHYLIB |
981 | select CRC32 | 981 | select CRC32 |
diff --git a/drivers/net/arm/ep93xx_eth.c b/drivers/net/arm/ep93xx_eth.c index 2be49c817995..b25467ac895c 100644 --- a/drivers/net/arm/ep93xx_eth.c +++ b/drivers/net/arm/ep93xx_eth.c | |||
@@ -628,15 +628,6 @@ static int ep93xx_open(struct net_device *dev) | |||
628 | if (ep93xx_alloc_buffers(ep)) | 628 | if (ep93xx_alloc_buffers(ep)) |
629 | return -ENOMEM; | 629 | return -ENOMEM; |
630 | 630 | ||
631 | if (is_zero_ether_addr(dev->dev_addr)) { | ||
632 | random_ether_addr(dev->dev_addr); | ||
633 | printk(KERN_INFO "%s: generated random MAC address " | ||
634 | "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x.\n", dev->name, | ||
635 | dev->dev_addr[0], dev->dev_addr[1], | ||
636 | dev->dev_addr[2], dev->dev_addr[3], | ||
637 | dev->dev_addr[4], dev->dev_addr[5]); | ||
638 | } | ||
639 | |||
640 | napi_enable(&ep->napi); | 631 | napi_enable(&ep->napi); |
641 | 632 | ||
642 | if (ep93xx_start_hw(dev)) { | 633 | if (ep93xx_start_hw(dev)) { |
@@ -877,6 +868,9 @@ static int ep93xx_eth_probe(struct platform_device *pdev) | |||
877 | ep->mii.mdio_write = ep93xx_mdio_write; | 868 | ep->mii.mdio_write = ep93xx_mdio_write; |
878 | ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */ | 869 | ep->mdc_divisor = 40; /* Max HCLK 100 MHz, min MDIO clk 2.5 MHz. */ |
879 | 870 | ||
871 | if (is_zero_ether_addr(dev->dev_addr)) | ||
872 | random_ether_addr(dev->dev_addr); | ||
873 | |||
880 | err = register_netdev(dev); | 874 | err = register_netdev(dev); |
881 | if (err) { | 875 | if (err) { |
882 | dev_err(&pdev->dev, "Failed to register netdev\n"); | 876 | dev_err(&pdev->dev, "Failed to register netdev\n"); |
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index ce6f1ac25df8..3f4b4300f533 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
@@ -1088,7 +1088,14 @@ static struct net_device * au1000_probe(int port_num) | |||
1088 | return NULL; | 1088 | return NULL; |
1089 | } | 1089 | } |
1090 | 1090 | ||
1091 | if ((err = register_netdev(dev)) != 0) { | 1091 | dev->base_addr = base; |
1092 | dev->irq = irq; | ||
1093 | dev->netdev_ops = &au1000_netdev_ops; | ||
1094 | SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops); | ||
1095 | dev->watchdog_timeo = ETH_TX_TIMEOUT; | ||
1096 | |||
1097 | err = register_netdev(dev); | ||
1098 | if (err != 0) { | ||
1092 | printk(KERN_ERR "%s: Cannot register net device, error %d\n", | 1099 | printk(KERN_ERR "%s: Cannot register net device, error %d\n", |
1093 | DRV_NAME, err); | 1100 | DRV_NAME, err); |
1094 | free_netdev(dev); | 1101 | free_netdev(dev); |
@@ -1209,12 +1216,6 @@ static struct net_device * au1000_probe(int port_num) | |||
1209 | aup->tx_db_inuse[i] = pDB; | 1216 | aup->tx_db_inuse[i] = pDB; |
1210 | } | 1217 | } |
1211 | 1218 | ||
1212 | dev->base_addr = base; | ||
1213 | dev->irq = irq; | ||
1214 | dev->netdev_ops = &au1000_netdev_ops; | ||
1215 | SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops); | ||
1216 | dev->watchdog_timeo = ETH_TX_TIMEOUT; | ||
1217 | |||
1218 | /* | 1219 | /* |
1219 | * The boot code uses the ethernet controller, so reset it to start | 1220 | * The boot code uses the ethernet controller, so reset it to start |
1220 | * fresh. au1000_init() expects that the device is in reset state. | 1221 | * fresh. au1000_init() expects that the device is in reset state. |
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index e046943ef29d..2a9132343b66 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c | |||
@@ -912,9 +912,6 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id) | |||
912 | bp->istat = istat; | 912 | bp->istat = istat; |
913 | __b44_disable_ints(bp); | 913 | __b44_disable_ints(bp); |
914 | __napi_schedule(&bp->napi); | 914 | __napi_schedule(&bp->napi); |
915 | } else { | ||
916 | printk(KERN_ERR PFX "%s: Error, poll already scheduled\n", | ||
917 | dev->name); | ||
918 | } | 915 | } |
919 | 916 | ||
920 | irq_ack: | 917 | irq_ack: |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index db6380379478..e3478314c002 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -164,16 +164,14 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1"; | |||
164 | # define EMAC_MBP_MCASTCHAN(ch) ((ch) & 0x7) | 164 | # define EMAC_MBP_MCASTCHAN(ch) ((ch) & 0x7) |
165 | 165 | ||
166 | /* EMAC mac_control register */ | 166 | /* EMAC mac_control register */ |
167 | #define EMAC_MACCONTROL_TXPTYPE (0x200) | 167 | #define EMAC_MACCONTROL_TXPTYPE BIT(9) |
168 | #define EMAC_MACCONTROL_TXPACEEN (0x40) | 168 | #define EMAC_MACCONTROL_TXPACEEN BIT(6) |
169 | #define EMAC_MACCONTROL_MIIEN (0x20) | 169 | #define EMAC_MACCONTROL_GMIIEN BIT(5) |
170 | #define EMAC_MACCONTROL_GIGABITEN (0x80) | 170 | #define EMAC_MACCONTROL_GIGABITEN BIT(7) |
171 | #define EMAC_MACCONTROL_GIGABITEN_SHIFT (7) | 171 | #define EMAC_MACCONTROL_FULLDUPLEXEN BIT(0) |
172 | #define EMAC_MACCONTROL_FULLDUPLEXEN (0x1) | ||
173 | #define EMAC_MACCONTROL_RMIISPEED_MASK BIT(15) | 172 | #define EMAC_MACCONTROL_RMIISPEED_MASK BIT(15) |
174 | 173 | ||
175 | /* GIGABIT MODE related bits */ | 174 | /* GIGABIT MODE related bits */ |
176 | #define EMAC_DM646X_MACCONTORL_GMIIEN BIT(5) | ||
177 | #define EMAC_DM646X_MACCONTORL_GIG BIT(7) | 175 | #define EMAC_DM646X_MACCONTORL_GIG BIT(7) |
178 | #define EMAC_DM646X_MACCONTORL_GIGFORCE BIT(17) | 176 | #define EMAC_DM646X_MACCONTORL_GIGFORCE BIT(17) |
179 | 177 | ||
@@ -192,10 +190,10 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1"; | |||
192 | #define EMAC_RX_BUFFER_OFFSET_MASK (0xFFFF) | 190 | #define EMAC_RX_BUFFER_OFFSET_MASK (0xFFFF) |
193 | 191 | ||
194 | /* MAC_IN_VECTOR (0x180) register bit fields */ | 192 | /* MAC_IN_VECTOR (0x180) register bit fields */ |
195 | #define EMAC_DM644X_MAC_IN_VECTOR_HOST_INT (0x20000) | 193 | #define EMAC_DM644X_MAC_IN_VECTOR_HOST_INT BIT(17) |
196 | #define EMAC_DM644X_MAC_IN_VECTOR_STATPEND_INT (0x10000) | 194 | #define EMAC_DM644X_MAC_IN_VECTOR_STATPEND_INT BIT(16) |
197 | #define EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC (0x0100) | 195 | #define EMAC_DM644X_MAC_IN_VECTOR_RX_INT_VEC BIT(8) |
198 | #define EMAC_DM644X_MAC_IN_VECTOR_TX_INT_VEC (0x01) | 196 | #define EMAC_DM644X_MAC_IN_VECTOR_TX_INT_VEC BIT(0) |
199 | 197 | ||
200 | /** NOTE:: For DM646x the IN_VECTOR has changed */ | 198 | /** NOTE:: For DM646x the IN_VECTOR has changed */ |
201 | #define EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC BIT(EMAC_DEF_RX_CH) | 199 | #define EMAC_DM646X_MAC_IN_VECTOR_RX_INT_VEC BIT(EMAC_DEF_RX_CH) |
@@ -203,7 +201,6 @@ static const char emac_version_string[] = "TI DaVinci EMAC Linux v6.1"; | |||
203 | #define EMAC_DM646X_MAC_IN_VECTOR_HOST_INT BIT(26) | 201 | #define EMAC_DM646X_MAC_IN_VECTOR_HOST_INT BIT(26) |
204 | #define EMAC_DM646X_MAC_IN_VECTOR_STATPEND_INT BIT(27) | 202 | #define EMAC_DM646X_MAC_IN_VECTOR_STATPEND_INT BIT(27) |
205 | 203 | ||
206 | |||
207 | /* CPPI bit positions */ | 204 | /* CPPI bit positions */ |
208 | #define EMAC_CPPI_SOP_BIT BIT(31) | 205 | #define EMAC_CPPI_SOP_BIT BIT(31) |
209 | #define EMAC_CPPI_EOP_BIT BIT(30) | 206 | #define EMAC_CPPI_EOP_BIT BIT(30) |
@@ -750,8 +747,7 @@ static void emac_update_phystatus(struct emac_priv *priv) | |||
750 | 747 | ||
751 | if (priv->speed == SPEED_1000 && (priv->version == EMAC_VERSION_2)) { | 748 | if (priv->speed == SPEED_1000 && (priv->version == EMAC_VERSION_2)) { |
752 | mac_control = emac_read(EMAC_MACCONTROL); | 749 | mac_control = emac_read(EMAC_MACCONTROL); |
753 | mac_control |= (EMAC_DM646X_MACCONTORL_GMIIEN | | 750 | mac_control |= (EMAC_DM646X_MACCONTORL_GIG | |
754 | EMAC_DM646X_MACCONTORL_GIG | | ||
755 | EMAC_DM646X_MACCONTORL_GIGFORCE); | 751 | EMAC_DM646X_MACCONTORL_GIGFORCE); |
756 | } else { | 752 | } else { |
757 | /* Clear the GIG bit and GIGFORCE bit */ | 753 | /* Clear the GIG bit and GIGFORCE bit */ |
@@ -2108,7 +2104,7 @@ static int emac_hw_enable(struct emac_priv *priv) | |||
2108 | 2104 | ||
2109 | /* Enable MII */ | 2105 | /* Enable MII */ |
2110 | val = emac_read(EMAC_MACCONTROL); | 2106 | val = emac_read(EMAC_MACCONTROL); |
2111 | val |= (EMAC_MACCONTROL_MIIEN); | 2107 | val |= (EMAC_MACCONTROL_GMIIEN); |
2112 | emac_write(EMAC_MACCONTROL, val); | 2108 | emac_write(EMAC_MACCONTROL, val); |
2113 | 2109 | ||
2114 | /* Enable NAPI and interrupts */ | 2110 | /* Enable NAPI and interrupts */ |
diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 3c29a20b751e..d269a68ce354 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c | |||
@@ -157,6 +157,7 @@ | |||
157 | #include <linux/init.h> | 157 | #include <linux/init.h> |
158 | #include <linux/pci.h> | 158 | #include <linux/pci.h> |
159 | #include <linux/dma-mapping.h> | 159 | #include <linux/dma-mapping.h> |
160 | #include <linux/dmapool.h> | ||
160 | #include <linux/netdevice.h> | 161 | #include <linux/netdevice.h> |
161 | #include <linux/etherdevice.h> | 162 | #include <linux/etherdevice.h> |
162 | #include <linux/mii.h> | 163 | #include <linux/mii.h> |
@@ -602,6 +603,7 @@ struct nic { | |||
602 | struct mem *mem; | 603 | struct mem *mem; |
603 | dma_addr_t dma_addr; | 604 | dma_addr_t dma_addr; |
604 | 605 | ||
606 | struct pci_pool *cbs_pool; | ||
605 | dma_addr_t cbs_dma_addr; | 607 | dma_addr_t cbs_dma_addr; |
606 | u8 adaptive_ifs; | 608 | u8 adaptive_ifs; |
607 | u8 tx_threshold; | 609 | u8 tx_threshold; |
@@ -1793,9 +1795,7 @@ static void e100_clean_cbs(struct nic *nic) | |||
1793 | nic->cb_to_clean = nic->cb_to_clean->next; | 1795 | nic->cb_to_clean = nic->cb_to_clean->next; |
1794 | nic->cbs_avail++; | 1796 | nic->cbs_avail++; |
1795 | } | 1797 | } |
1796 | pci_free_consistent(nic->pdev, | 1798 | pci_pool_free(nic->cbs_pool, nic->cbs, nic->cbs_dma_addr); |
1797 | sizeof(struct cb) * nic->params.cbs.count, | ||
1798 | nic->cbs, nic->cbs_dma_addr); | ||
1799 | nic->cbs = NULL; | 1799 | nic->cbs = NULL; |
1800 | nic->cbs_avail = 0; | 1800 | nic->cbs_avail = 0; |
1801 | } | 1801 | } |
@@ -1813,8 +1813,8 @@ static int e100_alloc_cbs(struct nic *nic) | |||
1813 | nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL; | 1813 | nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL; |
1814 | nic->cbs_avail = 0; | 1814 | nic->cbs_avail = 0; |
1815 | 1815 | ||
1816 | nic->cbs = pci_alloc_consistent(nic->pdev, | 1816 | nic->cbs = pci_pool_alloc(nic->cbs_pool, GFP_KERNEL, |
1817 | sizeof(struct cb) * count, &nic->cbs_dma_addr); | 1817 | &nic->cbs_dma_addr); |
1818 | if (!nic->cbs) | 1818 | if (!nic->cbs) |
1819 | return -ENOMEM; | 1819 | return -ENOMEM; |
1820 | 1820 | ||
@@ -2841,7 +2841,11 @@ static int __devinit e100_probe(struct pci_dev *pdev, | |||
2841 | DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); | 2841 | DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); |
2842 | goto err_out_free; | 2842 | goto err_out_free; |
2843 | } | 2843 | } |
2844 | 2844 | nic->cbs_pool = pci_pool_create(netdev->name, | |
2845 | nic->pdev, | ||
2846 | nic->params.cbs.count * sizeof(struct cb), | ||
2847 | sizeof(u32), | ||
2848 | 0); | ||
2845 | DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", | 2849 | DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n", |
2846 | (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), | 2850 | (unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0), |
2847 | pdev->irq, netdev->dev_addr); | 2851 | pdev->irq, netdev->dev_addr); |
@@ -2871,6 +2875,7 @@ static void __devexit e100_remove(struct pci_dev *pdev) | |||
2871 | unregister_netdev(netdev); | 2875 | unregister_netdev(netdev); |
2872 | e100_free(nic); | 2876 | e100_free(nic); |
2873 | pci_iounmap(pdev, nic->csr); | 2877 | pci_iounmap(pdev, nic->csr); |
2878 | pci_pool_destroy(nic->cbs_pool); | ||
2874 | free_netdev(netdev); | 2879 | free_netdev(netdev); |
2875 | pci_release_regions(pdev); | 2880 | pci_release_regions(pdev); |
2876 | pci_disable_device(pdev); | 2881 | pci_disable_device(pdev); |
diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h index 189dfa2d6c76..3e187b0e4203 100644 --- a/drivers/net/e1000e/e1000.h +++ b/drivers/net/e1000e/e1000.h | |||
@@ -141,6 +141,8 @@ struct e1000_info; | |||
141 | #define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */ | 141 | #define HV_TNCRS_UPPER PHY_REG(778, 29) /* Transmit with no CRS */ |
142 | #define HV_TNCRS_LOWER PHY_REG(778, 30) | 142 | #define HV_TNCRS_LOWER PHY_REG(778, 30) |
143 | 143 | ||
144 | #define E1000_FCRTV_PCH 0x05F40 /* PCH Flow Control Refresh Timer Value */ | ||
145 | |||
144 | /* BM PHY Copper Specific Status */ | 146 | /* BM PHY Copper Specific Status */ |
145 | #define BM_CS_STATUS 17 | 147 | #define BM_CS_STATUS 17 |
146 | #define BM_CS_STATUS_LINK_UP 0x0400 | 148 | #define BM_CS_STATUS_LINK_UP 0x0400 |
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c index 1bf4d2a5d34f..e82638ecae88 100644 --- a/drivers/net/e1000e/ethtool.c +++ b/drivers/net/e1000e/ethtool.c | |||
@@ -327,10 +327,18 @@ static int e1000_set_pauseparam(struct net_device *netdev, | |||
327 | 327 | ||
328 | hw->fc.current_mode = hw->fc.requested_mode; | 328 | hw->fc.current_mode = hw->fc.requested_mode; |
329 | 329 | ||
330 | retval = ((hw->phy.media_type == e1000_media_type_fiber) ? | 330 | if (hw->phy.media_type == e1000_media_type_fiber) { |
331 | hw->mac.ops.setup_link(hw) : e1000e_force_mac_fc(hw)); | 331 | retval = hw->mac.ops.setup_link(hw); |
332 | /* implicit goto out */ | ||
333 | } else { | ||
334 | retval = e1000e_force_mac_fc(hw); | ||
335 | if (retval) | ||
336 | goto out; | ||
337 | e1000e_set_fc_watermarks(hw); | ||
338 | } | ||
332 | } | 339 | } |
333 | 340 | ||
341 | out: | ||
334 | clear_bit(__E1000_RESETTING, &adapter->state); | 342 | clear_bit(__E1000_RESETTING, &adapter->state); |
335 | return retval; | 343 | return retval; |
336 | } | 344 | } |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 51ddb04ab195..eff3f4783655 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -1118,7 +1118,8 @@ static s32 e1000_oem_bits_config_ich8lan(struct e1000_hw *hw, bool d0_state) | |||
1118 | oem_reg |= HV_OEM_BITS_LPLU; | 1118 | oem_reg |= HV_OEM_BITS_LPLU; |
1119 | } | 1119 | } |
1120 | /* Restart auto-neg to activate the bits */ | 1120 | /* Restart auto-neg to activate the bits */ |
1121 | oem_reg |= HV_OEM_BITS_RESTART_AN; | 1121 | if (!e1000_check_reset_block(hw)) |
1122 | oem_reg |= HV_OEM_BITS_RESTART_AN; | ||
1122 | ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg); | 1123 | ret_val = hw->phy.ops.write_phy_reg_locked(hw, HV_OEM_BITS, oem_reg); |
1123 | 1124 | ||
1124 | out: | 1125 | out: |
@@ -3558,6 +3559,7 @@ struct e1000_info e1000_pch_info = { | |||
3558 | | FLAG_HAS_AMT | 3559 | | FLAG_HAS_AMT |
3559 | | FLAG_HAS_FLASH | 3560 | | FLAG_HAS_FLASH |
3560 | | FLAG_HAS_JUMBO_FRAMES | 3561 | | FLAG_HAS_JUMBO_FRAMES |
3562 | | FLAG_DISABLE_FC_PAUSE_TIME /* errata */ | ||
3561 | | FLAG_APME_IN_WUC, | 3563 | | FLAG_APME_IN_WUC, |
3562 | .pba = 26, | 3564 | .pba = 26, |
3563 | .max_hw_frame_size = 4096, | 3565 | .max_hw_frame_size = 4096, |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 0687c6aa4e46..fad8f9ea0043 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -2769,25 +2769,38 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2769 | /* | 2769 | /* |
2770 | * flow control settings | 2770 | * flow control settings |
2771 | * | 2771 | * |
2772 | * The high water mark must be low enough to fit two full frame | 2772 | * The high water mark must be low enough to fit one full frame |
2773 | * (or the size used for early receive) above it in the Rx FIFO. | 2773 | * (or the size used for early receive) above it in the Rx FIFO. |
2774 | * Set it to the lower of: | 2774 | * Set it to the lower of: |
2775 | * - 90% of the Rx FIFO size, and | 2775 | * - 90% of the Rx FIFO size, and |
2776 | * - the full Rx FIFO size minus the early receive size (for parts | 2776 | * - the full Rx FIFO size minus the early receive size (for parts |
2777 | * with ERT support assuming ERT set to E1000_ERT_2048), or | 2777 | * with ERT support assuming ERT set to E1000_ERT_2048), or |
2778 | * - the full Rx FIFO size minus two full frames | 2778 | * - the full Rx FIFO size minus one full frame |
2779 | */ | 2779 | */ |
2780 | if ((adapter->flags & FLAG_HAS_ERT) && | 2780 | if (hw->mac.type == e1000_pchlan) { |
2781 | (adapter->netdev->mtu > ETH_DATA_LEN)) | 2781 | /* |
2782 | hwm = min(((pba << 10) * 9 / 10), | 2782 | * Workaround PCH LOM adapter hangs with certain network |
2783 | ((pba << 10) - (E1000_ERT_2048 << 3))); | 2783 | * loads. If hangs persist, try disabling Tx flow control. |
2784 | else | 2784 | */ |
2785 | hwm = min(((pba << 10) * 9 / 10), | 2785 | if (adapter->netdev->mtu > ETH_DATA_LEN) { |
2786 | ((pba << 10) - (2 * adapter->max_frame_size))); | 2786 | fc->high_water = 0x3500; |
2787 | fc->low_water = 0x1500; | ||
2788 | } else { | ||
2789 | fc->high_water = 0x5000; | ||
2790 | fc->low_water = 0x3000; | ||
2791 | } | ||
2792 | } else { | ||
2793 | if ((adapter->flags & FLAG_HAS_ERT) && | ||
2794 | (adapter->netdev->mtu > ETH_DATA_LEN)) | ||
2795 | hwm = min(((pba << 10) * 9 / 10), | ||
2796 | ((pba << 10) - (E1000_ERT_2048 << 3))); | ||
2797 | else | ||
2798 | hwm = min(((pba << 10) * 9 / 10), | ||
2799 | ((pba << 10) - adapter->max_frame_size)); | ||
2787 | 2800 | ||
2788 | fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */ | 2801 | fc->high_water = hwm & E1000_FCRTH_RTH; /* 8-byte granularity */ |
2789 | fc->low_water = (fc->high_water - (2 * adapter->max_frame_size)); | 2802 | fc->low_water = fc->high_water - 8; |
2790 | fc->low_water &= E1000_FCRTL_RTL; /* 8-byte granularity */ | 2803 | } |
2791 | 2804 | ||
2792 | if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) | 2805 | if (adapter->flags & FLAG_DISABLE_FC_PAUSE_TIME) |
2793 | fc->pause_time = 0xFFFF; | 2806 | fc->pause_time = 0xFFFF; |
@@ -2813,6 +2826,10 @@ void e1000e_reset(struct e1000_adapter *adapter) | |||
2813 | if (mac->ops.init_hw(hw)) | 2826 | if (mac->ops.init_hw(hw)) |
2814 | e_err("Hardware Error\n"); | 2827 | e_err("Hardware Error\n"); |
2815 | 2828 | ||
2829 | /* additional part of the flow-control workaround above */ | ||
2830 | if (hw->mac.type == e1000_pchlan) | ||
2831 | ew32(FCRTV_PCH, 0x1000); | ||
2832 | |||
2816 | e1000_update_mng_vlan(adapter); | 2833 | e1000_update_mng_vlan(adapter); |
2817 | 2834 | ||
2818 | /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ | 2835 | /* Enable h/w to recognize an 802.1Q VLAN Ethernet packet */ |
@@ -3610,7 +3627,7 @@ static void e1000_watchdog_task(struct work_struct *work) | |||
3610 | case SPEED_100: | 3627 | case SPEED_100: |
3611 | txb2b = 0; | 3628 | txb2b = 0; |
3612 | netdev->tx_queue_len = 100; | 3629 | netdev->tx_queue_len = 100; |
3613 | /* maybe add some timeout factor ? */ | 3630 | adapter->tx_timeout_factor = 10; |
3614 | break; | 3631 | break; |
3615 | } | 3632 | } |
3616 | 3633 | ||
@@ -4288,8 +4305,10 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
4288 | 4305 | ||
4289 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) | 4306 | while (test_and_set_bit(__E1000_RESETTING, &adapter->state)) |
4290 | msleep(1); | 4307 | msleep(1); |
4291 | /* e1000e_down has a dependency on max_frame_size */ | 4308 | /* e1000e_down -> e1000e_reset dependent on max_frame_size & mtu */ |
4292 | adapter->max_frame_size = max_frame; | 4309 | adapter->max_frame_size = max_frame; |
4310 | e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); | ||
4311 | netdev->mtu = new_mtu; | ||
4293 | if (netif_running(netdev)) | 4312 | if (netif_running(netdev)) |
4294 | e1000e_down(adapter); | 4313 | e1000e_down(adapter); |
4295 | 4314 | ||
@@ -4319,9 +4338,6 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu) | |||
4319 | adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN | 4338 | adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN |
4320 | + ETH_FCS_LEN; | 4339 | + ETH_FCS_LEN; |
4321 | 4340 | ||
4322 | e_info("changing MTU from %d to %d\n", netdev->mtu, new_mtu); | ||
4323 | netdev->mtu = new_mtu; | ||
4324 | |||
4325 | if (netif_running(netdev)) | 4341 | if (netif_running(netdev)) |
4326 | e1000e_up(adapter); | 4342 | e1000e_up(adapter); |
4327 | else | 4343 | else |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index 03175b3a2c9e..85f955f70417 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -71,7 +71,6 @@ static const u16 e1000_igp_2_cable_length_table[] = | |||
71 | #define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15) | 71 | #define I82577_CFG_ASSERT_CRS_ON_TX (1 << 15) |
72 | #define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */ | 72 | #define I82577_CFG_ENABLE_DOWNSHIFT (3 << 10) /* auto downshift 100/10 */ |
73 | #define I82577_CTRL_REG 23 | 73 | #define I82577_CTRL_REG 23 |
74 | #define I82577_CTRL_DOWNSHIFT_MASK (7 << 10) | ||
75 | 74 | ||
76 | /* 82577 specific PHY registers */ | 75 | /* 82577 specific PHY registers */ |
77 | #define I82577_PHY_CTRL_2 18 | 76 | #define I82577_PHY_CTRL_2 18 |
@@ -660,15 +659,6 @@ s32 e1000_copper_link_setup_82577(struct e1000_hw *hw) | |||
660 | phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; | 659 | phy_data |= I82577_CFG_ENABLE_DOWNSHIFT; |
661 | 660 | ||
662 | ret_val = phy->ops.write_phy_reg(hw, I82577_CFG_REG, phy_data); | 661 | ret_val = phy->ops.write_phy_reg(hw, I82577_CFG_REG, phy_data); |
663 | if (ret_val) | ||
664 | goto out; | ||
665 | |||
666 | /* Set number of link attempts before downshift */ | ||
667 | ret_val = phy->ops.read_phy_reg(hw, I82577_CTRL_REG, &phy_data); | ||
668 | if (ret_val) | ||
669 | goto out; | ||
670 | phy_data &= ~I82577_CTRL_DOWNSHIFT_MASK; | ||
671 | ret_val = phy->ops.write_phy_reg(hw, I82577_CTRL_REG, phy_data); | ||
672 | 662 | ||
673 | out: | 663 | out: |
674 | return ret_val; | 664 | return ret_val; |
@@ -2658,19 +2648,18 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, | |||
2658 | page = 0; | 2648 | page = 0; |
2659 | 2649 | ||
2660 | if (reg > MAX_PHY_MULTI_PAGE_REG) { | 2650 | if (reg > MAX_PHY_MULTI_PAGE_REG) { |
2661 | if ((hw->phy.type != e1000_phy_82578) || | 2651 | u32 phy_addr = hw->phy.addr; |
2662 | ((reg != I82578_ADDR_REG) && | ||
2663 | (reg != I82578_ADDR_REG + 1))) { | ||
2664 | u32 phy_addr = hw->phy.addr; | ||
2665 | 2652 | ||
2666 | hw->phy.addr = 1; | 2653 | hw->phy.addr = 1; |
2667 | 2654 | ||
2668 | /* Page is shifted left, PHY expects (page x 32) */ | 2655 | /* Page is shifted left, PHY expects (page x 32) */ |
2669 | ret_val = e1000e_write_phy_reg_mdic(hw, | 2656 | ret_val = e1000e_write_phy_reg_mdic(hw, |
2670 | IGP01E1000_PHY_PAGE_SELECT, | 2657 | IGP01E1000_PHY_PAGE_SELECT, |
2671 | (page << IGP_PAGE_SHIFT)); | 2658 | (page << IGP_PAGE_SHIFT)); |
2672 | hw->phy.addr = phy_addr; | 2659 | hw->phy.addr = phy_addr; |
2673 | } | 2660 | |
2661 | if (ret_val) | ||
2662 | goto out; | ||
2674 | } | 2663 | } |
2675 | 2664 | ||
2676 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, | 2665 | ret_val = e1000e_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, |
@@ -2678,7 +2667,7 @@ static s32 __e1000_read_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 *data, | |||
2678 | out: | 2667 | out: |
2679 | /* Revert to MDIO fast mode, if applicable */ | 2668 | /* Revert to MDIO fast mode, if applicable */ |
2680 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) | 2669 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) |
2681 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); | 2670 | ret_val |= e1000_set_mdio_slow_mode_hv(hw, false); |
2682 | 2671 | ||
2683 | if (!locked) | 2672 | if (!locked) |
2684 | hw->phy.ops.release_phy(hw); | 2673 | hw->phy.ops.release_phy(hw); |
@@ -2784,19 +2773,18 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, | |||
2784 | } | 2773 | } |
2785 | 2774 | ||
2786 | if (reg > MAX_PHY_MULTI_PAGE_REG) { | 2775 | if (reg > MAX_PHY_MULTI_PAGE_REG) { |
2787 | if ((hw->phy.type != e1000_phy_82578) || | 2776 | u32 phy_addr = hw->phy.addr; |
2788 | ((reg != I82578_ADDR_REG) && | ||
2789 | (reg != I82578_ADDR_REG + 1))) { | ||
2790 | u32 phy_addr = hw->phy.addr; | ||
2791 | 2777 | ||
2792 | hw->phy.addr = 1; | 2778 | hw->phy.addr = 1; |
2793 | 2779 | ||
2794 | /* Page is shifted left, PHY expects (page x 32) */ | 2780 | /* Page is shifted left, PHY expects (page x 32) */ |
2795 | ret_val = e1000e_write_phy_reg_mdic(hw, | 2781 | ret_val = e1000e_write_phy_reg_mdic(hw, |
2796 | IGP01E1000_PHY_PAGE_SELECT, | 2782 | IGP01E1000_PHY_PAGE_SELECT, |
2797 | (page << IGP_PAGE_SHIFT)); | 2783 | (page << IGP_PAGE_SHIFT)); |
2798 | hw->phy.addr = phy_addr; | 2784 | hw->phy.addr = phy_addr; |
2799 | } | 2785 | |
2786 | if (ret_val) | ||
2787 | goto out; | ||
2800 | } | 2788 | } |
2801 | 2789 | ||
2802 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, | 2790 | ret_val = e1000e_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & reg, |
@@ -2805,7 +2793,7 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data, | |||
2805 | out: | 2793 | out: |
2806 | /* Revert to MDIO fast mode, if applicable */ | 2794 | /* Revert to MDIO fast mode, if applicable */ |
2807 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) | 2795 | if ((hw->phy.type == e1000_phy_82577) && in_slow_mode) |
2808 | ret_val = e1000_set_mdio_slow_mode_hv(hw, false); | 2796 | ret_val |= e1000_set_mdio_slow_mode_hv(hw, false); |
2809 | 2797 | ||
2810 | if (!locked) | 2798 | if (!locked) |
2811 | hw->phy.ops.release_phy(hw); | 2799 | hw->phy.ops.release_phy(hw); |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index a5036f7c1923..a456578b8578 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -240,11 +240,11 @@ static void ixgbe_unmap_and_free_tx_resource(struct ixgbe_adapter *adapter, | |||
240 | static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter, | 240 | static inline bool ixgbe_tx_is_paused(struct ixgbe_adapter *adapter, |
241 | struct ixgbe_ring *tx_ring) | 241 | struct ixgbe_ring *tx_ring) |
242 | { | 242 | { |
243 | int tc; | ||
244 | u32 txoff = IXGBE_TFCS_TXOFF; | 243 | u32 txoff = IXGBE_TFCS_TXOFF; |
245 | 244 | ||
246 | #ifdef CONFIG_IXGBE_DCB | 245 | #ifdef CONFIG_IXGBE_DCB |
247 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { | 246 | if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) { |
247 | int tc; | ||
248 | int reg_idx = tx_ring->reg_idx; | 248 | int reg_idx = tx_ring->reg_idx; |
249 | int dcb_i = adapter->ring_feature[RING_F_DCB].indices; | 249 | int dcb_i = adapter->ring_feature[RING_F_DCB].indices; |
250 | 250 | ||
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c index 0be14d702beb..c146304d8d6c 100644 --- a/drivers/net/ks8851_mll.c +++ b/drivers/net/ks8851_mll.c | |||
@@ -568,6 +568,16 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len) | |||
568 | iowrite16(*wptr++, ks->hw_addr); | 568 | iowrite16(*wptr++, ks->hw_addr); |
569 | } | 569 | } |
570 | 570 | ||
571 | static void ks_disable_int(struct ks_net *ks) | ||
572 | { | ||
573 | ks_wrreg16(ks, KS_IER, 0x0000); | ||
574 | } /* ks_disable_int */ | ||
575 | |||
576 | static void ks_enable_int(struct ks_net *ks) | ||
577 | { | ||
578 | ks_wrreg16(ks, KS_IER, ks->rc_ier); | ||
579 | } /* ks_enable_int */ | ||
580 | |||
571 | /** | 581 | /** |
572 | * ks_tx_fifo_space - return the available hardware buffer size. | 582 | * ks_tx_fifo_space - return the available hardware buffer size. |
573 | * @ks: The chip information | 583 | * @ks: The chip information |
@@ -681,6 +691,47 @@ static void ks_soft_reset(struct ks_net *ks, unsigned op) | |||
681 | } | 691 | } |
682 | 692 | ||
683 | 693 | ||
694 | void ks_enable_qmu(struct ks_net *ks) | ||
695 | { | ||
696 | u16 w; | ||
697 | |||
698 | w = ks_rdreg16(ks, KS_TXCR); | ||
699 | /* Enables QMU Transmit (TXCR). */ | ||
700 | ks_wrreg16(ks, KS_TXCR, w | TXCR_TXE); | ||
701 | |||
702 | /* | ||
703 | * RX Frame Count Threshold Enable and Auto-Dequeue RXQ Frame | ||
704 | * Enable | ||
705 | */ | ||
706 | |||
707 | w = ks_rdreg16(ks, KS_RXQCR); | ||
708 | ks_wrreg16(ks, KS_RXQCR, w | RXQCR_RXFCTE); | ||
709 | |||
710 | /* Enables QMU Receive (RXCR1). */ | ||
711 | w = ks_rdreg16(ks, KS_RXCR1); | ||
712 | ks_wrreg16(ks, KS_RXCR1, w | RXCR1_RXE); | ||
713 | ks->enabled = true; | ||
714 | } /* ks_enable_qmu */ | ||
715 | |||
716 | static void ks_disable_qmu(struct ks_net *ks) | ||
717 | { | ||
718 | u16 w; | ||
719 | |||
720 | w = ks_rdreg16(ks, KS_TXCR); | ||
721 | |||
722 | /* Disables QMU Transmit (TXCR). */ | ||
723 | w &= ~TXCR_TXE; | ||
724 | ks_wrreg16(ks, KS_TXCR, w); | ||
725 | |||
726 | /* Disables QMU Receive (RXCR1). */ | ||
727 | w = ks_rdreg16(ks, KS_RXCR1); | ||
728 | w &= ~RXCR1_RXE ; | ||
729 | ks_wrreg16(ks, KS_RXCR1, w); | ||
730 | |||
731 | ks->enabled = false; | ||
732 | |||
733 | } /* ks_disable_qmu */ | ||
734 | |||
684 | /** | 735 | /** |
685 | * ks_read_qmu - read 1 pkt data from the QMU. | 736 | * ks_read_qmu - read 1 pkt data from the QMU. |
686 | * @ks: The chip information | 737 | * @ks: The chip information |
@@ -752,7 +803,7 @@ static void ks_rcv(struct ks_net *ks, struct net_device *netdev) | |||
752 | (frame_hdr->len < RX_BUF_SIZE) && frame_hdr->len)) { | 803 | (frame_hdr->len < RX_BUF_SIZE) && frame_hdr->len)) { |
753 | skb_reserve(skb, 2); | 804 | skb_reserve(skb, 2); |
754 | /* read data block including CRC 4 bytes */ | 805 | /* read data block including CRC 4 bytes */ |
755 | ks_read_qmu(ks, (u16 *)skb->data, frame_hdr->len + 4); | 806 | ks_read_qmu(ks, (u16 *)skb->data, frame_hdr->len); |
756 | skb_put(skb, frame_hdr->len); | 807 | skb_put(skb, frame_hdr->len); |
757 | skb->dev = netdev; | 808 | skb->dev = netdev; |
758 | skb->protocol = eth_type_trans(skb, netdev); | 809 | skb->protocol = eth_type_trans(skb, netdev); |
@@ -861,7 +912,7 @@ static int ks_net_open(struct net_device *netdev) | |||
861 | ks_dbg(ks, "%s - entry\n", __func__); | 912 | ks_dbg(ks, "%s - entry\n", __func__); |
862 | 913 | ||
863 | /* reset the HW */ | 914 | /* reset the HW */ |
864 | err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, ks); | 915 | err = request_irq(ks->irq, ks_irq, KS_INT_FLAGS, DRV_NAME, netdev); |
865 | 916 | ||
866 | if (err) { | 917 | if (err) { |
867 | printk(KERN_ERR "Failed to request IRQ: %d: %d\n", | 918 | printk(KERN_ERR "Failed to request IRQ: %d: %d\n", |
@@ -869,6 +920,15 @@ static int ks_net_open(struct net_device *netdev) | |||
869 | return err; | 920 | return err; |
870 | } | 921 | } |
871 | 922 | ||
923 | /* wake up powermode to normal mode */ | ||
924 | ks_set_powermode(ks, PMECR_PM_NORMAL); | ||
925 | mdelay(1); /* wait for normal mode to take effect */ | ||
926 | |||
927 | ks_wrreg16(ks, KS_ISR, 0xffff); | ||
928 | ks_enable_int(ks); | ||
929 | ks_enable_qmu(ks); | ||
930 | netif_start_queue(ks->netdev); | ||
931 | |||
872 | if (netif_msg_ifup(ks)) | 932 | if (netif_msg_ifup(ks)) |
873 | ks_dbg(ks, "network device %s up\n", netdev->name); | 933 | ks_dbg(ks, "network device %s up\n", netdev->name); |
874 | 934 | ||
@@ -892,19 +952,14 @@ static int ks_net_stop(struct net_device *netdev) | |||
892 | 952 | ||
893 | netif_stop_queue(netdev); | 953 | netif_stop_queue(netdev); |
894 | 954 | ||
895 | kfree(ks->frame_head_info); | ||
896 | |||
897 | mutex_lock(&ks->lock); | 955 | mutex_lock(&ks->lock); |
898 | 956 | ||
899 | /* turn off the IRQs and ack any outstanding */ | 957 | /* turn off the IRQs and ack any outstanding */ |
900 | ks_wrreg16(ks, KS_IER, 0x0000); | 958 | ks_wrreg16(ks, KS_IER, 0x0000); |
901 | ks_wrreg16(ks, KS_ISR, 0xffff); | 959 | ks_wrreg16(ks, KS_ISR, 0xffff); |
902 | 960 | ||
903 | /* shutdown RX process */ | 961 | /* shutdown RX/TX QMU */ |
904 | ks_wrreg16(ks, KS_RXCR1, 0x0000); | 962 | ks_disable_qmu(ks); |
905 | |||
906 | /* shutdown TX process */ | ||
907 | ks_wrreg16(ks, KS_TXCR, 0x0000); | ||
908 | 963 | ||
909 | /* set powermode to soft power down to save power */ | 964 | /* set powermode to soft power down to save power */ |
910 | ks_set_powermode(ks, PMECR_PM_SOFTDOWN); | 965 | ks_set_powermode(ks, PMECR_PM_SOFTDOWN); |
@@ -929,17 +984,8 @@ static int ks_net_stop(struct net_device *netdev) | |||
929 | */ | 984 | */ |
930 | static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) | 985 | static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) |
931 | { | 986 | { |
932 | unsigned fid = ks->fid; | ||
933 | |||
934 | fid = ks->fid; | ||
935 | ks->fid = (ks->fid + 1) & TXFR_TXFID_MASK; | ||
936 | |||
937 | /* reduce the tx interrupt occurrances. */ | ||
938 | if (!fid) | ||
939 | fid |= TXFR_TXIC; /* irq on completion */ | ||
940 | |||
941 | /* start header at txb[0] to align txw entries */ | 987 | /* start header at txb[0] to align txw entries */ |
942 | ks->txh.txw[0] = cpu_to_le16(fid); | 988 | ks->txh.txw[0] = 0; |
943 | ks->txh.txw[1] = cpu_to_le16(len); | 989 | ks->txh.txw[1] = cpu_to_le16(len); |
944 | 990 | ||
945 | /* 1. set sudo-DMA mode */ | 991 | /* 1. set sudo-DMA mode */ |
@@ -957,16 +1003,6 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len) | |||
957 | ; | 1003 | ; |
958 | } | 1004 | } |
959 | 1005 | ||
960 | static void ks_disable_int(struct ks_net *ks) | ||
961 | { | ||
962 | ks_wrreg16(ks, KS_IER, 0x0000); | ||
963 | } /* ks_disable_int */ | ||
964 | |||
965 | static void ks_enable_int(struct ks_net *ks) | ||
966 | { | ||
967 | ks_wrreg16(ks, KS_IER, ks->rc_ier); | ||
968 | } /* ks_enable_int */ | ||
969 | |||
970 | /** | 1006 | /** |
971 | * ks_start_xmit - transmit packet | 1007 | * ks_start_xmit - transmit packet |
972 | * @skb : The buffer to transmit | 1008 | * @skb : The buffer to transmit |
@@ -1410,25 +1446,6 @@ static int ks_read_selftest(struct ks_net *ks) | |||
1410 | return ret; | 1446 | return ret; |
1411 | } | 1447 | } |
1412 | 1448 | ||
1413 | static void ks_disable(struct ks_net *ks) | ||
1414 | { | ||
1415 | u16 w; | ||
1416 | |||
1417 | w = ks_rdreg16(ks, KS_TXCR); | ||
1418 | |||
1419 | /* Disables QMU Transmit (TXCR). */ | ||
1420 | w &= ~TXCR_TXE; | ||
1421 | ks_wrreg16(ks, KS_TXCR, w); | ||
1422 | |||
1423 | /* Disables QMU Receive (RXCR1). */ | ||
1424 | w = ks_rdreg16(ks, KS_RXCR1); | ||
1425 | w &= ~RXCR1_RXE ; | ||
1426 | ks_wrreg16(ks, KS_RXCR1, w); | ||
1427 | |||
1428 | ks->enabled = false; | ||
1429 | |||
1430 | } /* ks_disable */ | ||
1431 | |||
1432 | static void ks_setup(struct ks_net *ks) | 1449 | static void ks_setup(struct ks_net *ks) |
1433 | { | 1450 | { |
1434 | u16 w; | 1451 | u16 w; |
@@ -1463,7 +1480,7 @@ static void ks_setup(struct ks_net *ks) | |||
1463 | w = TXCR_TXFCE | TXCR_TXPE | TXCR_TXCRC | TXCR_TCGIP; | 1480 | w = TXCR_TXFCE | TXCR_TXPE | TXCR_TXCRC | TXCR_TCGIP; |
1464 | ks_wrreg16(ks, KS_TXCR, w); | 1481 | ks_wrreg16(ks, KS_TXCR, w); |
1465 | 1482 | ||
1466 | w = RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE; | 1483 | w = RXCR1_RXFCE | RXCR1_RXBE | RXCR1_RXUE | RXCR1_RXME | RXCR1_RXIPFCC; |
1467 | 1484 | ||
1468 | if (ks->promiscuous) /* bPromiscuous */ | 1485 | if (ks->promiscuous) /* bPromiscuous */ |
1469 | w |= (RXCR1_RXAE | RXCR1_RXINVF); | 1486 | w |= (RXCR1_RXAE | RXCR1_RXINVF); |
@@ -1486,28 +1503,6 @@ static void ks_setup_int(struct ks_net *ks) | |||
1486 | ks->rc_ier = (IRQ_LCI | IRQ_TXI | IRQ_RXI); | 1503 | ks->rc_ier = (IRQ_LCI | IRQ_TXI | IRQ_RXI); |
1487 | } /* ks_setup_int */ | 1504 | } /* ks_setup_int */ |
1488 | 1505 | ||
1489 | void ks_enable(struct ks_net *ks) | ||
1490 | { | ||
1491 | u16 w; | ||
1492 | |||
1493 | w = ks_rdreg16(ks, KS_TXCR); | ||
1494 | /* Enables QMU Transmit (TXCR). */ | ||
1495 | ks_wrreg16(ks, KS_TXCR, w | TXCR_TXE); | ||
1496 | |||
1497 | /* | ||
1498 | * RX Frame Count Threshold Enable and Auto-Dequeue RXQ Frame | ||
1499 | * Enable | ||
1500 | */ | ||
1501 | |||
1502 | w = ks_rdreg16(ks, KS_RXQCR); | ||
1503 | ks_wrreg16(ks, KS_RXQCR, w | RXQCR_RXFCTE); | ||
1504 | |||
1505 | /* Enables QMU Receive (RXCR1). */ | ||
1506 | w = ks_rdreg16(ks, KS_RXCR1); | ||
1507 | ks_wrreg16(ks, KS_RXCR1, w | RXCR1_RXE); | ||
1508 | ks->enabled = true; | ||
1509 | } /* ks_enable */ | ||
1510 | |||
1511 | static int ks_hw_init(struct ks_net *ks) | 1506 | static int ks_hw_init(struct ks_net *ks) |
1512 | { | 1507 | { |
1513 | #define MHEADER_SIZE (sizeof(struct type_frame_head) * MAX_RECV_FRAMES) | 1508 | #define MHEADER_SIZE (sizeof(struct type_frame_head) * MAX_RECV_FRAMES) |
@@ -1612,11 +1607,9 @@ static int __devinit ks8851_probe(struct platform_device *pdev) | |||
1612 | 1607 | ||
1613 | ks_soft_reset(ks, GRR_GSR); | 1608 | ks_soft_reset(ks, GRR_GSR); |
1614 | ks_hw_init(ks); | 1609 | ks_hw_init(ks); |
1615 | ks_disable(ks); | 1610 | ks_disable_qmu(ks); |
1616 | ks_setup(ks); | 1611 | ks_setup(ks); |
1617 | ks_setup_int(ks); | 1612 | ks_setup_int(ks); |
1618 | ks_enable_int(ks); | ||
1619 | ks_enable(ks); | ||
1620 | memcpy(netdev->dev_addr, ks->mac_addr, 6); | 1613 | memcpy(netdev->dev_addr, ks->mac_addr, 6); |
1621 | 1614 | ||
1622 | data = ks_rdreg16(ks, KS_OBCR); | 1615 | data = ks_rdreg16(ks, KS_OBCR); |
@@ -1658,6 +1651,7 @@ static int __devexit ks8851_remove(struct platform_device *pdev) | |||
1658 | struct ks_net *ks = netdev_priv(netdev); | 1651 | struct ks_net *ks = netdev_priv(netdev); |
1659 | struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1652 | struct resource *iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1660 | 1653 | ||
1654 | kfree(ks->frame_head_info); | ||
1661 | unregister_netdev(netdev); | 1655 | unregister_netdev(netdev); |
1662 | iounmap(ks->hw_addr); | 1656 | iounmap(ks->hw_addr); |
1663 | free_netdev(netdev); | 1657 | free_netdev(netdev); |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 3aabfd9dd212..2490aa39804c 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -360,6 +360,7 @@ static int macvlan_init(struct net_device *dev) | |||
360 | dev->state = (dev->state & ~MACVLAN_STATE_MASK) | | 360 | dev->state = (dev->state & ~MACVLAN_STATE_MASK) | |
361 | (lowerdev->state & MACVLAN_STATE_MASK); | 361 | (lowerdev->state & MACVLAN_STATE_MASK); |
362 | dev->features = lowerdev->features & MACVLAN_FEATURES; | 362 | dev->features = lowerdev->features & MACVLAN_FEATURES; |
363 | dev->gso_max_size = lowerdev->gso_max_size; | ||
363 | dev->iflink = lowerdev->ifindex; | 364 | dev->iflink = lowerdev->ifindex; |
364 | dev->hard_header_len = lowerdev->hard_header_len; | 365 | dev->hard_header_len = lowerdev->hard_header_len; |
365 | 366 | ||
@@ -596,6 +597,7 @@ static int macvlan_device_event(struct notifier_block *unused, | |||
596 | case NETDEV_FEAT_CHANGE: | 597 | case NETDEV_FEAT_CHANGE: |
597 | list_for_each_entry(vlan, &port->vlans, list) { | 598 | list_for_each_entry(vlan, &port->vlans, list) { |
598 | vlan->dev->features = dev->features & MACVLAN_FEATURES; | 599 | vlan->dev->features = dev->features & MACVLAN_FEATURES; |
600 | vlan->dev->gso_max_size = dev->gso_max_size; | ||
599 | netdev_features_change(vlan->dev); | 601 | netdev_features_change(vlan->dev); |
600 | } | 602 | } |
601 | break; | 603 | break; |
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 7384f59df615..e1237b802872 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -1163,6 +1163,8 @@ struct netxen_adapter { | |||
1163 | u32 int_vec_bit; | 1163 | u32 int_vec_bit; |
1164 | u32 heartbit; | 1164 | u32 heartbit; |
1165 | 1165 | ||
1166 | u8 mac_addr[ETH_ALEN]; | ||
1167 | |||
1166 | struct netxen_adapter_stats stats; | 1168 | struct netxen_adapter_stats stats; |
1167 | 1169 | ||
1168 | struct netxen_recv_context recv_ctx; | 1170 | struct netxen_recv_context recv_ctx; |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 1c46da632125..17bb3818d84e 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -545,6 +545,8 @@ enum { | |||
545 | #define NETXEN_NIU_TEST_MUX_CTL (NETXEN_CRB_NIU + 0x00094) | 545 | #define NETXEN_NIU_TEST_MUX_CTL (NETXEN_CRB_NIU + 0x00094) |
546 | #define NETXEN_NIU_XG_PAUSE_CTL (NETXEN_CRB_NIU + 0x00098) | 546 | #define NETXEN_NIU_XG_PAUSE_CTL (NETXEN_CRB_NIU + 0x00098) |
547 | #define NETXEN_NIU_XG_PAUSE_LEVEL (NETXEN_CRB_NIU + 0x000dc) | 547 | #define NETXEN_NIU_XG_PAUSE_LEVEL (NETXEN_CRB_NIU + 0x000dc) |
548 | #define NETXEN_NIU_FRAME_COUNT_SELECT (NETXEN_CRB_NIU + 0x000ac) | ||
549 | #define NETXEN_NIU_FRAME_COUNT (NETXEN_CRB_NIU + 0x000b0) | ||
548 | #define NETXEN_NIU_XG_SEL (NETXEN_CRB_NIU + 0x00128) | 550 | #define NETXEN_NIU_XG_SEL (NETXEN_CRB_NIU + 0x00128) |
549 | #define NETXEN_NIU_GB_PAUSE_CTL (NETXEN_CRB_NIU + 0x0030c) | 551 | #define NETXEN_NIU_GB_PAUSE_CTL (NETXEN_CRB_NIU + 0x0030c) |
550 | 552 | ||
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 3185a98b0917..52a3798d8d94 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -383,24 +383,51 @@ int netxen_niu_disable_xg_port(struct netxen_adapter *adapter) | |||
383 | 383 | ||
384 | int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) | 384 | int netxen_p2_nic_set_promisc(struct netxen_adapter *adapter, u32 mode) |
385 | { | 385 | { |
386 | __u32 reg; | 386 | u32 mac_cfg; |
387 | u32 cnt = 0; | ||
388 | __u32 reg = 0x0200; | ||
387 | u32 port = adapter->physical_port; | 389 | u32 port = adapter->physical_port; |
390 | u16 board_type = adapter->ahw.board_type; | ||
388 | 391 | ||
389 | if (port > NETXEN_NIU_MAX_XG_PORTS) | 392 | if (port > NETXEN_NIU_MAX_XG_PORTS) |
390 | return -EINVAL; | 393 | return -EINVAL; |
391 | 394 | ||
392 | reg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port)); | 395 | mac_cfg = NXRD32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port)); |
393 | if (mode == NETXEN_NIU_PROMISC_MODE) | 396 | mac_cfg &= ~0x4; |
394 | reg = (reg | 0x2000UL); | 397 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg); |
395 | else | ||
396 | reg = (reg & ~0x2000UL); | ||
397 | 398 | ||
398 | if (mode == NETXEN_NIU_ALLMULTI_MODE) | 399 | if ((board_type == NETXEN_BRDTYPE_P2_SB31_10G_IMEZ) || |
399 | reg = (reg | 0x1000UL); | 400 | (board_type == NETXEN_BRDTYPE_P2_SB31_10G_HMEZ)) |
400 | else | 401 | reg = (0x20 << port); |
401 | reg = (reg & ~0x1000UL); | 402 | |
403 | NXWR32(adapter, NETXEN_NIU_FRAME_COUNT_SELECT, reg); | ||
404 | |||
405 | mdelay(10); | ||
406 | |||
407 | while (NXRD32(adapter, NETXEN_NIU_FRAME_COUNT) && ++cnt < 20) | ||
408 | mdelay(10); | ||
409 | |||
410 | if (cnt < 20) { | ||
411 | |||
412 | reg = NXRD32(adapter, | ||
413 | NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port)); | ||
414 | |||
415 | if (mode == NETXEN_NIU_PROMISC_MODE) | ||
416 | reg = (reg | 0x2000UL); | ||
417 | else | ||
418 | reg = (reg & ~0x2000UL); | ||
419 | |||
420 | if (mode == NETXEN_NIU_ALLMULTI_MODE) | ||
421 | reg = (reg | 0x1000UL); | ||
422 | else | ||
423 | reg = (reg & ~0x1000UL); | ||
424 | |||
425 | NXWR32(adapter, | ||
426 | NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg); | ||
427 | } | ||
402 | 428 | ||
403 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_1 + (0x10000 * port), reg); | 429 | mac_cfg |= 0x4; |
430 | NXWR32(adapter, NETXEN_NIU_XGE_CONFIG_0 + (0x10000 * port), mac_cfg); | ||
404 | 431 | ||
405 | return 0; | 432 | return 0; |
406 | } | 433 | } |
@@ -436,7 +463,7 @@ netxen_nic_enable_mcast_filter(struct netxen_adapter *adapter) | |||
436 | { | 463 | { |
437 | u32 val = 0; | 464 | u32 val = 0; |
438 | u16 port = adapter->physical_port; | 465 | u16 port = adapter->physical_port; |
439 | u8 *addr = adapter->netdev->dev_addr; | 466 | u8 *addr = adapter->mac_addr; |
440 | 467 | ||
441 | if (adapter->mc_enabled) | 468 | if (adapter->mc_enabled) |
442 | return 0; | 469 | return 0; |
@@ -465,7 +492,7 @@ netxen_nic_disable_mcast_filter(struct netxen_adapter *adapter) | |||
465 | { | 492 | { |
466 | u32 val = 0; | 493 | u32 val = 0; |
467 | u16 port = adapter->physical_port; | 494 | u16 port = adapter->physical_port; |
468 | u8 *addr = adapter->netdev->dev_addr; | 495 | u8 *addr = adapter->mac_addr; |
469 | 496 | ||
470 | if (!adapter->mc_enabled) | 497 | if (!adapter->mc_enabled) |
471 | return 0; | 498 | return 0; |
@@ -660,7 +687,7 @@ void netxen_p3_nic_set_multi(struct net_device *netdev) | |||
660 | 687 | ||
661 | list_splice_tail_init(&adapter->mac_list, &del_list); | 688 | list_splice_tail_init(&adapter->mac_list, &del_list); |
662 | 689 | ||
663 | nx_p3_nic_add_mac(adapter, netdev->dev_addr, &del_list); | 690 | nx_p3_nic_add_mac(adapter, adapter->mac_addr, &del_list); |
664 | nx_p3_nic_add_mac(adapter, bcast_addr, &del_list); | 691 | nx_p3_nic_add_mac(adapter, bcast_addr, &del_list); |
665 | 692 | ||
666 | if (netdev->flags & IFF_PROMISC) { | 693 | if (netdev->flags & IFF_PROMISC) { |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index e40b914d6faf..8a0904368e08 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -544,6 +544,8 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
544 | continue; | 544 | continue; |
545 | if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ | 545 | if (off == (ROMUSB_GLB + 0x1c)) /* MS clock */ |
546 | continue; | 546 | continue; |
547 | if ((off & 0x0ff00000) == NETXEN_CRB_DDR_NET) | ||
548 | continue; | ||
547 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) | 549 | if (off == (NETXEN_CRB_PEG_NET_1 + 0x18)) |
548 | buf[i].data = 0x1020; | 550 | buf[i].data = 0x1020; |
549 | /* skip the function enable register */ | 551 | /* skip the function enable register */ |
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 0b4a56a8c8d5..3bf78dbfbf0f 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -437,6 +437,7 @@ netxen_read_mac_addr(struct netxen_adapter *adapter) | |||
437 | netdev->dev_addr[i] = *(p + 5 - i); | 437 | netdev->dev_addr[i] = *(p + 5 - i); |
438 | 438 | ||
439 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); | 439 | memcpy(netdev->perm_addr, netdev->dev_addr, netdev->addr_len); |
440 | memcpy(adapter->mac_addr, netdev->dev_addr, netdev->addr_len); | ||
440 | 441 | ||
441 | /* set station address */ | 442 | /* set station address */ |
442 | 443 | ||
@@ -459,6 +460,7 @@ int netxen_nic_set_mac(struct net_device *netdev, void *p) | |||
459 | netxen_napi_disable(adapter); | 460 | netxen_napi_disable(adapter); |
460 | } | 461 | } |
461 | 462 | ||
463 | memcpy(adapter->mac_addr, addr->sa_data, netdev->addr_len); | ||
462 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); | 464 | memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len); |
463 | adapter->macaddr_set(adapter, addr->sa_data); | 465 | adapter->macaddr_set(adapter, addr->sa_data); |
464 | 466 | ||
@@ -956,7 +958,7 @@ netxen_nic_up(struct netxen_adapter *adapter, struct net_device *netdev) | |||
956 | return err; | 958 | return err; |
957 | } | 959 | } |
958 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | 960 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) |
959 | adapter->macaddr_set(adapter, netdev->dev_addr); | 961 | adapter->macaddr_set(adapter, adapter->mac_addr); |
960 | 962 | ||
961 | adapter->set_multi(netdev); | 963 | adapter->set_multi(netdev); |
962 | adapter->set_mtu(adapter, netdev->mtu); | 964 | adapter->set_mtu(adapter, netdev->mtu); |
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index b58965a2b3ae..17a27225cc98 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -118,14 +118,6 @@ INT_MODULE_PARM(full_duplex, 0); | |||
118 | /* Autodetect link polarity reversal? */ | 118 | /* Autodetect link polarity reversal? */ |
119 | INT_MODULE_PARM(auto_polarity, 1); | 119 | INT_MODULE_PARM(auto_polarity, 1); |
120 | 120 | ||
121 | #ifdef PCMCIA_DEBUG | ||
122 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
123 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
124 | static char *version = | ||
125 | "3c574_cs.c 1.65ac1 2003/04/07 Donald Becker/David Hinds, becker@scyld.com.\n"; | ||
126 | #else | ||
127 | #define DEBUG(n, args...) | ||
128 | #endif | ||
129 | 121 | ||
130 | /*====================================================================*/ | 122 | /*====================================================================*/ |
131 | 123 | ||
@@ -278,7 +270,7 @@ static int tc574_probe(struct pcmcia_device *link) | |||
278 | struct el3_private *lp; | 270 | struct el3_private *lp; |
279 | struct net_device *dev; | 271 | struct net_device *dev; |
280 | 272 | ||
281 | DEBUG(0, "3c574_attach()\n"); | 273 | dev_dbg(&link->dev, "3c574_attach()\n"); |
282 | 274 | ||
283 | /* Create the PC card device object. */ | 275 | /* Create the PC card device object. */ |
284 | dev = alloc_etherdev(sizeof(struct el3_private)); | 276 | dev = alloc_etherdev(sizeof(struct el3_private)); |
@@ -291,10 +283,8 @@ static int tc574_probe(struct pcmcia_device *link) | |||
291 | spin_lock_init(&lp->window_lock); | 283 | spin_lock_init(&lp->window_lock); |
292 | link->io.NumPorts1 = 32; | 284 | link->io.NumPorts1 = 32; |
293 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 285 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
294 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; | 286 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
295 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
296 | link->irq.Handler = &el3_interrupt; | 287 | link->irq.Handler = &el3_interrupt; |
297 | link->irq.Instance = dev; | ||
298 | link->conf.Attributes = CONF_ENABLE_IRQ; | 288 | link->conf.Attributes = CONF_ENABLE_IRQ; |
299 | link->conf.IntType = INT_MEMORY_AND_IO; | 289 | link->conf.IntType = INT_MEMORY_AND_IO; |
300 | link->conf.ConfigIndex = 1; | 290 | link->conf.ConfigIndex = 1; |
@@ -319,7 +309,7 @@ static void tc574_detach(struct pcmcia_device *link) | |||
319 | { | 309 | { |
320 | struct net_device *dev = link->priv; | 310 | struct net_device *dev = link->priv; |
321 | 311 | ||
322 | DEBUG(0, "3c574_detach(0x%p)\n", link); | 312 | dev_dbg(&link->dev, "3c574_detach()\n"); |
323 | 313 | ||
324 | if (link->dev_node) | 314 | if (link->dev_node) |
325 | unregister_netdev(dev); | 315 | unregister_netdev(dev); |
@@ -335,26 +325,23 @@ static void tc574_detach(struct pcmcia_device *link) | |||
335 | ethernet device available to the system. | 325 | ethernet device available to the system. |
336 | */ | 326 | */ |
337 | 327 | ||
338 | #define CS_CHECK(fn, ret) \ | ||
339 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
340 | |||
341 | static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; | 328 | static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; |
342 | 329 | ||
343 | static int tc574_config(struct pcmcia_device *link) | 330 | static int tc574_config(struct pcmcia_device *link) |
344 | { | 331 | { |
345 | struct net_device *dev = link->priv; | 332 | struct net_device *dev = link->priv; |
346 | struct el3_private *lp = netdev_priv(dev); | 333 | struct el3_private *lp = netdev_priv(dev); |
347 | tuple_t tuple; | 334 | int ret, i, j; |
348 | __le16 buf[32]; | ||
349 | int last_fn, last_ret, i, j; | ||
350 | unsigned int ioaddr; | 335 | unsigned int ioaddr; |
351 | __be16 *phys_addr; | 336 | __be16 *phys_addr; |
352 | char *cardname; | 337 | char *cardname; |
353 | __u32 config; | 338 | __u32 config; |
339 | u8 *buf; | ||
340 | size_t len; | ||
354 | 341 | ||
355 | phys_addr = (__be16 *)dev->dev_addr; | 342 | phys_addr = (__be16 *)dev->dev_addr; |
356 | 343 | ||
357 | DEBUG(0, "3c574_config(0x%p)\n", link); | 344 | dev_dbg(&link->dev, "3c574_config()\n"); |
358 | 345 | ||
359 | link->io.IOAddrLines = 16; | 346 | link->io.IOAddrLines = 16; |
360 | for (i = j = 0; j < 0x400; j += 0x20) { | 347 | for (i = j = 0; j < 0x400; j += 0x20) { |
@@ -363,12 +350,16 @@ static int tc574_config(struct pcmcia_device *link) | |||
363 | if (i == 0) | 350 | if (i == 0) |
364 | break; | 351 | break; |
365 | } | 352 | } |
366 | if (i != 0) { | 353 | if (i != 0) |
367 | cs_error(link, RequestIO, i); | 354 | goto failed; |
355 | |||
356 | ret = pcmcia_request_irq(link, &link->irq); | ||
357 | if (ret) | ||
358 | goto failed; | ||
359 | |||
360 | ret = pcmcia_request_configuration(link, &link->conf); | ||
361 | if (ret) | ||
368 | goto failed; | 362 | goto failed; |
369 | } | ||
370 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | ||
371 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | ||
372 | 363 | ||
373 | dev->irq = link->irq.AssignedIRQ; | 364 | dev->irq = link->irq.AssignedIRQ; |
374 | dev->base_addr = link->io.BasePort1; | 365 | dev->base_addr = link->io.BasePort1; |
@@ -378,16 +369,14 @@ static int tc574_config(struct pcmcia_device *link) | |||
378 | /* The 3c574 normally uses an EEPROM for configuration info, including | 369 | /* The 3c574 normally uses an EEPROM for configuration info, including |
379 | the hardware address. The future products may include a modem chip | 370 | the hardware address. The future products may include a modem chip |
380 | and put the address in the CIS. */ | 371 | and put the address in the CIS. */ |
381 | tuple.Attributes = 0; | 372 | |
382 | tuple.TupleData = (cisdata_t *)buf; | 373 | len = pcmcia_get_tuple(link, 0x88, &buf); |
383 | tuple.TupleDataMax = 64; | 374 | if (buf && len >= 6) { |
384 | tuple.TupleOffset = 0; | ||
385 | tuple.DesiredTuple = 0x88; | ||
386 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { | ||
387 | pcmcia_get_tuple_data(link, &tuple); | ||
388 | for (i = 0; i < 3; i++) | 375 | for (i = 0; i < 3; i++) |
389 | phys_addr[i] = htons(le16_to_cpu(buf[i])); | 376 | phys_addr[i] = htons(le16_to_cpu(buf[i * 2])); |
377 | kfree(buf); | ||
390 | } else { | 378 | } else { |
379 | kfree(buf); /* 0 < len < 6 */ | ||
391 | EL3WINDOW(0); | 380 | EL3WINDOW(0); |
392 | for (i = 0; i < 3; i++) | 381 | for (i = 0; i < 3; i++) |
393 | phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); | 382 | phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); |
@@ -435,7 +424,8 @@ static int tc574_config(struct pcmcia_device *link) | |||
435 | mii_status = mdio_read(ioaddr, phy & 0x1f, 1); | 424 | mii_status = mdio_read(ioaddr, phy & 0x1f, 1); |
436 | if (mii_status != 0xffff) { | 425 | if (mii_status != 0xffff) { |
437 | lp->phys = phy & 0x1f; | 426 | lp->phys = phy & 0x1f; |
438 | DEBUG(0, " MII transceiver at index %d, status %x.\n", | 427 | dev_dbg(&link->dev, " MII transceiver at " |
428 | "index %d, status %x.\n", | ||
439 | phy, mii_status); | 429 | phy, mii_status); |
440 | if ((mii_status & 0x0040) == 0) | 430 | if ((mii_status & 0x0040) == 0) |
441 | mii_preamble_required = 1; | 431 | mii_preamble_required = 1; |
@@ -457,7 +447,7 @@ static int tc574_config(struct pcmcia_device *link) | |||
457 | } | 447 | } |
458 | 448 | ||
459 | link->dev_node = &lp->node; | 449 | link->dev_node = &lp->node; |
460 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 450 | SET_NETDEV_DEV(dev, &link->dev); |
461 | 451 | ||
462 | if (register_netdev(dev) != 0) { | 452 | if (register_netdev(dev) != 0) { |
463 | printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); | 453 | printk(KERN_NOTICE "3c574_cs: register_netdev() failed\n"); |
@@ -478,8 +468,6 @@ static int tc574_config(struct pcmcia_device *link) | |||
478 | 468 | ||
479 | return 0; | 469 | return 0; |
480 | 470 | ||
481 | cs_failed: | ||
482 | cs_error(link, last_fn, last_ret); | ||
483 | failed: | 471 | failed: |
484 | tc574_release(link); | 472 | tc574_release(link); |
485 | return -ENODEV; | 473 | return -ENODEV; |
@@ -738,7 +726,7 @@ static int el3_open(struct net_device *dev) | |||
738 | lp->media.expires = jiffies + HZ; | 726 | lp->media.expires = jiffies + HZ; |
739 | add_timer(&lp->media); | 727 | add_timer(&lp->media); |
740 | 728 | ||
741 | DEBUG(2, "%s: opened, status %4.4x.\n", | 729 | dev_dbg(&link->dev, "%s: opened, status %4.4x.\n", |
742 | dev->name, inw(dev->base_addr + EL3_STATUS)); | 730 | dev->name, inw(dev->base_addr + EL3_STATUS)); |
743 | 731 | ||
744 | return 0; | 732 | return 0; |
@@ -772,7 +760,7 @@ static void pop_tx_status(struct net_device *dev) | |||
772 | if (tx_status & 0x30) | 760 | if (tx_status & 0x30) |
773 | tc574_wait_for_completion(dev, TxReset); | 761 | tc574_wait_for_completion(dev, TxReset); |
774 | if (tx_status & 0x38) { | 762 | if (tx_status & 0x38) { |
775 | DEBUG(1, "%s: transmit error: status 0x%02x\n", | 763 | pr_debug("%s: transmit error: status 0x%02x\n", |
776 | dev->name, tx_status); | 764 | dev->name, tx_status); |
777 | outw(TxEnable, ioaddr + EL3_CMD); | 765 | outw(TxEnable, ioaddr + EL3_CMD); |
778 | dev->stats.tx_aborted_errors++; | 766 | dev->stats.tx_aborted_errors++; |
@@ -788,7 +776,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb, | |||
788 | struct el3_private *lp = netdev_priv(dev); | 776 | struct el3_private *lp = netdev_priv(dev); |
789 | unsigned long flags; | 777 | unsigned long flags; |
790 | 778 | ||
791 | DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " | 779 | pr_debug("%s: el3_start_xmit(length = %ld) called, " |
792 | "status %4.4x.\n", dev->name, (long)skb->len, | 780 | "status %4.4x.\n", dev->name, (long)skb->len, |
793 | inw(ioaddr + EL3_STATUS)); | 781 | inw(ioaddr + EL3_STATUS)); |
794 | 782 | ||
@@ -827,7 +815,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
827 | return IRQ_NONE; | 815 | return IRQ_NONE; |
828 | ioaddr = dev->base_addr; | 816 | ioaddr = dev->base_addr; |
829 | 817 | ||
830 | DEBUG(3, "%s: interrupt, status %4.4x.\n", | 818 | pr_debug("%s: interrupt, status %4.4x.\n", |
831 | dev->name, inw(ioaddr + EL3_STATUS)); | 819 | dev->name, inw(ioaddr + EL3_STATUS)); |
832 | 820 | ||
833 | spin_lock(&lp->window_lock); | 821 | spin_lock(&lp->window_lock); |
@@ -836,7 +824,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
836 | (IntLatch | RxComplete | RxEarly | StatsFull)) { | 824 | (IntLatch | RxComplete | RxEarly | StatsFull)) { |
837 | if (!netif_device_present(dev) || | 825 | if (!netif_device_present(dev) || |
838 | ((status & 0xe000) != 0x2000)) { | 826 | ((status & 0xe000) != 0x2000)) { |
839 | DEBUG(1, "%s: Interrupt from dead card\n", dev->name); | 827 | pr_debug("%s: Interrupt from dead card\n", dev->name); |
840 | break; | 828 | break; |
841 | } | 829 | } |
842 | 830 | ||
@@ -846,7 +834,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
846 | work_budget = el3_rx(dev, work_budget); | 834 | work_budget = el3_rx(dev, work_budget); |
847 | 835 | ||
848 | if (status & TxAvailable) { | 836 | if (status & TxAvailable) { |
849 | DEBUG(3, " TX room bit was handled.\n"); | 837 | pr_debug(" TX room bit was handled.\n"); |
850 | /* There's room in the FIFO for a full-sized packet. */ | 838 | /* There's room in the FIFO for a full-sized packet. */ |
851 | outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); | 839 | outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); |
852 | netif_wake_queue(dev); | 840 | netif_wake_queue(dev); |
@@ -886,7 +874,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
886 | } | 874 | } |
887 | 875 | ||
888 | if (--work_budget < 0) { | 876 | if (--work_budget < 0) { |
889 | DEBUG(0, "%s: Too much work in interrupt, " | 877 | pr_debug("%s: Too much work in interrupt, " |
890 | "status %4.4x.\n", dev->name, status); | 878 | "status %4.4x.\n", dev->name, status); |
891 | /* Clear all interrupts */ | 879 | /* Clear all interrupts */ |
892 | outw(AckIntr | 0xFF, ioaddr + EL3_CMD); | 880 | outw(AckIntr | 0xFF, ioaddr + EL3_CMD); |
@@ -896,7 +884,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
896 | outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD); | 884 | outw(AckIntr | IntReq | IntLatch, ioaddr + EL3_CMD); |
897 | } | 885 | } |
898 | 886 | ||
899 | DEBUG(3, "%s: exiting interrupt, status %4.4x.\n", | 887 | pr_debug("%s: exiting interrupt, status %4.4x.\n", |
900 | dev->name, inw(ioaddr + EL3_STATUS)); | 888 | dev->name, inw(ioaddr + EL3_STATUS)); |
901 | 889 | ||
902 | spin_unlock(&lp->window_lock); | 890 | spin_unlock(&lp->window_lock); |
@@ -1003,7 +991,7 @@ static void update_stats(struct net_device *dev) | |||
1003 | unsigned int ioaddr = dev->base_addr; | 991 | unsigned int ioaddr = dev->base_addr; |
1004 | u8 rx, tx, up; | 992 | u8 rx, tx, up; |
1005 | 993 | ||
1006 | DEBUG(2, "%s: updating the statistics.\n", dev->name); | 994 | pr_debug("%s: updating the statistics.\n", dev->name); |
1007 | 995 | ||
1008 | if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */ | 996 | if (inw(ioaddr+EL3_STATUS) == 0xffff) /* No card. */ |
1009 | return; | 997 | return; |
@@ -1039,7 +1027,7 @@ static int el3_rx(struct net_device *dev, int worklimit) | |||
1039 | unsigned int ioaddr = dev->base_addr; | 1027 | unsigned int ioaddr = dev->base_addr; |
1040 | short rx_status; | 1028 | short rx_status; |
1041 | 1029 | ||
1042 | DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", | 1030 | pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", |
1043 | dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus)); | 1031 | dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RxStatus)); |
1044 | while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) && | 1032 | while (!((rx_status = inw(ioaddr + RxStatus)) & 0x8000) && |
1045 | worklimit > 0) { | 1033 | worklimit > 0) { |
@@ -1061,7 +1049,7 @@ static int el3_rx(struct net_device *dev, int worklimit) | |||
1061 | 1049 | ||
1062 | skb = dev_alloc_skb(pkt_len+5); | 1050 | skb = dev_alloc_skb(pkt_len+5); |
1063 | 1051 | ||
1064 | DEBUG(3, " Receiving packet size %d status %4.4x.\n", | 1052 | pr_debug(" Receiving packet size %d status %4.4x.\n", |
1065 | pkt_len, rx_status); | 1053 | pkt_len, rx_status); |
1066 | if (skb != NULL) { | 1054 | if (skb != NULL) { |
1067 | skb_reserve(skb, 2); | 1055 | skb_reserve(skb, 2); |
@@ -1072,7 +1060,7 @@ static int el3_rx(struct net_device *dev, int worklimit) | |||
1072 | dev->stats.rx_packets++; | 1060 | dev->stats.rx_packets++; |
1073 | dev->stats.rx_bytes += pkt_len; | 1061 | dev->stats.rx_bytes += pkt_len; |
1074 | } else { | 1062 | } else { |
1075 | DEBUG(1, "%s: couldn't allocate a sk_buff of" | 1063 | pr_debug("%s: couldn't allocate a sk_buff of" |
1076 | " size %d.\n", dev->name, pkt_len); | 1064 | " size %d.\n", dev->name, pkt_len); |
1077 | dev->stats.rx_dropped++; | 1065 | dev->stats.rx_dropped++; |
1078 | } | 1066 | } |
@@ -1101,7 +1089,7 @@ static int el3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1101 | struct mii_ioctl_data *data = if_mii(rq); | 1089 | struct mii_ioctl_data *data = if_mii(rq); |
1102 | int phy = lp->phys & 0x1f; | 1090 | int phy = lp->phys & 0x1f; |
1103 | 1091 | ||
1104 | DEBUG(2, "%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", | 1092 | pr_debug("%s: In ioct(%-.6s, %#4.4x) %4.4x %4.4x %4.4x %4.4x.\n", |
1105 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, | 1093 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, |
1106 | data->phy_id, data->reg_num, data->val_in, data->val_out); | 1094 | data->phy_id, data->reg_num, data->val_in, data->val_out); |
1107 | 1095 | ||
@@ -1178,7 +1166,7 @@ static int el3_close(struct net_device *dev) | |||
1178 | struct el3_private *lp = netdev_priv(dev); | 1166 | struct el3_private *lp = netdev_priv(dev); |
1179 | struct pcmcia_device *link = lp->p_dev; | 1167 | struct pcmcia_device *link = lp->p_dev; |
1180 | 1168 | ||
1181 | DEBUG(2, "%s: shutting down ethercard.\n", dev->name); | 1169 | dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name); |
1182 | 1170 | ||
1183 | if (pcmcia_dev_present(link)) { | 1171 | if (pcmcia_dev_present(link)) { |
1184 | unsigned long flags; | 1172 | unsigned long flags; |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 569fb06793cf..6f8d7e2e5922 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -130,14 +130,6 @@ MODULE_LICENSE("GPL"); | |||
130 | /* Special hook for setting if_port when module is loaded */ | 130 | /* Special hook for setting if_port when module is loaded */ |
131 | INT_MODULE_PARM(if_port, 0); | 131 | INT_MODULE_PARM(if_port, 0); |
132 | 132 | ||
133 | #ifdef PCMCIA_DEBUG | ||
134 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
135 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
136 | static char *version = | ||
137 | DRV_NAME ".c " DRV_VERSION " 2001/10/13 00:08:50 (David Hinds)"; | ||
138 | #else | ||
139 | #define DEBUG(n, args...) | ||
140 | #endif | ||
141 | 133 | ||
142 | /*====================================================================*/ | 134 | /*====================================================================*/ |
143 | 135 | ||
@@ -189,7 +181,7 @@ static int tc589_probe(struct pcmcia_device *link) | |||
189 | struct el3_private *lp; | 181 | struct el3_private *lp; |
190 | struct net_device *dev; | 182 | struct net_device *dev; |
191 | 183 | ||
192 | DEBUG(0, "3c589_attach()\n"); | 184 | dev_dbg(&link->dev, "3c589_attach()\n"); |
193 | 185 | ||
194 | /* Create new ethernet device */ | 186 | /* Create new ethernet device */ |
195 | dev = alloc_etherdev(sizeof(struct el3_private)); | 187 | dev = alloc_etherdev(sizeof(struct el3_private)); |
@@ -202,10 +194,8 @@ static int tc589_probe(struct pcmcia_device *link) | |||
202 | spin_lock_init(&lp->lock); | 194 | spin_lock_init(&lp->lock); |
203 | link->io.NumPorts1 = 16; | 195 | link->io.NumPorts1 = 16; |
204 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 196 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
205 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; | 197 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
206 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
207 | link->irq.Handler = &el3_interrupt; | 198 | link->irq.Handler = &el3_interrupt; |
208 | link->irq.Instance = dev; | ||
209 | link->conf.Attributes = CONF_ENABLE_IRQ; | 199 | link->conf.Attributes = CONF_ENABLE_IRQ; |
210 | link->conf.IntType = INT_MEMORY_AND_IO; | 200 | link->conf.IntType = INT_MEMORY_AND_IO; |
211 | link->conf.ConfigIndex = 1; | 201 | link->conf.ConfigIndex = 1; |
@@ -231,7 +221,7 @@ static void tc589_detach(struct pcmcia_device *link) | |||
231 | { | 221 | { |
232 | struct net_device *dev = link->priv; | 222 | struct net_device *dev = link->priv; |
233 | 223 | ||
234 | DEBUG(0, "3c589_detach(0x%p)\n", link); | 224 | dev_dbg(&link->dev, "3c589_detach\n"); |
235 | 225 | ||
236 | if (link->dev_node) | 226 | if (link->dev_node) |
237 | unregister_netdev(dev); | 227 | unregister_netdev(dev); |
@@ -249,29 +239,20 @@ static void tc589_detach(struct pcmcia_device *link) | |||
249 | 239 | ||
250 | ======================================================================*/ | 240 | ======================================================================*/ |
251 | 241 | ||
252 | #define CS_CHECK(fn, ret) \ | ||
253 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
254 | |||
255 | static int tc589_config(struct pcmcia_device *link) | 242 | static int tc589_config(struct pcmcia_device *link) |
256 | { | 243 | { |
257 | struct net_device *dev = link->priv; | 244 | struct net_device *dev = link->priv; |
258 | struct el3_private *lp = netdev_priv(dev); | 245 | struct el3_private *lp = netdev_priv(dev); |
259 | tuple_t tuple; | ||
260 | __le16 buf[32]; | ||
261 | __be16 *phys_addr; | 246 | __be16 *phys_addr; |
262 | int last_fn, last_ret, i, j, multi = 0, fifo; | 247 | int ret, i, j, multi = 0, fifo; |
263 | unsigned int ioaddr; | 248 | unsigned int ioaddr; |
264 | char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; | 249 | char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; |
250 | u8 *buf; | ||
251 | size_t len; | ||
265 | 252 | ||
266 | DEBUG(0, "3c589_config(0x%p)\n", link); | 253 | dev_dbg(&link->dev, "3c589_config\n"); |
267 | 254 | ||
268 | phys_addr = (__be16 *)dev->dev_addr; | 255 | phys_addr = (__be16 *)dev->dev_addr; |
269 | tuple.Attributes = 0; | ||
270 | tuple.TupleData = (cisdata_t *)buf; | ||
271 | tuple.TupleDataMax = sizeof(buf); | ||
272 | tuple.TupleOffset = 0; | ||
273 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
274 | |||
275 | /* Is this a 3c562? */ | 256 | /* Is this a 3c562? */ |
276 | if (link->manf_id != MANFID_3COM) | 257 | if (link->manf_id != MANFID_3COM) |
277 | printk(KERN_INFO "3c589_cs: hmmm, is this really a " | 258 | printk(KERN_INFO "3c589_cs: hmmm, is this really a " |
@@ -287,12 +268,16 @@ static int tc589_config(struct pcmcia_device *link) | |||
287 | if (i == 0) | 268 | if (i == 0) |
288 | break; | 269 | break; |
289 | } | 270 | } |
290 | if (i != 0) { | 271 | if (i != 0) |
291 | cs_error(link, RequestIO, i); | ||
292 | goto failed; | 272 | goto failed; |
293 | } | 273 | |
294 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 274 | ret = pcmcia_request_irq(link, &link->irq); |
295 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 275 | if (ret) |
276 | goto failed; | ||
277 | |||
278 | ret = pcmcia_request_configuration(link, &link->conf); | ||
279 | if (ret) | ||
280 | goto failed; | ||
296 | 281 | ||
297 | dev->irq = link->irq.AssignedIRQ; | 282 | dev->irq = link->irq.AssignedIRQ; |
298 | dev->base_addr = link->io.BasePort1; | 283 | dev->base_addr = link->io.BasePort1; |
@@ -301,12 +286,13 @@ static int tc589_config(struct pcmcia_device *link) | |||
301 | 286 | ||
302 | /* The 3c589 has an extra EEPROM for configuration info, including | 287 | /* The 3c589 has an extra EEPROM for configuration info, including |
303 | the hardware address. The 3c562 puts the address in the CIS. */ | 288 | the hardware address. The 3c562 puts the address in the CIS. */ |
304 | tuple.DesiredTuple = 0x88; | 289 | len = pcmcia_get_tuple(link, 0x88, &buf); |
305 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { | 290 | if (buf && len >= 6) { |
306 | pcmcia_get_tuple_data(link, &tuple); | 291 | for (i = 0; i < 3; i++) |
307 | for (i = 0; i < 3; i++) | 292 | phys_addr[i] = htons(le16_to_cpu(buf[i*2])); |
308 | phys_addr[i] = htons(le16_to_cpu(buf[i])); | 293 | kfree(buf); |
309 | } else { | 294 | } else { |
295 | kfree(buf); /* 0 < len < 6 */ | ||
310 | for (i = 0; i < 3; i++) | 296 | for (i = 0; i < 3; i++) |
311 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); | 297 | phys_addr[i] = htons(read_eeprom(ioaddr, i)); |
312 | if (phys_addr[0] == htons(0x6060)) { | 298 | if (phys_addr[0] == htons(0x6060)) { |
@@ -328,7 +314,7 @@ static int tc589_config(struct pcmcia_device *link) | |||
328 | printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); | 314 | printk(KERN_ERR "3c589_cs: invalid if_port requested\n"); |
329 | 315 | ||
330 | link->dev_node = &lp->node; | 316 | link->dev_node = &lp->node; |
331 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 317 | SET_NETDEV_DEV(dev, &link->dev); |
332 | 318 | ||
333 | if (register_netdev(dev) != 0) { | 319 | if (register_netdev(dev) != 0) { |
334 | printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); | 320 | printk(KERN_ERR "3c589_cs: register_netdev() failed\n"); |
@@ -347,8 +333,6 @@ static int tc589_config(struct pcmcia_device *link) | |||
347 | if_names[dev->if_port]); | 333 | if_names[dev->if_port]); |
348 | return 0; | 334 | return 0; |
349 | 335 | ||
350 | cs_failed: | ||
351 | cs_error(link, last_fn, last_ret); | ||
352 | failed: | 336 | failed: |
353 | tc589_release(link); | 337 | tc589_release(link); |
354 | return -ENODEV; | 338 | return -ENODEV; |
@@ -511,24 +495,8 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
511 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | 495 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); |
512 | } | 496 | } |
513 | 497 | ||
514 | #ifdef PCMCIA_DEBUG | ||
515 | static u32 netdev_get_msglevel(struct net_device *dev) | ||
516 | { | ||
517 | return pc_debug; | ||
518 | } | ||
519 | |||
520 | static void netdev_set_msglevel(struct net_device *dev, u32 level) | ||
521 | { | ||
522 | pc_debug = level; | ||
523 | } | ||
524 | #endif /* PCMCIA_DEBUG */ | ||
525 | |||
526 | static const struct ethtool_ops netdev_ethtool_ops = { | 498 | static const struct ethtool_ops netdev_ethtool_ops = { |
527 | .get_drvinfo = netdev_get_drvinfo, | 499 | .get_drvinfo = netdev_get_drvinfo, |
528 | #ifdef PCMCIA_DEBUG | ||
529 | .get_msglevel = netdev_get_msglevel, | ||
530 | .set_msglevel = netdev_set_msglevel, | ||
531 | #endif /* PCMCIA_DEBUG */ | ||
532 | }; | 500 | }; |
533 | 501 | ||
534 | static int el3_config(struct net_device *dev, struct ifmap *map) | 502 | static int el3_config(struct net_device *dev, struct ifmap *map) |
@@ -563,7 +531,7 @@ static int el3_open(struct net_device *dev) | |||
563 | lp->media.expires = jiffies + HZ; | 531 | lp->media.expires = jiffies + HZ; |
564 | add_timer(&lp->media); | 532 | add_timer(&lp->media); |
565 | 533 | ||
566 | DEBUG(1, "%s: opened, status %4.4x.\n", | 534 | dev_dbg(&link->dev, "%s: opened, status %4.4x.\n", |
567 | dev->name, inw(dev->base_addr + EL3_STATUS)); | 535 | dev->name, inw(dev->base_addr + EL3_STATUS)); |
568 | 536 | ||
569 | return 0; | 537 | return 0; |
@@ -596,7 +564,7 @@ static void pop_tx_status(struct net_device *dev) | |||
596 | if (tx_status & 0x30) | 564 | if (tx_status & 0x30) |
597 | tc589_wait_for_completion(dev, TxReset); | 565 | tc589_wait_for_completion(dev, TxReset); |
598 | if (tx_status & 0x38) { | 566 | if (tx_status & 0x38) { |
599 | DEBUG(1, "%s: transmit error: status 0x%02x\n", | 567 | pr_debug("%s: transmit error: status 0x%02x\n", |
600 | dev->name, tx_status); | 568 | dev->name, tx_status); |
601 | outw(TxEnable, ioaddr + EL3_CMD); | 569 | outw(TxEnable, ioaddr + EL3_CMD); |
602 | dev->stats.tx_aborted_errors++; | 570 | dev->stats.tx_aborted_errors++; |
@@ -612,7 +580,7 @@ static netdev_tx_t el3_start_xmit(struct sk_buff *skb, | |||
612 | struct el3_private *priv = netdev_priv(dev); | 580 | struct el3_private *priv = netdev_priv(dev); |
613 | unsigned long flags; | 581 | unsigned long flags; |
614 | 582 | ||
615 | DEBUG(3, "%s: el3_start_xmit(length = %ld) called, " | 583 | pr_debug("%s: el3_start_xmit(length = %ld) called, " |
616 | "status %4.4x.\n", dev->name, (long)skb->len, | 584 | "status %4.4x.\n", dev->name, (long)skb->len, |
617 | inw(ioaddr + EL3_STATUS)); | 585 | inw(ioaddr + EL3_STATUS)); |
618 | 586 | ||
@@ -654,14 +622,14 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
654 | 622 | ||
655 | ioaddr = dev->base_addr; | 623 | ioaddr = dev->base_addr; |
656 | 624 | ||
657 | DEBUG(3, "%s: interrupt, status %4.4x.\n", | 625 | pr_debug("%s: interrupt, status %4.4x.\n", |
658 | dev->name, inw(ioaddr + EL3_STATUS)); | 626 | dev->name, inw(ioaddr + EL3_STATUS)); |
659 | 627 | ||
660 | spin_lock(&lp->lock); | 628 | spin_lock(&lp->lock); |
661 | while ((status = inw(ioaddr + EL3_STATUS)) & | 629 | while ((status = inw(ioaddr + EL3_STATUS)) & |
662 | (IntLatch | RxComplete | StatsFull)) { | 630 | (IntLatch | RxComplete | StatsFull)) { |
663 | if ((status & 0xe000) != 0x2000) { | 631 | if ((status & 0xe000) != 0x2000) { |
664 | DEBUG(1, "%s: interrupt from dead card\n", dev->name); | 632 | pr_debug("%s: interrupt from dead card\n", dev->name); |
665 | handled = 0; | 633 | handled = 0; |
666 | break; | 634 | break; |
667 | } | 635 | } |
@@ -670,7 +638,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
670 | el3_rx(dev); | 638 | el3_rx(dev); |
671 | 639 | ||
672 | if (status & TxAvailable) { | 640 | if (status & TxAvailable) { |
673 | DEBUG(3, " TX room bit was handled.\n"); | 641 | pr_debug(" TX room bit was handled.\n"); |
674 | /* There's room in the FIFO for a full-sized packet. */ | 642 | /* There's room in the FIFO for a full-sized packet. */ |
675 | outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); | 643 | outw(AckIntr | TxAvailable, ioaddr + EL3_CMD); |
676 | netif_wake_queue(dev); | 644 | netif_wake_queue(dev); |
@@ -722,7 +690,7 @@ static irqreturn_t el3_interrupt(int irq, void *dev_id) | |||
722 | 690 | ||
723 | lp->last_irq = jiffies; | 691 | lp->last_irq = jiffies; |
724 | spin_unlock(&lp->lock); | 692 | spin_unlock(&lp->lock); |
725 | DEBUG(3, "%s: exiting interrupt, status %4.4x.\n", | 693 | pr_debug("%s: exiting interrupt, status %4.4x.\n", |
726 | dev->name, inw(ioaddr + EL3_STATUS)); | 694 | dev->name, inw(ioaddr + EL3_STATUS)); |
727 | return IRQ_RETVAL(handled); | 695 | return IRQ_RETVAL(handled); |
728 | } | 696 | } |
@@ -833,7 +801,7 @@ static void update_stats(struct net_device *dev) | |||
833 | { | 801 | { |
834 | unsigned int ioaddr = dev->base_addr; | 802 | unsigned int ioaddr = dev->base_addr; |
835 | 803 | ||
836 | DEBUG(2, "%s: updating the statistics.\n", dev->name); | 804 | pr_debug("%s: updating the statistics.\n", dev->name); |
837 | /* Turn off statistics updates while reading. */ | 805 | /* Turn off statistics updates while reading. */ |
838 | outw(StatsDisable, ioaddr + EL3_CMD); | 806 | outw(StatsDisable, ioaddr + EL3_CMD); |
839 | /* Switch to the stats window, and read everything. */ | 807 | /* Switch to the stats window, and read everything. */ |
@@ -861,7 +829,7 @@ static int el3_rx(struct net_device *dev) | |||
861 | int worklimit = 32; | 829 | int worklimit = 32; |
862 | short rx_status; | 830 | short rx_status; |
863 | 831 | ||
864 | DEBUG(3, "%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", | 832 | pr_debug("%s: in rx_packet(), status %4.4x, rx_status %4.4x.\n", |
865 | dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS)); | 833 | dev->name, inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS)); |
866 | while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) && | 834 | while (!((rx_status = inw(ioaddr + RX_STATUS)) & 0x8000) && |
867 | worklimit > 0) { | 835 | worklimit > 0) { |
@@ -883,7 +851,7 @@ static int el3_rx(struct net_device *dev) | |||
883 | 851 | ||
884 | skb = dev_alloc_skb(pkt_len+5); | 852 | skb = dev_alloc_skb(pkt_len+5); |
885 | 853 | ||
886 | DEBUG(3, " Receiving packet size %d status %4.4x.\n", | 854 | pr_debug(" Receiving packet size %d status %4.4x.\n", |
887 | pkt_len, rx_status); | 855 | pkt_len, rx_status); |
888 | if (skb != NULL) { | 856 | if (skb != NULL) { |
889 | skb_reserve(skb, 2); | 857 | skb_reserve(skb, 2); |
@@ -894,7 +862,7 @@ static int el3_rx(struct net_device *dev) | |||
894 | dev->stats.rx_packets++; | 862 | dev->stats.rx_packets++; |
895 | dev->stats.rx_bytes += pkt_len; | 863 | dev->stats.rx_bytes += pkt_len; |
896 | } else { | 864 | } else { |
897 | DEBUG(1, "%s: couldn't allocate a sk_buff of" | 865 | pr_debug("%s: couldn't allocate a sk_buff of" |
898 | " size %d.\n", dev->name, pkt_len); | 866 | " size %d.\n", dev->name, pkt_len); |
899 | dev->stats.rx_dropped++; | 867 | dev->stats.rx_dropped++; |
900 | } | 868 | } |
@@ -935,7 +903,7 @@ static int el3_close(struct net_device *dev) | |||
935 | struct pcmcia_device *link = lp->p_dev; | 903 | struct pcmcia_device *link = lp->p_dev; |
936 | unsigned int ioaddr = dev->base_addr; | 904 | unsigned int ioaddr = dev->base_addr; |
937 | 905 | ||
938 | DEBUG(1, "%s: shutting down ethercard.\n", dev->name); | 906 | dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name); |
939 | 907 | ||
940 | if (pcmcia_dev_present(link)) { | 908 | if (pcmcia_dev_present(link)) { |
941 | /* Turn off statistics ASAP. We update dev->stats below. */ | 909 | /* Turn off statistics ASAP. We update dev->stats below. */ |
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 3131a59a8d32..800597b82d18 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c | |||
@@ -75,16 +75,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>"); | |||
75 | MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver"); | 75 | MODULE_DESCRIPTION("Asix AX88190 PCMCIA ethernet driver"); |
76 | MODULE_LICENSE("GPL"); | 76 | MODULE_LICENSE("GPL"); |
77 | 77 | ||
78 | #ifdef PCMCIA_DEBUG | ||
79 | #define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0) | ||
80 | |||
81 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
82 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
83 | static char *version = | ||
84 | "axnet_cs.c 1.28 2002/06/29 06:27:37 (David Hinds)"; | ||
85 | #else | ||
86 | #define DEBUG(n, args...) | ||
87 | #endif | ||
88 | 78 | ||
89 | /*====================================================================*/ | 79 | /*====================================================================*/ |
90 | 80 | ||
@@ -167,7 +157,7 @@ static int axnet_probe(struct pcmcia_device *link) | |||
167 | struct net_device *dev; | 157 | struct net_device *dev; |
168 | struct ei_device *ei_local; | 158 | struct ei_device *ei_local; |
169 | 159 | ||
170 | DEBUG(0, "axnet_attach()\n"); | 160 | dev_dbg(&link->dev, "axnet_attach()\n"); |
171 | 161 | ||
172 | dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t)); | 162 | dev = alloc_etherdev(sizeof(struct ei_device) + sizeof(axnet_dev_t)); |
173 | if (!dev) | 163 | if (!dev) |
@@ -180,7 +170,6 @@ static int axnet_probe(struct pcmcia_device *link) | |||
180 | info->p_dev = link; | 170 | info->p_dev = link; |
181 | link->priv = dev; | 171 | link->priv = dev; |
182 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 172 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
183 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
184 | link->conf.Attributes = CONF_ENABLE_IRQ; | 173 | link->conf.Attributes = CONF_ENABLE_IRQ; |
185 | link->conf.IntType = INT_MEMORY_AND_IO; | 174 | link->conf.IntType = INT_MEMORY_AND_IO; |
186 | 175 | ||
@@ -205,7 +194,7 @@ static void axnet_detach(struct pcmcia_device *link) | |||
205 | { | 194 | { |
206 | struct net_device *dev = link->priv; | 195 | struct net_device *dev = link->priv; |
207 | 196 | ||
208 | DEBUG(0, "axnet_detach(0x%p)\n", link); | 197 | dev_dbg(&link->dev, "axnet_detach(0x%p)\n", link); |
209 | 198 | ||
210 | if (link->dev_node) | 199 | if (link->dev_node) |
211 | unregister_netdev(dev); | 200 | unregister_netdev(dev); |
@@ -272,9 +261,6 @@ static int get_prom(struct pcmcia_device *link) | |||
272 | 261 | ||
273 | ======================================================================*/ | 262 | ======================================================================*/ |
274 | 263 | ||
275 | #define CS_CHECK(fn, ret) \ | ||
276 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
277 | |||
278 | static int try_io_port(struct pcmcia_device *link) | 264 | static int try_io_port(struct pcmcia_device *link) |
279 | { | 265 | { |
280 | int j, ret; | 266 | int j, ret; |
@@ -341,26 +327,29 @@ static int axnet_config(struct pcmcia_device *link) | |||
341 | { | 327 | { |
342 | struct net_device *dev = link->priv; | 328 | struct net_device *dev = link->priv; |
343 | axnet_dev_t *info = PRIV(dev); | 329 | axnet_dev_t *info = PRIV(dev); |
344 | int i, j, j2, last_ret, last_fn; | 330 | int i, j, j2, ret; |
345 | 331 | ||
346 | DEBUG(0, "axnet_config(0x%p)\n", link); | 332 | dev_dbg(&link->dev, "axnet_config(0x%p)\n", link); |
347 | 333 | ||
348 | /* don't trust the CIS on this; Linksys got it wrong */ | 334 | /* don't trust the CIS on this; Linksys got it wrong */ |
349 | link->conf.Present = 0x63; | 335 | link->conf.Present = 0x63; |
350 | last_ret = pcmcia_loop_config(link, axnet_configcheck, NULL); | 336 | ret = pcmcia_loop_config(link, axnet_configcheck, NULL); |
351 | if (last_ret != 0) { | 337 | if (ret != 0) |
352 | cs_error(link, RequestIO, last_ret); | ||
353 | goto failed; | 338 | goto failed; |
354 | } | ||
355 | 339 | ||
356 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 340 | ret = pcmcia_request_irq(link, &link->irq); |
341 | if (ret) | ||
342 | goto failed; | ||
357 | 343 | ||
358 | if (link->io.NumPorts2 == 8) { | 344 | if (link->io.NumPorts2 == 8) { |
359 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 345 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
360 | link->conf.Status = CCSR_AUDIO_ENA; | 346 | link->conf.Status = CCSR_AUDIO_ENA; |
361 | } | 347 | } |
362 | 348 | ||
363 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 349 | ret = pcmcia_request_configuration(link, &link->conf); |
350 | if (ret) | ||
351 | goto failed; | ||
352 | |||
364 | dev->irq = link->irq.AssignedIRQ; | 353 | dev->irq = link->irq.AssignedIRQ; |
365 | dev->base_addr = link->io.BasePort1; | 354 | dev->base_addr = link->io.BasePort1; |
366 | 355 | ||
@@ -410,7 +399,7 @@ static int axnet_config(struct pcmcia_device *link) | |||
410 | 399 | ||
411 | info->phy_id = (i < 32) ? i : -1; | 400 | info->phy_id = (i < 32) ? i : -1; |
412 | link->dev_node = &info->node; | 401 | link->dev_node = &info->node; |
413 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 402 | SET_NETDEV_DEV(dev, &link->dev); |
414 | 403 | ||
415 | if (register_netdev(dev) != 0) { | 404 | if (register_netdev(dev) != 0) { |
416 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); | 405 | printk(KERN_NOTICE "axnet_cs: register_netdev() failed\n"); |
@@ -426,14 +415,12 @@ static int axnet_config(struct pcmcia_device *link) | |||
426 | dev->base_addr, dev->irq, | 415 | dev->base_addr, dev->irq, |
427 | dev->dev_addr); | 416 | dev->dev_addr); |
428 | if (info->phy_id != -1) { | 417 | if (info->phy_id != -1) { |
429 | DEBUG(0, " MII transceiver at index %d, status %x.\n", info->phy_id, j); | 418 | dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", info->phy_id, j); |
430 | } else { | 419 | } else { |
431 | printk(KERN_NOTICE " No MII transceivers found!\n"); | 420 | printk(KERN_NOTICE " No MII transceivers found!\n"); |
432 | } | 421 | } |
433 | return 0; | 422 | return 0; |
434 | 423 | ||
435 | cs_failed: | ||
436 | cs_error(link, last_fn, last_ret); | ||
437 | failed: | 424 | failed: |
438 | axnet_release(link); | 425 | axnet_release(link); |
439 | return -ENODEV; | 426 | return -ENODEV; |
@@ -543,7 +530,7 @@ static int axnet_open(struct net_device *dev) | |||
543 | struct pcmcia_device *link = info->p_dev; | 530 | struct pcmcia_device *link = info->p_dev; |
544 | unsigned int nic_base = dev->base_addr; | 531 | unsigned int nic_base = dev->base_addr; |
545 | 532 | ||
546 | DEBUG(2, "axnet_open('%s')\n", dev->name); | 533 | dev_dbg(&link->dev, "axnet_open('%s')\n", dev->name); |
547 | 534 | ||
548 | if (!pcmcia_dev_present(link)) | 535 | if (!pcmcia_dev_present(link)) |
549 | return -ENODEV; | 536 | return -ENODEV; |
@@ -572,7 +559,7 @@ static int axnet_close(struct net_device *dev) | |||
572 | axnet_dev_t *info = PRIV(dev); | 559 | axnet_dev_t *info = PRIV(dev); |
573 | struct pcmcia_device *link = info->p_dev; | 560 | struct pcmcia_device *link = info->p_dev; |
574 | 561 | ||
575 | DEBUG(2, "axnet_close('%s')\n", dev->name); | 562 | dev_dbg(&link->dev, "axnet_close('%s')\n", dev->name); |
576 | 563 | ||
577 | ax_close(dev); | 564 | ax_close(dev); |
578 | free_irq(dev->irq, dev); | 565 | free_irq(dev->irq, dev); |
@@ -741,10 +728,8 @@ static void block_input(struct net_device *dev, int count, | |||
741 | int xfer_count = count; | 728 | int xfer_count = count; |
742 | char *buf = skb->data; | 729 | char *buf = skb->data; |
743 | 730 | ||
744 | #ifdef PCMCIA_DEBUG | ||
745 | if ((ei_debug > 4) && (count != 4)) | 731 | if ((ei_debug > 4) && (count != 4)) |
746 | printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); | 732 | pr_debug("%s: [bi=%d]\n", dev->name, count+4); |
747 | #endif | ||
748 | outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); | 733 | outb_p(ring_offset & 0xff, nic_base + EN0_RSARLO); |
749 | outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); | 734 | outb_p(ring_offset >> 8, nic_base + EN0_RSARHI); |
750 | outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); | 735 | outb_p(E8390_RREAD+E8390_START, nic_base + AXNET_CMD); |
@@ -762,10 +747,7 @@ static void block_output(struct net_device *dev, int count, | |||
762 | { | 747 | { |
763 | unsigned int nic_base = dev->base_addr; | 748 | unsigned int nic_base = dev->base_addr; |
764 | 749 | ||
765 | #ifdef PCMCIA_DEBUG | 750 | pr_debug("%s: [bo=%d]\n", dev->name, count); |
766 | if (ei_debug > 4) | ||
767 | printk(KERN_DEBUG "%s: [bo=%d]\n", dev->name, count); | ||
768 | #endif | ||
769 | 751 | ||
770 | /* Round the count up for word writes. Do we need to do this? | 752 | /* Round the count up for word writes. Do we need to do this? |
771 | What effect will an odd byte count have on the 8390? | 753 | What effect will an odd byte count have on the 8390? |
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 7b5c77b7bd27..21d9c9d815d1 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -53,11 +53,7 @@ | |||
53 | 53 | ||
54 | #define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" | 54 | #define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" |
55 | 55 | ||
56 | #ifdef PCMCIA_DEBUG | 56 | #ifdef DEBUG |
57 | |||
58 | static int pc_debug = PCMCIA_DEBUG; | ||
59 | module_param(pc_debug, int, 0); | ||
60 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
61 | 57 | ||
62 | static void regdump(struct net_device *dev) | 58 | static void regdump(struct net_device *dev) |
63 | { | 59 | { |
@@ -92,7 +88,6 @@ static void regdump(struct net_device *dev) | |||
92 | 88 | ||
93 | #else | 89 | #else |
94 | 90 | ||
95 | #define DEBUG(n, args...) do { } while (0) | ||
96 | static inline void regdump(struct net_device *dev) { } | 91 | static inline void regdump(struct net_device *dev) { } |
97 | 92 | ||
98 | #endif | 93 | #endif |
@@ -144,7 +139,7 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
144 | struct net_device *dev; | 139 | struct net_device *dev; |
145 | struct arcnet_local *lp; | 140 | struct arcnet_local *lp; |
146 | 141 | ||
147 | DEBUG(0, "com20020_attach()\n"); | 142 | dev_dbg(&p_dev->dev, "com20020_attach()\n"); |
148 | 143 | ||
149 | /* Create new network device */ | 144 | /* Create new network device */ |
150 | info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); | 145 | info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); |
@@ -169,11 +164,10 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
169 | p_dev->io.NumPorts1 = 16; | 164 | p_dev->io.NumPorts1 = 16; |
170 | p_dev->io.IOAddrLines = 16; | 165 | p_dev->io.IOAddrLines = 16; |
171 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 166 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
172 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
173 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 167 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
174 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 168 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
175 | 169 | ||
176 | p_dev->irq.Instance = info->dev = dev; | 170 | info->dev = dev; |
177 | p_dev->priv = info; | 171 | p_dev->priv = info; |
178 | 172 | ||
179 | return com20020_config(p_dev); | 173 | return com20020_config(p_dev); |
@@ -198,12 +192,12 @@ static void com20020_detach(struct pcmcia_device *link) | |||
198 | struct com20020_dev_t *info = link->priv; | 192 | struct com20020_dev_t *info = link->priv; |
199 | struct net_device *dev = info->dev; | 193 | struct net_device *dev = info->dev; |
200 | 194 | ||
201 | DEBUG(1,"detach...\n"); | 195 | dev_dbg(&link->dev, "detach...\n"); |
202 | 196 | ||
203 | DEBUG(0, "com20020_detach(0x%p)\n", link); | 197 | dev_dbg(&link->dev, "com20020_detach\n"); |
204 | 198 | ||
205 | if (link->dev_node) { | 199 | if (link->dev_node) { |
206 | DEBUG(1,"unregister...\n"); | 200 | dev_dbg(&link->dev, "unregister...\n"); |
207 | 201 | ||
208 | unregister_netdev(dev); | 202 | unregister_netdev(dev); |
209 | 203 | ||
@@ -218,16 +212,16 @@ static void com20020_detach(struct pcmcia_device *link) | |||
218 | com20020_release(link); | 212 | com20020_release(link); |
219 | 213 | ||
220 | /* Unlink device structure, free bits */ | 214 | /* Unlink device structure, free bits */ |
221 | DEBUG(1,"unlinking...\n"); | 215 | dev_dbg(&link->dev, "unlinking...\n"); |
222 | if (link->priv) | 216 | if (link->priv) |
223 | { | 217 | { |
224 | dev = info->dev; | 218 | dev = info->dev; |
225 | if (dev) | 219 | if (dev) |
226 | { | 220 | { |
227 | DEBUG(1,"kfree...\n"); | 221 | dev_dbg(&link->dev, "kfree...\n"); |
228 | free_netdev(dev); | 222 | free_netdev(dev); |
229 | } | 223 | } |
230 | DEBUG(1,"kfree2...\n"); | 224 | dev_dbg(&link->dev, "kfree2...\n"); |
231 | kfree(info); | 225 | kfree(info); |
232 | } | 226 | } |
233 | 227 | ||
@@ -241,25 +235,22 @@ static void com20020_detach(struct pcmcia_device *link) | |||
241 | 235 | ||
242 | ======================================================================*/ | 236 | ======================================================================*/ |
243 | 237 | ||
244 | #define CS_CHECK(fn, ret) \ | ||
245 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
246 | |||
247 | static int com20020_config(struct pcmcia_device *link) | 238 | static int com20020_config(struct pcmcia_device *link) |
248 | { | 239 | { |
249 | struct arcnet_local *lp; | 240 | struct arcnet_local *lp; |
250 | com20020_dev_t *info; | 241 | com20020_dev_t *info; |
251 | struct net_device *dev; | 242 | struct net_device *dev; |
252 | int i, last_ret, last_fn; | 243 | int i, ret; |
253 | int ioaddr; | 244 | int ioaddr; |
254 | 245 | ||
255 | info = link->priv; | 246 | info = link->priv; |
256 | dev = info->dev; | 247 | dev = info->dev; |
257 | 248 | ||
258 | DEBUG(1,"config...\n"); | 249 | dev_dbg(&link->dev, "config...\n"); |
259 | 250 | ||
260 | DEBUG(0, "com20020_config(0x%p)\n", link); | 251 | dev_dbg(&link->dev, "com20020_config\n"); |
261 | 252 | ||
262 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); | 253 | dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1); |
263 | i = -ENODEV; | 254 | i = -ENODEV; |
264 | if (!link->io.BasePort1) | 255 | if (!link->io.BasePort1) |
265 | { | 256 | { |
@@ -276,26 +267,27 @@ static int com20020_config(struct pcmcia_device *link) | |||
276 | 267 | ||
277 | if (i != 0) | 268 | if (i != 0) |
278 | { | 269 | { |
279 | DEBUG(1,"arcnet: requestIO failed totally!\n"); | 270 | dev_dbg(&link->dev, "requestIO failed totally!\n"); |
280 | goto failed; | 271 | goto failed; |
281 | } | 272 | } |
282 | 273 | ||
283 | ioaddr = dev->base_addr = link->io.BasePort1; | 274 | ioaddr = dev->base_addr = link->io.BasePort1; |
284 | DEBUG(1,"arcnet: got ioaddr %Xh\n", ioaddr); | 275 | dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr); |
285 | 276 | ||
286 | DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n", | 277 | dev_dbg(&link->dev, "request IRQ %d\n", |
287 | link->irq.AssignedIRQ, | 278 | link->irq.AssignedIRQ); |
288 | link->irq.IRQInfo1, link->irq.IRQInfo2); | ||
289 | i = pcmcia_request_irq(link, &link->irq); | 279 | i = pcmcia_request_irq(link, &link->irq); |
290 | if (i != 0) | 280 | if (i != 0) |
291 | { | 281 | { |
292 | DEBUG(1,"arcnet: requestIRQ failed totally!\n"); | 282 | dev_dbg(&link->dev, "requestIRQ failed totally!\n"); |
293 | goto failed; | 283 | goto failed; |
294 | } | 284 | } |
295 | 285 | ||
296 | dev->irq = link->irq.AssignedIRQ; | 286 | dev->irq = link->irq.AssignedIRQ; |
297 | 287 | ||
298 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 288 | ret = pcmcia_request_configuration(link, &link->conf); |
289 | if (ret) | ||
290 | goto failed; | ||
299 | 291 | ||
300 | if (com20020_check(dev)) | 292 | if (com20020_check(dev)) |
301 | { | 293 | { |
@@ -308,26 +300,25 @@ static int com20020_config(struct pcmcia_device *link) | |||
308 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ | 300 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ |
309 | 301 | ||
310 | link->dev_node = &info->node; | 302 | link->dev_node = &info->node; |
311 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 303 | SET_NETDEV_DEV(dev, &link->dev); |
312 | 304 | ||
313 | i = com20020_found(dev, 0); /* calls register_netdev */ | 305 | i = com20020_found(dev, 0); /* calls register_netdev */ |
314 | 306 | ||
315 | if (i != 0) { | 307 | if (i != 0) { |
316 | DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); | 308 | dev_printk(KERN_NOTICE, &link->dev, |
309 | "com20020_cs: com20020_found() failed\n"); | ||
317 | link->dev_node = NULL; | 310 | link->dev_node = NULL; |
318 | goto failed; | 311 | goto failed; |
319 | } | 312 | } |
320 | 313 | ||
321 | strcpy(info->node.dev_name, dev->name); | 314 | strcpy(info->node.dev_name, dev->name); |
322 | 315 | ||
323 | DEBUG(1,KERN_INFO "%s: port %#3lx, irq %d\n", | 316 | dev_dbg(&link->dev,KERN_INFO "%s: port %#3lx, irq %d\n", |
324 | dev->name, dev->base_addr, dev->irq); | 317 | dev->name, dev->base_addr, dev->irq); |
325 | return 0; | 318 | return 0; |
326 | 319 | ||
327 | cs_failed: | ||
328 | cs_error(link, last_fn, last_ret); | ||
329 | failed: | 320 | failed: |
330 | DEBUG(1,"com20020_config failed...\n"); | 321 | dev_dbg(&link->dev, "com20020_config failed...\n"); |
331 | com20020_release(link); | 322 | com20020_release(link); |
332 | return -ENODEV; | 323 | return -ENODEV; |
333 | } /* com20020_config */ | 324 | } /* com20020_config */ |
@@ -342,7 +333,7 @@ failed: | |||
342 | 333 | ||
343 | static void com20020_release(struct pcmcia_device *link) | 334 | static void com20020_release(struct pcmcia_device *link) |
344 | { | 335 | { |
345 | DEBUG(0, "com20020_release(0x%p)\n", link); | 336 | dev_dbg(&link->dev, "com20020_release\n"); |
346 | pcmcia_disable_device(link); | 337 | pcmcia_disable_device(link); |
347 | } | 338 | } |
348 | 339 | ||
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 7e01fbdb87e0..6e3e1ced6db4 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -72,13 +72,6 @@ MODULE_LICENSE("GPL"); | |||
72 | /* 0:4KB*2 TX buffer else:8KB*2 TX buffer */ | 72 | /* 0:4KB*2 TX buffer else:8KB*2 TX buffer */ |
73 | INT_MODULE_PARM(sram_config, 0); | 73 | INT_MODULE_PARM(sram_config, 0); |
74 | 74 | ||
75 | #ifdef PCMCIA_DEBUG | ||
76 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
77 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
78 | static char *version = DRV_NAME ".c " DRV_VERSION " 2002/03/23"; | ||
79 | #else | ||
80 | #define DEBUG(n, args...) | ||
81 | #endif | ||
82 | 75 | ||
83 | /*====================================================================*/ | 76 | /*====================================================================*/ |
84 | /* | 77 | /* |
@@ -245,7 +238,7 @@ static int fmvj18x_probe(struct pcmcia_device *link) | |||
245 | local_info_t *lp; | 238 | local_info_t *lp; |
246 | struct net_device *dev; | 239 | struct net_device *dev; |
247 | 240 | ||
248 | DEBUG(0, "fmvj18x_attach()\n"); | 241 | dev_dbg(&link->dev, "fmvj18x_attach()\n"); |
249 | 242 | ||
250 | /* Make up a FMVJ18x specific data structure */ | 243 | /* Make up a FMVJ18x specific data structure */ |
251 | dev = alloc_etherdev(sizeof(local_info_t)); | 244 | dev = alloc_etherdev(sizeof(local_info_t)); |
@@ -262,10 +255,8 @@ static int fmvj18x_probe(struct pcmcia_device *link) | |||
262 | link->io.IOAddrLines = 5; | 255 | link->io.IOAddrLines = 5; |
263 | 256 | ||
264 | /* Interrupt setup */ | 257 | /* Interrupt setup */ |
265 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; | 258 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
266 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
267 | link->irq.Handler = &fjn_interrupt; | 259 | link->irq.Handler = &fjn_interrupt; |
268 | link->irq.Instance = dev; | ||
269 | 260 | ||
270 | /* General socket configuration */ | 261 | /* General socket configuration */ |
271 | link->conf.Attributes = CONF_ENABLE_IRQ; | 262 | link->conf.Attributes = CONF_ENABLE_IRQ; |
@@ -285,7 +276,7 @@ static void fmvj18x_detach(struct pcmcia_device *link) | |||
285 | { | 276 | { |
286 | struct net_device *dev = link->priv; | 277 | struct net_device *dev = link->priv; |
287 | 278 | ||
288 | DEBUG(0, "fmvj18x_detach(0x%p)\n", link); | 279 | dev_dbg(&link->dev, "fmvj18x_detach\n"); |
289 | 280 | ||
290 | if (link->dev_node) | 281 | if (link->dev_node) |
291 | unregister_netdev(dev); | 282 | unregister_netdev(dev); |
@@ -297,9 +288,6 @@ static void fmvj18x_detach(struct pcmcia_device *link) | |||
297 | 288 | ||
298 | /*====================================================================*/ | 289 | /*====================================================================*/ |
299 | 290 | ||
300 | #define CS_CHECK(fn, ret) \ | ||
301 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
302 | |||
303 | static int mfc_try_io_port(struct pcmcia_device *link) | 291 | static int mfc_try_io_port(struct pcmcia_device *link) |
304 | { | 292 | { |
305 | int i, ret; | 293 | int i, ret; |
@@ -341,33 +329,38 @@ static int ungermann_try_io_port(struct pcmcia_device *link) | |||
341 | return ret; /* RequestIO failed */ | 329 | return ret; /* RequestIO failed */ |
342 | } | 330 | } |
343 | 331 | ||
332 | static int fmvj18x_ioprobe(struct pcmcia_device *p_dev, | ||
333 | cistpl_cftable_entry_t *cfg, | ||
334 | cistpl_cftable_entry_t *dflt, | ||
335 | unsigned int vcc, | ||
336 | void *priv_data) | ||
337 | { | ||
338 | return 0; /* strange, but that's what the code did already before... */ | ||
339 | } | ||
340 | |||
344 | static int fmvj18x_config(struct pcmcia_device *link) | 341 | static int fmvj18x_config(struct pcmcia_device *link) |
345 | { | 342 | { |
346 | struct net_device *dev = link->priv; | 343 | struct net_device *dev = link->priv; |
347 | local_info_t *lp = netdev_priv(dev); | 344 | local_info_t *lp = netdev_priv(dev); |
348 | tuple_t tuple; | 345 | int i, ret; |
349 | cisparse_t parse; | ||
350 | u_short buf[32]; | ||
351 | int i, last_fn = 0, last_ret = 0, ret; | ||
352 | unsigned int ioaddr; | 346 | unsigned int ioaddr; |
353 | cardtype_t cardtype; | 347 | cardtype_t cardtype; |
354 | char *card_name = "unknown"; | 348 | char *card_name = "unknown"; |
355 | u_char *node_id; | 349 | u8 *buf; |
350 | size_t len; | ||
351 | u_char buggybuf[32]; | ||
352 | |||
353 | dev_dbg(&link->dev, "fmvj18x_config\n"); | ||
356 | 354 | ||
357 | DEBUG(0, "fmvj18x_config(0x%p)\n", link); | 355 | len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); |
356 | kfree(buf); | ||
358 | 357 | ||
359 | tuple.TupleData = (u_char *)buf; | 358 | if (len) { |
360 | tuple.TupleDataMax = 64; | ||
361 | tuple.TupleOffset = 0; | ||
362 | tuple.DesiredTuple = CISTPL_FUNCE; | ||
363 | tuple.TupleOffset = 0; | ||
364 | if (pcmcia_get_first_tuple(link, &tuple) == 0) { | ||
365 | /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ | 359 | /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ |
366 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 360 | ret = pcmcia_loop_config(link, fmvj18x_ioprobe, NULL); |
367 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 361 | if (ret != 0) |
368 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 362 | goto failed; |
369 | CS_CHECK(ParseTuple, pcmcia_parse_tuple(&tuple, &parse)); | 363 | |
370 | link->conf.ConfigIndex = parse.cftable_entry.index; | ||
371 | switch (link->manf_id) { | 364 | switch (link->manf_id) { |
372 | case MANFID_TDK: | 365 | case MANFID_TDK: |
373 | cardtype = TDK; | 366 | cardtype = TDK; |
@@ -433,17 +426,24 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
433 | 426 | ||
434 | if (link->io.NumPorts2 != 0) { | 427 | if (link->io.NumPorts2 != 0) { |
435 | link->irq.Attributes = | 428 | link->irq.Attributes = |
436 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; | 429 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
437 | ret = mfc_try_io_port(link); | 430 | ret = mfc_try_io_port(link); |
438 | if (ret != 0) goto cs_failed; | 431 | if (ret != 0) goto failed; |
439 | } else if (cardtype == UNGERMANN) { | 432 | } else if (cardtype == UNGERMANN) { |
440 | ret = ungermann_try_io_port(link); | 433 | ret = ungermann_try_io_port(link); |
441 | if (ret != 0) goto cs_failed; | 434 | if (ret != 0) goto failed; |
442 | } else { | 435 | } else { |
443 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | 436 | ret = pcmcia_request_io(link, &link->io); |
437 | if (ret) | ||
438 | goto failed; | ||
444 | } | 439 | } |
445 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 440 | ret = pcmcia_request_irq(link, &link->irq); |
446 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 441 | if (ret) |
442 | goto failed; | ||
443 | ret = pcmcia_request_configuration(link, &link->conf); | ||
444 | if (ret) | ||
445 | goto failed; | ||
446 | |||
447 | dev->irq = link->irq.AssignedIRQ; | 447 | dev->irq = link->irq.AssignedIRQ; |
448 | dev->base_addr = link->io.BasePort1; | 448 | dev->base_addr = link->io.BasePort1; |
449 | 449 | ||
@@ -474,21 +474,21 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
474 | case CONTEC: | 474 | case CONTEC: |
475 | case NEC: | 475 | case NEC: |
476 | case KME: | 476 | case KME: |
477 | tuple.DesiredTuple = CISTPL_FUNCE; | ||
478 | tuple.TupleOffset = 0; | ||
479 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | ||
480 | tuple.TupleOffset = 0; | ||
481 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | ||
482 | if (cardtype == MBH10304) { | 477 | if (cardtype == MBH10304) { |
483 | /* MBH10304's CIS_FUNCE is corrupted */ | ||
484 | node_id = &(tuple.TupleData[5]); | ||
485 | card_name = "FMV-J182"; | 478 | card_name = "FMV-J182"; |
486 | } else { | 479 | |
487 | while (tuple.TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID ) { | 480 | len = pcmcia_get_tuple(link, CISTPL_FUNCE, &buf); |
488 | CS_CHECK(GetNextTuple, pcmcia_get_next_tuple(link, &tuple)); | 481 | if (len < 11) { |
489 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 482 | kfree(buf); |
483 | goto failed; | ||
490 | } | 484 | } |
491 | node_id = &(tuple.TupleData[2]); | 485 | /* Read MACID from CIS */ |
486 | for (i = 5; i < 11; i++) | ||
487 | dev->dev_addr[i] = buf[i]; | ||
488 | kfree(buf); | ||
489 | } else { | ||
490 | if (pcmcia_get_mac_from_cis(link, dev)) | ||
491 | goto failed; | ||
492 | if( cardtype == TDK ) { | 492 | if( cardtype == TDK ) { |
493 | card_name = "TDK LAK-CD021"; | 493 | card_name = "TDK LAK-CD021"; |
494 | } else if( cardtype == LA501 ) { | 494 | } else if( cardtype == LA501 ) { |
@@ -501,9 +501,6 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
501 | card_name = "C-NET(PC)C"; | 501 | card_name = "C-NET(PC)C"; |
502 | } | 502 | } |
503 | } | 503 | } |
504 | /* Read MACID from CIS */ | ||
505 | for (i = 0; i < 6; i++) | ||
506 | dev->dev_addr[i] = node_id[i]; | ||
507 | break; | 504 | break; |
508 | case UNGERMANN: | 505 | case UNGERMANN: |
509 | /* Read MACID from register */ | 506 | /* Read MACID from register */ |
@@ -513,12 +510,12 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
513 | break; | 510 | break; |
514 | case XXX10304: | 511 | case XXX10304: |
515 | /* Read MACID from Buggy CIS */ | 512 | /* Read MACID from Buggy CIS */ |
516 | if (fmvj18x_get_hwinfo(link, tuple.TupleData) == -1) { | 513 | if (fmvj18x_get_hwinfo(link, buggybuf) == -1) { |
517 | printk(KERN_NOTICE "fmvj18x_cs: unable to read hardware net address.\n"); | 514 | printk(KERN_NOTICE "fmvj18x_cs: unable to read hardware net address.\n"); |
518 | goto failed; | 515 | goto failed; |
519 | } | 516 | } |
520 | for (i = 0 ; i < 6; i++) { | 517 | for (i = 0 ; i < 6; i++) { |
521 | dev->dev_addr[i] = tuple.TupleData[i]; | 518 | dev->dev_addr[i] = buggybuf[i]; |
522 | } | 519 | } |
523 | card_name = "FMV-J182"; | 520 | card_name = "FMV-J182"; |
524 | break; | 521 | break; |
@@ -533,7 +530,7 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
533 | 530 | ||
534 | lp->cardtype = cardtype; | 531 | lp->cardtype = cardtype; |
535 | link->dev_node = &lp->node; | 532 | link->dev_node = &lp->node; |
536 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 533 | SET_NETDEV_DEV(dev, &link->dev); |
537 | 534 | ||
538 | if (register_netdev(dev) != 0) { | 535 | if (register_netdev(dev) != 0) { |
539 | printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n"); | 536 | printk(KERN_NOTICE "fmvj18x_cs: register_netdev() failed\n"); |
@@ -551,9 +548,6 @@ static int fmvj18x_config(struct pcmcia_device *link) | |||
551 | 548 | ||
552 | return 0; | 549 | return 0; |
553 | 550 | ||
554 | cs_failed: | ||
555 | /* All Card Services errors end up here */ | ||
556 | cs_error(link, last_fn, last_ret); | ||
557 | failed: | 551 | failed: |
558 | fmvj18x_release(link); | 552 | fmvj18x_release(link); |
559 | return -ENODEV; | 553 | return -ENODEV; |
@@ -571,16 +565,14 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
571 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 565 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
572 | req.Base = 0; req.Size = 0; | 566 | req.Base = 0; req.Size = 0; |
573 | req.AccessSpeed = 0; | 567 | req.AccessSpeed = 0; |
574 | i = pcmcia_request_window(&link, &req, &link->win); | 568 | i = pcmcia_request_window(link, &req, &link->win); |
575 | if (i != 0) { | 569 | if (i != 0) |
576 | cs_error(link, RequestWindow, i); | ||
577 | return -1; | 570 | return -1; |
578 | } | ||
579 | 571 | ||
580 | base = ioremap(req.Base, req.Size); | 572 | base = ioremap(req.Base, req.Size); |
581 | mem.Page = 0; | 573 | mem.Page = 0; |
582 | mem.CardOffset = 0; | 574 | mem.CardOffset = 0; |
583 | pcmcia_map_mem_page(link->win, &mem); | 575 | pcmcia_map_mem_page(link, link->win, &mem); |
584 | 576 | ||
585 | /* | 577 | /* |
586 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format | 578 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format |
@@ -605,9 +597,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
605 | } | 597 | } |
606 | 598 | ||
607 | iounmap(base); | 599 | iounmap(base); |
608 | j = pcmcia_release_window(link->win); | 600 | j = pcmcia_release_window(link, link->win); |
609 | if (j != 0) | ||
610 | cs_error(link, ReleaseWindow, j); | ||
611 | return (i != 0x200) ? 0 : -1; | 601 | return (i != 0x200) ? 0 : -1; |
612 | 602 | ||
613 | } /* fmvj18x_get_hwinfo */ | 603 | } /* fmvj18x_get_hwinfo */ |
@@ -626,11 +616,9 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) | |||
626 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 616 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
627 | req.Base = 0; req.Size = 0; | 617 | req.Base = 0; req.Size = 0; |
628 | req.AccessSpeed = 0; | 618 | req.AccessSpeed = 0; |
629 | i = pcmcia_request_window(&link, &req, &link->win); | 619 | i = pcmcia_request_window(link, &req, &link->win); |
630 | if (i != 0) { | 620 | if (i != 0) |
631 | cs_error(link, RequestWindow, i); | ||
632 | return -1; | 621 | return -1; |
633 | } | ||
634 | 622 | ||
635 | lp->base = ioremap(req.Base, req.Size); | 623 | lp->base = ioremap(req.Base, req.Size); |
636 | if (lp->base == NULL) { | 624 | if (lp->base == NULL) { |
@@ -640,11 +628,10 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) | |||
640 | 628 | ||
641 | mem.Page = 0; | 629 | mem.Page = 0; |
642 | mem.CardOffset = 0; | 630 | mem.CardOffset = 0; |
643 | i = pcmcia_map_mem_page(link->win, &mem); | 631 | i = pcmcia_map_mem_page(link, link->win, &mem); |
644 | if (i != 0) { | 632 | if (i != 0) { |
645 | iounmap(lp->base); | 633 | iounmap(lp->base); |
646 | lp->base = NULL; | 634 | lp->base = NULL; |
647 | cs_error(link, MapMemPage, i); | ||
648 | return -1; | 635 | return -1; |
649 | } | 636 | } |
650 | 637 | ||
@@ -671,15 +658,13 @@ static void fmvj18x_release(struct pcmcia_device *link) | |||
671 | u_char __iomem *tmp; | 658 | u_char __iomem *tmp; |
672 | int j; | 659 | int j; |
673 | 660 | ||
674 | DEBUG(0, "fmvj18x_release(0x%p)\n", link); | 661 | dev_dbg(&link->dev, "fmvj18x_release\n"); |
675 | 662 | ||
676 | if (lp->base != NULL) { | 663 | if (lp->base != NULL) { |
677 | tmp = lp->base; | 664 | tmp = lp->base; |
678 | lp->base = NULL; /* set NULL before iounmap */ | 665 | lp->base = NULL; /* set NULL before iounmap */ |
679 | iounmap(tmp); | 666 | iounmap(tmp); |
680 | j = pcmcia_release_window(link->win); | 667 | j = pcmcia_release_window(link, link->win); |
681 | if (j != 0) | ||
682 | cs_error(link, ReleaseWindow, j); | ||
683 | } | 668 | } |
684 | 669 | ||
685 | pcmcia_disable_device(link); | 670 | pcmcia_disable_device(link); |
@@ -788,8 +773,8 @@ static irqreturn_t fjn_interrupt(int dummy, void *dev_id) | |||
788 | outb(tx_stat, ioaddr + TX_STATUS); | 773 | outb(tx_stat, ioaddr + TX_STATUS); |
789 | outb(rx_stat, ioaddr + RX_STATUS); | 774 | outb(rx_stat, ioaddr + RX_STATUS); |
790 | 775 | ||
791 | DEBUG(4, "%s: interrupt, rx_status %02x.\n", dev->name, rx_stat); | 776 | pr_debug("%s: interrupt, rx_status %02x.\n", dev->name, rx_stat); |
792 | DEBUG(4, " tx_status %02x.\n", tx_stat); | 777 | pr_debug(" tx_status %02x.\n", tx_stat); |
793 | 778 | ||
794 | if (rx_stat || (inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { | 779 | if (rx_stat || (inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { |
795 | /* there is packet(s) in rx buffer */ | 780 | /* there is packet(s) in rx buffer */ |
@@ -809,8 +794,8 @@ static irqreturn_t fjn_interrupt(int dummy, void *dev_id) | |||
809 | } | 794 | } |
810 | netif_wake_queue(dev); | 795 | netif_wake_queue(dev); |
811 | } | 796 | } |
812 | DEBUG(4, "%s: exiting interrupt,\n", dev->name); | 797 | pr_debug("%s: exiting interrupt,\n", dev->name); |
813 | DEBUG(4, " tx_status %02x, rx_status %02x.\n", tx_stat, rx_stat); | 798 | pr_debug(" tx_status %02x, rx_status %02x.\n", tx_stat, rx_stat); |
814 | 799 | ||
815 | outb(D_TX_INTR, ioaddr + TX_INTR); | 800 | outb(D_TX_INTR, ioaddr + TX_INTR); |
816 | outb(D_RX_INTR, ioaddr + RX_INTR); | 801 | outb(D_RX_INTR, ioaddr + RX_INTR); |
@@ -882,7 +867,7 @@ static netdev_tx_t fjn_start_xmit(struct sk_buff *skb, | |||
882 | return NETDEV_TX_BUSY; | 867 | return NETDEV_TX_BUSY; |
883 | } | 868 | } |
884 | 869 | ||
885 | DEBUG(4, "%s: Transmitting a packet of length %lu.\n", | 870 | pr_debug("%s: Transmitting a packet of length %lu.\n", |
886 | dev->name, (unsigned long)skb->len); | 871 | dev->name, (unsigned long)skb->len); |
887 | dev->stats.tx_bytes += skb->len; | 872 | dev->stats.tx_bytes += skb->len; |
888 | 873 | ||
@@ -937,7 +922,7 @@ static void fjn_reset(struct net_device *dev) | |||
937 | unsigned int ioaddr = dev->base_addr; | 922 | unsigned int ioaddr = dev->base_addr; |
938 | int i; | 923 | int i; |
939 | 924 | ||
940 | DEBUG(4, "fjn_reset(%s) called.\n",dev->name); | 925 | pr_debug("fjn_reset(%s) called.\n",dev->name); |
941 | 926 | ||
942 | /* Reset controller */ | 927 | /* Reset controller */ |
943 | if( sram_config == 0 ) | 928 | if( sram_config == 0 ) |
@@ -1015,13 +1000,13 @@ static void fjn_rx(struct net_device *dev) | |||
1015 | unsigned int ioaddr = dev->base_addr; | 1000 | unsigned int ioaddr = dev->base_addr; |
1016 | int boguscount = 10; /* 5 -> 10: by agy 19940922 */ | 1001 | int boguscount = 10; /* 5 -> 10: by agy 19940922 */ |
1017 | 1002 | ||
1018 | DEBUG(4, "%s: in rx_packet(), rx_status %02x.\n", | 1003 | pr_debug("%s: in rx_packet(), rx_status %02x.\n", |
1019 | dev->name, inb(ioaddr + RX_STATUS)); | 1004 | dev->name, inb(ioaddr + RX_STATUS)); |
1020 | 1005 | ||
1021 | while ((inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { | 1006 | while ((inb(ioaddr + RX_MODE) & F_BUF_EMP) == 0) { |
1022 | u_short status = inw(ioaddr + DATAPORT); | 1007 | u_short status = inw(ioaddr + DATAPORT); |
1023 | 1008 | ||
1024 | DEBUG(4, "%s: Rxing packet mode %02x status %04x.\n", | 1009 | pr_debug("%s: Rxing packet mode %02x status %04x.\n", |
1025 | dev->name, inb(ioaddr + RX_MODE), status); | 1010 | dev->name, inb(ioaddr + RX_MODE), status); |
1026 | #ifndef final_version | 1011 | #ifndef final_version |
1027 | if (status == 0) { | 1012 | if (status == 0) { |
@@ -1061,16 +1046,14 @@ static void fjn_rx(struct net_device *dev) | |||
1061 | (pkt_len + 1) >> 1); | 1046 | (pkt_len + 1) >> 1); |
1062 | skb->protocol = eth_type_trans(skb, dev); | 1047 | skb->protocol = eth_type_trans(skb, dev); |
1063 | 1048 | ||
1064 | #ifdef PCMCIA_DEBUG | 1049 | { |
1065 | if (pc_debug > 5) { | ||
1066 | int i; | 1050 | int i; |
1067 | printk(KERN_DEBUG "%s: Rxed packet of length %d: ", | 1051 | pr_debug("%s: Rxed packet of length %d: ", |
1068 | dev->name, pkt_len); | 1052 | dev->name, pkt_len); |
1069 | for (i = 0; i < 14; i++) | 1053 | for (i = 0; i < 14; i++) |
1070 | printk(" %02x", skb->data[i]); | 1054 | pr_debug(" %02x", skb->data[i]); |
1071 | printk(".\n"); | 1055 | pr_debug(".\n"); |
1072 | } | 1056 | } |
1073 | #endif | ||
1074 | 1057 | ||
1075 | netif_rx(skb); | 1058 | netif_rx(skb); |
1076 | dev->stats.rx_packets++; | 1059 | dev->stats.rx_packets++; |
@@ -1094,7 +1077,7 @@ static void fjn_rx(struct net_device *dev) | |||
1094 | } | 1077 | } |
1095 | 1078 | ||
1096 | if (i > 0) | 1079 | if (i > 0) |
1097 | DEBUG(5, "%s: Exint Rx packet with mode %02x after " | 1080 | pr_debug("%s: Exint Rx packet with mode %02x after " |
1098 | "%d ticks.\n", dev->name, inb(ioaddr + RX_MODE), i); | 1081 | "%d ticks.\n", dev->name, inb(ioaddr + RX_MODE), i); |
1099 | } | 1082 | } |
1100 | */ | 1083 | */ |
@@ -1112,24 +1095,8 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
1112 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | 1095 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); |
1113 | } | 1096 | } |
1114 | 1097 | ||
1115 | #ifdef PCMCIA_DEBUG | ||
1116 | static u32 netdev_get_msglevel(struct net_device *dev) | ||
1117 | { | ||
1118 | return pc_debug; | ||
1119 | } | ||
1120 | |||
1121 | static void netdev_set_msglevel(struct net_device *dev, u32 level) | ||
1122 | { | ||
1123 | pc_debug = level; | ||
1124 | } | ||
1125 | #endif /* PCMCIA_DEBUG */ | ||
1126 | |||
1127 | static const struct ethtool_ops netdev_ethtool_ops = { | 1098 | static const struct ethtool_ops netdev_ethtool_ops = { |
1128 | .get_drvinfo = netdev_get_drvinfo, | 1099 | .get_drvinfo = netdev_get_drvinfo, |
1129 | #ifdef PCMCIA_DEBUG | ||
1130 | .get_msglevel = netdev_get_msglevel, | ||
1131 | .set_msglevel = netdev_set_msglevel, | ||
1132 | #endif /* PCMCIA_DEBUG */ | ||
1133 | }; | 1100 | }; |
1134 | 1101 | ||
1135 | static int fjn_config(struct net_device *dev, struct ifmap *map){ | 1102 | static int fjn_config(struct net_device *dev, struct ifmap *map){ |
@@ -1141,7 +1108,7 @@ static int fjn_open(struct net_device *dev) | |||
1141 | struct local_info_t *lp = netdev_priv(dev); | 1108 | struct local_info_t *lp = netdev_priv(dev); |
1142 | struct pcmcia_device *link = lp->p_dev; | 1109 | struct pcmcia_device *link = lp->p_dev; |
1143 | 1110 | ||
1144 | DEBUG(4, "fjn_open('%s').\n", dev->name); | 1111 | pr_debug("fjn_open('%s').\n", dev->name); |
1145 | 1112 | ||
1146 | if (!pcmcia_dev_present(link)) | 1113 | if (!pcmcia_dev_present(link)) |
1147 | return -ENODEV; | 1114 | return -ENODEV; |
@@ -1167,7 +1134,7 @@ static int fjn_close(struct net_device *dev) | |||
1167 | struct pcmcia_device *link = lp->p_dev; | 1134 | struct pcmcia_device *link = lp->p_dev; |
1168 | unsigned int ioaddr = dev->base_addr; | 1135 | unsigned int ioaddr = dev->base_addr; |
1169 | 1136 | ||
1170 | DEBUG(4, "fjn_close('%s').\n", dev->name); | 1137 | pr_debug("fjn_close('%s').\n", dev->name); |
1171 | 1138 | ||
1172 | lp->open_time = 0; | 1139 | lp->open_time = 0; |
1173 | netif_stop_queue(dev); | 1140 | netif_stop_queue(dev); |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index 06618af1a468..37f4a6fdc3ef 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -69,17 +69,6 @@ | |||
69 | #define PCMCIA | 69 | #define PCMCIA |
70 | #include "../tokenring/ibmtr.c" | 70 | #include "../tokenring/ibmtr.c" |
71 | 71 | ||
72 | #ifdef PCMCIA_DEBUG | ||
73 | static int pc_debug = PCMCIA_DEBUG; | ||
74 | module_param(pc_debug, int, 0); | ||
75 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
76 | static char *version = | ||
77 | "ibmtr_cs.c 1.10 1996/01/06 05:19:00 (Steve Kipisz)\n" | ||
78 | " 2.2.7 1999/05/03 12:00:00 (Mike Phillips)\n" | ||
79 | " 2.4.2 2001/30/28 Midnight (Burt Silverman)\n"; | ||
80 | #else | ||
81 | #define DEBUG(n, args...) | ||
82 | #endif | ||
83 | 72 | ||
84 | /*====================================================================*/ | 73 | /*====================================================================*/ |
85 | 74 | ||
@@ -130,6 +119,12 @@ static const struct ethtool_ops netdev_ethtool_ops = { | |||
130 | .get_drvinfo = netdev_get_drvinfo, | 119 | .get_drvinfo = netdev_get_drvinfo, |
131 | }; | 120 | }; |
132 | 121 | ||
122 | static irqreturn_t ibmtr_interrupt(int irq, void *dev_id) { | ||
123 | ibmtr_dev_t *info = dev_id; | ||
124 | struct net_device *dev = info->dev; | ||
125 | return tok_interrupt(irq, dev); | ||
126 | }; | ||
127 | |||
133 | /*====================================================================== | 128 | /*====================================================================== |
134 | 129 | ||
135 | ibmtr_attach() creates an "instance" of the driver, allocating | 130 | ibmtr_attach() creates an "instance" of the driver, allocating |
@@ -143,7 +138,7 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) | |||
143 | ibmtr_dev_t *info; | 138 | ibmtr_dev_t *info; |
144 | struct net_device *dev; | 139 | struct net_device *dev; |
145 | 140 | ||
146 | DEBUG(0, "ibmtr_attach()\n"); | 141 | dev_dbg(&link->dev, "ibmtr_attach()\n"); |
147 | 142 | ||
148 | /* Create new token-ring device */ | 143 | /* Create new token-ring device */ |
149 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 144 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
@@ -161,14 +156,13 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link) | |||
161 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 156 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
162 | link->io.NumPorts1 = 4; | 157 | link->io.NumPorts1 = 4; |
163 | link->io.IOAddrLines = 16; | 158 | link->io.IOAddrLines = 16; |
164 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 159 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
165 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | 160 | link->irq.Handler = ibmtr_interrupt; |
166 | link->irq.Handler = &tok_interrupt; | ||
167 | link->conf.Attributes = CONF_ENABLE_IRQ; | 161 | link->conf.Attributes = CONF_ENABLE_IRQ; |
168 | link->conf.IntType = INT_MEMORY_AND_IO; | 162 | link->conf.IntType = INT_MEMORY_AND_IO; |
169 | link->conf.Present = PRESENT_OPTION; | 163 | link->conf.Present = PRESENT_OPTION; |
170 | 164 | ||
171 | link->irq.Instance = info->dev = dev; | 165 | info->dev = dev; |
172 | 166 | ||
173 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); | 167 | SET_ETHTOOL_OPS(dev, &netdev_ethtool_ops); |
174 | 168 | ||
@@ -190,7 +184,7 @@ static void ibmtr_detach(struct pcmcia_device *link) | |||
190 | struct net_device *dev = info->dev; | 184 | struct net_device *dev = info->dev; |
191 | struct tok_info *ti = netdev_priv(dev); | 185 | struct tok_info *ti = netdev_priv(dev); |
192 | 186 | ||
193 | DEBUG(0, "ibmtr_detach(0x%p)\n", link); | 187 | dev_dbg(&link->dev, "ibmtr_detach\n"); |
194 | 188 | ||
195 | /* | 189 | /* |
196 | * When the card removal interrupt hits tok_interrupt(), | 190 | * When the card removal interrupt hits tok_interrupt(), |
@@ -217,9 +211,6 @@ static void ibmtr_detach(struct pcmcia_device *link) | |||
217 | 211 | ||
218 | ======================================================================*/ | 212 | ======================================================================*/ |
219 | 213 | ||
220 | #define CS_CHECK(fn, ret) \ | ||
221 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
222 | |||
223 | static int __devinit ibmtr_config(struct pcmcia_device *link) | 214 | static int __devinit ibmtr_config(struct pcmcia_device *link) |
224 | { | 215 | { |
225 | ibmtr_dev_t *info = link->priv; | 216 | ibmtr_dev_t *info = link->priv; |
@@ -227,9 +218,9 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
227 | struct tok_info *ti = netdev_priv(dev); | 218 | struct tok_info *ti = netdev_priv(dev); |
228 | win_req_t req; | 219 | win_req_t req; |
229 | memreq_t mem; | 220 | memreq_t mem; |
230 | int i, last_ret, last_fn; | 221 | int i, ret; |
231 | 222 | ||
232 | DEBUG(0, "ibmtr_config(0x%p)\n", link); | 223 | dev_dbg(&link->dev, "ibmtr_config\n"); |
233 | 224 | ||
234 | link->conf.ConfigIndex = 0x61; | 225 | link->conf.ConfigIndex = 0x61; |
235 | 226 | ||
@@ -241,11 +232,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
241 | if (i != 0) { | 232 | if (i != 0) { |
242 | /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ | 233 | /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ |
243 | link->io.BasePort1 = 0xA24; | 234 | link->io.BasePort1 = 0xA24; |
244 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | 235 | ret = pcmcia_request_io(link, &link->io); |
236 | if (ret) | ||
237 | goto failed; | ||
245 | } | 238 | } |
246 | dev->base_addr = link->io.BasePort1; | 239 | dev->base_addr = link->io.BasePort1; |
247 | 240 | ||
248 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 241 | ret = pcmcia_request_irq(link, &link->irq); |
242 | if (ret) | ||
243 | goto failed; | ||
249 | dev->irq = link->irq.AssignedIRQ; | 244 | dev->irq = link->irq.AssignedIRQ; |
250 | ti->irq = link->irq.AssignedIRQ; | 245 | ti->irq = link->irq.AssignedIRQ; |
251 | ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); | 246 | ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); |
@@ -256,11 +251,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
256 | req.Base = 0; | 251 | req.Base = 0; |
257 | req.Size = 0x2000; | 252 | req.Size = 0x2000; |
258 | req.AccessSpeed = 250; | 253 | req.AccessSpeed = 250; |
259 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); | 254 | ret = pcmcia_request_window(link, &req, &link->win); |
255 | if (ret) | ||
256 | goto failed; | ||
260 | 257 | ||
261 | mem.CardOffset = mmiobase; | 258 | mem.CardOffset = mmiobase; |
262 | mem.Page = 0; | 259 | mem.Page = 0; |
263 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); | 260 | ret = pcmcia_map_mem_page(link, link->win, &mem); |
261 | if (ret) | ||
262 | goto failed; | ||
264 | ti->mmio = ioremap(req.Base, req.Size); | 263 | ti->mmio = ioremap(req.Base, req.Size); |
265 | 264 | ||
266 | /* Allocate the SRAM memory window */ | 265 | /* Allocate the SRAM memory window */ |
@@ -269,17 +268,23 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
269 | req.Base = 0; | 268 | req.Base = 0; |
270 | req.Size = sramsize * 1024; | 269 | req.Size = sramsize * 1024; |
271 | req.AccessSpeed = 250; | 270 | req.AccessSpeed = 250; |
272 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &info->sram_win_handle)); | 271 | ret = pcmcia_request_window(link, &req, &info->sram_win_handle); |
272 | if (ret) | ||
273 | goto failed; | ||
273 | 274 | ||
274 | mem.CardOffset = srambase; | 275 | mem.CardOffset = srambase; |
275 | mem.Page = 0; | 276 | mem.Page = 0; |
276 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(info->sram_win_handle, &mem)); | 277 | ret = pcmcia_map_mem_page(link, info->sram_win_handle, &mem); |
278 | if (ret) | ||
279 | goto failed; | ||
277 | 280 | ||
278 | ti->sram_base = mem.CardOffset >> 12; | 281 | ti->sram_base = mem.CardOffset >> 12; |
279 | ti->sram_virt = ioremap(req.Base, req.Size); | 282 | ti->sram_virt = ioremap(req.Base, req.Size); |
280 | ti->sram_phys = req.Base; | 283 | ti->sram_phys = req.Base; |
281 | 284 | ||
282 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 285 | ret = pcmcia_request_configuration(link, &link->conf); |
286 | if (ret) | ||
287 | goto failed; | ||
283 | 288 | ||
284 | /* Set up the Token-Ring Controller Configuration Register and | 289 | /* Set up the Token-Ring Controller Configuration Register and |
285 | turn on the card. Check the "Local Area Network Credit Card | 290 | turn on the card. Check the "Local Area Network Credit Card |
@@ -287,7 +292,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
287 | ibmtr_hw_setup(dev, mmiobase); | 292 | ibmtr_hw_setup(dev, mmiobase); |
288 | 293 | ||
289 | link->dev_node = &info->node; | 294 | link->dev_node = &info->node; |
290 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 295 | SET_NETDEV_DEV(dev, &link->dev); |
291 | 296 | ||
292 | i = ibmtr_probe_card(dev); | 297 | i = ibmtr_probe_card(dev); |
293 | if (i != 0) { | 298 | if (i != 0) { |
@@ -305,8 +310,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
305 | dev->dev_addr); | 310 | dev->dev_addr); |
306 | return 0; | 311 | return 0; |
307 | 312 | ||
308 | cs_failed: | ||
309 | cs_error(link, last_fn, last_ret); | ||
310 | failed: | 313 | failed: |
311 | ibmtr_release(link); | 314 | ibmtr_release(link); |
312 | return -ENODEV; | 315 | return -ENODEV; |
@@ -325,12 +328,12 @@ static void ibmtr_release(struct pcmcia_device *link) | |||
325 | ibmtr_dev_t *info = link->priv; | 328 | ibmtr_dev_t *info = link->priv; |
326 | struct net_device *dev = info->dev; | 329 | struct net_device *dev = info->dev; |
327 | 330 | ||
328 | DEBUG(0, "ibmtr_release(0x%p)\n", link); | 331 | dev_dbg(&link->dev, "ibmtr_release\n"); |
329 | 332 | ||
330 | if (link->win) { | 333 | if (link->win) { |
331 | struct tok_info *ti = netdev_priv(dev); | 334 | struct tok_info *ti = netdev_priv(dev); |
332 | iounmap(ti->mmio); | 335 | iounmap(ti->mmio); |
333 | pcmcia_release_window(info->sram_win_handle); | 336 | pcmcia_release_window(link, info->sram_win_handle); |
334 | } | 337 | } |
335 | pcmcia_disable_device(link); | 338 | pcmcia_disable_device(link); |
336 | } | 339 | } |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 5ed6339c52bc..dae5ef6b2609 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -381,13 +381,6 @@ typedef struct _mace_private { | |||
381 | Private Global Variables | 381 | Private Global Variables |
382 | ---------------------------------------------------------------------------- */ | 382 | ---------------------------------------------------------------------------- */ |
383 | 383 | ||
384 | #ifdef PCMCIA_DEBUG | ||
385 | static char rcsid[] = | ||
386 | "nmclan_cs.c,v 0.16 1995/07/01 06:42:17 rpao Exp rpao"; | ||
387 | static char *version = | ||
388 | DRV_NAME " " DRV_VERSION " (Roger C. Pao)"; | ||
389 | #endif | ||
390 | |||
391 | static const char *if_names[]={ | 384 | static const char *if_names[]={ |
392 | "Auto", "10baseT", "BNC", | 385 | "Auto", "10baseT", "BNC", |
393 | }; | 386 | }; |
@@ -406,12 +399,6 @@ MODULE_LICENSE("GPL"); | |||
406 | /* 0=auto, 1=10baseT, 2 = 10base2, default=auto */ | 399 | /* 0=auto, 1=10baseT, 2 = 10base2, default=auto */ |
407 | INT_MODULE_PARM(if_port, 0); | 400 | INT_MODULE_PARM(if_port, 0); |
408 | 401 | ||
409 | #ifdef PCMCIA_DEBUG | ||
410 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
411 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
412 | #else | ||
413 | #define DEBUG(n, args...) | ||
414 | #endif | ||
415 | 402 | ||
416 | /* ---------------------------------------------------------------------------- | 403 | /* ---------------------------------------------------------------------------- |
417 | Function Prototypes | 404 | Function Prototypes |
@@ -462,8 +449,7 @@ static int nmclan_probe(struct pcmcia_device *link) | |||
462 | mace_private *lp; | 449 | mace_private *lp; |
463 | struct net_device *dev; | 450 | struct net_device *dev; |
464 | 451 | ||
465 | DEBUG(0, "nmclan_attach()\n"); | 452 | dev_dbg(&link->dev, "nmclan_attach()\n"); |
466 | DEBUG(1, "%s\n", rcsid); | ||
467 | 453 | ||
468 | /* Create new ethernet device */ | 454 | /* Create new ethernet device */ |
469 | dev = alloc_etherdev(sizeof(mace_private)); | 455 | dev = alloc_etherdev(sizeof(mace_private)); |
@@ -477,10 +463,8 @@ static int nmclan_probe(struct pcmcia_device *link) | |||
477 | link->io.NumPorts1 = 32; | 463 | link->io.NumPorts1 = 32; |
478 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 464 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
479 | link->io.IOAddrLines = 5; | 465 | link->io.IOAddrLines = 5; |
480 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; | 466 | link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
481 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
482 | link->irq.Handler = &mace_interrupt; | 467 | link->irq.Handler = &mace_interrupt; |
483 | link->irq.Instance = dev; | ||
484 | link->conf.Attributes = CONF_ENABLE_IRQ; | 468 | link->conf.Attributes = CONF_ENABLE_IRQ; |
485 | link->conf.IntType = INT_MEMORY_AND_IO; | 469 | link->conf.IntType = INT_MEMORY_AND_IO; |
486 | link->conf.ConfigIndex = 1; | 470 | link->conf.ConfigIndex = 1; |
@@ -507,7 +491,7 @@ static void nmclan_detach(struct pcmcia_device *link) | |||
507 | { | 491 | { |
508 | struct net_device *dev = link->priv; | 492 | struct net_device *dev = link->priv; |
509 | 493 | ||
510 | DEBUG(0, "nmclan_detach(0x%p)\n", link); | 494 | dev_dbg(&link->dev, "nmclan_detach\n"); |
511 | 495 | ||
512 | if (link->dev_node) | 496 | if (link->dev_node) |
513 | unregister_netdev(dev); | 497 | unregister_netdev(dev); |
@@ -654,37 +638,40 @@ nmclan_config | |||
654 | ethernet device available to the system. | 638 | ethernet device available to the system. |
655 | ---------------------------------------------------------------------------- */ | 639 | ---------------------------------------------------------------------------- */ |
656 | 640 | ||
657 | #define CS_CHECK(fn, ret) \ | ||
658 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
659 | |||
660 | static int nmclan_config(struct pcmcia_device *link) | 641 | static int nmclan_config(struct pcmcia_device *link) |
661 | { | 642 | { |
662 | struct net_device *dev = link->priv; | 643 | struct net_device *dev = link->priv; |
663 | mace_private *lp = netdev_priv(dev); | 644 | mace_private *lp = netdev_priv(dev); |
664 | tuple_t tuple; | 645 | u8 *buf; |
665 | u_char buf[64]; | 646 | size_t len; |
666 | int i, last_ret, last_fn; | 647 | int i, ret; |
667 | unsigned int ioaddr; | 648 | unsigned int ioaddr; |
668 | 649 | ||
669 | DEBUG(0, "nmclan_config(0x%p)\n", link); | 650 | dev_dbg(&link->dev, "nmclan_config\n"); |
651 | |||
652 | ret = pcmcia_request_io(link, &link->io); | ||
653 | if (ret) | ||
654 | goto failed; | ||
655 | ret = pcmcia_request_irq(link, &link->irq); | ||
656 | if (ret) | ||
657 | goto failed; | ||
658 | ret = pcmcia_request_configuration(link, &link->conf); | ||
659 | if (ret) | ||
660 | goto failed; | ||
670 | 661 | ||
671 | CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); | ||
672 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | ||
673 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | ||
674 | dev->irq = link->irq.AssignedIRQ; | 662 | dev->irq = link->irq.AssignedIRQ; |
675 | dev->base_addr = link->io.BasePort1; | 663 | dev->base_addr = link->io.BasePort1; |
676 | 664 | ||
677 | ioaddr = dev->base_addr; | 665 | ioaddr = dev->base_addr; |
678 | 666 | ||
679 | /* Read the ethernet address from the CIS. */ | 667 | /* Read the ethernet address from the CIS. */ |
680 | tuple.DesiredTuple = 0x80 /* CISTPL_CFTABLE_ENTRY_MISC */; | 668 | len = pcmcia_get_tuple(link, 0x80, &buf); |
681 | tuple.TupleData = buf; | 669 | if (!buf || len < ETHER_ADDR_LEN) { |
682 | tuple.TupleDataMax = 64; | 670 | kfree(buf); |
683 | tuple.TupleOffset = 0; | 671 | goto failed; |
684 | tuple.Attributes = 0; | 672 | } |
685 | CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); | 673 | memcpy(dev->dev_addr, buf, ETHER_ADDR_LEN); |
686 | CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); | 674 | kfree(buf); |
687 | memcpy(dev->dev_addr, tuple.TupleData, ETHER_ADDR_LEN); | ||
688 | 675 | ||
689 | /* Verify configuration by reading the MACE ID. */ | 676 | /* Verify configuration by reading the MACE ID. */ |
690 | { | 677 | { |
@@ -693,7 +680,7 @@ static int nmclan_config(struct pcmcia_device *link) | |||
693 | sig[0] = mace_read(lp, ioaddr, MACE_CHIPIDL); | 680 | sig[0] = mace_read(lp, ioaddr, MACE_CHIPIDL); |
694 | sig[1] = mace_read(lp, ioaddr, MACE_CHIPIDH); | 681 | sig[1] = mace_read(lp, ioaddr, MACE_CHIPIDH); |
695 | if ((sig[0] == 0x40) && ((sig[1] & 0x0F) == 0x09)) { | 682 | if ((sig[0] == 0x40) && ((sig[1] & 0x0F) == 0x09)) { |
696 | DEBUG(0, "nmclan_cs configured: mace id=%x %x\n", | 683 | dev_dbg(&link->dev, "nmclan_cs configured: mace id=%x %x\n", |
697 | sig[0], sig[1]); | 684 | sig[0], sig[1]); |
698 | } else { | 685 | } else { |
699 | printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" | 686 | printk(KERN_NOTICE "nmclan_cs: mace id not found: %x %x should" |
@@ -712,7 +699,7 @@ static int nmclan_config(struct pcmcia_device *link) | |||
712 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); | 699 | printk(KERN_NOTICE "nmclan_cs: invalid if_port requested\n"); |
713 | 700 | ||
714 | link->dev_node = &lp->node; | 701 | link->dev_node = &lp->node; |
715 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 702 | SET_NETDEV_DEV(dev, &link->dev); |
716 | 703 | ||
717 | i = register_netdev(dev); | 704 | i = register_netdev(dev); |
718 | if (i != 0) { | 705 | if (i != 0) { |
@@ -729,8 +716,6 @@ static int nmclan_config(struct pcmcia_device *link) | |||
729 | dev->dev_addr); | 716 | dev->dev_addr); |
730 | return 0; | 717 | return 0; |
731 | 718 | ||
732 | cs_failed: | ||
733 | cs_error(link, last_fn, last_ret); | ||
734 | failed: | 719 | failed: |
735 | nmclan_release(link); | 720 | nmclan_release(link); |
736 | return -ENODEV; | 721 | return -ENODEV; |
@@ -744,7 +729,7 @@ nmclan_release | |||
744 | ---------------------------------------------------------------------------- */ | 729 | ---------------------------------------------------------------------------- */ |
745 | static void nmclan_release(struct pcmcia_device *link) | 730 | static void nmclan_release(struct pcmcia_device *link) |
746 | { | 731 | { |
747 | DEBUG(0, "nmclan_release(0x%p)\n", link); | 732 | dev_dbg(&link->dev, "nmclan_release\n"); |
748 | pcmcia_disable_device(link); | 733 | pcmcia_disable_device(link); |
749 | } | 734 | } |
750 | 735 | ||
@@ -795,7 +780,7 @@ static void nmclan_reset(struct net_device *dev) | |||
795 | /* Reset Xilinx */ | 780 | /* Reset Xilinx */ |
796 | reg.Action = CS_WRITE; | 781 | reg.Action = CS_WRITE; |
797 | reg.Offset = CISREG_COR; | 782 | reg.Offset = CISREG_COR; |
798 | DEBUG(1, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", | 783 | dev_dbg(&link->dev, "nmclan_reset: OrigCorValue=0x%lX, resetting...\n", |
799 | OrigCorValue); | 784 | OrigCorValue); |
800 | reg.Value = COR_SOFT_RESET; | 785 | reg.Value = COR_SOFT_RESET; |
801 | pcmcia_access_configuration_register(link, ®); | 786 | pcmcia_access_configuration_register(link, ®); |
@@ -872,7 +857,7 @@ static int mace_close(struct net_device *dev) | |||
872 | mace_private *lp = netdev_priv(dev); | 857 | mace_private *lp = netdev_priv(dev); |
873 | struct pcmcia_device *link = lp->p_dev; | 858 | struct pcmcia_device *link = lp->p_dev; |
874 | 859 | ||
875 | DEBUG(2, "%s: shutting down ethercard.\n", dev->name); | 860 | dev_dbg(&link->dev, "%s: shutting down ethercard.\n", dev->name); |
876 | 861 | ||
877 | /* Mask off all interrupts from the MACE chip. */ | 862 | /* Mask off all interrupts from the MACE chip. */ |
878 | outb(0xFF, ioaddr + AM2150_MACE_BASE + MACE_IMR); | 863 | outb(0xFF, ioaddr + AM2150_MACE_BASE + MACE_IMR); |
@@ -891,24 +876,8 @@ static void netdev_get_drvinfo(struct net_device *dev, | |||
891 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); | 876 | sprintf(info->bus_info, "PCMCIA 0x%lx", dev->base_addr); |
892 | } | 877 | } |
893 | 878 | ||
894 | #ifdef PCMCIA_DEBUG | ||
895 | static u32 netdev_get_msglevel(struct net_device *dev) | ||
896 | { | ||
897 | return pc_debug; | ||
898 | } | ||
899 | |||
900 | static void netdev_set_msglevel(struct net_device *dev, u32 level) | ||
901 | { | ||
902 | pc_debug = level; | ||
903 | } | ||
904 | #endif /* PCMCIA_DEBUG */ | ||
905 | |||
906 | static const struct ethtool_ops netdev_ethtool_ops = { | 879 | static const struct ethtool_ops netdev_ethtool_ops = { |
907 | .get_drvinfo = netdev_get_drvinfo, | 880 | .get_drvinfo = netdev_get_drvinfo, |
908 | #ifdef PCMCIA_DEBUG | ||
909 | .get_msglevel = netdev_get_msglevel, | ||
910 | .set_msglevel = netdev_set_msglevel, | ||
911 | #endif /* PCMCIA_DEBUG */ | ||
912 | }; | 881 | }; |
913 | 882 | ||
914 | /* ---------------------------------------------------------------------------- | 883 | /* ---------------------------------------------------------------------------- |
@@ -946,7 +915,7 @@ static netdev_tx_t mace_start_xmit(struct sk_buff *skb, | |||
946 | 915 | ||
947 | netif_stop_queue(dev); | 916 | netif_stop_queue(dev); |
948 | 917 | ||
949 | DEBUG(3, "%s: mace_start_xmit(length = %ld) called.\n", | 918 | pr_debug("%s: mace_start_xmit(length = %ld) called.\n", |
950 | dev->name, (long)skb->len); | 919 | dev->name, (long)skb->len); |
951 | 920 | ||
952 | #if (!TX_INTERRUPTABLE) | 921 | #if (!TX_INTERRUPTABLE) |
@@ -1008,7 +977,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) | |||
1008 | int IntrCnt = MACE_MAX_IR_ITERATIONS; | 977 | int IntrCnt = MACE_MAX_IR_ITERATIONS; |
1009 | 978 | ||
1010 | if (dev == NULL) { | 979 | if (dev == NULL) { |
1011 | DEBUG(2, "mace_interrupt(): irq 0x%X for unknown device.\n", | 980 | pr_debug("mace_interrupt(): irq 0x%X for unknown device.\n", |
1012 | irq); | 981 | irq); |
1013 | return IRQ_NONE; | 982 | return IRQ_NONE; |
1014 | } | 983 | } |
@@ -1031,7 +1000,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) | |||
1031 | } | 1000 | } |
1032 | 1001 | ||
1033 | if (!netif_device_present(dev)) { | 1002 | if (!netif_device_present(dev)) { |
1034 | DEBUG(2, "%s: interrupt from dead card\n", dev->name); | 1003 | pr_debug("%s: interrupt from dead card\n", dev->name); |
1035 | return IRQ_NONE; | 1004 | return IRQ_NONE; |
1036 | } | 1005 | } |
1037 | 1006 | ||
@@ -1039,7 +1008,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id) | |||
1039 | /* WARNING: MACE_IR is a READ/CLEAR port! */ | 1008 | /* WARNING: MACE_IR is a READ/CLEAR port! */ |
1040 | status = inb(ioaddr + AM2150_MACE_BASE + MACE_IR); | 1009 | status = inb(ioaddr + AM2150_MACE_BASE + MACE_IR); |
1041 | 1010 | ||
1042 | DEBUG(3, "mace_interrupt: irq 0x%X status 0x%X.\n", irq, status); | 1011 | pr_debug("mace_interrupt: irq 0x%X status 0x%X.\n", irq, status); |
1043 | 1012 | ||
1044 | if (status & MACE_IR_RCVINT) { | 1013 | if (status & MACE_IR_RCVINT) { |
1045 | mace_rx(dev, MACE_MAX_RX_ITERATIONS); | 1014 | mace_rx(dev, MACE_MAX_RX_ITERATIONS); |
@@ -1158,7 +1127,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
1158 | ) { | 1127 | ) { |
1159 | rx_status = inw(ioaddr + AM2150_RCV); | 1128 | rx_status = inw(ioaddr + AM2150_RCV); |
1160 | 1129 | ||
1161 | DEBUG(3, "%s: in mace_rx(), framecnt 0x%X, rx_status" | 1130 | pr_debug("%s: in mace_rx(), framecnt 0x%X, rx_status" |
1162 | " 0x%X.\n", dev->name, rx_framecnt, rx_status); | 1131 | " 0x%X.\n", dev->name, rx_framecnt, rx_status); |
1163 | 1132 | ||
1164 | if (rx_status & MACE_RCVFS_RCVSTS) { /* Error, update stats. */ | 1133 | if (rx_status & MACE_RCVFS_RCVSTS) { /* Error, update stats. */ |
@@ -1185,7 +1154,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
1185 | lp->mace_stats.rfs_rcvcc += inb(ioaddr + AM2150_RCV); | 1154 | lp->mace_stats.rfs_rcvcc += inb(ioaddr + AM2150_RCV); |
1186 | /* rcv collision count */ | 1155 | /* rcv collision count */ |
1187 | 1156 | ||
1188 | DEBUG(3, " receiving packet size 0x%X rx_status" | 1157 | pr_debug(" receiving packet size 0x%X rx_status" |
1189 | " 0x%X.\n", pkt_len, rx_status); | 1158 | " 0x%X.\n", pkt_len, rx_status); |
1190 | 1159 | ||
1191 | skb = dev_alloc_skb(pkt_len+2); | 1160 | skb = dev_alloc_skb(pkt_len+2); |
@@ -1204,7 +1173,7 @@ static int mace_rx(struct net_device *dev, unsigned char RxCnt) | |||
1204 | outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ | 1173 | outb(0xFF, ioaddr + AM2150_RCV_NEXT); /* skip to next frame */ |
1205 | continue; | 1174 | continue; |
1206 | } else { | 1175 | } else { |
1207 | DEBUG(1, "%s: couldn't allocate a sk_buff of size" | 1176 | pr_debug("%s: couldn't allocate a sk_buff of size" |
1208 | " %d.\n", dev->name, pkt_len); | 1177 | " %d.\n", dev->name, pkt_len); |
1209 | lp->linux_stats.rx_dropped++; | 1178 | lp->linux_stats.rx_dropped++; |
1210 | } | 1179 | } |
@@ -1220,28 +1189,28 @@ pr_linux_stats | |||
1220 | ---------------------------------------------------------------------------- */ | 1189 | ---------------------------------------------------------------------------- */ |
1221 | static void pr_linux_stats(struct net_device_stats *pstats) | 1190 | static void pr_linux_stats(struct net_device_stats *pstats) |
1222 | { | 1191 | { |
1223 | DEBUG(2, "pr_linux_stats\n"); | 1192 | pr_debug("pr_linux_stats\n"); |
1224 | DEBUG(2, " rx_packets=%-7ld tx_packets=%ld\n", | 1193 | pr_debug(" rx_packets=%-7ld tx_packets=%ld\n", |
1225 | (long)pstats->rx_packets, (long)pstats->tx_packets); | 1194 | (long)pstats->rx_packets, (long)pstats->tx_packets); |
1226 | DEBUG(2, " rx_errors=%-7ld tx_errors=%ld\n", | 1195 | pr_debug(" rx_errors=%-7ld tx_errors=%ld\n", |
1227 | (long)pstats->rx_errors, (long)pstats->tx_errors); | 1196 | (long)pstats->rx_errors, (long)pstats->tx_errors); |
1228 | DEBUG(2, " rx_dropped=%-7ld tx_dropped=%ld\n", | 1197 | pr_debug(" rx_dropped=%-7ld tx_dropped=%ld\n", |
1229 | (long)pstats->rx_dropped, (long)pstats->tx_dropped); | 1198 | (long)pstats->rx_dropped, (long)pstats->tx_dropped); |
1230 | DEBUG(2, " multicast=%-7ld collisions=%ld\n", | 1199 | pr_debug(" multicast=%-7ld collisions=%ld\n", |
1231 | (long)pstats->multicast, (long)pstats->collisions); | 1200 | (long)pstats->multicast, (long)pstats->collisions); |
1232 | 1201 | ||
1233 | DEBUG(2, " rx_length_errors=%-7ld rx_over_errors=%ld\n", | 1202 | pr_debug(" rx_length_errors=%-7ld rx_over_errors=%ld\n", |
1234 | (long)pstats->rx_length_errors, (long)pstats->rx_over_errors); | 1203 | (long)pstats->rx_length_errors, (long)pstats->rx_over_errors); |
1235 | DEBUG(2, " rx_crc_errors=%-7ld rx_frame_errors=%ld\n", | 1204 | pr_debug(" rx_crc_errors=%-7ld rx_frame_errors=%ld\n", |
1236 | (long)pstats->rx_crc_errors, (long)pstats->rx_frame_errors); | 1205 | (long)pstats->rx_crc_errors, (long)pstats->rx_frame_errors); |
1237 | DEBUG(2, " rx_fifo_errors=%-7ld rx_missed_errors=%ld\n", | 1206 | pr_debug(" rx_fifo_errors=%-7ld rx_missed_errors=%ld\n", |
1238 | (long)pstats->rx_fifo_errors, (long)pstats->rx_missed_errors); | 1207 | (long)pstats->rx_fifo_errors, (long)pstats->rx_missed_errors); |
1239 | 1208 | ||
1240 | DEBUG(2, " tx_aborted_errors=%-7ld tx_carrier_errors=%ld\n", | 1209 | pr_debug(" tx_aborted_errors=%-7ld tx_carrier_errors=%ld\n", |
1241 | (long)pstats->tx_aborted_errors, (long)pstats->tx_carrier_errors); | 1210 | (long)pstats->tx_aborted_errors, (long)pstats->tx_carrier_errors); |
1242 | DEBUG(2, " tx_fifo_errors=%-7ld tx_heartbeat_errors=%ld\n", | 1211 | pr_debug(" tx_fifo_errors=%-7ld tx_heartbeat_errors=%ld\n", |
1243 | (long)pstats->tx_fifo_errors, (long)pstats->tx_heartbeat_errors); | 1212 | (long)pstats->tx_fifo_errors, (long)pstats->tx_heartbeat_errors); |
1244 | DEBUG(2, " tx_window_errors=%ld\n", | 1213 | pr_debug(" tx_window_errors=%ld\n", |
1245 | (long)pstats->tx_window_errors); | 1214 | (long)pstats->tx_window_errors); |
1246 | } /* pr_linux_stats */ | 1215 | } /* pr_linux_stats */ |
1247 | 1216 | ||
@@ -1250,48 +1219,48 @@ pr_mace_stats | |||
1250 | ---------------------------------------------------------------------------- */ | 1219 | ---------------------------------------------------------------------------- */ |
1251 | static void pr_mace_stats(mace_statistics *pstats) | 1220 | static void pr_mace_stats(mace_statistics *pstats) |
1252 | { | 1221 | { |
1253 | DEBUG(2, "pr_mace_stats\n"); | 1222 | pr_debug("pr_mace_stats\n"); |
1254 | 1223 | ||
1255 | DEBUG(2, " xmtsv=%-7d uflo=%d\n", | 1224 | pr_debug(" xmtsv=%-7d uflo=%d\n", |
1256 | pstats->xmtsv, pstats->uflo); | 1225 | pstats->xmtsv, pstats->uflo); |
1257 | DEBUG(2, " lcol=%-7d more=%d\n", | 1226 | pr_debug(" lcol=%-7d more=%d\n", |
1258 | pstats->lcol, pstats->more); | 1227 | pstats->lcol, pstats->more); |
1259 | DEBUG(2, " one=%-7d defer=%d\n", | 1228 | pr_debug(" one=%-7d defer=%d\n", |
1260 | pstats->one, pstats->defer); | 1229 | pstats->one, pstats->defer); |
1261 | DEBUG(2, " lcar=%-7d rtry=%d\n", | 1230 | pr_debug(" lcar=%-7d rtry=%d\n", |
1262 | pstats->lcar, pstats->rtry); | 1231 | pstats->lcar, pstats->rtry); |
1263 | 1232 | ||
1264 | /* MACE_XMTRC */ | 1233 | /* MACE_XMTRC */ |
1265 | DEBUG(2, " exdef=%-7d xmtrc=%d\n", | 1234 | pr_debug(" exdef=%-7d xmtrc=%d\n", |
1266 | pstats->exdef, pstats->xmtrc); | 1235 | pstats->exdef, pstats->xmtrc); |
1267 | 1236 | ||
1268 | /* RFS1--Receive Status (RCVSTS) */ | 1237 | /* RFS1--Receive Status (RCVSTS) */ |
1269 | DEBUG(2, " oflo=%-7d clsn=%d\n", | 1238 | pr_debug(" oflo=%-7d clsn=%d\n", |
1270 | pstats->oflo, pstats->clsn); | 1239 | pstats->oflo, pstats->clsn); |
1271 | DEBUG(2, " fram=%-7d fcs=%d\n", | 1240 | pr_debug(" fram=%-7d fcs=%d\n", |
1272 | pstats->fram, pstats->fcs); | 1241 | pstats->fram, pstats->fcs); |
1273 | 1242 | ||
1274 | /* RFS2--Runt Packet Count (RNTPC) */ | 1243 | /* RFS2--Runt Packet Count (RNTPC) */ |
1275 | /* RFS3--Receive Collision Count (RCVCC) */ | 1244 | /* RFS3--Receive Collision Count (RCVCC) */ |
1276 | DEBUG(2, " rfs_rntpc=%-7d rfs_rcvcc=%d\n", | 1245 | pr_debug(" rfs_rntpc=%-7d rfs_rcvcc=%d\n", |
1277 | pstats->rfs_rntpc, pstats->rfs_rcvcc); | 1246 | pstats->rfs_rntpc, pstats->rfs_rcvcc); |
1278 | 1247 | ||
1279 | /* MACE_IR */ | 1248 | /* MACE_IR */ |
1280 | DEBUG(2, " jab=%-7d babl=%d\n", | 1249 | pr_debug(" jab=%-7d babl=%d\n", |
1281 | pstats->jab, pstats->babl); | 1250 | pstats->jab, pstats->babl); |
1282 | DEBUG(2, " cerr=%-7d rcvcco=%d\n", | 1251 | pr_debug(" cerr=%-7d rcvcco=%d\n", |
1283 | pstats->cerr, pstats->rcvcco); | 1252 | pstats->cerr, pstats->rcvcco); |
1284 | DEBUG(2, " rntpco=%-7d mpco=%d\n", | 1253 | pr_debug(" rntpco=%-7d mpco=%d\n", |
1285 | pstats->rntpco, pstats->mpco); | 1254 | pstats->rntpco, pstats->mpco); |
1286 | 1255 | ||
1287 | /* MACE_MPC */ | 1256 | /* MACE_MPC */ |
1288 | DEBUG(2, " mpc=%d\n", pstats->mpc); | 1257 | pr_debug(" mpc=%d\n", pstats->mpc); |
1289 | 1258 | ||
1290 | /* MACE_RNTPC */ | 1259 | /* MACE_RNTPC */ |
1291 | DEBUG(2, " rntpc=%d\n", pstats->rntpc); | 1260 | pr_debug(" rntpc=%d\n", pstats->rntpc); |
1292 | 1261 | ||
1293 | /* MACE_RCVCC */ | 1262 | /* MACE_RCVCC */ |
1294 | DEBUG(2, " rcvcc=%d\n", pstats->rcvcc); | 1263 | pr_debug(" rcvcc=%d\n", pstats->rcvcc); |
1295 | 1264 | ||
1296 | } /* pr_mace_stats */ | 1265 | } /* pr_mace_stats */ |
1297 | 1266 | ||
@@ -1360,7 +1329,7 @@ static struct net_device_stats *mace_get_stats(struct net_device *dev) | |||
1360 | 1329 | ||
1361 | update_stats(dev->base_addr, dev); | 1330 | update_stats(dev->base_addr, dev); |
1362 | 1331 | ||
1363 | DEBUG(1, "%s: updating the statistics.\n", dev->name); | 1332 | pr_debug("%s: updating the statistics.\n", dev->name); |
1364 | pr_linux_stats(&lp->linux_stats); | 1333 | pr_linux_stats(&lp->linux_stats); |
1365 | pr_mace_stats(&lp->mace_stats); | 1334 | pr_mace_stats(&lp->mace_stats); |
1366 | 1335 | ||
@@ -1427,7 +1396,7 @@ static void BuildLAF(int *ladrf, int *adr) | |||
1427 | ladrf[byte] |= (1 << (hashcode & 7)); | 1396 | ladrf[byte] |= (1 << (hashcode & 7)); |
1428 | 1397 | ||
1429 | #ifdef PCMCIA_DEBUG | 1398 | #ifdef PCMCIA_DEBUG |
1430 | if (pc_debug > 2) | 1399 | if (0) |
1431 | printk(KERN_DEBUG " adr =%pM\n", adr); | 1400 | printk(KERN_DEBUG " adr =%pM\n", adr); |
1432 | printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode); | 1401 | printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode); |
1433 | for (i = 0; i < 8; i++) | 1402 | for (i = 0; i < 8; i++) |
@@ -1454,12 +1423,12 @@ static void restore_multicast_list(struct net_device *dev) | |||
1454 | unsigned int ioaddr = dev->base_addr; | 1423 | unsigned int ioaddr = dev->base_addr; |
1455 | int i; | 1424 | int i; |
1456 | 1425 | ||
1457 | DEBUG(2, "%s: restoring Rx mode to %d addresses.\n", | 1426 | pr_debug("%s: restoring Rx mode to %d addresses.\n", |
1458 | dev->name, num_addrs); | 1427 | dev->name, num_addrs); |
1459 | 1428 | ||
1460 | if (num_addrs > 0) { | 1429 | if (num_addrs > 0) { |
1461 | 1430 | ||
1462 | DEBUG(1, "Attempt to restore multicast list detected.\n"); | 1431 | pr_debug("Attempt to restore multicast list detected.\n"); |
1463 | 1432 | ||
1464 | mace_write(lp, ioaddr, MACE_IAC, MACE_IAC_ADDRCHG | MACE_IAC_LOGADDR); | 1433 | mace_write(lp, ioaddr, MACE_IAC, MACE_IAC_ADDRCHG | MACE_IAC_LOGADDR); |
1465 | /* Poll ADDRCHG bit */ | 1434 | /* Poll ADDRCHG bit */ |
@@ -1511,11 +1480,11 @@ static void set_multicast_list(struct net_device *dev) | |||
1511 | struct dev_mc_list *dmi = dev->mc_list; | 1480 | struct dev_mc_list *dmi = dev->mc_list; |
1512 | 1481 | ||
1513 | #ifdef PCMCIA_DEBUG | 1482 | #ifdef PCMCIA_DEBUG |
1514 | if (pc_debug > 1) { | 1483 | { |
1515 | static int old; | 1484 | static int old; |
1516 | if (dev->mc_count != old) { | 1485 | if (dev->mc_count != old) { |
1517 | old = dev->mc_count; | 1486 | old = dev->mc_count; |
1518 | DEBUG(0, "%s: setting Rx mode to %d addresses.\n", | 1487 | pr_debug("%s: setting Rx mode to %d addresses.\n", |
1519 | dev->name, old); | 1488 | dev->name, old); |
1520 | } | 1489 | } |
1521 | } | 1490 | } |
@@ -1546,7 +1515,7 @@ static void restore_multicast_list(struct net_device *dev) | |||
1546 | unsigned int ioaddr = dev->base_addr; | 1515 | unsigned int ioaddr = dev->base_addr; |
1547 | mace_private *lp = netdev_priv(dev); | 1516 | mace_private *lp = netdev_priv(dev); |
1548 | 1517 | ||
1549 | DEBUG(2, "%s: restoring Rx mode to %d addresses.\n", dev->name, | 1518 | pr_debug("%s: restoring Rx mode to %d addresses.\n", dev->name, |
1550 | lp->multicast_num_addrs); | 1519 | lp->multicast_num_addrs); |
1551 | 1520 | ||
1552 | if (dev->flags & IFF_PROMISC) { | 1521 | if (dev->flags & IFF_PROMISC) { |
@@ -1567,11 +1536,11 @@ static void set_multicast_list(struct net_device *dev) | |||
1567 | mace_private *lp = netdev_priv(dev); | 1536 | mace_private *lp = netdev_priv(dev); |
1568 | 1537 | ||
1569 | #ifdef PCMCIA_DEBUG | 1538 | #ifdef PCMCIA_DEBUG |
1570 | if (pc_debug > 1) { | 1539 | { |
1571 | static int old; | 1540 | static int old; |
1572 | if (dev->mc_count != old) { | 1541 | if (dev->mc_count != old) { |
1573 | old = dev->mc_count; | 1542 | old = dev->mc_count; |
1574 | DEBUG(0, "%s: setting Rx mode to %d addresses.\n", | 1543 | pr_debug("%s: setting Rx mode to %d addresses.\n", |
1575 | dev->name, old); | 1544 | dev->name, old); |
1576 | } | 1545 | } |
1577 | } | 1546 | } |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 94c9ad2746bc..cbe462ed221f 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -71,15 +71,6 @@ | |||
71 | 71 | ||
72 | static const char *if_names[] = { "auto", "10baseT", "10base2"}; | 72 | static const char *if_names[] = { "auto", "10baseT", "10base2"}; |
73 | 73 | ||
74 | #ifdef PCMCIA_DEBUG | ||
75 | static int pc_debug = PCMCIA_DEBUG; | ||
76 | module_param(pc_debug, int, 0); | ||
77 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
78 | static char *version = | ||
79 | "pcnet_cs.c 1.153 2003/11/09 18:53:09 (David Hinds)"; | ||
80 | #else | ||
81 | #define DEBUG(n, args...) | ||
82 | #endif | ||
83 | 74 | ||
84 | /*====================================================================*/ | 75 | /*====================================================================*/ |
85 | 76 | ||
@@ -265,7 +256,7 @@ static int pcnet_probe(struct pcmcia_device *link) | |||
265 | pcnet_dev_t *info; | 256 | pcnet_dev_t *info; |
266 | struct net_device *dev; | 257 | struct net_device *dev; |
267 | 258 | ||
268 | DEBUG(0, "pcnet_attach()\n"); | 259 | dev_dbg(&link->dev, "pcnet_attach()\n"); |
269 | 260 | ||
270 | /* Create new ethernet device */ | 261 | /* Create new ethernet device */ |
271 | dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); | 262 | dev = __alloc_ei_netdev(sizeof(pcnet_dev_t)); |
@@ -275,7 +266,6 @@ static int pcnet_probe(struct pcmcia_device *link) | |||
275 | link->priv = dev; | 266 | link->priv = dev; |
276 | 267 | ||
277 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 268 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
278 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
279 | link->conf.Attributes = CONF_ENABLE_IRQ; | 269 | link->conf.Attributes = CONF_ENABLE_IRQ; |
280 | link->conf.IntType = INT_MEMORY_AND_IO; | 270 | link->conf.IntType = INT_MEMORY_AND_IO; |
281 | 271 | ||
@@ -297,7 +287,7 @@ static void pcnet_detach(struct pcmcia_device *link) | |||
297 | { | 287 | { |
298 | struct net_device *dev = link->priv; | 288 | struct net_device *dev = link->priv; |
299 | 289 | ||
300 | DEBUG(0, "pcnet_detach(0x%p)\n", link); | 290 | dev_dbg(&link->dev, "pcnet_detach\n"); |
301 | 291 | ||
302 | if (link->dev_node) | 292 | if (link->dev_node) |
303 | unregister_netdev(dev); | 293 | unregister_netdev(dev); |
@@ -326,17 +316,15 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) | |||
326 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 316 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
327 | req.Base = 0; req.Size = 0; | 317 | req.Base = 0; req.Size = 0; |
328 | req.AccessSpeed = 0; | 318 | req.AccessSpeed = 0; |
329 | i = pcmcia_request_window(&link, &req, &link->win); | 319 | i = pcmcia_request_window(link, &req, &link->win); |
330 | if (i != 0) { | 320 | if (i != 0) |
331 | cs_error(link, RequestWindow, i); | ||
332 | return NULL; | 321 | return NULL; |
333 | } | ||
334 | 322 | ||
335 | virt = ioremap(req.Base, req.Size); | 323 | virt = ioremap(req.Base, req.Size); |
336 | mem.Page = 0; | 324 | mem.Page = 0; |
337 | for (i = 0; i < NR_INFO; i++) { | 325 | for (i = 0; i < NR_INFO; i++) { |
338 | mem.CardOffset = hw_info[i].offset & ~(req.Size-1); | 326 | mem.CardOffset = hw_info[i].offset & ~(req.Size-1); |
339 | pcmcia_map_mem_page(link->win, &mem); | 327 | pcmcia_map_mem_page(link, link->win, &mem); |
340 | base = &virt[hw_info[i].offset & (req.Size-1)]; | 328 | base = &virt[hw_info[i].offset & (req.Size-1)]; |
341 | if ((readb(base+0) == hw_info[i].a0) && | 329 | if ((readb(base+0) == hw_info[i].a0) && |
342 | (readb(base+2) == hw_info[i].a1) && | 330 | (readb(base+2) == hw_info[i].a1) && |
@@ -348,9 +336,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) | |||
348 | } | 336 | } |
349 | 337 | ||
350 | iounmap(virt); | 338 | iounmap(virt); |
351 | j = pcmcia_release_window(link->win); | 339 | j = pcmcia_release_window(link, link->win); |
352 | if (j != 0) | ||
353 | cs_error(link, ReleaseWindow, j); | ||
354 | return (i < NR_INFO) ? hw_info+i : NULL; | 340 | return (i < NR_INFO) ? hw_info+i : NULL; |
355 | } /* get_hwinfo */ | 341 | } /* get_hwinfo */ |
356 | 342 | ||
@@ -495,9 +481,6 @@ static hw_info_t *get_hwired(struct pcmcia_device *link) | |||
495 | 481 | ||
496 | ======================================================================*/ | 482 | ======================================================================*/ |
497 | 483 | ||
498 | #define CS_CHECK(fn, ret) \ | ||
499 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
500 | |||
501 | static int try_io_port(struct pcmcia_device *link) | 484 | static int try_io_port(struct pcmcia_device *link) |
502 | { | 485 | { |
503 | int j, ret; | 486 | int j, ret; |
@@ -567,19 +550,19 @@ static int pcnet_config(struct pcmcia_device *link) | |||
567 | { | 550 | { |
568 | struct net_device *dev = link->priv; | 551 | struct net_device *dev = link->priv; |
569 | pcnet_dev_t *info = PRIV(dev); | 552 | pcnet_dev_t *info = PRIV(dev); |
570 | int last_ret, last_fn, start_pg, stop_pg, cm_offset; | 553 | int ret, start_pg, stop_pg, cm_offset; |
571 | int has_shmem = 0; | 554 | int has_shmem = 0; |
572 | hw_info_t *local_hw_info; | 555 | hw_info_t *local_hw_info; |
573 | 556 | ||
574 | DEBUG(0, "pcnet_config(0x%p)\n", link); | 557 | dev_dbg(&link->dev, "pcnet_config\n"); |
575 | 558 | ||
576 | last_ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); | 559 | ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); |
577 | if (last_ret) { | 560 | if (ret) |
578 | cs_error(link, RequestIO, last_ret); | ||
579 | goto failed; | 561 | goto failed; |
580 | } | ||
581 | 562 | ||
582 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 563 | ret = pcmcia_request_irq(link, &link->irq); |
564 | if (ret) | ||
565 | goto failed; | ||
583 | 566 | ||
584 | if (link->io.NumPorts2 == 8) { | 567 | if (link->io.NumPorts2 == 8) { |
585 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 568 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
@@ -589,7 +572,9 @@ static int pcnet_config(struct pcmcia_device *link) | |||
589 | (link->card_id == PRODID_IBM_HOME_AND_AWAY)) | 572 | (link->card_id == PRODID_IBM_HOME_AND_AWAY)) |
590 | link->conf.ConfigIndex |= 0x10; | 573 | link->conf.ConfigIndex |= 0x10; |
591 | 574 | ||
592 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 575 | ret = pcmcia_request_configuration(link, &link->conf); |
576 | if (ret) | ||
577 | goto failed; | ||
593 | dev->irq = link->irq.AssignedIRQ; | 578 | dev->irq = link->irq.AssignedIRQ; |
594 | dev->base_addr = link->io.BasePort1; | 579 | dev->base_addr = link->io.BasePort1; |
595 | if (info->flags & HAS_MISC_REG) { | 580 | if (info->flags & HAS_MISC_REG) { |
@@ -660,7 +645,7 @@ static int pcnet_config(struct pcmcia_device *link) | |||
660 | mii_phy_probe(dev); | 645 | mii_phy_probe(dev); |
661 | 646 | ||
662 | link->dev_node = &info->node; | 647 | link->dev_node = &info->node; |
663 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 648 | SET_NETDEV_DEV(dev, &link->dev); |
664 | 649 | ||
665 | if (register_netdev(dev) != 0) { | 650 | if (register_netdev(dev) != 0) { |
666 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); | 651 | printk(KERN_NOTICE "pcnet_cs: register_netdev() failed\n"); |
@@ -687,8 +672,6 @@ static int pcnet_config(struct pcmcia_device *link) | |||
687 | printk(" hw_addr %pM\n", dev->dev_addr); | 672 | printk(" hw_addr %pM\n", dev->dev_addr); |
688 | return 0; | 673 | return 0; |
689 | 674 | ||
690 | cs_failed: | ||
691 | cs_error(link, last_fn, last_ret); | ||
692 | failed: | 675 | failed: |
693 | pcnet_release(link); | 676 | pcnet_release(link); |
694 | return -ENODEV; | 677 | return -ENODEV; |
@@ -706,7 +689,7 @@ static void pcnet_release(struct pcmcia_device *link) | |||
706 | { | 689 | { |
707 | pcnet_dev_t *info = PRIV(link->priv); | 690 | pcnet_dev_t *info = PRIV(link->priv); |
708 | 691 | ||
709 | DEBUG(0, "pcnet_release(0x%p)\n", link); | 692 | dev_dbg(&link->dev, "pcnet_release\n"); |
710 | 693 | ||
711 | if (info->flags & USE_SHMEM) | 694 | if (info->flags & USE_SHMEM) |
712 | iounmap(info->base); | 695 | iounmap(info->base); |
@@ -960,7 +943,7 @@ static void mii_phy_probe(struct net_device *dev) | |||
960 | phyid = tmp << 16; | 943 | phyid = tmp << 16; |
961 | phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2); | 944 | phyid |= mdio_read(mii_addr, i, MII_PHYID_REG2); |
962 | phyid &= MII_PHYID_REV_MASK; | 945 | phyid &= MII_PHYID_REV_MASK; |
963 | DEBUG(0, "%s: MII at %d is 0x%08x\n", dev->name, i, phyid); | 946 | pr_debug("%s: MII at %d is 0x%08x\n", dev->name, i, phyid); |
964 | if (phyid == AM79C9XX_HOME_PHY) { | 947 | if (phyid == AM79C9XX_HOME_PHY) { |
965 | info->pna_phy = i; | 948 | info->pna_phy = i; |
966 | } else if (phyid != AM79C9XX_ETH_PHY) { | 949 | } else if (phyid != AM79C9XX_ETH_PHY) { |
@@ -976,7 +959,7 @@ static int pcnet_open(struct net_device *dev) | |||
976 | struct pcmcia_device *link = info->p_dev; | 959 | struct pcmcia_device *link = info->p_dev; |
977 | unsigned int nic_base = dev->base_addr; | 960 | unsigned int nic_base = dev->base_addr; |
978 | 961 | ||
979 | DEBUG(2, "pcnet_open('%s')\n", dev->name); | 962 | dev_dbg(&link->dev, "pcnet_open('%s')\n", dev->name); |
980 | 963 | ||
981 | if (!pcmcia_dev_present(link)) | 964 | if (!pcmcia_dev_present(link)) |
982 | return -ENODEV; | 965 | return -ENODEV; |
@@ -1008,7 +991,7 @@ static int pcnet_close(struct net_device *dev) | |||
1008 | pcnet_dev_t *info = PRIV(dev); | 991 | pcnet_dev_t *info = PRIV(dev); |
1009 | struct pcmcia_device *link = info->p_dev; | 992 | struct pcmcia_device *link = info->p_dev; |
1010 | 993 | ||
1011 | DEBUG(2, "pcnet_close('%s')\n", dev->name); | 994 | dev_dbg(&link->dev, "pcnet_close('%s')\n", dev->name); |
1012 | 995 | ||
1013 | ei_close(dev); | 996 | ei_close(dev); |
1014 | free_irq(dev->irq, dev); | 997 | free_irq(dev->irq, dev); |
@@ -1251,10 +1234,8 @@ static void dma_block_input(struct net_device *dev, int count, | |||
1251 | int xfer_count = count; | 1234 | int xfer_count = count; |
1252 | char *buf = skb->data; | 1235 | char *buf = skb->data; |
1253 | 1236 | ||
1254 | #ifdef PCMCIA_DEBUG | ||
1255 | if ((ei_debug > 4) && (count != 4)) | 1237 | if ((ei_debug > 4) && (count != 4)) |
1256 | printk(KERN_DEBUG "%s: [bi=%d]\n", dev->name, count+4); | 1238 | pr_debug("%s: [bi=%d]\n", dev->name, count+4); |
1257 | #endif | ||
1258 | if (ei_status.dmaing) { | 1239 | if (ei_status.dmaing) { |
1259 | printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." | 1240 | printk(KERN_NOTICE "%s: DMAing conflict in dma_block_input." |
1260 | "[DMAstat:%1x][irqlock:%1x]\n", | 1241 | "[DMAstat:%1x][irqlock:%1x]\n", |
@@ -1495,7 +1476,7 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1495 | pcnet_dev_t *info = PRIV(dev); | 1476 | pcnet_dev_t *info = PRIV(dev); |
1496 | win_req_t req; | 1477 | win_req_t req; |
1497 | memreq_t mem; | 1478 | memreq_t mem; |
1498 | int i, window_size, offset, last_ret, last_fn; | 1479 | int i, window_size, offset, ret; |
1499 | 1480 | ||
1500 | window_size = (stop_pg - start_pg) << 8; | 1481 | window_size = (stop_pg - start_pg) << 8; |
1501 | if (window_size > 32 * 1024) | 1482 | if (window_size > 32 * 1024) |
@@ -1509,13 +1490,17 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1509 | req.Attributes |= WIN_USE_WAIT; | 1490 | req.Attributes |= WIN_USE_WAIT; |
1510 | req.Base = 0; req.Size = window_size; | 1491 | req.Base = 0; req.Size = window_size; |
1511 | req.AccessSpeed = mem_speed; | 1492 | req.AccessSpeed = mem_speed; |
1512 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); | 1493 | ret = pcmcia_request_window(link, &req, &link->win); |
1494 | if (ret) | ||
1495 | goto failed; | ||
1513 | 1496 | ||
1514 | mem.CardOffset = (start_pg << 8) + cm_offset; | 1497 | mem.CardOffset = (start_pg << 8) + cm_offset; |
1515 | offset = mem.CardOffset % window_size; | 1498 | offset = mem.CardOffset % window_size; |
1516 | mem.CardOffset -= offset; | 1499 | mem.CardOffset -= offset; |
1517 | mem.Page = 0; | 1500 | mem.Page = 0; |
1518 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); | 1501 | ret = pcmcia_map_mem_page(link, link->win, &mem); |
1502 | if (ret) | ||
1503 | goto failed; | ||
1519 | 1504 | ||
1520 | /* Try scribbling on the buffer */ | 1505 | /* Try scribbling on the buffer */ |
1521 | info->base = ioremap(req.Base, window_size); | 1506 | info->base = ioremap(req.Base, window_size); |
@@ -1527,8 +1512,8 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1527 | pcnet_reset_8390(dev); | 1512 | pcnet_reset_8390(dev); |
1528 | if (i != (TX_PAGES<<8)) { | 1513 | if (i != (TX_PAGES<<8)) { |
1529 | iounmap(info->base); | 1514 | iounmap(info->base); |
1530 | pcmcia_release_window(link->win); | 1515 | pcmcia_release_window(link, link->win); |
1531 | info->base = NULL; link->win = NULL; | 1516 | info->base = NULL; link->win = 0; |
1532 | goto failed; | 1517 | goto failed; |
1533 | } | 1518 | } |
1534 | 1519 | ||
@@ -1549,8 +1534,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1549 | info->flags |= USE_SHMEM; | 1534 | info->flags |= USE_SHMEM; |
1550 | return 0; | 1535 | return 0; |
1551 | 1536 | ||
1552 | cs_failed: | ||
1553 | cs_error(link, last_fn, last_ret); | ||
1554 | failed: | 1537 | failed: |
1555 | return 1; | 1538 | return 1; |
1556 | } | 1539 | } |
@@ -1788,7 +1771,6 @@ static int __init init_pcnet_cs(void) | |||
1788 | 1771 | ||
1789 | static void __exit exit_pcnet_cs(void) | 1772 | static void __exit exit_pcnet_cs(void) |
1790 | { | 1773 | { |
1791 | DEBUG(0, "pcnet_cs: unloading\n"); | ||
1792 | pcmcia_unregister_driver(&pcnet_driver); | 1774 | pcmcia_unregister_driver(&pcnet_driver); |
1793 | } | 1775 | } |
1794 | 1776 | ||
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 7bde2cd34c7e..9e0da370912e 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -79,14 +79,6 @@ MODULE_FIRMWARE(FIRMWARE_NAME); | |||
79 | */ | 79 | */ |
80 | INT_MODULE_PARM(if_port, 0); | 80 | INT_MODULE_PARM(if_port, 0); |
81 | 81 | ||
82 | #ifdef PCMCIA_DEBUG | ||
83 | INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); | ||
84 | static const char *version = | ||
85 | "smc91c92_cs.c 1.123 2006/11/09 Donald Becker, becker@scyld.com.\n"; | ||
86 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
87 | #else | ||
88 | #define DEBUG(n, args...) | ||
89 | #endif | ||
90 | 82 | ||
91 | #define DRV_NAME "smc91c92_cs" | 83 | #define DRV_NAME "smc91c92_cs" |
92 | #define DRV_VERSION "1.123" | 84 | #define DRV_VERSION "1.123" |
@@ -126,12 +118,6 @@ struct smc_private { | |||
126 | int rx_ovrn; | 118 | int rx_ovrn; |
127 | }; | 119 | }; |
128 | 120 | ||
129 | struct smc_cfg_mem { | ||
130 | tuple_t tuple; | ||
131 | cisparse_t parse; | ||
132 | u_char buf[255]; | ||
133 | }; | ||
134 | |||
135 | /* Special definitions for Megahertz multifunction cards */ | 121 | /* Special definitions for Megahertz multifunction cards */ |
136 | #define MEGAHERTZ_ISR 0x0380 | 122 | #define MEGAHERTZ_ISR 0x0380 |
137 | 123 | ||
@@ -329,7 +315,7 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
329 | struct smc_private *smc; | 315 | struct smc_private *smc; |
330 | struct net_device *dev; | 316 | struct net_device *dev; |
331 | 317 | ||
332 | DEBUG(0, "smc91c92_attach()\n"); | 318 | dev_dbg(&link->dev, "smc91c92_attach()\n"); |
333 | 319 | ||
334 | /* Create new ethernet device */ | 320 | /* Create new ethernet device */ |
335 | dev = alloc_etherdev(sizeof(struct smc_private)); | 321 | dev = alloc_etherdev(sizeof(struct smc_private)); |
@@ -343,10 +329,8 @@ static int smc91c92_probe(struct pcmcia_device *link) | |||
343 | link->io.NumPorts1 = 16; | 329 | link->io.NumPorts1 = 16; |
344 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | 330 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; |
345 | link->io.IOAddrLines = 4; | 331 | link->io.IOAddrLines = 4; |
346 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_HANDLE_PRESENT; | 332 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
347 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
348 | link->irq.Handler = &smc_interrupt; | 333 | link->irq.Handler = &smc_interrupt; |
349 | link->irq.Instance = dev; | ||
350 | link->conf.Attributes = CONF_ENABLE_IRQ; | 334 | link->conf.Attributes = CONF_ENABLE_IRQ; |
351 | link->conf.IntType = INT_MEMORY_AND_IO; | 335 | link->conf.IntType = INT_MEMORY_AND_IO; |
352 | 336 | ||
@@ -377,7 +361,7 @@ static void smc91c92_detach(struct pcmcia_device *link) | |||
377 | { | 361 | { |
378 | struct net_device *dev = link->priv; | 362 | struct net_device *dev = link->priv; |
379 | 363 | ||
380 | DEBUG(0, "smc91c92_detach(0x%p)\n", link); | 364 | dev_dbg(&link->dev, "smc91c92_detach\n"); |
381 | 365 | ||
382 | if (link->dev_node) | 366 | if (link->dev_node) |
383 | unregister_netdev(dev); | 367 | unregister_netdev(dev); |
@@ -408,34 +392,7 @@ static int cvt_ascii_address(struct net_device *dev, char *s) | |||
408 | return 0; | 392 | return 0; |
409 | } | 393 | } |
410 | 394 | ||
411 | /*====================================================================*/ | 395 | /*==================================================================== |
412 | |||
413 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, | ||
414 | cisparse_t *parse) | ||
415 | { | ||
416 | int i; | ||
417 | |||
418 | i = pcmcia_get_first_tuple(handle, tuple); | ||
419 | if (i != 0) | ||
420 | return i; | ||
421 | i = pcmcia_get_tuple_data(handle, tuple); | ||
422 | if (i != 0) | ||
423 | return i; | ||
424 | return pcmcia_parse_tuple(tuple, parse); | ||
425 | } | ||
426 | |||
427 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, | ||
428 | cisparse_t *parse) | ||
429 | { | ||
430 | int i; | ||
431 | |||
432 | if ((i = pcmcia_get_next_tuple(handle, tuple)) != 0 || | ||
433 | (i = pcmcia_get_tuple_data(handle, tuple)) != 0) | ||
434 | return i; | ||
435 | return pcmcia_parse_tuple(tuple, parse); | ||
436 | } | ||
437 | |||
438 | /*====================================================================== | ||
439 | 396 | ||
440 | Configuration stuff for Megahertz cards | 397 | Configuration stuff for Megahertz cards |
441 | 398 | ||
@@ -490,19 +447,14 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
490 | { | 447 | { |
491 | struct net_device *dev = link->priv; | 448 | struct net_device *dev = link->priv; |
492 | struct smc_private *smc = netdev_priv(dev); | 449 | struct smc_private *smc = netdev_priv(dev); |
493 | struct smc_cfg_mem *cfg_mem; | ||
494 | win_req_t req; | 450 | win_req_t req; |
495 | memreq_t mem; | 451 | memreq_t mem; |
496 | int i; | 452 | int i; |
497 | 453 | ||
498 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | ||
499 | if (!cfg_mem) | ||
500 | return -ENOMEM; | ||
501 | |||
502 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 454 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
503 | link->conf.Status = CCSR_AUDIO_ENA; | 455 | link->conf.Status = CCSR_AUDIO_ENA; |
504 | link->irq.Attributes = | 456 | link->irq.Attributes = |
505 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; | 457 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
506 | link->io.IOAddrLines = 16; | 458 | link->io.IOAddrLines = 16; |
507 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 459 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
508 | link->io.NumPorts2 = 8; | 460 | link->io.NumPorts2 = 8; |
@@ -510,91 +462,80 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
510 | /* The Megahertz combo cards have modem-like CIS entries, so | 462 | /* The Megahertz combo cards have modem-like CIS entries, so |
511 | we have to explicitly try a bunch of port combinations. */ | 463 | we have to explicitly try a bunch of port combinations. */ |
512 | if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) | 464 | if (pcmcia_loop_config(link, mhz_mfc_config_check, NULL)) |
513 | goto free_cfg_mem; | 465 | return -ENODEV; |
466 | |||
514 | dev->base_addr = link->io.BasePort1; | 467 | dev->base_addr = link->io.BasePort1; |
515 | 468 | ||
516 | /* Allocate a memory window, for accessing the ISR */ | 469 | /* Allocate a memory window, for accessing the ISR */ |
517 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 470 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
518 | req.Base = req.Size = 0; | 471 | req.Base = req.Size = 0; |
519 | req.AccessSpeed = 0; | 472 | req.AccessSpeed = 0; |
520 | i = pcmcia_request_window(&link, &req, &link->win); | 473 | i = pcmcia_request_window(link, &req, &link->win); |
521 | if (i != 0) | 474 | if (i != 0) |
522 | goto free_cfg_mem; | 475 | return -ENODEV; |
476 | |||
523 | smc->base = ioremap(req.Base, req.Size); | 477 | smc->base = ioremap(req.Base, req.Size); |
524 | mem.CardOffset = mem.Page = 0; | 478 | mem.CardOffset = mem.Page = 0; |
525 | if (smc->manfid == MANFID_MOTOROLA) | 479 | if (smc->manfid == MANFID_MOTOROLA) |
526 | mem.CardOffset = link->conf.ConfigBase; | 480 | mem.CardOffset = link->conf.ConfigBase; |
527 | i = pcmcia_map_mem_page(link->win, &mem); | 481 | i = pcmcia_map_mem_page(link, link->win, &mem); |
528 | 482 | ||
529 | if ((i == 0) | 483 | if ((i == 0) |
530 | && (smc->manfid == MANFID_MEGAHERTZ) | 484 | && (smc->manfid == MANFID_MEGAHERTZ) |
531 | && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) | 485 | && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) |
532 | mhz_3288_power(link); | 486 | mhz_3288_power(link); |
533 | 487 | ||
534 | free_cfg_mem: | 488 | return 0; |
535 | kfree(cfg_mem); | ||
536 | return -ENODEV; | ||
537 | } | 489 | } |
538 | 490 | ||
539 | static int mhz_setup(struct pcmcia_device *link) | 491 | static int pcmcia_get_versmac(struct pcmcia_device *p_dev, |
492 | tuple_t *tuple, | ||
493 | void *priv) | ||
540 | { | 494 | { |
541 | struct net_device *dev = link->priv; | 495 | struct net_device *dev = priv; |
542 | struct smc_cfg_mem *cfg_mem; | 496 | cisparse_t parse; |
543 | tuple_t *tuple; | ||
544 | cisparse_t *parse; | ||
545 | u_char *buf, *station_addr; | ||
546 | int rc; | ||
547 | 497 | ||
548 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | 498 | if (pcmcia_parse_tuple(tuple, &parse)) |
549 | if (!cfg_mem) | 499 | return -EINVAL; |
550 | return -1; | ||
551 | 500 | ||
552 | tuple = &cfg_mem->tuple; | 501 | if ((parse.version_1.ns > 3) && |
553 | parse = &cfg_mem->parse; | 502 | (cvt_ascii_address(dev, |
554 | buf = cfg_mem->buf; | 503 | (parse.version_1.str + parse.version_1.ofs[3])))) |
504 | return 0; | ||
555 | 505 | ||
556 | tuple->Attributes = tuple->TupleOffset = 0; | 506 | return -EINVAL; |
557 | tuple->TupleData = (cisdata_t *)buf; | 507 | }; |
558 | tuple->TupleDataMax = 255; | 508 | |
509 | static int mhz_setup(struct pcmcia_device *link) | ||
510 | { | ||
511 | struct net_device *dev = link->priv; | ||
512 | size_t len; | ||
513 | u8 *buf; | ||
514 | int rc; | ||
559 | 515 | ||
560 | /* Read the station address from the CIS. It is stored as the last | 516 | /* Read the station address from the CIS. It is stored as the last |
561 | (fourth) string in the Version 1 Version/ID tuple. */ | 517 | (fourth) string in the Version 1 Version/ID tuple. */ |
562 | tuple->DesiredTuple = CISTPL_VERS_1; | 518 | if ((link->prod_id[3]) && |
563 | if (first_tuple(link, tuple, parse) != 0) { | 519 | (cvt_ascii_address(dev, link->prod_id[3]) == 0)) |
564 | rc = -1; | 520 | return 0; |
565 | goto free_cfg_mem; | 521 | |
566 | } | 522 | /* Workarounds for broken cards start here. */ |
567 | /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ | 523 | /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ |
568 | if (next_tuple(link, tuple, parse) != 0) | 524 | if (!pcmcia_loop_tuple(link, CISTPL_VERS_1, pcmcia_get_versmac, dev)) |
569 | first_tuple(link, tuple, parse); | 525 | return 0; |
570 | if (parse->version_1.ns > 3) { | ||
571 | station_addr = parse->version_1.str + parse->version_1.ofs[3]; | ||
572 | if (cvt_ascii_address(dev, station_addr) == 0) { | ||
573 | rc = 0; | ||
574 | goto free_cfg_mem; | ||
575 | } | ||
576 | } | ||
577 | 526 | ||
578 | /* Another possibility: for the EM3288, in a special tuple */ | 527 | /* Another possibility: for the EM3288, in a special tuple */ |
579 | tuple->DesiredTuple = 0x81; | ||
580 | if (pcmcia_get_first_tuple(link, tuple) != 0) { | ||
581 | rc = -1; | ||
582 | goto free_cfg_mem; | ||
583 | } | ||
584 | if (pcmcia_get_tuple_data(link, tuple) != 0) { | ||
585 | rc = -1; | ||
586 | goto free_cfg_mem; | ||
587 | } | ||
588 | buf[12] = '\0'; | ||
589 | if (cvt_ascii_address(dev, buf) == 0) { | ||
590 | rc = 0; | ||
591 | goto free_cfg_mem; | ||
592 | } | ||
593 | rc = -1; | 528 | rc = -1; |
594 | free_cfg_mem: | 529 | len = pcmcia_get_tuple(link, 0x81, &buf); |
595 | kfree(cfg_mem); | 530 | if (buf && len >= 13) { |
596 | return rc; | 531 | buf[12] = '\0'; |
597 | } | 532 | if (cvt_ascii_address(dev, buf)) |
533 | rc = 0; | ||
534 | } | ||
535 | kfree(buf); | ||
536 | |||
537 | return rc; | ||
538 | }; | ||
598 | 539 | ||
599 | /*====================================================================== | 540 | /*====================================================================== |
600 | 541 | ||
@@ -684,58 +625,21 @@ static int smc_config(struct pcmcia_device *link) | |||
684 | return i; | 625 | return i; |
685 | } | 626 | } |
686 | 627 | ||
628 | |||
687 | static int smc_setup(struct pcmcia_device *link) | 629 | static int smc_setup(struct pcmcia_device *link) |
688 | { | 630 | { |
689 | struct net_device *dev = link->priv; | 631 | struct net_device *dev = link->priv; |
690 | struct smc_cfg_mem *cfg_mem; | ||
691 | tuple_t *tuple; | ||
692 | cisparse_t *parse; | ||
693 | cistpl_lan_node_id_t *node_id; | ||
694 | u_char *buf, *station_addr; | ||
695 | int i, rc; | ||
696 | |||
697 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | ||
698 | if (!cfg_mem) | ||
699 | return -ENOMEM; | ||
700 | |||
701 | tuple = &cfg_mem->tuple; | ||
702 | parse = &cfg_mem->parse; | ||
703 | buf = cfg_mem->buf; | ||
704 | |||
705 | tuple->Attributes = tuple->TupleOffset = 0; | ||
706 | tuple->TupleData = (cisdata_t *)buf; | ||
707 | tuple->TupleDataMax = 255; | ||
708 | 632 | ||
709 | /* Check for a LAN function extension tuple */ | 633 | /* Check for a LAN function extension tuple */ |
710 | tuple->DesiredTuple = CISTPL_FUNCE; | 634 | if (!pcmcia_get_mac_from_cis(link, dev)) |
711 | i = first_tuple(link, tuple, parse); | 635 | return 0; |
712 | while (i == 0) { | 636 | |
713 | if (parse->funce.type == CISTPL_FUNCE_LAN_NODE_ID) | ||
714 | break; | ||
715 | i = next_tuple(link, tuple, parse); | ||
716 | } | ||
717 | if (i == 0) { | ||
718 | node_id = (cistpl_lan_node_id_t *)parse->funce.data; | ||
719 | if (node_id->nb == 6) { | ||
720 | for (i = 0; i < 6; i++) | ||
721 | dev->dev_addr[i] = node_id->id[i]; | ||
722 | rc = 0; | ||
723 | goto free_cfg_mem; | ||
724 | } | ||
725 | } | ||
726 | /* Try the third string in the Version 1 Version/ID tuple. */ | 637 | /* Try the third string in the Version 1 Version/ID tuple. */ |
727 | if (link->prod_id[2]) { | 638 | if (link->prod_id[2]) { |
728 | station_addr = link->prod_id[2]; | 639 | if (cvt_ascii_address(dev, link->prod_id[2]) == 0) |
729 | if (cvt_ascii_address(dev, station_addr) == 0) { | 640 | return 0; |
730 | rc = 0; | ||
731 | goto free_cfg_mem; | ||
732 | } | ||
733 | } | 641 | } |
734 | 642 | return -1; | |
735 | rc = -1; | ||
736 | free_cfg_mem: | ||
737 | kfree(cfg_mem); | ||
738 | return rc; | ||
739 | } | 643 | } |
740 | 644 | ||
741 | /*====================================================================*/ | 645 | /*====================================================================*/ |
@@ -749,7 +653,7 @@ static int osi_config(struct pcmcia_device *link) | |||
749 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 653 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
750 | link->conf.Status = CCSR_AUDIO_ENA; | 654 | link->conf.Status = CCSR_AUDIO_ENA; |
751 | link->irq.Attributes = | 655 | link->irq.Attributes = |
752 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; | 656 | IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; |
753 | link->io.NumPorts1 = 64; | 657 | link->io.NumPorts1 = 64; |
754 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; | 658 | link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; |
755 | link->io.NumPorts2 = 8; | 659 | link->io.NumPorts2 = 8; |
@@ -794,41 +698,31 @@ static int osi_load_firmware(struct pcmcia_device *link) | |||
794 | return err; | 698 | return err; |
795 | } | 699 | } |
796 | 700 | ||
797 | static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) | 701 | static int pcmcia_osi_mac(struct pcmcia_device *p_dev, |
702 | tuple_t *tuple, | ||
703 | void *priv) | ||
798 | { | 704 | { |
799 | struct net_device *dev = link->priv; | 705 | struct net_device *dev = priv; |
800 | struct smc_cfg_mem *cfg_mem; | 706 | int i; |
801 | tuple_t *tuple; | ||
802 | u_char *buf; | ||
803 | int i, rc; | ||
804 | 707 | ||
805 | cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); | 708 | if (tuple->TupleDataLen < 8) |
806 | if (!cfg_mem) | 709 | return -EINVAL; |
807 | return -1; | 710 | if (tuple->TupleData[0] != 0x04) |
711 | return -EINVAL; | ||
712 | for (i = 0; i < 6; i++) | ||
713 | dev->dev_addr[i] = tuple->TupleData[i+2]; | ||
714 | return 0; | ||
715 | }; | ||
808 | 716 | ||
809 | tuple = &cfg_mem->tuple; | ||
810 | buf = cfg_mem->buf; | ||
811 | 717 | ||
812 | tuple->Attributes = TUPLE_RETURN_COMMON; | 718 | static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) |
813 | tuple->TupleData = (cisdata_t *)buf; | 719 | { |
814 | tuple->TupleDataMax = 255; | 720 | struct net_device *dev = link->priv; |
815 | tuple->TupleOffset = 0; | 721 | int rc; |
816 | 722 | ||
817 | /* Read the station address from tuple 0x90, subtuple 0x04 */ | 723 | /* Read the station address from tuple 0x90, subtuple 0x04 */ |
818 | tuple->DesiredTuple = 0x90; | 724 | if (pcmcia_loop_tuple(link, 0x90, pcmcia_osi_mac, dev)) |
819 | i = pcmcia_get_first_tuple(link, tuple); | 725 | return -1; |
820 | while (i == 0) { | ||
821 | i = pcmcia_get_tuple_data(link, tuple); | ||
822 | if ((i != 0) || (buf[0] == 0x04)) | ||
823 | break; | ||
824 | i = pcmcia_get_next_tuple(link, tuple); | ||
825 | } | ||
826 | if (i != 0) { | ||
827 | rc = -1; | ||
828 | goto free_cfg_mem; | ||
829 | } | ||
830 | for (i = 0; i < 6; i++) | ||
831 | dev->dev_addr[i] = buf[i+2]; | ||
832 | 726 | ||
833 | if (((manfid == MANFID_OSITECH) && | 727 | if (((manfid == MANFID_OSITECH) && |
834 | (cardid == PRODID_OSITECH_SEVEN)) || | 728 | (cardid == PRODID_OSITECH_SEVEN)) || |
@@ -836,20 +730,17 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) | |||
836 | (cardid == PRODID_PSION_NET100))) { | 730 | (cardid == PRODID_PSION_NET100))) { |
837 | rc = osi_load_firmware(link); | 731 | rc = osi_load_firmware(link); |
838 | if (rc) | 732 | if (rc) |
839 | goto free_cfg_mem; | 733 | return rc; |
840 | } else if (manfid == MANFID_OSITECH) { | 734 | } else if (manfid == MANFID_OSITECH) { |
841 | /* Make sure both functions are powered up */ | 735 | /* Make sure both functions are powered up */ |
842 | set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); | 736 | set_bits(0x300, link->io.BasePort1 + OSITECH_AUI_PWR); |
843 | /* Now, turn on the interrupt for both card functions */ | 737 | /* Now, turn on the interrupt for both card functions */ |
844 | set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); | 738 | set_bits(0x300, link->io.BasePort1 + OSITECH_RESET_ISR); |
845 | DEBUG(2, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", | 739 | dev_dbg(&link->dev, "AUI/PWR: %4.4x RESET/ISR: %4.4x\n", |
846 | inw(link->io.BasePort1 + OSITECH_AUI_PWR), | 740 | inw(link->io.BasePort1 + OSITECH_AUI_PWR), |
847 | inw(link->io.BasePort1 + OSITECH_RESET_ISR)); | 741 | inw(link->io.BasePort1 + OSITECH_RESET_ISR)); |
848 | } | 742 | } |
849 | rc = 0; | 743 | return 0; |
850 | free_cfg_mem: | ||
851 | kfree(cfg_mem); | ||
852 | return rc; | ||
853 | } | 744 | } |
854 | 745 | ||
855 | static int smc91c92_suspend(struct pcmcia_device *link) | 746 | static int smc91c92_suspend(struct pcmcia_device *link) |
@@ -959,12 +850,6 @@ static int check_sig(struct pcmcia_device *link) | |||
959 | 850 | ||
960 | ======================================================================*/ | 851 | ======================================================================*/ |
961 | 852 | ||
962 | #define CS_EXIT_TEST(ret, svc, label) \ | ||
963 | if (ret != 0) { \ | ||
964 | cs_error(link, svc, ret); \ | ||
965 | goto label; \ | ||
966 | } | ||
967 | |||
968 | static int smc91c92_config(struct pcmcia_device *link) | 853 | static int smc91c92_config(struct pcmcia_device *link) |
969 | { | 854 | { |
970 | struct net_device *dev = link->priv; | 855 | struct net_device *dev = link->priv; |
@@ -974,7 +859,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
974 | unsigned int ioaddr; | 859 | unsigned int ioaddr; |
975 | u_long mir; | 860 | u_long mir; |
976 | 861 | ||
977 | DEBUG(0, "smc91c92_config(0x%p)\n", link); | 862 | dev_dbg(&link->dev, "smc91c92_config\n"); |
978 | 863 | ||
979 | smc->manfid = link->manf_id; | 864 | smc->manfid = link->manf_id; |
980 | smc->cardid = link->card_id; | 865 | smc->cardid = link->card_id; |
@@ -990,12 +875,15 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
990 | } else { | 875 | } else { |
991 | i = smc_config(link); | 876 | i = smc_config(link); |
992 | } | 877 | } |
993 | CS_EXIT_TEST(i, RequestIO, config_failed); | 878 | if (i) |
879 | goto config_failed; | ||
994 | 880 | ||
995 | i = pcmcia_request_irq(link, &link->irq); | 881 | i = pcmcia_request_irq(link, &link->irq); |
996 | CS_EXIT_TEST(i, RequestIRQ, config_failed); | 882 | if (i) |
883 | goto config_failed; | ||
997 | i = pcmcia_request_configuration(link, &link->conf); | 884 | i = pcmcia_request_configuration(link, &link->conf); |
998 | CS_EXIT_TEST(i, RequestConfiguration, config_failed); | 885 | if (i) |
886 | goto config_failed; | ||
999 | 887 | ||
1000 | if (smc->manfid == MANFID_MOTOROLA) | 888 | if (smc->manfid == MANFID_MOTOROLA) |
1001 | mot_config(link); | 889 | mot_config(link); |
@@ -1074,7 +962,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
1074 | } | 962 | } |
1075 | 963 | ||
1076 | link->dev_node = &smc->node; | 964 | link->dev_node = &smc->node; |
1077 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 965 | SET_NETDEV_DEV(dev, &link->dev); |
1078 | 966 | ||
1079 | if (register_netdev(dev) != 0) { | 967 | if (register_netdev(dev) != 0) { |
1080 | printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); | 968 | printk(KERN_ERR "smc91c92_cs: register_netdev() failed\n"); |
@@ -1100,7 +988,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
1100 | 988 | ||
1101 | if (smc->cfg & CFG_MII_SELECT) { | 989 | if (smc->cfg & CFG_MII_SELECT) { |
1102 | if (smc->mii_if.phy_id != -1) { | 990 | if (smc->mii_if.phy_id != -1) { |
1103 | DEBUG(0, " MII transceiver at index %d, status %x.\n", | 991 | dev_dbg(&link->dev, " MII transceiver at index %d, status %x.\n", |
1104 | smc->mii_if.phy_id, j); | 992 | smc->mii_if.phy_id, j); |
1105 | } else { | 993 | } else { |
1106 | printk(KERN_NOTICE " No MII transceivers found!\n"); | 994 | printk(KERN_NOTICE " No MII transceivers found!\n"); |
@@ -1110,7 +998,7 @@ static int smc91c92_config(struct pcmcia_device *link) | |||
1110 | 998 | ||
1111 | config_undo: | 999 | config_undo: |
1112 | unregister_netdev(dev); | 1000 | unregister_netdev(dev); |
1113 | config_failed: /* CS_EXIT_TEST() calls jump to here... */ | 1001 | config_failed: |
1114 | smc91c92_release(link); | 1002 | smc91c92_release(link); |
1115 | return -ENODEV; | 1003 | return -ENODEV; |
1116 | } /* smc91c92_config */ | 1004 | } /* smc91c92_config */ |
@@ -1125,7 +1013,7 @@ config_failed: /* CS_EXIT_TEST() calls jump to here... */ | |||
1125 | 1013 | ||
1126 | static void smc91c92_release(struct pcmcia_device *link) | 1014 | static void smc91c92_release(struct pcmcia_device *link) |
1127 | { | 1015 | { |
1128 | DEBUG(0, "smc91c92_release(0x%p)\n", link); | 1016 | dev_dbg(&link->dev, "smc91c92_release\n"); |
1129 | if (link->win) { | 1017 | if (link->win) { |
1130 | struct net_device *dev = link->priv; | 1018 | struct net_device *dev = link->priv; |
1131 | struct smc_private *smc = netdev_priv(dev); | 1019 | struct smc_private *smc = netdev_priv(dev); |
@@ -1222,10 +1110,10 @@ static int smc_open(struct net_device *dev) | |||
1222 | struct smc_private *smc = netdev_priv(dev); | 1110 | struct smc_private *smc = netdev_priv(dev); |
1223 | struct pcmcia_device *link = smc->p_dev; | 1111 | struct pcmcia_device *link = smc->p_dev; |
1224 | 1112 | ||
1225 | #ifdef PCMCIA_DEBUG | 1113 | dev_dbg(&link->dev, "%s: smc_open(%p), ID/Window %4.4x.\n", |
1226 | DEBUG(0, "%s: smc_open(%p), ID/Window %4.4x.\n", | ||
1227 | dev->name, dev, inw(dev->base_addr + BANK_SELECT)); | 1114 | dev->name, dev, inw(dev->base_addr + BANK_SELECT)); |
1228 | if (pc_debug > 1) smc_dump(dev); | 1115 | #ifdef PCMCIA_DEBUG |
1116 | smc_dump(dev); | ||
1229 | #endif | 1117 | #endif |
1230 | 1118 | ||
1231 | /* Check that the PCMCIA card is still here. */ | 1119 | /* Check that the PCMCIA card is still here. */ |
@@ -1260,7 +1148,7 @@ static int smc_close(struct net_device *dev) | |||
1260 | struct pcmcia_device *link = smc->p_dev; | 1148 | struct pcmcia_device *link = smc->p_dev; |
1261 | unsigned int ioaddr = dev->base_addr; | 1149 | unsigned int ioaddr = dev->base_addr; |
1262 | 1150 | ||
1263 | DEBUG(0, "%s: smc_close(), status %4.4x.\n", | 1151 | dev_dbg(&link->dev, "%s: smc_close(), status %4.4x.\n", |
1264 | dev->name, inw(ioaddr + BANK_SELECT)); | 1152 | dev->name, inw(ioaddr + BANK_SELECT)); |
1265 | 1153 | ||
1266 | netif_stop_queue(dev); | 1154 | netif_stop_queue(dev); |
@@ -1327,7 +1215,7 @@ static void smc_hardware_send_packet(struct net_device * dev) | |||
1327 | u_char *buf = skb->data; | 1215 | u_char *buf = skb->data; |
1328 | u_int length = skb->len; /* The chip will pad to ethernet min. */ | 1216 | u_int length = skb->len; /* The chip will pad to ethernet min. */ |
1329 | 1217 | ||
1330 | DEBUG(2, "%s: Trying to xmit packet of length %d.\n", | 1218 | pr_debug("%s: Trying to xmit packet of length %d.\n", |
1331 | dev->name, length); | 1219 | dev->name, length); |
1332 | 1220 | ||
1333 | /* send the packet length: +6 for status word, length, and ctl */ | 1221 | /* send the packet length: +6 for status word, length, and ctl */ |
@@ -1382,7 +1270,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb, | |||
1382 | 1270 | ||
1383 | netif_stop_queue(dev); | 1271 | netif_stop_queue(dev); |
1384 | 1272 | ||
1385 | DEBUG(2, "%s: smc_start_xmit(length = %d) called," | 1273 | pr_debug("%s: smc_start_xmit(length = %d) called," |
1386 | " status %4.4x.\n", dev->name, skb->len, inw(ioaddr + 2)); | 1274 | " status %4.4x.\n", dev->name, skb->len, inw(ioaddr + 2)); |
1387 | 1275 | ||
1388 | if (smc->saved_skb) { | 1276 | if (smc->saved_skb) { |
@@ -1429,7 +1317,7 @@ static netdev_tx_t smc_start_xmit(struct sk_buff *skb, | |||
1429 | } | 1317 | } |
1430 | 1318 | ||
1431 | /* Otherwise defer until the Tx-space-allocated interrupt. */ | 1319 | /* Otherwise defer until the Tx-space-allocated interrupt. */ |
1432 | DEBUG(2, "%s: memory allocation deferred.\n", dev->name); | 1320 | pr_debug("%s: memory allocation deferred.\n", dev->name); |
1433 | outw((IM_ALLOC_INT << 8) | (ir & 0xff00), ioaddr + INTERRUPT); | 1321 | outw((IM_ALLOC_INT << 8) | (ir & 0xff00), ioaddr + INTERRUPT); |
1434 | spin_unlock_irqrestore(&smc->lock, flags); | 1322 | spin_unlock_irqrestore(&smc->lock, flags); |
1435 | 1323 | ||
@@ -1494,7 +1382,7 @@ static void smc_eph_irq(struct net_device *dev) | |||
1494 | 1382 | ||
1495 | SMC_SELECT_BANK(0); | 1383 | SMC_SELECT_BANK(0); |
1496 | ephs = inw(ioaddr + EPH); | 1384 | ephs = inw(ioaddr + EPH); |
1497 | DEBUG(2, "%s: Ethernet protocol handler interrupt, status" | 1385 | pr_debug("%s: Ethernet protocol handler interrupt, status" |
1498 | " %4.4x.\n", dev->name, ephs); | 1386 | " %4.4x.\n", dev->name, ephs); |
1499 | /* Could be a counter roll-over warning: update stats. */ | 1387 | /* Could be a counter roll-over warning: update stats. */ |
1500 | card_stats = inw(ioaddr + COUNTER); | 1388 | card_stats = inw(ioaddr + COUNTER); |
@@ -1534,7 +1422,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1534 | 1422 | ||
1535 | ioaddr = dev->base_addr; | 1423 | ioaddr = dev->base_addr; |
1536 | 1424 | ||
1537 | DEBUG(3, "%s: SMC91c92 interrupt %d at %#x.\n", dev->name, | 1425 | pr_debug("%s: SMC91c92 interrupt %d at %#x.\n", dev->name, |
1538 | irq, ioaddr); | 1426 | irq, ioaddr); |
1539 | 1427 | ||
1540 | spin_lock(&smc->lock); | 1428 | spin_lock(&smc->lock); |
@@ -1543,7 +1431,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1543 | if ((saved_bank & 0xff00) != 0x3300) { | 1431 | if ((saved_bank & 0xff00) != 0x3300) { |
1544 | /* The device does not exist -- the card could be off-line, or | 1432 | /* The device does not exist -- the card could be off-line, or |
1545 | maybe it has been ejected. */ | 1433 | maybe it has been ejected. */ |
1546 | DEBUG(1, "%s: SMC91c92 interrupt %d for non-existent" | 1434 | pr_debug("%s: SMC91c92 interrupt %d for non-existent" |
1547 | "/ejected device.\n", dev->name, irq); | 1435 | "/ejected device.\n", dev->name, irq); |
1548 | handled = 0; | 1436 | handled = 0; |
1549 | goto irq_done; | 1437 | goto irq_done; |
@@ -1557,7 +1445,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1557 | 1445 | ||
1558 | do { /* read the status flag, and mask it */ | 1446 | do { /* read the status flag, and mask it */ |
1559 | status = inw(ioaddr + INTERRUPT) & 0xff; | 1447 | status = inw(ioaddr + INTERRUPT) & 0xff; |
1560 | DEBUG(3, "%s: Status is %#2.2x (mask %#2.2x).\n", dev->name, | 1448 | pr_debug("%s: Status is %#2.2x (mask %#2.2x).\n", dev->name, |
1561 | status, mask); | 1449 | status, mask); |
1562 | if ((status & mask) == 0) { | 1450 | if ((status & mask) == 0) { |
1563 | if (bogus_cnt == INTR_WORK) | 1451 | if (bogus_cnt == INTR_WORK) |
@@ -1602,7 +1490,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1602 | smc_eph_irq(dev); | 1490 | smc_eph_irq(dev); |
1603 | } while (--bogus_cnt); | 1491 | } while (--bogus_cnt); |
1604 | 1492 | ||
1605 | DEBUG(3, " Restoring saved registers mask %2.2x bank %4.4x" | 1493 | pr_debug(" Restoring saved registers mask %2.2x bank %4.4x" |
1606 | " pointer %4.4x.\n", mask, saved_bank, saved_pointer); | 1494 | " pointer %4.4x.\n", mask, saved_bank, saved_pointer); |
1607 | 1495 | ||
1608 | /* restore state register */ | 1496 | /* restore state register */ |
@@ -1610,7 +1498,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id) | |||
1610 | outw(saved_pointer, ioaddr + POINTER); | 1498 | outw(saved_pointer, ioaddr + POINTER); |
1611 | SMC_SELECT_BANK(saved_bank); | 1499 | SMC_SELECT_BANK(saved_bank); |
1612 | 1500 | ||
1613 | DEBUG(3, "%s: Exiting interrupt IRQ%d.\n", dev->name, irq); | 1501 | pr_debug("%s: Exiting interrupt IRQ%d.\n", dev->name, irq); |
1614 | 1502 | ||
1615 | irq_done: | 1503 | irq_done: |
1616 | 1504 | ||
@@ -1661,7 +1549,7 @@ static void smc_rx(struct net_device *dev) | |||
1661 | rx_status = inw(ioaddr + DATA_1); | 1549 | rx_status = inw(ioaddr + DATA_1); |
1662 | packet_length = inw(ioaddr + DATA_1) & 0x07ff; | 1550 | packet_length = inw(ioaddr + DATA_1) & 0x07ff; |
1663 | 1551 | ||
1664 | DEBUG(2, "%s: Receive status %4.4x length %d.\n", | 1552 | pr_debug("%s: Receive status %4.4x length %d.\n", |
1665 | dev->name, rx_status, packet_length); | 1553 | dev->name, rx_status, packet_length); |
1666 | 1554 | ||
1667 | if (!(rx_status & RS_ERRORS)) { | 1555 | if (!(rx_status & RS_ERRORS)) { |
@@ -1672,7 +1560,7 @@ static void smc_rx(struct net_device *dev) | |||
1672 | skb = dev_alloc_skb(packet_length+2); | 1560 | skb = dev_alloc_skb(packet_length+2); |
1673 | 1561 | ||
1674 | if (skb == NULL) { | 1562 | if (skb == NULL) { |
1675 | DEBUG(1, "%s: Low memory, packet dropped.\n", dev->name); | 1563 | pr_debug("%s: Low memory, packet dropped.\n", dev->name); |
1676 | dev->stats.rx_dropped++; | 1564 | dev->stats.rx_dropped++; |
1677 | outw(MC_RELEASE, ioaddr + MMU_CMD); | 1565 | outw(MC_RELEASE, ioaddr + MMU_CMD); |
1678 | return; | 1566 | return; |
@@ -1832,7 +1720,7 @@ static void smc_reset(struct net_device *dev) | |||
1832 | struct smc_private *smc = netdev_priv(dev); | 1720 | struct smc_private *smc = netdev_priv(dev); |
1833 | int i; | 1721 | int i; |
1834 | 1722 | ||
1835 | DEBUG(0, "%s: smc91c92 reset called.\n", dev->name); | 1723 | pr_debug("%s: smc91c92 reset called.\n", dev->name); |
1836 | 1724 | ||
1837 | /* The first interaction must be a write to bring the chip out | 1725 | /* The first interaction must be a write to bring the chip out |
1838 | of sleep mode. */ | 1726 | of sleep mode. */ |
@@ -2149,18 +2037,6 @@ static u32 smc_get_link(struct net_device *dev) | |||
2149 | return ret; | 2037 | return ret; |
2150 | } | 2038 | } |
2151 | 2039 | ||
2152 | #ifdef PCMCIA_DEBUG | ||
2153 | static u32 smc_get_msglevel(struct net_device *dev) | ||
2154 | { | ||
2155 | return pc_debug; | ||
2156 | } | ||
2157 | |||
2158 | static void smc_set_msglevel(struct net_device *dev, u32 val) | ||
2159 | { | ||
2160 | pc_debug = val; | ||
2161 | } | ||
2162 | #endif | ||
2163 | |||
2164 | static int smc_nway_reset(struct net_device *dev) | 2040 | static int smc_nway_reset(struct net_device *dev) |
2165 | { | 2041 | { |
2166 | struct smc_private *smc = netdev_priv(dev); | 2042 | struct smc_private *smc = netdev_priv(dev); |
@@ -2184,10 +2060,6 @@ static const struct ethtool_ops ethtool_ops = { | |||
2184 | .get_settings = smc_get_settings, | 2060 | .get_settings = smc_get_settings, |
2185 | .set_settings = smc_set_settings, | 2061 | .set_settings = smc_set_settings, |
2186 | .get_link = smc_get_link, | 2062 | .get_link = smc_get_link, |
2187 | #ifdef PCMCIA_DEBUG | ||
2188 | .get_msglevel = smc_get_msglevel, | ||
2189 | .set_msglevel = smc_set_msglevel, | ||
2190 | #endif | ||
2191 | .nway_reset = smc_nway_reset, | 2063 | .nway_reset = smc_nway_reset, |
2192 | }; | 2064 | }; |
2193 | 2065 | ||
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index cf8423102538..fe504b7f369f 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -211,20 +211,6 @@ enum xirc_cmd { /* Commands */ | |||
211 | 211 | ||
212 | static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" }; | 212 | static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" }; |
213 | 213 | ||
214 | /**************** | ||
215 | * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
216 | * you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
217 | * left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
218 | * be present but disabled -- but it can then be enabled for specific | ||
219 | * modules at load time with a 'pc_debug=#' option to insmod. | ||
220 | */ | ||
221 | #ifdef PCMCIA_DEBUG | ||
222 | static int pc_debug = PCMCIA_DEBUG; | ||
223 | module_param(pc_debug, int, 0); | ||
224 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KDBG_XIRC args) | ||
225 | #else | ||
226 | #define DEBUG(n, args...) | ||
227 | #endif | ||
228 | 214 | ||
229 | #define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: " | 215 | #define KDBG_XIRC KERN_DEBUG "xirc2ps_cs: " |
230 | #define KERR_XIRC KERN_ERR "xirc2ps_cs: " | 216 | #define KERR_XIRC KERN_ERR "xirc2ps_cs: " |
@@ -359,7 +345,7 @@ static void xirc_tx_timeout(struct net_device *dev); | |||
359 | static void xirc2ps_tx_timeout_task(struct work_struct *work); | 345 | static void xirc2ps_tx_timeout_task(struct work_struct *work); |
360 | static void set_addresses(struct net_device *dev); | 346 | static void set_addresses(struct net_device *dev); |
361 | static void set_multicast_list(struct net_device *dev); | 347 | static void set_multicast_list(struct net_device *dev); |
362 | static int set_card_type(struct pcmcia_device *link, const void *s); | 348 | static int set_card_type(struct pcmcia_device *link); |
363 | static int do_config(struct net_device *dev, struct ifmap *map); | 349 | static int do_config(struct net_device *dev, struct ifmap *map); |
364 | static int do_open(struct net_device *dev); | 350 | static int do_open(struct net_device *dev); |
365 | static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | 351 | static int do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); |
@@ -371,28 +357,6 @@ static void do_powerdown(struct net_device *dev); | |||
371 | static int do_stop(struct net_device *dev); | 357 | static int do_stop(struct net_device *dev); |
372 | 358 | ||
373 | /*=============== Helper functions =========================*/ | 359 | /*=============== Helper functions =========================*/ |
374 | static int | ||
375 | first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | ||
376 | { | ||
377 | int err; | ||
378 | |||
379 | if ((err = pcmcia_get_first_tuple(handle, tuple)) == 0 && | ||
380 | (err = pcmcia_get_tuple_data(handle, tuple)) == 0) | ||
381 | err = pcmcia_parse_tuple(tuple, parse); | ||
382 | return err; | ||
383 | } | ||
384 | |||
385 | static int | ||
386 | next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | ||
387 | { | ||
388 | int err; | ||
389 | |||
390 | if ((err = pcmcia_get_next_tuple(handle, tuple)) == 0 && | ||
391 | (err = pcmcia_get_tuple_data(handle, tuple)) == 0) | ||
392 | err = pcmcia_parse_tuple(tuple, parse); | ||
393 | return err; | ||
394 | } | ||
395 | |||
396 | #define SelectPage(pgnr) outb((pgnr), ioaddr + XIRCREG_PR) | 360 | #define SelectPage(pgnr) outb((pgnr), ioaddr + XIRCREG_PR) |
397 | #define GetByte(reg) ((unsigned)inb(ioaddr + (reg))) | 361 | #define GetByte(reg) ((unsigned)inb(ioaddr + (reg))) |
398 | #define GetWord(reg) ((unsigned)inw(ioaddr + (reg))) | 362 | #define GetWord(reg) ((unsigned)inw(ioaddr + (reg))) |
@@ -400,7 +364,7 @@ next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) | |||
400 | #define PutWord(reg,value) outw((value), ioaddr+(reg)) | 364 | #define PutWord(reg,value) outw((value), ioaddr+(reg)) |
401 | 365 | ||
402 | /*====== Functions used for debugging =================================*/ | 366 | /*====== Functions used for debugging =================================*/ |
403 | #if defined(PCMCIA_DEBUG) && 0 /* reading regs may change system status */ | 367 | #if 0 /* reading regs may change system status */ |
404 | static void | 368 | static void |
405 | PrintRegisters(struct net_device *dev) | 369 | PrintRegisters(struct net_device *dev) |
406 | { | 370 | { |
@@ -432,7 +396,7 @@ PrintRegisters(struct net_device *dev) | |||
432 | } | 396 | } |
433 | } | 397 | } |
434 | } | 398 | } |
435 | #endif /* PCMCIA_DEBUG */ | 399 | #endif /* 0 */ |
436 | 400 | ||
437 | /*============== MII Management functions ===============*/ | 401 | /*============== MII Management functions ===============*/ |
438 | 402 | ||
@@ -576,7 +540,7 @@ xirc2ps_probe(struct pcmcia_device *link) | |||
576 | struct net_device *dev; | 540 | struct net_device *dev; |
577 | local_info_t *local; | 541 | local_info_t *local; |
578 | 542 | ||
579 | DEBUG(0, "attach()\n"); | 543 | dev_dbg(&link->dev, "attach()\n"); |
580 | 544 | ||
581 | /* Allocate the device structure */ | 545 | /* Allocate the device structure */ |
582 | dev = alloc_etherdev(sizeof(local_info_t)); | 546 | dev = alloc_etherdev(sizeof(local_info_t)); |
@@ -592,7 +556,6 @@ xirc2ps_probe(struct pcmcia_device *link) | |||
592 | link->conf.IntType = INT_MEMORY_AND_IO; | 556 | link->conf.IntType = INT_MEMORY_AND_IO; |
593 | link->conf.ConfigIndex = 1; | 557 | link->conf.ConfigIndex = 1; |
594 | link->irq.Handler = xirc2ps_interrupt; | 558 | link->irq.Handler = xirc2ps_interrupt; |
595 | link->irq.Instance = dev; | ||
596 | 559 | ||
597 | /* Fill in card specific entries */ | 560 | /* Fill in card specific entries */ |
598 | dev->netdev_ops = &netdev_ops; | 561 | dev->netdev_ops = &netdev_ops; |
@@ -615,7 +578,7 @@ xirc2ps_detach(struct pcmcia_device *link) | |||
615 | { | 578 | { |
616 | struct net_device *dev = link->priv; | 579 | struct net_device *dev = link->priv; |
617 | 580 | ||
618 | DEBUG(0, "detach(0x%p)\n", link); | 581 | dev_dbg(&link->dev, "detach\n"); |
619 | 582 | ||
620 | if (link->dev_node) | 583 | if (link->dev_node) |
621 | unregister_netdev(dev); | 584 | unregister_netdev(dev); |
@@ -644,17 +607,25 @@ xirc2ps_detach(struct pcmcia_device *link) | |||
644 | * | 607 | * |
645 | */ | 608 | */ |
646 | static int | 609 | static int |
647 | set_card_type(struct pcmcia_device *link, const void *s) | 610 | set_card_type(struct pcmcia_device *link) |
648 | { | 611 | { |
649 | struct net_device *dev = link->priv; | 612 | struct net_device *dev = link->priv; |
650 | local_info_t *local = netdev_priv(dev); | 613 | local_info_t *local = netdev_priv(dev); |
651 | #ifdef PCMCIA_DEBUG | 614 | u8 *buf; |
652 | unsigned cisrev = ((const unsigned char *)s)[2]; | 615 | unsigned int cisrev, mediaid, prodid; |
653 | #endif | 616 | size_t len; |
654 | unsigned mediaid= ((const unsigned char *)s)[3]; | 617 | |
655 | unsigned prodid = ((const unsigned char *)s)[4]; | 618 | len = pcmcia_get_tuple(link, CISTPL_MANFID, &buf); |
619 | if (len < 5) { | ||
620 | dev_err(&link->dev, "invalid CIS -- sorry\n"); | ||
621 | return 0; | ||
622 | } | ||
656 | 623 | ||
657 | DEBUG(0, "cisrev=%02x mediaid=%02x prodid=%02x\n", | 624 | cisrev = buf[2]; |
625 | mediaid = buf[3]; | ||
626 | prodid = buf[4]; | ||
627 | |||
628 | dev_dbg(&link->dev, "cisrev=%02x mediaid=%02x prodid=%02x\n", | ||
658 | cisrev, mediaid, prodid); | 629 | cisrev, mediaid, prodid); |
659 | 630 | ||
660 | local->mohawk = 0; | 631 | local->mohawk = 0; |
@@ -761,6 +732,26 @@ xirc2ps_config_check(struct pcmcia_device *p_dev, | |||
761 | 732 | ||
762 | } | 733 | } |
763 | 734 | ||
735 | |||
736 | static int pcmcia_get_mac_ce(struct pcmcia_device *p_dev, | ||
737 | tuple_t *tuple, | ||
738 | void *priv) | ||
739 | { | ||
740 | struct net_device *dev = priv; | ||
741 | int i; | ||
742 | |||
743 | if (tuple->TupleDataLen != 13) | ||
744 | return -EINVAL; | ||
745 | if ((tuple->TupleData[0] != 2) || (tuple->TupleData[1] != 1) || | ||
746 | (tuple->TupleData[2] != 6)) | ||
747 | return -EINVAL; | ||
748 | /* another try (James Lehmer's CE2 version 4.1)*/ | ||
749 | for (i = 2; i < 6; i++) | ||
750 | dev->dev_addr[i] = tuple->TupleData[i+2]; | ||
751 | return 0; | ||
752 | }; | ||
753 | |||
754 | |||
764 | /**************** | 755 | /**************** |
765 | * xirc2ps_config() is scheduled to run after a CARD_INSERTION event | 756 | * xirc2ps_config() is scheduled to run after a CARD_INSERTION event |
766 | * is received, to configure the PCMCIA socket, and to make the | 757 | * is received, to configure the PCMCIA socket, and to make the |
@@ -772,33 +763,21 @@ xirc2ps_config(struct pcmcia_device * link) | |||
772 | struct net_device *dev = link->priv; | 763 | struct net_device *dev = link->priv; |
773 | local_info_t *local = netdev_priv(dev); | 764 | local_info_t *local = netdev_priv(dev); |
774 | unsigned int ioaddr; | 765 | unsigned int ioaddr; |
775 | tuple_t tuple; | 766 | int err; |
776 | cisparse_t parse; | 767 | u8 *buf; |
777 | int err, i; | 768 | size_t len; |
778 | u_char buf[64]; | ||
779 | cistpl_lan_node_id_t *node_id = (cistpl_lan_node_id_t*)parse.funce.data; | ||
780 | 769 | ||
781 | local->dingo_ccr = NULL; | 770 | local->dingo_ccr = NULL; |
782 | 771 | ||
783 | DEBUG(0, "config(0x%p)\n", link); | 772 | dev_dbg(&link->dev, "config\n"); |
784 | |||
785 | /* | ||
786 | * This reads the card's CONFIG tuple to find its configuration | ||
787 | * registers. | ||
788 | */ | ||
789 | tuple.Attributes = 0; | ||
790 | tuple.TupleData = buf; | ||
791 | tuple.TupleDataMax = 64; | ||
792 | tuple.TupleOffset = 0; | ||
793 | 773 | ||
794 | /* Is this a valid card */ | 774 | /* Is this a valid card */ |
795 | tuple.DesiredTuple = CISTPL_MANFID; | 775 | if (link->has_manf_id == 0) { |
796 | if ((err=first_tuple(link, &tuple, &parse))) { | ||
797 | printk(KNOT_XIRC "manfid not found in CIS\n"); | 776 | printk(KNOT_XIRC "manfid not found in CIS\n"); |
798 | goto failure; | 777 | goto failure; |
799 | } | 778 | } |
800 | 779 | ||
801 | switch(parse.manfid.manf) { | 780 | switch (link->manf_id) { |
802 | case MANFID_XIRCOM: | 781 | case MANFID_XIRCOM: |
803 | local->manf_str = "Xircom"; | 782 | local->manf_str = "Xircom"; |
804 | break; | 783 | break; |
@@ -817,65 +796,44 @@ xirc2ps_config(struct pcmcia_device * link) | |||
817 | break; | 796 | break; |
818 | default: | 797 | default: |
819 | printk(KNOT_XIRC "Unknown Card Manufacturer ID: 0x%04x\n", | 798 | printk(KNOT_XIRC "Unknown Card Manufacturer ID: 0x%04x\n", |
820 | (unsigned)parse.manfid.manf); | 799 | (unsigned)link->manf_id); |
821 | goto failure; | 800 | goto failure; |
822 | } | 801 | } |
823 | DEBUG(0, "found %s card\n", local->manf_str); | 802 | dev_dbg(&link->dev, "found %s card\n", local->manf_str); |
824 | 803 | ||
825 | if (!set_card_type(link, buf)) { | 804 | if (!set_card_type(link)) { |
826 | printk(KNOT_XIRC "this card is not supported\n"); | 805 | printk(KNOT_XIRC "this card is not supported\n"); |
827 | goto failure; | 806 | goto failure; |
828 | } | 807 | } |
829 | 808 | ||
830 | /* get the ethernet address from the CIS */ | 809 | /* get the ethernet address from the CIS */ |
831 | tuple.DesiredTuple = CISTPL_FUNCE; | 810 | err = pcmcia_get_mac_from_cis(link, dev); |
832 | for (err = first_tuple(link, &tuple, &parse); !err; | 811 | |
833 | err = next_tuple(link, &tuple, &parse)) { | 812 | /* not found: try to get the node-id from tuple 0x89 */ |
834 | /* Once I saw two CISTPL_FUNCE_LAN_NODE_ID entries: | 813 | if (err) { |
835 | * the first one with a length of zero the second correct - | 814 | len = pcmcia_get_tuple(link, 0x89, &buf); |
836 | * so I skip all entries with length 0 */ | 815 | /* data layout looks like tuple 0x22 */ |
837 | if (parse.funce.type == CISTPL_FUNCE_LAN_NODE_ID | 816 | if (buf && len == 8) { |
838 | && ((cistpl_lan_node_id_t *)parse.funce.data)->nb) | 817 | if (*buf == CISTPL_FUNCE_LAN_NODE_ID) { |
839 | break; | 818 | int i; |
840 | } | 819 | for (i = 2; i < 6; i++) |
841 | if (err) { /* not found: try to get the node-id from tuple 0x89 */ | 820 | dev->dev_addr[i] = buf[i+2]; |
842 | tuple.DesiredTuple = 0x89; /* data layout looks like tuple 0x22 */ | 821 | } else |
843 | if ((err = pcmcia_get_first_tuple(link, &tuple)) == 0 && | 822 | err = -1; |
844 | (err = pcmcia_get_tuple_data(link, &tuple)) == 0) { | ||
845 | if (tuple.TupleDataLen == 8 && *buf == CISTPL_FUNCE_LAN_NODE_ID) | ||
846 | memcpy(&parse, buf, 8); | ||
847 | else | ||
848 | err = -1; | ||
849 | } | ||
850 | } | ||
851 | if (err) { /* another try (James Lehmer's CE2 version 4.1)*/ | ||
852 | tuple.DesiredTuple = CISTPL_FUNCE; | ||
853 | for (err = first_tuple(link, &tuple, &parse); !err; | ||
854 | err = next_tuple(link, &tuple, &parse)) { | ||
855 | if (parse.funce.type == 0x02 && parse.funce.data[0] == 1 | ||
856 | && parse.funce.data[1] == 6 && tuple.TupleDataLen == 13) { | ||
857 | buf[1] = 4; | ||
858 | memcpy(&parse, buf+1, 8); | ||
859 | break; | ||
860 | } | 823 | } |
861 | } | 824 | kfree(buf); |
862 | } | 825 | } |
826 | |||
827 | if (err) | ||
828 | err = pcmcia_loop_tuple(link, CISTPL_FUNCE, pcmcia_get_mac_ce, dev); | ||
829 | |||
863 | if (err) { | 830 | if (err) { |
864 | printk(KNOT_XIRC "node-id not found in CIS\n"); | 831 | printk(KNOT_XIRC "node-id not found in CIS\n"); |
865 | goto failure; | 832 | goto failure; |
866 | } | 833 | } |
867 | node_id = (cistpl_lan_node_id_t *)parse.funce.data; | ||
868 | if (node_id->nb != 6) { | ||
869 | printk(KNOT_XIRC "malformed node-id in CIS\n"); | ||
870 | goto failure; | ||
871 | } | ||
872 | for (i=0; i < 6; i++) | ||
873 | dev->dev_addr[i] = node_id->id[i]; | ||
874 | 834 | ||
875 | link->io.IOAddrLines =10; | 835 | link->io.IOAddrLines =10; |
876 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; | 836 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; |
877 | link->irq.Attributes = IRQ_HANDLE_PRESENT; | ||
878 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
879 | if (local->modem) { | 837 | if (local->modem) { |
880 | int pass; | 838 | int pass; |
881 | 839 | ||
@@ -916,10 +874,8 @@ xirc2ps_config(struct pcmcia_device * link) | |||
916 | goto port_found; | 874 | goto port_found; |
917 | } | 875 | } |
918 | link->io.BasePort1 = 0; /* let CS decide */ | 876 | link->io.BasePort1 = 0; /* let CS decide */ |
919 | if ((err=pcmcia_request_io(link, &link->io))) { | 877 | if ((err=pcmcia_request_io(link, &link->io))) |
920 | cs_error(link, RequestIO, err); | ||
921 | goto config_error; | 878 | goto config_error; |
922 | } | ||
923 | } | 879 | } |
924 | port_found: | 880 | port_found: |
925 | if (err) | 881 | if (err) |
@@ -929,19 +885,15 @@ xirc2ps_config(struct pcmcia_device * link) | |||
929 | * Now allocate an interrupt line. Note that this does not | 885 | * Now allocate an interrupt line. Note that this does not |
930 | * actually assign a handler to the interrupt. | 886 | * actually assign a handler to the interrupt. |
931 | */ | 887 | */ |
932 | if ((err=pcmcia_request_irq(link, &link->irq))) { | 888 | if ((err=pcmcia_request_irq(link, &link->irq))) |
933 | cs_error(link, RequestIRQ, err); | ||
934 | goto config_error; | 889 | goto config_error; |
935 | } | ||
936 | 890 | ||
937 | /**************** | 891 | /**************** |
938 | * This actually configures the PCMCIA socket -- setting up | 892 | * This actually configures the PCMCIA socket -- setting up |
939 | * the I/O windows and the interrupt mapping. | 893 | * the I/O windows and the interrupt mapping. |
940 | */ | 894 | */ |
941 | if ((err=pcmcia_request_configuration(link, &link->conf))) { | 895 | if ((err=pcmcia_request_configuration(link, &link->conf))) |
942 | cs_error(link, RequestConfiguration, err); | ||
943 | goto config_error; | 896 | goto config_error; |
944 | } | ||
945 | 897 | ||
946 | if (local->dingo) { | 898 | if (local->dingo) { |
947 | conf_reg_t reg; | 899 | conf_reg_t reg; |
@@ -956,17 +908,13 @@ xirc2ps_config(struct pcmcia_device * link) | |||
956 | reg.Action = CS_WRITE; | 908 | reg.Action = CS_WRITE; |
957 | reg.Offset = CISREG_IOBASE_0; | 909 | reg.Offset = CISREG_IOBASE_0; |
958 | reg.Value = link->io.BasePort2 & 0xff; | 910 | reg.Value = link->io.BasePort2 & 0xff; |
959 | if ((err = pcmcia_access_configuration_register(link, ®))) { | 911 | if ((err = pcmcia_access_configuration_register(link, ®))) |
960 | cs_error(link, AccessConfigurationRegister, err); | ||
961 | goto config_error; | 912 | goto config_error; |
962 | } | ||
963 | reg.Action = CS_WRITE; | 913 | reg.Action = CS_WRITE; |
964 | reg.Offset = CISREG_IOBASE_1; | 914 | reg.Offset = CISREG_IOBASE_1; |
965 | reg.Value = (link->io.BasePort2 >> 8) & 0xff; | 915 | reg.Value = (link->io.BasePort2 >> 8) & 0xff; |
966 | if ((err = pcmcia_access_configuration_register(link, ®))) { | 916 | if ((err = pcmcia_access_configuration_register(link, ®))) |
967 | cs_error(link, AccessConfigurationRegister, err); | ||
968 | goto config_error; | 917 | goto config_error; |
969 | } | ||
970 | 918 | ||
971 | /* There is no config entry for the Ethernet part which | 919 | /* There is no config entry for the Ethernet part which |
972 | * is at 0x0800. So we allocate a window into the attribute | 920 | * is at 0x0800. So we allocate a window into the attribute |
@@ -975,17 +923,14 @@ xirc2ps_config(struct pcmcia_device * link) | |||
975 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 923 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
976 | req.Base = req.Size = 0; | 924 | req.Base = req.Size = 0; |
977 | req.AccessSpeed = 0; | 925 | req.AccessSpeed = 0; |
978 | if ((err = pcmcia_request_window(&link, &req, &link->win))) { | 926 | if ((err = pcmcia_request_window(link, &req, &link->win))) |
979 | cs_error(link, RequestWindow, err); | ||
980 | goto config_error; | 927 | goto config_error; |
981 | } | 928 | |
982 | local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; | 929 | local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; |
983 | mem.CardOffset = 0x0; | 930 | mem.CardOffset = 0x0; |
984 | mem.Page = 0; | 931 | mem.Page = 0; |
985 | if ((err = pcmcia_map_mem_page(link->win, &mem))) { | 932 | if ((err = pcmcia_map_mem_page(link, link->win, &mem))) |
986 | cs_error(link, MapMemPage, err); | ||
987 | goto config_error; | 933 | goto config_error; |
988 | } | ||
989 | 934 | ||
990 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet | 935 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet |
991 | * part. | 936 | * part. |
@@ -1044,7 +989,7 @@ xirc2ps_config(struct pcmcia_device * link) | |||
1044 | do_reset(dev, 1); /* a kludge to make the cem56 work */ | 989 | do_reset(dev, 1); /* a kludge to make the cem56 work */ |
1045 | 990 | ||
1046 | link->dev_node = &local->node; | 991 | link->dev_node = &local->node; |
1047 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 992 | SET_NETDEV_DEV(dev, &link->dev); |
1048 | 993 | ||
1049 | if ((err=register_netdev(dev))) { | 994 | if ((err=register_netdev(dev))) { |
1050 | printk(KNOT_XIRC "register_netdev() failed\n"); | 995 | printk(KNOT_XIRC "register_netdev() failed\n"); |
@@ -1077,7 +1022,7 @@ xirc2ps_config(struct pcmcia_device * link) | |||
1077 | static void | 1022 | static void |
1078 | xirc2ps_release(struct pcmcia_device *link) | 1023 | xirc2ps_release(struct pcmcia_device *link) |
1079 | { | 1024 | { |
1080 | DEBUG(0, "release(0x%p)\n", link); | 1025 | dev_dbg(&link->dev, "release\n"); |
1081 | 1026 | ||
1082 | if (link->win) { | 1027 | if (link->win) { |
1083 | struct net_device *dev = link->priv; | 1028 | struct net_device *dev = link->priv; |
@@ -1144,7 +1089,7 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
1144 | PutByte(XIRCREG_CR, 0); | 1089 | PutByte(XIRCREG_CR, 0); |
1145 | } | 1090 | } |
1146 | 1091 | ||
1147 | DEBUG(6, "%s: interrupt %d at %#x.\n", dev->name, irq, ioaddr); | 1092 | pr_debug("%s: interrupt %d at %#x.\n", dev->name, irq, ioaddr); |
1148 | 1093 | ||
1149 | saved_page = GetByte(XIRCREG_PR); | 1094 | saved_page = GetByte(XIRCREG_PR); |
1150 | /* Read the ISR to see whats the cause for the interrupt. | 1095 | /* Read the ISR to see whats the cause for the interrupt. |
@@ -1154,7 +1099,7 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
1154 | bytes_rcvd = 0; | 1099 | bytes_rcvd = 0; |
1155 | loop_entry: | 1100 | loop_entry: |
1156 | if (int_status == 0xff) { /* card may be ejected */ | 1101 | if (int_status == 0xff) { /* card may be ejected */ |
1157 | DEBUG(3, "%s: interrupt %d for dead card\n", dev->name, irq); | 1102 | pr_debug("%s: interrupt %d for dead card\n", dev->name, irq); |
1158 | goto leave; | 1103 | goto leave; |
1159 | } | 1104 | } |
1160 | eth_status = GetByte(XIRCREG_ESR); | 1105 | eth_status = GetByte(XIRCREG_ESR); |
@@ -1167,7 +1112,7 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
1167 | PutByte(XIRCREG40_TXST0, 0); | 1112 | PutByte(XIRCREG40_TXST0, 0); |
1168 | PutByte(XIRCREG40_TXST1, 0); | 1113 | PutByte(XIRCREG40_TXST1, 0); |
1169 | 1114 | ||
1170 | DEBUG(3, "%s: ISR=%#2.2x ESR=%#2.2x RSR=%#2.2x TSR=%#4.4x\n", | 1115 | pr_debug("%s: ISR=%#2.2x ESR=%#2.2x RSR=%#2.2x TSR=%#4.4x\n", |
1171 | dev->name, int_status, eth_status, rx_status, tx_status); | 1116 | dev->name, int_status, eth_status, rx_status, tx_status); |
1172 | 1117 | ||
1173 | /***** receive section ******/ | 1118 | /***** receive section ******/ |
@@ -1178,14 +1123,14 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
1178 | /* too many bytes received during this int, drop the rest of the | 1123 | /* too many bytes received during this int, drop the rest of the |
1179 | * packets */ | 1124 | * packets */ |
1180 | dev->stats.rx_dropped++; | 1125 | dev->stats.rx_dropped++; |
1181 | DEBUG(2, "%s: RX drop, too much done\n", dev->name); | 1126 | pr_debug("%s: RX drop, too much done\n", dev->name); |
1182 | } else if (rsr & PktRxOk) { | 1127 | } else if (rsr & PktRxOk) { |
1183 | struct sk_buff *skb; | 1128 | struct sk_buff *skb; |
1184 | 1129 | ||
1185 | pktlen = GetWord(XIRCREG0_RBC); | 1130 | pktlen = GetWord(XIRCREG0_RBC); |
1186 | bytes_rcvd += pktlen; | 1131 | bytes_rcvd += pktlen; |
1187 | 1132 | ||
1188 | DEBUG(5, "rsr=%#02x packet_length=%u\n", rsr, pktlen); | 1133 | pr_debug("rsr=%#02x packet_length=%u\n", rsr, pktlen); |
1189 | 1134 | ||
1190 | skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */ | 1135 | skb = dev_alloc_skb(pktlen+3); /* 1 extra so we can use insw */ |
1191 | if (!skb) { | 1136 | if (!skb) { |
@@ -1253,19 +1198,19 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
1253 | dev->stats.multicast++; | 1198 | dev->stats.multicast++; |
1254 | } | 1199 | } |
1255 | } else { /* bad packet */ | 1200 | } else { /* bad packet */ |
1256 | DEBUG(5, "rsr=%#02x\n", rsr); | 1201 | pr_debug("rsr=%#02x\n", rsr); |
1257 | } | 1202 | } |
1258 | if (rsr & PktTooLong) { | 1203 | if (rsr & PktTooLong) { |
1259 | dev->stats.rx_frame_errors++; | 1204 | dev->stats.rx_frame_errors++; |
1260 | DEBUG(3, "%s: Packet too long\n", dev->name); | 1205 | pr_debug("%s: Packet too long\n", dev->name); |
1261 | } | 1206 | } |
1262 | if (rsr & CRCErr) { | 1207 | if (rsr & CRCErr) { |
1263 | dev->stats.rx_crc_errors++; | 1208 | dev->stats.rx_crc_errors++; |
1264 | DEBUG(3, "%s: CRC error\n", dev->name); | 1209 | pr_debug("%s: CRC error\n", dev->name); |
1265 | } | 1210 | } |
1266 | if (rsr & AlignErr) { | 1211 | if (rsr & AlignErr) { |
1267 | dev->stats.rx_fifo_errors++; /* okay ? */ | 1212 | dev->stats.rx_fifo_errors++; /* okay ? */ |
1268 | DEBUG(3, "%s: Alignment error\n", dev->name); | 1213 | pr_debug("%s: Alignment error\n", dev->name); |
1269 | } | 1214 | } |
1270 | 1215 | ||
1271 | /* clear the received/dropped/error packet */ | 1216 | /* clear the received/dropped/error packet */ |
@@ -1277,7 +1222,7 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
1277 | if (rx_status & 0x10) { /* Receive overrun */ | 1222 | if (rx_status & 0x10) { /* Receive overrun */ |
1278 | dev->stats.rx_over_errors++; | 1223 | dev->stats.rx_over_errors++; |
1279 | PutByte(XIRCREG_CR, ClearRxOvrun); | 1224 | PutByte(XIRCREG_CR, ClearRxOvrun); |
1280 | DEBUG(3, "receive overrun cleared\n"); | 1225 | pr_debug("receive overrun cleared\n"); |
1281 | } | 1226 | } |
1282 | 1227 | ||
1283 | /***** transmit section ******/ | 1228 | /***** transmit section ******/ |
@@ -1290,13 +1235,13 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
1290 | if (nn < n) /* rollover */ | 1235 | if (nn < n) /* rollover */ |
1291 | dev->stats.tx_packets += 256 - n; | 1236 | dev->stats.tx_packets += 256 - n; |
1292 | else if (n == nn) { /* happens sometimes - don't know why */ | 1237 | else if (n == nn) { /* happens sometimes - don't know why */ |
1293 | DEBUG(0, "PTR not changed?\n"); | 1238 | pr_debug("PTR not changed?\n"); |
1294 | } else | 1239 | } else |
1295 | dev->stats.tx_packets += lp->last_ptr_value - n; | 1240 | dev->stats.tx_packets += lp->last_ptr_value - n; |
1296 | netif_wake_queue(dev); | 1241 | netif_wake_queue(dev); |
1297 | } | 1242 | } |
1298 | if (tx_status & 0x0002) { /* Execessive collissions */ | 1243 | if (tx_status & 0x0002) { /* Execessive collissions */ |
1299 | DEBUG(0, "tx restarted due to execssive collissions\n"); | 1244 | pr_debug("tx restarted due to execssive collissions\n"); |
1300 | PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */ | 1245 | PutByte(XIRCREG_CR, RestartTx); /* restart transmitter process */ |
1301 | } | 1246 | } |
1302 | if (tx_status & 0x0040) | 1247 | if (tx_status & 0x0040) |
@@ -1315,14 +1260,14 @@ xirc2ps_interrupt(int irq, void *dev_id) | |||
1315 | maxrx_bytes = 2000; | 1260 | maxrx_bytes = 2000; |
1316 | else if (maxrx_bytes > 22000) | 1261 | else if (maxrx_bytes > 22000) |
1317 | maxrx_bytes = 22000; | 1262 | maxrx_bytes = 22000; |
1318 | DEBUG(1, "set maxrx=%u (rcvd=%u ticks=%lu)\n", | 1263 | pr_debug("set maxrx=%u (rcvd=%u ticks=%lu)\n", |
1319 | maxrx_bytes, bytes_rcvd, duration); | 1264 | maxrx_bytes, bytes_rcvd, duration); |
1320 | } else if (!duration && maxrx_bytes < 22000) { | 1265 | } else if (!duration && maxrx_bytes < 22000) { |
1321 | /* now much faster */ | 1266 | /* now much faster */ |
1322 | maxrx_bytes += 2000; | 1267 | maxrx_bytes += 2000; |
1323 | if (maxrx_bytes > 22000) | 1268 | if (maxrx_bytes > 22000) |
1324 | maxrx_bytes = 22000; | 1269 | maxrx_bytes = 22000; |
1325 | DEBUG(1, "set maxrx=%u\n", maxrx_bytes); | 1270 | pr_debug("set maxrx=%u\n", maxrx_bytes); |
1326 | } | 1271 | } |
1327 | } | 1272 | } |
1328 | 1273 | ||
@@ -1372,7 +1317,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1372 | unsigned freespace; | 1317 | unsigned freespace; |
1373 | unsigned pktlen = skb->len; | 1318 | unsigned pktlen = skb->len; |
1374 | 1319 | ||
1375 | DEBUG(1, "do_start_xmit(skb=%p, dev=%p) len=%u\n", | 1320 | pr_debug("do_start_xmit(skb=%p, dev=%p) len=%u\n", |
1376 | skb, dev, pktlen); | 1321 | skb, dev, pktlen); |
1377 | 1322 | ||
1378 | 1323 | ||
@@ -1398,7 +1343,7 @@ do_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1398 | freespace &= 0x7fff; | 1343 | freespace &= 0x7fff; |
1399 | /* TRS doesn't work - (indeed it is eliminated with sil-rev 1) */ | 1344 | /* TRS doesn't work - (indeed it is eliminated with sil-rev 1) */ |
1400 | okay = pktlen +2 < freespace; | 1345 | okay = pktlen +2 < freespace; |
1401 | DEBUG(2 + (okay ? 2 : 0), "%s: avail. tx space=%u%s\n", | 1346 | pr_debug("%s: avail. tx space=%u%s\n", |
1402 | dev->name, freespace, okay ? " (okay)":" (not enough)"); | 1347 | dev->name, freespace, okay ? " (okay)":" (not enough)"); |
1403 | if (!okay) { /* not enough space */ | 1348 | if (!okay) { /* not enough space */ |
1404 | return NETDEV_TX_BUSY; /* upper layer may decide to requeue this packet */ | 1349 | return NETDEV_TX_BUSY; /* upper layer may decide to requeue this packet */ |
@@ -1500,7 +1445,7 @@ do_config(struct net_device *dev, struct ifmap *map) | |||
1500 | { | 1445 | { |
1501 | local_info_t *local = netdev_priv(dev); | 1446 | local_info_t *local = netdev_priv(dev); |
1502 | 1447 | ||
1503 | DEBUG(0, "do_config(%p)\n", dev); | 1448 | pr_debug("do_config(%p)\n", dev); |
1504 | if (map->port != 255 && map->port != dev->if_port) { | 1449 | if (map->port != 255 && map->port != dev->if_port) { |
1505 | if (map->port > 4) | 1450 | if (map->port > 4) |
1506 | return -EINVAL; | 1451 | return -EINVAL; |
@@ -1527,7 +1472,7 @@ do_open(struct net_device *dev) | |||
1527 | local_info_t *lp = netdev_priv(dev); | 1472 | local_info_t *lp = netdev_priv(dev); |
1528 | struct pcmcia_device *link = lp->p_dev; | 1473 | struct pcmcia_device *link = lp->p_dev; |
1529 | 1474 | ||
1530 | DEBUG(0, "do_open(%p)\n", dev); | 1475 | dev_dbg(&link->dev, "do_open(%p)\n", dev); |
1531 | 1476 | ||
1532 | /* Check that the PCMCIA card is still here. */ | 1477 | /* Check that the PCMCIA card is still here. */ |
1533 | /* Physical device present signature. */ | 1478 | /* Physical device present signature. */ |
@@ -1561,7 +1506,7 @@ do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | |||
1561 | unsigned int ioaddr = dev->base_addr; | 1506 | unsigned int ioaddr = dev->base_addr; |
1562 | struct mii_ioctl_data *data = if_mii(rq); | 1507 | struct mii_ioctl_data *data = if_mii(rq); |
1563 | 1508 | ||
1564 | DEBUG(1, "%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n", | 1509 | pr_debug("%s: ioctl(%-.6s, %#04x) %04x %04x %04x %04x\n", |
1565 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, | 1510 | dev->name, rq->ifr_ifrn.ifrn_name, cmd, |
1566 | data->phy_id, data->reg_num, data->val_in, data->val_out); | 1511 | data->phy_id, data->reg_num, data->val_in, data->val_out); |
1567 | 1512 | ||
@@ -1610,7 +1555,7 @@ do_reset(struct net_device *dev, int full) | |||
1610 | unsigned int ioaddr = dev->base_addr; | 1555 | unsigned int ioaddr = dev->base_addr; |
1611 | unsigned value; | 1556 | unsigned value; |
1612 | 1557 | ||
1613 | DEBUG(0, "%s: do_reset(%p,%d)\n", dev? dev->name:"eth?", dev, full); | 1558 | pr_debug("%s: do_reset(%p,%d)\n", dev? dev->name:"eth?", dev, full); |
1614 | 1559 | ||
1615 | hardreset(dev); | 1560 | hardreset(dev); |
1616 | PutByte(XIRCREG_CR, SoftReset); /* set */ | 1561 | PutByte(XIRCREG_CR, SoftReset); /* set */ |
@@ -1648,8 +1593,8 @@ do_reset(struct net_device *dev, int full) | |||
1648 | } | 1593 | } |
1649 | msleep(40); /* wait 40 msec to let it complete */ | 1594 | msleep(40); /* wait 40 msec to let it complete */ |
1650 | 1595 | ||
1651 | #ifdef PCMCIA_DEBUG | 1596 | #if 0 |
1652 | if (pc_debug) { | 1597 | { |
1653 | SelectPage(0); | 1598 | SelectPage(0); |
1654 | value = GetByte(XIRCREG_ESR); /* read the ESR */ | 1599 | value = GetByte(XIRCREG_ESR); /* read the ESR */ |
1655 | printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value); | 1600 | printk(KERN_DEBUG "%s: ESR is: %#02x\n", dev->name, value); |
@@ -1666,7 +1611,7 @@ do_reset(struct net_device *dev, int full) | |||
1666 | value |= DisableLinkPulse; | 1611 | value |= DisableLinkPulse; |
1667 | PutByte(XIRCREG1_ECR, value); | 1612 | PutByte(XIRCREG1_ECR, value); |
1668 | #endif | 1613 | #endif |
1669 | DEBUG(0, "%s: ECR is: %#02x\n", dev->name, value); | 1614 | pr_debug("%s: ECR is: %#02x\n", dev->name, value); |
1670 | 1615 | ||
1671 | SelectPage(0x42); | 1616 | SelectPage(0x42); |
1672 | PutByte(XIRCREG42_SWC0, 0x20); /* disable source insertion */ | 1617 | PutByte(XIRCREG42_SWC0, 0x20); /* disable source insertion */ |
@@ -1844,7 +1789,7 @@ do_powerdown(struct net_device *dev) | |||
1844 | 1789 | ||
1845 | unsigned int ioaddr = dev->base_addr; | 1790 | unsigned int ioaddr = dev->base_addr; |
1846 | 1791 | ||
1847 | DEBUG(0, "do_powerdown(%p)\n", dev); | 1792 | pr_debug("do_powerdown(%p)\n", dev); |
1848 | 1793 | ||
1849 | SelectPage(4); | 1794 | SelectPage(4); |
1850 | PutByte(XIRCREG4_GPR1, 0); /* clear bit 0: power down */ | 1795 | PutByte(XIRCREG4_GPR1, 0); /* clear bit 0: power down */ |
@@ -1858,7 +1803,7 @@ do_stop(struct net_device *dev) | |||
1858 | local_info_t *lp = netdev_priv(dev); | 1803 | local_info_t *lp = netdev_priv(dev); |
1859 | struct pcmcia_device *link = lp->p_dev; | 1804 | struct pcmcia_device *link = lp->p_dev; |
1860 | 1805 | ||
1861 | DEBUG(0, "do_stop(%p)\n", dev); | 1806 | dev_dbg(&link->dev, "do_stop(%p)\n", dev); |
1862 | 1807 | ||
1863 | if (!link) | 1808 | if (!link) |
1864 | return -ENODEV; | 1809 | return -ENODEV; |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index b9221bdc7184..0fe2fc90f207 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -3235,6 +3235,10 @@ static void __devexit rtl8169_remove_one(struct pci_dev *pdev) | |||
3235 | flush_scheduled_work(); | 3235 | flush_scheduled_work(); |
3236 | 3236 | ||
3237 | unregister_netdev(dev); | 3237 | unregister_netdev(dev); |
3238 | |||
3239 | /* restore original MAC address */ | ||
3240 | rtl_rar_set(tp, dev->perm_addr); | ||
3241 | |||
3238 | rtl_disable_msi(pdev, tp); | 3242 | rtl_disable_msi(pdev, tp); |
3239 | rtl8169_release_board(pdev, dev, tp->mmio_addr); | 3243 | rtl8169_release_board(pdev, dev, tp->mmio_addr); |
3240 | pci_set_drvdata(pdev, NULL); | 3244 | pci_set_drvdata(pdev, NULL); |
@@ -4881,6 +4885,9 @@ static void rtl_shutdown(struct pci_dev *pdev) | |||
4881 | 4885 | ||
4882 | rtl8169_net_suspend(dev); | 4886 | rtl8169_net_suspend(dev); |
4883 | 4887 | ||
4888 | /* restore original MAC address */ | ||
4889 | rtl_rar_set(tp, dev->perm_addr); | ||
4890 | |||
4884 | spin_lock_irq(&tp->lock); | 4891 | spin_lock_irq(&tp->lock); |
4885 | 4892 | ||
4886 | rtl8169_asic_down(ioaddr); | 4893 | rtl8169_asic_down(ioaddr); |
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 05c91ee6921e..f12206bdbb75 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -2283,7 +2283,7 @@ static int __devinit smc_drv_probe(struct platform_device *pdev) | |||
2283 | 2283 | ||
2284 | ndev->irq = ires->start; | 2284 | ndev->irq = ires->start; |
2285 | 2285 | ||
2286 | if (ires->flags & IRQF_TRIGGER_MASK) | 2286 | if (irq_flags == -1 || ires->flags & IRQF_TRIGGER_MASK) |
2287 | irq_flags = ires->flags & IRQF_TRIGGER_MASK; | 2287 | irq_flags = ires->flags & IRQF_TRIGGER_MASK; |
2288 | 2288 | ||
2289 | ret = smc_request_attrib(pdev, ndev); | 2289 | ret = smc_request_attrib(pdev, ndev); |
diff --git a/drivers/net/smsc9420.c b/drivers/net/smsc9420.c index b4909a2dec66..0f7909276237 100644 --- a/drivers/net/smsc9420.c +++ b/drivers/net/smsc9420.c | |||
@@ -252,6 +252,9 @@ static int smsc9420_ethtool_get_settings(struct net_device *dev, | |||
252 | { | 252 | { |
253 | struct smsc9420_pdata *pd = netdev_priv(dev); | 253 | struct smsc9420_pdata *pd = netdev_priv(dev); |
254 | 254 | ||
255 | if (!pd->phy_dev) | ||
256 | return -ENODEV; | ||
257 | |||
255 | cmd->maxtxpkt = 1; | 258 | cmd->maxtxpkt = 1; |
256 | cmd->maxrxpkt = 1; | 259 | cmd->maxrxpkt = 1; |
257 | return phy_ethtool_gset(pd->phy_dev, cmd); | 260 | return phy_ethtool_gset(pd->phy_dev, cmd); |
@@ -262,6 +265,9 @@ static int smsc9420_ethtool_set_settings(struct net_device *dev, | |||
262 | { | 265 | { |
263 | struct smsc9420_pdata *pd = netdev_priv(dev); | 266 | struct smsc9420_pdata *pd = netdev_priv(dev); |
264 | 267 | ||
268 | if (!pd->phy_dev) | ||
269 | return -ENODEV; | ||
270 | |||
265 | return phy_ethtool_sset(pd->phy_dev, cmd); | 271 | return phy_ethtool_sset(pd->phy_dev, cmd); |
266 | } | 272 | } |
267 | 273 | ||
@@ -290,6 +296,10 @@ static void smsc9420_ethtool_set_msglevel(struct net_device *netdev, u32 data) | |||
290 | static int smsc9420_ethtool_nway_reset(struct net_device *netdev) | 296 | static int smsc9420_ethtool_nway_reset(struct net_device *netdev) |
291 | { | 297 | { |
292 | struct smsc9420_pdata *pd = netdev_priv(netdev); | 298 | struct smsc9420_pdata *pd = netdev_priv(netdev); |
299 | |||
300 | if (!pd->phy_dev) | ||
301 | return -ENODEV; | ||
302 | |||
293 | return phy_start_aneg(pd->phy_dev); | 303 | return phy_start_aneg(pd->phy_dev); |
294 | } | 304 | } |
295 | 305 | ||
@@ -312,6 +322,10 @@ smsc9420_ethtool_getregs(struct net_device *dev, struct ethtool_regs *regs, | |||
312 | for (i = 0; i < 0x100; i += (sizeof(u32))) | 322 | for (i = 0; i < 0x100; i += (sizeof(u32))) |
313 | data[j++] = smsc9420_reg_read(pd, i); | 323 | data[j++] = smsc9420_reg_read(pd, i); |
314 | 324 | ||
325 | // cannot read phy registers if the net device is down | ||
326 | if (!phy_dev) | ||
327 | return; | ||
328 | |||
315 | for (i = 0; i <= 31; i++) | 329 | for (i = 0; i <= 31; i++) |
316 | data[j++] = smsc9420_mii_read(phy_dev->bus, phy_dev->addr, i); | 330 | data[j++] = smsc9420_mii_read(phy_dev->bus, phy_dev->addr, i); |
317 | } | 331 | } |
diff --git a/drivers/net/stmmac/stmmac_main.c b/drivers/net/stmmac/stmmac_main.c index c2f14dc9ba28..9542995ba667 100644 --- a/drivers/net/stmmac/stmmac_main.c +++ b/drivers/net/stmmac/stmmac_main.c | |||
@@ -416,13 +416,8 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
416 | unsigned int txsize = priv->dma_tx_size; | 416 | unsigned int txsize = priv->dma_tx_size; |
417 | unsigned int rxsize = priv->dma_rx_size; | 417 | unsigned int rxsize = priv->dma_rx_size; |
418 | unsigned int bfsize = priv->dma_buf_sz; | 418 | unsigned int bfsize = priv->dma_buf_sz; |
419 | int buff2_needed = 0; | 419 | int buff2_needed = 0, dis_ic = 0; |
420 | int dis_ic = 0; | ||
421 | 420 | ||
422 | #ifdef CONFIG_STMMAC_TIMER | ||
423 | /* Using Timers disable interrupts on completion for the reception */ | ||
424 | dis_ic = 1; | ||
425 | #endif | ||
426 | /* Set the Buffer size according to the MTU; | 421 | /* Set the Buffer size according to the MTU; |
427 | * indeed, in case of jumbo we need to bump-up the buffer sizes. | 422 | * indeed, in case of jumbo we need to bump-up the buffer sizes. |
428 | */ | 423 | */ |
@@ -437,6 +432,11 @@ static void init_dma_desc_rings(struct net_device *dev) | |||
437 | else | 432 | else |
438 | bfsize = DMA_BUFFER_SIZE; | 433 | bfsize = DMA_BUFFER_SIZE; |
439 | 434 | ||
435 | #ifdef CONFIG_STMMAC_TIMER | ||
436 | /* Disable interrupts on completion for the reception if timer is on */ | ||
437 | if (likely(priv->tm->enable)) | ||
438 | dis_ic = 1; | ||
439 | #endif | ||
440 | /* If the MTU exceeds 8k so use the second buffer in the chain */ | 440 | /* If the MTU exceeds 8k so use the second buffer in the chain */ |
441 | if (bfsize >= BUF_SIZE_8KiB) | 441 | if (bfsize >= BUF_SIZE_8KiB) |
442 | buff2_needed = 1; | 442 | buff2_needed = 1; |
@@ -809,20 +809,22 @@ static void stmmac_tx(struct stmmac_priv *priv) | |||
809 | 809 | ||
810 | static inline void stmmac_enable_irq(struct stmmac_priv *priv) | 810 | static inline void stmmac_enable_irq(struct stmmac_priv *priv) |
811 | { | 811 | { |
812 | #ifndef CONFIG_STMMAC_TIMER | 812 | #ifdef CONFIG_STMMAC_TIMER |
813 | writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA); | 813 | if (likely(priv->tm->enable)) |
814 | #else | 814 | priv->tm->timer_start(tmrate); |
815 | priv->tm->timer_start(tmrate); | 815 | else |
816 | #endif | 816 | #endif |
817 | writel(DMA_INTR_DEFAULT_MASK, priv->dev->base_addr + DMA_INTR_ENA); | ||
817 | } | 818 | } |
818 | 819 | ||
819 | static inline void stmmac_disable_irq(struct stmmac_priv *priv) | 820 | static inline void stmmac_disable_irq(struct stmmac_priv *priv) |
820 | { | 821 | { |
821 | #ifndef CONFIG_STMMAC_TIMER | 822 | #ifdef CONFIG_STMMAC_TIMER |
822 | writel(0, priv->dev->base_addr + DMA_INTR_ENA); | 823 | if (likely(priv->tm->enable)) |
823 | #else | 824 | priv->tm->timer_stop(); |
824 | priv->tm->timer_stop(); | 825 | else |
825 | #endif | 826 | #endif |
827 | writel(0, priv->dev->base_addr + DMA_INTR_ENA); | ||
826 | } | 828 | } |
827 | 829 | ||
828 | static int stmmac_has_work(struct stmmac_priv *priv) | 830 | static int stmmac_has_work(struct stmmac_priv *priv) |
@@ -1031,22 +1033,23 @@ static int stmmac_open(struct net_device *dev) | |||
1031 | } | 1033 | } |
1032 | 1034 | ||
1033 | #ifdef CONFIG_STMMAC_TIMER | 1035 | #ifdef CONFIG_STMMAC_TIMER |
1034 | priv->tm = kmalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); | 1036 | priv->tm = kzalloc(sizeof(struct stmmac_timer *), GFP_KERNEL); |
1035 | if (unlikely(priv->tm == NULL)) { | 1037 | if (unlikely(priv->tm == NULL)) { |
1036 | pr_err("%s: ERROR: timer memory alloc failed \n", __func__); | 1038 | pr_err("%s: ERROR: timer memory alloc failed \n", __func__); |
1037 | return -ENOMEM; | 1039 | return -ENOMEM; |
1038 | } | 1040 | } |
1039 | priv->tm->freq = tmrate; | 1041 | priv->tm->freq = tmrate; |
1040 | 1042 | ||
1041 | /* Test if the HW timer can be actually used. | 1043 | /* Test if the external timer can be actually used. |
1042 | * In case of failure continue with no timer. */ | 1044 | * In case of failure continue without timer. */ |
1043 | if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) { | 1045 | if (unlikely((stmmac_open_ext_timer(dev, priv->tm)) < 0)) { |
1044 | pr_warning("stmmaceth: cannot attach the HW timer\n"); | 1046 | pr_warning("stmmaceth: cannot attach the external timer.\n"); |
1045 | tmrate = 0; | 1047 | tmrate = 0; |
1046 | priv->tm->freq = 0; | 1048 | priv->tm->freq = 0; |
1047 | priv->tm->timer_start = stmmac_no_timer_started; | 1049 | priv->tm->timer_start = stmmac_no_timer_started; |
1048 | priv->tm->timer_stop = stmmac_no_timer_stopped; | 1050 | priv->tm->timer_stop = stmmac_no_timer_stopped; |
1049 | } | 1051 | } else |
1052 | priv->tm->enable = 1; | ||
1050 | #endif | 1053 | #endif |
1051 | 1054 | ||
1052 | /* Create and initialize the TX/RX descriptors chains. */ | 1055 | /* Create and initialize the TX/RX descriptors chains. */ |
@@ -1322,9 +1325,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1322 | 1325 | ||
1323 | /* Interrupt on completition only for the latest segment */ | 1326 | /* Interrupt on completition only for the latest segment */ |
1324 | priv->mac_type->ops->close_tx_desc(desc); | 1327 | priv->mac_type->ops->close_tx_desc(desc); |
1328 | |||
1325 | #ifdef CONFIG_STMMAC_TIMER | 1329 | #ifdef CONFIG_STMMAC_TIMER |
1326 | /* Clean IC while using timers */ | 1330 | /* Clean IC while using timer */ |
1327 | priv->mac_type->ops->clear_tx_ic(desc); | 1331 | if (likely(priv->tm->enable)) |
1332 | priv->mac_type->ops->clear_tx_ic(desc); | ||
1328 | #endif | 1333 | #endif |
1329 | /* To avoid raise condition */ | 1334 | /* To avoid raise condition */ |
1330 | priv->mac_type->ops->set_tx_owner(first); | 1335 | priv->mac_type->ops->set_tx_owner(first); |
@@ -2028,7 +2033,8 @@ static int stmmac_suspend(struct platform_device *pdev, pm_message_t state) | |||
2028 | 2033 | ||
2029 | #ifdef CONFIG_STMMAC_TIMER | 2034 | #ifdef CONFIG_STMMAC_TIMER |
2030 | priv->tm->timer_stop(); | 2035 | priv->tm->timer_stop(); |
2031 | dis_ic = 1; | 2036 | if (likely(priv->tm->enable)) |
2037 | dis_ic = 1; | ||
2032 | #endif | 2038 | #endif |
2033 | napi_disable(&priv->napi); | 2039 | napi_disable(&priv->napi); |
2034 | 2040 | ||
diff --git a/drivers/net/stmmac/stmmac_timer.c b/drivers/net/stmmac/stmmac_timer.c index b838c6582077..679f61ffb1f8 100644 --- a/drivers/net/stmmac/stmmac_timer.c +++ b/drivers/net/stmmac/stmmac_timer.c | |||
@@ -63,7 +63,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | |||
63 | 63 | ||
64 | stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | 64 | stmmac_rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); |
65 | if (stmmac_rtc == NULL) { | 65 | if (stmmac_rtc == NULL) { |
66 | pr_error("open rtc device failed\n"); | 66 | pr_err("open rtc device failed\n"); |
67 | return -ENODEV; | 67 | return -ENODEV; |
68 | } | 68 | } |
69 | 69 | ||
@@ -71,7 +71,7 @@ int stmmac_open_ext_timer(struct net_device *dev, struct stmmac_timer *tm) | |||
71 | 71 | ||
72 | /* Periodic mode is not supported */ | 72 | /* Periodic mode is not supported */ |
73 | if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) { | 73 | if ((rtc_irq_set_freq(stmmac_rtc, &stmmac_task, tm->freq) < 0)) { |
74 | pr_error("set periodic failed\n"); | 74 | pr_err("set periodic failed\n"); |
75 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); | 75 | rtc_irq_unregister(stmmac_rtc, &stmmac_task); |
76 | rtc_class_close(stmmac_rtc); | 76 | rtc_class_close(stmmac_rtc); |
77 | return -1; | 77 | return -1; |
diff --git a/drivers/net/stmmac/stmmac_timer.h b/drivers/net/stmmac/stmmac_timer.h index f795cae33725..6863590d184b 100644 --- a/drivers/net/stmmac/stmmac_timer.h +++ b/drivers/net/stmmac/stmmac_timer.h | |||
@@ -26,6 +26,7 @@ struct stmmac_timer { | |||
26 | void (*timer_start) (unsigned int new_freq); | 26 | void (*timer_start) (unsigned int new_freq); |
27 | void (*timer_stop) (void); | 27 | void (*timer_stop) (void); |
28 | unsigned int freq; | 28 | unsigned int freq; |
29 | unsigned int enable; | ||
29 | }; | 30 | }; |
30 | 31 | ||
31 | /* Open the HW timer device and return 0 in case of success */ | 32 | /* Open the HW timer device and return 0 in case of success */ |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index fa4e58196c21..43bc3fcc0d85 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -378,7 +378,7 @@ static void dbg_dump(int line_count, const char *func_name, unsigned char *buf, | |||
378 | } | 378 | } |
379 | 379 | ||
380 | #define DUMP(buf_, len_) \ | 380 | #define DUMP(buf_, len_) \ |
381 | dbg_dump(__LINE__, __func__, buf_, len_) | 381 | dbg_dump(__LINE__, __func__, (unsigned char *)buf_, len_) |
382 | 382 | ||
383 | #define DUMP1(buf_, len_) \ | 383 | #define DUMP1(buf_, len_) \ |
384 | do { \ | 384 | do { \ |
@@ -1363,7 +1363,7 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) | |||
1363 | /* reset the rts and dtr */ | 1363 | /* reset the rts and dtr */ |
1364 | /* do the actual close */ | 1364 | /* do the actual close */ |
1365 | serial->open_count--; | 1365 | serial->open_count--; |
1366 | kref_put(&serial->parent->ref, hso_serial_ref_free); | 1366 | |
1367 | if (serial->open_count <= 0) { | 1367 | if (serial->open_count <= 0) { |
1368 | serial->open_count = 0; | 1368 | serial->open_count = 0; |
1369 | spin_lock_irq(&serial->serial_lock); | 1369 | spin_lock_irq(&serial->serial_lock); |
@@ -1383,6 +1383,8 @@ static void hso_serial_close(struct tty_struct *tty, struct file *filp) | |||
1383 | usb_autopm_put_interface(serial->parent->interface); | 1383 | usb_autopm_put_interface(serial->parent->interface); |
1384 | 1384 | ||
1385 | mutex_unlock(&serial->parent->mutex); | 1385 | mutex_unlock(&serial->parent->mutex); |
1386 | |||
1387 | kref_put(&serial->parent->ref, hso_serial_ref_free); | ||
1386 | } | 1388 | } |
1387 | 1389 | ||
1388 | /* close the requested serial port */ | 1390 | /* close the requested serial port */ |
@@ -1527,7 +1529,7 @@ static void tiocmget_intr_callback(struct urb *urb) | |||
1527 | dev_warn(&usb->dev, | 1529 | dev_warn(&usb->dev, |
1528 | "hso received invalid serial state notification\n"); | 1530 | "hso received invalid serial state notification\n"); |
1529 | DUMP(serial_state_notification, | 1531 | DUMP(serial_state_notification, |
1530 | sizeof(hso_serial_state_notifation)) | 1532 | sizeof(struct hso_serial_state_notification)); |
1531 | } else { | 1533 | } else { |
1532 | 1534 | ||
1533 | UART_state_bitmap = le16_to_cpu(serial_state_notification-> | 1535 | UART_state_bitmap = le16_to_cpu(serial_state_notification-> |
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index ade5b344f75d..52af5017c46b 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c | |||
@@ -210,32 +210,29 @@ rx_drop: | |||
210 | static struct net_device_stats *veth_get_stats(struct net_device *dev) | 210 | static struct net_device_stats *veth_get_stats(struct net_device *dev) |
211 | { | 211 | { |
212 | struct veth_priv *priv; | 212 | struct veth_priv *priv; |
213 | struct net_device_stats *dev_stats; | ||
214 | int cpu; | 213 | int cpu; |
215 | struct veth_net_stats *stats; | 214 | struct veth_net_stats *stats, total = {0}; |
216 | 215 | ||
217 | priv = netdev_priv(dev); | 216 | priv = netdev_priv(dev); |
218 | dev_stats = &dev->stats; | ||
219 | |||
220 | dev_stats->rx_packets = 0; | ||
221 | dev_stats->tx_packets = 0; | ||
222 | dev_stats->rx_bytes = 0; | ||
223 | dev_stats->tx_bytes = 0; | ||
224 | dev_stats->tx_dropped = 0; | ||
225 | dev_stats->rx_dropped = 0; | ||
226 | 217 | ||
227 | for_each_online_cpu(cpu) { | 218 | for_each_possible_cpu(cpu) { |
228 | stats = per_cpu_ptr(priv->stats, cpu); | 219 | stats = per_cpu_ptr(priv->stats, cpu); |
229 | 220 | ||
230 | dev_stats->rx_packets += stats->rx_packets; | 221 | total.rx_packets += stats->rx_packets; |
231 | dev_stats->tx_packets += stats->tx_packets; | 222 | total.tx_packets += stats->tx_packets; |
232 | dev_stats->rx_bytes += stats->rx_bytes; | 223 | total.rx_bytes += stats->rx_bytes; |
233 | dev_stats->tx_bytes += stats->tx_bytes; | 224 | total.tx_bytes += stats->tx_bytes; |
234 | dev_stats->tx_dropped += stats->tx_dropped; | 225 | total.tx_dropped += stats->tx_dropped; |
235 | dev_stats->rx_dropped += stats->rx_dropped; | 226 | total.rx_dropped += stats->rx_dropped; |
236 | } | 227 | } |
237 | 228 | dev->stats.rx_packets = total.rx_packets; | |
238 | return dev_stats; | 229 | dev->stats.tx_packets = total.tx_packets; |
230 | dev->stats.rx_bytes = total.rx_bytes; | ||
231 | dev->stats.tx_bytes = total.tx_bytes; | ||
232 | dev->stats.tx_dropped = total.tx_dropped; | ||
233 | dev->stats.rx_dropped = total.rx_dropped; | ||
234 | |||
235 | return &dev->stats; | ||
239 | } | 236 | } |
240 | 237 | ||
241 | static int veth_open(struct net_device *dev) | 238 | static int veth_open(struct net_device *dev) |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index e2c33c06190b..8e25ca7080c7 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -907,6 +907,7 @@ static ssize_t cosa_write(struct file *file, | |||
907 | current->state = TASK_RUNNING; | 907 | current->state = TASK_RUNNING; |
908 | chan->tx_status = 1; | 908 | chan->tx_status = 1; |
909 | spin_unlock_irqrestore(&cosa->lock, flags); | 909 | spin_unlock_irqrestore(&cosa->lock, flags); |
910 | up(&chan->wsem); | ||
910 | return -ERESTARTSYS; | 911 | return -ERESTARTSYS; |
911 | } | 912 | } |
912 | } | 913 | } |
diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index d0593ed9170e..f6036fb42319 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c | |||
@@ -43,21 +43,6 @@ | |||
43 | 43 | ||
44 | #include "airo.h" | 44 | #include "airo.h" |
45 | 45 | ||
46 | /* | ||
47 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
48 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
49 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
50 | be present but disabled -- but it can then be enabled for specific | ||
51 | modules at load time with a 'pc_debug=#' option to insmod. | ||
52 | */ | ||
53 | #ifdef PCMCIA_DEBUG | ||
54 | static int pc_debug = PCMCIA_DEBUG; | ||
55 | module_param(pc_debug, int, 0); | ||
56 | static char *version = "$Revision: 1.2 $"; | ||
57 | #define DEBUG(n, args...) if (pc_debug > (n)) printk(KERN_DEBUG args); | ||
58 | #else | ||
59 | #define DEBUG(n, args...) | ||
60 | #endif | ||
61 | 46 | ||
62 | /*====================================================================*/ | 47 | /*====================================================================*/ |
63 | 48 | ||
@@ -145,11 +130,10 @@ static int airo_probe(struct pcmcia_device *p_dev) | |||
145 | { | 130 | { |
146 | local_info_t *local; | 131 | local_info_t *local; |
147 | 132 | ||
148 | DEBUG(0, "airo_attach()\n"); | 133 | dev_dbg(&p_dev->dev, "airo_attach()\n"); |
149 | 134 | ||
150 | /* Interrupt setup */ | 135 | /* Interrupt setup */ |
151 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 136 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
152 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
153 | p_dev->irq.Handler = NULL; | 137 | p_dev->irq.Handler = NULL; |
154 | 138 | ||
155 | /* | 139 | /* |
@@ -184,7 +168,7 @@ static int airo_probe(struct pcmcia_device *p_dev) | |||
184 | 168 | ||
185 | static void airo_detach(struct pcmcia_device *link) | 169 | static void airo_detach(struct pcmcia_device *link) |
186 | { | 170 | { |
187 | DEBUG(0, "airo_detach(0x%p)\n", link); | 171 | dev_dbg(&link->dev, "airo_detach\n"); |
188 | 172 | ||
189 | airo_release(link); | 173 | airo_release(link); |
190 | 174 | ||
@@ -204,9 +188,6 @@ static void airo_detach(struct pcmcia_device *link) | |||
204 | 188 | ||
205 | ======================================================================*/ | 189 | ======================================================================*/ |
206 | 190 | ||
207 | #define CS_CHECK(fn, ret) \ | ||
208 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
209 | |||
210 | static int airo_cs_config_check(struct pcmcia_device *p_dev, | 191 | static int airo_cs_config_check(struct pcmcia_device *p_dev, |
211 | cistpl_cftable_entry_t *cfg, | 192 | cistpl_cftable_entry_t *cfg, |
212 | cistpl_cftable_entry_t *dflt, | 193 | cistpl_cftable_entry_t *dflt, |
@@ -275,11 +256,11 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, | |||
275 | req->Base = mem->win[0].host_addr; | 256 | req->Base = mem->win[0].host_addr; |
276 | req->Size = mem->win[0].len; | 257 | req->Size = mem->win[0].len; |
277 | req->AccessSpeed = 0; | 258 | req->AccessSpeed = 0; |
278 | if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0) | 259 | if (pcmcia_request_window(p_dev, req, &p_dev->win) != 0) |
279 | return -ENODEV; | 260 | return -ENODEV; |
280 | map.Page = 0; | 261 | map.Page = 0; |
281 | map.CardOffset = mem->win[0].card_addr; | 262 | map.CardOffset = mem->win[0].card_addr; |
282 | if (pcmcia_map_mem_page(p_dev->win, &map) != 0) | 263 | if (pcmcia_map_mem_page(p_dev, p_dev->win, &map) != 0) |
283 | return -ENODEV; | 264 | return -ENODEV; |
284 | } | 265 | } |
285 | /* If we got this far, we're cool! */ | 266 | /* If we got this far, we're cool! */ |
@@ -291,11 +272,11 @@ static int airo_config(struct pcmcia_device *link) | |||
291 | { | 272 | { |
292 | local_info_t *dev; | 273 | local_info_t *dev; |
293 | win_req_t *req; | 274 | win_req_t *req; |
294 | int last_fn, last_ret; | 275 | int ret; |
295 | 276 | ||
296 | dev = link->priv; | 277 | dev = link->priv; |
297 | 278 | ||
298 | DEBUG(0, "airo_config(0x%p)\n", link); | 279 | dev_dbg(&link->dev, "airo_config\n"); |
299 | 280 | ||
300 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); | 281 | req = kzalloc(sizeof(win_req_t), GFP_KERNEL); |
301 | if (!req) | 282 | if (!req) |
@@ -315,8 +296,8 @@ static int airo_config(struct pcmcia_device *link) | |||
315 | * and most client drivers will only use the CIS to fill in | 296 | * and most client drivers will only use the CIS to fill in |
316 | * implementation-defined details. | 297 | * implementation-defined details. |
317 | */ | 298 | */ |
318 | last_ret = pcmcia_loop_config(link, airo_cs_config_check, req); | 299 | ret = pcmcia_loop_config(link, airo_cs_config_check, req); |
319 | if (last_ret) | 300 | if (ret) |
320 | goto failed; | 301 | goto failed; |
321 | 302 | ||
322 | /* | 303 | /* |
@@ -324,21 +305,25 @@ static int airo_config(struct pcmcia_device *link) | |||
324 | handler to the interrupt, unless the 'Handler' member of the | 305 | handler to the interrupt, unless the 'Handler' member of the |
325 | irq structure is initialized. | 306 | irq structure is initialized. |
326 | */ | 307 | */ |
327 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 308 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
328 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 309 | ret = pcmcia_request_irq(link, &link->irq); |
310 | if (ret) | ||
311 | goto failed; | ||
312 | } | ||
329 | 313 | ||
330 | /* | 314 | /* |
331 | This actually configures the PCMCIA socket -- setting up | 315 | This actually configures the PCMCIA socket -- setting up |
332 | the I/O windows and the interrupt mapping, and putting the | 316 | the I/O windows and the interrupt mapping, and putting the |
333 | card and host interface into "Memory and IO" mode. | 317 | card and host interface into "Memory and IO" mode. |
334 | */ | 318 | */ |
335 | CS_CHECK(RequestConfiguration, | 319 | ret = pcmcia_request_configuration(link, &link->conf); |
336 | pcmcia_request_configuration(link, &link->conf)); | 320 | if (ret) |
321 | goto failed; | ||
337 | ((local_info_t *)link->priv)->eth_dev = | 322 | ((local_info_t *)link->priv)->eth_dev = |
338 | init_airo_card(link->irq.AssignedIRQ, | 323 | init_airo_card(link->irq.AssignedIRQ, |
339 | link->io.BasePort1, 1, &handle_to_dev(link)); | 324 | link->io.BasePort1, 1, &link->dev); |
340 | if (!((local_info_t *)link->priv)->eth_dev) | 325 | if (!((local_info_t *)link->priv)->eth_dev) |
341 | goto cs_failed; | 326 | goto failed; |
342 | 327 | ||
343 | /* | 328 | /* |
344 | At this point, the dev_node_t structure(s) need to be | 329 | At this point, the dev_node_t structure(s) need to be |
@@ -368,8 +353,6 @@ static int airo_config(struct pcmcia_device *link) | |||
368 | kfree(req); | 353 | kfree(req); |
369 | return 0; | 354 | return 0; |
370 | 355 | ||
371 | cs_failed: | ||
372 | cs_error(link, last_fn, last_ret); | ||
373 | failed: | 356 | failed: |
374 | airo_release(link); | 357 | airo_release(link); |
375 | kfree(req); | 358 | kfree(req); |
@@ -386,7 +369,7 @@ static int airo_config(struct pcmcia_device *link) | |||
386 | 369 | ||
387 | static void airo_release(struct pcmcia_device *link) | 370 | static void airo_release(struct pcmcia_device *link) |
388 | { | 371 | { |
389 | DEBUG(0, "airo_release(0x%p)\n", link); | 372 | dev_dbg(&link->dev, "airo_release\n"); |
390 | pcmcia_disable_device(link); | 373 | pcmcia_disable_device(link); |
391 | } | 374 | } |
392 | 375 | ||
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 52bed89063d4..43d2be9867fc 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1555,6 +1555,8 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) | |||
1555 | BIT(NL80211_IFTYPE_ADHOC) | | 1555 | BIT(NL80211_IFTYPE_ADHOC) | |
1556 | BIT(NL80211_IFTYPE_MESH_POINT); | 1556 | BIT(NL80211_IFTYPE_MESH_POINT); |
1557 | 1557 | ||
1558 | hw->wiphy->ps_default = false; | ||
1559 | |||
1558 | hw->queues = 4; | 1560 | hw->queues = 4; |
1559 | hw->max_rates = 4; | 1561 | hw->max_rates = 4; |
1560 | hw->channel_change_time = 5000; | 1562 | hw->channel_change_time = 5000; |
diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index ddaa859c3491..32407911842f 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c | |||
@@ -55,22 +55,6 @@ | |||
55 | 55 | ||
56 | #include "atmel.h" | 56 | #include "atmel.h" |
57 | 57 | ||
58 | /* | ||
59 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
60 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
61 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
62 | be present but disabled -- but it can then be enabled for specific | ||
63 | modules at load time with a 'pc_debug=#' option to insmod. | ||
64 | */ | ||
65 | |||
66 | #ifdef PCMCIA_DEBUG | ||
67 | static int pc_debug = PCMCIA_DEBUG; | ||
68 | module_param(pc_debug, int, 0); | ||
69 | static char *version = "$Revision: 1.2 $"; | ||
70 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); | ||
71 | #else | ||
72 | #define DEBUG(n, args...) | ||
73 | #endif | ||
74 | 58 | ||
75 | /*====================================================================*/ | 59 | /*====================================================================*/ |
76 | 60 | ||
@@ -155,11 +139,10 @@ static int atmel_probe(struct pcmcia_device *p_dev) | |||
155 | { | 139 | { |
156 | local_info_t *local; | 140 | local_info_t *local; |
157 | 141 | ||
158 | DEBUG(0, "atmel_attach()\n"); | 142 | dev_dbg(&p_dev->dev, "atmel_attach()\n"); |
159 | 143 | ||
160 | /* Interrupt setup */ | 144 | /* Interrupt setup */ |
161 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 145 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
162 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
163 | p_dev->irq.Handler = NULL; | 146 | p_dev->irq.Handler = NULL; |
164 | 147 | ||
165 | /* | 148 | /* |
@@ -194,7 +177,7 @@ static int atmel_probe(struct pcmcia_device *p_dev) | |||
194 | 177 | ||
195 | static void atmel_detach(struct pcmcia_device *link) | 178 | static void atmel_detach(struct pcmcia_device *link) |
196 | { | 179 | { |
197 | DEBUG(0, "atmel_detach(0x%p)\n", link); | 180 | dev_dbg(&link->dev, "atmel_detach\n"); |
198 | 181 | ||
199 | atmel_release(link); | 182 | atmel_release(link); |
200 | 183 | ||
@@ -209,9 +192,6 @@ static void atmel_detach(struct pcmcia_device *link) | |||
209 | 192 | ||
210 | ======================================================================*/ | 193 | ======================================================================*/ |
211 | 194 | ||
212 | #define CS_CHECK(fn, ret) \ | ||
213 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
214 | |||
215 | /* Call-back function to interrogate PCMCIA-specific information | 195 | /* Call-back function to interrogate PCMCIA-specific information |
216 | about the current existance of the card */ | 196 | about the current existance of the card */ |
217 | static int card_present(void *arg) | 197 | static int card_present(void *arg) |
@@ -275,13 +255,13 @@ static int atmel_config_check(struct pcmcia_device *p_dev, | |||
275 | static int atmel_config(struct pcmcia_device *link) | 255 | static int atmel_config(struct pcmcia_device *link) |
276 | { | 256 | { |
277 | local_info_t *dev; | 257 | local_info_t *dev; |
278 | int last_fn, last_ret; | 258 | int ret; |
279 | struct pcmcia_device_id *did; | 259 | struct pcmcia_device_id *did; |
280 | 260 | ||
281 | dev = link->priv; | 261 | dev = link->priv; |
282 | did = dev_get_drvdata(&handle_to_dev(link)); | 262 | did = dev_get_drvdata(&link->dev); |
283 | 263 | ||
284 | DEBUG(0, "atmel_config(0x%p)\n", link); | 264 | dev_dbg(&link->dev, "atmel_config\n"); |
285 | 265 | ||
286 | /* | 266 | /* |
287 | In this loop, we scan the CIS for configuration table entries, | 267 | In this loop, we scan the CIS for configuration table entries, |
@@ -303,31 +283,36 @@ static int atmel_config(struct pcmcia_device *link) | |||
303 | handler to the interrupt, unless the 'Handler' member of the | 283 | handler to the interrupt, unless the 'Handler' member of the |
304 | irq structure is initialized. | 284 | irq structure is initialized. |
305 | */ | 285 | */ |
306 | if (link->conf.Attributes & CONF_ENABLE_IRQ) | 286 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
307 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 287 | ret = pcmcia_request_irq(link, &link->irq); |
288 | if (ret) | ||
289 | goto failed; | ||
290 | } | ||
308 | 291 | ||
309 | /* | 292 | /* |
310 | This actually configures the PCMCIA socket -- setting up | 293 | This actually configures the PCMCIA socket -- setting up |
311 | the I/O windows and the interrupt mapping, and putting the | 294 | the I/O windows and the interrupt mapping, and putting the |
312 | card and host interface into "Memory and IO" mode. | 295 | card and host interface into "Memory and IO" mode. |
313 | */ | 296 | */ |
314 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 297 | ret = pcmcia_request_configuration(link, &link->conf); |
298 | if (ret) | ||
299 | goto failed; | ||
315 | 300 | ||
316 | if (link->irq.AssignedIRQ == 0) { | 301 | if (link->irq.AssignedIRQ == 0) { |
317 | printk(KERN_ALERT | 302 | printk(KERN_ALERT |
318 | "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config."); | 303 | "atmel: cannot assign IRQ: check that CONFIG_ISA is set in kernel config."); |
319 | goto cs_failed; | 304 | goto failed; |
320 | } | 305 | } |
321 | 306 | ||
322 | ((local_info_t*)link->priv)->eth_dev = | 307 | ((local_info_t*)link->priv)->eth_dev = |
323 | init_atmel_card(link->irq.AssignedIRQ, | 308 | init_atmel_card(link->irq.AssignedIRQ, |
324 | link->io.BasePort1, | 309 | link->io.BasePort1, |
325 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, | 310 | did ? did->driver_info : ATMEL_FW_TYPE_NONE, |
326 | &handle_to_dev(link), | 311 | &link->dev, |
327 | card_present, | 312 | card_present, |
328 | link); | 313 | link); |
329 | if (!((local_info_t*)link->priv)->eth_dev) | 314 | if (!((local_info_t*)link->priv)->eth_dev) |
330 | goto cs_failed; | 315 | goto failed; |
331 | 316 | ||
332 | 317 | ||
333 | /* | 318 | /* |
@@ -340,8 +325,6 @@ static int atmel_config(struct pcmcia_device *link) | |||
340 | 325 | ||
341 | return 0; | 326 | return 0; |
342 | 327 | ||
343 | cs_failed: | ||
344 | cs_error(link, last_fn, last_ret); | ||
345 | failed: | 328 | failed: |
346 | atmel_release(link); | 329 | atmel_release(link); |
347 | return -ENODEV; | 330 | return -ENODEV; |
@@ -359,7 +342,7 @@ static void atmel_release(struct pcmcia_device *link) | |||
359 | { | 342 | { |
360 | struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; | 343 | struct net_device *dev = ((local_info_t*)link->priv)->eth_dev; |
361 | 344 | ||
362 | DEBUG(0, "atmel_release(0x%p)\n", link); | 345 | dev_dbg(&link->dev, "atmel_release\n"); |
363 | 346 | ||
364 | if (dev) | 347 | if (dev) |
365 | stop_atmel_card(dev); | 348 | stop_atmel_card(dev); |
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 6c3a74964ab8..984174bc7b0f 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -65,35 +65,15 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
65 | struct ssb_bus *ssb; | 65 | struct ssb_bus *ssb; |
66 | win_req_t win; | 66 | win_req_t win; |
67 | memreq_t mem; | 67 | memreq_t mem; |
68 | tuple_t tuple; | ||
69 | cisparse_t parse; | ||
70 | int err = -ENOMEM; | 68 | int err = -ENOMEM; |
71 | int res = 0; | 69 | int res = 0; |
72 | unsigned char buf[64]; | ||
73 | 70 | ||
74 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); | 71 | ssb = kzalloc(sizeof(*ssb), GFP_KERNEL); |
75 | if (!ssb) | 72 | if (!ssb) |
76 | goto out_error; | 73 | goto out_error; |
77 | 74 | ||
78 | err = -ENODEV; | 75 | err = -ENODEV; |
79 | tuple.DesiredTuple = CISTPL_CONFIG; | ||
80 | tuple.Attributes = 0; | ||
81 | tuple.TupleData = buf; | ||
82 | tuple.TupleDataMax = sizeof(buf); | ||
83 | tuple.TupleOffset = 0; | ||
84 | 76 | ||
85 | res = pcmcia_get_first_tuple(dev, &tuple); | ||
86 | if (res != 0) | ||
87 | goto err_kfree_ssb; | ||
88 | res = pcmcia_get_tuple_data(dev, &tuple); | ||
89 | if (res != 0) | ||
90 | goto err_kfree_ssb; | ||
91 | res = pcmcia_parse_tuple(&tuple, &parse); | ||
92 | if (res != 0) | ||
93 | goto err_kfree_ssb; | ||
94 | |||
95 | dev->conf.ConfigBase = parse.config.base; | ||
96 | dev->conf.Present = parse.config.rmask[0]; | ||
97 | dev->conf.Attributes = CONF_ENABLE_IRQ; | 77 | dev->conf.Attributes = CONF_ENABLE_IRQ; |
98 | dev->conf.IntType = INT_MEMORY_AND_IO; | 78 | dev->conf.IntType = INT_MEMORY_AND_IO; |
99 | 79 | ||
@@ -107,20 +87,18 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
107 | win.Base = 0; | 87 | win.Base = 0; |
108 | win.Size = SSB_CORE_SIZE; | 88 | win.Size = SSB_CORE_SIZE; |
109 | win.AccessSpeed = 250; | 89 | win.AccessSpeed = 250; |
110 | res = pcmcia_request_window(&dev, &win, &dev->win); | 90 | res = pcmcia_request_window(dev, &win, &dev->win); |
111 | if (res != 0) | 91 | if (res != 0) |
112 | goto err_kfree_ssb; | 92 | goto err_kfree_ssb; |
113 | 93 | ||
114 | mem.CardOffset = 0; | 94 | mem.CardOffset = 0; |
115 | mem.Page = 0; | 95 | mem.Page = 0; |
116 | res = pcmcia_map_mem_page(dev->win, &mem); | 96 | res = pcmcia_map_mem_page(dev, dev->win, &mem); |
117 | if (res != 0) | 97 | if (res != 0) |
118 | goto err_disable; | 98 | goto err_disable; |
119 | 99 | ||
120 | dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 100 | dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
121 | dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
122 | dev->irq.Handler = NULL; /* The handler is registered later. */ | 101 | dev->irq.Handler = NULL; /* The handler is registered later. */ |
123 | dev->irq.Instance = NULL; | ||
124 | res = pcmcia_request_irq(dev, &dev->irq); | 102 | res = pcmcia_request_irq(dev, &dev->irq); |
125 | if (res != 0) | 103 | if (res != 0) |
126 | goto err_disable; | 104 | goto err_disable; |
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index ad8eab4a639b..c9640a3e02c9 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c | |||
@@ -274,9 +274,6 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
274 | conf_reg_t reg; | 274 | conf_reg_t reg; |
275 | struct hostap_interface *iface = netdev_priv(dev); | 275 | struct hostap_interface *iface = netdev_priv(dev); |
276 | local_info_t *local = iface->local; | 276 | local_info_t *local = iface->local; |
277 | tuple_t tuple; | ||
278 | cisparse_t *parse = NULL; | ||
279 | u_char buf[64]; | ||
280 | struct hostap_cs_priv *hw_priv = local->hw_priv; | 277 | struct hostap_cs_priv *hw_priv = local->hw_priv; |
281 | 278 | ||
282 | if (hw_priv->link->io.NumPorts1 < 0x42) { | 279 | if (hw_priv->link->io.NumPorts1 < 0x42) { |
@@ -285,28 +282,13 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
285 | goto done; | 282 | goto done; |
286 | } | 283 | } |
287 | 284 | ||
288 | parse = kmalloc(sizeof(cisparse_t), GFP_KERNEL); | ||
289 | if (parse == NULL) { | ||
290 | ret = -ENOMEM; | ||
291 | goto done; | ||
292 | } | ||
293 | |||
294 | tuple.Attributes = TUPLE_RETURN_COMMON; | ||
295 | tuple.TupleData = buf; | ||
296 | tuple.TupleDataMax = sizeof(buf); | ||
297 | tuple.TupleOffset = 0; | ||
298 | |||
299 | if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) { | 285 | if (hw_priv->link->manf_id != 0xd601 || hw_priv->link->card_id != 0x0101) { |
300 | /* No SanDisk manfid found */ | 286 | /* No SanDisk manfid found */ |
301 | ret = -ENODEV; | 287 | ret = -ENODEV; |
302 | goto done; | 288 | goto done; |
303 | } | 289 | } |
304 | 290 | ||
305 | tuple.DesiredTuple = CISTPL_LONGLINK_MFC; | 291 | if (hw_priv->link->socket->functions < 2) { |
306 | if (pcmcia_get_first_tuple(hw_priv->link, &tuple) || | ||
307 | pcmcia_get_tuple_data(hw_priv->link, &tuple) || | ||
308 | pcmcia_parse_tuple(&tuple, parse) || | ||
309 | parse->longlink_mfc.nfn < 2) { | ||
310 | /* No multi-function links found */ | 292 | /* No multi-function links found */ |
311 | ret = -ENODEV; | 293 | ret = -ENODEV; |
312 | goto done; | 294 | goto done; |
@@ -354,7 +336,6 @@ static int sandisk_enable_wireless(struct net_device *dev) | |||
354 | udelay(10); | 336 | udelay(10); |
355 | 337 | ||
356 | done: | 338 | done: |
357 | kfree(parse); | ||
358 | return ret; | 339 | return ret; |
359 | } | 340 | } |
360 | 341 | ||
@@ -529,10 +510,6 @@ static void prism2_detach(struct pcmcia_device *link) | |||
529 | } | 510 | } |
530 | 511 | ||
531 | 512 | ||
532 | #define CS_CHECK(fn, ret) \ | ||
533 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
534 | |||
535 | |||
536 | /* run after a CARD_INSERTION event is received to configure the PCMCIA | 513 | /* run after a CARD_INSERTION event is received to configure the PCMCIA |
537 | * socket and make the device available to the system */ | 514 | * socket and make the device available to the system */ |
538 | 515 | ||
@@ -624,7 +601,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
624 | struct hostap_interface *iface; | 601 | struct hostap_interface *iface; |
625 | local_info_t *local; | 602 | local_info_t *local; |
626 | int ret = 1; | 603 | int ret = 1; |
627 | int last_fn, last_ret; | ||
628 | struct hostap_cs_priv *hw_priv; | 604 | struct hostap_cs_priv *hw_priv; |
629 | 605 | ||
630 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); | 606 | PDEBUG(DEBUG_FLOW, "prism2_config()\n"); |
@@ -636,19 +612,18 @@ static int prism2_config(struct pcmcia_device *link) | |||
636 | } | 612 | } |
637 | 613 | ||
638 | /* Look for an appropriate configuration table entry in the CIS */ | 614 | /* Look for an appropriate configuration table entry in the CIS */ |
639 | last_ret = pcmcia_loop_config(link, prism2_config_check, NULL); | 615 | ret = pcmcia_loop_config(link, prism2_config_check, NULL); |
640 | if (last_ret) { | 616 | if (ret) { |
641 | if (!ignore_cis_vcc) | 617 | if (!ignore_cis_vcc) |
642 | printk(KERN_ERR "GetNextTuple(): No matching " | 618 | printk(KERN_ERR "GetNextTuple(): No matching " |
643 | "CIS configuration. Maybe you need the " | 619 | "CIS configuration. Maybe you need the " |
644 | "ignore_cis_vcc=1 parameter.\n"); | 620 | "ignore_cis_vcc=1 parameter.\n"); |
645 | cs_error(link, RequestIO, last_ret); | ||
646 | goto failed; | 621 | goto failed; |
647 | } | 622 | } |
648 | 623 | ||
649 | /* Need to allocate net_device before requesting IRQ handler */ | 624 | /* Need to allocate net_device before requesting IRQ handler */ |
650 | dev = prism2_init_local_data(&prism2_pccard_funcs, 0, | 625 | dev = prism2_init_local_data(&prism2_pccard_funcs, 0, |
651 | &handle_to_dev(link)); | 626 | &link->dev); |
652 | if (dev == NULL) | 627 | if (dev == NULL) |
653 | goto failed; | 628 | goto failed; |
654 | link->priv = dev; | 629 | link->priv = dev; |
@@ -666,13 +641,11 @@ static int prism2_config(struct pcmcia_device *link) | |||
666 | * irq structure is initialized. | 641 | * irq structure is initialized. |
667 | */ | 642 | */ |
668 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { | 643 | if (link->conf.Attributes & CONF_ENABLE_IRQ) { |
669 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | | 644 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
670 | IRQ_HANDLE_PRESENT; | ||
671 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
672 | link->irq.Handler = prism2_interrupt; | 645 | link->irq.Handler = prism2_interrupt; |
673 | link->irq.Instance = dev; | 646 | ret = pcmcia_request_irq(link, &link->irq); |
674 | CS_CHECK(RequestIRQ, | 647 | if (ret) |
675 | pcmcia_request_irq(link, &link->irq)); | 648 | goto failed; |
676 | } | 649 | } |
677 | 650 | ||
678 | /* | 651 | /* |
@@ -680,8 +653,9 @@ static int prism2_config(struct pcmcia_device *link) | |||
680 | * the I/O windows and the interrupt mapping, and putting the | 653 | * the I/O windows and the interrupt mapping, and putting the |
681 | * card and host interface into "Memory and IO" mode. | 654 | * card and host interface into "Memory and IO" mode. |
682 | */ | 655 | */ |
683 | CS_CHECK(RequestConfiguration, | 656 | ret = pcmcia_request_configuration(link, &link->conf); |
684 | pcmcia_request_configuration(link, &link->conf)); | 657 | if (ret) |
658 | goto failed; | ||
685 | 659 | ||
686 | dev->irq = link->irq.AssignedIRQ; | 660 | dev->irq = link->irq.AssignedIRQ; |
687 | dev->base_addr = link->io.BasePort1; | 661 | dev->base_addr = link->io.BasePort1; |
@@ -714,9 +688,6 @@ static int prism2_config(struct pcmcia_device *link) | |||
714 | } | 688 | } |
715 | return ret; | 689 | return ret; |
716 | 690 | ||
717 | cs_failed: | ||
718 | cs_error(link, last_fn, last_ret); | ||
719 | |||
720 | failed: | 691 | failed: |
721 | kfree(hw_priv); | 692 | kfree(hw_priv); |
722 | prism2_release((u_long)link); | 693 | prism2_release((u_long)link); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c index fb9bcfa6d947..b7e196e3c8d3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-tx.c +++ b/drivers/net/wireless/iwlwifi/iwl-tx.c | |||
@@ -1277,8 +1277,16 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid) | |||
1277 | return -ENXIO; | 1277 | return -ENXIO; |
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | if (priv->stations[sta_id].tid[tid].agg.state == | ||
1281 | IWL_EMPTYING_HW_QUEUE_ADDBA) { | ||
1282 | IWL_DEBUG_HT(priv, "AGG stop before setup done\n"); | ||
1283 | ieee80211_stop_tx_ba_cb_irqsafe(priv->hw, ra, tid); | ||
1284 | priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF; | ||
1285 | return 0; | ||
1286 | } | ||
1287 | |||
1280 | if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON) | 1288 | if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON) |
1281 | IWL_WARN(priv, "Stopping AGG while state not IWL_AGG_ON\n"); | 1289 | IWL_WARN(priv, "Stopping AGG while state not ON or starting\n"); |
1282 | 1290 | ||
1283 | tid_data = &priv->stations[sta_id].tid[tid]; | 1291 | tid_data = &priv->stations[sta_id].tid[tid]; |
1284 | ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; | 1292 | ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4; |
diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 62381768f2d5..b1d84592b959 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c | |||
@@ -590,7 +590,7 @@ static int if_cs_prog_helper(struct if_cs_card *card) | |||
590 | 590 | ||
591 | /* TODO: make firmware file configurable */ | 591 | /* TODO: make firmware file configurable */ |
592 | ret = request_firmware(&fw, "libertas_cs_helper.fw", | 592 | ret = request_firmware(&fw, "libertas_cs_helper.fw", |
593 | &handle_to_dev(card->p_dev)); | 593 | &card->p_dev->dev); |
594 | if (ret) { | 594 | if (ret) { |
595 | lbs_pr_err("can't load helper firmware\n"); | 595 | lbs_pr_err("can't load helper firmware\n"); |
596 | ret = -ENODEV; | 596 | ret = -ENODEV; |
@@ -663,7 +663,7 @@ static int if_cs_prog_real(struct if_cs_card *card) | |||
663 | 663 | ||
664 | /* TODO: make firmware file configurable */ | 664 | /* TODO: make firmware file configurable */ |
665 | ret = request_firmware(&fw, "libertas_cs.fw", | 665 | ret = request_firmware(&fw, "libertas_cs.fw", |
666 | &handle_to_dev(card->p_dev)); | 666 | &card->p_dev->dev); |
667 | if (ret) { | 667 | if (ret) { |
668 | lbs_pr_err("can't load firmware\n"); | 668 | lbs_pr_err("can't load firmware\n"); |
669 | ret = -ENODEV; | 669 | ret = -ENODEV; |
@@ -793,18 +793,37 @@ static void if_cs_release(struct pcmcia_device *p_dev) | |||
793 | * configure the card at this point -- we wait until we receive a card | 793 | * configure the card at this point -- we wait until we receive a card |
794 | * insertion event. | 794 | * insertion event. |
795 | */ | 795 | */ |
796 | |||
797 | static int if_cs_ioprobe(struct pcmcia_device *p_dev, | ||
798 | cistpl_cftable_entry_t *cfg, | ||
799 | cistpl_cftable_entry_t *dflt, | ||
800 | unsigned int vcc, | ||
801 | void *priv_data) | ||
802 | { | ||
803 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
804 | p_dev->io.BasePort1 = cfg->io.win[0].base; | ||
805 | p_dev->io.NumPorts1 = cfg->io.win[0].len; | ||
806 | |||
807 | /* Do we need to allocate an interrupt? */ | ||
808 | if (cfg->irq.IRQInfo1) | ||
809 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
810 | |||
811 | /* IO window settings */ | ||
812 | if (cfg->io.nwin != 1) { | ||
813 | lbs_pr_err("wrong CIS (check number of IO windows)\n"); | ||
814 | return -ENODEV; | ||
815 | } | ||
816 | |||
817 | /* This reserves IO space but doesn't actually enable it */ | ||
818 | return pcmcia_request_io(p_dev, &p_dev->io); | ||
819 | } | ||
820 | |||
796 | static int if_cs_probe(struct pcmcia_device *p_dev) | 821 | static int if_cs_probe(struct pcmcia_device *p_dev) |
797 | { | 822 | { |
798 | int ret = -ENOMEM; | 823 | int ret = -ENOMEM; |
799 | unsigned int prod_id; | 824 | unsigned int prod_id; |
800 | struct lbs_private *priv; | 825 | struct lbs_private *priv; |
801 | struct if_cs_card *card; | 826 | struct if_cs_card *card; |
802 | /* CIS parsing */ | ||
803 | tuple_t tuple; | ||
804 | cisparse_t parse; | ||
805 | cistpl_cftable_entry_t *cfg = &parse.cftable_entry; | ||
806 | cistpl_io_t *io = &cfg->io; | ||
807 | u_char buf[64]; | ||
808 | 827 | ||
809 | lbs_deb_enter(LBS_DEB_CS); | 828 | lbs_deb_enter(LBS_DEB_CS); |
810 | 829 | ||
@@ -818,48 +837,15 @@ static int if_cs_probe(struct pcmcia_device *p_dev) | |||
818 | 837 | ||
819 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; | 838 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
820 | p_dev->irq.Handler = NULL; | 839 | p_dev->irq.Handler = NULL; |
821 | p_dev->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_LEVEL_ID; | ||
822 | 840 | ||
823 | p_dev->conf.Attributes = 0; | 841 | p_dev->conf.Attributes = 0; |
824 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 842 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
825 | 843 | ||
826 | tuple.Attributes = 0; | 844 | if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { |
827 | tuple.TupleData = buf; | 845 | lbs_pr_err("error in pcmcia_loop_config\n"); |
828 | tuple.TupleDataMax = sizeof(buf); | ||
829 | tuple.TupleOffset = 0; | ||
830 | |||
831 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
832 | if ((ret = pcmcia_get_first_tuple(p_dev, &tuple)) != 0 || | ||
833 | (ret = pcmcia_get_tuple_data(p_dev, &tuple)) != 0 || | ||
834 | (ret = pcmcia_parse_tuple(&tuple, &parse)) != 0) | ||
835 | { | ||
836 | lbs_pr_err("error in pcmcia_get_first_tuple etc\n"); | ||
837 | goto out1; | ||
838 | } | ||
839 | |||
840 | p_dev->conf.ConfigIndex = cfg->index; | ||
841 | |||
842 | /* Do we need to allocate an interrupt? */ | ||
843 | if (cfg->irq.IRQInfo1) { | ||
844 | p_dev->conf.Attributes |= CONF_ENABLE_IRQ; | ||
845 | } | ||
846 | |||
847 | /* IO window settings */ | ||
848 | if (cfg->io.nwin != 1) { | ||
849 | lbs_pr_err("wrong CIS (check number of IO windows)\n"); | ||
850 | ret = -ENODEV; | ||
851 | goto out1; | 846 | goto out1; |
852 | } | 847 | } |
853 | p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; | ||
854 | p_dev->io.BasePort1 = io->win[0].base; | ||
855 | p_dev->io.NumPorts1 = io->win[0].len; | ||
856 | 848 | ||
857 | /* This reserves IO space but doesn't actually enable it */ | ||
858 | ret = pcmcia_request_io(p_dev, &p_dev->io); | ||
859 | if (ret) { | ||
860 | lbs_pr_err("error in pcmcia_request_io\n"); | ||
861 | goto out1; | ||
862 | } | ||
863 | 849 | ||
864 | /* | 850 | /* |
865 | * Allocate an interrupt line. Note that this does not assign | 851 | * Allocate an interrupt line. Note that this does not assign |
diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index 9498b46c99a4..e61e6b9440ab 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c | |||
@@ -145,23 +145,6 @@ static const unsigned int txConfEUD = 0x10; /* Enable Uni-Data packets */ | |||
145 | static const unsigned int txConfKey = 0x02; /* Scramble data packets */ | 145 | static const unsigned int txConfKey = 0x02; /* Scramble data packets */ |
146 | static const unsigned int txConfLoop = 0x01; /* Loopback mode */ | 146 | static const unsigned int txConfLoop = 0x01; /* Loopback mode */ |
147 | 147 | ||
148 | /* | ||
149 | All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
150 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
151 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
152 | be present but disabled -- but it can then be enabled for specific | ||
153 | modules at load time with a 'pc_debug=#' option to insmod. | ||
154 | */ | ||
155 | |||
156 | #ifdef PCMCIA_DEBUG | ||
157 | static int pc_debug = PCMCIA_DEBUG; | ||
158 | module_param(pc_debug, int, 0); | ||
159 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
160 | static char *version = | ||
161 | "netwave_cs.c 0.3.0 Thu Jul 17 14:36:02 1997 (John Markus Bjørndalen)\n"; | ||
162 | #else | ||
163 | #define DEBUG(n, args...) | ||
164 | #endif | ||
165 | 148 | ||
166 | /*====================================================================*/ | 149 | /*====================================================================*/ |
167 | 150 | ||
@@ -383,7 +366,7 @@ static int netwave_probe(struct pcmcia_device *link) | |||
383 | struct net_device *dev; | 366 | struct net_device *dev; |
384 | netwave_private *priv; | 367 | netwave_private *priv; |
385 | 368 | ||
386 | DEBUG(0, "netwave_attach()\n"); | 369 | dev_dbg(&link->dev, "netwave_attach()\n"); |
387 | 370 | ||
388 | /* Initialize the struct pcmcia_device structure */ | 371 | /* Initialize the struct pcmcia_device structure */ |
389 | dev = alloc_etherdev(sizeof(netwave_private)); | 372 | dev = alloc_etherdev(sizeof(netwave_private)); |
@@ -401,8 +384,7 @@ static int netwave_probe(struct pcmcia_device *link) | |||
401 | link->io.IOAddrLines = 5; | 384 | link->io.IOAddrLines = 5; |
402 | 385 | ||
403 | /* Interrupt setup */ | 386 | /* Interrupt setup */ |
404 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 387 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
405 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
406 | link->irq.Handler = &netwave_interrupt; | 388 | link->irq.Handler = &netwave_interrupt; |
407 | 389 | ||
408 | /* General socket configuration */ | 390 | /* General socket configuration */ |
@@ -421,8 +403,6 @@ static int netwave_probe(struct pcmcia_device *link) | |||
421 | 403 | ||
422 | dev->watchdog_timeo = TX_TIMEOUT; | 404 | dev->watchdog_timeo = TX_TIMEOUT; |
423 | 405 | ||
424 | link->irq.Instance = dev; | ||
425 | |||
426 | return netwave_pcmcia_config( link); | 406 | return netwave_pcmcia_config( link); |
427 | } /* netwave_attach */ | 407 | } /* netwave_attach */ |
428 | 408 | ||
@@ -438,7 +418,7 @@ static void netwave_detach(struct pcmcia_device *link) | |||
438 | { | 418 | { |
439 | struct net_device *dev = link->priv; | 419 | struct net_device *dev = link->priv; |
440 | 420 | ||
441 | DEBUG(0, "netwave_detach(0x%p)\n", link); | 421 | dev_dbg(&link->dev, "netwave_detach\n"); |
442 | 422 | ||
443 | netwave_release(link); | 423 | netwave_release(link); |
444 | 424 | ||
@@ -725,18 +705,15 @@ static const struct iw_handler_def netwave_handler_def = | |||
725 | * | 705 | * |
726 | */ | 706 | */ |
727 | 707 | ||
728 | #define CS_CHECK(fn, ret) \ | ||
729 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
730 | |||
731 | static int netwave_pcmcia_config(struct pcmcia_device *link) { | 708 | static int netwave_pcmcia_config(struct pcmcia_device *link) { |
732 | struct net_device *dev = link->priv; | 709 | struct net_device *dev = link->priv; |
733 | netwave_private *priv = netdev_priv(dev); | 710 | netwave_private *priv = netdev_priv(dev); |
734 | int i, j, last_ret, last_fn; | 711 | int i, j, ret; |
735 | win_req_t req; | 712 | win_req_t req; |
736 | memreq_t mem; | 713 | memreq_t mem; |
737 | u_char __iomem *ramBase = NULL; | 714 | u_char __iomem *ramBase = NULL; |
738 | 715 | ||
739 | DEBUG(0, "netwave_pcmcia_config(0x%p)\n", link); | 716 | dev_dbg(&link->dev, "netwave_pcmcia_config\n"); |
740 | 717 | ||
741 | /* | 718 | /* |
742 | * Try allocating IO ports. This tries a few fixed addresses. | 719 | * Try allocating IO ports. This tries a few fixed addresses. |
@@ -749,22 +726,24 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
749 | if (i == 0) | 726 | if (i == 0) |
750 | break; | 727 | break; |
751 | } | 728 | } |
752 | if (i != 0) { | 729 | if (i != 0) |
753 | cs_error(link, RequestIO, i); | ||
754 | goto failed; | 730 | goto failed; |
755 | } | ||
756 | 731 | ||
757 | /* | 732 | /* |
758 | * Now allocate an interrupt line. Note that this does not | 733 | * Now allocate an interrupt line. Note that this does not |
759 | * actually assign a handler to the interrupt. | 734 | * actually assign a handler to the interrupt. |
760 | */ | 735 | */ |
761 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 736 | ret = pcmcia_request_irq(link, &link->irq); |
737 | if (ret) | ||
738 | goto failed; | ||
762 | 739 | ||
763 | /* | 740 | /* |
764 | * This actually configures the PCMCIA socket -- setting up | 741 | * This actually configures the PCMCIA socket -- setting up |
765 | * the I/O windows and the interrupt mapping. | 742 | * the I/O windows and the interrupt mapping. |
766 | */ | 743 | */ |
767 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 744 | ret = pcmcia_request_configuration(link, &link->conf); |
745 | if (ret) | ||
746 | goto failed; | ||
768 | 747 | ||
769 | /* | 748 | /* |
770 | * Allocate a 32K memory window. Note that the struct pcmcia_device | 749 | * Allocate a 32K memory window. Note that the struct pcmcia_device |
@@ -772,14 +751,18 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
772 | * device needs several windows, you'll need to keep track of | 751 | * device needs several windows, you'll need to keep track of |
773 | * the handles in your private data structure, dev->priv. | 752 | * the handles in your private data structure, dev->priv. |
774 | */ | 753 | */ |
775 | DEBUG(1, "Setting mem speed of %d\n", mem_speed); | 754 | dev_dbg(&link->dev, "Setting mem speed of %d\n", mem_speed); |
776 | 755 | ||
777 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; | 756 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_CM|WIN_ENABLE; |
778 | req.Base = 0; req.Size = 0x8000; | 757 | req.Base = 0; req.Size = 0x8000; |
779 | req.AccessSpeed = mem_speed; | 758 | req.AccessSpeed = mem_speed; |
780 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); | 759 | ret = pcmcia_request_window(link, &req, &link->win); |
760 | if (ret) | ||
761 | goto failed; | ||
781 | mem.CardOffset = 0x20000; mem.Page = 0; | 762 | mem.CardOffset = 0x20000; mem.Page = 0; |
782 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); | 763 | ret = pcmcia_map_mem_page(link, link->win, &mem); |
764 | if (ret) | ||
765 | goto failed; | ||
783 | 766 | ||
784 | /* Store base address of the common window frame */ | 767 | /* Store base address of the common window frame */ |
785 | ramBase = ioremap(req.Base, 0x8000); | 768 | ramBase = ioremap(req.Base, 0x8000); |
@@ -787,7 +770,7 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
787 | 770 | ||
788 | dev->irq = link->irq.AssignedIRQ; | 771 | dev->irq = link->irq.AssignedIRQ; |
789 | dev->base_addr = link->io.BasePort1; | 772 | dev->base_addr = link->io.BasePort1; |
790 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 773 | SET_NETDEV_DEV(dev, &link->dev); |
791 | 774 | ||
792 | if (register_netdev(dev) != 0) { | 775 | if (register_netdev(dev) != 0) { |
793 | printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n"); | 776 | printk(KERN_DEBUG "netwave_cs: register_netdev() failed\n"); |
@@ -818,8 +801,6 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { | |||
818 | get_uint16(ramBase + NETWAVE_EREG_ARW+2)); | 801 | get_uint16(ramBase + NETWAVE_EREG_ARW+2)); |
819 | return 0; | 802 | return 0; |
820 | 803 | ||
821 | cs_failed: | ||
822 | cs_error(link, last_fn, last_ret); | ||
823 | failed: | 804 | failed: |
824 | netwave_release(link); | 805 | netwave_release(link); |
825 | return -ENODEV; | 806 | return -ENODEV; |
@@ -837,7 +818,7 @@ static void netwave_release(struct pcmcia_device *link) | |||
837 | struct net_device *dev = link->priv; | 818 | struct net_device *dev = link->priv; |
838 | netwave_private *priv = netdev_priv(dev); | 819 | netwave_private *priv = netdev_priv(dev); |
839 | 820 | ||
840 | DEBUG(0, "netwave_release(0x%p)\n", link); | 821 | dev_dbg(&link->dev, "netwave_release\n"); |
841 | 822 | ||
842 | pcmcia_disable_device(link); | 823 | pcmcia_disable_device(link); |
843 | if (link->win) | 824 | if (link->win) |
@@ -892,7 +873,7 @@ static void netwave_reset(struct net_device *dev) { | |||
892 | u_char __iomem *ramBase = priv->ramBase; | 873 | u_char __iomem *ramBase = priv->ramBase; |
893 | unsigned int iobase = dev->base_addr; | 874 | unsigned int iobase = dev->base_addr; |
894 | 875 | ||
895 | DEBUG(0, "netwave_reset: Done with hardware reset\n"); | 876 | pr_debug("netwave_reset: Done with hardware reset\n"); |
896 | 877 | ||
897 | priv->timeoutCounter = 0; | 878 | priv->timeoutCounter = 0; |
898 | 879 | ||
@@ -988,7 +969,7 @@ static int netwave_hw_xmit(unsigned char* data, int len, | |||
988 | 969 | ||
989 | dev->stats.tx_bytes += len; | 970 | dev->stats.tx_bytes += len; |
990 | 971 | ||
991 | DEBUG(3, "Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n", | 972 | pr_debug("Transmitting with SPCQ %x SPU %x LIF %x ISPLQ %x\n", |
992 | readb(ramBase + NETWAVE_EREG_SPCQ), | 973 | readb(ramBase + NETWAVE_EREG_SPCQ), |
993 | readb(ramBase + NETWAVE_EREG_SPU), | 974 | readb(ramBase + NETWAVE_EREG_SPU), |
994 | readb(ramBase + NETWAVE_EREG_LIF), | 975 | readb(ramBase + NETWAVE_EREG_LIF), |
@@ -1000,7 +981,7 @@ static int netwave_hw_xmit(unsigned char* data, int len, | |||
1000 | MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2); | 981 | MaxData = get_uint16(ramBase + NETWAVE_EREG_TDP+2); |
1001 | DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4); | 982 | DataOffset = get_uint16(ramBase + NETWAVE_EREG_TDP+4); |
1002 | 983 | ||
1003 | DEBUG(3, "TxFreeList %x, MaxData %x, DataOffset %x\n", | 984 | pr_debug("TxFreeList %x, MaxData %x, DataOffset %x\n", |
1004 | TxFreeList, MaxData, DataOffset); | 985 | TxFreeList, MaxData, DataOffset); |
1005 | 986 | ||
1006 | /* Copy packet to the adapter fragment buffers */ | 987 | /* Copy packet to the adapter fragment buffers */ |
@@ -1088,7 +1069,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1088 | status = inb(iobase + NETWAVE_REG_ASR); | 1069 | status = inb(iobase + NETWAVE_REG_ASR); |
1089 | 1070 | ||
1090 | if (!pcmcia_dev_present(link)) { | 1071 | if (!pcmcia_dev_present(link)) { |
1091 | DEBUG(1, "netwave_interrupt: Interrupt with status 0x%x " | 1072 | pr_debug("netwave_interrupt: Interrupt with status 0x%x " |
1092 | "from removed or suspended card!\n", status); | 1073 | "from removed or suspended card!\n", status); |
1093 | break; | 1074 | break; |
1094 | } | 1075 | } |
@@ -1132,7 +1113,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1132 | int txStatus; | 1113 | int txStatus; |
1133 | 1114 | ||
1134 | txStatus = readb(ramBase + NETWAVE_EREG_TSER); | 1115 | txStatus = readb(ramBase + NETWAVE_EREG_TSER); |
1135 | DEBUG(3, "Transmit done. TSER = %x id %x\n", | 1116 | pr_debug("Transmit done. TSER = %x id %x\n", |
1136 | txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1)); | 1117 | txStatus, readb(ramBase + NETWAVE_EREG_TSER + 1)); |
1137 | 1118 | ||
1138 | if (txStatus & 0x20) { | 1119 | if (txStatus & 0x20) { |
@@ -1156,7 +1137,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1156 | * TxGU and TxNOAP is set. (Those are the only ones | 1137 | * TxGU and TxNOAP is set. (Those are the only ones |
1157 | * to set TxErr). | 1138 | * to set TxErr). |
1158 | */ | 1139 | */ |
1159 | DEBUG(3, "netwave_interrupt: TxDN with error status %x\n", | 1140 | pr_debug("netwave_interrupt: TxDN with error status %x\n", |
1160 | txStatus); | 1141 | txStatus); |
1161 | 1142 | ||
1162 | /* Clear out TxGU, TxNOAP, TxErr and TxTrys */ | 1143 | /* Clear out TxGU, TxNOAP, TxErr and TxTrys */ |
@@ -1164,7 +1145,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1164 | writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4); | 1145 | writeb(0xdf & txStatus, ramBase+NETWAVE_EREG_TSER+4); |
1165 | ++dev->stats.tx_errors; | 1146 | ++dev->stats.tx_errors; |
1166 | } | 1147 | } |
1167 | DEBUG(3, "New status is TSER %x ASR %x\n", | 1148 | pr_debug("New status is TSER %x ASR %x\n", |
1168 | readb(ramBase + NETWAVE_EREG_TSER), | 1149 | readb(ramBase + NETWAVE_EREG_TSER), |
1169 | inb(iobase + NETWAVE_REG_ASR)); | 1150 | inb(iobase + NETWAVE_REG_ASR)); |
1170 | 1151 | ||
@@ -1172,7 +1153,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1172 | } | 1153 | } |
1173 | /* TxBA, this would trigger on all error packets received */ | 1154 | /* TxBA, this would trigger on all error packets received */ |
1174 | /* if (status & 0x01) { | 1155 | /* if (status & 0x01) { |
1175 | DEBUG(4, "Transmit buffers available, %x\n", status); | 1156 | pr_debug("Transmit buffers available, %x\n", status); |
1176 | } | 1157 | } |
1177 | */ | 1158 | */ |
1178 | } | 1159 | } |
@@ -1190,7 +1171,7 @@ static irqreturn_t netwave_interrupt(int irq, void* dev_id) | |||
1190 | */ | 1171 | */ |
1191 | static void netwave_watchdog(struct net_device *dev) { | 1172 | static void netwave_watchdog(struct net_device *dev) { |
1192 | 1173 | ||
1193 | DEBUG(1, "%s: netwave_watchdog: watchdog timer expired\n", dev->name); | 1174 | pr_debug("%s: netwave_watchdog: watchdog timer expired\n", dev->name); |
1194 | netwave_reset(dev); | 1175 | netwave_reset(dev); |
1195 | dev->trans_start = jiffies; | 1176 | dev->trans_start = jiffies; |
1196 | netif_wake_queue(dev); | 1177 | netif_wake_queue(dev); |
@@ -1211,7 +1192,7 @@ static int netwave_rx(struct net_device *dev) | |||
1211 | int i; | 1192 | int i; |
1212 | u_char *ptr; | 1193 | u_char *ptr; |
1213 | 1194 | ||
1214 | DEBUG(3, "xinw_rx: Receiving ... \n"); | 1195 | pr_debug("xinw_rx: Receiving ... \n"); |
1215 | 1196 | ||
1216 | /* Receive max 10 packets for now. */ | 1197 | /* Receive max 10 packets for now. */ |
1217 | for (i = 0; i < 10; i++) { | 1198 | for (i = 0; i < 10; i++) { |
@@ -1237,7 +1218,7 @@ static int netwave_rx(struct net_device *dev) | |||
1237 | 1218 | ||
1238 | skb = dev_alloc_skb(rcvLen+5); | 1219 | skb = dev_alloc_skb(rcvLen+5); |
1239 | if (skb == NULL) { | 1220 | if (skb == NULL) { |
1240 | DEBUG(1, "netwave_rx: Could not allocate an sk_buff of " | 1221 | pr_debug("netwave_rx: Could not allocate an sk_buff of " |
1241 | "length %d\n", rcvLen); | 1222 | "length %d\n", rcvLen); |
1242 | ++dev->stats.rx_dropped; | 1223 | ++dev->stats.rx_dropped; |
1243 | /* Tell the adapter to skip the packet */ | 1224 | /* Tell the adapter to skip the packet */ |
@@ -1279,7 +1260,7 @@ static int netwave_rx(struct net_device *dev) | |||
1279 | wait_WOC(iobase); | 1260 | wait_WOC(iobase); |
1280 | writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0); | 1261 | writeb(NETWAVE_CMD_SRP, ramBase + NETWAVE_EREG_CB + 0); |
1281 | writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1); | 1262 | writeb(NETWAVE_CMD_EOC, ramBase + NETWAVE_EREG_CB + 1); |
1282 | DEBUG(3, "Packet reception ok\n"); | 1263 | pr_debug("Packet reception ok\n"); |
1283 | } | 1264 | } |
1284 | return 0; | 1265 | return 0; |
1285 | } | 1266 | } |
@@ -1288,7 +1269,7 @@ static int netwave_open(struct net_device *dev) { | |||
1288 | netwave_private *priv = netdev_priv(dev); | 1269 | netwave_private *priv = netdev_priv(dev); |
1289 | struct pcmcia_device *link = priv->p_dev; | 1270 | struct pcmcia_device *link = priv->p_dev; |
1290 | 1271 | ||
1291 | DEBUG(1, "netwave_open: starting.\n"); | 1272 | dev_dbg(&link->dev, "netwave_open: starting.\n"); |
1292 | 1273 | ||
1293 | if (!pcmcia_dev_present(link)) | 1274 | if (!pcmcia_dev_present(link)) |
1294 | return -ENODEV; | 1275 | return -ENODEV; |
@@ -1305,7 +1286,7 @@ static int netwave_close(struct net_device *dev) { | |||
1305 | netwave_private *priv = netdev_priv(dev); | 1286 | netwave_private *priv = netdev_priv(dev); |
1306 | struct pcmcia_device *link = priv->p_dev; | 1287 | struct pcmcia_device *link = priv->p_dev; |
1307 | 1288 | ||
1308 | DEBUG(1, "netwave_close: finishing.\n"); | 1289 | dev_dbg(&link->dev, "netwave_close: finishing.\n"); |
1309 | 1290 | ||
1310 | link->open--; | 1291 | link->open--; |
1311 | netif_stop_queue(dev); | 1292 | netif_stop_queue(dev); |
@@ -1358,11 +1339,11 @@ static void set_multicast_list(struct net_device *dev) | |||
1358 | u_char rcvMode = 0; | 1339 | u_char rcvMode = 0; |
1359 | 1340 | ||
1360 | #ifdef PCMCIA_DEBUG | 1341 | #ifdef PCMCIA_DEBUG |
1361 | if (pc_debug > 2) { | 1342 | { |
1362 | static int old; | 1343 | xstatic int old; |
1363 | if (old != dev->mc_count) { | 1344 | if (old != dev->mc_count) { |
1364 | old = dev->mc_count; | 1345 | old = dev->mc_count; |
1365 | DEBUG(0, "%s: setting Rx mode to %d addresses.\n", | 1346 | pr_debug("%s: setting Rx mode to %d addresses.\n", |
1366 | dev->name, dev->mc_count); | 1347 | dev->name, dev->mc_count); |
1367 | } | 1348 | } |
1368 | } | 1349 | } |
diff --git a/drivers/net/wireless/orinoco/orinoco_cs.c b/drivers/net/wireless/orinoco/orinoco_cs.c index 38c1c9d2abb8..f27bb8367c98 100644 --- a/drivers/net/wireless/orinoco/orinoco_cs.c +++ b/drivers/net/wireless/orinoco/orinoco_cs.c | |||
@@ -109,7 +109,7 @@ orinoco_cs_probe(struct pcmcia_device *link) | |||
109 | struct orinoco_private *priv; | 109 | struct orinoco_private *priv; |
110 | struct orinoco_pccard *card; | 110 | struct orinoco_pccard *card; |
111 | 111 | ||
112 | priv = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), | 112 | priv = alloc_orinocodev(sizeof(*card), &link->dev, |
113 | orinoco_cs_hard_reset, NULL); | 113 | orinoco_cs_hard_reset, NULL); |
114 | if (!priv) | 114 | if (!priv) |
115 | return -ENOMEM; | 115 | return -ENOMEM; |
@@ -120,10 +120,8 @@ orinoco_cs_probe(struct pcmcia_device *link) | |||
120 | link->priv = priv; | 120 | link->priv = priv; |
121 | 121 | ||
122 | /* Interrupt setup */ | 122 | /* Interrupt setup */ |
123 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 123 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
124 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
125 | link->irq.Handler = orinoco_interrupt; | 124 | link->irq.Handler = orinoco_interrupt; |
126 | link->irq.Instance = priv; | ||
127 | 125 | ||
128 | /* General socket configuration defaults can go here. In this | 126 | /* General socket configuration defaults can go here. In this |
129 | * client, we assume very little, and rely on the CIS for | 127 | * client, we assume very little, and rely on the CIS for |
@@ -160,12 +158,6 @@ static void orinoco_cs_detach(struct pcmcia_device *link) | |||
160 | * device available to the system. | 158 | * device available to the system. |
161 | */ | 159 | */ |
162 | 160 | ||
163 | #define CS_CHECK(fn, ret) do { \ | ||
164 | last_fn = (fn); \ | ||
165 | if ((last_ret = (ret)) != 0) \ | ||
166 | goto cs_failed; \ | ||
167 | } while (0) | ||
168 | |||
169 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, | 161 | static int orinoco_cs_config_check(struct pcmcia_device *p_dev, |
170 | cistpl_cftable_entry_t *cfg, | 162 | cistpl_cftable_entry_t *cfg, |
171 | cistpl_cftable_entry_t *dflt, | 163 | cistpl_cftable_entry_t *dflt, |
@@ -240,7 +232,7 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
240 | struct orinoco_private *priv = link->priv; | 232 | struct orinoco_private *priv = link->priv; |
241 | struct orinoco_pccard *card = priv->card; | 233 | struct orinoco_pccard *card = priv->card; |
242 | hermes_t *hw = &priv->hw; | 234 | hermes_t *hw = &priv->hw; |
243 | int last_fn, last_ret; | 235 | int ret; |
244 | void __iomem *mem; | 236 | void __iomem *mem; |
245 | 237 | ||
246 | /* | 238 | /* |
@@ -257,13 +249,12 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
257 | * and most client drivers will only use the CIS to fill in | 249 | * and most client drivers will only use the CIS to fill in |
258 | * implementation-defined details. | 250 | * implementation-defined details. |
259 | */ | 251 | */ |
260 | last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); | 252 | ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); |
261 | if (last_ret) { | 253 | if (ret) { |
262 | if (!ignore_cis_vcc) | 254 | if (!ignore_cis_vcc) |
263 | printk(KERN_ERR PFX "GetNextTuple(): No matching " | 255 | printk(KERN_ERR PFX "GetNextTuple(): No matching " |
264 | "CIS configuration. Maybe you need the " | 256 | "CIS configuration. Maybe you need the " |
265 | "ignore_cis_vcc=1 parameter.\n"); | 257 | "ignore_cis_vcc=1 parameter.\n"); |
266 | cs_error(link, RequestIO, last_ret); | ||
267 | goto failed; | 258 | goto failed; |
268 | } | 259 | } |
269 | 260 | ||
@@ -272,14 +263,16 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
272 | * a handler to the interrupt, unless the 'Handler' member of | 263 | * a handler to the interrupt, unless the 'Handler' member of |
273 | * the irq structure is initialized. | 264 | * the irq structure is initialized. |
274 | */ | 265 | */ |
275 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 266 | ret = pcmcia_request_irq(link, &link->irq); |
267 | if (ret) | ||
268 | goto failed; | ||
276 | 269 | ||
277 | /* We initialize the hermes structure before completing PCMCIA | 270 | /* We initialize the hermes structure before completing PCMCIA |
278 | * configuration just in case the interrupt handler gets | 271 | * configuration just in case the interrupt handler gets |
279 | * called. */ | 272 | * called. */ |
280 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); | 273 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); |
281 | if (!mem) | 274 | if (!mem) |
282 | goto cs_failed; | 275 | goto failed; |
283 | 276 | ||
284 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 277 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
285 | 278 | ||
@@ -288,8 +281,9 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
288 | * the I/O windows and the interrupt mapping, and putting the | 281 | * the I/O windows and the interrupt mapping, and putting the |
289 | * card and host interface into "Memory and IO" mode. | 282 | * card and host interface into "Memory and IO" mode. |
290 | */ | 283 | */ |
291 | CS_CHECK(RequestConfiguration, | 284 | ret = pcmcia_request_configuration(link, &link->conf); |
292 | pcmcia_request_configuration(link, &link->conf)); | 285 | if (ret) |
286 | goto failed; | ||
293 | 287 | ||
294 | /* Ok, we have the configuration, prepare to register the netdev */ | 288 | /* Ok, we have the configuration, prepare to register the netdev */ |
295 | card->node.major = card->node.minor = 0; | 289 | card->node.major = card->node.minor = 0; |
@@ -315,9 +309,6 @@ orinoco_cs_config(struct pcmcia_device *link) | |||
315 | * net_device has been registered */ | 309 | * net_device has been registered */ |
316 | return 0; | 310 | return 0; |
317 | 311 | ||
318 | cs_failed: | ||
319 | cs_error(link, last_fn, last_ret); | ||
320 | |||
321 | failed: | 312 | failed: |
322 | orinoco_cs_release(link); | 313 | orinoco_cs_release(link); |
323 | return -ENODEV; | 314 | return -ENODEV; |
diff --git a/drivers/net/wireless/orinoco/spectrum_cs.c b/drivers/net/wireless/orinoco/spectrum_cs.c index c361310b885d..59bda240fdc2 100644 --- a/drivers/net/wireless/orinoco/spectrum_cs.c +++ b/drivers/net/wireless/orinoco/spectrum_cs.c | |||
@@ -73,9 +73,6 @@ static void spectrum_cs_release(struct pcmcia_device *link); | |||
73 | #define HCR_MEM16 0x10 /* memory width bit, should be preserved */ | 73 | #define HCR_MEM16 0x10 /* memory width bit, should be preserved */ |
74 | 74 | ||
75 | 75 | ||
76 | #define CS_CHECK(fn, ret) \ | ||
77 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
78 | |||
79 | /* | 76 | /* |
80 | * Reset the card using configuration registers COR and CCSR. | 77 | * Reset the card using configuration registers COR and CCSR. |
81 | * If IDLE is 1, stop the firmware, so that it can be safely rewritten. | 78 | * If IDLE is 1, stop the firmware, so that it can be safely rewritten. |
@@ -83,7 +80,7 @@ static void spectrum_cs_release(struct pcmcia_device *link); | |||
83 | static int | 80 | static int |
84 | spectrum_reset(struct pcmcia_device *link, int idle) | 81 | spectrum_reset(struct pcmcia_device *link, int idle) |
85 | { | 82 | { |
86 | int last_ret, last_fn; | 83 | int ret; |
87 | conf_reg_t reg; | 84 | conf_reg_t reg; |
88 | u_int save_cor; | 85 | u_int save_cor; |
89 | 86 | ||
@@ -95,23 +92,26 @@ spectrum_reset(struct pcmcia_device *link, int idle) | |||
95 | reg.Function = 0; | 92 | reg.Function = 0; |
96 | reg.Action = CS_READ; | 93 | reg.Action = CS_READ; |
97 | reg.Offset = CISREG_COR; | 94 | reg.Offset = CISREG_COR; |
98 | CS_CHECK(AccessConfigurationRegister, | 95 | ret = pcmcia_access_configuration_register(link, ®); |
99 | pcmcia_access_configuration_register(link, ®)); | 96 | if (ret) |
97 | goto failed; | ||
100 | save_cor = reg.Value; | 98 | save_cor = reg.Value; |
101 | 99 | ||
102 | /* Soft-Reset card */ | 100 | /* Soft-Reset card */ |
103 | reg.Action = CS_WRITE; | 101 | reg.Action = CS_WRITE; |
104 | reg.Offset = CISREG_COR; | 102 | reg.Offset = CISREG_COR; |
105 | reg.Value = (save_cor | COR_SOFT_RESET); | 103 | reg.Value = (save_cor | COR_SOFT_RESET); |
106 | CS_CHECK(AccessConfigurationRegister, | 104 | ret = pcmcia_access_configuration_register(link, ®); |
107 | pcmcia_access_configuration_register(link, ®)); | 105 | if (ret) |
106 | goto failed; | ||
108 | udelay(1000); | 107 | udelay(1000); |
109 | 108 | ||
110 | /* Read CCSR */ | 109 | /* Read CCSR */ |
111 | reg.Action = CS_READ; | 110 | reg.Action = CS_READ; |
112 | reg.Offset = CISREG_CCSR; | 111 | reg.Offset = CISREG_CCSR; |
113 | CS_CHECK(AccessConfigurationRegister, | 112 | ret = pcmcia_access_configuration_register(link, ®); |
114 | pcmcia_access_configuration_register(link, ®)); | 113 | if (ret) |
114 | goto failed; | ||
115 | 115 | ||
116 | /* | 116 | /* |
117 | * Start or stop the firmware. Memory width bit should be | 117 | * Start or stop the firmware. Memory width bit should be |
@@ -120,21 +120,22 @@ spectrum_reset(struct pcmcia_device *link, int idle) | |||
120 | reg.Action = CS_WRITE; | 120 | reg.Action = CS_WRITE; |
121 | reg.Offset = CISREG_CCSR; | 121 | reg.Offset = CISREG_CCSR; |
122 | reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); | 122 | reg.Value = (idle ? HCR_IDLE : HCR_RUN) | (reg.Value & HCR_MEM16); |
123 | CS_CHECK(AccessConfigurationRegister, | 123 | ret = pcmcia_access_configuration_register(link, ®); |
124 | pcmcia_access_configuration_register(link, ®)); | 124 | if (ret) |
125 | goto failed; | ||
125 | udelay(1000); | 126 | udelay(1000); |
126 | 127 | ||
127 | /* Restore original COR configuration index */ | 128 | /* Restore original COR configuration index */ |
128 | reg.Action = CS_WRITE; | 129 | reg.Action = CS_WRITE; |
129 | reg.Offset = CISREG_COR; | 130 | reg.Offset = CISREG_COR; |
130 | reg.Value = (save_cor & ~COR_SOFT_RESET); | 131 | reg.Value = (save_cor & ~COR_SOFT_RESET); |
131 | CS_CHECK(AccessConfigurationRegister, | 132 | ret = pcmcia_access_configuration_register(link, ®); |
132 | pcmcia_access_configuration_register(link, ®)); | 133 | if (ret) |
134 | goto failed; | ||
133 | udelay(1000); | 135 | udelay(1000); |
134 | return 0; | 136 | return 0; |
135 | 137 | ||
136 | cs_failed: | 138 | failed: |
137 | cs_error(link, last_fn, last_ret); | ||
138 | return -ENODEV; | 139 | return -ENODEV; |
139 | } | 140 | } |
140 | 141 | ||
@@ -181,7 +182,7 @@ spectrum_cs_probe(struct pcmcia_device *link) | |||
181 | struct orinoco_private *priv; | 182 | struct orinoco_private *priv; |
182 | struct orinoco_pccard *card; | 183 | struct orinoco_pccard *card; |
183 | 184 | ||
184 | priv = alloc_orinocodev(sizeof(*card), &handle_to_dev(link), | 185 | priv = alloc_orinocodev(sizeof(*card), &link->dev, |
185 | spectrum_cs_hard_reset, | 186 | spectrum_cs_hard_reset, |
186 | spectrum_cs_stop_firmware); | 187 | spectrum_cs_stop_firmware); |
187 | if (!priv) | 188 | if (!priv) |
@@ -193,10 +194,8 @@ spectrum_cs_probe(struct pcmcia_device *link) | |||
193 | link->priv = priv; | 194 | link->priv = priv; |
194 | 195 | ||
195 | /* Interrupt setup */ | 196 | /* Interrupt setup */ |
196 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 197 | link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
197 | link->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
198 | link->irq.Handler = orinoco_interrupt; | 198 | link->irq.Handler = orinoco_interrupt; |
199 | link->irq.Instance = priv; | ||
200 | 199 | ||
201 | /* General socket configuration defaults can go here. In this | 200 | /* General socket configuration defaults can go here. In this |
202 | * client, we assume very little, and rely on the CIS for | 201 | * client, we assume very little, and rely on the CIS for |
@@ -307,7 +306,7 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
307 | struct orinoco_private *priv = link->priv; | 306 | struct orinoco_private *priv = link->priv; |
308 | struct orinoco_pccard *card = priv->card; | 307 | struct orinoco_pccard *card = priv->card; |
309 | hermes_t *hw = &priv->hw; | 308 | hermes_t *hw = &priv->hw; |
310 | int last_fn, last_ret; | 309 | int ret; |
311 | void __iomem *mem; | 310 | void __iomem *mem; |
312 | 311 | ||
313 | /* | 312 | /* |
@@ -324,13 +323,12 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
324 | * and most client drivers will only use the CIS to fill in | 323 | * and most client drivers will only use the CIS to fill in |
325 | * implementation-defined details. | 324 | * implementation-defined details. |
326 | */ | 325 | */ |
327 | last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); | 326 | ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); |
328 | if (last_ret) { | 327 | if (ret) { |
329 | if (!ignore_cis_vcc) | 328 | if (!ignore_cis_vcc) |
330 | printk(KERN_ERR PFX "GetNextTuple(): No matching " | 329 | printk(KERN_ERR PFX "GetNextTuple(): No matching " |
331 | "CIS configuration. Maybe you need the " | 330 | "CIS configuration. Maybe you need the " |
332 | "ignore_cis_vcc=1 parameter.\n"); | 331 | "ignore_cis_vcc=1 parameter.\n"); |
333 | cs_error(link, RequestIO, last_ret); | ||
334 | goto failed; | 332 | goto failed; |
335 | } | 333 | } |
336 | 334 | ||
@@ -339,14 +337,16 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
339 | * a handler to the interrupt, unless the 'Handler' member of | 337 | * a handler to the interrupt, unless the 'Handler' member of |
340 | * the irq structure is initialized. | 338 | * the irq structure is initialized. |
341 | */ | 339 | */ |
342 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 340 | ret = pcmcia_request_irq(link, &link->irq); |
341 | if (ret) | ||
342 | goto failed; | ||
343 | 343 | ||
344 | /* We initialize the hermes structure before completing PCMCIA | 344 | /* We initialize the hermes structure before completing PCMCIA |
345 | * configuration just in case the interrupt handler gets | 345 | * configuration just in case the interrupt handler gets |
346 | * called. */ | 346 | * called. */ |
347 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); | 347 | mem = ioport_map(link->io.BasePort1, link->io.NumPorts1); |
348 | if (!mem) | 348 | if (!mem) |
349 | goto cs_failed; | 349 | goto failed; |
350 | 350 | ||
351 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); | 351 | hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING); |
352 | 352 | ||
@@ -355,8 +355,9 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
355 | * the I/O windows and the interrupt mapping, and putting the | 355 | * the I/O windows and the interrupt mapping, and putting the |
356 | * card and host interface into "Memory and IO" mode. | 356 | * card and host interface into "Memory and IO" mode. |
357 | */ | 357 | */ |
358 | CS_CHECK(RequestConfiguration, | 358 | ret = pcmcia_request_configuration(link, &link->conf); |
359 | pcmcia_request_configuration(link, &link->conf)); | 359 | if (ret) |
360 | goto failed; | ||
360 | 361 | ||
361 | /* Ok, we have the configuration, prepare to register the netdev */ | 362 | /* Ok, we have the configuration, prepare to register the netdev */ |
362 | card->node.major = card->node.minor = 0; | 363 | card->node.major = card->node.minor = 0; |
@@ -386,9 +387,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
386 | * net_device has been registered */ | 387 | * net_device has been registered */ |
387 | return 0; | 388 | return 0; |
388 | 389 | ||
389 | cs_failed: | ||
390 | cs_error(link, last_fn, last_ret); | ||
391 | |||
392 | failed: | 390 | failed: |
393 | spectrum_cs_release(link); | 391 | spectrum_cs_release(link); |
394 | return -ENODEV; | 392 | return -ENODEV; |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 1c88c2ea59aa..5b8e3e4cdd9f 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -71,25 +71,7 @@ typedef u_char mac_addr[ETH_ALEN]; /* Hardware address */ | |||
71 | #include "rayctl.h" | 71 | #include "rayctl.h" |
72 | #include "ray_cs.h" | 72 | #include "ray_cs.h" |
73 | 73 | ||
74 | /* All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If | ||
75 | you do not define PCMCIA_DEBUG at all, all the debug code will be | ||
76 | left out. If you compile with PCMCIA_DEBUG=0, the debug code will | ||
77 | be present but disabled -- but it can then be enabled for specific | ||
78 | modules at load time with a 'pc_debug=#' option to insmod. | ||
79 | */ | ||
80 | 74 | ||
81 | #ifdef RAYLINK_DEBUG | ||
82 | #define PCMCIA_DEBUG RAYLINK_DEBUG | ||
83 | #endif | ||
84 | #ifdef PCMCIA_DEBUG | ||
85 | static int ray_debug; | ||
86 | static int pc_debug = PCMCIA_DEBUG; | ||
87 | module_param(pc_debug, int, 0); | ||
88 | /* #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); */ | ||
89 | #define DEBUG(n, args...) if (pc_debug > (n)) printk(args); | ||
90 | #else | ||
91 | #define DEBUG(n, args...) | ||
92 | #endif | ||
93 | /** Prototypes based on PCMCIA skeleton driver *******************************/ | 75 | /** Prototypes based on PCMCIA skeleton driver *******************************/ |
94 | static int ray_config(struct pcmcia_device *link); | 76 | static int ray_config(struct pcmcia_device *link); |
95 | static void ray_release(struct pcmcia_device *link); | 77 | static void ray_release(struct pcmcia_device *link); |
@@ -325,7 +307,7 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
325 | ray_dev_t *local; | 307 | ray_dev_t *local; |
326 | struct net_device *dev; | 308 | struct net_device *dev; |
327 | 309 | ||
328 | DEBUG(1, "ray_attach()\n"); | 310 | dev_dbg(&p_dev->dev, "ray_attach()\n"); |
329 | 311 | ||
330 | /* Allocate space for private device-specific data */ | 312 | /* Allocate space for private device-specific data */ |
331 | dev = alloc_etherdev(sizeof(ray_dev_t)); | 313 | dev = alloc_etherdev(sizeof(ray_dev_t)); |
@@ -341,8 +323,7 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
341 | p_dev->io.IOAddrLines = 5; | 323 | p_dev->io.IOAddrLines = 5; |
342 | 324 | ||
343 | /* Interrupt setup. For PCMCIA, driver takes what's given */ | 325 | /* Interrupt setup. For PCMCIA, driver takes what's given */ |
344 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 326 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
345 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
346 | p_dev->irq.Handler = &ray_interrupt; | 327 | p_dev->irq.Handler = &ray_interrupt; |
347 | 328 | ||
348 | /* General socket configuration */ | 329 | /* General socket configuration */ |
@@ -351,13 +332,12 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
351 | p_dev->conf.ConfigIndex = 1; | 332 | p_dev->conf.ConfigIndex = 1; |
352 | 333 | ||
353 | p_dev->priv = dev; | 334 | p_dev->priv = dev; |
354 | p_dev->irq.Instance = dev; | ||
355 | 335 | ||
356 | local->finder = p_dev; | 336 | local->finder = p_dev; |
357 | local->card_status = CARD_INSERTED; | 337 | local->card_status = CARD_INSERTED; |
358 | local->authentication_state = UNAUTHENTICATED; | 338 | local->authentication_state = UNAUTHENTICATED; |
359 | local->num_multi = 0; | 339 | local->num_multi = 0; |
360 | DEBUG(2, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", | 340 | dev_dbg(&p_dev->dev, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", |
361 | p_dev, dev, local, &ray_interrupt); | 341 | p_dev, dev, local, &ray_interrupt); |
362 | 342 | ||
363 | /* Raylink entries in the device structure */ | 343 | /* Raylink entries in the device structure */ |
@@ -370,7 +350,7 @@ static int ray_probe(struct pcmcia_device *p_dev) | |||
370 | #endif /* WIRELESS_SPY */ | 350 | #endif /* WIRELESS_SPY */ |
371 | 351 | ||
372 | 352 | ||
373 | DEBUG(2, "ray_cs ray_attach calling ether_setup.)\n"); | 353 | dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n"); |
374 | netif_stop_queue(dev); | 354 | netif_stop_queue(dev); |
375 | 355 | ||
376 | init_timer(&local->timer); | 356 | init_timer(&local->timer); |
@@ -393,7 +373,7 @@ static void ray_detach(struct pcmcia_device *link) | |||
393 | struct net_device *dev; | 373 | struct net_device *dev; |
394 | ray_dev_t *local; | 374 | ray_dev_t *local; |
395 | 375 | ||
396 | DEBUG(1, "ray_detach(0x%p)\n", link); | 376 | dev_dbg(&link->dev, "ray_detach\n"); |
397 | 377 | ||
398 | this_device = NULL; | 378 | this_device = NULL; |
399 | dev = link->priv; | 379 | dev = link->priv; |
@@ -408,7 +388,7 @@ static void ray_detach(struct pcmcia_device *link) | |||
408 | unregister_netdev(dev); | 388 | unregister_netdev(dev); |
409 | free_netdev(dev); | 389 | free_netdev(dev); |
410 | } | 390 | } |
411 | DEBUG(2, "ray_cs ray_detach ending\n"); | 391 | dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); |
412 | } /* ray_detach */ | 392 | } /* ray_detach */ |
413 | 393 | ||
414 | /*============================================================================= | 394 | /*============================================================================= |
@@ -416,19 +396,17 @@ static void ray_detach(struct pcmcia_device *link) | |||
416 | is received, to configure the PCMCIA socket, and to make the | 396 | is received, to configure the PCMCIA socket, and to make the |
417 | ethernet device available to the system. | 397 | ethernet device available to the system. |
418 | =============================================================================*/ | 398 | =============================================================================*/ |
419 | #define CS_CHECK(fn, ret) \ | ||
420 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
421 | #define MAX_TUPLE_SIZE 128 | 399 | #define MAX_TUPLE_SIZE 128 |
422 | static int ray_config(struct pcmcia_device *link) | 400 | static int ray_config(struct pcmcia_device *link) |
423 | { | 401 | { |
424 | int last_fn = 0, last_ret = 0; | 402 | int ret = 0; |
425 | int i; | 403 | int i; |
426 | win_req_t req; | 404 | win_req_t req; |
427 | memreq_t mem; | 405 | memreq_t mem; |
428 | struct net_device *dev = (struct net_device *)link->priv; | 406 | struct net_device *dev = (struct net_device *)link->priv; |
429 | ray_dev_t *local = netdev_priv(dev); | 407 | ray_dev_t *local = netdev_priv(dev); |
430 | 408 | ||
431 | DEBUG(1, "ray_config(0x%p)\n", link); | 409 | dev_dbg(&link->dev, "ray_config\n"); |
432 | 410 | ||
433 | /* Determine card type and firmware version */ | 411 | /* Determine card type and firmware version */ |
434 | printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n", | 412 | printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n", |
@@ -440,14 +418,17 @@ static int ray_config(struct pcmcia_device *link) | |||
440 | /* Now allocate an interrupt line. Note that this does not | 418 | /* Now allocate an interrupt line. Note that this does not |
441 | actually assign a handler to the interrupt. | 419 | actually assign a handler to the interrupt. |
442 | */ | 420 | */ |
443 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 421 | ret = pcmcia_request_irq(link, &link->irq); |
422 | if (ret) | ||
423 | goto failed; | ||
444 | dev->irq = link->irq.AssignedIRQ; | 424 | dev->irq = link->irq.AssignedIRQ; |
445 | 425 | ||
446 | /* This actually configures the PCMCIA socket -- setting up | 426 | /* This actually configures the PCMCIA socket -- setting up |
447 | the I/O windows and the interrupt mapping. | 427 | the I/O windows and the interrupt mapping. |
448 | */ | 428 | */ |
449 | CS_CHECK(RequestConfiguration, | 429 | ret = pcmcia_request_configuration(link, &link->conf); |
450 | pcmcia_request_configuration(link, &link->conf)); | 430 | if (ret) |
431 | goto failed; | ||
451 | 432 | ||
452 | /*** Set up 32k window for shared memory (transmit and control) ************/ | 433 | /*** Set up 32k window for shared memory (transmit and control) ************/ |
453 | req.Attributes = | 434 | req.Attributes = |
@@ -455,10 +436,14 @@ static int ray_config(struct pcmcia_device *link) | |||
455 | req.Base = 0; | 436 | req.Base = 0; |
456 | req.Size = 0x8000; | 437 | req.Size = 0x8000; |
457 | req.AccessSpeed = ray_mem_speed; | 438 | req.AccessSpeed = ray_mem_speed; |
458 | CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); | 439 | ret = pcmcia_request_window(link, &req, &link->win); |
440 | if (ret) | ||
441 | goto failed; | ||
459 | mem.CardOffset = 0x0000; | 442 | mem.CardOffset = 0x0000; |
460 | mem.Page = 0; | 443 | mem.Page = 0; |
461 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); | 444 | ret = pcmcia_map_mem_page(link, link->win, &mem); |
445 | if (ret) | ||
446 | goto failed; | ||
462 | local->sram = ioremap(req.Base, req.Size); | 447 | local->sram = ioremap(req.Base, req.Size); |
463 | 448 | ||
464 | /*** Set up 16k window for shared memory (receive buffer) ***************/ | 449 | /*** Set up 16k window for shared memory (receive buffer) ***************/ |
@@ -467,11 +452,14 @@ static int ray_config(struct pcmcia_device *link) | |||
467 | req.Base = 0; | 452 | req.Base = 0; |
468 | req.Size = 0x4000; | 453 | req.Size = 0x4000; |
469 | req.AccessSpeed = ray_mem_speed; | 454 | req.AccessSpeed = ray_mem_speed; |
470 | CS_CHECK(RequestWindow, | 455 | ret = pcmcia_request_window(link, &req, &local->rmem_handle); |
471 | pcmcia_request_window(&link, &req, &local->rmem_handle)); | 456 | if (ret) |
457 | goto failed; | ||
472 | mem.CardOffset = 0x8000; | 458 | mem.CardOffset = 0x8000; |
473 | mem.Page = 0; | 459 | mem.Page = 0; |
474 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->rmem_handle, &mem)); | 460 | ret = pcmcia_map_mem_page(link, local->rmem_handle, &mem); |
461 | if (ret) | ||
462 | goto failed; | ||
475 | local->rmem = ioremap(req.Base, req.Size); | 463 | local->rmem = ioremap(req.Base, req.Size); |
476 | 464 | ||
477 | /*** Set up window for attribute memory ***********************************/ | 465 | /*** Set up window for attribute memory ***********************************/ |
@@ -480,22 +468,25 @@ static int ray_config(struct pcmcia_device *link) | |||
480 | req.Base = 0; | 468 | req.Base = 0; |
481 | req.Size = 0x1000; | 469 | req.Size = 0x1000; |
482 | req.AccessSpeed = ray_mem_speed; | 470 | req.AccessSpeed = ray_mem_speed; |
483 | CS_CHECK(RequestWindow, | 471 | ret = pcmcia_request_window(link, &req, &local->amem_handle); |
484 | pcmcia_request_window(&link, &req, &local->amem_handle)); | 472 | if (ret) |
473 | goto failed; | ||
485 | mem.CardOffset = 0x0000; | 474 | mem.CardOffset = 0x0000; |
486 | mem.Page = 0; | 475 | mem.Page = 0; |
487 | CS_CHECK(MapMemPage, pcmcia_map_mem_page(local->amem_handle, &mem)); | 476 | ret = pcmcia_map_mem_page(link, local->amem_handle, &mem); |
477 | if (ret) | ||
478 | goto failed; | ||
488 | local->amem = ioremap(req.Base, req.Size); | 479 | local->amem = ioremap(req.Base, req.Size); |
489 | 480 | ||
490 | DEBUG(3, "ray_config sram=%p\n", local->sram); | 481 | dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); |
491 | DEBUG(3, "ray_config rmem=%p\n", local->rmem); | 482 | dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); |
492 | DEBUG(3, "ray_config amem=%p\n", local->amem); | 483 | dev_dbg(&link->dev, "ray_config amem=%p\n", local->amem); |
493 | if (ray_init(dev) < 0) { | 484 | if (ray_init(dev) < 0) { |
494 | ray_release(link); | 485 | ray_release(link); |
495 | return -ENODEV; | 486 | return -ENODEV; |
496 | } | 487 | } |
497 | 488 | ||
498 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 489 | SET_NETDEV_DEV(dev, &link->dev); |
499 | i = register_netdev(dev); | 490 | i = register_netdev(dev); |
500 | if (i != 0) { | 491 | if (i != 0) { |
501 | printk("ray_config register_netdev() failed\n"); | 492 | printk("ray_config register_netdev() failed\n"); |
@@ -511,9 +502,7 @@ static int ray_config(struct pcmcia_device *link) | |||
511 | 502 | ||
512 | return 0; | 503 | return 0; |
513 | 504 | ||
514 | cs_failed: | 505 | failed: |
515 | cs_error(link, last_fn, last_ret); | ||
516 | |||
517 | ray_release(link); | 506 | ray_release(link); |
518 | return -ENODEV; | 507 | return -ENODEV; |
519 | } /* ray_config */ | 508 | } /* ray_config */ |
@@ -543,9 +532,9 @@ static int ray_init(struct net_device *dev) | |||
543 | struct ccs __iomem *pccs; | 532 | struct ccs __iomem *pccs; |
544 | ray_dev_t *local = netdev_priv(dev); | 533 | ray_dev_t *local = netdev_priv(dev); |
545 | struct pcmcia_device *link = local->finder; | 534 | struct pcmcia_device *link = local->finder; |
546 | DEBUG(1, "ray_init(0x%p)\n", dev); | 535 | dev_dbg(&link->dev, "ray_init(0x%p)\n", dev); |
547 | if (!(pcmcia_dev_present(link))) { | 536 | if (!(pcmcia_dev_present(link))) { |
548 | DEBUG(0, "ray_init - device not present\n"); | 537 | dev_dbg(&link->dev, "ray_init - device not present\n"); |
549 | return -1; | 538 | return -1; |
550 | } | 539 | } |
551 | 540 | ||
@@ -567,13 +556,13 @@ static int ray_init(struct net_device *dev) | |||
567 | local->fw_ver = local->startup_res.firmware_version[0]; | 556 | local->fw_ver = local->startup_res.firmware_version[0]; |
568 | local->fw_bld = local->startup_res.firmware_version[1]; | 557 | local->fw_bld = local->startup_res.firmware_version[1]; |
569 | local->fw_var = local->startup_res.firmware_version[2]; | 558 | local->fw_var = local->startup_res.firmware_version[2]; |
570 | DEBUG(1, "ray_init firmware version %d.%d \n", local->fw_ver, | 559 | dev_dbg(&link->dev, "ray_init firmware version %d.%d \n", local->fw_ver, |
571 | local->fw_bld); | 560 | local->fw_bld); |
572 | 561 | ||
573 | local->tib_length = 0x20; | 562 | local->tib_length = 0x20; |
574 | if ((local->fw_ver == 5) && (local->fw_bld >= 30)) | 563 | if ((local->fw_ver == 5) && (local->fw_bld >= 30)) |
575 | local->tib_length = local->startup_res.tib_length; | 564 | local->tib_length = local->startup_res.tib_length; |
576 | DEBUG(2, "ray_init tib_length = 0x%02x\n", local->tib_length); | 565 | dev_dbg(&link->dev, "ray_init tib_length = 0x%02x\n", local->tib_length); |
577 | /* Initialize CCS's to buffer free state */ | 566 | /* Initialize CCS's to buffer free state */ |
578 | pccs = ccs_base(local); | 567 | pccs = ccs_base(local); |
579 | for (i = 0; i < NUMBER_OF_CCS; i++) { | 568 | for (i = 0; i < NUMBER_OF_CCS; i++) { |
@@ -592,7 +581,7 @@ static int ray_init(struct net_device *dev) | |||
592 | 581 | ||
593 | clear_interrupt(local); /* Clear any interrupt from the card */ | 582 | clear_interrupt(local); /* Clear any interrupt from the card */ |
594 | local->card_status = CARD_AWAITING_PARAM; | 583 | local->card_status = CARD_AWAITING_PARAM; |
595 | DEBUG(2, "ray_init ending\n"); | 584 | dev_dbg(&link->dev, "ray_init ending\n"); |
596 | return 0; | 585 | return 0; |
597 | } /* ray_init */ | 586 | } /* ray_init */ |
598 | 587 | ||
@@ -605,9 +594,9 @@ static int dl_startup_params(struct net_device *dev) | |||
605 | struct ccs __iomem *pccs; | 594 | struct ccs __iomem *pccs; |
606 | struct pcmcia_device *link = local->finder; | 595 | struct pcmcia_device *link = local->finder; |
607 | 596 | ||
608 | DEBUG(1, "dl_startup_params entered\n"); | 597 | dev_dbg(&link->dev, "dl_startup_params entered\n"); |
609 | if (!(pcmcia_dev_present(link))) { | 598 | if (!(pcmcia_dev_present(link))) { |
610 | DEBUG(2, "ray_cs dl_startup_params - device not present\n"); | 599 | dev_dbg(&link->dev, "ray_cs dl_startup_params - device not present\n"); |
611 | return -1; | 600 | return -1; |
612 | } | 601 | } |
613 | 602 | ||
@@ -625,7 +614,7 @@ static int dl_startup_params(struct net_device *dev) | |||
625 | local->dl_param_ccs = ccsindex; | 614 | local->dl_param_ccs = ccsindex; |
626 | pccs = ccs_base(local) + ccsindex; | 615 | pccs = ccs_base(local) + ccsindex; |
627 | writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd); | 616 | writeb(CCS_DOWNLOAD_STARTUP_PARAMS, &pccs->cmd); |
628 | DEBUG(2, "dl_startup_params start ccsindex = %d\n", | 617 | dev_dbg(&link->dev, "dl_startup_params start ccsindex = %d\n", |
629 | local->dl_param_ccs); | 618 | local->dl_param_ccs); |
630 | /* Interrupt the firmware to process the command */ | 619 | /* Interrupt the firmware to process the command */ |
631 | if (interrupt_ecf(local, ccsindex)) { | 620 | if (interrupt_ecf(local, ccsindex)) { |
@@ -641,7 +630,7 @@ static int dl_startup_params(struct net_device *dev) | |||
641 | local->timer.data = (long)local; | 630 | local->timer.data = (long)local; |
642 | local->timer.function = &verify_dl_startup; | 631 | local->timer.function = &verify_dl_startup; |
643 | add_timer(&local->timer); | 632 | add_timer(&local->timer); |
644 | DEBUG(2, | 633 | dev_dbg(&link->dev, |
645 | "ray_cs dl_startup_params started timer for verify_dl_startup\n"); | 634 | "ray_cs dl_startup_params started timer for verify_dl_startup\n"); |
646 | return 0; | 635 | return 0; |
647 | } /* dl_startup_params */ | 636 | } /* dl_startup_params */ |
@@ -717,11 +706,11 @@ static void verify_dl_startup(u_long data) | |||
717 | struct pcmcia_device *link = local->finder; | 706 | struct pcmcia_device *link = local->finder; |
718 | 707 | ||
719 | if (!(pcmcia_dev_present(link))) { | 708 | if (!(pcmcia_dev_present(link))) { |
720 | DEBUG(2, "ray_cs verify_dl_startup - device not present\n"); | 709 | dev_dbg(&link->dev, "ray_cs verify_dl_startup - device not present\n"); |
721 | return; | 710 | return; |
722 | } | 711 | } |
723 | #ifdef PCMCIA_DEBUG | 712 | #if 0 |
724 | if (pc_debug > 2) { | 713 | { |
725 | int i; | 714 | int i; |
726 | printk(KERN_DEBUG | 715 | printk(KERN_DEBUG |
727 | "verify_dl_startup parameters sent via ccs %d:\n", | 716 | "verify_dl_startup parameters sent via ccs %d:\n", |
@@ -760,7 +749,7 @@ static void start_net(u_long data) | |||
760 | int ccsindex; | 749 | int ccsindex; |
761 | struct pcmcia_device *link = local->finder; | 750 | struct pcmcia_device *link = local->finder; |
762 | if (!(pcmcia_dev_present(link))) { | 751 | if (!(pcmcia_dev_present(link))) { |
763 | DEBUG(2, "ray_cs start_net - device not present\n"); | 752 | dev_dbg(&link->dev, "ray_cs start_net - device not present\n"); |
764 | return; | 753 | return; |
765 | } | 754 | } |
766 | /* Fill in the CCS fields for the ECF */ | 755 | /* Fill in the CCS fields for the ECF */ |
@@ -771,7 +760,7 @@ static void start_net(u_long data) | |||
771 | writeb(0, &pccs->var.start_network.update_param); | 760 | writeb(0, &pccs->var.start_network.update_param); |
772 | /* Interrupt the firmware to process the command */ | 761 | /* Interrupt the firmware to process the command */ |
773 | if (interrupt_ecf(local, ccsindex)) { | 762 | if (interrupt_ecf(local, ccsindex)) { |
774 | DEBUG(1, "ray start net failed - card not ready for intr\n"); | 763 | dev_dbg(&link->dev, "ray start net failed - card not ready for intr\n"); |
775 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 764 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
776 | return; | 765 | return; |
777 | } | 766 | } |
@@ -790,7 +779,7 @@ static void join_net(u_long data) | |||
790 | struct pcmcia_device *link = local->finder; | 779 | struct pcmcia_device *link = local->finder; |
791 | 780 | ||
792 | if (!(pcmcia_dev_present(link))) { | 781 | if (!(pcmcia_dev_present(link))) { |
793 | DEBUG(2, "ray_cs join_net - device not present\n"); | 782 | dev_dbg(&link->dev, "ray_cs join_net - device not present\n"); |
794 | return; | 783 | return; |
795 | } | 784 | } |
796 | /* Fill in the CCS fields for the ECF */ | 785 | /* Fill in the CCS fields for the ECF */ |
@@ -802,7 +791,7 @@ static void join_net(u_long data) | |||
802 | writeb(0, &pccs->var.join_network.net_initiated); | 791 | writeb(0, &pccs->var.join_network.net_initiated); |
803 | /* Interrupt the firmware to process the command */ | 792 | /* Interrupt the firmware to process the command */ |
804 | if (interrupt_ecf(local, ccsindex)) { | 793 | if (interrupt_ecf(local, ccsindex)) { |
805 | DEBUG(1, "ray join net failed - card not ready for intr\n"); | 794 | dev_dbg(&link->dev, "ray join net failed - card not ready for intr\n"); |
806 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 795 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
807 | return; | 796 | return; |
808 | } | 797 | } |
@@ -821,7 +810,7 @@ static void ray_release(struct pcmcia_device *link) | |||
821 | ray_dev_t *local = netdev_priv(dev); | 810 | ray_dev_t *local = netdev_priv(dev); |
822 | int i; | 811 | int i; |
823 | 812 | ||
824 | DEBUG(1, "ray_release(0x%p)\n", link); | 813 | dev_dbg(&link->dev, "ray_release\n"); |
825 | 814 | ||
826 | del_timer(&local->timer); | 815 | del_timer(&local->timer); |
827 | 816 | ||
@@ -829,15 +818,15 @@ static void ray_release(struct pcmcia_device *link) | |||
829 | iounmap(local->rmem); | 818 | iounmap(local->rmem); |
830 | iounmap(local->amem); | 819 | iounmap(local->amem); |
831 | /* Do bother checking to see if these succeed or not */ | 820 | /* Do bother checking to see if these succeed or not */ |
832 | i = pcmcia_release_window(local->amem_handle); | 821 | i = pcmcia_release_window(link, local->amem_handle); |
833 | if (i != 0) | 822 | if (i != 0) |
834 | DEBUG(0, "ReleaseWindow(local->amem) ret = %x\n", i); | 823 | dev_dbg(&link->dev, "ReleaseWindow(local->amem) ret = %x\n", i); |
835 | i = pcmcia_release_window(local->rmem_handle); | 824 | i = pcmcia_release_window(link, local->rmem_handle); |
836 | if (i != 0) | 825 | if (i != 0) |
837 | DEBUG(0, "ReleaseWindow(local->rmem) ret = %x\n", i); | 826 | dev_dbg(&link->dev, "ReleaseWindow(local->rmem) ret = %x\n", i); |
838 | pcmcia_disable_device(link); | 827 | pcmcia_disable_device(link); |
839 | 828 | ||
840 | DEBUG(2, "ray_release ending\n"); | 829 | dev_dbg(&link->dev, "ray_release ending\n"); |
841 | } | 830 | } |
842 | 831 | ||
843 | static int ray_suspend(struct pcmcia_device *link) | 832 | static int ray_suspend(struct pcmcia_device *link) |
@@ -871,9 +860,9 @@ static int ray_dev_init(struct net_device *dev) | |||
871 | ray_dev_t *local = netdev_priv(dev); | 860 | ray_dev_t *local = netdev_priv(dev); |
872 | struct pcmcia_device *link = local->finder; | 861 | struct pcmcia_device *link = local->finder; |
873 | 862 | ||
874 | DEBUG(1, "ray_dev_init(dev=%p)\n", dev); | 863 | dev_dbg(&link->dev, "ray_dev_init(dev=%p)\n", dev); |
875 | if (!(pcmcia_dev_present(link))) { | 864 | if (!(pcmcia_dev_present(link))) { |
876 | DEBUG(2, "ray_dev_init - device not present\n"); | 865 | dev_dbg(&link->dev, "ray_dev_init - device not present\n"); |
877 | return -1; | 866 | return -1; |
878 | } | 867 | } |
879 | #ifdef RAY_IMMEDIATE_INIT | 868 | #ifdef RAY_IMMEDIATE_INIT |
@@ -887,7 +876,7 @@ static int ray_dev_init(struct net_device *dev) | |||
887 | /* Postpone the card init so that we can still configure the card, | 876 | /* Postpone the card init so that we can still configure the card, |
888 | * for example using the Wireless Extensions. The init will happen | 877 | * for example using the Wireless Extensions. The init will happen |
889 | * in ray_open() - Jean II */ | 878 | * in ray_open() - Jean II */ |
890 | DEBUG(1, | 879 | dev_dbg(&link->dev, |
891 | "ray_dev_init: postponing card init to ray_open() ; Status = %d\n", | 880 | "ray_dev_init: postponing card init to ray_open() ; Status = %d\n", |
892 | local->card_status); | 881 | local->card_status); |
893 | #endif /* RAY_IMMEDIATE_INIT */ | 882 | #endif /* RAY_IMMEDIATE_INIT */ |
@@ -896,7 +885,7 @@ static int ray_dev_init(struct net_device *dev) | |||
896 | memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN); | 885 | memcpy(dev->dev_addr, &local->sparm.b4.a_mac_addr, ADDRLEN); |
897 | memset(dev->broadcast, 0xff, ETH_ALEN); | 886 | memset(dev->broadcast, 0xff, ETH_ALEN); |
898 | 887 | ||
899 | DEBUG(2, "ray_dev_init ending\n"); | 888 | dev_dbg(&link->dev, "ray_dev_init ending\n"); |
900 | return 0; | 889 | return 0; |
901 | } | 890 | } |
902 | 891 | ||
@@ -906,9 +895,9 @@ static int ray_dev_config(struct net_device *dev, struct ifmap *map) | |||
906 | ray_dev_t *local = netdev_priv(dev); | 895 | ray_dev_t *local = netdev_priv(dev); |
907 | struct pcmcia_device *link = local->finder; | 896 | struct pcmcia_device *link = local->finder; |
908 | /* Dummy routine to satisfy device structure */ | 897 | /* Dummy routine to satisfy device structure */ |
909 | DEBUG(1, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map); | 898 | dev_dbg(&link->dev, "ray_dev_config(dev=%p,ifmap=%p)\n", dev, map); |
910 | if (!(pcmcia_dev_present(link))) { | 899 | if (!(pcmcia_dev_present(link))) { |
911 | DEBUG(2, "ray_dev_config - device not present\n"); | 900 | dev_dbg(&link->dev, "ray_dev_config - device not present\n"); |
912 | return -1; | 901 | return -1; |
913 | } | 902 | } |
914 | 903 | ||
@@ -924,14 +913,14 @@ static netdev_tx_t ray_dev_start_xmit(struct sk_buff *skb, | |||
924 | short length = skb->len; | 913 | short length = skb->len; |
925 | 914 | ||
926 | if (!pcmcia_dev_present(link)) { | 915 | if (!pcmcia_dev_present(link)) { |
927 | DEBUG(2, "ray_dev_start_xmit - device not present\n"); | 916 | dev_dbg(&link->dev, "ray_dev_start_xmit - device not present\n"); |
928 | dev_kfree_skb(skb); | 917 | dev_kfree_skb(skb); |
929 | return NETDEV_TX_OK; | 918 | return NETDEV_TX_OK; |
930 | } | 919 | } |
931 | 920 | ||
932 | DEBUG(3, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev); | 921 | dev_dbg(&link->dev, "ray_dev_start_xmit(skb=%p, dev=%p)\n", skb, dev); |
933 | if (local->authentication_state == NEED_TO_AUTH) { | 922 | if (local->authentication_state == NEED_TO_AUTH) { |
934 | DEBUG(0, "ray_cs Sending authentication request.\n"); | 923 | dev_dbg(&link->dev, "ray_cs Sending authentication request.\n"); |
935 | if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) { | 924 | if (!build_auth_frame(local, local->auth_id, OPEN_AUTH_REQUEST)) { |
936 | local->authentication_state = AUTHENTICATED; | 925 | local->authentication_state = AUTHENTICATED; |
937 | netif_stop_queue(dev); | 926 | netif_stop_queue(dev); |
@@ -971,7 +960,7 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev, | |||
971 | struct tx_msg __iomem *ptx; /* Address of xmit buffer in PC space */ | 960 | struct tx_msg __iomem *ptx; /* Address of xmit buffer in PC space */ |
972 | short int addr; /* Address of xmit buffer in card space */ | 961 | short int addr; /* Address of xmit buffer in card space */ |
973 | 962 | ||
974 | DEBUG(3, "ray_hw_xmit(data=%p, len=%d, dev=%p)\n", data, len, dev); | 963 | pr_debug("ray_hw_xmit(data=%p, len=%d, dev=%p)\n", data, len, dev); |
975 | if (len + TX_HEADER_LENGTH > TX_BUF_SIZE) { | 964 | if (len + TX_HEADER_LENGTH > TX_BUF_SIZE) { |
976 | printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n", | 965 | printk(KERN_INFO "ray_hw_xmit packet too large: %d bytes\n", |
977 | len); | 966 | len); |
@@ -979,9 +968,9 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev, | |||
979 | } | 968 | } |
980 | switch (ccsindex = get_free_tx_ccs(local)) { | 969 | switch (ccsindex = get_free_tx_ccs(local)) { |
981 | case ECCSBUSY: | 970 | case ECCSBUSY: |
982 | DEBUG(2, "ray_hw_xmit tx_ccs table busy\n"); | 971 | pr_debug("ray_hw_xmit tx_ccs table busy\n"); |
983 | case ECCSFULL: | 972 | case ECCSFULL: |
984 | DEBUG(2, "ray_hw_xmit No free tx ccs\n"); | 973 | pr_debug("ray_hw_xmit No free tx ccs\n"); |
985 | case ECARDGONE: | 974 | case ECARDGONE: |
986 | netif_stop_queue(dev); | 975 | netif_stop_queue(dev); |
987 | return XMIT_NO_CCS; | 976 | return XMIT_NO_CCS; |
@@ -1018,12 +1007,12 @@ static int ray_hw_xmit(unsigned char *data, int len, struct net_device *dev, | |||
1018 | writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode); | 1007 | writeb(PSM_CAM, &pccs->var.tx_request.pow_sav_mode); |
1019 | writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate); | 1008 | writeb(local->net_default_tx_rate, &pccs->var.tx_request.tx_rate); |
1020 | writeb(0, &pccs->var.tx_request.antenna); | 1009 | writeb(0, &pccs->var.tx_request.antenna); |
1021 | DEBUG(3, "ray_hw_xmit default_tx_rate = 0x%x\n", | 1010 | pr_debug("ray_hw_xmit default_tx_rate = 0x%x\n", |
1022 | local->net_default_tx_rate); | 1011 | local->net_default_tx_rate); |
1023 | 1012 | ||
1024 | /* Interrupt the firmware to process the command */ | 1013 | /* Interrupt the firmware to process the command */ |
1025 | if (interrupt_ecf(local, ccsindex)) { | 1014 | if (interrupt_ecf(local, ccsindex)) { |
1026 | DEBUG(2, "ray_hw_xmit failed - ECF not ready for intr\n"); | 1015 | pr_debug("ray_hw_xmit failed - ECF not ready for intr\n"); |
1027 | /* TBD very inefficient to copy packet to buffer, and then not | 1016 | /* TBD very inefficient to copy packet to buffer, and then not |
1028 | send it, but the alternative is to queue the messages and that | 1017 | send it, but the alternative is to queue the messages and that |
1029 | won't be done for a while. Maybe set tbusy until a CCS is free? | 1018 | won't be done for a while. Maybe set tbusy until a CCS is free? |
@@ -1040,7 +1029,7 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, | |||
1040 | { | 1029 | { |
1041 | __be16 proto = ((struct ethhdr *)data)->h_proto; | 1030 | __be16 proto = ((struct ethhdr *)data)->h_proto; |
1042 | if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */ | 1031 | if (ntohs(proto) >= 1536) { /* DIX II ethernet frame */ |
1043 | DEBUG(3, "ray_cs translate_frame DIX II\n"); | 1032 | pr_debug("ray_cs translate_frame DIX II\n"); |
1044 | /* Copy LLC header to card buffer */ | 1033 | /* Copy LLC header to card buffer */ |
1045 | memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); | 1034 | memcpy_toio(&ptx->var, eth2_llc, sizeof(eth2_llc)); |
1046 | memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc), | 1035 | memcpy_toio(((void __iomem *)&ptx->var) + sizeof(eth2_llc), |
@@ -1056,9 +1045,9 @@ static int translate_frame(ray_dev_t *local, struct tx_msg __iomem *ptx, | |||
1056 | len - ETH_HLEN); | 1045 | len - ETH_HLEN); |
1057 | return (int)sizeof(struct snaphdr_t) - ETH_HLEN; | 1046 | return (int)sizeof(struct snaphdr_t) - ETH_HLEN; |
1058 | } else { /* already 802 type, and proto is length */ | 1047 | } else { /* already 802 type, and proto is length */ |
1059 | DEBUG(3, "ray_cs translate_frame 802\n"); | 1048 | pr_debug("ray_cs translate_frame 802\n"); |
1060 | if (proto == htons(0xffff)) { /* evil netware IPX 802.3 without LLC */ | 1049 | if (proto == htons(0xffff)) { /* evil netware IPX 802.3 without LLC */ |
1061 | DEBUG(3, "ray_cs translate_frame evil IPX\n"); | 1050 | pr_debug("ray_cs translate_frame evil IPX\n"); |
1062 | memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); | 1051 | memcpy_toio(&ptx->var, data + ETH_HLEN, len - ETH_HLEN); |
1063 | return 0 - ETH_HLEN; | 1052 | return 0 - ETH_HLEN; |
1064 | } | 1053 | } |
@@ -1603,7 +1592,7 @@ static int ray_open(struct net_device *dev) | |||
1603 | struct pcmcia_device *link; | 1592 | struct pcmcia_device *link; |
1604 | link = local->finder; | 1593 | link = local->finder; |
1605 | 1594 | ||
1606 | DEBUG(1, "ray_open('%s')\n", dev->name); | 1595 | dev_dbg(&link->dev, "ray_open('%s')\n", dev->name); |
1607 | 1596 | ||
1608 | if (link->open == 0) | 1597 | if (link->open == 0) |
1609 | local->num_multi = 0; | 1598 | local->num_multi = 0; |
@@ -1613,7 +1602,7 @@ static int ray_open(struct net_device *dev) | |||
1613 | if (local->card_status == CARD_AWAITING_PARAM) { | 1602 | if (local->card_status == CARD_AWAITING_PARAM) { |
1614 | int i; | 1603 | int i; |
1615 | 1604 | ||
1616 | DEBUG(1, "ray_open: doing init now !\n"); | 1605 | dev_dbg(&link->dev, "ray_open: doing init now !\n"); |
1617 | 1606 | ||
1618 | /* Download startup parameters */ | 1607 | /* Download startup parameters */ |
1619 | if ((i = dl_startup_params(dev)) < 0) { | 1608 | if ((i = dl_startup_params(dev)) < 0) { |
@@ -1629,7 +1618,7 @@ static int ray_open(struct net_device *dev) | |||
1629 | else | 1618 | else |
1630 | netif_start_queue(dev); | 1619 | netif_start_queue(dev); |
1631 | 1620 | ||
1632 | DEBUG(2, "ray_open ending\n"); | 1621 | dev_dbg(&link->dev, "ray_open ending\n"); |
1633 | return 0; | 1622 | return 0; |
1634 | } /* end ray_open */ | 1623 | } /* end ray_open */ |
1635 | 1624 | ||
@@ -1640,7 +1629,7 @@ static int ray_dev_close(struct net_device *dev) | |||
1640 | struct pcmcia_device *link; | 1629 | struct pcmcia_device *link; |
1641 | link = local->finder; | 1630 | link = local->finder; |
1642 | 1631 | ||
1643 | DEBUG(1, "ray_dev_close('%s')\n", dev->name); | 1632 | dev_dbg(&link->dev, "ray_dev_close('%s')\n", dev->name); |
1644 | 1633 | ||
1645 | link->open--; | 1634 | link->open--; |
1646 | netif_stop_queue(dev); | 1635 | netif_stop_queue(dev); |
@@ -1656,7 +1645,7 @@ static int ray_dev_close(struct net_device *dev) | |||
1656 | /*===========================================================================*/ | 1645 | /*===========================================================================*/ |
1657 | static void ray_reset(struct net_device *dev) | 1646 | static void ray_reset(struct net_device *dev) |
1658 | { | 1647 | { |
1659 | DEBUG(1, "ray_reset entered\n"); | 1648 | pr_debug("ray_reset entered\n"); |
1660 | return; | 1649 | return; |
1661 | } | 1650 | } |
1662 | 1651 | ||
@@ -1669,17 +1658,17 @@ static int interrupt_ecf(ray_dev_t *local, int ccs) | |||
1669 | struct pcmcia_device *link = local->finder; | 1658 | struct pcmcia_device *link = local->finder; |
1670 | 1659 | ||
1671 | if (!(pcmcia_dev_present(link))) { | 1660 | if (!(pcmcia_dev_present(link))) { |
1672 | DEBUG(2, "ray_cs interrupt_ecf - device not present\n"); | 1661 | dev_dbg(&link->dev, "ray_cs interrupt_ecf - device not present\n"); |
1673 | return -1; | 1662 | return -1; |
1674 | } | 1663 | } |
1675 | DEBUG(2, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs); | 1664 | dev_dbg(&link->dev, "interrupt_ecf(local=%p, ccs = 0x%x\n", local, ccs); |
1676 | 1665 | ||
1677 | while (i && | 1666 | while (i && |
1678 | (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & | 1667 | (readb(local->amem + CIS_OFFSET + ECF_INTR_OFFSET) & |
1679 | ECF_INTR_SET)) | 1668 | ECF_INTR_SET)) |
1680 | i--; | 1669 | i--; |
1681 | if (i == 0) { | 1670 | if (i == 0) { |
1682 | DEBUG(2, "ray_cs interrupt_ecf card not ready for interrupt\n"); | 1671 | dev_dbg(&link->dev, "ray_cs interrupt_ecf card not ready for interrupt\n"); |
1683 | return -1; | 1672 | return -1; |
1684 | } | 1673 | } |
1685 | /* Fill the mailbox, then kick the card */ | 1674 | /* Fill the mailbox, then kick the card */ |
@@ -1698,12 +1687,12 @@ static int get_free_tx_ccs(ray_dev_t *local) | |||
1698 | struct pcmcia_device *link = local->finder; | 1687 | struct pcmcia_device *link = local->finder; |
1699 | 1688 | ||
1700 | if (!(pcmcia_dev_present(link))) { | 1689 | if (!(pcmcia_dev_present(link))) { |
1701 | DEBUG(2, "ray_cs get_free_tx_ccs - device not present\n"); | 1690 | dev_dbg(&link->dev, "ray_cs get_free_tx_ccs - device not present\n"); |
1702 | return ECARDGONE; | 1691 | return ECARDGONE; |
1703 | } | 1692 | } |
1704 | 1693 | ||
1705 | if (test_and_set_bit(0, &local->tx_ccs_lock)) { | 1694 | if (test_and_set_bit(0, &local->tx_ccs_lock)) { |
1706 | DEBUG(1, "ray_cs tx_ccs_lock busy\n"); | 1695 | dev_dbg(&link->dev, "ray_cs tx_ccs_lock busy\n"); |
1707 | return ECCSBUSY; | 1696 | return ECCSBUSY; |
1708 | } | 1697 | } |
1709 | 1698 | ||
@@ -1716,7 +1705,7 @@ static int get_free_tx_ccs(ray_dev_t *local) | |||
1716 | } | 1705 | } |
1717 | } | 1706 | } |
1718 | local->tx_ccs_lock = 0; | 1707 | local->tx_ccs_lock = 0; |
1719 | DEBUG(2, "ray_cs ERROR no free tx CCS for raylink card\n"); | 1708 | dev_dbg(&link->dev, "ray_cs ERROR no free tx CCS for raylink card\n"); |
1720 | return ECCSFULL; | 1709 | return ECCSFULL; |
1721 | } /* get_free_tx_ccs */ | 1710 | } /* get_free_tx_ccs */ |
1722 | 1711 | ||
@@ -1730,11 +1719,11 @@ static int get_free_ccs(ray_dev_t *local) | |||
1730 | struct pcmcia_device *link = local->finder; | 1719 | struct pcmcia_device *link = local->finder; |
1731 | 1720 | ||
1732 | if (!(pcmcia_dev_present(link))) { | 1721 | if (!(pcmcia_dev_present(link))) { |
1733 | DEBUG(2, "ray_cs get_free_ccs - device not present\n"); | 1722 | dev_dbg(&link->dev, "ray_cs get_free_ccs - device not present\n"); |
1734 | return ECARDGONE; | 1723 | return ECARDGONE; |
1735 | } | 1724 | } |
1736 | if (test_and_set_bit(0, &local->ccs_lock)) { | 1725 | if (test_and_set_bit(0, &local->ccs_lock)) { |
1737 | DEBUG(1, "ray_cs ccs_lock busy\n"); | 1726 | dev_dbg(&link->dev, "ray_cs ccs_lock busy\n"); |
1738 | return ECCSBUSY; | 1727 | return ECCSBUSY; |
1739 | } | 1728 | } |
1740 | 1729 | ||
@@ -1747,7 +1736,7 @@ static int get_free_ccs(ray_dev_t *local) | |||
1747 | } | 1736 | } |
1748 | } | 1737 | } |
1749 | local->ccs_lock = 0; | 1738 | local->ccs_lock = 0; |
1750 | DEBUG(1, "ray_cs ERROR no free CCS for raylink card\n"); | 1739 | dev_dbg(&link->dev, "ray_cs ERROR no free CCS for raylink card\n"); |
1751 | return ECCSFULL; | 1740 | return ECCSFULL; |
1752 | } /* get_free_ccs */ | 1741 | } /* get_free_ccs */ |
1753 | 1742 | ||
@@ -1823,7 +1812,7 @@ static struct net_device_stats *ray_get_stats(struct net_device *dev) | |||
1823 | struct pcmcia_device *link = local->finder; | 1812 | struct pcmcia_device *link = local->finder; |
1824 | struct status __iomem *p = local->sram + STATUS_BASE; | 1813 | struct status __iomem *p = local->sram + STATUS_BASE; |
1825 | if (!(pcmcia_dev_present(link))) { | 1814 | if (!(pcmcia_dev_present(link))) { |
1826 | DEBUG(2, "ray_cs net_device_stats - device not present\n"); | 1815 | dev_dbg(&link->dev, "ray_cs net_device_stats - device not present\n"); |
1827 | return &local->stats; | 1816 | return &local->stats; |
1828 | } | 1817 | } |
1829 | if (readb(&p->mrx_overflow_for_host)) { | 1818 | if (readb(&p->mrx_overflow_for_host)) { |
@@ -1856,12 +1845,12 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, | |||
1856 | struct ccs __iomem *pccs; | 1845 | struct ccs __iomem *pccs; |
1857 | 1846 | ||
1858 | if (!(pcmcia_dev_present(link))) { | 1847 | if (!(pcmcia_dev_present(link))) { |
1859 | DEBUG(2, "ray_update_parm - device not present\n"); | 1848 | dev_dbg(&link->dev, "ray_update_parm - device not present\n"); |
1860 | return; | 1849 | return; |
1861 | } | 1850 | } |
1862 | 1851 | ||
1863 | if ((ccsindex = get_free_ccs(local)) < 0) { | 1852 | if ((ccsindex = get_free_ccs(local)) < 0) { |
1864 | DEBUG(0, "ray_update_parm - No free ccs\n"); | 1853 | dev_dbg(&link->dev, "ray_update_parm - No free ccs\n"); |
1865 | return; | 1854 | return; |
1866 | } | 1855 | } |
1867 | pccs = ccs_base(local) + ccsindex; | 1856 | pccs = ccs_base(local) + ccsindex; |
@@ -1874,7 +1863,7 @@ static void ray_update_parm(struct net_device *dev, UCHAR objid, UCHAR *value, | |||
1874 | } | 1863 | } |
1875 | /* Interrupt the firmware to process the command */ | 1864 | /* Interrupt the firmware to process the command */ |
1876 | if (interrupt_ecf(local, ccsindex)) { | 1865 | if (interrupt_ecf(local, ccsindex)) { |
1877 | DEBUG(0, "ray_cs associate failed - ECF not ready for intr\n"); | 1866 | dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n"); |
1878 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 1867 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
1879 | } | 1868 | } |
1880 | } | 1869 | } |
@@ -1891,12 +1880,12 @@ static void ray_update_multi_list(struct net_device *dev, int all) | |||
1891 | void __iomem *p = local->sram + HOST_TO_ECF_BASE; | 1880 | void __iomem *p = local->sram + HOST_TO_ECF_BASE; |
1892 | 1881 | ||
1893 | if (!(pcmcia_dev_present(link))) { | 1882 | if (!(pcmcia_dev_present(link))) { |
1894 | DEBUG(2, "ray_update_multi_list - device not present\n"); | 1883 | dev_dbg(&link->dev, "ray_update_multi_list - device not present\n"); |
1895 | return; | 1884 | return; |
1896 | } else | 1885 | } else |
1897 | DEBUG(2, "ray_update_multi_list(%p)\n", dev); | 1886 | dev_dbg(&link->dev, "ray_update_multi_list(%p)\n", dev); |
1898 | if ((ccsindex = get_free_ccs(local)) < 0) { | 1887 | if ((ccsindex = get_free_ccs(local)) < 0) { |
1899 | DEBUG(1, "ray_update_multi - No free ccs\n"); | 1888 | dev_dbg(&link->dev, "ray_update_multi - No free ccs\n"); |
1900 | return; | 1889 | return; |
1901 | } | 1890 | } |
1902 | pccs = ccs_base(local) + ccsindex; | 1891 | pccs = ccs_base(local) + ccsindex; |
@@ -1910,7 +1899,7 @@ static void ray_update_multi_list(struct net_device *dev, int all) | |||
1910 | for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; | 1899 | for (dmip = &dev->mc_list; (dmi = *dmip) != NULL; |
1911 | dmip = &dmi->next) { | 1900 | dmip = &dmi->next) { |
1912 | memcpy_toio(p, dmi->dmi_addr, ETH_ALEN); | 1901 | memcpy_toio(p, dmi->dmi_addr, ETH_ALEN); |
1913 | DEBUG(1, | 1902 | dev_dbg(&link->dev, |
1914 | "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n", | 1903 | "ray_update_multi add addr %02x%02x%02x%02x%02x%02x\n", |
1915 | dmi->dmi_addr[0], dmi->dmi_addr[1], | 1904 | dmi->dmi_addr[0], dmi->dmi_addr[1], |
1916 | dmi->dmi_addr[2], dmi->dmi_addr[3], | 1905 | dmi->dmi_addr[2], dmi->dmi_addr[3], |
@@ -1921,12 +1910,12 @@ static void ray_update_multi_list(struct net_device *dev, int all) | |||
1921 | if (i > 256 / ADDRLEN) | 1910 | if (i > 256 / ADDRLEN) |
1922 | i = 256 / ADDRLEN; | 1911 | i = 256 / ADDRLEN; |
1923 | writeb((UCHAR) i, &pccs->var); | 1912 | writeb((UCHAR) i, &pccs->var); |
1924 | DEBUG(1, "ray_cs update_multi %d addresses in list\n", i); | 1913 | dev_dbg(&link->dev, "ray_cs update_multi %d addresses in list\n", i); |
1925 | /* Interrupt the firmware to process the command */ | 1914 | /* Interrupt the firmware to process the command */ |
1926 | local->num_multi = i; | 1915 | local->num_multi = i; |
1927 | } | 1916 | } |
1928 | if (interrupt_ecf(local, ccsindex)) { | 1917 | if (interrupt_ecf(local, ccsindex)) { |
1929 | DEBUG(1, | 1918 | dev_dbg(&link->dev, |
1930 | "ray_cs update_multi failed - ECF not ready for intr\n"); | 1919 | "ray_cs update_multi failed - ECF not ready for intr\n"); |
1931 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 1920 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
1932 | } | 1921 | } |
@@ -1938,11 +1927,11 @@ static void set_multicast_list(struct net_device *dev) | |||
1938 | ray_dev_t *local = netdev_priv(dev); | 1927 | ray_dev_t *local = netdev_priv(dev); |
1939 | UCHAR promisc; | 1928 | UCHAR promisc; |
1940 | 1929 | ||
1941 | DEBUG(2, "ray_cs set_multicast_list(%p)\n", dev); | 1930 | pr_debug("ray_cs set_multicast_list(%p)\n", dev); |
1942 | 1931 | ||
1943 | if (dev->flags & IFF_PROMISC) { | 1932 | if (dev->flags & IFF_PROMISC) { |
1944 | if (local->sparm.b5.a_promiscuous_mode == 0) { | 1933 | if (local->sparm.b5.a_promiscuous_mode == 0) { |
1945 | DEBUG(1, "ray_cs set_multicast_list promisc on\n"); | 1934 | pr_debug("ray_cs set_multicast_list promisc on\n"); |
1946 | local->sparm.b5.a_promiscuous_mode = 1; | 1935 | local->sparm.b5.a_promiscuous_mode = 1; |
1947 | promisc = 1; | 1936 | promisc = 1; |
1948 | ray_update_parm(dev, OBJID_promiscuous_mode, | 1937 | ray_update_parm(dev, OBJID_promiscuous_mode, |
@@ -1950,7 +1939,7 @@ static void set_multicast_list(struct net_device *dev) | |||
1950 | } | 1939 | } |
1951 | } else { | 1940 | } else { |
1952 | if (local->sparm.b5.a_promiscuous_mode == 1) { | 1941 | if (local->sparm.b5.a_promiscuous_mode == 1) { |
1953 | DEBUG(1, "ray_cs set_multicast_list promisc off\n"); | 1942 | pr_debug("ray_cs set_multicast_list promisc off\n"); |
1954 | local->sparm.b5.a_promiscuous_mode = 0; | 1943 | local->sparm.b5.a_promiscuous_mode = 0; |
1955 | promisc = 0; | 1944 | promisc = 0; |
1956 | ray_update_parm(dev, OBJID_promiscuous_mode, | 1945 | ray_update_parm(dev, OBJID_promiscuous_mode, |
@@ -1984,19 +1973,19 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
1984 | if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */ | 1973 | if (dev == NULL) /* Note that we want interrupts with dev->start == 0 */ |
1985 | return IRQ_NONE; | 1974 | return IRQ_NONE; |
1986 | 1975 | ||
1987 | DEBUG(4, "ray_cs: interrupt for *dev=%p\n", dev); | 1976 | pr_debug("ray_cs: interrupt for *dev=%p\n", dev); |
1988 | 1977 | ||
1989 | local = netdev_priv(dev); | 1978 | local = netdev_priv(dev); |
1990 | link = (struct pcmcia_device *)local->finder; | 1979 | link = (struct pcmcia_device *)local->finder; |
1991 | if (!pcmcia_dev_present(link)) { | 1980 | if (!pcmcia_dev_present(link)) { |
1992 | DEBUG(2, | 1981 | pr_debug( |
1993 | "ray_cs interrupt from device not present or suspended.\n"); | 1982 | "ray_cs interrupt from device not present or suspended.\n"); |
1994 | return IRQ_NONE; | 1983 | return IRQ_NONE; |
1995 | } | 1984 | } |
1996 | rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index); | 1985 | rcsindex = readb(&((struct scb __iomem *)(local->sram))->rcs_index); |
1997 | 1986 | ||
1998 | if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { | 1987 | if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { |
1999 | DEBUG(1, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex); | 1988 | dev_dbg(&link->dev, "ray_cs interrupt bad rcsindex = 0x%x\n", rcsindex); |
2000 | clear_interrupt(local); | 1989 | clear_interrupt(local); |
2001 | return IRQ_HANDLED; | 1990 | return IRQ_HANDLED; |
2002 | } | 1991 | } |
@@ -2008,33 +1997,33 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
2008 | case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */ | 1997 | case CCS_DOWNLOAD_STARTUP_PARAMS: /* Happens in firmware someday */ |
2009 | del_timer(&local->timer); | 1998 | del_timer(&local->timer); |
2010 | if (status == CCS_COMMAND_COMPLETE) { | 1999 | if (status == CCS_COMMAND_COMPLETE) { |
2011 | DEBUG(1, | 2000 | dev_dbg(&link->dev, |
2012 | "ray_cs interrupt download_startup_parameters OK\n"); | 2001 | "ray_cs interrupt download_startup_parameters OK\n"); |
2013 | } else { | 2002 | } else { |
2014 | DEBUG(1, | 2003 | dev_dbg(&link->dev, |
2015 | "ray_cs interrupt download_startup_parameters fail\n"); | 2004 | "ray_cs interrupt download_startup_parameters fail\n"); |
2016 | } | 2005 | } |
2017 | break; | 2006 | break; |
2018 | case CCS_UPDATE_PARAMS: | 2007 | case CCS_UPDATE_PARAMS: |
2019 | DEBUG(1, "ray_cs interrupt update params done\n"); | 2008 | dev_dbg(&link->dev, "ray_cs interrupt update params done\n"); |
2020 | if (status != CCS_COMMAND_COMPLETE) { | 2009 | if (status != CCS_COMMAND_COMPLETE) { |
2021 | tmp = | 2010 | tmp = |
2022 | readb(&pccs->var.update_param. | 2011 | readb(&pccs->var.update_param. |
2023 | failure_cause); | 2012 | failure_cause); |
2024 | DEBUG(0, | 2013 | dev_dbg(&link->dev, |
2025 | "ray_cs interrupt update params failed - reason %d\n", | 2014 | "ray_cs interrupt update params failed - reason %d\n", |
2026 | tmp); | 2015 | tmp); |
2027 | } | 2016 | } |
2028 | break; | 2017 | break; |
2029 | case CCS_REPORT_PARAMS: | 2018 | case CCS_REPORT_PARAMS: |
2030 | DEBUG(1, "ray_cs interrupt report params done\n"); | 2019 | dev_dbg(&link->dev, "ray_cs interrupt report params done\n"); |
2031 | break; | 2020 | break; |
2032 | case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */ | 2021 | case CCS_UPDATE_MULTICAST_LIST: /* Note that this CCS isn't returned */ |
2033 | DEBUG(1, | 2022 | dev_dbg(&link->dev, |
2034 | "ray_cs interrupt CCS Update Multicast List done\n"); | 2023 | "ray_cs interrupt CCS Update Multicast List done\n"); |
2035 | break; | 2024 | break; |
2036 | case CCS_UPDATE_POWER_SAVINGS_MODE: | 2025 | case CCS_UPDATE_POWER_SAVINGS_MODE: |
2037 | DEBUG(1, | 2026 | dev_dbg(&link->dev, |
2038 | "ray_cs interrupt update power save mode done\n"); | 2027 | "ray_cs interrupt update power save mode done\n"); |
2039 | break; | 2028 | break; |
2040 | case CCS_START_NETWORK: | 2029 | case CCS_START_NETWORK: |
@@ -2043,11 +2032,11 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
2043 | if (readb | 2032 | if (readb |
2044 | (&pccs->var.start_network.net_initiated) == | 2033 | (&pccs->var.start_network.net_initiated) == |
2045 | 1) { | 2034 | 1) { |
2046 | DEBUG(0, | 2035 | dev_dbg(&link->dev, |
2047 | "ray_cs interrupt network \"%s\" started\n", | 2036 | "ray_cs interrupt network \"%s\" started\n", |
2048 | local->sparm.b4.a_current_ess_id); | 2037 | local->sparm.b4.a_current_ess_id); |
2049 | } else { | 2038 | } else { |
2050 | DEBUG(0, | 2039 | dev_dbg(&link->dev, |
2051 | "ray_cs interrupt network \"%s\" joined\n", | 2040 | "ray_cs interrupt network \"%s\" joined\n", |
2052 | local->sparm.b4.a_current_ess_id); | 2041 | local->sparm.b4.a_current_ess_id); |
2053 | } | 2042 | } |
@@ -2075,12 +2064,12 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
2075 | local->timer.expires = jiffies + HZ * 5; | 2064 | local->timer.expires = jiffies + HZ * 5; |
2076 | local->timer.data = (long)local; | 2065 | local->timer.data = (long)local; |
2077 | if (status == CCS_START_NETWORK) { | 2066 | if (status == CCS_START_NETWORK) { |
2078 | DEBUG(0, | 2067 | dev_dbg(&link->dev, |
2079 | "ray_cs interrupt network \"%s\" start failed\n", | 2068 | "ray_cs interrupt network \"%s\" start failed\n", |
2080 | local->sparm.b4.a_current_ess_id); | 2069 | local->sparm.b4.a_current_ess_id); |
2081 | local->timer.function = &start_net; | 2070 | local->timer.function = &start_net; |
2082 | } else { | 2071 | } else { |
2083 | DEBUG(0, | 2072 | dev_dbg(&link->dev, |
2084 | "ray_cs interrupt network \"%s\" join failed\n", | 2073 | "ray_cs interrupt network \"%s\" join failed\n", |
2085 | local->sparm.b4.a_current_ess_id); | 2074 | local->sparm.b4.a_current_ess_id); |
2086 | local->timer.function = &join_net; | 2075 | local->timer.function = &join_net; |
@@ -2091,19 +2080,19 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
2091 | case CCS_START_ASSOCIATION: | 2080 | case CCS_START_ASSOCIATION: |
2092 | if (status == CCS_COMMAND_COMPLETE) { | 2081 | if (status == CCS_COMMAND_COMPLETE) { |
2093 | local->card_status = CARD_ASSOC_COMPLETE; | 2082 | local->card_status = CARD_ASSOC_COMPLETE; |
2094 | DEBUG(0, "ray_cs association successful\n"); | 2083 | dev_dbg(&link->dev, "ray_cs association successful\n"); |
2095 | } else { | 2084 | } else { |
2096 | DEBUG(0, "ray_cs association failed,\n"); | 2085 | dev_dbg(&link->dev, "ray_cs association failed,\n"); |
2097 | local->card_status = CARD_ASSOC_FAILED; | 2086 | local->card_status = CARD_ASSOC_FAILED; |
2098 | join_net((u_long) local); | 2087 | join_net((u_long) local); |
2099 | } | 2088 | } |
2100 | break; | 2089 | break; |
2101 | case CCS_TX_REQUEST: | 2090 | case CCS_TX_REQUEST: |
2102 | if (status == CCS_COMMAND_COMPLETE) { | 2091 | if (status == CCS_COMMAND_COMPLETE) { |
2103 | DEBUG(3, | 2092 | dev_dbg(&link->dev, |
2104 | "ray_cs interrupt tx request complete\n"); | 2093 | "ray_cs interrupt tx request complete\n"); |
2105 | } else { | 2094 | } else { |
2106 | DEBUG(1, | 2095 | dev_dbg(&link->dev, |
2107 | "ray_cs interrupt tx request failed\n"); | 2096 | "ray_cs interrupt tx request failed\n"); |
2108 | } | 2097 | } |
2109 | if (!sniffer) | 2098 | if (!sniffer) |
@@ -2111,21 +2100,21 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
2111 | netif_wake_queue(dev); | 2100 | netif_wake_queue(dev); |
2112 | break; | 2101 | break; |
2113 | case CCS_TEST_MEMORY: | 2102 | case CCS_TEST_MEMORY: |
2114 | DEBUG(1, "ray_cs interrupt mem test done\n"); | 2103 | dev_dbg(&link->dev, "ray_cs interrupt mem test done\n"); |
2115 | break; | 2104 | break; |
2116 | case CCS_SHUTDOWN: | 2105 | case CCS_SHUTDOWN: |
2117 | DEBUG(1, | 2106 | dev_dbg(&link->dev, |
2118 | "ray_cs interrupt Unexpected CCS returned - Shutdown\n"); | 2107 | "ray_cs interrupt Unexpected CCS returned - Shutdown\n"); |
2119 | break; | 2108 | break; |
2120 | case CCS_DUMP_MEMORY: | 2109 | case CCS_DUMP_MEMORY: |
2121 | DEBUG(1, "ray_cs interrupt dump memory done\n"); | 2110 | dev_dbg(&link->dev, "ray_cs interrupt dump memory done\n"); |
2122 | break; | 2111 | break; |
2123 | case CCS_START_TIMER: | 2112 | case CCS_START_TIMER: |
2124 | DEBUG(2, | 2113 | dev_dbg(&link->dev, |
2125 | "ray_cs interrupt DING - raylink timer expired\n"); | 2114 | "ray_cs interrupt DING - raylink timer expired\n"); |
2126 | break; | 2115 | break; |
2127 | default: | 2116 | default: |
2128 | DEBUG(1, | 2117 | dev_dbg(&link->dev, |
2129 | "ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n", | 2118 | "ray_cs interrupt Unexpected CCS 0x%x returned 0x%x\n", |
2130 | rcsindex, cmd); | 2119 | rcsindex, cmd); |
2131 | } | 2120 | } |
@@ -2139,7 +2128,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
2139 | ray_rx(dev, local, prcs); | 2128 | ray_rx(dev, local, prcs); |
2140 | break; | 2129 | break; |
2141 | case REJOIN_NET_COMPLETE: | 2130 | case REJOIN_NET_COMPLETE: |
2142 | DEBUG(1, "ray_cs interrupt rejoin net complete\n"); | 2131 | dev_dbg(&link->dev, "ray_cs interrupt rejoin net complete\n"); |
2143 | local->card_status = CARD_ACQ_COMPLETE; | 2132 | local->card_status = CARD_ACQ_COMPLETE; |
2144 | /* do we need to clear tx buffers CCS's? */ | 2133 | /* do we need to clear tx buffers CCS's? */ |
2145 | if (local->sparm.b4.a_network_type == ADHOC) { | 2134 | if (local->sparm.b4.a_network_type == ADHOC) { |
@@ -2149,7 +2138,7 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
2149 | memcpy_fromio(&local->bss_id, | 2138 | memcpy_fromio(&local->bss_id, |
2150 | prcs->var.rejoin_net_complete. | 2139 | prcs->var.rejoin_net_complete. |
2151 | bssid, ADDRLEN); | 2140 | bssid, ADDRLEN); |
2152 | DEBUG(1, | 2141 | dev_dbg(&link->dev, |
2153 | "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n", | 2142 | "ray_cs new BSSID = %02x%02x%02x%02x%02x%02x\n", |
2154 | local->bss_id[0], local->bss_id[1], | 2143 | local->bss_id[0], local->bss_id[1], |
2155 | local->bss_id[2], local->bss_id[3], | 2144 | local->bss_id[2], local->bss_id[3], |
@@ -2159,15 +2148,15 @@ static irqreturn_t ray_interrupt(int irq, void *dev_id) | |||
2159 | } | 2148 | } |
2160 | break; | 2149 | break; |
2161 | case ROAMING_INITIATED: | 2150 | case ROAMING_INITIATED: |
2162 | DEBUG(1, "ray_cs interrupt roaming initiated\n"); | 2151 | dev_dbg(&link->dev, "ray_cs interrupt roaming initiated\n"); |
2163 | netif_stop_queue(dev); | 2152 | netif_stop_queue(dev); |
2164 | local->card_status = CARD_DOING_ACQ; | 2153 | local->card_status = CARD_DOING_ACQ; |
2165 | break; | 2154 | break; |
2166 | case JAPAN_CALL_SIGN_RXD: | 2155 | case JAPAN_CALL_SIGN_RXD: |
2167 | DEBUG(1, "ray_cs interrupt japan call sign rx\n"); | 2156 | dev_dbg(&link->dev, "ray_cs interrupt japan call sign rx\n"); |
2168 | break; | 2157 | break; |
2169 | default: | 2158 | default: |
2170 | DEBUG(1, | 2159 | dev_dbg(&link->dev, |
2171 | "ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n", | 2160 | "ray_cs Unexpected interrupt for RCS 0x%x cmd = 0x%x\n", |
2172 | rcsindex, | 2161 | rcsindex, |
2173 | (unsigned int)readb(&prcs->interrupt_id)); | 2162 | (unsigned int)readb(&prcs->interrupt_id)); |
@@ -2186,7 +2175,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local, | |||
2186 | int rx_len; | 2175 | int rx_len; |
2187 | unsigned int pkt_addr; | 2176 | unsigned int pkt_addr; |
2188 | void __iomem *pmsg; | 2177 | void __iomem *pmsg; |
2189 | DEBUG(4, "ray_rx process rx packet\n"); | 2178 | pr_debug("ray_rx process rx packet\n"); |
2190 | 2179 | ||
2191 | /* Calculate address of packet within Rx buffer */ | 2180 | /* Calculate address of packet within Rx buffer */ |
2192 | pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8) | 2181 | pkt_addr = ((readb(&prcs->var.rx_packet.rx_data_ptr[0]) << 8) |
@@ -2199,28 +2188,28 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local, | |||
2199 | pmsg = local->rmem + pkt_addr; | 2188 | pmsg = local->rmem + pkt_addr; |
2200 | switch (readb(pmsg)) { | 2189 | switch (readb(pmsg)) { |
2201 | case DATA_TYPE: | 2190 | case DATA_TYPE: |
2202 | DEBUG(4, "ray_rx data type\n"); | 2191 | pr_debug("ray_rx data type\n"); |
2203 | rx_data(dev, prcs, pkt_addr, rx_len); | 2192 | rx_data(dev, prcs, pkt_addr, rx_len); |
2204 | break; | 2193 | break; |
2205 | case AUTHENTIC_TYPE: | 2194 | case AUTHENTIC_TYPE: |
2206 | DEBUG(4, "ray_rx authentic type\n"); | 2195 | pr_debug("ray_rx authentic type\n"); |
2207 | if (sniffer) | 2196 | if (sniffer) |
2208 | rx_data(dev, prcs, pkt_addr, rx_len); | 2197 | rx_data(dev, prcs, pkt_addr, rx_len); |
2209 | else | 2198 | else |
2210 | rx_authenticate(local, prcs, pkt_addr, rx_len); | 2199 | rx_authenticate(local, prcs, pkt_addr, rx_len); |
2211 | break; | 2200 | break; |
2212 | case DEAUTHENTIC_TYPE: | 2201 | case DEAUTHENTIC_TYPE: |
2213 | DEBUG(4, "ray_rx deauth type\n"); | 2202 | pr_debug("ray_rx deauth type\n"); |
2214 | if (sniffer) | 2203 | if (sniffer) |
2215 | rx_data(dev, prcs, pkt_addr, rx_len); | 2204 | rx_data(dev, prcs, pkt_addr, rx_len); |
2216 | else | 2205 | else |
2217 | rx_deauthenticate(local, prcs, pkt_addr, rx_len); | 2206 | rx_deauthenticate(local, prcs, pkt_addr, rx_len); |
2218 | break; | 2207 | break; |
2219 | case NULL_MSG_TYPE: | 2208 | case NULL_MSG_TYPE: |
2220 | DEBUG(3, "ray_cs rx NULL msg\n"); | 2209 | pr_debug("ray_cs rx NULL msg\n"); |
2221 | break; | 2210 | break; |
2222 | case BEACON_TYPE: | 2211 | case BEACON_TYPE: |
2223 | DEBUG(4, "ray_rx beacon type\n"); | 2212 | pr_debug("ray_rx beacon type\n"); |
2224 | if (sniffer) | 2213 | if (sniffer) |
2225 | rx_data(dev, prcs, pkt_addr, rx_len); | 2214 | rx_data(dev, prcs, pkt_addr, rx_len); |
2226 | 2215 | ||
@@ -2233,7 +2222,7 @@ static void ray_rx(struct net_device *dev, ray_dev_t *local, | |||
2233 | ray_get_stats(dev); | 2222 | ray_get_stats(dev); |
2234 | break; | 2223 | break; |
2235 | default: | 2224 | default: |
2236 | DEBUG(0, "ray_cs unknown pkt type %2x\n", | 2225 | pr_debug("ray_cs unknown pkt type %2x\n", |
2237 | (unsigned int)readb(pmsg)); | 2226 | (unsigned int)readb(pmsg)); |
2238 | break; | 2227 | break; |
2239 | } | 2228 | } |
@@ -2262,7 +2251,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
2262 | rx_len > | 2251 | rx_len > |
2263 | (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + | 2252 | (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + |
2264 | FCS_LEN)) { | 2253 | FCS_LEN)) { |
2265 | DEBUG(0, | 2254 | pr_debug( |
2266 | "ray_cs invalid packet length %d received \n", | 2255 | "ray_cs invalid packet length %d received \n", |
2267 | rx_len); | 2256 | rx_len); |
2268 | return; | 2257 | return; |
@@ -2273,17 +2262,17 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
2273 | rx_len > | 2262 | rx_len > |
2274 | (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + | 2263 | (dev->mtu + RX_MAC_HEADER_LENGTH + ETH_HLEN + |
2275 | FCS_LEN)) { | 2264 | FCS_LEN)) { |
2276 | DEBUG(0, | 2265 | pr_debug( |
2277 | "ray_cs invalid packet length %d received \n", | 2266 | "ray_cs invalid packet length %d received \n", |
2278 | rx_len); | 2267 | rx_len); |
2279 | return; | 2268 | return; |
2280 | } | 2269 | } |
2281 | } | 2270 | } |
2282 | } | 2271 | } |
2283 | DEBUG(4, "ray_cs rx_data packet\n"); | 2272 | pr_debug("ray_cs rx_data packet\n"); |
2284 | /* If fragmented packet, verify sizes of fragments add up */ | 2273 | /* If fragmented packet, verify sizes of fragments add up */ |
2285 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { | 2274 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { |
2286 | DEBUG(1, "ray_cs rx'ed fragment\n"); | 2275 | pr_debug("ray_cs rx'ed fragment\n"); |
2287 | tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8) | 2276 | tmp = (readb(&prcs->var.rx_packet.totalpacketlength[0]) << 8) |
2288 | + readb(&prcs->var.rx_packet.totalpacketlength[1]); | 2277 | + readb(&prcs->var.rx_packet.totalpacketlength[1]); |
2289 | total_len = tmp; | 2278 | total_len = tmp; |
@@ -2301,7 +2290,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
2301 | } while (1); | 2290 | } while (1); |
2302 | 2291 | ||
2303 | if (tmp < 0) { | 2292 | if (tmp < 0) { |
2304 | DEBUG(0, | 2293 | pr_debug( |
2305 | "ray_cs rx_data fragment lengths don't add up\n"); | 2294 | "ray_cs rx_data fragment lengths don't add up\n"); |
2306 | local->stats.rx_dropped++; | 2295 | local->stats.rx_dropped++; |
2307 | release_frag_chain(local, prcs); | 2296 | release_frag_chain(local, prcs); |
@@ -2313,7 +2302,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
2313 | 2302 | ||
2314 | skb = dev_alloc_skb(total_len + 5); | 2303 | skb = dev_alloc_skb(total_len + 5); |
2315 | if (skb == NULL) { | 2304 | if (skb == NULL) { |
2316 | DEBUG(0, "ray_cs rx_data could not allocate skb\n"); | 2305 | pr_debug("ray_cs rx_data could not allocate skb\n"); |
2317 | local->stats.rx_dropped++; | 2306 | local->stats.rx_dropped++; |
2318 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) | 2307 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) |
2319 | release_frag_chain(local, prcs); | 2308 | release_frag_chain(local, prcs); |
@@ -2321,7 +2310,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
2321 | } | 2310 | } |
2322 | skb_reserve(skb, 2); /* Align IP on 16 byte (TBD check this) */ | 2311 | skb_reserve(skb, 2); /* Align IP on 16 byte (TBD check this) */ |
2323 | 2312 | ||
2324 | DEBUG(4, "ray_cs rx_data total_len = %x, rx_len = %x\n", total_len, | 2313 | pr_debug("ray_cs rx_data total_len = %x, rx_len = %x\n", total_len, |
2325 | rx_len); | 2314 | rx_len); |
2326 | 2315 | ||
2327 | /************************/ | 2316 | /************************/ |
@@ -2354,7 +2343,7 @@ static void rx_data(struct net_device *dev, struct rcs __iomem *prcs, | |||
2354 | tmp = 17; | 2343 | tmp = 17; |
2355 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { | 2344 | if (readb(&prcs->var.rx_packet.next_frag_rcs_index) != 0xFF) { |
2356 | prcslink = prcs; | 2345 | prcslink = prcs; |
2357 | DEBUG(1, "ray_cs rx_data in fragment loop\n"); | 2346 | pr_debug("ray_cs rx_data in fragment loop\n"); |
2358 | do { | 2347 | do { |
2359 | prcslink = rcs_base(local) | 2348 | prcslink = rcs_base(local) |
2360 | + | 2349 | + |
@@ -2426,8 +2415,8 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
2426 | memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN); | 2415 | memcpy(destaddr, ieee80211_get_DA(pmac), ADDRLEN); |
2427 | memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN); | 2416 | memcpy(srcaddr, ieee80211_get_SA(pmac), ADDRLEN); |
2428 | 2417 | ||
2429 | #ifdef PCMCIA_DEBUG | 2418 | #if 0 |
2430 | if (pc_debug > 3) { | 2419 | if { |
2431 | print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", | 2420 | print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", |
2432 | DUMP_PREFIX_NONE, 16, 1, | 2421 | DUMP_PREFIX_NONE, 16, 1, |
2433 | skb->data, 64, true); | 2422 | skb->data, 64, true); |
@@ -2441,7 +2430,7 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
2441 | 2430 | ||
2442 | if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) { | 2431 | if (psnap->dsap != 0xaa || psnap->ssap != 0xaa || psnap->ctrl != 3) { |
2443 | /* not a snap type so leave it alone */ | 2432 | /* not a snap type so leave it alone */ |
2444 | DEBUG(3, "ray_cs untranslate NOT SNAP %02x %02x %02x\n", | 2433 | pr_debug("ray_cs untranslate NOT SNAP %02x %02x %02x\n", |
2445 | psnap->dsap, psnap->ssap, psnap->ctrl); | 2434 | psnap->dsap, psnap->ssap, psnap->ctrl); |
2446 | 2435 | ||
2447 | delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; | 2436 | delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; |
@@ -2450,7 +2439,7 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
2450 | } else { /* Its a SNAP */ | 2439 | } else { /* Its a SNAP */ |
2451 | if (memcmp(psnap->org, org_bridge, 3) == 0) { | 2440 | if (memcmp(psnap->org, org_bridge, 3) == 0) { |
2452 | /* EtherII and nuke the LLC */ | 2441 | /* EtherII and nuke the LLC */ |
2453 | DEBUG(3, "ray_cs untranslate Bridge encap\n"); | 2442 | pr_debug("ray_cs untranslate Bridge encap\n"); |
2454 | delta = RX_MAC_HEADER_LENGTH | 2443 | delta = RX_MAC_HEADER_LENGTH |
2455 | + sizeof(struct snaphdr_t) - ETH_HLEN; | 2444 | + sizeof(struct snaphdr_t) - ETH_HLEN; |
2456 | peth = (struct ethhdr *)(skb->data + delta); | 2445 | peth = (struct ethhdr *)(skb->data + delta); |
@@ -2459,14 +2448,14 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
2459 | switch (ntohs(type)) { | 2448 | switch (ntohs(type)) { |
2460 | case ETH_P_IPX: | 2449 | case ETH_P_IPX: |
2461 | case ETH_P_AARP: | 2450 | case ETH_P_AARP: |
2462 | DEBUG(3, "ray_cs untranslate RFC IPX/AARP\n"); | 2451 | pr_debug("ray_cs untranslate RFC IPX/AARP\n"); |
2463 | delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; | 2452 | delta = RX_MAC_HEADER_LENGTH - ETH_HLEN; |
2464 | peth = (struct ethhdr *)(skb->data + delta); | 2453 | peth = (struct ethhdr *)(skb->data + delta); |
2465 | peth->h_proto = | 2454 | peth->h_proto = |
2466 | htons(len - RX_MAC_HEADER_LENGTH); | 2455 | htons(len - RX_MAC_HEADER_LENGTH); |
2467 | break; | 2456 | break; |
2468 | default: | 2457 | default: |
2469 | DEBUG(3, "ray_cs untranslate RFC default\n"); | 2458 | pr_debug("ray_cs untranslate RFC default\n"); |
2470 | delta = RX_MAC_HEADER_LENGTH + | 2459 | delta = RX_MAC_HEADER_LENGTH + |
2471 | sizeof(struct snaphdr_t) - ETH_HLEN; | 2460 | sizeof(struct snaphdr_t) - ETH_HLEN; |
2472 | peth = (struct ethhdr *)(skb->data + delta); | 2461 | peth = (struct ethhdr *)(skb->data + delta); |
@@ -2482,12 +2471,12 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
2482 | } | 2471 | } |
2483 | /* TBD reserve skb_reserve(skb, delta); */ | 2472 | /* TBD reserve skb_reserve(skb, delta); */ |
2484 | skb_pull(skb, delta); | 2473 | skb_pull(skb, delta); |
2485 | DEBUG(3, "untranslate after skb_pull(%d), skb->data = %p\n", delta, | 2474 | pr_debug("untranslate after skb_pull(%d), skb->data = %p\n", delta, |
2486 | skb->data); | 2475 | skb->data); |
2487 | memcpy(peth->h_dest, destaddr, ADDRLEN); | 2476 | memcpy(peth->h_dest, destaddr, ADDRLEN); |
2488 | memcpy(peth->h_source, srcaddr, ADDRLEN); | 2477 | memcpy(peth->h_source, srcaddr, ADDRLEN); |
2489 | #ifdef PCMCIA_DEBUG | 2478 | #if 0 |
2490 | if (pc_debug > 3) { | 2479 | { |
2491 | int i; | 2480 | int i; |
2492 | printk(KERN_DEBUG "skb->data after untranslate:"); | 2481 | printk(KERN_DEBUG "skb->data after untranslate:"); |
2493 | for (i = 0; i < 64; i++) | 2482 | for (i = 0; i < 64; i++) |
@@ -2529,7 +2518,7 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs) | |||
2529 | while (tmp--) { | 2518 | while (tmp--) { |
2530 | writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); | 2519 | writeb(CCS_BUFFER_FREE, &prcslink->buffer_status); |
2531 | if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { | 2520 | if (rcsindex >= (NUMBER_OF_CCS + NUMBER_OF_RCS)) { |
2532 | DEBUG(1, "ray_cs interrupt bad rcsindex = 0x%x\n", | 2521 | pr_debug("ray_cs interrupt bad rcsindex = 0x%x\n", |
2533 | rcsindex); | 2522 | rcsindex); |
2534 | break; | 2523 | break; |
2535 | } | 2524 | } |
@@ -2543,9 +2532,9 @@ static void release_frag_chain(ray_dev_t *local, struct rcs __iomem *prcs) | |||
2543 | static void authenticate(ray_dev_t *local) | 2532 | static void authenticate(ray_dev_t *local) |
2544 | { | 2533 | { |
2545 | struct pcmcia_device *link = local->finder; | 2534 | struct pcmcia_device *link = local->finder; |
2546 | DEBUG(0, "ray_cs Starting authentication.\n"); | 2535 | dev_dbg(&link->dev, "ray_cs Starting authentication.\n"); |
2547 | if (!(pcmcia_dev_present(link))) { | 2536 | if (!(pcmcia_dev_present(link))) { |
2548 | DEBUG(2, "ray_cs authenticate - device not present\n"); | 2537 | dev_dbg(&link->dev, "ray_cs authenticate - device not present\n"); |
2549 | return; | 2538 | return; |
2550 | } | 2539 | } |
2551 | 2540 | ||
@@ -2573,11 +2562,11 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs, | |||
2573 | copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); | 2562 | copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); |
2574 | /* if we are trying to get authenticated */ | 2563 | /* if we are trying to get authenticated */ |
2575 | if (local->sparm.b4.a_network_type == ADHOC) { | 2564 | if (local->sparm.b4.a_network_type == ADHOC) { |
2576 | DEBUG(1, "ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n", | 2565 | pr_debug("ray_cs rx_auth var= %02x %02x %02x %02x %02x %02x\n", |
2577 | msg->var[0], msg->var[1], msg->var[2], msg->var[3], | 2566 | msg->var[0], msg->var[1], msg->var[2], msg->var[3], |
2578 | msg->var[4], msg->var[5]); | 2567 | msg->var[4], msg->var[5]); |
2579 | if (msg->var[2] == 1) { | 2568 | if (msg->var[2] == 1) { |
2580 | DEBUG(0, "ray_cs Sending authentication response.\n"); | 2569 | pr_debug("ray_cs Sending authentication response.\n"); |
2581 | if (!build_auth_frame | 2570 | if (!build_auth_frame |
2582 | (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) { | 2571 | (local, msg->mac.addr_2, OPEN_AUTH_RESPONSE)) { |
2583 | local->authentication_state = NEED_TO_AUTH; | 2572 | local->authentication_state = NEED_TO_AUTH; |
@@ -2591,13 +2580,13 @@ static void rx_authenticate(ray_dev_t *local, struct rcs __iomem *prcs, | |||
2591 | /* Verify authentication sequence #2 and success */ | 2580 | /* Verify authentication sequence #2 and success */ |
2592 | if (msg->var[2] == 2) { | 2581 | if (msg->var[2] == 2) { |
2593 | if ((msg->var[3] | msg->var[4]) == 0) { | 2582 | if ((msg->var[3] | msg->var[4]) == 0) { |
2594 | DEBUG(1, "Authentication successful\n"); | 2583 | pr_debug("Authentication successful\n"); |
2595 | local->card_status = CARD_AUTH_COMPLETE; | 2584 | local->card_status = CARD_AUTH_COMPLETE; |
2596 | associate(local); | 2585 | associate(local); |
2597 | local->authentication_state = | 2586 | local->authentication_state = |
2598 | AUTHENTICATED; | 2587 | AUTHENTICATED; |
2599 | } else { | 2588 | } else { |
2600 | DEBUG(0, "Authentication refused\n"); | 2589 | pr_debug("Authentication refused\n"); |
2601 | local->card_status = CARD_AUTH_REFUSED; | 2590 | local->card_status = CARD_AUTH_REFUSED; |
2602 | join_net((u_long) local); | 2591 | join_net((u_long) local); |
2603 | local->authentication_state = | 2592 | local->authentication_state = |
@@ -2617,22 +2606,22 @@ static void associate(ray_dev_t *local) | |||
2617 | struct net_device *dev = link->priv; | 2606 | struct net_device *dev = link->priv; |
2618 | int ccsindex; | 2607 | int ccsindex; |
2619 | if (!(pcmcia_dev_present(link))) { | 2608 | if (!(pcmcia_dev_present(link))) { |
2620 | DEBUG(2, "ray_cs associate - device not present\n"); | 2609 | dev_dbg(&link->dev, "ray_cs associate - device not present\n"); |
2621 | return; | 2610 | return; |
2622 | } | 2611 | } |
2623 | /* If no tx buffers available, return */ | 2612 | /* If no tx buffers available, return */ |
2624 | if ((ccsindex = get_free_ccs(local)) < 0) { | 2613 | if ((ccsindex = get_free_ccs(local)) < 0) { |
2625 | /* TBD should never be here but... what if we are? */ | 2614 | /* TBD should never be here but... what if we are? */ |
2626 | DEBUG(1, "ray_cs associate - No free ccs\n"); | 2615 | dev_dbg(&link->dev, "ray_cs associate - No free ccs\n"); |
2627 | return; | 2616 | return; |
2628 | } | 2617 | } |
2629 | DEBUG(1, "ray_cs Starting association with access point\n"); | 2618 | dev_dbg(&link->dev, "ray_cs Starting association with access point\n"); |
2630 | pccs = ccs_base(local) + ccsindex; | 2619 | pccs = ccs_base(local) + ccsindex; |
2631 | /* fill in the CCS */ | 2620 | /* fill in the CCS */ |
2632 | writeb(CCS_START_ASSOCIATION, &pccs->cmd); | 2621 | writeb(CCS_START_ASSOCIATION, &pccs->cmd); |
2633 | /* Interrupt the firmware to process the command */ | 2622 | /* Interrupt the firmware to process the command */ |
2634 | if (interrupt_ecf(local, ccsindex)) { | 2623 | if (interrupt_ecf(local, ccsindex)) { |
2635 | DEBUG(1, "ray_cs associate failed - ECF not ready for intr\n"); | 2624 | dev_dbg(&link->dev, "ray_cs associate failed - ECF not ready for intr\n"); |
2636 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 2625 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
2637 | 2626 | ||
2638 | del_timer(&local->timer); | 2627 | del_timer(&local->timer); |
@@ -2655,7 +2644,7 @@ static void rx_deauthenticate(ray_dev_t *local, struct rcs __iomem *prcs, | |||
2655 | /* UCHAR buff[256]; | 2644 | /* UCHAR buff[256]; |
2656 | struct rx_msg *msg = (struct rx_msg *)buff; | 2645 | struct rx_msg *msg = (struct rx_msg *)buff; |
2657 | */ | 2646 | */ |
2658 | DEBUG(0, "Deauthentication frame received\n"); | 2647 | pr_debug("Deauthentication frame received\n"); |
2659 | local->authentication_state = UNAUTHENTICATED; | 2648 | local->authentication_state = UNAUTHENTICATED; |
2660 | /* Need to reauthenticate or rejoin depending on reason code */ | 2649 | /* Need to reauthenticate or rejoin depending on reason code */ |
2661 | /* copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); | 2650 | /* copy_from_rx_buff(local, buff, pkt_addr, rx_len & 0xff); |
@@ -2823,7 +2812,7 @@ static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) | |||
2823 | 2812 | ||
2824 | /* If no tx buffers available, return */ | 2813 | /* If no tx buffers available, return */ |
2825 | if ((ccsindex = get_free_tx_ccs(local)) < 0) { | 2814 | if ((ccsindex = get_free_tx_ccs(local)) < 0) { |
2826 | DEBUG(1, "ray_cs send authenticate - No free tx ccs\n"); | 2815 | pr_debug("ray_cs send authenticate - No free tx ccs\n"); |
2827 | return -1; | 2816 | return -1; |
2828 | } | 2817 | } |
2829 | 2818 | ||
@@ -2855,7 +2844,7 @@ static int build_auth_frame(ray_dev_t *local, UCHAR *dest, int auth_type) | |||
2855 | 2844 | ||
2856 | /* Interrupt the firmware to process the command */ | 2845 | /* Interrupt the firmware to process the command */ |
2857 | if (interrupt_ecf(local, ccsindex)) { | 2846 | if (interrupt_ecf(local, ccsindex)) { |
2858 | DEBUG(1, | 2847 | pr_debug( |
2859 | "ray_cs send authentication request failed - ECF not ready for intr\n"); | 2848 | "ray_cs send authentication request failed - ECF not ready for intr\n"); |
2860 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); | 2849 | writeb(CCS_BUFFER_FREE, &(pccs++)->buffer_status); |
2861 | return -1; | 2850 | return -1; |
@@ -2942,9 +2931,9 @@ static int __init init_ray_cs(void) | |||
2942 | { | 2931 | { |
2943 | int rc; | 2932 | int rc; |
2944 | 2933 | ||
2945 | DEBUG(1, "%s\n", rcsid); | 2934 | pr_debug("%s\n", rcsid); |
2946 | rc = pcmcia_register_driver(&ray_driver); | 2935 | rc = pcmcia_register_driver(&ray_driver); |
2947 | DEBUG(1, "raylink init_module register_pcmcia_driver returns 0x%x\n", | 2936 | pr_debug("raylink init_module register_pcmcia_driver returns 0x%x\n", |
2948 | rc); | 2937 | rc); |
2949 | 2938 | ||
2950 | #ifdef CONFIG_PROC_FS | 2939 | #ifdef CONFIG_PROC_FS |
@@ -2964,7 +2953,7 @@ static int __init init_ray_cs(void) | |||
2964 | 2953 | ||
2965 | static void __exit exit_ray_cs(void) | 2954 | static void __exit exit_ray_cs(void) |
2966 | { | 2955 | { |
2967 | DEBUG(0, "ray_cs: cleanup_module\n"); | 2956 | pr_debug("ray_cs: cleanup_module\n"); |
2968 | 2957 | ||
2969 | #ifdef CONFIG_PROC_FS | 2958 | #ifdef CONFIG_PROC_FS |
2970 | remove_proc_entry("driver/ray_cs/ray_cs", NULL); | 2959 | remove_proc_entry("driver/ray_cs/ray_cs", NULL); |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 431a20ec6db6..33918fd5b231 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -3656,10 +3656,7 @@ wv_pcmcia_reset(struct net_device * dev) | |||
3656 | 3656 | ||
3657 | i = pcmcia_access_configuration_register(link, ®); | 3657 | i = pcmcia_access_configuration_register(link, ®); |
3658 | if (i != 0) | 3658 | if (i != 0) |
3659 | { | ||
3660 | cs_error(link, AccessConfigurationRegister, i); | ||
3661 | return FALSE; | 3659 | return FALSE; |
3662 | } | ||
3663 | 3660 | ||
3664 | #ifdef DEBUG_CONFIG_INFO | 3661 | #ifdef DEBUG_CONFIG_INFO |
3665 | printk(KERN_DEBUG "%s: wavelan_pcmcia_reset(): Config reg is 0x%x\n", | 3662 | printk(KERN_DEBUG "%s: wavelan_pcmcia_reset(): Config reg is 0x%x\n", |
@@ -3670,19 +3667,13 @@ wv_pcmcia_reset(struct net_device * dev) | |||
3670 | reg.Value = reg.Value | COR_SW_RESET; | 3667 | reg.Value = reg.Value | COR_SW_RESET; |
3671 | i = pcmcia_access_configuration_register(link, ®); | 3668 | i = pcmcia_access_configuration_register(link, ®); |
3672 | if (i != 0) | 3669 | if (i != 0) |
3673 | { | ||
3674 | cs_error(link, AccessConfigurationRegister, i); | ||
3675 | return FALSE; | 3670 | return FALSE; |
3676 | } | ||
3677 | 3671 | ||
3678 | reg.Action = CS_WRITE; | 3672 | reg.Action = CS_WRITE; |
3679 | reg.Value = COR_LEVEL_IRQ | COR_CONFIG; | 3673 | reg.Value = COR_LEVEL_IRQ | COR_CONFIG; |
3680 | i = pcmcia_access_configuration_register(link, ®); | 3674 | i = pcmcia_access_configuration_register(link, ®); |
3681 | if (i != 0) | 3675 | if (i != 0) |
3682 | { | ||
3683 | cs_error(link, AccessConfigurationRegister, i); | ||
3684 | return FALSE; | 3676 | return FALSE; |
3685 | } | ||
3686 | 3677 | ||
3687 | #ifdef DEBUG_CONFIG_TRACE | 3678 | #ifdef DEBUG_CONFIG_TRACE |
3688 | printk(KERN_DEBUG "%s: <-wv_pcmcia_reset()\n", dev->name); | 3679 | printk(KERN_DEBUG "%s: <-wv_pcmcia_reset()\n", dev->name); |
@@ -3857,10 +3848,7 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
3857 | { | 3848 | { |
3858 | i = pcmcia_request_io(link, &link->io); | 3849 | i = pcmcia_request_io(link, &link->io); |
3859 | if (i != 0) | 3850 | if (i != 0) |
3860 | { | ||
3861 | cs_error(link, RequestIO, i); | ||
3862 | break; | 3851 | break; |
3863 | } | ||
3864 | 3852 | ||
3865 | /* | 3853 | /* |
3866 | * Now allocate an interrupt line. Note that this does not | 3854 | * Now allocate an interrupt line. Note that this does not |
@@ -3868,10 +3856,7 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
3868 | */ | 3856 | */ |
3869 | i = pcmcia_request_irq(link, &link->irq); | 3857 | i = pcmcia_request_irq(link, &link->irq); |
3870 | if (i != 0) | 3858 | if (i != 0) |
3871 | { | ||
3872 | cs_error(link, RequestIRQ, i); | ||
3873 | break; | 3859 | break; |
3874 | } | ||
3875 | 3860 | ||
3876 | /* | 3861 | /* |
3877 | * This actually configures the PCMCIA socket -- setting up | 3862 | * This actually configures the PCMCIA socket -- setting up |
@@ -3880,10 +3865,7 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
3880 | link->conf.ConfigIndex = 1; | 3865 | link->conf.ConfigIndex = 1; |
3881 | i = pcmcia_request_configuration(link, &link->conf); | 3866 | i = pcmcia_request_configuration(link, &link->conf); |
3882 | if (i != 0) | 3867 | if (i != 0) |
3883 | { | ||
3884 | cs_error(link, RequestConfiguration, i); | ||
3885 | break; | 3868 | break; |
3886 | } | ||
3887 | 3869 | ||
3888 | /* | 3870 | /* |
3889 | * Allocate a small memory window. Note that the struct pcmcia_device | 3871 | * Allocate a small memory window. Note that the struct pcmcia_device |
@@ -3894,24 +3876,18 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
3894 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 3876 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
3895 | req.Base = req.Size = 0; | 3877 | req.Base = req.Size = 0; |
3896 | req.AccessSpeed = mem_speed; | 3878 | req.AccessSpeed = mem_speed; |
3897 | i = pcmcia_request_window(&link, &req, &link->win); | 3879 | i = pcmcia_request_window(link, &req, &link->win); |
3898 | if (i != 0) | 3880 | if (i != 0) |
3899 | { | ||
3900 | cs_error(link, RequestWindow, i); | ||
3901 | break; | 3881 | break; |
3902 | } | ||
3903 | 3882 | ||
3904 | lp->mem = ioremap(req.Base, req.Size); | 3883 | lp->mem = ioremap(req.Base, req.Size); |
3905 | dev->mem_start = (u_long)lp->mem; | 3884 | dev->mem_start = (u_long)lp->mem; |
3906 | dev->mem_end = dev->mem_start + req.Size; | 3885 | dev->mem_end = dev->mem_start + req.Size; |
3907 | 3886 | ||
3908 | mem.CardOffset = 0; mem.Page = 0; | 3887 | mem.CardOffset = 0; mem.Page = 0; |
3909 | i = pcmcia_map_mem_page(link->win, &mem); | 3888 | i = pcmcia_map_mem_page(link, link->win, &mem); |
3910 | if (i != 0) | 3889 | if (i != 0) |
3911 | { | ||
3912 | cs_error(link, MapMemPage, i); | ||
3913 | break; | 3890 | break; |
3914 | } | ||
3915 | 3891 | ||
3916 | /* Feed device with this info... */ | 3892 | /* Feed device with this info... */ |
3917 | dev->irq = link->irq.AssignedIRQ; | 3893 | dev->irq = link->irq.AssignedIRQ; |
@@ -3923,7 +3899,7 @@ wv_pcmcia_config(struct pcmcia_device * link) | |||
3923 | lp->mem, dev->irq, (u_int) dev->base_addr); | 3899 | lp->mem, dev->irq, (u_int) dev->base_addr); |
3924 | #endif | 3900 | #endif |
3925 | 3901 | ||
3926 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 3902 | SET_NETDEV_DEV(dev, &link->dev); |
3927 | i = register_netdev(dev); | 3903 | i = register_netdev(dev); |
3928 | if(i != 0) | 3904 | if(i != 0) |
3929 | { | 3905 | { |
@@ -4462,8 +4438,7 @@ wavelan_probe(struct pcmcia_device *p_dev) | |||
4462 | p_dev->io.IOAddrLines = 3; | 4438 | p_dev->io.IOAddrLines = 3; |
4463 | 4439 | ||
4464 | /* Interrupt setup */ | 4440 | /* Interrupt setup */ |
4465 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 4441 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
4466 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
4467 | p_dev->irq.Handler = wavelan_interrupt; | 4442 | p_dev->irq.Handler = wavelan_interrupt; |
4468 | 4443 | ||
4469 | /* General socket configuration */ | 4444 | /* General socket configuration */ |
@@ -4475,7 +4450,7 @@ wavelan_probe(struct pcmcia_device *p_dev) | |||
4475 | if (!dev) | 4450 | if (!dev) |
4476 | return -ENOMEM; | 4451 | return -ENOMEM; |
4477 | 4452 | ||
4478 | p_dev->priv = p_dev->irq.Instance = dev; | 4453 | p_dev->priv = dev; |
4479 | 4454 | ||
4480 | lp = netdev_priv(dev); | 4455 | lp = netdev_priv(dev); |
4481 | 4456 | ||
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 4f1e0cfe609b..5f0401a52cff 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c | |||
@@ -67,23 +67,7 @@ | |||
67 | /* For rough constant delay */ | 67 | /* For rough constant delay */ |
68 | #define WL3501_NOPLOOP(n) { int x = 0; while (x++ < n) slow_down_io(); } | 68 | #define WL3501_NOPLOOP(n) { int x = 0; while (x++ < n) slow_down_io(); } |
69 | 69 | ||
70 | /* | 70 | |
71 | * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If you do not | ||
72 | * define PCMCIA_DEBUG at all, all the debug code will be left out. If you | ||
73 | * compile with PCMCIA_DEBUG=0, the debug code will be present but disabled -- | ||
74 | * but it can then be enabled for specific modules at load time with a | ||
75 | * 'pc_debug=#' option to insmod. | ||
76 | */ | ||
77 | #define PCMCIA_DEBUG 0 | ||
78 | #ifdef PCMCIA_DEBUG | ||
79 | static int pc_debug = PCMCIA_DEBUG; | ||
80 | module_param(pc_debug, int, 0); | ||
81 | #define dprintk(n, format, args...) \ | ||
82 | { if (pc_debug > (n)) \ | ||
83 | printk(KERN_INFO "%s: " format "\n", __func__ , ##args); } | ||
84 | #else | ||
85 | #define dprintk(n, format, args...) | ||
86 | #endif | ||
87 | 71 | ||
88 | #define wl3501_outb(a, b) { outb(a, b); slow_down_io(); } | 72 | #define wl3501_outb(a, b) { outb(a, b); slow_down_io(); } |
89 | #define wl3501_outb_p(a, b) { outb_p(a, b); slow_down_io(); } | 73 | #define wl3501_outb_p(a, b) { outb_p(a, b); slow_down_io(); } |
@@ -684,10 +668,10 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) | |||
684 | int matchflag = 0; | 668 | int matchflag = 0; |
685 | struct wl3501_scan_confirm sig; | 669 | struct wl3501_scan_confirm sig; |
686 | 670 | ||
687 | dprintk(3, "entry"); | 671 | pr_debug("entry"); |
688 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 672 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
689 | if (sig.status == WL3501_STATUS_SUCCESS) { | 673 | if (sig.status == WL3501_STATUS_SUCCESS) { |
690 | dprintk(3, "success"); | 674 | pr_debug("success"); |
691 | if ((this->net_type == IW_MODE_INFRA && | 675 | if ((this->net_type == IW_MODE_INFRA && |
692 | (sig.cap_info & WL3501_MGMT_CAPABILITY_ESS)) || | 676 | (sig.cap_info & WL3501_MGMT_CAPABILITY_ESS)) || |
693 | (this->net_type == IW_MODE_ADHOC && | 677 | (this->net_type == IW_MODE_ADHOC && |
@@ -722,7 +706,7 @@ static void wl3501_mgmt_scan_confirm(struct wl3501_card *this, u16 addr) | |||
722 | } | 706 | } |
723 | } | 707 | } |
724 | } else if (sig.status == WL3501_STATUS_TIMEOUT) { | 708 | } else if (sig.status == WL3501_STATUS_TIMEOUT) { |
725 | dprintk(3, "timeout"); | 709 | pr_debug("timeout"); |
726 | this->join_sta_bss = 0; | 710 | this->join_sta_bss = 0; |
727 | for (i = this->join_sta_bss; i < this->bss_cnt; i++) | 711 | for (i = this->join_sta_bss; i < this->bss_cnt; i++) |
728 | if (!wl3501_mgmt_join(this, i)) | 712 | if (!wl3501_mgmt_join(this, i)) |
@@ -879,7 +863,7 @@ static int wl3501_mgmt_auth(struct wl3501_card *this) | |||
879 | .timeout = 1000, | 863 | .timeout = 1000, |
880 | }; | 864 | }; |
881 | 865 | ||
882 | dprintk(3, "entry"); | 866 | pr_debug("entry"); |
883 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); | 867 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); |
884 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); | 868 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); |
885 | } | 869 | } |
@@ -893,7 +877,7 @@ static int wl3501_mgmt_association(struct wl3501_card *this) | |||
893 | .cap_info = this->cap_info, | 877 | .cap_info = this->cap_info, |
894 | }; | 878 | }; |
895 | 879 | ||
896 | dprintk(3, "entry"); | 880 | pr_debug("entry"); |
897 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); | 881 | memcpy(sig.mac_addr, this->bssid, ETH_ALEN); |
898 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); | 882 | return wl3501_esbq_exec(this, &sig, sizeof(sig)); |
899 | } | 883 | } |
@@ -903,7 +887,7 @@ static void wl3501_mgmt_join_confirm(struct net_device *dev, u16 addr) | |||
903 | struct wl3501_card *this = netdev_priv(dev); | 887 | struct wl3501_card *this = netdev_priv(dev); |
904 | struct wl3501_join_confirm sig; | 888 | struct wl3501_join_confirm sig; |
905 | 889 | ||
906 | dprintk(3, "entry"); | 890 | pr_debug("entry"); |
907 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 891 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
908 | if (sig.status == WL3501_STATUS_SUCCESS) { | 892 | if (sig.status == WL3501_STATUS_SUCCESS) { |
909 | if (this->net_type == IW_MODE_INFRA) { | 893 | if (this->net_type == IW_MODE_INFRA) { |
@@ -962,7 +946,7 @@ static inline void wl3501_md_confirm_interrupt(struct net_device *dev, | |||
962 | { | 946 | { |
963 | struct wl3501_md_confirm sig; | 947 | struct wl3501_md_confirm sig; |
964 | 948 | ||
965 | dprintk(3, "entry"); | 949 | pr_debug("entry"); |
966 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 950 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
967 | wl3501_free_tx_buffer(this, sig.data); | 951 | wl3501_free_tx_buffer(this, sig.data); |
968 | if (netif_queue_stopped(dev)) | 952 | if (netif_queue_stopped(dev)) |
@@ -1017,7 +1001,7 @@ static inline void wl3501_md_ind_interrupt(struct net_device *dev, | |||
1017 | static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this, | 1001 | static inline void wl3501_get_confirm_interrupt(struct wl3501_card *this, |
1018 | u16 addr, void *sig, int size) | 1002 | u16 addr, void *sig, int size) |
1019 | { | 1003 | { |
1020 | dprintk(3, "entry"); | 1004 | pr_debug("entry"); |
1021 | wl3501_get_from_wla(this, addr, &this->sig_get_confirm, | 1005 | wl3501_get_from_wla(this, addr, &this->sig_get_confirm, |
1022 | sizeof(this->sig_get_confirm)); | 1006 | sizeof(this->sig_get_confirm)); |
1023 | wake_up(&this->wait); | 1007 | wake_up(&this->wait); |
@@ -1029,7 +1013,7 @@ static inline void wl3501_start_confirm_interrupt(struct net_device *dev, | |||
1029 | { | 1013 | { |
1030 | struct wl3501_start_confirm sig; | 1014 | struct wl3501_start_confirm sig; |
1031 | 1015 | ||
1032 | dprintk(3, "entry"); | 1016 | pr_debug("entry"); |
1033 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 1017 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
1034 | if (sig.status == WL3501_STATUS_SUCCESS) | 1018 | if (sig.status == WL3501_STATUS_SUCCESS) |
1035 | netif_wake_queue(dev); | 1019 | netif_wake_queue(dev); |
@@ -1041,7 +1025,7 @@ static inline void wl3501_assoc_confirm_interrupt(struct net_device *dev, | |||
1041 | struct wl3501_card *this = netdev_priv(dev); | 1025 | struct wl3501_card *this = netdev_priv(dev); |
1042 | struct wl3501_assoc_confirm sig; | 1026 | struct wl3501_assoc_confirm sig; |
1043 | 1027 | ||
1044 | dprintk(3, "entry"); | 1028 | pr_debug("entry"); |
1045 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 1029 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
1046 | 1030 | ||
1047 | if (sig.status == WL3501_STATUS_SUCCESS) | 1031 | if (sig.status == WL3501_STATUS_SUCCESS) |
@@ -1053,7 +1037,7 @@ static inline void wl3501_auth_confirm_interrupt(struct wl3501_card *this, | |||
1053 | { | 1037 | { |
1054 | struct wl3501_auth_confirm sig; | 1038 | struct wl3501_auth_confirm sig; |
1055 | 1039 | ||
1056 | dprintk(3, "entry"); | 1040 | pr_debug("entry"); |
1057 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); | 1041 | wl3501_get_from_wla(this, addr, &sig, sizeof(sig)); |
1058 | 1042 | ||
1059 | if (sig.status == WL3501_STATUS_SUCCESS) | 1043 | if (sig.status == WL3501_STATUS_SUCCESS) |
@@ -1069,7 +1053,7 @@ static inline void wl3501_rx_interrupt(struct net_device *dev) | |||
1069 | u8 sig_id; | 1053 | u8 sig_id; |
1070 | struct wl3501_card *this = netdev_priv(dev); | 1054 | struct wl3501_card *this = netdev_priv(dev); |
1071 | 1055 | ||
1072 | dprintk(3, "entry"); | 1056 | pr_debug("entry"); |
1073 | loop: | 1057 | loop: |
1074 | morepkts = 0; | 1058 | morepkts = 0; |
1075 | if (!wl3501_esbq_confirm(this)) | 1059 | if (!wl3501_esbq_confirm(this)) |
@@ -1302,7 +1286,7 @@ static int wl3501_reset(struct net_device *dev) | |||
1302 | wl3501_ack_interrupt(this); | 1286 | wl3501_ack_interrupt(this); |
1303 | wl3501_unblock_interrupt(this); | 1287 | wl3501_unblock_interrupt(this); |
1304 | wl3501_mgmt_scan(this, 100); | 1288 | wl3501_mgmt_scan(this, 100); |
1305 | dprintk(1, "%s: device reset", dev->name); | 1289 | pr_debug("%s: device reset", dev->name); |
1306 | rc = 0; | 1290 | rc = 0; |
1307 | out: | 1291 | out: |
1308 | return rc; | 1292 | return rc; |
@@ -1376,7 +1360,7 @@ static int wl3501_open(struct net_device *dev) | |||
1376 | link->open++; | 1360 | link->open++; |
1377 | 1361 | ||
1378 | /* Initial WL3501 firmware */ | 1362 | /* Initial WL3501 firmware */ |
1379 | dprintk(1, "%s: Initialize WL3501 firmware...", dev->name); | 1363 | pr_debug("%s: Initialize WL3501 firmware...", dev->name); |
1380 | if (wl3501_init_firmware(this)) | 1364 | if (wl3501_init_firmware(this)) |
1381 | goto fail; | 1365 | goto fail; |
1382 | /* Initial device variables */ | 1366 | /* Initial device variables */ |
@@ -1388,7 +1372,7 @@ static int wl3501_open(struct net_device *dev) | |||
1388 | wl3501_unblock_interrupt(this); | 1372 | wl3501_unblock_interrupt(this); |
1389 | wl3501_mgmt_scan(this, 100); | 1373 | wl3501_mgmt_scan(this, 100); |
1390 | rc = 0; | 1374 | rc = 0; |
1391 | dprintk(1, "%s: WL3501 opened", dev->name); | 1375 | pr_debug("%s: WL3501 opened", dev->name); |
1392 | printk(KERN_INFO "%s: Card Name: %s\n" | 1376 | printk(KERN_INFO "%s: Card Name: %s\n" |
1393 | "%s: Firmware Date: %s\n", | 1377 | "%s: Firmware Date: %s\n", |
1394 | dev->name, this->card_name, | 1378 | dev->name, this->card_name, |
@@ -1914,8 +1898,7 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
1914 | p_dev->io.IOAddrLines = 5; | 1898 | p_dev->io.IOAddrLines = 5; |
1915 | 1899 | ||
1916 | /* Interrupt setup */ | 1900 | /* Interrupt setup */ |
1917 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; | 1901 | p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; |
1918 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
1919 | p_dev->irq.Handler = wl3501_interrupt; | 1902 | p_dev->irq.Handler = wl3501_interrupt; |
1920 | 1903 | ||
1921 | /* General socket configuration */ | 1904 | /* General socket configuration */ |
@@ -1938,16 +1921,13 @@ static int wl3501_probe(struct pcmcia_device *p_dev) | |||
1938 | dev->wireless_handlers = &wl3501_handler_def; | 1921 | dev->wireless_handlers = &wl3501_handler_def; |
1939 | SET_ETHTOOL_OPS(dev, &ops); | 1922 | SET_ETHTOOL_OPS(dev, &ops); |
1940 | netif_stop_queue(dev); | 1923 | netif_stop_queue(dev); |
1941 | p_dev->priv = p_dev->irq.Instance = dev; | 1924 | p_dev->priv = dev; |
1942 | 1925 | ||
1943 | return wl3501_config(p_dev); | 1926 | return wl3501_config(p_dev); |
1944 | out_link: | 1927 | out_link: |
1945 | return -ENOMEM; | 1928 | return -ENOMEM; |
1946 | } | 1929 | } |
1947 | 1930 | ||
1948 | #define CS_CHECK(fn, ret) \ | ||
1949 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
1950 | |||
1951 | /** | 1931 | /** |
1952 | * wl3501_config - configure the PCMCIA socket and make eth device available | 1932 | * wl3501_config - configure the PCMCIA socket and make eth device available |
1953 | * @link - FILL_IN | 1933 | * @link - FILL_IN |
@@ -1959,7 +1939,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | |||
1959 | static int wl3501_config(struct pcmcia_device *link) | 1939 | static int wl3501_config(struct pcmcia_device *link) |
1960 | { | 1940 | { |
1961 | struct net_device *dev = link->priv; | 1941 | struct net_device *dev = link->priv; |
1962 | int i = 0, j, last_fn, last_ret; | 1942 | int i = 0, j, ret; |
1963 | struct wl3501_card *this; | 1943 | struct wl3501_card *this; |
1964 | 1944 | ||
1965 | /* Try allocating IO ports. This tries a few fixed addresses. If you | 1945 | /* Try allocating IO ports. This tries a few fixed addresses. If you |
@@ -1975,24 +1955,26 @@ static int wl3501_config(struct pcmcia_device *link) | |||
1975 | if (i == 0) | 1955 | if (i == 0) |
1976 | break; | 1956 | break; |
1977 | } | 1957 | } |
1978 | if (i != 0) { | 1958 | if (i != 0) |
1979 | cs_error(link, RequestIO, i); | ||
1980 | goto failed; | 1959 | goto failed; |
1981 | } | ||
1982 | 1960 | ||
1983 | /* Now allocate an interrupt line. Note that this does not actually | 1961 | /* Now allocate an interrupt line. Note that this does not actually |
1984 | * assign a handler to the interrupt. */ | 1962 | * assign a handler to the interrupt. */ |
1985 | 1963 | ||
1986 | CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); | 1964 | ret = pcmcia_request_irq(link, &link->irq); |
1965 | if (ret) | ||
1966 | goto failed; | ||
1987 | 1967 | ||
1988 | /* This actually configures the PCMCIA socket -- setting up the I/O | 1968 | /* This actually configures the PCMCIA socket -- setting up the I/O |
1989 | * windows and the interrupt mapping. */ | 1969 | * windows and the interrupt mapping. */ |
1990 | 1970 | ||
1991 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 1971 | ret = pcmcia_request_configuration(link, &link->conf); |
1972 | if (ret) | ||
1973 | goto failed; | ||
1992 | 1974 | ||
1993 | dev->irq = link->irq.AssignedIRQ; | 1975 | dev->irq = link->irq.AssignedIRQ; |
1994 | dev->base_addr = link->io.BasePort1; | 1976 | dev->base_addr = link->io.BasePort1; |
1995 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 1977 | SET_NETDEV_DEV(dev, &link->dev); |
1996 | if (register_netdev(dev)) { | 1978 | if (register_netdev(dev)) { |
1997 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); | 1979 | printk(KERN_NOTICE "wl3501_cs: register_netdev() failed\n"); |
1998 | goto failed; | 1980 | goto failed; |
@@ -2041,8 +2023,6 @@ static int wl3501_config(struct pcmcia_device *link) | |||
2041 | netif_start_queue(dev); | 2023 | netif_start_queue(dev); |
2042 | return 0; | 2024 | return 0; |
2043 | 2025 | ||
2044 | cs_failed: | ||
2045 | cs_error(link, last_fn, last_ret); | ||
2046 | failed: | 2026 | failed: |
2047 | wl3501_release(link); | 2027 | wl3501_release(link); |
2048 | return -ENODEV; | 2028 | return -ENODEV; |