linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Sergei Ianovich <ynvich@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Russell King <linux@arm.linux.org.uk>,
	Eric Miao <eric.y.miao@gmail.com>,
	Haojian Zhuang <haojian.zhuang@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>, Arnd Bergmann <arnd@arndb.de>,
	"open list:SERIAL DRIVERS" <linux-serial@vger.kernel.org>
Subject: Re: [PATCH 05/11] serial: support for 16550 serial ports on LP-8x4x
Date: Mon, 2 Dec 2013 15:53:33 +0200	[thread overview]
Message-ID: <20131202135333.GJ3942@xps8300> (raw)
In-Reply-To: <1385984782.12531.26.camel@host5.omatika.ru>

Hi,

On Mon, Dec 02, 2013 at 03:46:22PM +0400, Sergei Ianovich wrote:
> On Mon, 2013-12-02 at 10:48 +0200, Heikki Krogerus wrote:
> > On Sun, Dec 01, 2013 at 10:26:18AM +0400, Sergei Ianovich wrote:
> > > +static int request_and_remap(int i)
> > > +{
> > > +	if (!request_mem_region(extra_mem[i], 1, "serial"))
> > > +		return -EBUSY;
> > > +
> > > +	lp8x4x_data[i].private_data = ioremap(extra_mem[i], 1);
> > > +	if (lp8x4x_data[i].private_data)
> > > +		return 0;
> > > +
> > > +	release_mem_region(extra_mem[i], 1);
> > > +	return -ENODEV;
> 
> > Instead of registering a platform device for serial8250 here, you need
> > to simply register a platform driver for something like lp8x4x_serial.
> > The platform code will to registers the platform devices for it. You
> > will use serial8250_register_8250_port() in your probe to register a
> > new port. Use 8250_em.c and 8250_dw.c under drivers/tty/serial/8250/
> > as an example.
> > 
> > You don't need to introduce plat_serial8250_port so you won't need
> > the QUIRK_PORT stuff. You deliver the iomem and the irq as normal
> > resources that the driver uses when you create the platform device.
> > That of course also means the driver does not need to care about the
> > instances. The platform code will generate a platform device for as
> > many ports you have and set to resources accordingly.
> 
> 8250_core.c doesn't use platform infrastructure to request and map IO
> memory. There will be a conflict (and an error in
> serial8250_request_std_resource()), if main IO memory is requested by
> the platform device, won't it?

You don't need to request the mem region in your probe driver.

You can still map it. You have the flag UPF_IOREMAP that you can use
to tell 8250_code.c to map the region. If you don't set the flag,
8250_core.c will in practice expect that port->membase is already set
by the probe driver.

Check 8250_dw.c. It does the mapping on it's own and simply doesn't
set the flag.

Br,

-- 
heikki

  reply	other threads:[~2013-12-02 13:53 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1385879185-22455-1-git-send-email-ynvich@gmail.com>
2013-12-01  6:26 ` [PATCH 01/11] resolve PXA<->8250 serial device address conflict Sergei Ianovich
2013-12-02  9:02   ` Heikki Krogerus
2013-12-02  9:23     ` Sergei Ianovich
2013-12-02  9:49       ` Heikki Krogerus
2013-12-02 10:26         ` Sergei Ianovich
2013-12-02 14:10           ` Heikki Krogerus
2013-12-05  4:12             ` Greg Kroah-Hartman
2013-12-05  4:31               ` Sergei Ianovich
2013-12-05  4:35                 ` Greg Kroah-Hartman
2013-12-05  4:36                   ` Sergei Ianovich
     [not found]                   ` <20131205043544.GA28580-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-12-05 23:28                     ` [PATCH] serial: rewrite pxa2xx-uart to use 8250_core Sergei Ianovich
     [not found]                       ` <1386286149-2855-1-git-send-email-ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-12-06  0:02                         ` Greg Kroah-Hartman
     [not found]                           ` <20131206000253.GC21358-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-12-06  0:17                             ` Russell King - ARM Linux
2013-12-06  9:28                               ` Sergei Ianovich
2013-12-06  9:53                                 ` James Cameron
2013-12-06 10:34                                   ` Sergei Ianovich
2013-12-06 11:05                                     ` James Cameron
2013-12-06  0:38                       ` James Cameron
2013-12-06  2:55                         ` James Cameron
2013-12-06  2:42                       ` James Cameron
2013-12-06  9:16                         ` Sergei Ianovich
2013-12-06  9:09                       ` [PATCH v2] " Sergei Ianovich
2013-12-06  9:28                         ` James Cameron
2013-12-09  8:38                         ` Heikki Krogerus
2013-12-09  8:44                           ` Sascha Hauer
2013-12-09 11:38                         ` [PATCH v3] " Sergei Ianovich
2014-01-28 14:14   ` [PATCH 01/11] resolve PXA<->8250 serial device address conflict Pavel Machek
2014-01-28 14:20     ` Sergei Ianovich
2013-12-01  6:26 ` [PATCH 05/11] serial: support for 16550 serial ports on LP-8x4x Sergei Ianovich
2013-12-02  8:48   ` Heikki Krogerus
2013-12-02 11:46     ` Sergei Ianovich
2013-12-02 13:53       ` Heikki Krogerus [this message]
2013-12-02 11:30   ` Russell King - ARM Linux
2013-12-02 11:39     ` Sergei Ianovich
2013-12-02 11:52       ` Russell King - ARM Linux
2013-12-02 12:01         ` Sergei Ianovich

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=20131202135333.GJ3942@xps8300 \
    --to=heikki.krogerus@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=eric.y.miao@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=jslaby@suse.cz \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=ynvich@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;
as well as URLs for NNTP newsgroup(s).