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.
24 #include <linux/ssb/ssb.h>
26 #include <pcmcia/cs_types.h>
27 #include <pcmcia/cs.h>
28 #include <pcmcia/cistpl.h>
29 #include <pcmcia/ciscode.h>
30 #include <pcmcia/ds.h>
31 #include <pcmcia/cisreg.h>
33 static /*const */ struct pcmcia_device_id b43_pcmcia_tbl
[] = {
34 PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448),
38 MODULE_DEVICE_TABLE(pcmcia
, b43_pcmcia_tbl
);
41 static int b43_pcmcia_suspend(struct pcmcia_device
*dev
)
47 static int b43_pcmcia_resume(struct pcmcia_device
*dev
)
53 # define b43_pcmcia_suspend NULL
54 # define b43_pcmcia_resume NULL
55 #endif /* CONFIG_PM */
57 static int __devinit
b43_pcmcia_probe(struct pcmcia_device
*dev
)
66 unsigned char buf
[64];
68 ssb
= kzalloc(sizeof(*ssb
), GFP_KERNEL
);
73 tuple
.DesiredTuple
= CISTPL_CONFIG
;
75 tuple
.TupleData
= buf
;
76 tuple
.TupleDataMax
= sizeof(buf
);
77 tuple
.TupleOffset
= 0;
79 res
= pcmcia_get_first_tuple(dev
, &tuple
);
80 if (res
!= CS_SUCCESS
)
82 res
= pcmcia_get_tuple_data(dev
, &tuple
);
83 if (res
!= CS_SUCCESS
)
85 res
= pcmcia_parse_tuple(dev
, &tuple
, &parse
);
86 if (res
!= CS_SUCCESS
)
89 dev
->conf
.ConfigBase
= parse
.config
.base
;
90 dev
->conf
.Present
= parse
.config
.rmask
[0];
92 dev
->io
.BasePort2
= 0;
93 dev
->io
.NumPorts2
= 0;
94 dev
->io
.Attributes2
= 0;
96 win
.Attributes
= WIN_MEMORY_TYPE_CM
| WIN_ENABLE
| WIN_USE_WAIT
;
98 win
.Size
= SSB_CORE_SIZE
;
99 win
.AccessSpeed
= 1000;
100 res
= pcmcia_request_window(&dev
, &win
, &dev
->win
);
101 if (res
!= CS_SUCCESS
)
106 res
= pcmcia_map_mem_page(dev
->win
, &mem
);
107 if (res
!= CS_SUCCESS
)
110 res
= pcmcia_request_configuration(dev
, &dev
->conf
);
111 if (res
!= CS_SUCCESS
)
114 err
= ssb_bus_pcmciabus_register(ssb
, dev
, win
.Base
);
120 pcmcia_disable_device(dev
);
126 static void __devexit
b43_pcmcia_remove(struct pcmcia_device
*dev
)
128 struct ssb_bus
*ssb
= dev
->priv
;
130 ssb_bus_unregister(ssb
);
131 pcmcia_release_window(dev
->win
);
132 pcmcia_disable_device(dev
);
137 static struct pcmcia_driver b43_pcmcia_driver
= {
138 .owner
= THIS_MODULE
,
140 .name
= "b43-pcmcia",
142 .id_table
= b43_pcmcia_tbl
,
143 .probe
= b43_pcmcia_probe
,
144 .remove
= b43_pcmcia_remove
,
145 .suspend
= b43_pcmcia_suspend
,
146 .resume
= b43_pcmcia_resume
,
149 int b43_pcmcia_init(void)
151 return pcmcia_register_driver(&b43_pcmcia_driver
);
154 void b43_pcmcia_exit(void)
156 pcmcia_unregister_driver(&b43_pcmcia_driver
);