[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140731151941.244fd508@alan.etchedpixels.co.uk>
Date: Thu, 31 Jul 2014 15:19:41 +0100
From: One Thousand Gnomes <gnomes@...rguk.ukuu.org.uk>
To: Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.cz>, Alan Cox <alan@...ux.intel.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Murali Karicheri <m-karicheri2@...com>,
Jingoo Han <jg1.han@...sung.com>,
Michael Welling <mwelling@...e.org>,
Peter Hurley <peter@...leysoftware.com>,
Joe Schultz <jschultz@...-inc.com>,
Ingo Molnar <mingo@...e.hu>,
Doug Anderson <dianders@...omium.org>,
linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] serial: Add support for Fintek F81216A LPC to 4
UART
> +static int fintek_8250_get_index(resource_size_t base_addr)
> +{
> + resource_size_t base[] = {0x3f8, 0x2f8, 0x3e8, 0x2e8};
> + int i;
> +
> + for (i = 0; i < ARRAY_SIZE(base); i++)
> + if (base_addr == base[i])
> + return i;
> +
> + return -ENODEV;
Less than ideal in some ways because the base may well be remapped by
other hardware or on non x86 devices. No obvious ideas how to fix it
though and PnP kind of implies x86.
> + mutex_lock(&fintek_mutex);
> + outb(LDN, ADDR_PORT);
> + outb(index, DATA_PORT);
> + outb(RS485, ADDR_PORT);
> + outb(config, DATA_PORT);
> + mutex_unlock(&fintek_mutex);
You really need to request that block of addresses because you may not be
the only superIO chip or driver playing with the various mux hack
registers that are used.
On the bright side you can then make the resource layer do your locking
work for you. We have an IORESOURCE_MUXED flag for these little horrors
so you can request the resource with IORESOURCE_MUXED. If the resource is
busy then you will get a failure back, if it is idle you will get the
resource, if it is busy but held by another driver using IORESOURCE_MUXED
then the request will block until they finish with it.
So you do
request_muxed_region
if failed then EBUSY
prod stuff
release_region
Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists