From: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jslaby@suse.cz>, Alan Cox <alan@linux.intel.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Murali Karicheri <m-karicheri2@ti.com>,
Jingoo Han <jg1.han@samsung.com>,
Michael Welling <mwelling@ieee.org>,
Peter Hurley <peter@hurleysoftware.com>,
Joe Schultz <jschultz@xes-inc.com>, Ingo Molnar <mingo@elte.hu>,
Doug Anderson <dianders@chromium.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] serial: Add support for Fintek F81216A LPC to 4 UART
Date: Thu, 31 Jul 2014 15:19:41 +0100 [thread overview]
Message-ID: <20140731151941.244fd508@alan.etchedpixels.co.uk> (raw)
In-Reply-To: <1406651242-20689-2-git-send-email-ricardo.ribalda@gmail.com>
> +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
next prev parent reply other threads:[~2014-07-31 14:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-29 16:27 [PATCH 1/2] serial/8250: Add support for RS485 IOCTLs Ricardo Ribalda Delgado
2014-07-29 16:27 ` [PATCH 2/2] serial: Add support for Fintek F81216A LPC to 4 UART Ricardo Ribalda Delgado
2014-07-31 14:19 ` One Thousand Gnomes [this message]
2014-07-31 16:07 ` Ricardo Ribalda Delgado
2014-07-31 19:22 ` [PATCH 2/2 v2] " Ricardo Ribalda Delgado
2014-08-01 12:23 ` One Thousand Gnomes
2014-08-01 12:28 ` Ricardo Ribalda Delgado
2014-08-05 9:34 ` One Thousand Gnomes
2014-08-05 9:47 ` Ricardo Ribalda Delgado
2014-07-31 14:07 ` [PATCH 1/2] serial/8250: Add support for RS485 IOCTLs One Thousand Gnomes
2014-07-31 16:13 ` Ricardo Ribalda Delgado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140731151941.244fd508@alan.etchedpixels.co.uk \
--to=gnomes@lxorguk.ukuu.org.uk \
--cc=alan@linux.intel.com \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=jg1.han@samsung.com \
--cc=jschultz@xes-inc.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=m-karicheri2@ti.com \
--cc=mingo@elte.hu \
--cc=mwelling@ieee.org \
--cc=peter@hurleysoftware.com \
--cc=ricardo.ribalda@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®