Skip to contentSkip to conversation

serial: pl011: Add xilinx uart

PATCH Superseded Shubhrajyoti Datta 8 participants 13 messages Nov 16, 2021 – Jul 20, 2022

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover serial: pl011: Add xilinx uart

-Support uart peripheral in Xilinx Versal SOC.
Add the dt-binding for the same

Raviteja Narayanam (1):
serial: pl011: Add support for Xilinx Uart

Shubhrajyoti Datta (1):
dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

 .../devicetree/bindings/serial/pl011.yaml     | 10 ++++--
 drivers/tty/serial/amba-pl011.c               | 33 +++++++++++++++++--
 2 files changed, 38 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Add support for Uart used in Xilinx Versal SOCs as a platform device.

---
 Documentation/devicetree/bindings/serial/pl011.yaml | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/pl011.yaml +7 -3
index 5ea00f8a283d..6c73923dd15e 100644
@@ -24,9 +24,13 @@ select:
 
 properties:
   compatible:
-    items:
-      - const: arm,pl011
-      - const: arm,primecell
+    oneOf:
+      - items:
+          - const: arm,pl011
+          - const: arm,primecell
+      - items:
+          - const: arm,pl011
+          - const: arm,xlnx-uart # xilinx uart as platform device
 
   reg:
     maxItems: 1
Signature · 1 line
2.25.1
maintainer
#2 lore raw

Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 2 lines · Shubhrajyoti Datta

Add support for Uart used in Xilinx Versal SOCs as a platform device.

No. Why would we want to do that?

Quoted 15 lines
---
 Documentation/devicetree/bindings/serial/pl011.yaml | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/pl011.yaml +0 -0
index 5ea00f8a283d..6c73923dd15e 100644
@@ -24,9 +24,13 @@ select:
 
 properties:
   compatible:

Documentation/devicetree/bindings/serial/pl011.yaml select: · line 33

Quoted 10 lines
Documentation/devicetree/bindings/serial/pl011.yaml +7 -3
-    items:
-      - const: arm,pl011
-      - const: arm,primecell
+    oneOf:
+      - items:
+          - const: arm,pl011
+          - const: arm,primecell
+      - items:
+          - const: arm,pl011
+          - const: arm,xlnx-uart # xilinx uart as platform device

'arm,primecell' means the block has ID registers. Are you saying this implementation doesn't?

Quoted 7 lines
Documentation/devicetree/bindings/serial/pl011.yaml +0 -0
   reg:
     maxItems: 1
Signature · 1 line
2.25.1
#3 lore raw

RE: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 10 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Tuesday, November 30, 2021 3:39 AM
To: Shubhrajyoti Datta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Raviteja Narayanam <[email protected]>
Subject: Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 4 lines
Quoted 1 line · Shubhrajyoti Datta

Add support for Uart used in Xilinx Versal SOCs as a platform device.

No. Why would we want to do that?

Apologies did not understand that.

Quoted 15 lines
Quoted 15 lines
---
 Documentation/devicetree/bindings/serial/pl011.yaml | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/pl011.yaml +0 -0
index 5ea00f8a283d..6c73923dd15e 100644
@@ -24,9 +24,13 @@ select:
 
Quoted 15 lines

Documentation/devicetree/bindings/serial/pl011.yaml select: · line 33

Quoted 12 lines
Documentation/devicetree/bindings/serial/pl011.yaml +7 -3
 properties:
   compatible:
-    items:
-      - const: arm,pl011
-      - const: arm,primecell
+    oneOf:
+      - items:
+          - const: arm,pl011
+          - const: arm,primecell
+      - items:
+          - const: arm,pl011
+          - const: arm,xlnx-uart # xilinx uart as platform device

'arm,primecell' means the block has ID registers. Are you saying this implementation doesn't?

The ID registers do not have any Xilinx specific identifiers. However there are differences like 32-bit access.

Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/serial/pl011.yaml +0 -1
   reg:
     maxItems: 1
--

2.25.1

#4 lore raw

RE: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 57 lines

-----Original Message-----
From: Shubhrajyoti Datta
Sent: Friday, December 10, 2021 7:12 PM
To: Rob Herring <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Raviteja Narayanam <[email protected]>
Subject: RE: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 8 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Tuesday, November 30, 2021 3:39 AM
To: Shubhrajyoti Datta <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Raviteja Narayanam <[email protected]>
Subject: Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 4 lines
Quoted 1 line · Shubhrajyoti Datta

Add support for Uart used in Xilinx Versal SOCs as a platform device.

