diff options
Diffstat (limited to 'drivers/net/wireless/spectrum_cs.c')
-rw-r--r-- | drivers/net/wireless/spectrum_cs.c | 81 |
1 files changed, 29 insertions, 52 deletions
diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index f7b77ce54d7b..7f9aa139c347 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for 802.11b cards using RAM-loadable Symbol firmware, such as | 2 | * Driver for 802.11b cards using RAM-loadable Symbol firmware, such as |
3 | * Symbol Wireless Networker LA4100, CompactFlash cards by Socket | 3 | * Symbol Wireless Networker LA4137, CompactFlash cards by Socket |
4 | * Communications and Intel PRO/Wireless 2011B. | 4 | * Communications and Intel PRO/Wireless 2011B. |
5 | * | 5 | * |
6 | * The driver implements Symbol firmware download. The rest is handled | 6 | * The driver implements Symbol firmware download. The rest is handled |
@@ -120,8 +120,8 @@ static void spectrum_cs_release(struct pcmcia_device *link); | |||
120 | * Each block has the following structure. | 120 | * Each block has the following structure. |
121 | */ | 121 | */ |
122 | struct dblock { | 122 | struct dblock { |
123 | __le32 _addr; /* adapter address where to write the block */ | 123 | __le32 addr; /* adapter address where to write the block */ |
124 | __le16 _len; /* length of the data only, in bytes */ | 124 | __le16 len; /* length of the data only, in bytes */ |
125 | char data[0]; /* data to be written */ | 125 | char data[0]; /* data to be written */ |
126 | } __attribute__ ((packed)); | 126 | } __attribute__ ((packed)); |
127 | 127 | ||
@@ -131,9 +131,9 @@ struct dblock { | |||
131 | * items with matching ID should be written. | 131 | * items with matching ID should be written. |
132 | */ | 132 | */ |
133 | struct pdr { | 133 | struct pdr { |
134 | __le32 _id; /* record ID */ | 134 | __le32 id; /* record ID */ |
135 | __le32 _addr; /* adapter address where to write the data */ | 135 | __le32 addr; /* adapter address where to write the data */ |
136 | __le32 _len; /* expected length of the data, in bytes */ | 136 | __le32 len; /* expected length of the data, in bytes */ |
137 | char next[0]; /* next PDR starts here */ | 137 | char next[0]; /* next PDR starts here */ |
138 | } __attribute__ ((packed)); | 138 | } __attribute__ ((packed)); |
139 | 139 | ||
@@ -144,8 +144,8 @@ struct pdr { | |||
144 | * be plugged into the secondary firmware. | 144 | * be plugged into the secondary firmware. |
145 | */ | 145 | */ |
146 | struct pdi { | 146 | struct pdi { |
147 | __le16 _len; /* length of ID and data, in words */ | 147 | __le16 len; /* length of ID and data, in words */ |
148 | __le16 _id; /* record ID */ | 148 | __le16 id; /* record ID */ |
149 | char data[0]; /* plug data */ | 149 | char data[0]; /* plug data */ |
150 | } __attribute__ ((packed)); | 150 | } __attribute__ ((packed)); |
151 | 151 | ||
@@ -154,44 +154,44 @@ struct pdi { | |||
154 | static inline u32 | 154 | static inline u32 |
155 | dblock_addr(const struct dblock *blk) | 155 | dblock_addr(const struct dblock *blk) |
156 | { | 156 | { |
157 | return le32_to_cpu(blk->_addr); | 157 | return le32_to_cpu(blk->addr); |
158 | } | 158 | } |
159 | 159 | ||
160 | static inline u32 | 160 | static inline u32 |
161 | dblock_len(const struct dblock *blk) | 161 | dblock_len(const struct dblock *blk) |
162 | { | 162 | { |
163 | return le16_to_cpu(blk->_len); | 163 | return le16_to_cpu(blk->len); |
164 | } | 164 | } |
165 | 165 | ||
166 | static inline u32 | 166 | static inline u32 |
167 | pdr_id(const struct pdr *pdr) | 167 | pdr_id(const struct pdr *pdr) |
168 | { | 168 | { |
169 | return le32_to_cpu(pdr->_id); | 169 | return le32_to_cpu(pdr->id); |
170 | } | 170 | } |
171 | 171 | ||
172 | static inline u32 | 172 | static inline u32 |
173 | pdr_addr(const struct pdr *pdr) | 173 | pdr_addr(const struct pdr *pdr) |
174 | { | 174 | { |
175 | return le32_to_cpu(pdr->_addr); | 175 | return le32_to_cpu(pdr->addr); |
176 | } | 176 | } |
177 | 177 | ||
178 | static inline u32 | 178 | static inline u32 |
179 | pdr_len(const struct pdr *pdr) | 179 | pdr_len(const struct pdr *pdr) |
180 | { | 180 | { |
181 | return le32_to_cpu(pdr->_len); | 181 | return le32_to_cpu(pdr->len); |
182 | } | 182 | } |
183 | 183 | ||
184 | static inline u32 | 184 | static inline u32 |
185 | pdi_id(const struct pdi *pdi) | 185 | pdi_id(const struct pdi *pdi) |
186 | { | 186 | { |
187 | return le16_to_cpu(pdi->_id); | 187 | return le16_to_cpu(pdi->id); |
188 | } | 188 | } |
189 | 189 | ||
190 | /* Return length of the data only, in bytes */ | 190 | /* Return length of the data only, in bytes */ |
191 | static inline u32 | 191 | static inline u32 |
192 | pdi_len(const struct pdi *pdi) | 192 | pdi_len(const struct pdi *pdi) |
193 | { | 193 | { |
194 | return 2 * (le16_to_cpu(pdi->_len) - 1); | 194 | return 2 * (le16_to_cpu(pdi->len) - 1); |
195 | } | 195 | } |
196 | 196 | ||
197 | 197 | ||
@@ -343,8 +343,7 @@ spectrum_plug_pdi(hermes_t *hw, struct pdr *first_pdr, struct pdi *pdi) | |||
343 | 343 | ||
344 | /* do the actual plugging */ | 344 | /* do the actual plugging */ |
345 | spectrum_aux_setaddr(hw, pdr_addr(pdr)); | 345 | spectrum_aux_setaddr(hw, pdr_addr(pdr)); |
346 | hermes_write_words(hw, HERMES_AUXDATA, pdi->data, | 346 | hermes_write_bytes(hw, HERMES_AUXDATA, pdi->data, pdi_len(pdi)); |
347 | pdi_len(pdi) / 2); | ||
348 | 347 | ||
349 | return 0; | 348 | return 0; |
350 | } | 349 | } |
@@ -424,8 +423,8 @@ spectrum_load_blocks(hermes_t *hw, const struct dblock *first_block) | |||
424 | 423 | ||
425 | while (dblock_addr(blk) != BLOCK_END) { | 424 | while (dblock_addr(blk) != BLOCK_END) { |
426 | spectrum_aux_setaddr(hw, blkaddr); | 425 | spectrum_aux_setaddr(hw, blkaddr); |
427 | hermes_write_words(hw, HERMES_AUXDATA, blk->data, | 426 | hermes_write_bytes(hw, HERMES_AUXDATA, blk->data, |
428 | blklen / 2); | 427 | blklen); |
429 | 428 | ||
430 | blk = (struct dblock *) &blk->data[blklen]; | 429 | blk = (struct dblock *) &blk->data[blklen]; |
431 | blkaddr = dblock_addr(blk); | 430 | blkaddr = dblock_addr(blk); |
@@ -626,14 +625,11 @@ static void spectrum_cs_detach(struct pcmcia_device *link) | |||
626 | { | 625 | { |
627 | struct net_device *dev = link->priv; | 626 | struct net_device *dev = link->priv; |
628 | 627 | ||
628 | if (link->dev_node) | ||
629 | unregister_netdev(dev); | ||
630 | |||
629 | spectrum_cs_release(link); | 631 | spectrum_cs_release(link); |
630 | 632 | ||
631 | DEBUG(0, PFX "detach: link=%p link->dev_node=%p\n", link, link->dev_node); | ||
632 | if (link->dev_node) { | ||
633 | DEBUG(0, PFX "About to unregister net device %p\n", | ||
634 | dev); | ||
635 | unregister_netdev(dev); | ||
636 | } | ||
637 | free_orinocodev(dev); | 633 | free_orinocodev(dev); |
638 | } /* spectrum_cs_detach */ | 634 | } /* spectrum_cs_detach */ |
639 | 635 | ||
@@ -653,13 +649,10 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
653 | int last_fn, last_ret; | 649 | int last_fn, last_ret; |
654 | u_char buf[64]; | 650 | u_char buf[64]; |
655 | config_info_t conf; | 651 | config_info_t conf; |
656 | cisinfo_t info; | ||
657 | tuple_t tuple; | 652 | tuple_t tuple; |
658 | cisparse_t parse; | 653 | cisparse_t parse; |
659 | void __iomem *mem; | 654 | void __iomem *mem; |
660 | 655 | ||
661 | CS_CHECK(ValidateCIS, pcmcia_validate_cis(link, &info)); | ||
662 | |||
663 | /* | 656 | /* |
664 | * This reads the card's CONFIG tuple to find its | 657 | * This reads the card's CONFIG tuple to find its |
665 | * configuration registers. | 658 | * configuration registers. |
@@ -709,12 +702,6 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
709 | goto next_entry; | 702 | goto next_entry; |
710 | link->conf.ConfigIndex = cfg->index; | 703 | link->conf.ConfigIndex = cfg->index; |
711 | 704 | ||
712 | /* Does this card need audio output? */ | ||
713 | if (cfg->flags & CISTPL_CFTABLE_AUDIO) { | ||
714 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
715 | link->conf.Status = CCSR_AUDIO_ENA; | ||
716 | } | ||
717 | |||
718 | /* Use power settings for Vcc and Vpp if present */ | 705 | /* Use power settings for Vcc and Vpp if present */ |
719 | /* Note that the CIS values need to be rescaled */ | 706 | /* Note that the CIS values need to be rescaled */ |
720 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { | 707 | if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { |
@@ -835,19 +822,10 @@ spectrum_cs_config(struct pcmcia_device *link) | |||
835 | net_device has been registered */ | 822 | net_device has been registered */ |
836 | 823 | ||
837 | /* Finally, report what we've done */ | 824 | /* Finally, report what we've done */ |
838 | printk(KERN_DEBUG "%s: index 0x%02x: ", | 825 | printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io " |
839 | dev->name, link->conf.ConfigIndex); | 826 | "0x%04x-0x%04x\n", dev->name, dev->class_dev.dev->bus_id, |
840 | if (link->conf.Vpp) | 827 | link->irq.AssignedIRQ, link->io.BasePort1, |
841 | printk(", Vpp %d.%d", link->conf.Vpp / 10, | 828 | link->io.BasePort1 + link->io.NumPorts1 - 1); |
842 | link->conf.Vpp % 10); | ||
843 | printk(", irq %d", link->irq.AssignedIRQ); | ||
844 | if (link->io.NumPorts1) | ||
845 | printk(", io 0x%04x-0x%04x", link->io.BasePort1, | ||
846 | link->io.BasePort1 + link->io.NumPorts1 - 1); | ||
847 | if (link->io.NumPorts2) | ||
848 | printk(" & 0x%04x-0x%04x", link->io.BasePort2, | ||
849 | link->io.BasePort2 + link->io.NumPorts2 - 1); | ||
850 | printk("\n"); | ||
851 | 829 | ||
852 | return 0; | 830 | return 0; |
853 | 831 | ||
@@ -888,11 +866,10 @@ spectrum_cs_suspend(struct pcmcia_device *link) | |||
888 | { | 866 | { |
889 | struct net_device *dev = link->priv; | 867 | struct net_device *dev = link->priv; |
890 | struct orinoco_private *priv = netdev_priv(dev); | 868 | struct orinoco_private *priv = netdev_priv(dev); |
891 | unsigned long flags; | ||
892 | int err = 0; | 869 | int err = 0; |
893 | 870 | ||
894 | /* Mark the device as stopped, to block IO until later */ | 871 | /* Mark the device as stopped, to block IO until later */ |
895 | spin_lock_irqsave(&priv->lock, flags); | 872 | spin_lock(&priv->lock); |
896 | 873 | ||
897 | err = __orinoco_down(dev); | 874 | err = __orinoco_down(dev); |
898 | if (err) | 875 | if (err) |
@@ -902,9 +879,9 @@ spectrum_cs_suspend(struct pcmcia_device *link) | |||
902 | netif_device_detach(dev); | 879 | netif_device_detach(dev); |
903 | priv->hw_unavailable++; | 880 | priv->hw_unavailable++; |
904 | 881 | ||
905 | spin_unlock_irqrestore(&priv->lock, flags); | 882 | spin_unlock(&priv->lock); |
906 | 883 | ||
907 | return 0; | 884 | return err; |
908 | } | 885 | } |
909 | 886 | ||
910 | static int | 887 | static int |
@@ -932,7 +909,7 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION | |||
932 | " David Gibson <hermes@gibson.dropbear.id.au>, et al)"; | 909 | " David Gibson <hermes@gibson.dropbear.id.au>, et al)"; |
933 | 910 | ||
934 | static struct pcmcia_device_id spectrum_cs_ids[] = { | 911 | static struct pcmcia_device_id spectrum_cs_ids[] = { |
935 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4100 */ | 912 | PCMCIA_DEVICE_MANF_CARD(0x026c, 0x0001), /* Symbol Spectrum24 LA4137 */ |
936 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ | 913 | PCMCIA_DEVICE_MANF_CARD(0x0104, 0x0001), /* Socket Communications CF */ |
937 | PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless LAN PC Card", 0x816cc815, 0x6fbf459a), /* 2011B, not 2011 */ | 914 | PCMCIA_DEVICE_PROD_ID12("Intel", "PRO/Wireless LAN PC Card", 0x816cc815, 0x6fbf459a), /* 2011B, not 2011 */ |
938 | PCMCIA_DEVICE_NULL, | 915 | PCMCIA_DEVICE_NULL, |