aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/b43/Kconfig20
-rw-r--r--drivers/net/wireless/b43/Makefile1
-rw-r--r--drivers/net/wireless/b43/main.c9
-rw-r--r--drivers/net/wireless/b43/pcmcia.c145
-rw-r--r--drivers/net/wireless/b43/pcmcia.h20
-rw-r--r--drivers/ssb/Makefile2
-rw-r--r--drivers/ssb/bridge_pcmcia_80211.c128
-rw-r--r--drivers/ssb/main.c8
-rw-r--r--drivers/ssb/ssb_private.h9
9 files changed, 146 insertions, 196 deletions
diff --git a/drivers/net/wireless/b43/Kconfig b/drivers/net/wireless/b43/Kconfig
index 759fb8d41fc9..fba856032ca5 100644
--- a/drivers/net/wireless/b43/Kconfig
+++ b/drivers/net/wireless/b43/Kconfig
@@ -71,26 +71,6 @@ config B43_PCICORE_AUTOSELECT
71 select SSB_DRIVER_PCICORE 71 select SSB_DRIVER_PCICORE
72 default y 72 default y
73 73
74config B43_PCMCIA
75 bool "Broadcom 43xx PCMCIA device support"
76 depends on B43 && B43_SSB && SSB_PCMCIAHOST_POSSIBLE
77 select SSB_PCMCIAHOST
78 ---help---
79 Broadcom 43xx PCMCIA device support.
80
81 Support for 16bit PCMCIA devices.
82 Please note that most PC-CARD devices are _NOT_ 16bit PCMCIA
83 devices, but 32bit CardBUS devices. CardBUS devices are supported
84 out of the box by b43.
85
86 With this config option you can drive b43 cards in
87 CompactFlash formfactor in a PCMCIA adaptor.
88 CF b43 cards can sometimes be found in handheld PCs.
89
90 It's safe to select Y here, even if you don't have a B43 PCMCIA device.
91
92 If unsure, say N.
93
94config B43_SDIO 74config B43_SDIO
95 bool "Broadcom 43xx SDIO device support" 75 bool "Broadcom 43xx SDIO device support"
96 depends on B43 && B43_SSB && SSB_SDIOHOST_POSSIBLE 76 depends on B43 && B43_SSB && SSB_SDIOHOST_POSSIBLE
diff --git a/drivers/net/wireless/b43/Makefile b/drivers/net/wireless/b43/Makefile
index c624d4d90e4f..ddc4df46656f 100644
--- a/drivers/net/wireless/b43/Makefile
+++ b/drivers/net/wireless/b43/Makefile
@@ -21,7 +21,6 @@ b43-y += pio.o
21b43-y += rfkill.o 21b43-y += rfkill.o
22b43-y += ppr.o 22b43-y += ppr.o
23b43-$(CONFIG_B43_LEDS) += leds.o 23b43-$(CONFIG_B43_LEDS) += leds.o
24b43-$(CONFIG_B43_PCMCIA) += pcmcia.o
25b43-$(CONFIG_B43_SDIO) += sdio.o 24b43-$(CONFIG_B43_SDIO) += sdio.o
26b43-$(CONFIG_B43_DEBUG) += debugfs.o 25b43-$(CONFIG_B43_DEBUG) += debugfs.o
27 26
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 71d3e9adbf3c..ec013fbd6a81 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -56,7 +56,6 @@
56#include "sysfs.h" 56#include "sysfs.h"
57#include "xmit.h" 57#include "xmit.h"
58#include "lo.h" 58#include "lo.h"
59#include "pcmcia.h"
60#include "sdio.h" 59#include "sdio.h"
61#include <linux/mmc/sdio_func.h> 60#include <linux/mmc/sdio_func.h>
62 61
@@ -5850,12 +5849,9 @@ static int __init b43_init(void)
5850 int err; 5849 int err;
5851 5850
5852 b43_debugfs_init(); 5851 b43_debugfs_init();
5853 err = b43_pcmcia_init();
5854 if (err)
5855 goto err_dfs_exit;
5856 err = b43_sdio_init(); 5852 err = b43_sdio_init();
5857 if (err) 5853 if (err)
5858 goto err_pcmcia_exit; 5854 goto err_dfs_exit;
5859#ifdef CONFIG_B43_BCMA 5855#ifdef CONFIG_B43_BCMA
5860 err = bcma_driver_register(&b43_bcma_driver); 5856 err = bcma_driver_register(&b43_bcma_driver);
5861 if (err) 5857 if (err)
@@ -5878,8 +5874,6 @@ err_bcma_driver_exit:
5878err_sdio_exit: 5874err_sdio_exit:
5879#endif 5875#endif
5880 b43_sdio_exit(); 5876 b43_sdio_exit();
5881err_pcmcia_exit:
5882 b43_pcmcia_exit();
5883err_dfs_exit: 5877err_dfs_exit:
5884 b43_debugfs_exit(); 5878 b43_debugfs_exit();
5885 return err; 5879 return err;
@@ -5894,7 +5888,6 @@ static void __exit b43_exit(void)
5894 bcma_driver_unregister(&b43_bcma_driver); 5888 bcma_driver_unregister(&b43_bcma_driver);
5895#endif 5889#endif
5896 b43_sdio_exit(); 5890 b43_sdio_exit();
5897 b43_pcmcia_exit();
5898 b43_debugfs_exit(); 5891 b43_debugfs_exit();
5899} 5892}
5900 5893
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c
deleted file mode 100644
index 55f2bd7f8f74..000000000000
--- a/drivers/net/wireless/b43/pcmcia.c
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
2
3 Broadcom B43 wireless driver
4
5 Copyright (c) 2007 Michael Buesch <m@bues.ch>
6
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.
11
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.
16
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.
21
22*/
23
24#include "pcmcia.h"
25
26#include <linux/ssb/ssb.h>
27#include <linux/slab.h>
28#include <linux/module.h>
29
30#include <pcmcia/cistpl.h>
31#include <pcmcia/ciscode.h>
32#include <pcmcia/ds.h>
33#include <pcmcia/cisreg.h>
34
35
36static const struct pcmcia_device_id b43_pcmcia_tbl[] = {
37 PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448),
38 PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x476),
39 PCMCIA_DEVICE_NULL,
40};
41
42MODULE_DEVICE_TABLE(pcmcia, b43_pcmcia_tbl);
43
44#ifdef CONFIG_PM
45static int b43_pcmcia_suspend(struct pcmcia_device *dev)
46{
47 struct ssb_bus *ssb = dev->priv;
48
49 return ssb_bus_suspend(ssb);
50}
51
52static int b43_pcmcia_resume(struct pcmcia_device *dev)
53{
54 struct ssb_bus *ssb = dev->priv;
55
56 return ssb_bus_resume(ssb);
57}
58#else /* CONFIG_PM */
59# define b43_pcmcia_suspend NULL
60# define b43_pcmcia_resume NULL
61#endif /* CONFIG_PM */
62
63static int b43_pcmcia_probe(struct pcmcia_device *dev)
64{
65 struct ssb_bus *ssb;
66 int err = -ENOMEM;
67 int res = 0;
68
69 ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
70 if (!ssb)
71 goto out_error;
72
73 err = -ENODEV;
74
75 dev->config_flags |= CONF_ENABLE_IRQ;
76
77 dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 |
78 WIN_USE_WAIT;
79 dev->resource[2]->start = 0;
80 dev->resource[2]->end = SSB_CORE_SIZE;
81 res = pcmcia_request_window(dev, dev->resource[2], 250);
82 if (res != 0)
83 goto err_kfree_ssb;
84
85 res = pcmcia_map_mem_page(dev, dev->resource[2], 0);
86 if (res != 0)
87 goto err_disable;
88
89 if (!dev->irq)
90 goto err_disable;
91
92 res = pcmcia_enable_device(dev);
93 if (res != 0)
94 goto err_disable;
95
96 err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start);
97 if (err)
98 goto err_disable;
99 dev->priv = ssb;
100
101 return 0;
102
103err_disable:
104 pcmcia_disable_device(dev);
105err_kfree_ssb:
106 kfree(ssb);
107out_error:
108 printk(KERN_ERR "b43-pcmcia: Initialization failed (%d, %d)\n",
109 res, err);
110 return err;
111}
112
113static void b43_pcmcia_remove(struct pcmcia_device *dev)
114{
115 struct ssb_bus *ssb = dev->priv;
116
117 ssb_bus_unregister(ssb);
118 pcmcia_disable_device(dev);
119 kfree(ssb);
120 dev->priv = NULL;
121}
122
123static struct pcmcia_driver b43_pcmcia_driver = {
124 .owner = THIS_MODULE,
125 .name = "b43-pcmcia",
126 .id_table = b43_pcmcia_tbl,
127 .probe = b43_pcmcia_probe,
128 .remove = b43_pcmcia_remove,
129 .suspend = b43_pcmcia_suspend,
130 .resume = b43_pcmcia_resume,
131};
132
133/*
134 * These are not module init/exit functions!
135 * The module_pcmcia_driver() helper cannot be used here.
136 */
137int b43_pcmcia_init(void)
138{
139 return pcmcia_register_driver(&b43_pcmcia_driver);
140}
141
142void b43_pcmcia_exit(void)
143{
144 pcmcia_unregister_driver(&b43_pcmcia_driver);
145}
diff --git a/drivers/net/wireless/b43/pcmcia.h b/drivers/net/wireless/b43/pcmcia.h
deleted file mode 100644
index 85f120a67cbe..000000000000
--- a/drivers/net/wireless/b43/pcmcia.h
+++ /dev/null
@@ -1,20 +0,0 @@
1#ifndef B43_PCMCIA_H_
2#define B43_PCMCIA_H_
3
4#ifdef CONFIG_B43_PCMCIA
5
6int b43_pcmcia_init(void);
7void b43_pcmcia_exit(void);
8
9#else /* CONFIG_B43_PCMCIA */
10
11static inline int b43_pcmcia_init(void)
12{
13 return 0;
14}
15static inline void b43_pcmcia_exit(void)
16{
17}
18
19#endif /* CONFIG_B43_PCMCIA */
20#endif /* B43_PCMCIA_H_ */
diff --git a/drivers/ssb/Makefile b/drivers/ssb/Makefile
index b1ddc116d387..7daa03e34b37 100644
--- a/drivers/ssb/Makefile
+++ b/drivers/ssb/Makefile
@@ -5,7 +5,7 @@ ssb-$(CONFIG_SSB_SPROM) += sprom.o
5 5
6# host support 6# host support
7ssb-$(CONFIG_SSB_PCIHOST) += pci.o pcihost_wrapper.o 7ssb-$(CONFIG_SSB_PCIHOST) += pci.o pcihost_wrapper.o
8ssb-$(CONFIG_SSB_PCMCIAHOST) += pcmcia.o 8ssb-$(CONFIG_SSB_PCMCIAHOST) += pcmcia.o bridge_pcmcia_80211.o
9ssb-$(CONFIG_SSB_SDIOHOST) += sdio.o 9ssb-$(CONFIG_SSB_SDIOHOST) += sdio.o
10 10
11# built-in drivers 11# built-in drivers
diff --git a/drivers/ssb/bridge_pcmcia_80211.c b/drivers/ssb/bridge_pcmcia_80211.c
new file mode 100644
index 000000000000..d70568ea02d5
--- /dev/null
+++ b/drivers/ssb/bridge_pcmcia_80211.c
@@ -0,0 +1,128 @@
1/*
2 * Broadcom 43xx PCMCIA-SSB bridge module
3 *
4 * Copyright (c) 2007 Michael Buesch <m@bues.ch>
5 *
6 * Licensed under the GNU/GPL. See COPYING for details.
7 */
8
9#include <linux/ssb/ssb.h>
10#include <linux/slab.h>
11#include <linux/module.h>
12
13#include <pcmcia/cistpl.h>
14#include <pcmcia/ciscode.h>
15#include <pcmcia/ds.h>
16#include <pcmcia/cisreg.h>
17
18#include "ssb_private.h"
19
20static const struct pcmcia_device_id ssb_host_pcmcia_tbl[] = {
21 PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448),
22 PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x476),
23 PCMCIA_DEVICE_NULL,
24};
25
26MODULE_DEVICE_TABLE(pcmcia, ssb_host_pcmcia_tbl);
27
28static int ssb_host_pcmcia_probe(struct pcmcia_device *dev)
29{
30 struct ssb_bus *ssb;
31 int err = -ENOMEM;
32 int res = 0;
33
34 ssb = kzalloc(sizeof(*ssb), GFP_KERNEL);
35 if (!ssb)
36 goto out_error;
37
38 err = -ENODEV;
39
40 dev->config_flags |= CONF_ENABLE_IRQ;
41
42 dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 |
43 WIN_USE_WAIT;
44 dev->resource[2]->start = 0;
45 dev->resource[2]->end = SSB_CORE_SIZE;
46 res = pcmcia_request_window(dev, dev->resource[2], 250);
47 if (res != 0)
48 goto err_kfree_ssb;
49
50 res = pcmcia_map_mem_page(dev, dev->resource[2], 0);
51 if (res != 0)
52 goto err_disable;
53
54 if (!dev->irq)
55 goto err_disable;
56
57 res = pcmcia_enable_device(dev);
58 if (res != 0)
59 goto err_disable;
60
61 err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start);
62 if (err)
63 goto err_disable;
64 dev->priv = ssb;
65
66 return 0;
67
68err_disable:
69 pcmcia_disable_device(dev);
70err_kfree_ssb:
71 kfree(ssb);
72out_error:
73 ssb_err("Initialization failed (%d, %d)\n", res, err);
74 return err;
75}
76
77static void ssb_host_pcmcia_remove(struct pcmcia_device *dev)
78{
79 struct ssb_bus *ssb = dev->priv;
80
81 ssb_bus_unregister(ssb);
82 pcmcia_disable_device(dev);
83 kfree(ssb);
84 dev->priv = NULL;
85}
86
87#ifdef CONFIG_PM
88static int ssb_host_pcmcia_suspend(struct pcmcia_device *dev)
89{
90 struct ssb_bus *ssb = dev->priv;
91
92 return ssb_bus_suspend(ssb);
93}
94
95static int ssb_host_pcmcia_resume(struct pcmcia_device *dev)
96{
97 struct ssb_bus *ssb = dev->priv;
98
99 return ssb_bus_resume(ssb);
100}
101#else /* CONFIG_PM */
102# define ssb_host_pcmcia_suspend NULL
103# define ssb_host_pcmcia_resume NULL
104#endif /* CONFIG_PM */
105
106static struct pcmcia_driver ssb_host_pcmcia_driver = {
107 .owner = THIS_MODULE,
108 .name = "ssb-pcmcia",
109 .id_table = ssb_host_pcmcia_tbl,
110 .probe = ssb_host_pcmcia_probe,
111 .remove = ssb_host_pcmcia_remove,
112 .suspend = ssb_host_pcmcia_suspend,
113 .resume = ssb_host_pcmcia_resume,
114};
115
116/*
117 * These are not module init/exit functions!
118 * The module_pcmcia_driver() helper cannot be used here.
119 */
120int ssb_host_pcmcia_init(void)
121{
122 return pcmcia_register_driver(&ssb_host_pcmcia_driver);
123}
124
125void ssb_host_pcmcia_exit(void)
126{
127 pcmcia_unregister_driver(&ssb_host_pcmcia_driver);
128}
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 8cf23a2468ba..90ec6a048b4c 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -897,7 +897,6 @@ int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
897 897
898 return err; 898 return err;
899} 899}
900EXPORT_SYMBOL(ssb_bus_pcmciabus_register);
901#endif /* CONFIG_SSB_PCMCIAHOST */ 900#endif /* CONFIG_SSB_PCMCIAHOST */
902 901
903#ifdef CONFIG_SSB_SDIOHOST 902#ifdef CONFIG_SSB_SDIOHOST
@@ -1464,6 +1463,12 @@ static int __init ssb_modinit(void)
1464 /* don't fail SSB init because of this */ 1463 /* don't fail SSB init because of this */
1465 err = 0; 1464 err = 0;
1466 } 1465 }
1466 err = ssb_host_pcmcia_init();
1467 if (err) {
1468 ssb_err("PCMCIA host initialization failed\n");
1469 /* don't fail SSB init because of this */
1470 err = 0;
1471 }
1467 err = ssb_gige_init(); 1472 err = ssb_gige_init();
1468 if (err) { 1473 if (err) {
1469 ssb_err("SSB Broadcom Gigabit Ethernet driver initialization failed\n"); 1474 ssb_err("SSB Broadcom Gigabit Ethernet driver initialization failed\n");
@@ -1481,6 +1486,7 @@ fs_initcall(ssb_modinit);
1481static void __exit ssb_modexit(void) 1486static void __exit ssb_modexit(void)
1482{ 1487{
1483 ssb_gige_exit(); 1488 ssb_gige_exit();
1489 ssb_host_pcmcia_exit();
1484 b43_pci_ssb_bridge_exit(); 1490 b43_pci_ssb_bridge_exit();
1485 bus_unregister(&ssb_bustype); 1491 bus_unregister(&ssb_bustype);
1486} 1492}
diff --git a/drivers/ssb/ssb_private.h b/drivers/ssb/ssb_private.h
index 8a2ebc88c66f..93bb8f0195a9 100644
--- a/drivers/ssb/ssb_private.h
+++ b/drivers/ssb/ssb_private.h
@@ -94,6 +94,8 @@ extern int ssb_pcmcia_get_invariants(struct ssb_bus *bus,
94extern int ssb_pcmcia_hardware_setup(struct ssb_bus *bus); 94extern int ssb_pcmcia_hardware_setup(struct ssb_bus *bus);
95extern void ssb_pcmcia_exit(struct ssb_bus *bus); 95extern void ssb_pcmcia_exit(struct ssb_bus *bus);
96extern int ssb_pcmcia_init(struct ssb_bus *bus); 96extern int ssb_pcmcia_init(struct ssb_bus *bus);
97extern int ssb_host_pcmcia_init(void);
98extern void ssb_host_pcmcia_exit(void);
97extern const struct ssb_bus_ops ssb_pcmcia_ops; 99extern const struct ssb_bus_ops ssb_pcmcia_ops;
98#else /* CONFIG_SSB_PCMCIAHOST */ 100#else /* CONFIG_SSB_PCMCIAHOST */
99static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, 101static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus,
@@ -117,6 +119,13 @@ static inline int ssb_pcmcia_init(struct ssb_bus *bus)
117{ 119{
118 return 0; 120 return 0;
119} 121}
122static inline int ssb_host_pcmcia_init(void)
123{
124 return 0;
125}
126static inline void ssb_host_pcmcia_exit(void)
127{
128}
120#endif /* CONFIG_SSB_PCMCIAHOST */ 129#endif /* CONFIG_SSB_PCMCIAHOST */
121 130
122/* sdio.c */ 131/* sdio.c */