No. Why would we want to do that?

Apologies did not understand that.

Quoted 15 lines
Quoted 15 lines
---
 Documentation/devicetree/bindings/serial/pl011.yaml | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/serial/pl011.yaml +0 -0
index 5ea00f8a283d..6c73923dd15e 100644
@@ -24,9 +24,13 @@ select:
 
Quoted 15 lines

Documentation/devicetree/bindings/serial/pl011.yaml select: · line 33

Quoted 12 lines
Documentation/devicetree/bindings/serial/pl011.yaml +7 -3
 properties:
   compatible:
-    items:
-      - const: arm,pl011
-      - const: arm,primecell
+    oneOf:
+      - items:
+          - const: arm,pl011
+          - const: arm,primecell
+      - items:
+          - const: arm,pl011
+          - const: arm,xlnx-uart # xilinx uart as platform device

'arm,primecell' means the block has ID registers. Are you saying this implementation doesn't?

Quoted 2 lines

The ID registers do not have any Xilinx specific identifiers. However there are differences like 32-bit access.

Hope that the current approach is fine with you.

Thanks

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/serial/pl011.yaml +0 -1
   reg:
     maxItems: 1
--

2.25.1

#5 lore raw

RE: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

<snip>

Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 9 lines
Documentation/devicetree/bindings/serial/pl011.yaml +0 -0
index 5ea00f8a283d..6c73923dd15e 100644
@@ -24,9 +24,13 @@ select:
 
 properties:
   compatible:

Documentation/devicetree/bindings/serial/pl011.yaml select: · line 33

Quoted 10 lines
Documentation/devicetree/bindings/serial/pl011.yaml +7 -3
-    items:
-      - const: arm,pl011
-      - const: arm,primecell
+    oneOf:
+      - items:
+          - const: arm,pl011
+          - const: arm,primecell
+      - items:
+          - const: arm,pl011
+          - const: arm,xlnx-uart # xilinx uart as platform device

'arm,primecell' means the block has ID registers. Are you saying this implementation doesn't?

Quoted 4 lines
Quoted 2 lines

The ID registers do not have any Xilinx specific identifiers. However there are differences like 32-bit access.

Hope that the current approach is fine with you.

Could you please guide how to go about it.

Quoted 10 lines

Thanks

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/serial/pl011.yaml +0 -1
   reg:
     maxItems: 1
--

2.25.1

maintainer
#6 lore raw

Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 25 lines · Shubhrajyoti Datta

<snip>

Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 9 lines
Documentation/devicetree/bindings/serial/pl011.yaml +0 -0
index 5ea00f8a283d..6c73923dd15e 100644
@@ -24,9 +24,13 @@ select:
 
 properties:
   compatible:

Documentation/devicetree/bindings/serial/pl011.yaml select: · line 33

Quoted 10 lines
Documentation/devicetree/bindings/serial/pl011.yaml +7 -3
-    items:
-      - const: arm,pl011
-      - const: arm,primecell
+    oneOf:
+      - items:
+          - const: arm,pl011
+          - const: arm,primecell
+      - items:
+          - const: arm,pl011
+          - const: arm,xlnx-uart # xilinx uart as platform device

'arm,primecell' means the block has ID registers. Are you saying this implementation doesn't?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

The ID registers do not have any Xilinx specific identifiers. However there are differences like 32-bit access.

Hope that the current approach is fine with you.

Could you please guide how to go about it.

No, I don't know what the differences are in your h/w. You have ID registers, but changed the IP and didn't change the ID registers? How has the IP changed?

Rob

#7 lore raw

Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 1 line
Quoted 1 line

<snip>

Quoted 5 lines

No, I don't know what the differences are in your h/w. You have ID registers, but changed the IP and didn't change the ID registers? How has the IP changed?

The IP is not changed and the ID registers are not updated. The limitation is coming from the AXI port that the IP is connected to. The axi port is allowing only the 32 bit access.
The same information will be updated in the Versal TRM.

Quoted 1 line

Rob

#8 lore raw

Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Hi Rob and Krzysztof,

Quoted 9 lines · Shubhrajyoti Datta
Quoted 1 line
Quoted 1 line

<snip>

Quoted 5 lines

No, I don't know what the differences are in your h/w. You have ID registers, but changed the IP and didn't change the ID registers? How has the IP changed?

Quoted 4 lines

The IP is not changed and the ID registers are not updated. The limitation is coming from the AXI port that the IP is connected to. The axi port is allowing only the 32 bit access.
The same information will be updated in the Versal TRM.

