Commit 1f977850 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] serial-cs and unusable port size ranges

A couple of GSM GPRS PCMCIA cards advertise 16 rather than 8 port sized
windows for their serial interface.  This breaks our current pcmcia serial
driver which ignores any windows that are not 8 bytes.

To avoid any regressions on other cards given this driver contains a
certain amount of "magic" the patch below looks for 8 byte windows first so
will not break existing supported cards (I hope ;))
Patch-by: default avatarAlan Cox <alan@redhat.com>
OSDL Developer Certiticate Of Origin included herein by reference

Acked by Russell King <rmk@arm.linux.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 73441a0e
...@@ -363,9 +363,10 @@ next_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse) ...@@ -363,9 +363,10 @@ next_tuple(client_handle_t handle, tuple_t * tuple, cisparse_t * parse)
/*====================================================================*/ /*====================================================================*/
static int simple_config(dev_link_t * link) static int simple_config(dev_link_t *link)
{ {
static ioaddr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; static ioaddr_t base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
static int size_table[2] = { 8, 16 };
client_handle_t handle = link->handle; client_handle_t handle = link->handle;
struct serial_info *info = link->priv; struct serial_info *info = link->priv;
tuple_t tuple; tuple_t tuple;
...@@ -374,6 +375,7 @@ static int simple_config(dev_link_t * link) ...@@ -374,6 +375,7 @@ static int simple_config(dev_link_t * link)
cistpl_cftable_entry_t *cf = &parse.cftable_entry; cistpl_cftable_entry_t *cf = &parse.cftable_entry;
config_info_t config; config_info_t config;
int i, j, try; int i, j, try;
int s;
/* If the card is already configured, look up the port and irq */ /* If the card is already configured, look up the port and irq */
i = pcmcia_get_configuration_info(handle, &config); i = pcmcia_get_configuration_info(handle, &config);
...@@ -399,29 +401,30 @@ static int simple_config(dev_link_t * link) ...@@ -399,29 +401,30 @@ static int simple_config(dev_link_t * link)
tuple.Attributes = 0; tuple.Attributes = 0;
tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
/* Two tries: without IO aliases, then with aliases */ /* Two tries: without IO aliases, then with aliases */
for (try = 0; try < 2; try++) { for (s = 0; s < 2; s++) {
i = first_tuple(handle, &tuple, &parse); for (try = 0; try < 2; try++) {
while (i != CS_NO_MORE_ITEMS) { i = first_tuple(handle, &tuple, &parse);
if (i != CS_SUCCESS) while (i != CS_NO_MORE_ITEMS) {
goto next_entry; if (i != CS_SUCCESS)
if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) goto next_entry;
link->conf.Vpp1 = link->conf.Vpp2 = if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM))
cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; link->conf.Vpp1 = link->conf.Vpp2 =
if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && cf->vpp1.param[CISTPL_POWER_VNOM] / 10000;
(cf->io.win[0].base != 0)) { if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[s]) &&
link->conf.ConfigIndex = cf->index; (cf->io.win[0].base != 0)) {
link->io.BasePort1 = cf->io.win[0].base; link->conf.ConfigIndex = cf->index;
link->io.IOAddrLines = (try == 0) ? link->io.BasePort1 = cf->io.win[0].base;
16 : cf->io.flags & CISTPL_IO_LINES_MASK; link->io.IOAddrLines = (try == 0) ?
i = pcmcia_request_io(link->handle, &link->io); 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
if (i == CS_SUCCESS) i = pcmcia_request_io(link->handle, &link->io);
goto found_port; if (i == CS_SUCCESS)
goto found_port;
}
next_entry:
i = next_tuple(handle, &tuple, &parse);
} }
next_entry:
i = next_tuple(handle, &tuple, &parse);
} }
} }
/* Second pass: try to find an entry that isn't picky about /* Second pass: try to find an entry that isn't picky about
its base address, then try to grab any standard serial port its base address, then try to grab any standard serial port
address, and finally try to get any free port. */ address, and finally try to get any free port. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment