Discussion:
[PATCH V2 0/9] bcm63xx_uart and of-serial updates
Kevin Cernekee
2014-10-20 20:53:59 UTC
Permalink
In the course of bringing up a new platform[1] that uses this hardware,
I made a couple of improvements:

- Allow the driver to be built for targets that do not define
CONFIG_BCM63xx (as mine doesn't)
- Use devm_ioremap_resource() to simplify the initialization code
- Allow OF earlycon to be hardwired "on" in the kernel build, so it can
eventually replace the MIPS EARLY_PRINTK scheme
- Update documentation; fix typos/grammar


V1->V2:

- Add acks from Florian
- Rebase on tty-next (3.18-rc1)
- bcm63xx_uart: add patches 3,4,6
- Rework my earlycon change (patches 7,8) to use a config option
instead of a function call

[1] https://github.com/cernekee/linux/commits/bcm3384


Kevin Cernekee (9):
tty: serial: bcm63xx: Allow bcm63xx_uart to be built on other
platforms
tty: serial: bcm63xx: Update the Kconfig help text
tty: serial: bcm63xx: Fix typo in MODULE_DESCRIPTION
Documentation: DT: Add entries for bcm63xx UART
tty: serial: bcm63xx: Enable DT earlycon support
tty: serial: bcm63xx: Eliminate unnecessary request/release functions
tty: serial: of-serial: Suppress warnings if OF earlycon is invoked
twice
tty: serial: of-serial: Allow OF earlycon to default to "on"
MAINTAINERS: Add entry for rp2 (Rocketport Express/Infinity) driver

.../devicetree/bindings/serial/bcm63xx-uart.txt | 34 ++++++++++++++
MAINTAINERS | 6 +++
drivers/of/fdt.c | 17 +++++--
drivers/tty/serial/Kconfig | 30 +++++++++----
drivers/tty/serial/bcm63xx_uart.c | 52 +++++++++++++---------
include/linux/serial_bcm63xx.h | 2 -
6 files changed, 106 insertions(+), 35 deletions(-)
create mode 100644 Documentation/devicetree/bindings/serial/bcm63xx-uart.txt
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Cernekee
2014-10-20 20:54:00 UTC
Permalink
This device was originally supported on bcm63xx only, but it shows up on
a wide variety of MIPS and ARM chipsets spanning multiple product lines.
Now that the driver has eliminated dependencies on bcm63xx-specific
header files, we can build it on any non-bcm63xx kernel.

Compile-tested on x86, both statically and as a module. Tested for
functionality on bcm3384 (a new MIPS platform under active development).

Signed-off-by: Kevin Cernekee <***@gmail.com>
Acked-by: Florian Fainelli <***@gmail.com>
---
drivers/tty/serial/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 649b784..4a5c0c8 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1283,7 +1283,7 @@ config SERIAL_TIMBERDALE
config SERIAL_BCM63XX
tristate "bcm63xx serial port support"
select SERIAL_CORE
- depends on BCM63XX
+ depends on MIPS || ARM || COMPILE_TEST
help
If you have a bcm63xx CPU, you can enable its onboard
serial port by enabling this options.
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Cernekee
2014-10-20 20:54:02 UTC
Permalink
Remove the extra '<' character.

Signed-off-by: Kevin Cernekee <***@gmail.com>
---
drivers/tty/serial/bcm63xx_uart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index 2315190..a70910e 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -905,5 +905,5 @@ module_init(bcm_uart_init);
module_exit(bcm_uart_exit);

MODULE_AUTHOR("Maxime Bizon <***@freebox.fr>");
-MODULE_DESCRIPTION("Broadcom 63<xx integrated uart driver");
+MODULE_DESCRIPTION("Broadcom 63xx integrated uart driver");
MODULE_LICENSE("GPL");
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Cernekee
2014-10-20 20:54:01 UTC
Permalink
Remove incorrect "bcm963xx_uart" module name; add a list of known users;
tweak grammar/indentation/capitalization.

Signed-off-by: Kevin Cernekee <***@gmail.com>
Acked-by: Florian Fainelli <***@gmail.com>
---
drivers/tty/serial/Kconfig | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 4a5c0c8..815b652 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1281,22 +1281,24 @@ config SERIAL_TIMBERDALE
Add support for UART controller on timberdale.

config SERIAL_BCM63XX
- tristate "bcm63xx serial port support"
+ tristate "Broadcom BCM63xx/BCM33xx UART support"
select SERIAL_CORE
depends on MIPS || ARM || COMPILE_TEST
help
- If you have a bcm63xx CPU, you can enable its onboard
- serial port by enabling this options.
+ This enables the driver for the onchip UART core found on
+ the following chipsets:

- To compile this driver as a module, choose M here: the
- module will be called bcm963xx_uart.
+ BCM33xx (cable modem)
+ BCM63xx/BCM63xxx (DSL)
+ BCM68xx (PON)
+ BCM7xxx (STB) - DOCSIS console

config SERIAL_BCM63XX_CONSOLE
- bool "Console on bcm63xx serial port"
+ bool "Console on BCM63xx serial port"
depends on SERIAL_BCM63XX=y
select SERIAL_CORE_CONSOLE
help
- If you have enabled the serial port on the bcm63xx CPU
+ If you have enabled the serial port on the BCM63xx CPU
you can make it the console by answering Y to this option.

config SERIAL_GRLIB_GAISLER_APBUART
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Cernekee
2014-10-20 20:54:03 UTC
Permalink
This squashes a checkpatch warning on my new bcm3384 dts submission.

Signed-off-by: Kevin Cernekee <***@gmail.com>
---
.../devicetree/bindings/serial/bcm63xx-uart.txt | 34 ++++++++++++++++++++++
1 file changed, 34 insertions(+)
create mode 100644 Documentation/devicetree/bindings/serial/bcm63xx-uart.txt

diff --git a/Documentation/devicetree/bindings/serial/bcm63xx-uart.txt b/Documentation/devicetree/bindings/serial/bcm63xx-uart.txt
new file mode 100644
index 0000000..b01c76a
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/bcm63xx-uart.txt
@@ -0,0 +1,34 @@
+* BCM63xx UART
+
+Required properties:
+
+- compatible: "brcm,bcm6345-uart"
+
+- reg: The base address of the UART register bank.
+
+- interrupts: A single interrupt specifier.
+
+- clocks: Clock driving the hardware; used to figure out the baud rate
+ divisor.
+
+- clock-names: The appropriate output name in the referenced clock node.
+
+Example:
+
+ uart0: ***@14e00520 {
+ compatible = "brcm,bcm6345-uart";
+ reg = <0x14e00520 0x18>;
+ interrupt-parent = <&periph_intc>;
+ interrupts = <2>;
+ clocks = <&periph_clk>;
+ clock-names = "periph";
+ };
+
+ clocks {
+ periph_clk: ***@0 {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <54000000>;
+ clock-output-names = "periph";
+ };
+ };
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Arnd Bergmann
2014-10-20 21:20:08 UTC
Permalink
Post by Kevin Cernekee
+- clock-names: The appropriate output name in the referenced clock node.
+
+ compatible = "brcm,bcm6345-uart";
+ reg = <0x14e00520 0x18>;
+ interrupt-parent = <&periph_intc>;
+ interrupts = <2>;
+ clocks = <&periph_clk>;
+ clock-names = "periph";
+ };
+
+ clocks {
+ compatible = "fixed-clock";
+ #clock-cells = <0>;
+ clock-frequency = <54000000>;
+ clock-output-names = "periph";
+ };
+ };
In this example, the clock output name of the clock provider is
the same as the clock input of the consumer, that is almost always
a bug and would not be a good example at all.

