3 Broadcom B43 wireless driver
5 Copyright (c) 2007 Michael Buesch <mb@bu3sch.de>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
20 Boston, MA 02110-1301, USA.
26 #include <linux/ssb/ssb.h>
27 #include <linux/slab.h>
29 #include <pcmcia/cs_types.h>
30 #include <pcmcia/cs.h>
31 #include <pcmcia/cistpl.h>
32 #include <pcmcia/ciscode.h>
33 #include <pcmcia/ds.h>
34 #include <pcmcia/cisreg.h>
37 static /*const */ struct pcmcia_device_id b43_pcmcia_tbl
[] = {
38 PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448),
39 PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x476),
43 MODULE_DEVICE_TABLE(pcmcia
, b43_pcmcia_tbl
);
46 static int b43_pcmcia_suspend(struct pcmcia_device
*dev
)
48 struct ssb_bus
*ssb
= dev
->priv
;
50 return ssb_bus_suspend(ssb
);
53 static int b43_pcmcia_resume(struct pcmcia_device
*dev
)
55 struct ssb_bus
*ssb
= dev
->priv
;
57 return ssb_bus_resume(ssb
);
60 # define b43_pcmcia_suspend NULL
61 # define b43_pcmcia_resume NULL
62 #endif /* CONFIG_PM */
64 static int __devinit
b43_pcmcia_probe(struct pcmcia_device
*dev
)
72 ssb
= kzalloc(sizeof(*ssb
), GFP_KERNEL
);
78 dev
->conf
.Attributes
= CONF_ENABLE_IRQ
;
79 dev
->conf
.IntType
= INT_MEMORY_AND_IO
;
81 dev
->io
.BasePort2
= 0;
82 dev
->io
.NumPorts2
= 0;
83 dev
->io
.Attributes2
= 0;
85 win
.Attributes
= WIN_ADDR_SPACE_MEM
| WIN_MEMORY_TYPE_CM
|
86 WIN_ENABLE
| WIN_DATA_WIDTH_16
|
89 win
.Size
= SSB_CORE_SIZE
;
90 win
.AccessSpeed
= 250;
91 res
= pcmcia_request_window(dev
, &win
, &dev
->win
);
97 res
= pcmcia_map_mem_page(dev
, dev
->win
, &mem
);
101 dev
->irq
.Attributes
= IRQ_TYPE_DYNAMIC_SHARING
;
102 dev
->irq
.Handler
= NULL
; /* The handler is registered later. */
103 res
= pcmcia_request_irq(dev
, &dev
->irq
);
107 res
= pcmcia_request_configuration(dev
, &dev
->conf
);
111 err
= ssb_bus_pcmciabus_register(ssb
, dev
, win
.Base
);
119 pcmcia_disable_device(dev
);
123 printk(KERN_ERR
"b43-pcmcia: Initialization failed (%d, %d)\n",
128 static void __devexit
b43_pcmcia_remove(struct pcmcia_device
*dev
)
130 struct ssb_bus
*ssb
= dev
->priv
;
132 ssb_bus_unregister(ssb
);
133 pcmcia_disable_device(dev
);
138 static struct pcmcia_driver b43_pcmcia_driver
= {
139 .owner
= THIS_MODULE
,
141 .name
= "b43-pcmcia",
143 .id_table
= b43_pcmcia_tbl
,
144 .probe
= b43_pcmcia_probe
,
145 .remove
= __devexit_p(b43_pcmcia_remove
),
146 .suspend
= b43_pcmcia_suspend
,
147 .resume
= b43_pcmcia_resume
,
150 int b43_pcmcia_init(void)
152 return pcmcia_register_driver(&b43_pcmcia_driver
);
155 void b43_pcmcia_exit(void)
157 pcmcia_unregister_driver(&b43_pcmcia_driver
);