Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1660162 > unrolled thread
| Started by | Paul Cercueil <paul@crapouillou.net> |
|---|---|
| First post | 2017-06-07 22:10 +0200 |
| Last post | 2017-06-08 23:20 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 06/15] serial: 8250_ingenic: Parse earlycon options Paul Cercueil <paul@crapouillou.net> - 2017-06-07 22:10 +0200
Re: [PATCH 06/15] serial: 8250_ingenic: Parse earlycon options Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2017-06-08 09:40 +0200
Re: [PATCH 06/15] serial: 8250_ingenic: Parse earlycon options Paul Cercueil <paul@crapouillou.net> - 2017-06-08 23:20 +0200
| From | Paul Cercueil <paul@crapouillou.net> |
|---|---|
| Date | 2017-06-07 22:10 +0200 |
| Subject | [PATCH 06/15] serial: 8250_ingenic: Parse earlycon options |
| Message-ID | <tPPrc-2PB-17@gated-at.bofh.it> |
In the devicetree, it is possible to specify the baudrate, parity,
bits, flow of the early console, by passing a configuration string like
this:
aliases {
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:57600n8";
};
This, for instance, will configure the early console for a baudrate of
57600 bps, no parity, and 8 bits per baud.
This patches implements parsing of this configuration string in the
8250_ingenic driver, which previously just ignored it.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
drivers/tty/serial/8250/8250_ingenic.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c
index b31b2ca552d1..59f3e632df49 100644
--- a/drivers/tty/serial/8250/8250_ingenic.c
+++ b/drivers/tty/serial/8250/8250_ingenic.c
@@ -99,14 +99,24 @@ static int __init ingenic_early_console_setup(struct earlycon_device *dev,
const char *opt)
{
struct uart_port *port = &dev->port;
- unsigned int baud, divisor;
+ unsigned int divisor;
+ int baud = 115200;
if (!dev->port.membase)
return -ENODEV;
+ if (opt) {
+ char options[256];
+ unsigned int parity, bits, flow; /* unused for now */
+
+ strlcpy(options, opt, sizeof(options));
+ uart_parse_options(options, &baud, &parity, &bits, &flow);
+ }
+
ingenic_early_console_setup_clock(dev);
- baud = dev->baud ?: 115200;
+ if (dev->baud)
+ baud = dev->baud;
divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * baud);
early_out(port, UART_IER, 0);
--
2.11.0
[toc] | [next] | [standalone]
| From | Marcin Nowakowski <marcin.nowakowski@imgtec.com> |
|---|---|
| Date | 2017-06-08 09:40 +0200 |
| Message-ID | <tQ0cW-1hd-33@gated-at.bofh.it> |
| In reply to | #1660162 |
Hi Paul,
On 07.06.2017 22:04, Paul Cercueil wrote:
> In the devicetree, it is possible to specify the baudrate, parity,
> bits, flow of the early console, by passing a configuration string like
> this:
>
> aliases {
> serial0 = &uart0;
> };
>
> chosen {
> stdout-path = "serial0:57600n8";
> };
>
> This, for instance, will configure the early console for a baudrate of
> 57600 bps, no parity, and 8 bits per baud.
>
> This patches implements parsing of this configuration string in the
> 8250_ingenic driver, which previously just ignored it.
>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> drivers/tty/serial/8250/8250_ingenic.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_ingenic.c b/drivers/tty/serial/8250/8250_ingenic.c
> index b31b2ca552d1..59f3e632df49 100644
> --- a/drivers/tty/serial/8250/8250_ingenic.c
> +++ b/drivers/tty/serial/8250/8250_ingenic.c
> @@ -99,14 +99,24 @@ static int __init ingenic_early_console_setup(struct earlycon_device *dev,
> const char *opt)
> {
> struct uart_port *port = &dev->port;
> - unsigned int baud, divisor;
> + unsigned int divisor;
> + int baud = 115200;
>
> if (!dev->port.membase)
> return -ENODEV;
>
> + if (opt) {
> + char options[256];
> + unsigned int parity, bits, flow; /* unused for now */
> +
> + strlcpy(options, opt, sizeof(options));
Rather than adding this extra local copy maybe you could instead:
-void uart_parse_options(char *options, int *baud, int *parity, int *bits,
+void uart_parse_options(const char *options, int *baud, int *parity,
int *bits,
I cannot see any reason why uart_parse_options shouldn't take 'const
char *options' as an argument.
> + uart_parse_options(options, &baud, &parity, &bits, &flow);
> + }
> +
> ingenic_early_console_setup_clock(dev);
>
> - baud = dev->baud ?: 115200;
> + if (dev->baud)
> + baud = dev->baud;
> divisor = DIV_ROUND_CLOSEST(port->uartclk, 16 * baud);
>
> early_out(port, UART_IER, 0);
>
Marcin
[toc] | [prev] | [next] | [standalone]
| From | Paul Cercueil <paul@crapouillou.net> |
|---|---|
| Date | 2017-06-08 23:20 +0200 |
| Message-ID | <tQd0u-11f-25@gated-at.bofh.it> |
| In reply to | #1660849 |
Hi,
[...]
>> diff --git a/drivers/tty/serial/8250/8250_ingenic.c
>> b/drivers/tty/serial/8250/8250_ingenic.c
>> index b31b2ca552d1..59f3e632df49 100644
>> --- a/drivers/tty/serial/8250/8250_ingenic.c
>> +++ b/drivers/tty/serial/8250/8250_ingenic.c
>> @@ -99,14 +99,24 @@ static int __init
>> ingenic_early_console_setup(struct earlycon_device *dev,
>> const char *opt)
>> {
>> struct uart_port *port = &dev->port;
>> - unsigned int baud, divisor;
>> + unsigned int divisor;
>> + int baud = 115200;
>> if (!dev->port.membase)
>> return -ENODEV;
>> + if (opt) {
>> + char options[256];
>> + unsigned int parity, bits, flow; /* unused for now */
>> +
>> + strlcpy(options, opt, sizeof(options));
>
> Rather than adding this extra local copy maybe you could instead:
>
> -void uart_parse_options(char *options, int *baud, int *parity, int
> *bits,
> +void uart_parse_options(const char *options, int *baud, int *parity,
> int *bits,
>
> I cannot see any reason why uart_parse_options shouldn't take 'const
> char *options' as an argument.
Sure, good remark. I'll send a patch to change the prototype.
Thanks,
- Paul
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web