Skip to contentSkip to conversation

bcm63xx_uart and of-serial updates

PATCH Superseded Kevin Cernekee 3 participants 14 messages Oct 20, 2014 – Oct 21, 2014

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover bcm63xx_uart and of-serial updates

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
Signature · 1 line
2.1.1
#1 lore raw

PATCH v2 1/9 tty: serial: bcm63xx: Allow bcm63xx_uart to be built on other platforms

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

---
 drivers/tty/serial/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/Kconfig +1 -1
index 649b784..4a5c0c8 100644
@@ -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.
Signature · 1 line
2.1.1
#2 lore raw

PATCH v2 2/9 tty: serial: bcm63xx: Update the Kconfig help text

In reply to Kevin Cernekee

Remove incorrect "bcm963xx_uart" module name; add a list of known users; tweak grammar/indentation/capitalization.

---
 drivers/tty/serial/Kconfig | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/tty/serial/Kconfig +9 -7
index 4a5c0c8..815b652 100644
@@ -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
Signature · 1 line
2.1.1
#3 lore raw

PATCH v2 3/9 tty: serial: bcm63xx: Fix typo in MODULE_DESCRIPTION

In reply to Kevin Cernekee

Remove the extra '<' character.

---
 drivers/tty/serial/bcm63xx_uart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/bcm63xx_uart.c +1 -1
index 2315190..a70910e 100644
@@ -905,5 +905,5 @@ module_init(bcm_uart_init);
 module_exit(bcm_uart_exit);
 
 MODULE_AUTHOR("Maxime Bizon <[email protected]>");
-MODULE_DESCRIPTION("Broadcom 63<xx integrated uart driver");
+MODULE_DESCRIPTION("Broadcom 63xx integrated uart driver");
 MODULE_LICENSE("GPL");
Signature · 1 line
2.1.1
#4 lore raw

PATCH v2 4/9 Documentation: DT: Add entries for bcm63xx UART

In reply to Kevin Cernekee

This squashes a checkpatch warning on my new bcm3384 dts submission.

---
 .../devicetree/bindings/serial/bcm63xx-uart.txt    | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/serial/bcm63xx-uart.txt
Documentation/devicetree/bindings/serial/bcm63xx-uart.txt new file +34 -0
new file mode 100644
index 0000000..b01c76a
@@ -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: serial@14e00520 {
+		compatible = "brcm,bcm6345-uart";
+		reg = <0x14e00520 0x18>;
+		interrupt-parent = <&periph_intc>;
+		interrupts = <2>;
+		clocks = <&periph_clk>;
+		clock-names = "periph";
+	};
+
+	clocks {
+		periph_clk: periph_clk@0 {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			clock-frequency = <54000000>;
+			clock-output-names = "periph";
+		};
+	};
Signature · 1 line
2.1.1
#9 lore raw

PATCH v2 5/9 tty: serial: bcm63xx: Enable DT earlycon support

In reply to Kevin Cernekee

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

---
 drivers/tty/serial/Kconfig        |  1 +
 drivers/tty/serial/bcm63xx_uart.c | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
drivers/tty/serial/Kconfig +1 -0
index 815b652..fdd851e 100644
@@ -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.
drivers/tty/serial/bcm63xx_uart.c +20 -0
index a70910e..2015284 100644
@@ -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
Signature · 1 line
2.1.1
#10 lore raw

PATCH v2 6/9 tty: serial: bcm63xx: Eliminate unnecessary request/release functions

In reply to Kevin Cernekee

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.

---
 drivers/tty/serial/bcm63xx_uart.c | 30 ++++++++++--------------------
 include/linux/serial_bcm63xx.h    |  2 --
 2 files changed, 10 insertions(+), 22 deletions(-)
drivers/tty/serial/bcm63xx_uart.c +10 -20
index 2015284..999bb6fa 100644
@@ -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;
include/linux/serial_bcm63xx.h +0 -2
index a80aa1a..570e964 100644
@@ -116,6 +116,4 @@
 					UART_FIFO_PARERR_MASK |		\
 					UART_FIFO_BRKDET_MASK)
 
-#define UART_REG_SIZE			24
-
 #endif /* _LINUX_SERIAL_BCM63XX_H */
Signature · 1 line
2.1.1
#11 lore raw