Can you please give us your recommendation how to process with this?

Thanks,
Michal

#9 lore raw

Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 12 lines · Michal Simek

Hi Rob and Krzysztof,

Quoted 9 lines · Shubhrajyoti Datta
Quoted 1 line
Quoted 1 line

<snip>

Quoted 5 lines

No, I don't know what the differences are in your h/w. You have ID registers, but changed the IP and didn't change the ID registers? How has the IP changed?

Quoted 6 lines
Quoted 4 lines

The IP is not changed and the ID registers are not updated. The limitation is coming from the AXI port that the IP is connected to. The axi port is allowing only the 32 bit access.
The same information will be updated in the Versal TRM.

Can you please give us your recommendation how to process with this?

Unfortunately I don't think that anyone remembers context from last year, especially me who was not Cced. Rob responded at end of March and it took two months to get back any answer. Such slow response time from submitter does not help to stay in the context. :(

Best regards,
Krzysztof

#10 lore raw

RE: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

[AMD Official Use Only - General]

Quoted 34 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Thursday, July 14, 2022 5:29 PM
To: Michal Simek <[email protected]>; Shubhrajyoti Datta <[email protected]>; Rob Herring <[email protected]>; Krzysztof Kozlowski <[email protected]>
Cc: Shubhrajyoti Datta <[email protected]>; [email protected]; [email protected]; [email protected]; Srinivas Goud <[email protected]>
Subject: Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

Quoted 17 lines · Michal Simek

Hi Rob and Krzysztof,

Quoted 13 lines · Shubhrajyoti Datta
Quoted 1 line
Quoted 1 line

<snip>

Quoted 5 lines

No, I don't know what the differences are in your h/w. You have ID registers, but changed the IP and didn't change the ID registers? How has the IP changed?

The IP is not changed and the ID registers are not updated. The limitation is coming from the AXI port that the IP is connected to. The axi port is allowing only the 32 bit access.
The same information will be updated in the Versal TRM.

Quoted 6 lines
Quoted 1 line

Can you please give us your recommendation how to process with this?

Unfortunately I don't think that anyone remembers context from last year, especially me who was not Cced. Rob responded at end of March and it took two months to get back any answer. Such slow response time from submitter does not help to stay in the context. :(

I had to contact the hardware team and get the details on the issue it took me sometime to get a response.

I will summarize

We are using the ip from ARM but the AXI port that we hooked has a limitation that it allows only 32 bit accesses.

So to tide over the and differentiate I am adding a new compatible arm,xlnx-uart.

Quoted 4 lines

Best regards,
Krzysztof

#11 lore raw

Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

Quoted 45 lines · Shubhrajyoti

[AMD Official Use Only - General]

Quoted 34 lines

-----Original Message-----
From: Krzysztof Kozlowski <[email protected]>
Sent: Thursday, July 14, 2022 5:29 PM
To: Michal Simek <[email protected]>; Shubhrajyoti Datta <[email protected]>; Rob Herring <[email protected]>; Krzysztof Kozlowski <[email protected]>
Cc: Shubhrajyoti Datta <[email protected]>; [email protected]; [email protected]; [email protected]; Srinivas Goud <[email protected]>
Subject: Re: [PATCH 1/2] dt-bindings: serial: pl011: Add 'arm,xlnx-uart'

CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.

Quoted 17 lines · Michal Simek

Hi Rob and Krzysztof,

Quoted 13 lines · Shubhrajyoti Datta
Quoted 1 line
Quoted 1 line

<snip>

Quoted 5 lines

No, I don't know what the differences are in your h/w. You have ID registers, but changed the IP and didn't change the ID registers? How has the IP changed?

The IP is not changed and the ID registers are not updated. The limitation is coming from the AXI port that the IP is connected to. The axi port is allowing only the 32 bit access.
The same information will be updated in the Versal TRM.

Quoted 6 lines
Quoted 1 line

Can you please give us your recommendation how to process with this?

Unfortunately I don't think that anyone remembers context from last year, especially me who was not Cced. Rob responded at end of March and it took two months to get back any answer. Such slow response time from submitter does not help to stay in the context. :(

Quoted 7 lines

I had to contact the hardware team and get the details on the issue it took me sometime to get a response.

I will summarize

We are using the ip from ARM but the AXI port that we hooked has a limitation that it allows only 32 bit accesses.

So to tide over the and differentiate I am adding a new compatible arm,xlnx-uart.

ok.

