All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Hurley <peter@hurleysoftware.com>
To: Sebastian Frias <sf84@laposte.net>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	linux-serial@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	mason <slash.tmp@free.fr>, "Måns Rullgård" <mans@mansr.com>
Subject: Re: [RFC PATCH] always probe UART HW when options are not specified
Date: Mon, 11 Jan 2016 12:21:05 -0800	[thread overview]
Message-ID: <56940EB1.40705@hurleysoftware.com> (raw)
In-Reply-To: <56940936.6050807@hurleysoftware.com>

On 01/11/2016 11:57 AM, Peter Hurley wrote:
> On 01/11/2016 11:06 AM, Peter Hurley wrote:
>> On 01/11/2016 09:56 AM, Sebastian Frias wrote:
>>> On 01/11/2016 05:11 PM, Peter Hurley wrote:
>>>> On 01/11/2016 07:07 AM, Sebastian Frias wrote:
>>>>> On 12/22/2015 06:56 PM, Sebastian Frias wrote:
> 
> [...]
> 
>>> 2) What would it take to make the "rt2880" work with the 8250
>>> earlycon? I mean, it is already pretty much supported in there, what
>>> would be missing? (I don't see why it blocks on earlycon_map) And
>>> would it be worth doing?
>>
>> The rt2880 does not have the same register locations as a 8250.
>> The 8250 port driver remaps all register accesses with a LUT.
>>
>> Adding support would be trivial.
> 
> Please test.

To get this working with DT, you may need to apply part or all of
my "Earlycon cleanup" series from Apr last year that adds the 
necessary support for things like "reg-shift" DT properties.

I'll see what I can do about cleaning up and re-submitting that series.

Regards,
Peter Hurley


> --- >% ---
> Subject: [PATCH] serial: 8250: Add Au1x00/RT288x earlycon support
> 
> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
> ---
>  drivers/tty/serial/8250/8250_early.c | 52 ++++++++++++++++++++++++++++++++++++
>  include/uapi/linux/serial_reg.h      | 13 +++++++++
>  2 files changed, 65 insertions(+)
> 
> diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
> index af62131..307fb23 100644
> --- a/drivers/tty/serial/8250/8250_early.c
> +++ b/drivers/tty/serial/8250/8250_early.c
> @@ -145,3 +145,55 @@ EARLYCON_DECLARE(uart8250, early_serial8250_setup);
>  EARLYCON_DECLARE(uart, early_serial8250_setup);
>  OF_EARLYCON_DECLARE(ns16550, "ns16550", early_serial8250_setup);
>  OF_EARLYCON_DECLARE(ns16550a, "ns16550a", early_serial8250_setup);
> +
> +
> +#ifdef CONFIG_SERIAL_8250_RT288X
> +
> +static void __init rt288x_putc(struct uart_port *port, int c)
> +{
> +	unsigned int status;
> +
> +	serial8250_early_out(port, AU1x00_TX, c);
> +
> +	for (;;) {
> +		status = serial8250_early_in(port, AU1x00_LSR);
> +		if ((status & BOTH_EMPTY) == BOTH_EMPTY)
> +			break;
> +		cpu_relax();
> +	}
> +}
> +
> +static void __init early_rt288x_write(struct console *console,
> +				      const char *s, unsigned int count)
> +{
> +	struct earlycon_device *device = console->data;
> +	struct uart_port *port = &device->port;
> +
> +	uart_console_write(port, s, count, rt288x_putc);
> +}
> +
> +static int __init early_rt288x_setup(struct earlycon_device *device,
> +				     const char *options)
> +{
> +	struct uart_port *port = &device->port;
> +	unsigned int ier;
> +
> +	if (!(device->port.membase || device->port.iobase))
> +		return -ENODEV;
> +
> +	/* Don't support direct init or any line-setting options */
> +	if (device->baud)
> +		return -EINVAL;
> +
> +	/* assume the device was initialized, only mask interrupts */
> +	ier = serial8250_early_in(port, AU1x00_IER);
> +	serial8250_early_out(port, AU1x00_IER, ier);
> +
> +	device->con->write = early_rt288x_write;
> +	return 0;
> +}
> +
> +EARLYCON_DECLARE(rt288x, early_rt288x_setup);
> +OF_EARLYCON_DECLARE(rt288x, "ralink,rt2880-uart", early_rt288x_setup);
> +
> +#endif /* CONFIG_SERIAL_8250_RT288X */
> diff --git a/include/uapi/linux/serial_reg.h b/include/uapi/linux/serial_reg.h
> index 1e5ac4e7..4d068ac 100644
> --- a/include/uapi/linux/serial_reg.h
> +++ b/include/uapi/linux/serial_reg.h
> @@ -376,5 +376,18 @@
>  #define UART_EXAR_TXTRG		0x0a	/* Tx FIFO trigger level write-only */
>  #define UART_EXAR_RXTRG		0x0b	/* Rx FIFO trigger level write-only */
>  
> +/*
> + * Register offsets for Au1x00/RT288x 8250-workalikes
> + */
> +#define AU1x00_RX	0
> +#define AU1x00_TX	1
> +#define AU1x00_IER	2
> +#define AU1x00_IIR	3
> +#define AU1x00_FCR	4
> +#define AU1x00_LCR	5
> +#define AU1x00_MCR	6
> +#define AU1x00_LSR	7
> +#define AU1x00_MSR	8
> +
>  #endif /* _LINUX_SERIAL_REG_H */
>  
> 

  reply	other threads:[~2016-01-11 20:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5672D18E.8000301@laposte.net>
2015-12-17 15:23 ` [RFC PATCH] always probe UART HW when options are not specified Måns Rullgård
2015-12-17 16:29 ` Peter Hurley
2015-12-17 16:48   ` Sebastian Frias
2015-12-17 17:21     ` Greg Kroah-Hartman
2015-12-17 19:05       ` Sebastian Frias
2015-12-17 17:48     ` Peter Hurley
2015-12-17 18:21       ` Sebastian Frias
2015-12-17 20:09         ` Peter Hurley
2015-12-18 13:53           ` Sebastian Frias
2015-12-18 15:03             ` Peter Hurley
2015-12-21 16:50               ` Sebastian Frias
2015-12-22 17:56                 ` Sebastian Frias
2016-01-11 15:07                   ` Sebastian Frias
2016-01-11 16:11                     ` Peter Hurley
2016-01-11 17:56                       ` Sebastian Frias
2016-01-11 19:06                         ` Peter Hurley
2016-01-11 19:57                           ` Peter Hurley
2016-01-11 20:21                             ` Peter Hurley [this message]
2016-01-12  9:37                           ` Mason
2016-01-12 14:22                             ` Sebastian Frias
2016-01-12 19:47                               ` Peter Hurley
2016-01-12 22:26                                 ` Mason
2016-01-12 22:42                                   ` Peter Hurley
2016-01-13 11:14                                 ` Sebastian Frias
2016-01-13 16:34                                   ` Peter Hurley
2016-01-18 11:52                                     ` Sebastian Frias
2016-01-12 14:14                           ` Sebastian Frias
2016-01-12 21:18                             ` Peter Hurley

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=56940EB1.40705@hurleysoftware.com \
    --to=peter@hurleysoftware.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mans@mansr.com \
    --cc=sf84@laposte.net \
    --cc=slash.tmp@free.fr \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.