On 8/19/19 4:26 PM, 'Nikhil Devshatwar' via Jailhouse wrote:
> UART is disabled by default on TI platforms and must be enabled
> via the MDR register.
> 
> Add a new flag in the jailhouse_console and apply the quirk
> as part of uart_init for 8250 driver when this flag is present.
> 
> Signed-off-by: Nikhil Devshatwar <[email protected]>
> Signed-off-by: Lokesh Vutla <[email protected]>
> ---
> Changes from v1:
> * Use console flag for MDR quirk instead of compile time flag
> 
>  include/jailhouse/console.h | 7 ++++++-
>  inmates/lib/uart-8250.c     | 4 ++++
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/include/jailhouse/console.h b/include/jailhouse/console.h
> index 8961c6e..a54bb56 100644
> --- a/include/jailhouse/console.h
> +++ b/include/jailhouse/console.h
> @@ -78,7 +78,12 @@
>  
>  #define CON_HAS_INVERTED_GATE(flags) !!((flags) & 
> JAILHOUSE_CON_INVERTED_GATE)
>  
> -/* Bits 13-15: Reserved */
> +/* Bit 13 is used to apply(set) or skip(clear) a MDR quirk on the console */

nit: please add a whitespace after 'apply' and 'clear'.

> +#define JAILHOUSE_CON_MDR_QUIRK              0x2000
> +
> +#define CON_HAS_MDR_QUIRK(flags)     !!((flags) & JAILHOUSE_CON_MDR_QUIRK)
> +
> +/* Bits 14-15: Reserved */

Space for two more quirks left. ;-)

>  
>  struct jailhouse_console {
>       __u64 address;
> diff --git a/inmates/lib/uart-8250.c b/inmates/lib/uart-8250.c
> index fb7940d..5b94b5d 100644
> --- a/inmates/lib/uart-8250.c
> +++ b/inmates/lib/uart-8250.c
> @@ -49,6 +49,7 @@
>  #define  UART_LCR_DLAB               0x80
>  #define UART_LSR             0x5
>  #define  UART_LSR_THRE               0x20
> +#define  UART_MDR1           0x8
>  
>  static void reg_out_mmio32(struct uart_chip *chip, unsigned int reg, u32 
> value)
>  {
> @@ -67,6 +68,9 @@ static void uart_8250_init(struct uart_chip *chip)
>               chip->reg_out(chip, UART_DLL, chip->divider);
>               chip->reg_out(chip, UART_DLM, 0);
>               chip->reg_out(chip, UART_LCR, UART_LCR_8N1);
> +             if (comm_region->console.flags & JAILHOUSE_CON_MDR_QUIRK) {

You can use CON_HAS_MDR_QUIRK here.

> +                     chip->reg_out(chip, UART_MDR1, 0);
> +             }

... and remove the useless brackets.

Thanks
  Ralf

>       }
>  }
>  
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/7ec253ee-709a-a78c-7f91-9fdba7590b9b%40oth-regensburg.de.

Reply via email to