xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm/acpi: Add Server Base System Architecture UART support
@ 2016-05-27  0:28 Shanker Donthineni
  2016-05-27 13:04 ` Julien Grall
  0 siblings, 1 reply; 9+ messages in thread
From: Shanker Donthineni @ 2016-05-27  0:28 UTC (permalink / raw)
  To: xen-devel
  Cc: Philip Elcan, Julien Grall, Stefano Stabellini,
	Shanker Donthineni, Vikram Sethi

The ARM Server Base System Architecture describes a generic UART
interface. It doesn't support clock control registers to set
baudrate. So, extend the driver probe() to handle SBSA interface
types and set the baudrate to 115200 for SBSA interfaces.

Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
---
https://silver.arm.com/download/download.tm?pv=2950177
 xen/drivers/char/pl011.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
index 1212d5c..81d095f 100644
--- a/xen/drivers/char/pl011.c
+++ b/xen/drivers/char/pl011.c
@@ -226,14 +226,14 @@ static struct uart_driver __read_mostly pl011_driver = {
     .vuart_info   = pl011_vuart,
 };
 
-static int __init pl011_uart_init(int irq, u64 addr, u64 size)
+static int __init pl011_uart_init(int irq, u64 addr, u64 size, int baud)
 {
     struct pl011 *uart;
 
     uart = &pl011_com;
     uart->irq       = irq;
     uart->clock_hz  = 0x16e3600;
-    uart->baud      = BAUD_AUTO;
+    uart->baud      = baud;
     uart->data_bits = 8;
     uart->parity    = PARITY_NONE;
     uart->stop_bits = 1;
@@ -285,7 +285,7 @@ static int __init pl011_dt_uart_init(struct dt_device_node *dev,
         return -EINVAL;
     }
 
-    res = pl011_uart_init(res, addr, size);
+    res = pl011_uart_init(res, addr, size, BAUD_AUTO);
     if ( res < 0 )
     {
         printk("pl011: Unable to initialize\n");
@@ -315,6 +315,7 @@ static int __init pl011_acpi_uart_init(const void *data)
 {
     acpi_status status;
     struct acpi_table_spcr *spcr = NULL;
+    int baud = BAUD_AUTO;
     int res;
 
     status = acpi_get_table(ACPI_SIG_SPCR, 0,
@@ -326,17 +327,23 @@ static int __init pl011_acpi_uart_init(const void *data)
         return -EINVAL;
     }
 
+    if ( (spcr->interface_type == ACPI_DBG2_SBSA_32) ||
+         (spcr->interface_type == ACPI_DBG2_SBSA) )
+        baud = 115200;
+
     /* trigger/polarity information is not available in spcr */
     irq_set_type(spcr->interrupt, IRQ_TYPE_LEVEL_HIGH);
 
     res = pl011_uart_init(spcr->interrupt, spcr->serial_port.address,
-                          PAGE_SIZE);
+                          PAGE_SIZE, baud);
     if ( res < 0 )
     {
         printk("pl011: Unable to initialize\n");
         return res;
     }
 
+
+
     return 0;
 }
 
@@ -344,6 +351,16 @@ ACPI_DEVICE_START(apl011, "PL011 UART", DEVICE_SERIAL)
         .class_type = ACPI_DBG2_PL011,
         .init = pl011_acpi_uart_init,
 ACPI_DEVICE_END
+
+ACPI_DEVICE_START(asbsa_uart, "SBSA UART", DEVICE_SERIAL)
+        .class_type = ACPI_DBG2_SBSA,
+        .init = pl011_acpi_uart_init,
+ACPI_DEVICE_END
+
+ACPI_DEVICE_START(asbsa32_uart, "SBSA32 UART", DEVICE_SERIAL)
+        .class_type = ACPI_DBG2_SBSA_32,
+        .init = pl011_acpi_uart_init,
+ACPI_DEVICE_END
 #endif
 
 /*
-- 
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, 
a Linux Foundation Collaborative Project


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] arm/acpi: Add Server Base System Architecture UART support
  2016-05-27  0:28 [PATCH] arm/acpi: Add Server Base System Architecture UART support Shanker Donthineni
@ 2016-05-27 13:04 ` Julien Grall
  2016-05-27 14:01   ` Shanker Donthineni
  0 siblings, 1 reply; 9+ messages in thread
From: Julien Grall @ 2016-05-27 13:04 UTC (permalink / raw)
  To: Shanker Donthineni, xen-devel
  Cc: Philip Elcan, Stefano Stabellini, Vikram Sethi

Hello Shanker,

On 27/05/16 01:28, Shanker Donthineni wrote:
> The ARM Server Base System Architecture describes a generic UART
> interface. It doesn't support clock control registers to set
> baudrate. So, extend the driver probe() to handle SBSA interface
> types and set the baudrate to 115200 for SBSA interfaces.

I cannot find any mention of the baudrate in the SBSA. Where does it 
come from?

Also the driver is using registers which should not be touch for the 
SBSA UART (see appendix B in the SBSA ARM-DEN-0029 v3.0). So this need 
to be address to get a proper support.

> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
> ---
> https://silver.arm.com/download/download.tm?pv=2950177
>   xen/drivers/char/pl011.c | 25 +++++++++++++++++++++----
>   1 file changed, 21 insertions(+), 4 deletions(-)
>
> diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
> index 1212d5c..81d095f 100644
> --- a/xen/drivers/char/pl011.c
> +++ b/xen/drivers/char/pl011.c
> @@ -226,14 +226,14 @@ static struct uart_driver __read_mostly pl011_driver = {
>       .vuart_info   = pl011_vuart,
>   };
>
> -static int __init pl011_uart_init(int irq, u64 addr, u64 size)
> +static int __init pl011_uart_init(int irq, u64 addr, u64 size, int baud)
>   {
>       struct pl011 *uart;
>
>       uart = &pl011_com;
>       uart->irq       = irq;
>       uart->clock_hz  = 0x16e3600;
> -    uart->baud      = BAUD_AUTO;
> +    uart->baud      = baud;
>       uart->data_bits = 8;
>       uart->parity    = PARITY_NONE;
>       uart->stop_bits = 1;
> @@ -285,7 +285,7 @@ static int __init pl011_dt_uart_init(struct dt_device_node *dev,
>           return -EINVAL;
>       }
>
> -    res = pl011_uart_init(res, addr, size);
> +    res = pl011_uart_init(res, addr, size, BAUD_AUTO);
>       if ( res < 0 )
>       {
>           printk("pl011: Unable to initialize\n");
> @@ -315,6 +315,7 @@ static int __init pl011_acpi_uart_init(const void *data)
>   {
>       acpi_status status;
>       struct acpi_table_spcr *spcr = NULL;
> +    int baud = BAUD_AUTO;
>       int res;
>
>       status = acpi_get_table(ACPI_SIG_SPCR, 0,
> @@ -326,17 +327,23 @@ static int __init pl011_acpi_uart_init(const void *data)
>           return -EINVAL;
>       }
>
> +    if ( (spcr->interface_type == ACPI_DBG2_SBSA_32) ||

Based on the DBG2 spec, this value is deprecated. So I do not think we 
should support it.

> +         (spcr->interface_type == ACPI_DBG2_SBSA) )
> +        baud = 115200;
> +
>       /* trigger/polarity information is not available in spcr */
>       irq_set_type(spcr->interrupt, IRQ_TYPE_LEVEL_HIGH);
>
>       res = pl011_uart_init(spcr->interrupt, spcr->serial_port.address,
> -                          PAGE_SIZE);
> +                          PAGE_SIZE, baud);
>       if ( res < 0 )
>       {
>           printk("pl011: Unable to initialize\n");
>           return res;
>       }
>
> +
> +

Spurious changes.

>       return 0;
>   }
>
> @@ -344,6 +351,16 @@ ACPI_DEVICE_START(apl011, "PL011 UART", DEVICE_SERIAL)
>           .class_type = ACPI_DBG2_PL011,
>           .init = pl011_acpi_uart_init,
>   ACPI_DEVICE_END
> +
> +ACPI_DEVICE_START(asbsa_uart, "SBSA UART", DEVICE_SERIAL)
> +        .class_type = ACPI_DBG2_SBSA,
> +        .init = pl011_acpi_uart_init,
> +ACPI_DEVICE_END
> +
> +ACPI_DEVICE_START(asbsa32_uart, "SBSA32 UART", DEVICE_SERIAL)
> +        .class_type = ACPI_DBG2_SBSA_32,
> +        .init = pl011_acpi_uart_init,
> +ACPI_DEVICE_END
>   #endif
>
>   /*
>

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] arm/acpi: Add Server Base System Architecture UART support
  2016-05-27 13:04 ` Julien Grall