I assume the output name is correct and the input is not. If you
have access to the HDL source of the bcm6345-uart, please check
if the input has a proper name, otherwise just call it "uart"
or remove the clock-names property completely.

In the documentation enough, you must document the specific name
of the clock that is supposed to be used by the uart driver.

Arnd
Arnd Bergmann
2014-10-20 21:25:10 UTC
Permalink
Post by Arnd Bergmann
In this example, the clock output name of the clock provider is
the same as the clock input of the consumer, that is almost always
a bug and would not be a good example at all.
Ah, found the bug: the MIPS code is written to ignore the device
and just look up a global clock name:

struct clk *clk_get(struct device *dev, const char *id)
{
if (!strcmp(id, "enet0"))
return &clk_enet0;
if (!strcmp(id, "enet1"))
return &clk_enet1;
if (!strcmp(id, "enetsw"))
return &clk_enetsw;
if (!strcmp(id, "ephy"))
return &clk_ephy;
if (!strcmp(id, "usbh"))
return &clk_usbh;
if (!strcmp(id, "usbd"))
return &clk_usbd;
if (!strcmp(id, "spi"))
return &clk_spi;
if (!strcmp(id, "hsspi"))
return &clk_hsspi;
if (!strcmp(id, "xtm"))
return &clk_xtm;
if (!strcmp(id, "periph"))
return &clk_periph;
if ((BCMCPU_IS_3368() || BCMCPU_IS_6358()) && !strcmp(id, "pcm"))
return &clk_pcm;
if ((BCMCPU_IS_6362() || BCMCPU_IS_6368()) && !strcmp(id, "ipsec"))
return &clk_ipsec;
if ((BCMCPU_IS_6328() || BCMCPU_IS_6362()) && !strcmp(id, "pcie"))
return &clk_pcie;
return ERR_PTR(-ENOENT);
}

