aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/axnet_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-24 11:23:51 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-08-03 03:04:11 -0400
commit90abdc3b973229bae98dd96649d9f7106cc177a4 (patch)
tree5c1a7a131b65560dd73b5103118d8c7631bd76a4 /drivers/net/pcmcia/axnet_cs.c
parent9a017a910346afd88ec2e065989903bf211a7d37 (diff)
pcmcia: do not use io_req_t when calling pcmcia_request_io()
Instead of io_req_t, drivers are now requested to fill out struct pcmcia_device *p_dev->resource[0,1] for up to two ioport ranges. After a call to pcmcia_request_io(), the ports found there are reserved, after calling pcmcia_request_configuration(), they may be used. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-ide@vger.kernel.org CC: linux-usb@vger.kernel.org CC: laforge@gnumonks.org CC: linux-mtd@lists.infradead.org CC: alsa-devel@alsa-project.org CC: linux-serial@vger.kernel.org CC: Michael Buesch <mb@bu3sch.de> Acked-by: Marcel Holtmann <marcel@holtmann.org> (for drivers/bluetooth/) Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/net/pcmcia/axnet_cs.c')
-rw-r--r--drivers/net/pcmcia/axnet_cs.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index c52fdf31cbfe..5f05ffb240cc 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -259,28 +259,30 @@ static int get_prom(struct pcmcia_device *link)
259static int try_io_port(struct pcmcia_device *link) 259static int try_io_port(struct pcmcia_device *link)
260{ 260{
261 int j, ret; 261 int j, ret;
262 if (link->io.NumPorts1 == 32) { 262 link->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
263 link->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; 263 link->resource[1]->flags &= ~IO_DATA_PATH_WIDTH;
264 if (link->resource[0]->end == 32) {
265 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
264 /* for master/slave multifunction cards */ 266 /* for master/slave multifunction cards */
265 if (link->io.NumPorts2 > 0) 267 if (link->resource[1]->end > 0)
266 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 268 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
267 } else { 269 } else {
268 /* This should be two 16-port windows */ 270 /* This should be two 16-port windows */
269 link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; 271 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
270 link->io.Attributes2 = IO_DATA_PATH_WIDTH_16; 272 link->resource[1]->flags |= IO_DATA_PATH_WIDTH_16;
271 } 273 }
272 if (link->io.BasePort1 == 0) { 274 if (link->resource[0]->start == 0) {
273 link->io.IOAddrLines = 16;
274 for (j = 0; j < 0x400; j += 0x20) { 275 for (j = 0; j < 0x400; j += 0x20) {
275 link->io.BasePort1 = j ^ 0x300; 276 link->resource[0]->start = j ^ 0x300;
276 link->io.BasePort2 = (j ^ 0x300) + 0x10; 277 link->resource[1]->start = (j ^ 0x300) + 0x10;
277 ret = pcmcia_request_io(link, &link->io); 278 link->io_lines = 16;
279 ret = pcmcia_request_io(link);
278 if (ret == 0) 280 if (ret == 0)
279 return ret; 281 return ret;
280 } 282 }
281 return ret; 283 return ret;
282 } else { 284 } else {
283 return pcmcia_request_io(link, &link->io); 285 return pcmcia_request_io(link);
284 } 286 }
285} 287}
286 288
@@ -301,15 +303,15 @@ static int axnet_configcheck(struct pcmcia_device *p_dev,
301 network function with window 0, and serial with window 1 */ 303 network function with window 0, and serial with window 1 */
302 if (io->nwin > 1) { 304 if (io->nwin > 1) {
303 i = (io->win[1].len > io->win[0].len); 305 i = (io->win[1].len > io->win[0].len);
304 p_dev->io.BasePort2 = io->win[1-i].base; 306 p_dev->resource[1]->start = io->win[1-i].base;
305 p_dev->io.NumPorts2 = io->win[1-i].len; 307 p_dev->resource[1]->end = io->win[1-i].len;
306 } else { 308 } else {
307 i = p_dev->io.NumPorts2 = 0; 309 i = p_dev->resource[1]->end = 0;
308 } 310 }
309 p_dev->io.BasePort1 = io->win[i].base; 311 p_dev->resource[0]->start = io->win[i].base;
310 p_dev->io.NumPorts1 = io->win[i].len; 312 p_dev->resource[0]->end = io->win[i].len;
311 p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; 313 p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK;
312 if (p_dev->io.NumPorts1 + p_dev->io.NumPorts2 >= 32) 314 if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32)
313 return try_io_port(p_dev); 315 return try_io_port(p_dev);
314 316
315 return -ENODEV; 317 return -ENODEV;