Shubhrajyoti: Please send this series again with updated commit message in 1/2 which contains information you provided here. That means it will be v2 version.

Thanks,
Michal

#12 lore raw

PATCH 2/2 serial: pl011: Add support for Xilinx Uart

In reply to Shubhrajyoti Datta

From: Raviteja Narayanam <[email protected]>

The xilinx uart used in Versal SOC follows arm pl011 implementation with just a minor change in data bus width. The minimum data transaction width in Versal SOC is 32-bit as specified in the TRM (Chapter 39: Transaction attributes). Pl011 defaults to 16-bit in the driver.
So, add the xilinx uart as platform device with properties specified in 'vendor_data' structure.

---
 drivers/tty/serial/amba-pl011.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
drivers/tty/serial/amba-pl011.c +31 -2
index d361cd84ff8c..278255a45ad9 100644
@@ -124,6 +124,21 @@ static const struct vendor_data vendor_sbsa = {
 	.fixed_options		= true,
 };
 
+static const struct vendor_data vendor_xlnx = {
+	.reg_offset             = pl011_std_offsets,
+	.ifls                   = UART011_IFLS_RX4_8 | UART011_IFLS_TX4_8,
+	.fr_busy                = UART01x_FR_BUSY,
+	.fr_dsr                 = UART01x_FR_DSR,
+	.fr_cts                 = UART01x_FR_CTS,
+	.fr_ri                  = UART011_FR_RI,
+	.access_32b             = true,
+	.oversampling           = false,
+	.dma_threshold          = false,
+	.cts_event_workaround   = false,
+	.always_enabled         = true,
+	.fixed_options          = false,
+};
+
 #ifdef CONFIG_ACPI_SPCR_TABLE
 static const struct vendor_data vendor_qdt_qdf2400_e44 = {
 	.reg_offset		= pl011_std_offsets,
@@ -2628,6 +2643,7 @@ static int __init pl011_early_console_setup(struct earlycon_device *device,
 }
 OF_EARLYCON_DECLARE(pl011, "arm,pl011", pl011_early_console_setup);
 OF_EARLYCON_DECLARE(pl011, "arm,sbsa-uart", pl011_early_console_setup);
+OF_EARLYCON_DECLARE(pl011, "arm,xlnx-uart", pl011_early_console_setup);
 
 /*
  * On Qualcomm Datacenter Technologies QDF2400 SOCs affected by
@@ -2872,6 +2888,7 @@ static int sbsa_uart_probe(struct platform_device *pdev)
 {
 	struct uart_amba_port *uap;
 	struct resource *r;
+	int xlnx_uart = 0;
 	int portnr, ret;
 	int baudrate;
 
@@ -2882,6 +2899,7 @@ static int sbsa_uart_probe(struct platform_device *pdev)
 	if (pdev->dev.of_node) {
 		struct device_node *np = pdev->dev.of_node;
 
+		xlnx_uart = of_device_is_compatible(np, "arm,xlnx-uart");
 		ret = of_property_read_u32(np, "current-speed", &baudrate);
 		if (ret)
 			return ret;
@@ -2911,13 +2929,23 @@ static int sbsa_uart_probe(struct platform_device *pdev)
 #endif
 		uap->vendor = &vendor_sbsa;
 
+	uap->port.ops   = &sbsa_uart_pops;
+
+	if (xlnx_uart) {
+		uap->vendor = &vendor_xlnx;
+		uap->clk = devm_clk_get(&pdev->dev, NULL);
+		if (IS_ERR(uap->clk))
+			return PTR_ERR(uap->clk);
+
+		uap->port.ops = &amba_pl011_pops;
+	}
+
 	uap->reg_offset	= uap->vendor->reg_offset;
 	uap->fifosize	= 32;
 	uap->port.iotype = uap->vendor->access_32b ? UPIO_MEM32 : UPIO_MEM;
-	uap->port.ops	= &sbsa_uart_pops;
 	uap->fixed_baud = baudrate;
 
-	snprintf(uap->type, sizeof(uap->type), "SBSA");
+	snprintf(uap->type, sizeof(uap->type), "%s\n", (xlnx_uart ? "xlnx_uart" : "SBSA"));
 
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
@@ -2941,6 +2969,7 @@ static int sbsa_uart_remove(struct platform_device *pdev)
 
 static const struct of_device_id sbsa_uart_of_match[] = {
 	{ .compatible = "arm,sbsa-uart", },
+	{ .compatible = "arm,xlnx-uart", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, sbsa_uart_of_match);
Signature · 1 line
2.25.1