PATCH v2 7/9 tty: serial: of-serial: Suppress warnings if OF earlycon is invoked twice

In reply to Kevin Cernekee

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.

---
 drivers/of/fdt.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/of/fdt.c +8 -4
index d1ffca8..20193cc 100644
@@ -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
Signature · 1 line
2.1.1
#12 lore raw

PATCH v2 8/9 tty: serial: of-serial: Allow OF earlycon to default to "on"

In reply to Kevin Cernekee

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.

---
 drivers/of/fdt.c           |  5 +++++
 drivers/tty/serial/Kconfig | 11 +++++++++++
 2 files changed, 16 insertions(+)
drivers/of/fdt.c +5 -0
index 20193cc..3e2ea1e 100644
@@ -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);
 
drivers/tty/serial/Kconfig +11 -0
index fdd851e..bc4ebcc 100644
@@ -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"
Signature · 1 line
2.1.1
#13 lore raw

PATCH v2 9/9 MAINTAINERS: Add entry for rp2 (Rocketport Express/Infinity) driver

In reply to Kevin Cernekee

I wrote this driver and use it daily on several machines for work, so why not.

---
 MAINTAINERS | 6 ++++++
 1 file changed, 6 insertions(+)
MAINTAINERS +6 -0
index a20df9b..d483627 100644
@@ -7787,6 +7787,12 @@ S:	Maintained
 F:	Documentation/serial/rocket.txt
 F:	drivers/tty/rocket*
 
+ROCKETPORT EXPRESS/INFINITY DRIVER
+M:	Kevin Cernekee <[email protected]>
+L:	[email protected]
+S:	Odd Fixes
+F:	drivers/tty/serial/rp2.*
+
 ROSE NETWORK LAYER
 M:	Ralf Baechle <[email protected]>
 L:	[email protected]
Signature · 1 line
2.1.1
#5 lore raw

Re: [PATCH V2 4/9] Documentation: DT: Add entries for bcm63xx UART

In reply to Kevin Cernekee
Quoted 9 lines · On Monday 20 October 2014 13:54:03 Kevin Cernekee wrote:

+- clock-names: The appropriate output name in the referenced clock node.

Documentation/devicetree/bindings/serial/bcm63xx-uart.txt new file +8 -0
+
+       uart0: serial@14e00520 {
+               compatible = "brcm,bcm6345-uart";
+               reg = <0x14e00520 0x18>;
+               interrupt-parent = <&periph_intc>;
+               interrupts = <2>;
+               clocks = <&periph_clk>;
+               clock-names = "periph";

Documentation/devicetree/bindings/serial/bcm63xx-uart.txt line 34

Quoted 10 lines
Documentation/devicetree/bindings/serial/bcm63xx-uart.txt new file +10 -0
+       };
+
+       clocks {
+               periph_clk: periph_clk@0 {
+                       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

#6 lore raw

Re: [PATCH V2 4/9] Documentation: DT: Add entries for bcm63xx UART

Quoted 6 lines · On Monday 20 October 2014 23:20:08 Arnd Bergmann wrote:

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

#7 lore raw

Re: [PATCH V2 4/9] Documentation: DT: Add entries for bcm63xx UART

Quoted 42 lines · Arnd Bergmann
Quoted 6 lines · On Monday 20 October 2014 23:20:08 Arnd Bergmann wrote:

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);
}
Quoted 2 lines

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:

(quoted diff) +0 -0

b/drivers/tty/serial/bcm63xx_uart.c
index e0b87d507670..1b914b85dd31 100644

drivers/tty/serial/bcm63xx_uart.c +1 -1
@@ -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;
 
Quoted 7 lines

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

#8 lore raw

Re: [PATCH V2 4/9] Documentation: DT: Add entries for bcm63xx UART

Quoted 13 lines · On Monday 20 October 2014 15:53:53 Florian Fainelli wrote:

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:

drivers/tty/serial/bcm63xx_uart.c +0 -0
index e0b87d507670..1b914b85dd31 100644

drivers/tty/serial/bcm63xx_uart.c static int bcm_uart_probe(struct platform_device *pdev) · line 825

Quoted 8 lines
drivers/tty/serial/bcm63xx_uart.c +1 -1
@@ -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