This should be changed to use the drivers/clk/clkdev.c lookup code if
you want to share drivers between architectures.

In particular, the "enet0"/"enet1" clock name makes no sense -- the
clock input name should be independent of the instance, aside from
the question of which output of the provider it is wired up to.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Florian Fainelli
2014-10-20 22:53:53 UTC
Permalink
Post by Arnd Bergmann
Post by Arnd Bergmann
In this example, the clock output name of the clock provider is
the same as the clock input of the consumer, that is almost always
a bug and would not be a good example at all.
Ah, found the bug: the MIPS code is written to ignore the device
struct clk *clk_get(struct device *dev, const char *id)
{
if (!strcmp(id, "enet0"))
return &clk_enet0;
if (!strcmp(id, "enet1"))
return &clk_enet1;
if (!strcmp(id, "enetsw"))
return &clk_enetsw;
if (!strcmp(id, "ephy"))
return &clk_ephy;
if (!strcmp(id, "usbh"))
return &clk_usbh;
if (!strcmp(id, "usbd"))
return &clk_usbd;
if (!strcmp(id, "spi"))
return &clk_spi;
if (!strcmp(id, "hsspi"))
return &clk_hsspi;
if (!strcmp(id, "xtm"))
return &clk_xtm;
if (!strcmp(id, "periph"))
return &clk_periph;
if ((BCMCPU_IS_3368() || BCMCPU_IS_6358()) && !strcmp(id, "pcm"))
return &clk_pcm;
if ((BCMCPU_IS_6362() || BCMCPU_IS_6368()) && !strcmp(id, "ipsec"))
return &clk_ipsec;
if ((BCMCPU_IS_6328() || BCMCPU_IS_6362()) && !strcmp(id, "pcie"))
return &clk_pcie;
return ERR_PTR(-ENOENT);
}
This should be changed to use the drivers/clk/clkdev.c lookup code if
you want to share drivers between architectures.
For now, I suppose that s simple fix could be to use an anonymous clock
request when probed via DT. This code you quote dates from 2008 when
there was no clkdev in the kernel at all. So something like this would
probably do it for now:

diff --git a/drivers/tty/serial/bcm63xx_uart.c
b/drivers/tty/serial/bcm63xx_uart.c
index e0b87d507670..1b914b85dd31 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -819,7 +819,7 @@ static int bcm_uart_probe(struct platform_device *pdev)
if (!res_irq)
return -ENODEV;

