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 int __devinit
bcm43xx_pcmcia_probe(struct pcmcia_device
*dev
)
67 unsigned char buf
[64];
69 ssb
= kzalloc(sizeof(*ssb
), GFP_KERNEL
);
74 tuple
.DesiredTuple
= CISTPL_CONFIG
;
76 tuple
.TupleData
= buf
;
77 tuple
.TupleDataMax
= sizeof(buf
);
78 tuple
.TupleOffset
= 0;
80 res
= pcmcia_get_first_tuple(dev
, &tuple
);
81 if (res
!= CS_SUCCESS
)
83 res
= pcmcia_get_tuple_data(dev
, &tuple
);
84 if (res
!= CS_SUCCESS
)
86 res
= pcmcia_parse_tuple(dev
, &tuple
, &parse
);
87 if (res
!= CS_SUCCESS
)
90 dev
->conf
.ConfigBase
= parse
.config
.base
;
91 dev
->conf
.Present
= parse
.config
.rmask
[0];
93 dev
->io
.BasePort2
= 0;
94 dev
->io
.NumPorts2
= 0;
95 dev
->io
.Attributes2
= 0;
97 win
.Attributes
= WIN_MEMORY_TYPE_CM
| WIN_ENABLE
| WIN_USE_WAIT
;
99 win
.Size
= SSB_CORE_SIZE
;
100 win
.AccessSpeed
= 1000;
101 res
= pcmcia_request_window(&dev
, &win
, &dev
->win
);
102 if (res
!= CS_SUCCESS
)
107 res
= pcmcia_map_mem_page(dev
->win
, &mem
);
108 if (res
!= CS_SUCCESS
)
111 res
= pcmcia_request_configuration(dev
, &dev
->conf
);
112 if (res
!= CS_SUCCESS
)
115 err
= ssb_bus_pcmciabus_register(ssb
, dev
, win
.Base
);
121 pcmcia_disable_device(dev
);
127 static void __devexit
bcm43xx_pcmcia_remove(struct pcmcia_device
*dev
)
129 struct ssb_bus
*ssb
= dev
->priv
;
131 ssb_bus_unregister(ssb
);
132 pcmcia_release_window(dev
->win
);
133 pcmcia_disable_device(dev
);
138 static struct pcmcia_driver bcm43xx_pcmcia_driver
= {
139 .owner
= THIS_MODULE
,
141 .name
= "bcm43xx-pcmcia",
143 .id_table
= bcm43xx_pcmcia_tbl
,
144 .probe
= bcm43xx_pcmcia_probe
,
145 .remove
= bcm43xx_pcmcia_remove
,
146 .suspend
= bcm43xx_pcmcia_suspend
,
147 .resume
= bcm43xx_pcmcia_resume
,
150 int bcm43xx_pcmcia_init(void)
152 return pcmcia_register_driver(&bcm43xx_pcmcia_driver
);
155 void bcm43xx_pcmcia_exit(void)
157 pcmcia_unregister_driver(&bcm43xx_pcmcia_driver
);