Questions about ioport-assignments

Wolfram Sang w.sang at pengutronix.de
Wed Jan 13 18:15:15 EST 2010


Hi,

I borrowed a modem/network-combo card for testing, namely a D-Link DMF-560TX.
It does not work out of the box:

[ 2227.051073] pcmcia 0.0: pcmcia: registering new device pcmcia0.0
[ 2227.105828] eth%d: pcnet_reset_8390() did not complete.
[ 2227.115966] pcnet_cs: unable to read hardware net address for io base 0xc300
[ 2227.845576] eth%d: pcnet_reset_8390() did not complete.
[ 2227.855714] pcnet_cs: unable to read hardware net address for io base 0xc300

(/proc/ioports does also _not_ list occupied ports at 0xc300.)

The following page describes a workaround which still applies:

  http://tuxmobil.org/pcmcia_dlink_dmf_560tx_lan_modem_linux.html

(short summary: exclude the ioport region assigned to the PCI-host-controller,
so mapping will be forced to ioport 0x300 instead of e.g. 0xc300)

Playing around, I made this change which also helps:

diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 776cad2..15904ff 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -497,8 +497,8 @@ static int try_io_port(struct pcmcia_device *link)
        link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
        link->io.Attributes2 = IO_DATA_PATH_WIDTH_16;
     }
+    link->io.IOAddrLines = 16;
     if (link->io.BasePort1 == 0) {
-       link->io.IOAddrLines = 16;
        for (j = 0; j < 0x400; j += 0x20) {
            link->io.BasePort1 = j ^ 0x300;
            link->io.BasePort2 = (j ^ 0x300) + 0x10;

Now, i have a few questions:

- Is it just a buggy card if it works at 0x300 but not 0xc300
  (or is it maybe a problem with Linux assigning the io area)?
- Why is IOAddrLines forced to 16 (and thus alignment to 0x10000), but only
  if BasePort1 is 0?

Thanks for assistance,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-pcmcia/attachments/20100114/9446b40e/attachment.sig>


More information about the linux-pcmcia mailing list