@ 2016-05-27 14:01   ` Shanker Donthineni
  2016-05-27 14:56     ` Julien Grall
  0 siblings, 1 reply; 9+ messages in thread
From: Shanker Donthineni @ 2016-05-27 14:01 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Philip Elcan, Stefano Stabellini, Vikram Sethi



On 05/27/2016 08:04 AM, Julien Grall wrote:
> Hello Shanker,
>
> On 27/05/16 01:28, Shanker Donthineni wrote:
>> The ARM Server Base System Architecture describes a generic UART
>> interface. It doesn't support clock control registers to set
>> baudrate. So, extend the driver probe() to handle SBSA interface
>> types and set the baudrate to 115200 for SBSA interfaces.
>
> I cannot find any mention of the baudrate in the SBSA. Where does it come from?
>
Yes, no where mentioned about the baudrate in SBSA document. I used 115200 based on the  the Linux  PL011 driver.

> Also the driver is using registers which should not be touch for the SBSA UART (see appendix B in the SBSA ARM-DEN-0029 v3.0). So this need to be address to get a proper support.
>
Yes, I agree with you, Which registers it is touching other than baudrate control registers?

>> Signed-off-by: Shanker Donthineni <shankerd@codeaurora.org>
>> ---
>> https://silver.arm.com/download/download.tm?pv=2950177
>>   xen/drivers/char/pl011.c | 25 +++++++++++++++++++++----
>>   1 file changed, 21 insertions(+), 4 deletions(-)
>>
>> diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
>> index 1212d5c..81d095f 100644
>> --- a/xen/drivers/char/pl011.c
>> +++ b/xen/drivers/char/pl011.c
>> @@ -226,14 +226,14 @@ static struct uart_driver __read_mostly pl011_driver = {
>>       .vuart_info   = pl011_vuart,
>>   };
>>
>> -static int __init pl011_uart_init(int irq, u64 addr, u64 size)
>> +static int __init pl011_uart_init(int irq, u64 addr, u64 size, int baud)
>>   {
>>       struct pl011 *uart;
>>
>>       uart = &pl011_com;
>>       uart->irq       = irq;
>>       uart->clock_hz  = 0x16e3600;
>> -    uart->baud      = BAUD_AUTO;
>> +    uart->baud      = baud;
>>       uart->data_bits = 8;
>>       uart->parity    = PARITY_NONE;
>>       uart->stop_bits = 1;
>> @@ -285,7 +285,7 @@ static int __init pl011_dt_uart_init(struct dt_device_node *dev,
>>           return -EINVAL;
>>       }
>>
>> -    res = pl011_uart_init(res, addr, size);
>> +    res = pl011_uart_init(res, addr, size, BAUD_AUTO);
>>       if ( res < 0 )
>>       {
>>           printk("pl011: Unable to initialize\n");
>> @@ -315,6 +315,7 @@ static int __init pl011_acpi_uart_init(const void *data)
>>   {
>>       acpi_status status;
>>       struct acpi_table_spcr *spcr = NULL;
>> +    int baud = BAUD_AUTO;
>>       int res;
>>
>>       status = acpi_get_table(ACPI_SIG_SPCR, 0,
>> @@ -326,17 +327,23 @@ static int __init pl011_acpi_uart_init(const void *data)
>>           return -EINVAL;
>>       }
>>
>> +    if ( (spcr->interface_type == ACPI_DBG2_SBSA_32) ||
>
> Based on the DBG2 spec, this value is deprecated. So I do not think we should support it.
>

I'll fix.

>> +         (spcr->interface_type == ACPI_DBG2_SBSA) )
>> +        baud = 115200;
>> +
>>       /* trigger/polarity information is not available in spcr */
>>       irq_set_type(spcr->interrupt, IRQ_TYPE_LEVEL_HIGH);
>>
>>       res = pl011_uart_init(spcr->interrupt, spcr->serial_port.address,
>> -                          PAGE_SIZE);
>> +                          PAGE_SIZE, baud);
>>       if ( res < 0 )
>>       {
>>           printk("pl011: Unable to initialize\n");
>>           return res;
>>       }
>>
>> +
>> +
>
> Spurious changes.
>
>>       return 0;
>>   }
>>
>> @@ -344,6 +351,16 @@ ACPI_DEVICE_START(apl011, "PL011 UART", DEVICE_SERIAL)
>>           .class_type = ACPI_DBG2_PL011,
>>           .init = pl011_acpi_uart_init,
>>   ACPI_DEVICE_END
>> +
>> +ACPI_DEVICE_START(asbsa_uart, "SBSA UART", DEVICE_SERIAL)
>> +        .class_type = ACPI_DBG2_SBSA,
>> +        .init = pl011_acpi_uart_init,
>> +ACPI_DEVICE_END
>> +
>> +ACPI_DEVICE_START(asbsa32_uart, "SBSA32 UART", DEVICE_SERIAL)
>> +        .class_type = ACPI_DBG2_SBSA_32,
>> +        .init = pl011_acpi_uart_init,
>> +ACPI_DEVICE_END
>>   #endif
>>
>>   /*
>>
>
> Regards,
>

-- 
Shanker Donthineni
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] arm/acpi: Add Server Base System Architecture UART support
  2016-05-27 14:01   ` Shanker Donthineni
@ 2016-05-27 14:56     ` Julien Grall
  2016-05-27 15:19       ` Shanker Donthineni
                         ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Julien Grall @ 2016-05-27 14:56 UTC (permalink / raw)
  To: Shanker Donthineni, xen-devel
  Cc: Andre Przywara, Philip Elcan, Stefano Stabellini, Vikram Sethi

Hello Shanker,

On 27/05/16 15:01, Shanker Donthineni wrote:
> On 05/27/2016 08:04 AM, Julien Grall wrote:
>> On 27/05/16 01:28, Shanker Donthineni wrote:
>>> The ARM Server Base System Architecture describes a generic UART
>>> interface. It doesn't support clock control registers to set
>>> baudrate. So, extend the driver probe() to handle SBSA interface
>>> types and set the baudrate to 115200 for SBSA interfaces.
>>
>> I cannot find any mention of the baudrate in the SBSA. Where does it come from?
>>
> Yes, no where mentioned about the baudrate in SBSA document. I used 115200 based on the  the Linux  PL011 driver.

Looking at the Linux code, it is a default when there is no valid 
configuration (which may not be suitable for any platform?).

Whilst Linux userspace cares about the baudrate, Xen only use it to 
configure the hardware. Given that the UART should have been configured 
by the hardware-specific software, the proper value should be BAUD_AUTO.

If you look at the code, pl011_init_preirq will read the baud rate when 
uart->baud == BAUD_AUTO but will never be used after.

>> Also the driver is using registers which should not be touch for the SBSA UART (see appendix B in the SBSA ARM-DEN-0029 v3.0). So this need to be address to get a proper support.
>>
> Yes, I agree with you, Which registers it is touching other than baudrate control registers?

Well, I only gave a quick look and noticed the difference between the 
SBSA and the pl011 (e.g CR, IFLS,...) . I am sure you can find out the 
rest of the registers by looking at the code (pl011-uart.h) and the spec.

Regards,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] arm/acpi: Add Server Base System Architecture UART support
  2016-05-27 14:56     ` Julien Grall
@ 2016-05-27 15:19       ` Shanker Donthineni
  2016-05-30  6:54       ` Wei Chen
  2016-05-30 12:00       ` Stefano Stabellini
  2 siblings, 0 replies; 9+ messages in thread
From: Shanker Donthineni @ 2016-05-27 15:19 UTC (permalink / raw)
  To: Julien Grall, xen-devel
  Cc: Andre Przywara, Philip Elcan, Stefano Stabellini, Vikram Sethi

I'll address your review comments in V2 patch.


On 05/27/2016 09:56 AM, Julien Grall wrote:
> Hello Shanker,
>
> On 27/05/16 15:01, Shanker Donthineni wrote:
>> On 05/27/2016 08:04 AM, Julien Grall wrote:
>>> On 27/05/16 01:28, Shanker Donthineni wrote:
>>>> The ARM Server Base System Architecture describes a generic UART
>>>> interface. It doesn't support clock control registers to set
>>>> baudrate. So, extend the driver probe() to handle SBSA interface
>>>> types and set the baudrate to 115200 for SBSA interfaces.
>>>
>>> I cannot find any mention of the baudrate in the SBSA. Where does it come from?
>>>
>> Yes, no where mentioned about the baudrate in SBSA document. I used 115200 based on the  the Linux  PL011 driver.
>
> Looking at the Linux code, it is a default when there is no valid configuration (which may not be suitable for any platform?).
>
> Whilst Linux userspace cares about the baudrate, Xen only use it to configure the hardware. Given that the UART should have been configured by the hardware-specific software, the proper value should be BAUD_AUTO.
>
> If you look at the code, pl011_init_preirq will read the baud rate when uart->baud == BAUD_AUTO but will never be used after.
>
>>> Also the driver is using registers which should not be touch for the SBSA UART (see appendix B in the SBSA ARM-DEN-0029 v3.0). So this need to be address to get a proper support.
>>>
>> Yes, I agree with you, Which registers it is touching other than baudrate control registers?
>
> Well, I only gave a quick look and noticed the difference between the SBSA and the pl011 (e.g CR, IFLS,...) . I am sure you can find out the rest of the registers by looking at the code (pl011-uart.h) and the spec.
>
> Regards,
>

-- 
Shanker Donthineni
Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] arm/acpi: Add Server Base System Architecture UART support
  2016-05-27 14:56     ` Julien Grall
  2016-05-27 15:19       ` Shanker Donthineni
@ 2016-05-30  6:54       ` Wei Chen
  2016-05-30 12:00       ` Stefano Stabellini
  2 siblings, 0 replies; 9+ messages in thread
From: Wei Chen @ 2016-05-30  6:54 UTC (permalink / raw)
  To: Julien Grall
  Cc: Philip Elcan, Vikram Sethi, Andre Przywara, xen-devel,
	Stefano Stabellini, Shanker Donthineni

Hi Shanker,

On 27 May 2016 at 22:56, Julien Grall <julien.grall@arm.com> wrote:
> Hello Shanker,
>
> On 27/05/16 15:01, Shanker Donthineni wrote:
>>
>> On 05/27/2016 08:04 AM, Julien Grall wrote:
>>>
>>> On 27/05/16 01:28, Shanker Donthineni wrote:
>>>>
>>>> The ARM Server Base System Architecture describes a generic UART
>>>> interface. It doesn't support clock control registers to set
>>>> baudrate. So, extend the driver probe() to handle SBSA interface
>>>> types and set the baudrate to 115200 for SBSA interfaces.
>>>
>>>
>>> I cannot find any mention of the baudrate in the SBSA. Where does it come
>>> from?
>>>
>> Yes, no where mentioned about the baudrate in SBSA document. I used 115200
>> based on the  the Linux  PL011 driver.
>
>
> Looking at the Linux code, it is a default when there is no valid
> configuration (which may not be suitable for any platform?).
>
> Whilst Linux userspace cares about the baudrate, Xen only use it to
> configure the hardware. Given that the UART should have been configured by
> the hardware-specific software, the proper value should be BAUD_AUTO.
>
> If you look at the code, pl011_init_preirq will read the baud rate when
> uart->baud == BAUD_AUTO but will never be used after.
>
>>> Also the driver is using registers which should not be touch for the SBSA
>>> UART (see appendix B in the SBSA ARM-DEN-0029 v3.0). So this need to be
>>> address to get a proper support.
>>>
>> Yes, I agree with you, Which registers it is touching other than baudrate
>> control registers?
>
>
> Well, I only gave a quick look and noticed the difference between the SBSA
> and the pl011 (e.g CR, IFLS,...) . I am sure you can find out the rest of
> the registers by looking at the code (pl011-uart.h) and the spec.
>

The SBSA (ARM-DEN-0029 v3.0) has defined a minimum set of UART registers.
When driver customizes the bandrate, it will access the IBRD and FBRD registers.
But these two registers are not listed in the minimum set registers.
In this case, not
all SBSA UARTs have these two registers. When uart->baud != BAUD_AUTO, the
code will cause some UARTs' initialization to fail.

> Regards,
>
> --
> Julien Grall
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] arm/acpi: Add Server Base System Architecture UART support
  2016-05-27 14:56     ` Julien Grall
  2016-05-27 15:19       ` Shanker Donthineni
  2016-05-30  6:54       ` Wei Chen
@ 2016-05-30 12:00       ` Stefano Stabellini
  2016-05-30 12:08         ` Julien Grall
  2 siblings, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2016-05-30 12:00 UTC (permalink / raw)
  To: Julien Grall
  Cc: Philip Elcan, Vikram Sethi, Andre Przywara, xen-devel,
	Stefano Stabellini, Shanker Donthineni

On Fri, 27 May 2016, Julien Grall wrote:
> Hello Shanker,
> 
> On 27/05/16 15:01, Shanker Donthineni wrote:
> > On 05/27/2016 08:04 AM, Julien Grall wrote:
> > > On 27/05/16 01:28, Shanker Donthineni wrote:
> > > > The ARM Server Base System Architecture describes a generic UART
> > > > interface. It doesn't support clock control registers to set
> > > > baudrate. So, extend the driver probe() to handle SBSA interface
> > > > types and set the baudrate to 115200 for SBSA interfaces.
> > > 
> > > I cannot find any mention of the baudrate in the SBSA. Where does it come
> > > from?
> > > 
> > Yes, no where mentioned about the baudrate in SBSA document. I used 115200
> > based on the  the Linux  PL011 driver.
> 
> Looking at the Linux code, it is a default when there is no valid
> configuration (which may not be suitable for any platform?).
> 
> Whilst Linux userspace cares about the baudrate, Xen only use it to configure
> the hardware. Given that the UART should have been configured by the
> hardware-specific software, the proper value should be BAUD_AUTO.
> 
> If you look at the code, pl011_init_preirq will read the baud rate when
> uart->baud == BAUD_AUTO but will never be used after.

The problem is that IBRD and FBRD are not part of the SBSA doc, so to
make the driver compliant, we would have to skip reading the baudrate
too, which shouldn't be a problem.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] arm/acpi: Add Server Base System Architecture UART support
  2016-05-30 12:00       ` Stefano Stabellini
@ 2016-05-30 12:08         ` Julien Grall
  2016-05-30 12:22           ` Julien Grall
  0 siblings, 1 reply; 9+ messages in thread
From: Julien Grall @ 2016-05-30 12:08 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Andre Przywara, Philip Elcan, xen-devel, Vikram Sethi,
	Shanker Donthineni



On 30/05/2016 13:00, Stefano Stabellini wrote:
> On Fri, 27 May 2016, Julien Grall wrote:
>> Hello Shanker,
>>
>> On 27/05/16 15:01, Shanker Donthineni wrote:
>>> On 05/27/2016 08:04 AM, Julien Grall wrote:
>>>> On 27/05/16 01:28, Shanker Donthineni wrote:
>>>>> The ARM Server Base System Architecture describes a generic UART
>>>>> interface. It doesn't support clock control registers to set
>>>>> baudrate. So, extend the driver probe() to handle SBSA interface
>>>>> types and set the baudrate to 115200 for SBSA interfaces.
>>>>
>>>> I cannot find any mention of the baudrate in the SBSA. Where does it come
>>>> from?
>>>>
>>> Yes, no where mentioned about the baudrate in SBSA document. I used 115200
>>> based on the  the Linux  PL011 driver.
>>
>> Looking at the Linux code, it is a default when there is no valid
>> configuration (which may not be suitable for any platform?).
>>
>> Whilst Linux userspace cares about the baudrate, Xen only use it to configure
>> the hardware. Given that the UART should have been configured by the
>> hardware-specific software, the proper value should be BAUD_AUTO.
>>
>> If you look at the code, pl011_init_preirq will read the baud rate when
>> uart->baud == BAUD_AUTO but will never be used after.
>
> The problem is that IBRD and FBRD are not part of the SBSA doc, so to
> make the driver compliant, we would have to skip reading the baudrate
> too, which shouldn't be a problem.

Well, we are reading the baud rate, but it is never used within the 
driver except. So I would drop the code rather than skip it.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] arm/acpi: Add Server Base System Architecture UART support
  2016-05-30 12:08         ` Julien Grall
@ 2016-05-30 12:22           ` Julien Grall
  0 siblings, 0 replies; 9+ messages in thread
From: Julien Grall @ 2016-05-30 12:22 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Andre Przywara, Philip Elcan, xen-devel, Vikram Sethi,
	Shanker Donthineni



On 30/05/2016 13:08, Julien Grall wrote:
>
>
> On 30/05/2016 13:00, Stefano Stabellini wrote:
>> On Fri, 27 May 2016, Julien Grall wrote:
>>> Hello Shanker,
>>>
>>> On 27/05/16 15:01, Shanker Donthineni wrote:
>>>> On 05/27/2016 08:04 AM, Julien Grall wrote:
>>>>> On 27/05/16 01:28, Shanker Donthineni wrote:
>>>>>> The ARM Server Base System Architecture describes a generic UART
>>>>>> interface. It doesn't support clock control registers to set
>>>>>> baudrate. So, extend the driver probe() to handle SBSA interface
>>>>>> types and set the baudrate to 115200 for SBSA interfaces.
>>>>>
>>>>> I cannot find any mention of the baudrate in the SBSA. Where does
>>>>> it come
>>>>> from?
>>>>>
>>>> Yes, no where mentioned about the baudrate in SBSA document. I used
>>>> 115200
>>>> based on the  the Linux  PL011 driver.
>>>
>>> Looking at the Linux code, it is a default when there is no valid
>>> configuration (which may not be suitable for any platform?).
>>>
>>> Whilst Linux userspace cares about the baudrate, Xen only use it to
>>> configure
>>> the hardware. Given that the UART should have been configured by the
>>> hardware-specific software, the proper value should be BAUD_AUTO.
>>>
>>> If you look at the code, pl011_init_preirq will read the baud rate when
>>> uart->baud == BAUD_AUTO but will never be used after.
>>
>> The problem is that IBRD and FBRD are not part of the SBSA doc, so to
>> make the driver compliant, we would have to skip reading the baudrate
>> too, which shouldn't be a problem.
>
> Well, we are reading the baud rate, but it is never used within the
> driver except. So I would drop the code rather than skip it.

Actually, looking a bit more at the code. The code to handle a fixed 
baud rate (baud != BAUD_AUTO) is likely buggy because the clock 
frequency (clk_hz) is hardcoded in Xen. Based on the commit log, the 
value is versatile express specific.

Anyway, the driver is always setting the baud rate to auto. So I will 
send a patch to drop completely the selection of the baud rate.

Note, that this may not be sufficient to support the SBSA UART.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-05-30 12:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-27  0:28 [PATCH] arm/acpi: Add Server Base System Architecture UART support Shanker Donthineni
2016-05-27 13:04 ` Julien Grall
2016-05-27 14:01   ` Shanker Donthineni
2016-05-27 14:56     ` Julien Grall
2016-05-27 15:19       ` Shanker Donthineni
2016-05-30  6:54       ` Wei Chen
2016-05-30 12:00       ` Stefano Stabellini
2016-05-30 12:08         ` Julien Grall
2016-05-30 12:22           ` Julien Grall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).