(pcmcia_resource.c needed to be changed) Issue with configuring multifunction card in Acer Aspire laptop.

kaustav.majumdar at wipro.com kaustav.majumdar at wipro.com
Tue May 23 03:01:34 EDT 2006


Hi David,

Thank you for the reply.
But I had not got the point of problem with the serial_cs driver.
If you will check the cat /proc/ioports output I had sent in my first mail, it shows:

00c0-00df : dma2
00f0-00ff : fpu
0100-010f : pcmcia_socket0
  0100-0107 : serial
0170-0177 : ide1
01f0-01f7 : ide0

So we are getting 16 bytes of IO port is allocated for the PCMCIA socket itself.
dump_cis is also showing that the serial function requests for 16 bytes of IO port.

So if the serial_cs will allocate IO ports for USB function also then probably we should get 80 bytes of IO port allocated for the pcmcia socket. But we are not getting that.

Secondly, in the alloc_io_space function, (the portion which I had suggested the change)
Socket's IO window base port will be of form 0x*00
So obviously if (align -1) will not be greater than 0x100 then the result of the '&' operation will give 0.
Now if there will be no IO address mentioned for the PCMCIA function then this will give us a conflict.
And I feel this is the case happening with the said card also.

Thirdly, may I know what sort of obvious conflicts we are checking over this code snippet? May be we should dig further before returning 1 from that portion. Actually after applying the patch when I had configured the card I had got the following output from cat /proc/ioports:

00c0-00df : dma2
00f0-00ff : fpu
0100-014f : pcmcia_socket0
  0100-0107 : serial
  0110-014f : cfu950-hcd
0170-0177 : ide1
01f0-01f7 : ide2

So if we can avoid the said conflict then we are getting the IO port ranges as required.

Please let me know if you want any more information.

Looking forward to your reply,

Thanks and regards
Kaustav


-----Original Message-----
From: David Hinds [mailto:dahinds at gmail.com]
Sent: Monday, May 22, 2006 11:00 PM
To: Kaustav Majumdar (WT01 - Semiconductors & Consumer Electronics)
Cc: komurojun-mbn at nifty.com; linux-pcmcia at lists.infradead.org; dahinds at users.sourceforge.net; linux at dominikbrodowski.net
Subject: Re: (pcmcia_resource.c needed to be changed) Issue with configuring multifunction card in Acer Aspire laptop.

This is a "compliant" multifunction card (separate CIS information for each function) so Komuro's statement that one driver should allocate both IO regions is incorrect: both drivers should be able to configure this card without knowledge of the other.  But each driver needs to be associated with just the correct card function.

I don't think the patch is correct.  It seems to say that certain IO port request conflicts should be silently ignored.  I think the problem is that the serial_cs driver is allocating ports for the USB function when it should be ignoring it.

-- Dave

On 5/22/06, kaustav.majumdar at wipro.com < kaustav.majumdar at wipro.com> wrote:

Hi Komuro,

Thanks for your reply.
I had followed the way as suggested by you. I think the same model is
also followed by pcnet_cs.c. But it did not work.

The problem here is that the first function (function 0) is serial (as
you can see from the dump_cis output), so the serial_cs will configure
the serial function first and pcmcia_get_configuration_info will always
fail.
That is the behavior I had got while testing the same.

Instead I had changed the pcmcia_resource.c file somewhat and now the
two functions are getting configured properly. Though we are facing some
issues regarding serial ports functioning, but I believe it is due to
the h/w and the serial core's handling of the port.

I decided to send this patch to David and Dominik for verification,
since they are the owners of this code.

Following is the patch.