- clk = clk_get(&pdev->dev, "periph");
+ clk = clk_get(&pdev->dev, pdev->dev.of_node ? NULL : "periph");
if (IS_ERR(clk))
return -ENODEV;
Post by Arnd Bergmann
In particular, the "enet0"/"enet1" clock name makes no sense -- the
clock input name should be independent of the instance, aside from
the question of which output of the provider it is wired up to.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Arnd Bergmann
2014-10-21 05:49:51 UTC
Permalink
Post by Florian Fainelli
For now, I suppose that s simple fix could be to use an anonymous clock
request when probed via DT. This code you quote dates from 2008 when
there was no clkdev in the kernel at all. So something like this would
diff --git a/drivers/tty/serial/bcm63xx_uart.c
b/drivers/tty/serial/bcm63xx_uart.c
index e0b87d507670..1b914b85dd31 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -819,7 +819,7 @@ static int bcm_uart_probe(struct platform_device *pdev)
if (!res_irq)
return -ENODEV;
- clk = clk_get(&pdev->dev, "periph");
+ clk = clk_get(&pdev->dev, pdev->dev.of_node ? NULL : "periph");
if (IS_ERR(clk))
return -ENODEV;
Yes, that would work. Just make sure the same bug doesn't creep in
for other drivers you are converting.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Cernekee
2014-10-20 20:54:04 UTC
Permalink
This enables early console output if there is a chosen/stdout-path
property referencing a UART node with the "brcm,bcm6345-uart" compatible
string. The bootloader sets up the pinmux and baud/parity/etc.
Tested on bcm3384 (MIPS, DT).

Signed-off-by: Kevin Cernekee <***@gmail.com>
---
drivers/tty/serial/Kconfig | 1 +
drivers/tty/serial/bcm63xx_uart.c | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 815b652..fdd851e 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1297,6 +1297,7 @@ config SERIAL_BCM63XX_CONSOLE
bool "Console on BCM63xx serial port"
depends on SERIAL_BCM63XX=y
select SERIAL_CORE_CONSOLE
+ select SERIAL_EARLYCON
help
If you have enabled the serial port on the BCM63xx CPU
you can make it the console by answering Y to this option.
diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index a70910e..2015284 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -782,6 +782,26 @@ static int __init bcm63xx_console_init(void)

console_initcall(bcm63xx_console_init);

+static void bcm_early_write(struct console *con, const char *s, unsigned n)
+{
+ struct earlycon_device *dev = con->data;
+
+ uart_console_write(&dev->port, s, n, bcm_console_putchar);
+ wait_for_xmitr(&dev->port);
+}
+
+static int __init bcm_early_console_setup(struct earlycon_device *device,
+ const char *opt)
+{
+ if (!device->port.membase)
+ return -ENODEV;
+
+ device->con->write = bcm_early_write;
+ return 0;
+}
+
+OF_EARLYCON_DECLARE(bcm63xx_uart, "brcm,bcm6345-uart", bcm_early_console_setup);
+
#define BCM63XX_CONSOLE (&bcm63xx_console)
#else
#define BCM63XX_CONSOLE NULL
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Cernekee
2014-10-20 20:54:07 UTC
Permalink
On many development systems it is very common to see failures during the
early stages of the boot process, e.g. SMP boot or PCIe initialization.
This is one likely reason why some existing earlyprintk implementations,
such as arch/mips/kernel/early_printk.c, are enabled unconditionally
at compile time.

Now that earlycon's operating parameters can be passed into the kernel
via DT, it is helpful to be able to configure the kernel to turn it on
automatically. Introduce a new CONFIG_SERIAL_EARLYCON_FORCE option for
this purpose.

Signed-off-by: Kevin Cernekee <***@gmail.com>
---
drivers/of/fdt.c | 5 +++++
drivers/tty/serial/Kconfig | 11 +++++++++++
2 files changed, 16 insertions(+)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 20193cc..3e2ea1e 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1013,6 +1013,11 @@ bool __init early_init_dt_verify(void *params)

void __init early_init_dt_scan_nodes(void)
{
+#ifdef CONFIG_SERIAL_EARLYCON_FORCE
+ if (early_init_dt_scan_chosen_serial() < 0)
+ pr_warn("Unable to set up earlycon from stdout-path\n");
+#endif
+
/* Retrieve various information from the /chosen node */
of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index fdd851e..bc4ebcc 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -14,6 +14,17 @@ config SERIAL_EARLYCON
the console before standard serial driver is probed. The console is
enabled when early_param is processed.

+config SERIAL_EARLYCON_FORCE
+ bool "Always enable early console"
+ depends on SERIAL_EARLYCON
+ help
+ Traditionally, enabling the early console has required passing in
+ the "earlycon" parameter on the kernel command line. On systems
+ under development it may be desirable to enable earlycon
+ unconditionally rather than to force the user to manually add it
+ to the boot argument string, as boot failures often occur before
+ the standard serial driver is probed.
+
source "drivers/tty/serial/8250/Kconfig"

comment "Non-8250 serial port support"
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Cernekee
2014-10-20 20:54:05 UTC
Permalink
We don't really need to perform the ioremap "on demand" so it's simpler
just to do it from the probe function. This also lets us eliminate the
UART_REG_SIZE constant and rely on the resource information passed in
from the DT or platform code.

Signed-off-by: Kevin Cernekee <***@gmail.com>
---
drivers/tty/serial/bcm63xx_uart.c | 30 ++++++++++--------------------
include/linux/serial_bcm63xx.h | 2 --
2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c
index 2015284..999bb6fa 100644
--- a/drivers/tty/serial/bcm63xx_uart.c
+++ b/drivers/tty/serial/bcm63xx_uart.c
@@ -588,20 +588,7 @@ static void bcm_uart_set_termios(struct uart_port *port,
*/
static int bcm_uart_request_port(struct uart_port *port)
{
- unsigned int size;
-
- size = UART_REG_SIZE;
- if (!request_mem_region(port->mapbase, size, "bcm63xx")) {
- dev_err(port->dev, "Memory region busy\n");
- return -EBUSY;
- }
-
- port->membase = ioremap(port->mapbase, size);
- if (!port->membase) {
- dev_err(port->dev, "Unable to map registers\n");
- release_mem_region(port->mapbase, size);
- return -EBUSY;
- }
+ /* UARTs always present */
return 0;
}

@@ -610,8 +597,7 @@ static int bcm_uart_request_port(struct uart_port *port)
*/
static void bcm_uart_release_port(struct uart_port *port)
{
- release_mem_region(port->mapbase, UART_REG_SIZE);
- iounmap(port->membase);
+ /* Nothing to release ... */
}

/*
@@ -833,13 +819,20 @@ static int bcm_uart_probe(struct platform_device *pdev)
if (pdev->id < 0 || pdev->id >= BCM63XX_NR_UARTS)
return -EINVAL;

- if (ports[pdev->id].membase)
+ port = &ports[pdev->id];
+ if (port->membase)
return -EBUSY;
+ memset(port, 0, sizeof(*port));

res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res_mem)
return -ENODEV;

+ port->mapbase = res_mem->start;
+ port->membase = devm_ioremap_resource(&pdev->dev, res_mem);
+ if (IS_ERR(port->membase))
+ return PTR_ERR(port->membase);
+
res_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res_irq)
return -ENODEV;
@@ -848,10 +841,7 @@ static int bcm_uart_probe(struct platform_device *pdev)
if (IS_ERR(clk))
return -ENODEV;

- port = &ports[pdev->id];
- memset(port, 0, sizeof(*port));
port->iotype = UPIO_MEM;
- port->mapbase = res_mem->start;
port->irq = res_irq->start;
port->ops = &bcm_uart_ops;
port->flags = UPF_BOOT_AUTOCONF;
diff --git a/include/linux/serial_bcm63xx.h b/include/linux/serial_bcm63xx.h
index a80aa1a..570e964 100644
--- a/include/linux/serial_bcm63xx.h
+++ b/include/linux/serial_bcm63xx.h
@@ -116,6 +116,4 @@
UART_FIFO_PARERR_MASK | \
UART_FIFO_BRKDET_MASK)

-#define UART_REG_SIZE 24
-
#endif /* _LINUX_SERIAL_BCM63XX_H */
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Cernekee
2014-10-20 20:54:06 UTC
Permalink
Specifying "earlycon earlycon" on the kernel command line yields this
warning:

bootconsole [uart0] enabled
------------[ cut here ]------------
WARNING: CPU: 0 PID: 0 at kernel/printk/printk.c:2391 register_console+0x244/0x3fc()
console 'uart0' already registered
CPU: 0 PID: 0 Comm: swapper Not tainted 3.18.0-rc1+ #2
Stack : 00000000 00000004 80af0000 80af0000 00000000 00000000 00000000 00000000
80ad4e12 00000036 00000000 00000000 00010000 805abe88 805606b4 805abae7
00000000 00000000 80ad38d8 805abe88 8055f304 43d42d03 9988c6a1 804e2710
805b0000 80032854 00000000 00000000 8056492c 80599c84 80599c84 805606b4
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
...
Call Trace:
[<8001a22c>] show_stack+0x64/0x7c
[<804e47d8>] dump_stack+0xc8/0xfc
[<80032aa8>] warn_slowpath_common+0x7c/0xac
[<80032b38>] warn_slowpath_fmt+0x2c/0x38
[<80076524>] register_console+0x244/0x3fc
[<805d8314>] of_setup_earlycon+0x74/0x98
[<805daa40>] early_init_dt_scan_chosen_serial+0x104/0x134
[<805c51a0>] do_early_param+0xc4/0x13c
[<8004efa0>] parse_args+0x284/0x444
[<805c56cc>] parse_early_options+0x34/0x40
[<805c5714>] parse_early_param+0x3c/0x58
[<805c87a4>] setup_arch+0xec/0x6e4
[<805c57d4>] start_kernel+0x94/0x458

---[ end trace dc8fa200cb88537f ]---

In this case the duplicate "earlycon" was entered directly, but there are
other cases where this could happen inadvertently:

- Some platforms allow user bootargs to be concatenated with builtin
bootargs, e.g. CONFIG_CMDLINE_EXTEND.

- Other platforms may want to hardwire earlycon to ON, so it isn't
nice if a user manually specifying "earlycon" on the command line sees
a big scary warning.

So, we will treat "earlycon" as a flag, and if happens to be requested
multiple times the kernel will not print any warnings.

Signed-off-by: Kevin Cernekee <***@gmail.com>
---
drivers/of/fdt.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d1ffca8..20193cc 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -755,6 +755,11 @@ int __init early_init_dt_scan_chosen_serial(void)
int l;
const struct of_device_id *match = __earlycon_of_table;
const void *fdt = initial_boot_params;
+ static int done;
+
+ if (done)
+ return -EBUSY;
+ done = 1;

offset = fdt_path_offset(fdt, "/chosen");
if (offset < 0)
@@ -792,10 +797,9 @@ int __init early_init_dt_scan_chosen_serial(void)

static int __init setup_of_earlycon(char *buf)
{
- if (buf)
- return 0;
-
- return early_init_dt_scan_chosen_serial();
+ if (!buf)
+ early_init_dt_scan_chosen_serial();
+ return 0;
}
early_param("earlycon", setup_of_earlycon);
#endif
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kevin Cernekee
2014-10-20 20:54:08 UTC
Permalink
I wrote this driver and use it daily on several machines for work, so
why not.

Signed-off-by: Kevin Cernekee <***@gmail.com>
Acked-by: Florian Fainelli <***@gmail.com>
---
MAINTAINERS | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index a20df9b..d483627 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7787,6 +7787,12 @@ S: Maintained
F: Documentation/serial/rocket.txt
F: drivers/tty/rocket*

+ROCKETPORT EXPRESS/INFINITY DRIVER
+M: Kevin Cernekee <***@gmail.com>
+L: linux-***@vger.kernel.org
+S: Odd Fixes
+F: drivers/tty/serial/rp2.*
+
ROSE NETWORK LAYER
M: Ralf Baechle <***@linux-mips.org>
L: linux-***@vger.kernel.org
--
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...