aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/pcmcia
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-28 04:59:06 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-09-29 11:20:21 -0400
commitcdb138080b78146d1cdadba9f5dadbeb97445b91 (patch)
treefae26f709ed0f19648db79059234faf9fa028051 /drivers/char/pcmcia
parent899611ee7d373e5eeda08e9a8632684e1ebbbf00 (diff)
pcmcia: do not use win_req_t when calling pcmcia_request_window()
Instead of win_req_t, drivers are now requested to fill out struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four iomem ranges. After a call to pcmcia_request_window(), the windows found there are reserved and may be used until pcmcia_release_window() is called. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-mtd@lists.infradead.org CC: Jiri Kosina <jkosina@suse.cz> CC: linux-scsi@vger.kernel.org Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/char/pcmcia')
-rw-r--r--drivers/char/pcmcia/ipwireless/main.c87
-rw-r--r--drivers/char/pcmcia/ipwireless/main.h4
2 files changed, 37 insertions, 54 deletions
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c
index 67bdb05798b1..8d2b86aab715 100644
--- a/drivers/char/pcmcia/ipwireless/main.c
+++ b/drivers/char/pcmcia/ipwireless/main.c
@@ -105,62 +105,54 @@ static int ipwireless_probe(struct pcmcia_device *p_dev,
105 if (cfg->mem.nwin == 0) 105 if (cfg->mem.nwin == 0)
106 return 0; 106 return 0;
107 107
108 ipw->request_common_memory.Attributes = 108 p_dev->resource[2]->flags |=
109 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; 109 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE;
110 ipw->request_common_memory.Base = cfg->mem.win[0].host_addr; 110 p_dev->resource[2]->start = cfg->mem.win[0].host_addr;
111 ipw->request_common_memory.Size = cfg->mem.win[0].len; 111 p_dev->resource[2]->end = cfg->mem.win[0].len;
112 if (ipw->request_common_memory.Size < 0x1000) 112 if (p_dev->resource[2]->end < 0x1000)
113 ipw->request_common_memory.Size = 0x1000; 113 p_dev->resource[2]->end = 0x1000;
114 ipw->request_common_memory.AccessSpeed = 0;
115
116 ret = pcmcia_request_window(p_dev, &ipw->request_common_memory,
117 &ipw->handle_common_memory);
118 114
115 ret = pcmcia_request_window(p_dev, p_dev->resource[2], 0);
119 if (ret != 0) 116 if (ret != 0)
120 goto exit1; 117 goto exit1;
121 118
122 ret = pcmcia_map_mem_page(p_dev, ipw->handle_common_memory, 119 ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2],
123 cfg->mem.win[0].card_addr); 120 cfg->mem.win[0].card_addr);
124
125 if (ret != 0) 121 if (ret != 0)
126 goto exit2; 122 goto exit2;
127 123
128 ipw->is_v2_card = cfg->mem.win[0].len == 0x100; 124 ipw->is_v2_card = cfg->mem.win[0].len == 0x100;
129 125
130 ipw->common_memory = ioremap(ipw->request_common_memory.Base, 126 ipw->attr_memory = ioremap(p_dev->resource[2]->start,
131 ipw->request_common_memory.Size); 127 resource_size(p_dev->resource[2]));
132 request_mem_region(ipw->request_common_memory.Base, 128 request_mem_region(p_dev->resource[2]->start,
133 ipw->request_common_memory.Size, 129 resource_size(p_dev->resource[2]),
134 IPWIRELESS_PCCARD_NAME); 130 IPWIRELESS_PCCARD_NAME);
135 131
136 ipw->request_attr_memory.Attributes = 132 p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM |
137 WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | WIN_ENABLE; 133 WIN_ENABLE;
138 ipw->request_attr_memory.Base = 0; 134 p_dev->resource[3]->end = 0; /* this used to be 0x1000 */
139 ipw->request_attr_memory.Size = 0; /* this used to be 0x1000 */ 135 ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0);
140 ipw->request_attr_memory.AccessSpeed = 0;
141
142 ret = pcmcia_request_window(p_dev, &ipw->request_attr_memory,
143 &ipw->handle_attr_memory);
144
145 if (ret != 0) 136 if (ret != 0)
146 goto exit2; 137 goto exit2;
147 138
148 ret = pcmcia_map_mem_page(p_dev, ipw->handle_attr_memory, 0); 139 ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0);
149 if (ret != 0) 140 if (ret != 0)
150 goto exit3; 141 goto exit3;
151 142
152 ipw->attr_memory = ioremap(ipw->request_attr_memory.Base, 143 ipw->attr_memory = ioremap(p_dev->resource[3]->start,
153 ipw->request_attr_memory.Size); 144 resource_size(p_dev->resource[3]));
154 request_mem_region(ipw->request_attr_memory.Base, 145 request_mem_region(p_dev->resource[3]->start,
155 ipw->request_attr_memory.Size, IPWIRELESS_PCCARD_NAME); 146 resource_size(p_dev->resource[3]),
147 IPWIRELESS_PCCARD_NAME);
156 148
157 return 0; 149 return 0;
158 150
159exit3: 151exit3:
160exit2: 152exit2:
161 if (ipw->common_memory) { 153 if (ipw->common_memory) {
162 release_mem_region(ipw->request_common_memory.Base, 154 release_mem_region(p_dev->resource[2]->start,
163 ipw->request_common_memory.Size); 155 resource_size(p_dev->resource[2]));
164 iounmap(ipw->common_memory); 156 iounmap(ipw->common_memory);
165 } 157 }
166exit1: 158exit1:
@@ -201,13 +193,9 @@ static int config_ipwireless(struct ipw_dev *ipw)
201 (unsigned int) link->irq); 193 (unsigned int) link->irq);
202 if (ipw->attr_memory && ipw->common_memory) 194 if (ipw->attr_memory && ipw->common_memory)
203 printk(KERN_INFO IPWIRELESS_PCCARD_NAME 195 printk(KERN_INFO IPWIRELESS_PCCARD_NAME
204 ": attr memory 0x%08lx-0x%08lx, common memory 0x%08lx-0x%08lx\n", 196 ": attr memory %pR, common memory %pR\n",
205 ipw->request_attr_memory.Base, 197 link->resource[3],
206 ipw->request_attr_memory.Base 198 link->resource[2]);
207 + ipw->request_attr_memory.Size - 1,
208 ipw->request_common_memory.Base,
209 ipw->request_common_memory.Base
210 + ipw->request_common_memory.Size - 1);
211 199
212 ipw->network = ipwireless_network_create(ipw->hardware); 200 ipw->network = ipwireless_network_create(ipw->hardware);
213 if (!ipw->network) 201 if (!ipw->network)
@@ -231,17 +219,16 @@ static int config_ipwireless(struct ipw_dev *ipw)
231 return 0; 219 return 0;
232 220
233exit: 221exit:
234 if (ipw->attr_memory) {
235 release_mem_region(ipw->request_attr_memory.Base,
236 ipw->request_attr_memory.Size);
237 iounmap(ipw->attr_memory);
238
239 }
240 if (ipw->common_memory) { 222 if (ipw->common_memory) {
241 release_mem_region(ipw->request_common_memory.Base, 223 release_mem_region(link->resource[2]->start,
242 ipw->request_common_memory.Size); 224 resource_size(link->resource[2]));
243 iounmap(ipw->common_memory); 225 iounmap(ipw->common_memory);
244 } 226 }
227 if (ipw->attr_memory) {
228 release_mem_region(link->resource[3]->start,
229 resource_size(link->resource[3]));
230 iounmap(ipw->attr_memory);
231 }
245 pcmcia_disable_device(link); 232 pcmcia_disable_device(link);
246 return -1; 233 return -1;
247} 234}
@@ -249,13 +236,13 @@ exit:
249static void release_ipwireless(struct ipw_dev *ipw) 236static void release_ipwireless(struct ipw_dev *ipw)
250{ 237{
251 if (ipw->common_memory) { 238 if (ipw->common_memory) {
252 release_mem_region(ipw->request_common_memory.Base, 239 release_mem_region(ipw->link->resource[2]->start,
253 ipw->request_common_memory.Size); 240 resource_size(ipw->link->resource[2]));
254 iounmap(ipw->common_memory); 241 iounmap(ipw->common_memory);
255 } 242 }
256 if (ipw->attr_memory) { 243 if (ipw->attr_memory) {
257 release_mem_region(ipw->request_attr_memory.Base, 244 release_mem_region(ipw->link->resource[3]->start,
258 ipw->request_attr_memory.Size); 245 resource_size(ipw->link->resource[3]));
259 iounmap(ipw->attr_memory); 246 iounmap(ipw->attr_memory);
260 } 247 }
261 pcmcia_disable_device(ipw->link); 248 pcmcia_disable_device(ipw->link);
diff --git a/drivers/char/pcmcia/ipwireless/main.h b/drivers/char/pcmcia/ipwireless/main.h
index c207be87b597..90402195855e 100644
--- a/drivers/char/pcmcia/ipwireless/main.h
+++ b/drivers/char/pcmcia/ipwireless/main.h
@@ -45,13 +45,9 @@ struct ipw_dev {
45 struct pcmcia_device *link; 45 struct pcmcia_device *link;
46 int is_v2_card; 46 int is_v2_card;
47 47
48 window_handle_t handle_attr_memory;
49 void __iomem *attr_memory; 48 void __iomem *attr_memory;
50 win_req_t request_attr_memory;
51 49
52 window_handle_t handle_common_memory;
53 void __iomem *common_memory; 50 void __iomem *common_memory;
54 win_req_t request_common_memory;
55 51
56 /* Reference to attribute memory, containing CIS data */ 52 /* Reference to attribute memory, containing CIS data */
57 void *attribute_memory; 53 void *attribute_memory;