LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Rob Herring <robherring2@gmail.com>
To: Eddie Huang <eddie.huang@mediatek.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	srv_heupstream@mediatek.com, Rob Herring <robh+dt@kernel.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>, Jiri Slaby <jslaby@suse.cz>,
	Alan Cox <alan@linux.intel.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	Sascha Hauer <kernel@pengutronix.de>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	yh.chen@mediatek.com
Subject: Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon
Date: Mon, 29 Dec 2014 08:54:02 -0600	[thread overview]
Message-ID: <CAL_JsqJQPQ2Ngis9GN8pi31pd-Y3E=ioXFoRfXBvMKkasng_Mw@mail.gmail.com> (raw)
In-Reply-To: <1419827096.6184.128.camel@mtksdaap41>

On Sun, Dec 28, 2014 at 10:24 PM, Eddie Huang <eddie.huang@mediatek.com> wrote:
> Hi Rob,
>
> On Fri, 2014-12-26 at 15:24 -0600, Rob Herring wrote:
>> On Thu, Dec 18, 2014 at 2:33 AM, Eddie Huang <eddie.huang@mediatek.com> wrote:
>> > Mediatek UART has highspeed register, but 8250_early.c doesn't
>> > support this, so add earlycon in 8250_mtk.c
>>
>> I don't see any highspeed register setup here. More generically,
>> aren't you just skipping any UART setup? That may be useful on other
>> platforms with 8250s, too. With the kernel command line version, you
>> could perhaps add a "noinit" flag. The DT case is harder, and I'm not
>> sure how we should handle that. We could perhaps add a
>> "stdout-path-initialized" flag to chosen.
>>
>
> Yes, I skipped UART setup same as msm_serial.c and amba-pl011.c
> (although they are standalone serial driver). Just like earlyprintk, I
> think earlycon should reuse UART setting in loader. Since some other
> platforms with 8250 already depend on this, it's ok to add flags to
> distinguish whether 8250 earlycon driver should init hw or not. As you
> said, add "noinit" flag is simple, but "stdout-path-initialized" need
> more discussion.
>
>> >
>> > Signed-off-by: Eddie Huang <eddie.huang@mediatek.com>
>> > ---
>> >  drivers/tty/serial/8250/8250_mtk.c | 33 +++++++++++++++++++++++++++++++++
>> >  1 file changed, 33 insertions(+)
>> >
>> > diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
>> > index de7aae5..65dd569 100644
>> > --- a/drivers/tty/serial/8250/8250_mtk.c
>> > +++ b/drivers/tty/serial/8250/8250_mtk.c
>> > @@ -23,6 +23,7 @@
>> >  #include <linux/pm_runtime.h>
>> >  #include <linux/serial_8250.h>
>> >  #include <linux/serial_reg.h>
>> > +#include <linux/console.h>
>> >
>> >  #include "8250.h"
>> >
>> > @@ -289,6 +290,38 @@ static struct platform_driver mtk8250_platform_driver = {
>> >  };
>> >  module_platform_driver(mtk8250_platform_driver);
>> >
>> > +#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
>> > +
>> > +static void __init mtk8250_serial_putc(struct uart_port *port, int c)
>> > +{
>> > +       while ((readl(port->membase + (UART_LSR << 2)) & BOTH_EMPTY) !=
>> > +               BOTH_EMPTY)
>> > +               ;
>> > +       writel(c, port->membase + (UART_TX << 2));
>> > +}
>> > +
>> > +static void __init early_mtk8250_write(struct console *console,
>> > +                                       const char *s, unsigned int count)
>>
>> Is there a reason early_serial8250_write can't work for you other than
>> it is currently static?
>>
>> Rob
>>
>
> The reason is only static. I want to keep 8250_early.c untouchable, all
> modifications in 8250_mtk.c

That is not how kernel development works. You should fix 8250_early.c
to do what you need rather than duplicating code.

Rob

  reply	other threads:[~2014-12-29 14:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-18  8:33 [PATCH 0/2] tty: serial: Add earlycon support to MT8173 SoC Eddie Huang
2014-12-18  8:33 ` [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon Eddie Huang
2014-12-18  8:48   ` Matthias Brugger
2014-12-18  9:12     ` Arnd Bergmann
2014-12-26 21:24   ` Rob Herring
2014-12-29  4:24     ` Eddie Huang
2014-12-29 14:54       ` Rob Herring [this message]
2014-12-29 19:08       ` Arnd Bergmann
2014-12-18  8:33 ` [PATCH 2/2] arm64: dts: Add mediatek MT8173 earlycon support Eddie Huang

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='CAL_JsqJQPQ2Ngis9GN8pi31pd-Y3E=ioXFoRfXBvMKkasng_Mw@mail.gmail.com' \
    --to=robherring2@gmail.com \
    --cc=alan@linux.intel.com \
    --cc=catalin.marinas@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=eddie.huang@mediatek.com \
    --cc=galak@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jslaby@suse.cz \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=matthias.bgg@gmail.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=srv_heupstream@mediatek.com \
    --cc=will.deacon@arm.com \
    --cc=yh.chen@mediatek.com \
    --cc=yingjoe.chen@mediatek.com \
    --subject='Re: [PATCH 1/2] tty: serial: 8250_mtk: Add earlycon' \
    /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

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).