3 Broadcom BCM43xx 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>
34 static /*const*/ struct pcmcia_device_id bcm43xx_pcmcia_tbl
[] = {
35 PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448),
38 MODULE_DEVICE_TABLE(pcmcia
, bcm43xx_pcmcia_tbl
);
42 static int bcm43xx_pcmcia_suspend(struct pcmcia_device
*dev
)
48 static int bcm43xx_pcmcia_resume(struct pcmcia_device
*dev
)
54 # define bcm43xx_pcmcia_suspend NULL
55 # define bcm43xx_pcmcia_resume NULL
56 #endif /* CONFIG_PM */
58 static void bcm43xx_pcmcia_fill_sprom(struct ssb_sprom
*sprom
)
62 static int __devinit
bcm43xx_pcmcia_probe(struct pcmcia_device
*dev
)
71 unsigned char buf
[64];
73 ssb
= kzalloc(sizeof(*ssb
), GFP_KERNEL
);
78 tuple
.DesiredTuple
= CISTPL_CONFIG
;
80 tuple
.TupleData
= buf
;
81 tuple
.TupleDataMax
= sizeof(buf
);
82 tuple
.TupleOffset
= 0;
84 res
= pcmcia_get_first_tuple(dev
, &tuple
);
85 if (res
!= CS_SUCCESS
)
87 res
= pcmcia_get_tuple_data(dev
, &tuple
);
88 if (res
!= CS_SUCCESS
)
90 res
= pcmcia_parse_tuple(dev
, &tuple
, &parse
);
91 if (res
!= CS_SUCCESS
)
94 dev
->conf
.ConfigBase
= parse
.config
.base
;
95 dev
->conf
.Present
= parse
.config
.rmask
[0];
97 dev
->io
.BasePort2
= 0;
98 dev
->io
.NumPorts2
= 0;
99 dev
->io
.Attributes2
= 0;
101 win
.Attributes
= WIN_MEMORY_TYPE_CM
| WIN_ENABLE
| WIN_USE_WAIT
;
103 win
.Size
= SSB_CORE_SIZE
;
104 win
.AccessSpeed
= 1000;
105 res
= pcmcia_request_window(&dev
, &win
, &dev
->win
);
106 if (res
!= CS_SUCCESS
)
111 res
= pcmcia_map_mem_page(dev
->win
, &mem
);
112 if (res
!= CS_SUCCESS
)
115 res
= pcmcia_request_configuration(dev
, &dev
->conf
);
116 if (res
!= CS_SUCCESS
)
119 err
= ssb_bus_pcmciabus_register(ssb
, dev
, win
.Base
,
120 bcm43xx_pcmcia_fill_sprom
);
126 pcmcia_disable_device(dev
);
132 static void __devexit
bcm43xx_pcmcia_remove(struct pcmcia_device
*dev
)
134 struct ssb_bus
*ssb
= dev
->priv
;
136 ssb_bus_unregister(ssb
);
137 pcmcia_release_window(dev
->win
);
138 pcmcia_disable_device(dev
);
143 static struct pcmcia_driver bcm43xx_pcmcia_driver
= {
144 .owner
= THIS_MODULE
,
146 .name
= "bcm43xx-pcmcia",
148 .id_table
= bcm43xx_pcmcia_tbl
,
149 .probe
= bcm43xx_pcmcia_probe
,
150 .remove
= bcm43xx_pcmcia_remove
,
151 .suspend
= bcm43xx_pcmcia_suspend
,
152 .resume
= bcm43xx_pcmcia_resume
,
155 int bcm43xx_pcmcia_init(void)
157 return pcmcia_register_driver(&bcm43xx_pcmcia_driver
);
160 void bcm43xx_pcmcia_exit(void)
162 pcmcia_unregister_driver(&bcm43xx_pcmcia_driver
);