diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-07-28 04:59:06 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-09-29 11:20:21 -0400 |
commit | cdb138080b78146d1cdadba9f5dadbeb97445b91 (patch) | |
tree | fae26f709ed0f19648db79059234faf9fa028051 | |
parent | 899611ee7d373e5eeda08e9a8632684e1ebbbf00 (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>
-rw-r--r-- | Documentation/pcmcia/driver-changes.txt | 7 | ||||
-rw-r--r-- | drivers/char/pcmcia/ipwireless/main.c | 87 | ||||
-rw-r--r-- | drivers/char/pcmcia/ipwireless/main.h | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/pcmciamtd.c | 53 | ||||
-rw-r--r-- | drivers/net/pcmcia/fmvj18x_cs.c | 29 | ||||
-rw-r--r-- | drivers/net/pcmcia/ibmtr_cs.c | 42 | ||||
-rw-r--r-- | drivers/net/pcmcia/pcnet_cs.c | 44 | ||||
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 15 | ||||
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 16 | ||||
-rw-r--r-- | drivers/net/wireless/b43/pcmcia.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/ray_cs.c | 44 | ||||
-rw-r--r-- | drivers/net/wireless/ray_cs.h | 2 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 60 | ||||
-rw-r--r-- | drivers/scsi/pcmcia/nsp_cs.c | 49 | ||||
-rw-r--r-- | include/pcmcia/cs.h | 24 | ||||
-rw-r--r-- | include/pcmcia/ds.h | 28 |
16 files changed, 241 insertions, 277 deletions
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index 26c0f9c00545..86e0f491f85e 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt | |||
@@ -1,4 +1,11 @@ | |||
1 | This file details changes in 2.6 which affect PCMCIA card driver authors: | 1 | This file details changes in 2.6 which affect PCMCIA card driver authors: |
2 | * pcmcia_request_window changes (as of 2.6.36) | ||
3 | Instead of win_req_t, drivers are now requested to fill out | ||
4 | struct pcmcia_device *p_dev->resource[2,3,4,5] for up to four ioport | ||
5 | ranges. After a call to pcmcia_request_window(), the regions found there | ||
6 | are reserved and may be used immediately -- until pcmcia_release_window() | ||
7 | is called. | ||
8 | |||
2 | * pcmcia_request_io changes (as of 2.6.36) | 9 | * pcmcia_request_io changes (as of 2.6.36) |
3 | Instead of io_req_t, drivers are now requested to fill out | 10 | Instead of io_req_t, drivers are now requested to fill out |
4 | struct pcmcia_device *p_dev->resource[0,1] for up to two ioport | 11 | struct pcmcia_device *p_dev->resource[0,1] for up to two ioport |
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 | ||
159 | exit3: | 151 | exit3: |
160 | exit2: | 152 | exit2: |
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 | } |
166 | exit1: | 158 | exit1: |
@@ -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 | ||
233 | exit: | 221 | exit: |
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: | |||
249 | static void release_ipwireless(struct ipw_dev *ipw) | 236 | static 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; |
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index e9ca5ba7d9d2..fb3c5380aa84 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -101,7 +101,7 @@ MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)") | |||
101 | static caddr_t remap_window(struct map_info *map, unsigned long to) | 101 | static caddr_t remap_window(struct map_info *map, unsigned long to) |
102 | { | 102 | { |
103 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 103 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
104 | window_handle_t win = (window_handle_t)map->map_priv_2; | 104 | struct resource *win = (struct resource *) map->map_priv_2; |
105 | unsigned int offset; | 105 | unsigned int offset; |
106 | int ret; | 106 | int ret; |
107 | 107 | ||
@@ -339,7 +339,7 @@ static void pcmciamtd_release(struct pcmcia_device *link) | |||
339 | 339 | ||
340 | DEBUG(3, "link = 0x%p", link); | 340 | DEBUG(3, "link = 0x%p", link); |
341 | 341 | ||
342 | if (link->win) { | 342 | if (link->resource[2]->end) { |
343 | if(dev->win_base) { | 343 | if(dev->win_base) { |
344 | iounmap(dev->win_base); | 344 | iounmap(dev->win_base); |
345 | dev->win_base = NULL; | 345 | dev->win_base = NULL; |
@@ -491,9 +491,8 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
491 | { | 491 | { |
492 | struct pcmciamtd_dev *dev = link->priv; | 492 | struct pcmciamtd_dev *dev = link->priv; |
493 | struct mtd_info *mtd = NULL; | 493 | struct mtd_info *mtd = NULL; |
494 | win_req_t req; | ||
495 | int ret; | 494 | int ret; |
496 | int i; | 495 | int i, j = 0; |
497 | static char *probes[] = { "jedec_probe", "cfi_probe" }; | 496 | static char *probes[] = { "jedec_probe", "cfi_probe" }; |
498 | int new_name = 0; | 497 | int new_name = 0; |
499 | 498 | ||
@@ -520,28 +519,34 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
520 | * smaller windows until we succeed | 519 | * smaller windows until we succeed |
521 | */ | 520 | */ |
522 | 521 | ||
523 | req.Attributes = WIN_MEMORY_TYPE_CM | WIN_ENABLE; | 522 | link->resource[2]->flags |= WIN_MEMORY_TYPE_CM | WIN_ENABLE; |
524 | req.Attributes |= (dev->pcmcia_map.bankwidth == 1) ? WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; | 523 | link->resource[2]->flags |= (dev->pcmcia_map.bankwidth == 1) ? |
525 | req.Base = 0; | 524 | WIN_DATA_WIDTH_8 : WIN_DATA_WIDTH_16; |
526 | req.AccessSpeed = mem_speed; | 525 | link->resource[2]->start = 0; |
527 | link->win = (window_handle_t)link; | 526 | link->resource[2]->end = (force_size) ? force_size << 20 : |
528 | req.Size = (force_size) ? force_size << 20 : MAX_PCMCIA_ADDR; | 527 | MAX_PCMCIA_ADDR; |
529 | dev->win_size = 0; | 528 | dev->win_size = 0; |
530 | 529 | ||
531 | do { | 530 | do { |
532 | int ret; | 531 | int ret; |
533 | DEBUG(2, "requesting window with size = %dKiB memspeed = %d", | 532 | DEBUG(2, "requesting window with size = %luKiB memspeed = %d", |
534 | req.Size >> 10, req.AccessSpeed); | 533 | (unsigned long) resource_size(link->resource[2]) >> 10, |
535 | ret = pcmcia_request_window(link, &req, &link->win); | 534 | mem_speed); |
535 | ret = pcmcia_request_window(link, link->resource[2], mem_speed); | ||
536 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); | 536 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); |
537 | if(ret) { | 537 | if(ret) { |
538 | req.Size >>= 1; | 538 | j++; |
539 | link->resource[2]->start = 0; | ||
540 | link->resource[2]->end = (force_size) ? | ||
541 | force_size << 20 : MAX_PCMCIA_ADDR; | ||
542 | link->resource[2]->end >>= j; | ||
539 | } else { | 543 | } else { |
540 | DEBUG(2, "Got window of size %dKiB", req.Size >> 10); | 544 | DEBUG(2, "Got window of size %luKiB", (unsigned long) |
541 | dev->win_size = req.Size; | 545 | resource_size(link->resource[2]) >> 10); |
546 | dev->win_size = resource_size(link->resource[2]); | ||
542 | break; | 547 | break; |
543 | } | 548 | } |
544 | } while(req.Size >= 0x1000); | 549 | } while (link->resource[2]->end >= 0x1000); |
545 | 550 | ||
546 | DEBUG(2, "dev->win_size = %d", dev->win_size); | 551 | DEBUG(2, "dev->win_size = %d", dev->win_size); |
547 | 552 | ||
@@ -553,20 +558,20 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
553 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); | 558 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); |
554 | 559 | ||
555 | /* Get write protect status */ | 560 | /* Get write protect status */ |
556 | DEBUG(2, "window handle = 0x%8.8lx", (unsigned long)link->win); | 561 | dev->win_base = ioremap(link->resource[2]->start, |
557 | dev->win_base = ioremap(req.Base, req.Size); | 562 | resource_size(link->resource[2])); |
558 | if(!dev->win_base) { | 563 | if(!dev->win_base) { |
559 | dev_err(&dev->p_dev->dev, "ioremap(%lu, %u) failed\n", | 564 | dev_err(&dev->p_dev->dev, "ioremap(%pR) failed\n", |
560 | req.Base, req.Size); | 565 | link->resource[2]); |
561 | pcmciamtd_release(link); | 566 | pcmciamtd_release(link); |
562 | return -ENODEV; | 567 | return -ENODEV; |
563 | } | 568 | } |
564 | DEBUG(1, "mapped window dev = %p req.base = 0x%lx base = %p size = 0x%x", | 569 | DEBUG(1, "mapped window dev = %p @ %pR, base = %p", |
565 | dev, req.Base, dev->win_base, req.Size); | 570 | dev, link->resource[2], dev->win_base); |
566 | 571 | ||
567 | dev->offset = 0; | 572 | dev->offset = 0; |
568 | dev->pcmcia_map.map_priv_1 = (unsigned long)dev; | 573 | dev->pcmcia_map.map_priv_1 = (unsigned long)dev; |
569 | dev->pcmcia_map.map_priv_2 = (unsigned long)link->win; | 574 | dev->pcmcia_map.map_priv_2 = (unsigned long)link->resource[2]; |
570 | 575 | ||
571 | dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; | 576 | dev->vpp = (vpp) ? vpp : link->socket->socket.Vpp; |
572 | link->conf.Attributes = 0; | 577 | link->conf.Attributes = 0; |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 98fffb03ecd7..dfd32842412e 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -544,20 +544,18 @@ failed: | |||
544 | 544 | ||
545 | static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | 545 | static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) |
546 | { | 546 | { |
547 | win_req_t req; | ||
548 | u_char __iomem *base; | 547 | u_char __iomem *base; |
549 | int i, j; | 548 | int i, j; |
550 | 549 | ||
551 | /* Allocate a small memory window */ | 550 | /* Allocate a small memory window */ |
552 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 551 | link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
553 | req.Base = 0; req.Size = 0; | 552 | link->resource[2]->start = 0; link->resource[2]->end = 0; |
554 | req.AccessSpeed = 0; | 553 | i = pcmcia_request_window(link, link->resource[2], 0); |
555 | i = pcmcia_request_window(link, &req, &link->win); | ||
556 | if (i != 0) | 554 | if (i != 0) |
557 | return -1; | 555 | return -1; |
558 | 556 | ||
559 | base = ioremap(req.Base, req.Size); | 557 | base = ioremap(link->resource[2]->start, resource_size(link->resource[2])); |
560 | pcmcia_map_mem_page(link, link->win, 0); | 558 | pcmcia_map_mem_page(link, link->resource[2], 0); |
561 | 559 | ||
562 | /* | 560 | /* |
563 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format | 561 | * MBH10304 CISTPL_FUNCE_LAN_NODE_ID format |
@@ -582,7 +580,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
582 | } | 580 | } |
583 | 581 | ||
584 | iounmap(base); | 582 | iounmap(base); |
585 | j = pcmcia_release_window(link, link->win); | 583 | j = pcmcia_release_window(link, link->resource[2]); |
586 | return (i != 0x200) ? 0 : -1; | 584 | return (i != 0x200) ? 0 : -1; |
587 | 585 | ||
588 | } /* fmvj18x_get_hwinfo */ | 586 | } /* fmvj18x_get_hwinfo */ |
@@ -590,27 +588,26 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) | |||
590 | 588 | ||
591 | static int fmvj18x_setup_mfc(struct pcmcia_device *link) | 589 | static int fmvj18x_setup_mfc(struct pcmcia_device *link) |
592 | { | 590 | { |
593 | win_req_t req; | ||
594 | int i; | 591 | int i; |
595 | struct net_device *dev = link->priv; | 592 | struct net_device *dev = link->priv; |
596 | unsigned int ioaddr; | 593 | unsigned int ioaddr; |
597 | local_info_t *lp = netdev_priv(dev); | 594 | local_info_t *lp = netdev_priv(dev); |
598 | 595 | ||
599 | /* Allocate a small memory window */ | 596 | /* Allocate a small memory window */ |
600 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 597 | link->resource[3]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
601 | req.Base = 0; req.Size = 0; | 598 | link->resource[3]->start = link->resource[3]->end = 0; |
602 | req.AccessSpeed = 0; | 599 | i = pcmcia_request_window(link, link->resource[3], 0); |
603 | i = pcmcia_request_window(link, &req, &link->win); | ||
604 | if (i != 0) | 600 | if (i != 0) |
605 | return -1; | 601 | return -1; |
606 | 602 | ||
607 | lp->base = ioremap(req.Base, req.Size); | 603 | lp->base = ioremap(link->resource[3]->start, |
604 | resource_size(link->resource[3])); | ||
608 | if (lp->base == NULL) { | 605 | if (lp->base == NULL) { |
609 | printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); | 606 | printk(KERN_NOTICE "fmvj18x_cs: ioremap failed\n"); |
610 | return -1; | 607 | return -1; |
611 | } | 608 | } |
612 | 609 | ||
613 | i = pcmcia_map_mem_page(link, link->win, 0); | 610 | i = pcmcia_map_mem_page(link, link->resource[3], 0); |
614 | if (i != 0) { | 611 | if (i != 0) { |
615 | iounmap(lp->base); | 612 | iounmap(lp->base); |
616 | lp->base = NULL; | 613 | lp->base = NULL; |
@@ -638,7 +635,6 @@ static void fmvj18x_release(struct pcmcia_device *link) | |||
638 | struct net_device *dev = link->priv; | 635 | struct net_device *dev = link->priv; |
639 | local_info_t *lp = netdev_priv(dev); | 636 | local_info_t *lp = netdev_priv(dev); |
640 | u_char __iomem *tmp; | 637 | u_char __iomem *tmp; |
641 | int j; | ||
642 | 638 | ||
643 | dev_dbg(&link->dev, "fmvj18x_release\n"); | 639 | dev_dbg(&link->dev, "fmvj18x_release\n"); |
644 | 640 | ||
@@ -646,7 +642,6 @@ static void fmvj18x_release(struct pcmcia_device *link) | |||
646 | tmp = lp->base; | 642 | tmp = lp->base; |
647 | lp->base = NULL; /* set NULL before iounmap */ | 643 | lp->base = NULL; /* set NULL before iounmap */ |
648 | iounmap(tmp); | 644 | iounmap(tmp); |
649 | j = pcmcia_release_window(link, link->win); | ||
650 | } | 645 | } |
651 | 646 | ||
652 | pcmcia_disable_device(link); | 647 | pcmcia_disable_device(link); |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index b0d06a3d962f..dbdea7f5e423 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -102,9 +102,8 @@ static void ibmtr_detach(struct pcmcia_device *p_dev); | |||
102 | 102 | ||
103 | typedef struct ibmtr_dev_t { | 103 | typedef struct ibmtr_dev_t { |
104 | struct pcmcia_device *p_dev; | 104 | struct pcmcia_device *p_dev; |
105 | struct net_device *dev; | 105 | struct net_device *dev; |
106 | window_handle_t sram_win_handle; | 106 | struct tok_info *ti; |
107 | struct tok_info *ti; | ||
108 | } ibmtr_dev_t; | 107 | } ibmtr_dev_t; |
109 | 108 | ||
110 | static void netdev_get_drvinfo(struct net_device *dev, | 109 | static void netdev_get_drvinfo(struct net_device *dev, |
@@ -210,7 +209,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
210 | ibmtr_dev_t *info = link->priv; | 209 | ibmtr_dev_t *info = link->priv; |
211 | struct net_device *dev = info->dev; | 210 | struct net_device *dev = info->dev; |
212 | struct tok_info *ti = netdev_priv(dev); | 211 | struct tok_info *ti = netdev_priv(dev); |
213 | win_req_t req; | ||
214 | int i, ret; | 212 | int i, ret; |
215 | 213 | ||
216 | dev_dbg(&link->dev, "ibmtr_config\n"); | 214 | dev_dbg(&link->dev, "ibmtr_config\n"); |
@@ -240,37 +238,37 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
240 | ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); | 238 | ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); |
241 | 239 | ||
242 | /* Allocate the MMIO memory window */ | 240 | /* Allocate the MMIO memory window */ |
243 | req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; | 241 | link->resource[2]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; |
244 | req.Attributes |= WIN_USE_WAIT; | 242 | link->resource[2]->flags |= WIN_USE_WAIT; |
245 | req.Base = 0; | 243 | link->resource[2]->start = 0; |
246 | req.Size = 0x2000; | 244 | link->resource[2]->end = 0x2000; |
247 | req.AccessSpeed = 250; | 245 | ret = pcmcia_request_window(link, link->resource[2], 250); |
248 | ret = pcmcia_request_window(link, &req, &link->win); | ||
249 | if (ret) | 246 | if (ret) |
250 | goto failed; | 247 | goto failed; |
251 | 248 | ||
252 | ret = pcmcia_map_mem_page(link, link->win, mmiobase); | 249 | ret = pcmcia_map_mem_page(link, link->resource[2], mmiobase); |
253 | if (ret) | 250 | if (ret) |
254 | goto failed; | 251 | goto failed; |
255 | ti->mmio = ioremap(req.Base, req.Size); | 252 | ti->mmio = ioremap(link->resource[2]->start, |
253 | resource_size(link->resource[2])); | ||
256 | 254 | ||
257 | /* Allocate the SRAM memory window */ | 255 | /* Allocate the SRAM memory window */ |
258 | req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; | 256 | link->resource[3]->flags = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; |
259 | req.Attributes |= WIN_USE_WAIT; | 257 | link->resource[3]->flags |= WIN_USE_WAIT; |
260 | req.Base = 0; | 258 | link->resource[3]->start = 0; |
261 | req.Size = sramsize * 1024; | 259 | link->resource[3]->end = sramsize * 1024; |
262 | req.AccessSpeed = 250; | 260 | ret = pcmcia_request_window(link, link->resource[3], 250); |
263 | ret = pcmcia_request_window(link, &req, &info->sram_win_handle); | ||
264 | if (ret) | 261 | if (ret) |
265 | goto failed; | 262 | goto failed; |
266 | 263 | ||
267 | ret = pcmcia_map_mem_page(link, info->sram_win_handle, srambase); | 264 | ret = pcmcia_map_mem_page(link, link->resource[3], srambase); |
268 | if (ret) | 265 | if (ret) |
269 | goto failed; | 266 | goto failed; |
270 | 267 | ||
271 | ti->sram_base = srambase >> 12; | 268 | ti->sram_base = srambase >> 12; |
272 | ti->sram_virt = ioremap(req.Base, req.Size); | 269 | ti->sram_virt = ioremap(link->resource[3]->start, |
273 | ti->sram_phys = req.Base; | 270 | resource_size(link->resource[3])); |
271 | ti->sram_phys = link->resource[3]->start; | ||
274 | 272 | ||
275 | ret = pcmcia_request_configuration(link, &link->conf); | 273 | ret = pcmcia_request_configuration(link, &link->conf); |
276 | if (ret) | 274 | if (ret) |
@@ -316,7 +314,7 @@ static void ibmtr_release(struct pcmcia_device *link) | |||
316 | 314 | ||
317 | dev_dbg(&link->dev, "ibmtr_release\n"); | 315 | dev_dbg(&link->dev, "ibmtr_release\n"); |
318 | 316 | ||
319 | if (link->win) { | 317 | if (link->resource[2]->end) { |
320 | struct tok_info *ti = netdev_priv(dev); | 318 | struct tok_info *ti = netdev_priv(dev); |
321 | iounmap(ti->mmio); | 319 | iounmap(ti->mmio); |
322 | } | 320 | } |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index f9b509a6b09a..aa6ee6b264cd 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -300,22 +300,22 @@ static void pcnet_detach(struct pcmcia_device *link) | |||
300 | static hw_info_t *get_hwinfo(struct pcmcia_device *link) | 300 | static hw_info_t *get_hwinfo(struct pcmcia_device *link) |
301 | { | 301 | { |
302 | struct net_device *dev = link->priv; | 302 | struct net_device *dev = link->priv; |
303 | win_req_t req; | ||
304 | u_char __iomem *base, *virt; | 303 | u_char __iomem *base, *virt; |
305 | int i, j; | 304 | int i, j; |
306 | 305 | ||
307 | /* Allocate a small memory window */ | 306 | /* Allocate a small memory window */ |
308 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 307 | link->resource[2]->flags |= WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
309 | req.Base = 0; req.Size = 0; | 308 | link->resource[2]->start = 0; link->resource[2]->end = 0; |
310 | req.AccessSpeed = 0; | 309 | i = pcmcia_request_window(link, link->resource[2], 0); |
311 | i = pcmcia_request_window(link, &req, &link->win); | ||
312 | if (i != 0) | 310 | if (i != 0) |
313 | return NULL; | 311 | return NULL; |
314 | 312 | ||
315 | virt = ioremap(req.Base, req.Size); | 313 | virt = ioremap(link->resource[2]->start, |
314 | resource_size(link->resource[2])); | ||
316 | for (i = 0; i < NR_INFO; i++) { | 315 | for (i = 0; i < NR_INFO; i++) { |
317 | pcmcia_map_mem_page(link, link->win, hw_info[i].offset & ~(req.Size-1)); | 316 | pcmcia_map_mem_page(link, link->resource[2], |
318 | base = &virt[hw_info[i].offset & (req.Size-1)]; | 317 | hw_info[i].offset & ~(resource_size(link->resource[2])-1)); |
318 | base = &virt[hw_info[i].offset & (resource_size(link->resource[2])-1)]; | ||
319 | if ((readb(base+0) == hw_info[i].a0) && | 319 | if ((readb(base+0) == hw_info[i].a0) && |
320 | (readb(base+2) == hw_info[i].a1) && | 320 | (readb(base+2) == hw_info[i].a1) && |
321 | (readb(base+4) == hw_info[i].a2)) { | 321 | (readb(base+4) == hw_info[i].a2)) { |
@@ -326,7 +326,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) | |||
326 | } | 326 | } |
327 | 327 | ||
328 | iounmap(virt); | 328 | iounmap(virt); |
329 | j = pcmcia_release_window(link, link->win); | 329 | j = pcmcia_release_window(link, link->resource[2]); |
330 | return (i < NR_INFO) ? hw_info+i : NULL; | 330 | return (i < NR_INFO) ? hw_info+i : NULL; |
331 | } /* get_hwinfo */ | 331 | } /* get_hwinfo */ |
332 | 332 | ||
@@ -1486,7 +1486,6 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1486 | { | 1486 | { |
1487 | struct net_device *dev = link->priv; | 1487 | struct net_device *dev = link->priv; |
1488 | pcnet_dev_t *info = PRIV(dev); | 1488 | pcnet_dev_t *info = PRIV(dev); |
1489 | win_req_t req; | ||
1490 | int i, window_size, offset, ret; | 1489 | int i, window_size, offset, ret; |
1491 | 1490 | ||
1492 | window_size = (stop_pg - start_pg) << 8; | 1491 | window_size = (stop_pg - start_pg) << 8; |
@@ -1497,22 +1496,22 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1497 | window_size = roundup_pow_of_two(window_size); | 1496 | window_size = roundup_pow_of_two(window_size); |
1498 | 1497 | ||
1499 | /* Allocate a memory window */ | 1498 | /* Allocate a memory window */ |
1500 | req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; | 1499 | link->resource[3]->flags |= WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM|WIN_ENABLE; |
1501 | req.Attributes |= WIN_USE_WAIT; | 1500 | link->resource[3]->flags |= WIN_USE_WAIT; |
1502 | req.Base = 0; req.Size = window_size; | 1501 | link->resource[3]->start = 0; link->resource[3]->end = window_size; |
1503 | req.AccessSpeed = mem_speed; | 1502 | ret = pcmcia_request_window(link, link->resource[3], mem_speed); |
1504 | ret = pcmcia_request_window(link, &req, &link->win); | ||
1505 | if (ret) | 1503 | if (ret) |
1506 | goto failed; | 1504 | goto failed; |
1507 | 1505 | ||
1508 | offset = (start_pg << 8) + cm_offset; | 1506 | offset = (start_pg << 8) + cm_offset; |
1509 | offset -= offset % window_size; | 1507 | offset -= offset % window_size; |
1510 | ret = pcmcia_map_mem_page(link, link->win, offset); | 1508 | ret = pcmcia_map_mem_page(link, link->resource[3], offset); |
1511 | if (ret) | 1509 | if (ret) |
1512 | goto failed; | 1510 | goto failed; |
1513 | 1511 | ||
1514 | /* Try scribbling on the buffer */ | 1512 | /* Try scribbling on the buffer */ |
1515 | info->base = ioremap(req.Base, window_size); | 1513 | info->base = ioremap(link->resource[3]->start, |
1514 | resource_size(link->resource[3])); | ||
1516 | for (i = 0; i < (TX_PAGES<<8); i += 2) | 1515 | for (i = 0; i < (TX_PAGES<<8); i += 2) |
1517 | __raw_writew((i>>1), info->base+offset+i); | 1516 | __raw_writew((i>>1), info->base+offset+i); |
1518 | udelay(100); | 1517 | udelay(100); |
@@ -1521,19 +1520,20 @@ static int setup_shmem_window(struct pcmcia_device *link, int start_pg, | |||
1521 | pcnet_reset_8390(dev); | 1520 | pcnet_reset_8390(dev); |
1522 | if (i != (TX_PAGES<<8)) { | 1521 | if (i != (TX_PAGES<<8)) { |
1523 | iounmap(info->base); | 1522 | iounmap(info->base); |
1524 | pcmcia_release_window(link, link->win); | 1523 | pcmcia_release_window(link, link->resource[3]); |
1525 | info->base = NULL; link->win = 0; | 1524 | info->base = NULL; |
1526 | goto failed; | 1525 | goto failed; |
1527 | } | 1526 | } |
1528 | 1527 | ||
1529 | ei_status.mem = info->base + offset; | 1528 | ei_status.mem = info->base + offset; |
1530 | ei_status.priv = req.Size; | 1529 | ei_status.priv = resource_size(link->resource[3]); |
1531 | dev->mem_start = (u_long)ei_status.mem; | 1530 | dev->mem_start = (u_long)ei_status.mem; |
1532 | dev->mem_end = dev->mem_start + req.Size; | 1531 | dev->mem_end = dev->mem_start + resource_size(link->resource[3]); |
1533 | 1532 | ||
1534 | ei_status.tx_start_page = start_pg; | 1533 | ei_status.tx_start_page = start_pg; |
1535 | ei_status.rx_start_page = start_pg + TX_PAGES; | 1534 | ei_status.rx_start_page = start_pg + TX_PAGES; |
1536 | ei_status.stop_page = start_pg + ((req.Size - offset) >> 8); | 1535 | ei_status.stop_page = start_pg + ( |
1536 | (resource_size(link->resource[3]) - offset) >> 8); | ||
1537 | 1537 | ||
1538 | /* set up block i/o functions */ | 1538 | /* set up block i/o functions */ |
1539 | ei_status.get_8390_hdr = &shmem_get_8390_hdr; | 1539 | ei_status.get_8390_hdr = &shmem_get_8390_hdr; |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 377367d03b41..acc680739c89 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -442,7 +442,6 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
442 | { | 442 | { |
443 | struct net_device *dev = link->priv; | 443 | struct net_device *dev = link->priv; |
444 | struct smc_private *smc = netdev_priv(dev); | 444 | struct smc_private *smc = netdev_priv(dev); |
445 | win_req_t req; | ||
446 | unsigned int offset; | 445 | unsigned int offset; |
447 | int i; | 446 | int i; |
448 | 447 | ||
@@ -459,16 +458,16 @@ static int mhz_mfc_config(struct pcmcia_device *link) | |||
459 | dev->base_addr = link->resource[0]->start; | 458 | dev->base_addr = link->resource[0]->start; |
460 | 459 | ||
461 | /* Allocate a memory window, for accessing the ISR */ | 460 | /* Allocate a memory window, for accessing the ISR */ |
462 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 461 | link->resource[2]->flags = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; |
463 | req.Base = req.Size = 0; | 462 | link->resource[2]->start = link->resource[2]->end = 0; |
464 | req.AccessSpeed = 0; | 463 | i = pcmcia_request_window(link, link->resource[2], 0); |
465 | i = pcmcia_request_window(link, &req, &link->win); | ||
466 | if (i != 0) | 464 | if (i != 0) |
467 | return -ENODEV; | 465 | return -ENODEV; |
468 | 466 | ||
469 | smc->base = ioremap(req.Base, req.Size); | 467 | smc->base = ioremap(link->resource[2]->start, |
468 | resource_size(link->resource[2])); | ||
470 | offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; | 469 | offset = (smc->manfid == MANFID_MOTOROLA) ? link->conf.ConfigBase : 0; |
471 | i = pcmcia_map_mem_page(link, link->win, offset); | 470 | i = pcmcia_map_mem_page(link, link->resource[2], offset); |
472 | if ((i == 0) && | 471 | if ((i == 0) && |
473 | (smc->manfid == MANFID_MEGAHERTZ) && | 472 | (smc->manfid == MANFID_MEGAHERTZ) && |
474 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) | 473 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) |
@@ -999,7 +998,7 @@ config_failed: | |||
999 | static void smc91c92_release(struct pcmcia_device *link) | 998 | static void smc91c92_release(struct pcmcia_device *link) |
1000 | { | 999 | { |
1001 | dev_dbg(&link->dev, "smc91c92_release\n"); | 1000 | dev_dbg(&link->dev, "smc91c92_release\n"); |
1002 | if (link->win) { | 1001 | if (link->resource[2]->end) { |
1003 | struct net_device *dev = link->priv; | 1002 | struct net_device *dev = link->priv; |
1004 | struct smc_private *smc = netdev_priv(dev); | 1003 | struct smc_private *smc = netdev_priv(dev); |
1005 | iounmap(smc->base); | 1004 | iounmap(smc->base); |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index f5819526b5ee..4308bda0e96d 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -869,8 +869,6 @@ xirc2ps_config(struct pcmcia_device * link) | |||
869 | goto config_error; | 869 | goto config_error; |
870 | 870 | ||
871 | if (local->dingo) { | 871 | if (local->dingo) { |
872 | win_req_t req; | ||
873 | |||
874 | /* Reset the modem's BAR to the correct value | 872 | /* Reset the modem's BAR to the correct value |
875 | * This is necessary because in the RequestConfiguration call, | 873 | * This is necessary because in the RequestConfiguration call, |
876 | * the base address of the ethernet port (BasePort1) is written | 874 | * the base address of the ethernet port (BasePort1) is written |
@@ -890,14 +888,14 @@ xirc2ps_config(struct pcmcia_device * link) | |||
890 | * is at 0x0800. So we allocate a window into the attribute | 888 | * is at 0x0800. So we allocate a window into the attribute |
891 | * memory and write direct to the CIS registers | 889 | * memory and write direct to the CIS registers |
892 | */ | 890 | */ |
893 | req.Attributes = WIN_DATA_WIDTH_8|WIN_MEMORY_TYPE_AM|WIN_ENABLE; | 891 | link->resource[2]->flags = WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | |
894 | req.Base = req.Size = 0; | 892 | WIN_ENABLE; |
895 | req.AccessSpeed = 0; | 893 | link->resource[2]->start = link->resource[2]->end = 0; |
896 | if ((err = pcmcia_request_window(link, &req, &link->win))) | 894 | if ((err = pcmcia_request_window(link, link->resource[2], 0))) |
897 | goto config_error; | 895 | goto config_error; |
898 | 896 | ||
899 | local->dingo_ccr = ioremap(req.Base,0x1000) + 0x0800; | 897 | local->dingo_ccr = ioremap(link->resource[2]->start, 0x1000) + 0x0800; |
900 | if ((err = pcmcia_map_mem_page(link, link->win, 0))) | 898 | if ((err = pcmcia_map_mem_page(link, link->resource[2], 0))) |
901 | goto config_error; | 899 | goto config_error; |
902 | 900 | ||
903 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet | 901 | /* Setup the CCRs; there are no infos in the CIS about the Ethernet |
@@ -988,7 +986,7 @@ xirc2ps_release(struct pcmcia_device *link) | |||
988 | { | 986 | { |
989 | dev_dbg(&link->dev, "release\n"); | 987 | dev_dbg(&link->dev, "release\n"); |
990 | 988 | ||
991 | if (link->win) { | 989 | if (link->resource[2]->end) { |
992 | struct net_device *dev = link->priv; | 990 | struct net_device *dev = link->priv; |
993 | local_info_t *local = netdev_priv(dev); | 991 | local_info_t *local = netdev_priv(dev); |
994 | if (local->dingo) | 992 | if (local->dingo) |
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index dfbc41d431ff..618d9b5c1054 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -63,7 +63,6 @@ static int b43_pcmcia_resume(struct pcmcia_device *dev) | |||
63 | static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | 63 | static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) |
64 | { | 64 | { |
65 | struct ssb_bus *ssb; | 65 | struct ssb_bus *ssb; |
66 | win_req_t win; | ||
67 | int err = -ENOMEM; | 66 | int err = -ENOMEM; |
68 | int res = 0; | 67 | int res = 0; |
69 | 68 | ||
@@ -76,16 +75,15 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
76 | dev->conf.Attributes = CONF_ENABLE_IRQ; | 75 | dev->conf.Attributes = CONF_ENABLE_IRQ; |
77 | dev->conf.IntType = INT_MEMORY_AND_IO; | 76 | dev->conf.IntType = INT_MEMORY_AND_IO; |
78 | 77 | ||
79 | win.Attributes = WIN_ENABLE | WIN_DATA_WIDTH_16 | | 78 | dev->resource[2]->flags |= WIN_ENABLE | WIN_DATA_WIDTH_16 | |
80 | WIN_USE_WAIT; | 79 | WIN_USE_WAIT; |
81 | win.Base = 0; | 80 | dev->resource[2]->start = 0; |
82 | win.Size = SSB_CORE_SIZE; | 81 | dev->resource[2]->end = SSB_CORE_SIZE; |
83 | win.AccessSpeed = 250; | 82 | res = pcmcia_request_window(dev, dev->resource[2], 250); |
84 | res = pcmcia_request_window(dev, &win, &dev->win); | ||
85 | if (res != 0) | 83 | if (res != 0) |
86 | goto err_kfree_ssb; | 84 | goto err_kfree_ssb; |
87 | 85 | ||
88 | res = pcmcia_map_mem_page(dev, dev->win, 0); | 86 | res = pcmcia_map_mem_page(dev, dev->resource[2], 0); |
89 | if (res != 0) | 87 | if (res != 0) |
90 | goto err_disable; | 88 | goto err_disable; |
91 | 89 | ||
@@ -96,7 +94,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) | |||
96 | if (res != 0) | 94 | if (res != 0) |
97 | goto err_disable; | 95 | goto err_disable; |
98 | 96 | ||
99 | err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); | 97 | err = ssb_bus_pcmciabus_register(ssb, dev, dev->resource[2]->start); |
100 | if (err) | 98 | if (err) |
101 | goto err_disable; | 99 | goto err_disable; |
102 | dev->priv = ssb; | 100 | dev->priv = ssb; |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 88560d0ae50a..ab34cb8c56c7 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -391,7 +391,6 @@ static int ray_config(struct pcmcia_device *link) | |||
391 | { | 391 | { |
392 | int ret = 0; | 392 | int ret = 0; |
393 | int i; | 393 | int i; |
394 | win_req_t req; | ||
395 | struct net_device *dev = (struct net_device *)link->priv; | 394 | struct net_device *dev = (struct net_device *)link->priv; |
396 | ray_dev_t *local = netdev_priv(dev); | 395 | ray_dev_t *local = netdev_priv(dev); |
397 | 396 | ||
@@ -420,46 +419,45 @@ static int ray_config(struct pcmcia_device *link) | |||
420 | goto failed; | 419 | goto failed; |
421 | 420 | ||
422 | /*** Set up 32k window for shared memory (transmit and control) ************/ | 421 | /*** Set up 32k window for shared memory (transmit and control) ************/ |
423 | req.Attributes = | 422 | link->resource[2]->flags |= WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; |
424 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; | 423 | link->resource[2]->start = 0; |
425 | req.Base = 0; | 424 | link->resource[2]->end = 0x8000; |
426 | req.Size = 0x8000; | 425 | ret = pcmcia_request_window(link, link->resource[2], ray_mem_speed); |
427 | req.AccessSpeed = ray_mem_speed; | ||
428 | ret = pcmcia_request_window(link, &req, &link->win); | ||
429 | if (ret) | 426 | if (ret) |
430 | goto failed; | 427 | goto failed; |
431 | ret = pcmcia_map_mem_page(link, link->win, 0); | 428 | ret = pcmcia_map_mem_page(link, link->resource[2], 0); |
432 | if (ret) | 429 | if (ret) |
433 | goto failed; | 430 | goto failed; |
434 | local->sram = ioremap(req.Base, req.Size); | 431 | local->sram = ioremap(link->resource[2]->start, |
432 | resource_size(link->resource[2])); | ||
435 | 433 | ||
436 | /*** Set up 16k window for shared memory (receive buffer) ***************/ | 434 | /*** Set up 16k window for shared memory (receive buffer) ***************/ |
437 | req.Attributes = | 435 | link->resource[3]->flags |= |
438 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; | 436 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_CM | WIN_ENABLE | WIN_USE_WAIT; |
439 | req.Base = 0; | 437 | link->resource[3]->start = 0; |
440 | req.Size = 0x4000; | 438 | link->resource[3]->end = 0x4000; |
441 | req.AccessSpeed = ray_mem_speed; | 439 | ret = pcmcia_request_window(link, link->resource[3], ray_mem_speed); |
442 | ret = pcmcia_request_window(link, &req, &local->rmem_handle); | ||
443 | if (ret) | 440 | if (ret) |
444 | goto failed; | 441 | goto failed; |
445 | ret = pcmcia_map_mem_page(link, local->rmem_handle, 0x8000); | 442 | ret = pcmcia_map_mem_page(link, link->resource[3], 0x8000); |
446 | if (ret) | 443 | if (ret) |
447 | goto failed; | 444 | goto failed; |
448 | local->rmem = ioremap(req.Base, req.Size); | 445 | local->rmem = ioremap(link->resource[3]->start, |
446 | resource_size(link->resource[3])); | ||
449 | 447 | ||
450 | /*** Set up window for attribute memory ***********************************/ | 448 | /*** Set up window for attribute memory ***********************************/ |
451 | req.Attributes = | 449 | link->resource[4]->flags |= |
452 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; | 450 | WIN_DATA_WIDTH_8 | WIN_MEMORY_TYPE_AM | WIN_ENABLE | WIN_USE_WAIT; |
453 | req.Base = 0; | 451 | link->resource[4]->start = 0; |
454 | req.Size = 0x1000; | 452 | link->resource[4]->end = 0x1000; |
455 | req.AccessSpeed = ray_mem_speed; | 453 | ret = pcmcia_request_window(link, link->resource[4], ray_mem_speed); |
456 | ret = pcmcia_request_window(link, &req, &local->amem_handle); | ||
457 | if (ret) | 454 | if (ret) |
458 | goto failed; | 455 | goto failed; |
459 | ret = pcmcia_map_mem_page(link, local->amem_handle, 0); | 456 | ret = pcmcia_map_mem_page(link, link->resource[4], 0); |
460 | if (ret) | 457 | if (ret) |
461 | goto failed; | 458 | goto failed; |
462 | local->amem = ioremap(req.Base, req.Size); | 459 | local->amem = ioremap(link->resource[4]->start, |
460 | resource_size(link->resource[4])); | ||
463 | 461 | ||
464 | dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); | 462 | dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); |
465 | dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); | 463 | dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); |
diff --git a/drivers/net/wireless/ray_cs.h b/drivers/net/wireless/ray_cs.h index 9f01ddb19748..e79848fbcca1 100644 --- a/drivers/net/wireless/ray_cs.h +++ b/drivers/net/wireless/ray_cs.h | |||
@@ -25,8 +25,6 @@ struct beacon_rx { | |||
25 | typedef struct ray_dev_t { | 25 | typedef struct ray_dev_t { |
26 | int card_status; | 26 | int card_status; |
27 | int authentication_state; | 27 | int authentication_state; |
28 | window_handle_t amem_handle; /* handle to window for attribute memory */ | ||
29 | window_handle_t rmem_handle; /* handle to window for rx buffer on card */ | ||
30 | void __iomem *sram; /* pointer to beginning of shared RAM */ | 28 | void __iomem *sram; /* pointer to beginning of shared RAM */ |
31 | void __iomem *amem; /* pointer to attribute mem window */ | 29 | void __iomem *amem; /* pointer to attribute mem window */ |
32 | void __iomem *rmem; /* pointer to receive buffer window */ | 30 | void __iomem *rmem; /* pointer to receive buffer window */ |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 9ba4dade69a4..bf16a1cf7399 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -204,11 +204,10 @@ int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val) | |||
204 | EXPORT_SYMBOL(pcmcia_write_config_byte); | 204 | EXPORT_SYMBOL(pcmcia_write_config_byte); |
205 | 205 | ||
206 | 206 | ||
207 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, | 207 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, |
208 | unsigned int offset) | 208 | unsigned int offset) |
209 | { | 209 | { |
210 | struct pcmcia_socket *s = p_dev->socket; | 210 | struct pcmcia_socket *s = p_dev->socket; |
211 | struct resource *res = wh; | ||
212 | unsigned int w; | 211 | unsigned int w; |
213 | int ret; | 212 | int ret; |
214 | 213 | ||
@@ -386,7 +385,12 @@ out: | |||
386 | return ret; | 385 | return ret; |
387 | } /* pcmcia_release_io */ | 386 | } /* pcmcia_release_io */ |
388 | 387 | ||
389 | 388 | /** | |
389 | * pcmcia_release_window() - release reserved iomem for PCMCIA devices | ||
390 | * | ||
391 | * pcmcia_release_window() releases struct resource *res which was | ||
392 | * previously reserved by calling pcmcia_request_window(). | ||
393 | */ | ||
390 | int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) | 394 | int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) |
391 | { | 395 | { |
392 | struct pcmcia_socket *s = p_dev->socket; | 396 | struct pcmcia_socket *s = p_dev->socket; |
@@ -420,6 +424,8 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) | |||
420 | kfree(win->res); | 424 | kfree(win->res); |
421 | win->res = NULL; | 425 | win->res = NULL; |
422 | } | 426 | } |
427 | res->start = res->end = 0; | ||
428 | res->flags = IORESOURCE_MEM; | ||
423 | p_dev->_win &= ~CLIENT_WIN_REQ(w); | 429 | p_dev->_win &= ~CLIENT_WIN_REQ(w); |
424 | mutex_unlock(&s->ops_mutex); | 430 | mutex_unlock(&s->ops_mutex); |
425 | 431 | ||
@@ -795,17 +801,21 @@ int pcmcia_setup_irq(struct pcmcia_device *p_dev) | |||
795 | } | 801 | } |
796 | 802 | ||
797 | 803 | ||
798 | /** pcmcia_request_window | 804 | /** |
805 | * pcmcia_request_window() - attempt to reserve iomem for PCMCIA devices | ||
799 | * | 806 | * |
800 | * Request_window() establishes a mapping between card memory space | 807 | * pcmcia_request_window() attepts to reserve an iomem ranges specified in |
801 | * and system memory space. | 808 | * struct resource *res pointing to one of the entries in |
809 | * struct pcmcia_device *p_dev->resource[2..5]. The "start" value is the | ||
810 | * requested start of the IO mem resource; "end" reflects the size | ||
811 | * requested. | ||
802 | */ | 812 | */ |
803 | int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_handle_t *wh) | 813 | int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, |
814 | unsigned int speed) | ||
804 | { | 815 | { |
805 | struct pcmcia_socket *s = p_dev->socket; | 816 | struct pcmcia_socket *s = p_dev->socket; |
806 | pccard_mem_map *win; | 817 | pccard_mem_map *win; |
807 | u_long align; | 818 | u_long align; |
808 | struct resource *res; | ||
809 | int w; | 819 | int w; |
810 | 820 | ||
811 | if (!(s->state & SOCKET_PRESENT)) { | 821 | if (!(s->state & SOCKET_PRESENT)) { |
@@ -814,19 +824,19 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
814 | } | 824 | } |
815 | 825 | ||
816 | /* Window size defaults to smallest available */ | 826 | /* Window size defaults to smallest available */ |
817 | if (req->Size == 0) | 827 | if (res->end == 0) |
818 | req->Size = s->map_size; | 828 | res->end = s->map_size; |
819 | align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; | 829 | align = (s->features & SS_CAP_MEM_ALIGN) ? res->end : s->map_size; |
820 | if (req->Size & (s->map_size-1)) { | 830 | if (res->end & (s->map_size-1)) { |
821 | dev_dbg(&p_dev->dev, "invalid map size\n"); | 831 | dev_dbg(&p_dev->dev, "invalid map size\n"); |
822 | return -EINVAL; | 832 | return -EINVAL; |
823 | } | 833 | } |
824 | if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || | 834 | if ((res->start && (s->features & SS_CAP_STATIC_MAP)) || |
825 | (req->Base & (align-1))) { | 835 | (res->start & (align-1))) { |
826 | dev_dbg(&p_dev->dev, "invalid base address\n"); | 836 | dev_dbg(&p_dev->dev, "invalid base address\n"); |
827 | return -EINVAL; | 837 | return -EINVAL; |
828 | } | 838 | } |
829 | if (req->Base) | 839 | if (res->start) |
830 | align = 0; | 840 | align = 0; |
831 | 841 | ||
832 | /* Allocate system memory window */ | 842 | /* Allocate system memory window */ |
@@ -843,7 +853,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
843 | win = &s->win[w]; | 853 | win = &s->win[w]; |
844 | 854 | ||
845 | if (!(s->features & SS_CAP_STATIC_MAP)) { | 855 | if (!(s->features & SS_CAP_STATIC_MAP)) { |
846 | win->res = pcmcia_find_mem_region(req->Base, req->Size, align, | 856 | win->res = pcmcia_find_mem_region(res->start, res->end, align, |
847 | 0, s); | 857 | 0, s); |
848 | if (!win->res) { | 858 | if (!win->res) { |
849 | dev_dbg(&p_dev->dev, "allocating mem region failed\n"); | 859 | dev_dbg(&p_dev->dev, "allocating mem region failed\n"); |
@@ -855,8 +865,8 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
855 | 865 | ||
856 | /* Configure the socket controller */ | 866 | /* Configure the socket controller */ |
857 | win->map = w+1; | 867 | win->map = w+1; |
858 | win->flags = req->Attributes; | 868 | win->flags = res->flags & WIN_FLAGS_MAP; |
859 | win->speed = req->AccessSpeed; | 869 | win->speed = speed; |
860 | win->card_start = 0; | 870 | win->card_start = 0; |
861 | 871 | ||
862 | if (s->ops->set_mem_map(s, win) != 0) { | 872 | if (s->ops->set_mem_map(s, win) != 0) { |
@@ -868,17 +878,14 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
868 | 878 | ||
869 | /* Return window handle */ | 879 | /* Return window handle */ |
870 | if (s->features & SS_CAP_STATIC_MAP) | 880 | if (s->features & SS_CAP_STATIC_MAP) |
871 | req->Base = win->static_start; | 881 | res->start = win->static_start; |
872 | else | 882 | else |
873 | req->Base = win->res->start; | 883 | res->start = win->res->start; |
874 | 884 | ||
875 | /* convert to new-style resources */ | 885 | /* convert to new-style resources */ |
876 | res = p_dev->resource[w + MAX_IO_WIN]; | 886 | res->end += res->start - 1; |
877 | res->start = req->Base; | 887 | res->flags &= ~WIN_FLAGS_REQ; |
878 | res->end = req->Base + req->Size - 1; | 888 | res->flags |= (win->map << 2) | IORESOURCE_MEM; |
879 | res->flags &= ~IORESOURCE_BITS; | ||
880 | res->flags |= (req->Attributes & WIN_FLAGS_MAP) | (win->map << 2); | ||
881 | res->flags |= IORESOURCE_MEM; | ||
882 | res->parent = win->res; | 889 | res->parent = win->res; |
883 | if (win->res) | 890 | if (win->res) |
884 | request_resource(&iomem_resource, res); | 891 | request_resource(&iomem_resource, res); |
@@ -886,7 +893,6 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
886 | dev_dbg(&p_dev->dev, "request_window results in %pR\n", res); | 893 | dev_dbg(&p_dev->dev, "request_window results in %pR\n", res); |
887 | 894 | ||
888 | mutex_unlock(&s->ops_mutex); | 895 | mutex_unlock(&s->ops_mutex); |
889 | *wh = res; | ||
890 | 896 | ||
891 | return 0; | 897 | return 0; |
892 | } /* pcmcia_request_window */ | 898 | } /* pcmcia_request_window */ |
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index dd9b40306f3d..e872e0684273 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -1596,18 +1596,13 @@ static void nsp_cs_detach(struct pcmcia_device *link) | |||
1596 | ethernet device available to the system. | 1596 | ethernet device available to the system. |
1597 | ======================================================================*/ | 1597 | ======================================================================*/ |
1598 | 1598 | ||
1599 | struct nsp_cs_configdata { | ||
1600 | nsp_hw_data *data; | ||
1601 | win_req_t req; | ||
1602 | }; | ||
1603 | |||
1604 | static int nsp_cs_config_check(struct pcmcia_device *p_dev, | 1599 | static int nsp_cs_config_check(struct pcmcia_device *p_dev, |
1605 | cistpl_cftable_entry_t *cfg, | 1600 | cistpl_cftable_entry_t *cfg, |
1606 | cistpl_cftable_entry_t *dflt, | 1601 | cistpl_cftable_entry_t *dflt, |
1607 | unsigned int vcc, | 1602 | unsigned int vcc, |
1608 | void *priv_data) | 1603 | void *priv_data) |
1609 | { | 1604 | { |
1610 | struct nsp_cs_configdata *cfg_mem = priv_data; | 1605 | nsp_hw_data *data = priv_data; |
1611 | 1606 | ||
1612 | if (cfg->index == 0) | 1607 | if (cfg->index == 0) |
1613 | return -ENODEV; | 1608 | return -ENODEV; |
@@ -1663,21 +1658,24 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, | |||
1663 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { | 1658 | if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { |
1664 | cistpl_mem_t *mem = | 1659 | cistpl_mem_t *mem = |
1665 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; | 1660 | (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; |
1666 | cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; | 1661 | p_dev->resource[2]->flags |= (WIN_DATA_WIDTH_16 | |
1667 | cfg_mem->req.Attributes |= WIN_ENABLE; | 1662 | WIN_MEMORY_TYPE_CM | |
1668 | cfg_mem->req.Base = mem->win[0].host_addr; | 1663 | WIN_ENABLE); |
1669 | cfg_mem->req.Size = mem->win[0].len; | 1664 | p_dev->resource[2]->start = mem->win[0].host_addr; |
1670 | if (cfg_mem->req.Size < 0x1000) | 1665 | p_dev->resource[2]->end = mem->win[0].len; |
1671 | cfg_mem->req.Size = 0x1000; | 1666 | if (p_dev->resource[2]->end < 0x1000) |
1672 | cfg_mem->req.AccessSpeed = 0; | 1667 | p_dev->resource[2]->end = 0x1000; |
1673 | if (pcmcia_request_window(p_dev, &cfg_mem->req, &p_dev->win) != 0) | 1668 | if (pcmcia_request_window(p_dev, p_dev->resource[2], |
1669 | 0) != 0) | ||
1674 | goto next_entry; | 1670 | goto next_entry; |
1675 | if (pcmcia_map_mem_page(p_dev, p_dev->win, | 1671 | if (pcmcia_map_mem_page(p_dev, p_dev->resource[2], |
1676 | mem->win[0].card_addr) != 0) | 1672 | mem->win[0].card_addr) != 0) |
1677 | goto next_entry; | 1673 | goto next_entry; |
1678 | 1674 | ||
1679 | cfg_mem->data->MmioAddress = (unsigned long) ioremap_nocache(cfg_mem->req.Base, cfg_mem->req.Size); | 1675 | data->MmioAddress = (unsigned long) |
1680 | cfg_mem->data->MmioLength = cfg_mem->req.Size; | 1676 | ioremap_nocache(p_dev->resource[2]->start, |
1677 | resource_size(p_dev->resource[2])); | ||
1678 | data->MmioLength = resource_size(p_dev->resource[2]); | ||
1681 | } | 1679 | } |
1682 | /* If we got this far, we're cool! */ | 1680 | /* If we got this far, we're cool! */ |
1683 | return 0; | 1681 | return 0; |
@@ -1693,18 +1691,12 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1693 | { | 1691 | { |
1694 | int ret; | 1692 | int ret; |
1695 | scsi_info_t *info = link->priv; | 1693 | scsi_info_t *info = link->priv; |
1696 | struct nsp_cs_configdata *cfg_mem; | ||
1697 | struct Scsi_Host *host; | 1694 | struct Scsi_Host *host; |
1698 | nsp_hw_data *data = &nsp_data_base; | 1695 | nsp_hw_data *data = &nsp_data_base; |
1699 | 1696 | ||
1700 | nsp_dbg(NSP_DEBUG_INIT, "in"); | 1697 | nsp_dbg(NSP_DEBUG_INIT, "in"); |
1701 | 1698 | ||
1702 | cfg_mem = kzalloc(sizeof(*cfg_mem), GFP_KERNEL); | 1699 | ret = pcmcia_loop_config(link, nsp_cs_config_check, data); |
1703 | if (!cfg_mem) | ||
1704 | return -ENOMEM; | ||
1705 | cfg_mem->data = data; | ||
1706 | |||
1707 | ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem); | ||
1708 | if (ret) | 1700 | if (ret) |
1709 | goto cs_failed; | 1701 | goto cs_failed; |
1710 | 1702 | ||
@@ -1767,18 +1759,15 @@ static int nsp_cs_config(struct pcmcia_device *link) | |||
1767 | printk(", io %pR", link->resource[0]); | 1759 | printk(", io %pR", link->resource[0]); |
1768 | if (link->resource[1]) | 1760 | if (link->resource[1]) |
1769 | printk(" & %pR", link->resource[1]); | 1761 | printk(" & %pR", link->resource[1]); |
1770 | if (link->win) | 1762 | if (link->resource[2]) |
1771 | printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, | 1763 | printk(", mem %pR", link->resource[2]); |
1772 | cfg_mem->req.Base+cfg_mem->req.Size-1); | ||
1773 | printk("\n"); | 1764 | printk("\n"); |
1774 | 1765 | ||
1775 | kfree(cfg_mem); | ||
1776 | return 0; | 1766 | return 0; |
1777 | 1767 | ||
1778 | cs_failed: | 1768 | cs_failed: |
1779 | nsp_dbg(NSP_DEBUG_INIT, "config fail"); | 1769 | nsp_dbg(NSP_DEBUG_INIT, "config fail"); |
1780 | nsp_cs_release(link); | 1770 | nsp_cs_release(link); |
1781 | kfree(cfg_mem); | ||
1782 | 1771 | ||
1783 | return -ENODEV; | 1772 | return -ENODEV; |
1784 | } /* nsp_cs_config */ | 1773 | } /* nsp_cs_config */ |
@@ -1807,7 +1796,7 @@ static void nsp_cs_release(struct pcmcia_device *link) | |||
1807 | scsi_remove_host(info->host); | 1796 | scsi_remove_host(info->host); |
1808 | } | 1797 | } |
1809 | 1798 | ||
1810 | if (link->win) { | 1799 | if (resource_size(link->resource[2])) { |
1811 | if (data != NULL) { | 1800 | if (data != NULL) { |
1812 | iounmap((void *)(data->MmioAddress)); | 1801 | iounmap((void *)(data->MmioAddress)); |
1813 | } | 1802 | } |
diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 68d8bde7e8d6..63cb9bbe390e 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h | |||
@@ -68,28 +68,4 @@ typedef struct config_req_t { | |||
68 | #define PRESENT_IOBASE_3 0x100 | 68 | #define PRESENT_IOBASE_3 0x100 |
69 | #define PRESENT_IOSIZE 0x200 | 69 | #define PRESENT_IOSIZE 0x200 |
70 | 70 | ||
71 | /* For RequestWindow */ | ||
72 | typedef struct win_req_t { | ||
73 | u_int Attributes; | ||
74 | u_long Base; | ||
75 | u_int Size; | ||
76 | u_int AccessSpeed; | ||
77 | } win_req_t; | ||
78 | |||
79 | /* Attributes for RequestWindow */ | ||
80 | #define WIN_MEMORY_TYPE_CM 0x00 /* default */ | ||
81 | #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ | ||
82 | #define WIN_DATA_WIDTH_8 0x00 /* default */ | ||
83 | #define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ | ||
84 | #define WIN_ENABLE 0x01 /* MAP_ACTIVE */ | ||
85 | #define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ | ||
86 | |||
87 | #define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | | ||
88 | MAP_USE_WAIT */ | ||
89 | #define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: | ||
90 | 0x04 -> 0 | ||
91 | 0x08 -> 1 | ||
92 | 0x0c -> 2 | ||
93 | 0x10 -> 3 */ | ||
94 | |||
95 | #endif /* _LINUX_CS_H */ | 71 | #endif /* _LINUX_CS_H */ |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 70c58ed2278c..6f7cb38d8850 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
@@ -36,8 +36,6 @@ struct pcmcia_device; | |||
36 | struct config_t; | 36 | struct config_t; |
37 | struct net_device; | 37 | struct net_device; |
38 | 38 | ||
39 | typedef struct resource *window_handle_t; | ||
40 | |||
41 | /* dynamic device IDs for PCMCIA device drivers. See | 39 | /* dynamic device IDs for PCMCIA device drivers. See |
42 | * Documentation/pcmcia/driver.txt for details. | 40 | * Documentation/pcmcia/driver.txt for details. |
43 | */ | 41 | */ |
@@ -92,7 +90,6 @@ struct pcmcia_device { | |||
92 | 90 | ||
93 | /* deprecated, will be cleaned up soon */ | 91 | /* deprecated, will be cleaned up soon */ |
94 | config_req_t conf; | 92 | config_req_t conf; |
95 | window_handle_t win; | ||
96 | 93 | ||
97 | /* device setup */ | 94 | /* device setup */ |
98 | unsigned int irq; | 95 | unsigned int irq; |
@@ -209,10 +206,10 @@ int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, | |||
209 | int pcmcia_request_configuration(struct pcmcia_device *p_dev, | 206 | int pcmcia_request_configuration(struct pcmcia_device *p_dev, |
210 | config_req_t *req); | 207 | config_req_t *req); |
211 | 208 | ||
212 | int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, | 209 | int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, |
213 | window_handle_t *wh); | 210 | unsigned int speed); |
214 | int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win); | 211 | int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res); |
215 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win, | 212 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, |
216 | unsigned int offset); | 213 | unsigned int offset); |
217 | 214 | ||
218 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); | 215 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); |
@@ -234,6 +231,23 @@ static inline int pcmcia_io_cfg_data_width(unsigned int flags) | |||
234 | return IO_DATA_PATH_WIDTH_AUTO; | 231 | return IO_DATA_PATH_WIDTH_AUTO; |
235 | } | 232 | } |
236 | 233 | ||
234 | /* IO memory */ | ||
235 | #define WIN_MEMORY_TYPE_CM 0x00 /* default */ | ||
236 | #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ | ||
237 | #define WIN_DATA_WIDTH_8 0x00 /* default */ | ||
238 | #define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ | ||
239 | #define WIN_ENABLE 0x01 /* MAP_ACTIVE */ | ||
240 | #define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ | ||
241 | |||
242 | #define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | | ||
243 | MAP_USE_WAIT */ | ||
244 | #define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: | ||
245 | 0x04 -> 0 | ||
246 | 0x08 -> 1 | ||
247 | 0x0c -> 2 | ||
248 | 0x10 -> 3 */ | ||
249 | |||
250 | |||
237 | #endif /* __KERNEL__ */ | 251 | #endif /* __KERNEL__ */ |
238 | 252 | ||
239 | #endif /* _LINUX_DS_H */ | 253 | #endif /* _LINUX_DS_H */ |