--- linux-2.6.15.4/drivers/pcmcia/pcmcia_resource.c     2006-02-10
12:52:48.000000000 +0530
+++ linux-2.6.15.4-Kaustav/drivers/pcmcia/pcmcia_resource.c
2006-05-22 11:53:09.000000000 +0530
@@ -96,10 +96,14 @@ static int alloc_io_space(struct pcmcia_
         * what was asked for.  It is a hack because it does not catch
all
         * potential conflicts, just the most obvious ones.
         */
-       for (i = 0; i < MAX_IO_WIN; i++)
+       for (i = 0; i < MAX_IO_WIN; i++) {
                if ((s->io[i].NumPorts != 0) &&
-                   ((s->io[i].BasePort & (align-1)) == *base))
-                       return 1;
+                   ((s->io[i].BasePort & (align-1)) == *base)) {
+                       if (i == 1) {
+                               return 1;
+                       }
+               }
+       }
        for (i = 0; i < MAX_IO_WIN; i++) {
                if (s->io[i].NumPorts == 0) {
                        s->io[i].res = pcmcia_find_io_region(*base, num,
align, s);

I think this is required as otherwise the PCMCIA subsystem does not
check for any other available IO resources even when they are actually
available.

Thank you,
With Regards,
Kaustav Majumdar



-----Original Message-----
From: Komuro [mailto:komurojun-mbn at nifty.com]
Sent: Saturday, May 20, 2006 11:29 AM
To: Kaustav Majumdar (WT01 - Semiconductors & Consumer Electronics)
Cc: linux-pcmcia at lists.infradead.org
Subject: Re: Issue with configuring multifunction card in Acer Aspire
laptop.


Hello,

The USB client driver should allocate both usb io-port and serial
io-port.
So you should set io.BasePort2, io.NumPort2, io.Attributes2
at the USB client driver.

The serial_cs gets the io-port by pcmcia_get_configuration_info.

Please see the smc91c92_cs.c driver for reference.


Best Regards
Komuro


>
>Hi all,
>
>We are writing a PCMCIA client driver for USB function of a
>multifunction PCMCIA card.
>We are facing an issue in configuring both of the functions of the
card.
>
>The card hosts a serial function (function 0) and a USB function
>(function 1).
>The serial function is driven by standard serial_cs.
>The dump_cis information of the card shows:
>
>Socket 0:
>  dev_info
>    SRAM 200ns, 2kb
>  attr_dev_info
>    ROM 200ns, 512b
>    fn_specific 200ns, 512b
>  mfc {
>    manfid 0xABCD, 0xABCD
>    vers_1 6.1, "CF CARD", "GENERIC", "", ""
>    funcid serial_port [post]
>    serial_interface
>      uart 16550 [space/mark/odd/even] [5/6/7/8] [1/1.5/2]
>    config base 0x0200 mask 0x006f last_index 0x07
>    cftable_entry 0x07 [default]
>      [rdybsy]
>      Vcc Vnom 3300mV
>      io 0x0000-0x000f [lines=4] [8bit]
>      irq mask 0xffff [level] [shared]
>  }, {
>    funcid unknown
>    config base 0x0300 mask 0x006f last_index 0x07
>    cftable_entry 0x07 [default]
>      [rdybsy]
>      Vcc Vnom 3300mV
>      io 0x0000-0x003f [lines=6] [8bit]
>      irq mask 0xffff [level] [shared]
>      memory 0x0000-0x07ff @ 0x0000
>  }
>
>
>The USB client driver is working properly when we don't insert the
>serial_cs module.
>That is, when the serial function is not configured then the USB client
>driver is configuring the USB function perfectly.
>But we are facing problem when we insert both the modules and try to
>configure both the functions simultaneously.
>In that case we are getting following messages from dmesg:
>
>yenta_socket: yenta_set_mem_map
>pcmcia: registering new device pcmcia0.0
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>serial_attach()
>serial_event(0x000004)
>serial_config(0xc8791600)
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>serial_multi_config(0xc8791600)
>serial_multi_config(0xc8791600) inside 1st while
>serial_multi_config(0xc8791600) inside 1st if
>i = 0x0 [This is the return value from pcmcia_request_io]
>serial_multi_config(0xc8791600) inside 2nd if
>yenta_socket: yenta_set_socket
>yenta_socket: yenta_set_power
>yenta_socket: yenta_set_socket
>yenta_socket: yenta_set_power
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_io_map
>ttyS4: detected caps 00000700 should be 00000100
>0.0: ttyS4 at I/O 0x100 (irq = 6) is a 16C950/954
>pcmcia: registering new device pcmcia0.1
>yenta_socket: yenta_set_mem_map
>USB-HCD_cs: USB-HCD_cs_attach: Attach entry point starts
>USB-HCD_cs: USB-HCD_cs_event: event for (0xc727c080)
>USB-HCD_cs: USB-HCD_cs_config: config starting for (0xc727c080)
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>yenta_socket: yenta_set_mem_map
>USB-HCD_cs: USB-HCD_cs_config: configuration failed
> 0.1: GetNextTuple: No more items
>USB-HCD_cs: USB-HCD_cs_release(0xc727c080)
>USB-HCD_cs: USB-HCD_cs_release: configuration can not be released
>USB-HCD_cs: USB-HCD_cs_release: io window can not be released
>USB-HCD_cs: USB-HCD_cs_release: release successful
>USB-HCD_cs: USB-HCD_cs_event: event successfully handled for
>(0xc727c080)
>USB-HCD_cs: USB-HCD_cs_attach: successfully completed
>ds: ds_open(socket 0)
>pcmcia: Detected deprecated PCMCIA ioctl usage.
>pcmcia: This interface will soon be removed from the kernel; please
>expect breakage unless you upgrade to new tools.
>pcmcia: see
> http://www.kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html for
>details.
>ds: ds_release(socket 0)
>ds: ds_open(socket 0)
>ds: ds_release(socket 0)
>
>On further study, we had found out this is failing in the function
>alloc_io_space(), where it checks for most obvious conflicts.
>Also we are getting following output from cat /proc/ioports:
>
>0000-001f : dma1
>0020-0021 : pic1
>0040-0043 : timer0
>0050-0053 : timer1
>0060-006f : keyboard
>0070-0077 : rtc
>0080-008f : dma page reg
>00a0-00a1 : pic2
>00c0-00df : dma2
>00f0-00ff : fpu
>0100-010f : pcmcia_socket0
>  0100-0107 : serial
>0170-0177 : ide1
>01f0-01f7 : ide0
>0376-0376 : ide1
>03c0-03df : vga+
>03f6-03f6 : ide0
>04d0-04d1 : pnp 00:03
>0cf8-0cff : PCI conf1
>1000-10ff : 0000:00:02.6
>  1000-10ff : SiS SI7013 Modem
>1400-14ff : 0000:00:02.7
>  1400-14ff : SiS SI7012
>1800-18ff : 0000:00:04.0
>  1800-18ff : sis900
>1c00-1c7f : 0000:00:02.6
>  1c00-1c7f : SiS SI7013 Modem
>1c80-1cff : 0000:00: 02.7
>  1c80-1cff : SiS SI7012
>2000-200f : 0000:00:02.5
>  2000-2007 : ide0
>  2008-200f : ide1
>2400-24ff : PCI CardBus #02
>2800-28ff : PCI CardBus #02
>8000-807f : motherboard
>  8000-8003 : PM1a_EVT_BLK
>  8004-8005 : PM1a_CNT_BLK
>  8008-800b : PM_TMR
>  8010-8015 : ACPI CPU throttle
>  8016-8016 : PM2_CNT_BLK
>  8020-8023 : GPE0_BLK
>  8030-8033 : GPE1_BLK
>8080-80ff : motherboard
>  8080-80ff : pnp 00:03
>8100-811f : 0000:00:02.1
>  8100-811f : motherboard
>    8100-811f : pnp 00:03
>      8100-811f : sis96x_smbus
>a000-afff : PCI Bus #01
>  a000-a07f : 0000:01:00.0
>
>The system we are testing on is Acer Aspire 3003LC running Linux Kernel
>2.6.15.4, downloaded from kernel.org
>We are using PCMCIAUTILS-013.
>The /etc/pcmcia/config.opts file reads as:
>
>#
># Local PCMCIA Configuration File
>#
>#----------------------------------------------------------------------
>#
># System resources available for PCMCIA cards
>#
># NOTE: these settings have no effect on resources assigned to a
># CardBus bridge device itself; this file only affects resources
># assigned to cards.  Also, interrupt settings here will only affect
># ISA bus interrupts assigned to 16-bit cards.  PCI interrupts
># generally can't be reconfigured.
>#
># With the kernel PCMCIA subsystem, these settings also have no effect
># at all on resources used for 32-bit CardBus cards.  Those are set by
># the PCI hotplug subsystem.
>#
>
>include port 0x100-0x4ff, port 0x800-0x8ff, port 0xc00-0xcff
>include memory 0xc0000-0xfffff
>include memory 0xa0000000-0xa0ffffff, memory 0x60000000-0x60ffffff
>
># High port numbers do not always work...
>include port 0x1000-0x17ff
>
># Extra port range for IBM Token Ring
>#include port 0xa00-0xaff
>
># Resources we should not use, even if they appear to be available
>
># First built-in serial port
>exclude irq 4
># Second built-in serial port
>#exclude irq 3
># First built-in parallel port
>exclude irq 7
># PS/2 Mouse controller port, comment this out if you don't have a PS/2
># based mouse
>exclude irq 12
># SB emulation ports
>exclude port 0x220-0x22f
># Radeon IGP MCE's if you touch ports 3b0->3bb & 3d3
>exclude port 0x3b0-0x3bb
>exclude port 0x3d3-0x3d3
>
>#----------------------------------------------------------------------
>
># Examples of options for loadable modules
>
># To fix sluggish network with IBM ethernet adapter...
>#module "pcnet_cs" opts "mem_speed=600"
>
># Options for IBM Token Ring adapters
>#module "ibmtr_cs" opts "mmiobase=0xd0000 srambase=0xd4000"
>
># Options for Raylink/WebGear driver: uncomment only one line...
># Generic ad-hoc network
>module "ray_cs" opts "essid=ADHOC_ESSID hop_dwell=128 beacon_period=256
>translate=1"
># Infrastructure network for older cards
>#module "ray_cs" opts "net_type=1 essid=ESSID1"
># Infrastructure network for WebGear
>#module "ray_cs" opts "net_type=1 essid=ESSID1 translate=1
hop_dwell=128
>beacon_period=256"
>
># Options for WaveLAN/IEEE driver (AccessPoint mode)...
>#module "wvlan_cs" opts "station_name=MY_PC"
># Options for WaveLAN/IEEE driver (ad-hoc mode)...
>#module "wvlan_cs" opts "port_type=3 channel=1 station_name=MY_PC"
>
># Options for Xircom Netwave driver...
>#module "netwave_cs" opts "domain=0x100 scramble_key=0x0"
>
>
>
>Looking forward to your suggestions.
>Thanks in advance,
>
>With Regards,
>Kaustav Majumdar
>
>
>The information contained in this electronic message and any
attachments to t
his message are intended for the exclusive use of the addressee(s) and
may con
tain proprietary, confidential or privileged information. If you are not
the i
ntended recipient, you should not disseminate, distribute or copy this
e-mail.
Please notify the sender immediately and destroy all copies of this
message a
nd any attachments.
>
>
>WARNING: Computer viruses can be transmitted via email. The recipient
should
check this email and any attachments for the presence of viruses. The
company
accepts no liability for any damage caused by any virus transmitted by
this em
ail.
>
>
>www.wipro.com
>
>_______________________________________________
>Linux PCMCIA reimplementation list
>http://lists.infradead.org/mailman/listinfo/linux-pcmcia



The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

www.wipro.com



More information about the linux-pcmcia mailing list