Skip to contentSkip to conversation

ns16550: Add compatible string for Raspberry Pi 4

PATCH Superseded Stewart Hildebrand 3 participants 3 messages Jul 24, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ns16550: Add compatible string for Raspberry Pi 4

---
xen/drivers/char/ns16550.c | 1 +

1 file changed, 1 insertion(+)
xen/drivers/char/ns16550.c +1 -0
index e518f2d790..c8d7c9b710 100644
@@ -1611,6 +1611,7 @@ static const struct dt_device_match ns16550_dt_match[] __initconst =
     DT_MATCH_COMPATIBLE("ns16550"),
     DT_MATCH_COMPATIBLE("ns16550a"),
     DT_MATCH_COMPATIBLE("snps,dw-apb-uart"),
+    DT_MATCH_COMPATIBLE("brcm,bcm2835-aux-uart"),
     { /* sentinel */ },

};
--
2.22.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw

(+ Andre)

Hi Stewart,

Quoted 19 lines · Stewart Hildebrand

---

xen/drivers/char/ns16550.c | 1 +

1 file changed, 1 insertion(+)
xen/drivers/char/ns16550.c +0 -0

index e518f2d790..c8d7c9b710 100644

--- a/xen/drivers/char/ns16550.c

+++ b/xen/drivers/char/ns16550.c

xen/drivers/char/ns16550.c +0 -0
@@ -1611,6 +1611,7 @@ static const struct dt_device_match ns16550_dt_match[] 

__initconst =

Quoted 7 lines

     DT_MATCH_COMPATIBLE("ns16550"),

     DT_MATCH_COMPATIBLE("ns16550a"),

     DT_MATCH_COMPATIBLE("snps,dw-apb-uart"),

+    DT_MATCH_COMPATIBLE("brcm,bcm2835-aux-uart"),

A different compatible usually means the UART behaves differently. So your commit message should at least explain what are the differences and why this is not necessary for Xen.

Looking at your repo xen-rpi4-builder, you are hacking the UART DT node. The new properties are not part of the binding for that compatible (see [1]).

While it is inevitable to hack device-tree for a first port, I don't want Xen to require unofficial binding.

Instead, those property should be set in the driver when matching brcm,bcm2835-aux-uart.

Cheers,

[1] Documentation/devicetree/bindings/serial/brcm,bcm2835-aux-uart.txt

Quoted 9 lines

     { /* sentinel */ },

};

Signature · 1 line
2.22.0
Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw
In reply to Stewart Hildebrand

On Wed, 24 Jul 2019 14:34:55 +0000
Stewart Hildebrand <[email protected]> wrote:

Hi,

I am afraid this is not enough. In your repo you hack the DT to contain the reg-shift and io-width properties, but those are not part of the "brcm,bcm2835-aux-uart" binding. Using 32-bit accesses is an integral property of this UART, and since it is only *somewhat* compatible to an 8250 or DW UART, it cannot use that binding. So I had the following additional hunk in:

@@ -1572,6 +1572,12 @@ static int __init ns16550_uart_dt_init(struct dt_device_node *dev,

     if ( uart->reg_width != 1 && uart->reg_width != 4 )
         return -EINVAL;

+ if ( dt_device_is_compatible(dev, "brcm,bcm2835-aux-uart") )
+ {
+ uart->reg_width = 4;
+ uart->reg_shift = 2;
+ }
+

     res = platform_get_irq(dev, 0);
     if ( ! res )
         return -EINVAL;

Feel free to use that snippet, that should work with the normal DT.

Cheers,
Andre.

Quoted 17 lines

---
xen/drivers/char/ns16550.c | 1 +

1 file changed, 1 insertion(+)
xen/drivers/char/ns16550.c +1 -1
index e518f2d790..c8d7c9b710 100644
@@ -1611,6 +1611,7 @@ static const struct dt_device_match ns16550_dt_match[] __initconst =
     DT_MATCH_COMPATIBLE("ns16550"),
     DT_MATCH_COMPATIBLE("ns16550a"),
     DT_MATCH_COMPATIBLE("snps,dw-apb-uart"),
+    DT_MATCH_COMPATIBLE("brcm,bcm2835-aux-uart"),
     { /* sentinel */ },
 };
--
Quoted 1 line

2.22.0

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel