All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2)
@ 2019-02-01 12:37 Oleksandr Tyshchenko
  2019-02-01 12:37 ` [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs Oleksandr Tyshchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 22+ messages in thread
From: Oleksandr Tyshchenko @ 2019-02-01 12:37 UTC (permalink / raw)
  To: xen-devel; +Cc: Oleksandr Tyshchenko, Julien Grall, Stefano Stabellini

From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

Hi, all.

The purpose of this patch series is to add required support to be able to run
Xen on Renesas Stout board [1] which uses SCIFA compatible UART as a console
interface.

Actually Xen already has support for SCIF compatible UARTs which are used on
Renesas Lager (R-Car Gen2), Salvator-X, H3ULCB/M3ULCB (R-Car Gen3) and other
development boards. So this patch series extends existing support to be able
to handle both interfaces.

----------

Current patch series is based on the following commit 3389a8dc8c5753a3c84744923cd0193395e3f2a9
and tested on Stout (ARM32) and H3ULCB (ARM64) boards.

You can find current patch series here:
repo: https://github.com/otyshchenko1/xen.git branch: stout_upstream

You can find previous discussion here:
https://www.mail-archive.com/xen-devel@lists.xenproject.org/msg21058.html

Please note, that current patch series doesn’t have the following patches:
- xen/arm: drivers: scif: Remove unused #define-s (already upstreamed)
- xen/arm: Reuse R-Car Gen2 platform code for Stout board (was dropped)
but has new one:
- xen/arm: Clarify usage of earlyprintk for Lager board

----------

In order to run Xen on Stout board you need "PSCI-enabled" U-Boot (not upsteamed yet).
You can find corresponding patches for U-Boot here:
http://u-boot.10912.n7.nabble.com/PATCH-0-3-PSCI-support-for-r8a7790-SoC-Lager-Stout-boards-td357352.html

Have a plan to update Xen Wiki regarding this board.

[1] https://elinux.org/R-Car/Boards/Stout

----------

Oleksandr Tyshchenko (3):
  xen/arm: drivers: scif: Add support for SCIFA compatible UARTs
  xen/arm: Clarify usage of earlyprintk for Lager board
  xen/arm: Add SCIFA UART support for early printk

 docs/misc/arm/early-printk.txt     |   2 +-
 xen/arch/arm/arm32/debug-scifa.inc |  51 ++++++++++++++
 xen/drivers/char/scif-uart.c       | 139 +++++++++++++++++++++++++++----------
 xen/include/asm-arm/scif-uart.h    |  44 ++++++++++--
 4 files changed, 194 insertions(+), 42 deletions(-)
 create mode 100644 xen/arch/arm/arm32/debug-scifa.inc

-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs
  2019-02-01 12:37 [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2) Oleksandr Tyshchenko
@ 2019-02-01 12:37 ` Oleksandr Tyshchenko
  2019-02-18 14:00   ` Julien Grall
  2019-02-01 12:37 ` [PATCH V2 2/3] xen/arm: Clarify usage of earlyprintk for Lager board Oleksandr Tyshchenko
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 22+ messages in thread
From: Oleksandr Tyshchenko @ 2019-02-01 12:37 UTC (permalink / raw)
  To: xen-devel; +Cc: Oleksandr Tyshchenko, Julien Grall, Stefano Stabellini

From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

Extend existing driver to be able to handle SCIFA interface as well.
SCIF and SCIFA have lot in common, though SCIFA has different
offsets and bits for some registers.

The "data" field in struct dt_device_match is used for recognizing
what interface is present on a target board.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

---
    Changes in v2:
        - Name a enum for describing interfaces this driver supports
        - Use local variable for "params" where appropriate
        - Use "data" field in struct dt_device_match instead of calling
          dt_device_is_compatible()
        - Don't check for "overrun_reg != status_reg" condition during
          initialization
---
 xen/drivers/char/scif-uart.c    | 139 ++++++++++++++++++++++++++++++----------
 xen/include/asm-arm/scif-uart.h |  44 +++++++++++--
 2 files changed, 142 insertions(+), 41 deletions(-)

diff --git a/xen/drivers/char/scif-uart.c b/xen/drivers/char/scif-uart.c
index 465fb34..9d2b08d 100644
--- a/xen/drivers/char/scif-uart.c
+++ b/xen/drivers/char/scif-uart.c
@@ -1,7 +1,7 @@
 /*
  * xen/drivers/char/scif-uart.c
  *
- * Driver for SCIF (Serial communication interface with FIFO)
+ * Driver for SCIF(A) (Serial communication interface with FIFO (A))
  * compatible UART.
  *
  * Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
@@ -40,16 +40,66 @@ static struct scif_uart {
     char __iomem *regs;
     struct irqaction irqaction;
     struct vuart_info vuart;
+    const struct port_params *params;
 } scif_com = {0};
 
+enum port_types
+{
+    SCIF_PORT,
+    SCIFA_PORT,
+    NR_PORTS,
+};
+
+struct port_params
+{
+    unsigned int status_reg;
+    unsigned int tx_fifo_reg;
+    unsigned int rx_fifo_reg;
+    unsigned int overrun_reg;
+    unsigned int overrun_mask;
+    unsigned int error_mask;
+    unsigned int irq_flags;
+    unsigned int fifo_size;
+};
+
+static const struct port_params port_params[NR_PORTS] =
+{
+    [SCIF_PORT] =
+    {
+        .status_reg   = SCIF_SCFSR,
+        .tx_fifo_reg  = SCIF_SCFTDR,
+        .rx_fifo_reg  = SCIF_SCFRDR,
+        .overrun_reg  = SCIF_SCLSR,
+        .overrun_mask = SCLSR_ORER,
+        .error_mask   = SCFSR_PER | SCFSR_FER | SCFSR_BRK | SCFSR_ER,
+        .irq_flags    = SCSCR_RIE | SCSCR_TIE | SCSCR_REIE,
+        .fifo_size    = 16,
+    },
+
+    [SCIFA_PORT] =
+    {
+        .status_reg   = SCIFA_SCASSR,
+        .tx_fifo_reg  = SCIFA_SCAFTDR,
+        .rx_fifo_reg  = SCIFA_SCAFRDR,
+        .overrun_reg  = SCIFA_SCASSR,
+        .overrun_mask = SCASSR_ORER,
+        .error_mask   = SCASSR_PER | SCASSR_FER | SCASSR_BRK | SCASSR_ER |
+                        SCASSR_ORER,
+        .irq_flags    = SCASCR_RIE | SCASCR_TIE | SCASCR_DRIE | SCASCR_ERIE |
+                        SCASCR_BRIE,
+        .fifo_size    = 64,
+    },
+};
+
 static void scif_uart_interrupt(int irq, void *data, struct cpu_user_regs *regs)
 {
     struct serial_port *port = data;
     struct scif_uart *uart = port->uart;
+    const struct port_params *params = uart->params;
     uint16_t status, ctrl;
 
     ctrl = scif_readw(uart, SCIF_SCSCR);
-    status = scif_readw(uart, SCIF_SCFSR) & ~SCFSR_TEND;
+    status = scif_readw(uart, params->status_reg) & ~SCFSR_TEND;
     /* Ignore next flag if TX Interrupt is disabled */
     if ( !(ctrl & SCSCR_TIE) )
         status &= ~SCFSR_TDFE;
@@ -65,13 +115,16 @@ static void scif_uart_interrupt(int irq, void *data, struct cpu_user_regs *regs)
             serial_rx_interrupt(port, regs);
 
         /* Error Interrupt */
-        if ( status & SCIF_ERRORS )
-            scif_writew(uart, SCIF_SCFSR, ~SCIF_ERRORS);
-        if ( scif_readw(uart, SCIF_SCLSR) & SCLSR_ORER )
-            scif_writew(uart, SCIF_SCLSR, 0);
+        if ( status & params->error_mask )
+            scif_writew(uart, params->status_reg, ~params->error_mask);
+        if ( params->overrun_reg != params->status_reg )
+        {
+            if ( scif_readw(uart, params->overrun_reg) & params->overrun_mask )
+                scif_writew(uart, params->overrun_reg, ~params->overrun_mask);
+        }
 
         ctrl = scif_readw(uart, SCIF_SCSCR);
-        status = scif_readw(uart, SCIF_SCFSR) & ~SCFSR_TEND;
+        status = scif_readw(uart, params->status_reg) & ~SCFSR_TEND;
         /* Ignore next flag if TX Interrupt is disabled */
         if ( !(ctrl & SCSCR_TIE) )
             status &= ~SCFSR_TDFE;
@@ -81,12 +134,13 @@ static void scif_uart_interrupt(int irq, void *data, struct cpu_user_regs *regs)
 static void __init scif_uart_init_preirq(struct serial_port *port)
 {
     struct scif_uart *uart = port->uart;
+    const struct port_params *params = uart->params;
 
     /*
      * Wait until last bit has been transmitted. This is needed for a smooth
      * transition when we come from early printk
      */
-    while ( !(scif_readw(uart, SCIF_SCFSR) & SCFSR_TEND) );
+    while ( !(scif_readw(uart, params->status_reg) & SCFSR_TEND) );
 
     /* Disable TX/RX parts and all interrupts */
     scif_writew(uart, SCIF_SCSCR, 0);
@@ -95,10 +149,10 @@ static void __init scif_uart_init_preirq(struct serial_port *port)
     scif_writew(uart, SCIF_SCFCR, SCFCR_RFRST | SCFCR_TFRST);
 
     /* Clear all errors and flags */
-    scif_readw(uart, SCIF_SCFSR);
-    scif_writew(uart, SCIF_SCFSR, 0);
-    scif_readw(uart, SCIF_SCLSR);
-    scif_writew(uart, SCIF_SCLSR, 0);
+    scif_readw(uart, params->status_reg);
+    scif_writew(uart, params->status_reg, 0);
+    scif_readw(uart, params->overrun_reg);
+    scif_writew(uart, params->overrun_reg, 0);
 
     /* Setup trigger level for TX/RX FIFOs */
     scif_writew(uart, SCIF_SCFCR, SCFCR_RTRG11 | SCFCR_TTRG11);
@@ -111,6 +165,7 @@ static void __init scif_uart_init_preirq(struct serial_port *port)
 static void __init scif_uart_init_postirq(struct serial_port *port)
 {
     struct scif_uart *uart = port->uart;
+    const struct port_params *params = uart->params;
     int rc;
 
     uart->irqaction.handler = scif_uart_interrupt;
@@ -122,14 +177,17 @@ static void __init scif_uart_init_postirq(struct serial_port *port)
                 uart->irq);
 
     /* Clear all errors */
-    if ( scif_readw(uart, SCIF_SCFSR) & SCIF_ERRORS )
-        scif_writew(uart, SCIF_SCFSR, ~SCIF_ERRORS);
-    if ( scif_readw(uart, SCIF_SCLSR) & SCLSR_ORER )
-        scif_writew(uart, SCIF_SCLSR, 0);
+    if ( scif_readw(uart, params->status_reg) & params->error_mask )
+        scif_writew(uart, params->status_reg, ~params->error_mask);
+    if ( params->overrun_reg != params->status_reg )
+    {
+        if ( scif_readw(uart, params->overrun_reg) & params->overrun_mask )
+            scif_writew(uart, params->overrun_reg, ~params->overrun_mask);
+    }
 
     /* Enable TX/RX and Error Interrupts  */
     scif_writew(uart, SCIF_SCSCR, scif_readw(uart, SCIF_SCSCR) |
-                 SCSCR_TIE | SCSCR_RIE | SCSCR_REIE);
+                params->irq_flags);
 }
 
 static void scif_uart_suspend(struct serial_port *port)
@@ -145,43 +203,47 @@ static void scif_uart_resume(struct serial_port *port)
 static int scif_uart_tx_ready(struct serial_port *port)
 {
     struct scif_uart *uart = port->uart;
+    const struct port_params *params = uart->params;
     uint16_t cnt;
 
     /* Check for empty space in TX FIFO */
-    if ( !(scif_readw(uart, SCIF_SCFSR) & SCFSR_TDFE) )
+    if ( !(scif_readw(uart, params->status_reg) & SCFSR_TDFE) )
         return 0;
 
      /* Check number of data bytes stored in TX FIFO */
     cnt = scif_readw(uart, SCIF_SCFDR) >> 8;
-    ASSERT( cnt >= 0 && cnt <= SCIF_FIFO_MAX_SIZE );
+    ASSERT( cnt >= 0 && cnt <= params->fifo_size );
 
-    return (SCIF_FIFO_MAX_SIZE - cnt);
+    return (params->fifo_size - cnt);
 }
 
 static void scif_uart_putc(struct serial_port *port, char c)
 {
     struct scif_uart *uart = port->uart;
+    const struct port_params *params = uart->params;
 
-    scif_writeb(uart, SCIF_SCFTDR, c);
+    scif_writeb(uart, params->tx_fifo_reg, c);
     /* Clear required TX flags */
-    scif_writew(uart, SCIF_SCFSR, scif_readw(uart, SCIF_SCFSR) &
-                 ~(SCFSR_TEND | SCFSR_TDFE));
+    scif_writew(uart, params->status_reg,
+                scif_readw(uart, params->status_reg) &
+                ~(SCFSR_TEND | SCFSR_TDFE));
 }
 
 static int scif_uart_getc(struct serial_port *port, char *pc)
 {
     struct scif_uart *uart = port->uart;
+    const struct port_params *params = uart->params;
 
     /* Check for available data bytes in RX FIFO */
-    if ( !(scif_readw(uart, SCIF_SCFSR) & (SCFSR_RDF | SCFSR_DR)) )
+    if ( !(scif_readw(uart, params->status_reg) & (SCFSR_RDF | SCFSR_DR)) )
         return 0;
 
-    *pc = scif_readb(uart, SCIF_SCFRDR);
+    *pc = scif_readb(uart, params->rx_fifo_reg);
 
     /* dummy read */
-    scif_readw(uart, SCIF_SCFSR);
+    scif_readw(uart, params->status_reg);
     /* Clear required RX flags */
-    scif_writew(uart, SCIF_SCFSR, ~(SCFSR_RDF | SCFSR_DR));
+    scif_writew(uart, params->status_reg, ~(SCFSR_RDF | SCFSR_DR));
 
     return 1;
 }
@@ -229,13 +291,22 @@ static struct uart_driver __read_mostly scif_uart_driver = {
     .vuart_info   = scif_vuart_info,
 };
 
+static const struct dt_device_match scif_uart_dt_match[] __initconst =
+{
+    { .compatible = "renesas,scif",  .data = (void *)SCIF_PORT },
+    { .compatible = "renesas,scifa", .data = (void *)SCIFA_PORT },
+    { /* sentinel */ },
+};
+
 static int __init scif_uart_init(struct dt_device_node *dev,
                                  const void *data)
 {
+    const struct dt_device_match *match;
     const char *config = data;
     struct scif_uart *uart;
     int res;
     u64 addr, size;
+    enum port_types port_type;
 
     if ( strcmp(config, "") )
         printk("WARNING: UART configuration is not supported\n");
@@ -265,10 +336,14 @@ static int __init scif_uart_init(struct dt_device_node *dev,
         return -ENOMEM;
     }
 
+    match = dt_match_node(scif_uart_dt_match, dev);
+    port_type = (enum port_types)match->data;
+    uart->params = &port_params[port_type];
+
     uart->vuart.base_addr  = addr;
     uart->vuart.size       = size;
-    uart->vuart.data_off   = SCIF_SCFTDR;
-    uart->vuart.status_off = SCIF_SCFSR;
+    uart->vuart.data_off   = uart->params->tx_fifo_reg;
+    uart->vuart.status_off = uart->params->status_reg;
     uart->vuart.status     = SCFSR_TDFE;
 
     /* Register with generic serial driver */
@@ -279,12 +354,6 @@ static int __init scif_uart_init(struct dt_device_node *dev,
     return 0;
 }
 
-static const struct dt_device_match scif_uart_dt_match[] __initconst =
-{
-    DT_MATCH_COMPATIBLE("renesas,scif"),
-    { /* sentinel */ },
-};
-
 DT_DEVICE_START(scif_uart, "SCIF UART", DEVICE_SERIAL)
     .dt_match = scif_uart_dt_match,
     .init = scif_uart_init,
diff --git a/xen/include/asm-arm/scif-uart.h b/xen/include/asm-arm/scif-uart.h
index 8137850..bce3404 100644
--- a/xen/include/asm-arm/scif-uart.h
+++ b/xen/include/asm-arm/scif-uart.h
@@ -2,7 +2,7 @@
  * xen/include/asm-arm/scif-uart.h
  *
  * Common constant definition between early printk and the UART driver
- * for the SCIF compatible UART.
+ * for the SCIF(A) compatible UART.
  *
  * Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
  * Copyright (C) 2014, Globallogic.
@@ -21,9 +21,7 @@
 #ifndef __ASM_ARM_SCIF_UART_H
 #define __ASM_ARM_SCIF_UART_H
 
-#define SCIF_FIFO_MAX_SIZE    16
-
-/* Register offsets */
+/* Register offsets (SCIF) */
 #define SCIF_SCSMR     (0x00)    /* Serial mode register           */
 #define SCIF_SCBRR     (0x04)    /* Bit rate register              */
 #define SCIF_SCSCR     (0x08)    /* Serial control register        */
@@ -57,8 +55,6 @@
 #define SCFSR_RDF     (1 << 1)    /* Receive FIFO Data Full */
 #define SCFSR_DR      (1 << 0)    /* Receive Data Ready */
 
-#define SCIF_ERRORS    (SCFSR_PER | SCFSR_FER | SCFSR_ER | SCFSR_BRK)
-
 /* Line Status Register (SCLSR) */
 #define SCLSR_TO      (1 << 2)    /* Timeout */
 #define SCLSR_ORER    (1 << 0)    /* Overrun Error */
@@ -83,6 +79,42 @@
 #define SCFCR_TTRG10    (SCFCR_TTRG1)
 #define SCFCR_TTRG11    (SCFCR_TTRG1 | SCFCR_TTRG0)
 
+/* Register offsets (SCIFA) */
+#define SCIFA_SCASMR     (0x00)    /* Serial mode register           */
+#define SCIFA_SCABRR     (0x04)    /* Bit rate register              */
+#define SCIFA_SCASCR     (0x08)    /* Serial control register        */
+#define SCIFA_SCATDSR    (0x0C)    /* Transmit data stop register    */
+#define SCIFA_SCAFER     (0x10)    /* FIFO error count register      */
+#define SCIFA_SCASSR     (0x14)    /* Serial status register         */
+#define SCIFA_SCAFCR     (0x18)    /* FIFO control register          */
+#define SCIFA_SCAFDR     (0x1C)    /* FIFO data count register       */
+#define SCIFA_SCAFTDR    (0x20)    /* Transmit FIFO data register    */
+#define SCIFA_SCAFRDR    (0x24)    /* Receive FIFO data register     */
+#define SCIFA_SCAPCR     (0x30)    /* Serial port control register   */
+#define SCIFA_SCAPDR     (0x34)    /* Serial port data register      */
+
+/* Serial Control Register (SCASCR) */
+#define SCASCR_ERIE     (1 << 10)    /* Receive Error Interrupt Enable */
+#define SCASCR_BRIE     (1 << 9)     /* Break Interrupt Enable */
+#define SCASCR_DRIE     (1 << 8)     /* Receive Data Ready Interrupt Enable */
+#define SCASCR_TIE      (1 << 7)     /* Transmit Interrupt Enable */
+#define SCASCR_RIE      (1 << 6)     /* Receive Interrupt Enable */
+#define SCASCR_TE       (1 << 5)     /* Transmit Enable */
+#define SCASCR_RE       (1 << 4)     /* Receive Enable */
+#define SCASCR_CKE0     (1 << 0)     /* Clock Enable 0 */
+
+/* Serial Status Register (SCASSR) */
+#define SCASSR_ORER    (1 << 9)    /* Overrun Error */
+#define SCASSR_TSF     (1 << 8)    /* Transmit Data Stop */
+#define SCASSR_ER      (1 << 7)    /* Receive Error */
+#define SCASSR_TEND    (1 << 6)    /* Transmission End */
+#define SCASSR_TDFE    (1 << 5)    /* Transmit FIFO Data Empty */
+#define SCASSR_BRK     (1 << 4)    /* Break Detect */
+#define SCASSR_FER     (1 << 3)    /* Framing Error */
+#define SCASSR_PER     (1 << 2)    /* Parity Error */
+#define SCASSR_RDF     (1 << 1)    /* Receive FIFO Data Full */
+#define SCASSR_DR      (1 << 0)    /* Receive Data Ready */
+
 #endif /* __ASM_ARM_SCIF_UART_H */
 
 /*
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [PATCH V2 2/3] xen/arm: Clarify usage of earlyprintk for Lager board
  2019-02-01 12:37 [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2) Oleksandr Tyshchenko
  2019-02-01 12:37 ` [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs Oleksandr Tyshchenko
@ 2019-02-01 12:37 ` Oleksandr Tyshchenko
  2019-02-18 14:01   ` Julien Grall
  2019-02-01 12:37 ` [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk Oleksandr Tyshchenko
  2019-02-15 13:21 ` [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2) Oleksandr
  3 siblings, 1 reply; 22+ messages in thread
From: Oleksandr Tyshchenko @ 2019-02-01 12:37 UTC (permalink / raw)
  To: xen-devel; +Cc: Oleksandr Tyshchenko, Julien Grall, Stefano Stabellini

From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

Current sentence is not entirely correct. Since SCIF0 interface is
applicable for Lager board, but is not applicable for all R-Car H2
based boards. For example, Stout board uses SCIFA0 interface.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
---
 docs/misc/arm/early-printk.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt
index f765f59..b23c54f 100644
--- a/docs/misc/arm/early-printk.txt
+++ b/docs/misc/arm/early-printk.txt
@@ -39,7 +39,7 @@ the name of the machine:
   - fastmodel: printk on ARM Fastmodel software emulators
   - hikey960: printk with pl011 with Hikey 960
   - juno: printk with pl011 on Juno platform
-  - lager: printk with SCIF0 on Renesas R-Car H2 processors
+  - lager: printk with SCIF0 on Renesas Lager board (R-Car H2 processor)
   - midway: printk with the pl011 on Calxeda Midway processors
   - mvebu: printk with the MVEBU for Marvell Armada 3700 SoCs
   - omap5432: printk with UART3 on TI OMAP5432 processors
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-01 12:37 [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2) Oleksandr Tyshchenko
  2019-02-01 12:37 ` [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs Oleksandr Tyshchenko
  2019-02-01 12:37 ` [PATCH V2 2/3] xen/arm: Clarify usage of earlyprintk for Lager board Oleksandr Tyshchenko
@ 2019-02-01 12:37 ` Oleksandr Tyshchenko
  2019-02-18 14:05   ` Julien Grall
  2019-02-15 13:21 ` [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2) Oleksandr
  3 siblings, 1 reply; 22+ messages in thread
From: Oleksandr Tyshchenko @ 2019-02-01 12:37 UTC (permalink / raw)
  To: xen-devel; +Cc: Oleksandr Tyshchenko, Julien Grall, Stefano Stabellini

From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

Add support for Renesas "Stout" development board based on
R-Car H2 SoC which has SCIFA compatible UART.

Actually existing SCIF UART support (debug-scif.inc) and
newly added SCIFA UART support (debug-scifa.inc) differ only
in registers offsets.

Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

---
    Changes in v2:
        - Move clarification regarding Lager board to separate patch
        - Drop changes in early-printk.txt and Rules.mk, earlyprink
          usage for Stout board should be documented on a Xen wiki
---
 xen/arch/arm/arm32/debug-scifa.inc | 51 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 xen/arch/arm/arm32/debug-scifa.inc

diff --git a/xen/arch/arm/arm32/debug-scifa.inc b/xen/arch/arm/arm32/debug-scifa.inc
new file mode 100644
index 0000000..b5e60db
--- /dev/null
+++ b/xen/arch/arm/arm32/debug-scifa.inc
@@ -0,0 +1,51 @@
+/*
+ * xen/arch/arm/arm32/debug-scifa.inc
+ *
+ * SCIFA specific debug code
+ *
+ * Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
+ * Copyright (C) 2018 EPAM Systems Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <asm/scif-uart.h>
+
+/*
+ * SCIFA UART wait UART to be ready to transmit
+ * rb: register which contains the UART base address
+ * rc: scratch register
+ */
+.macro early_uart_ready rb rc
+1:
+        ldrh   \rc, [\rb, #SCIFA_SCASSR]   /* <- SCASSR (status register) */
+        tst    \rc, #SCASSR_TDFE           /* Check TDFE bit */
+        beq    1b                          /* Wait for the UART to be ready */
+.endm
+
+/*
+ * SCIFA UART transmit character
+ * rb: register which contains the UART base address
+ * rt: register which contains the character to transmit
+ */
+.macro early_uart_transmit rb rt
+        strb   \rt, [\rb, #SCIFA_SCAFTDR]                  /* -> SCAFTDR (data register) */
+        ldrh   \rt, [\rb, #SCIFA_SCASSR]                   /* <- SCASSR (status register) */
+        and    \rt, \rt, #(~(SCASSR_TEND | SCASSR_TDFE))   /* Clear TEND and TDFE bits */
+        strh   \rt, [\rb, #SCIFA_SCASSR]                   /* -> SCASSR (status register) */
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2)
  2019-02-01 12:37 [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2) Oleksandr Tyshchenko
                   ` (2 preceding siblings ...)
  2019-02-01 12:37 ` [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk Oleksandr Tyshchenko
@ 2019-02-15 13:21 ` Oleksandr
  2019-02-15 13:30   ` Julien Grall
  3 siblings, 1 reply; 22+ messages in thread
From: Oleksandr @ 2019-02-15 13:21 UTC (permalink / raw)
  To: xen-devel; +Cc: Oleksandr Tyshchenko, Julien Grall, Stefano Stabellini


On 01.02.19 14:37, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>
> Hi, all.


Hi, all

gentle reminder...


>
> The purpose of this patch series is to add required support to be able to run
> Xen on Renesas Stout board [1] which uses SCIFA compatible UART as a console
> interface.
>
> Actually Xen already has support for SCIF compatible UARTs which are used on
> Renesas Lager (R-Car Gen2), Salvator-X, H3ULCB/M3ULCB (R-Car Gen3) and other
> development boards. So this patch series extends existing support to be able
> to handle both interfaces.
>
> ----------
>
> Current patch series is based on the following commit 3389a8dc8c5753a3c84744923cd0193395e3f2a9
> and tested on Stout (ARM32) and H3ULCB (ARM64) boards.
>
> You can find current patch series here:
> repo: https://github.com/otyshchenko1/xen.git branch: stout_upstream
>
> You can find previous discussion here:
> https://www.mail-archive.com/xen-devel@lists.xenproject.org/msg21058.html
>
> Please note, that current patch series doesn’t have the following patches:
> - xen/arm: drivers: scif: Remove unused #define-s (already upstreamed)
> - xen/arm: Reuse R-Car Gen2 platform code for Stout board (was dropped)
> but has new one:
> - xen/arm: Clarify usage of earlyprintk for Lager board
>
> ----------
>
> In order to run Xen on Stout board you need "PSCI-enabled" U-Boot (not upsteamed yet).
> You can find corresponding patches for U-Boot here:
> http://u-boot.10912.n7.nabble.com/PATCH-0-3-PSCI-support-for-r8a7790-SoC-Lager-Stout-boards-td357352.html
>
> Have a plan to update Xen Wiki regarding this board.
>
> [1] https://elinux.org/R-Car/Boards/Stout
>
> ----------
>
> Oleksandr Tyshchenko (3):
>    xen/arm: drivers: scif: Add support for SCIFA compatible UARTs
>    xen/arm: Clarify usage of earlyprintk for Lager board
>    xen/arm: Add SCIFA UART support for early printk
>
>   docs/misc/arm/early-printk.txt     |   2 +-
>   xen/arch/arm/arm32/debug-scifa.inc |  51 ++++++++++++++
>   xen/drivers/char/scif-uart.c       | 139 +++++++++++++++++++++++++++----------
>   xen/include/asm-arm/scif-uart.h    |  44 ++++++++++--
>   4 files changed, 194 insertions(+), 42 deletions(-)
>   create mode 100644 xen/arch/arm/arm32/debug-scifa.inc
>
-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2)
  2019-02-15 13:21 ` [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2) Oleksandr
@ 2019-02-15 13:30   ` Julien Grall
  2019-02-15 13:39     ` Oleksandr
  0 siblings, 1 reply; 22+ messages in thread
From: Julien Grall @ 2019-02-15 13:30 UTC (permalink / raw)
  To: Oleksandr
  Cc: Oleksandr Tyshchenko, Julien Grall, Stefano Stabellini, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 2944 bytes --]

On Fri, 15 Feb 2019, 14:25 Oleksandr, <olekstysh@gmail.com> wrote:

>
> On 01.02.19 14:37, Oleksandr Tyshchenko wrote:
> > From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> >
> > Hi, all.
>
>
> Hi, all
>
> gentle reminder...
>

This is in my queue of patches to review. Also, as we are in freeze, I tend
to prioritize patches for 4.12.

I will try to have a look next week.

Cheers,


>
> >
> > The purpose of this patch series is to add required support to be able
> to run
> > Xen on Renesas Stout board [1] which uses SCIFA compatible UART as a
> console
> > interface.
> >
> > Actually Xen already has support for SCIF compatible UARTs which are
> used on
> > Renesas Lager (R-Car Gen2), Salvator-X, H3ULCB/M3ULCB (R-Car Gen3) and
> other
> > development boards. So this patch series extends existing support to be
> able
> > to handle both interfaces.
> >
> > ----------
> >
> > Current patch series is based on the following commit
> 3389a8dc8c5753a3c84744923cd0193395e3f2a9
> > and tested on Stout (ARM32) and H3ULCB (ARM64) boards.
> >
> > You can find current patch series here:
> > repo: https://github.com/otyshchenko1/xen.git branch: stout_upstream
> >
> > You can find previous discussion here:
> >
> https://www.mail-archive.com/xen-devel@lists.xenproject.org/msg21058.html
> >
> > Please note, that current patch series doesn’t have the following
> patches:
> > - xen/arm: drivers: scif: Remove unused #define-s (already upstreamed)
> > - xen/arm: Reuse R-Car Gen2 platform code for Stout board (was dropped)
> > but has new one:
> > - xen/arm: Clarify usage of earlyprintk for Lager board
> >
> > ----------
> >
> > In order to run Xen on Stout board you need "PSCI-enabled" U-Boot (not
> upsteamed yet).
> > You can find corresponding patches for U-Boot here:
> >
> http://u-boot.10912.n7.nabble.com/PATCH-0-3-PSCI-support-for-r8a7790-SoC-Lager-Stout-boards-td357352.html
> >
> > Have a plan to update Xen Wiki regarding this board.
> >
> > [1] https://elinux.org/R-Car/Boards/Stout
> >
> > ----------
> >
> > Oleksandr Tyshchenko (3):
> >    xen/arm: drivers: scif: Add support for SCIFA compatible UARTs
> >    xen/arm: Clarify usage of earlyprintk for Lager board
> >    xen/arm: Add SCIFA UART support for early printk
> >
> >   docs/misc/arm/early-printk.txt     |   2 +-
> >   xen/arch/arm/arm32/debug-scifa.inc |  51 ++++++++++++++
> >   xen/drivers/char/scif-uart.c       | 139
> +++++++++++++++++++++++++++----------
> >   xen/include/asm-arm/scif-uart.h    |  44 ++++++++++--
> >   4 files changed, 194 insertions(+), 42 deletions(-)
> >   create mode 100644 xen/arch/arm/arm32/debug-scifa.inc
> >
> --
> Regards,
>
> Oleksandr Tyshchenko
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel

[-- Attachment #1.2: Type: text/html, Size: 4400 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2)
  2019-02-15 13:30   ` Julien Grall
@ 2019-02-15 13:39     ` Oleksandr
  0 siblings, 0 replies; 22+ messages in thread
From: Oleksandr @ 2019-02-15 13:39 UTC (permalink / raw)
  To: Julien Grall
  Cc: Oleksandr Tyshchenko, Julien Grall, Stefano Stabellini, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 3451 bytes --]


On 15.02.19 15:30, Julien Grall wrote:

Hi, Julien

>
>
> On Fri, 15 Feb 2019, 14:25 Oleksandr, <olekstysh@gmail.com 
> <mailto:olekstysh@gmail.com>> wrote:
>
>
>     On 01.02.19 14:37, Oleksandr Tyshchenko wrote:
>     > From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com
>     <mailto:oleksandr_tyshchenko@epam.com>>
>     >
>     > Hi, all.
>
>
>     Hi, all
>
>     gentle reminder...
>
>
> This is in my queue of patches to review. Also, as we are in freeze, I 
> tend to prioritize patches for 4.12.
>
> I will try to have a look next week.


I understand. Thank you.


>
> Cheers,
>
>
>
>     >
>     > The purpose of this patch series is to add required support to
>     be able to run
>     > Xen on Renesas Stout board [1] which uses SCIFA compatible UART
>     as a console
>     > interface.
>     >
>     > Actually Xen already has support for SCIF compatible UARTs which
>     are used on
>     > Renesas Lager (R-Car Gen2), Salvator-X, H3ULCB/M3ULCB (R-Car
>     Gen3) and other
>     > development boards. So this patch series extends existing
>     support to be able
>     > to handle both interfaces.
>     >
>     > ----------
>     >
>     > Current patch series is based on the following commit
>     3389a8dc8c5753a3c84744923cd0193395e3f2a9
>     > and tested on Stout (ARM32) and H3ULCB (ARM64) boards.
>     >
>     > You can find current patch series here:
>     > repo: https://github.com/otyshchenko1/xen.git branch: stout_upstream
>     >
>     > You can find previous discussion here:
>     >
>     https://www.mail-archive.com/xen-devel@lists.xenproject.org/msg21058.html
>     >
>     > Please note, that current patch series doesn’t have the
>     following patches:
>     > - xen/arm: drivers: scif: Remove unused #define-s (already
>     upstreamed)
>     > - xen/arm: Reuse R-Car Gen2 platform code for Stout board (was
>     dropped)
>     > but has new one:
>     > - xen/arm: Clarify usage of earlyprintk for Lager board
>     >
>     > ----------
>     >
>     > In order to run Xen on Stout board you need "PSCI-enabled"
>     U-Boot (not upsteamed yet).
>     > You can find corresponding patches for U-Boot here:
>     >
>     http://u-boot.10912.n7.nabble.com/PATCH-0-3-PSCI-support-for-r8a7790-SoC-Lager-Stout-boards-td357352.html
>     >
>     > Have a plan to update Xen Wiki regarding this board.
>     >
>     > [1] https://elinux.org/R-Car/Boards/Stout
>     >
>     > ----------
>     >
>     > Oleksandr Tyshchenko (3):
>     >    xen/arm: drivers: scif: Add support for SCIFA compatible UARTs
>     >    xen/arm: Clarify usage of earlyprintk for Lager board
>     >    xen/arm: Add SCIFA UART support for early printk
>     >
>     >   docs/misc/arm/early-printk.txt     |   2 +-
>     >   xen/arch/arm/arm32/debug-scifa.inc |  51 ++++++++++++++
>     >   xen/drivers/char/scif-uart.c       | 139
>     +++++++++++++++++++++++++++----------
>     >   xen/include/asm-arm/scif-uart.h    |  44 ++++++++++--
>     >   4 files changed, 194 insertions(+), 42 deletions(-)
>     >   create mode 100644 xen/arch/arm/arm32/debug-scifa.inc
>     >
>     -- 
>     Regards,
>
>     Oleksandr Tyshchenko
>
>
>     _______________________________________________
>     Xen-devel mailing list
>     Xen-devel@lists.xenproject.org <mailto:Xen-devel@lists.xenproject.org>
>     https://lists.xenproject.org/mailman/listinfo/xen-devel
>
-- 
Regards,

Oleksandr Tyshchenko


[-- Attachment #1.2: Type: text/html, Size: 6579 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs
  2019-02-01 12:37 ` [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs Oleksandr Tyshchenko
@ 2019-02-18 14:00   ` Julien Grall
  2019-02-18 20:14     ` Oleksandr
  0 siblings, 1 reply; 22+ messages in thread
From: Julien Grall @ 2019-02-18 14:00 UTC (permalink / raw)
  To: Oleksandr Tyshchenko, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini

Hi,

On 01/02/2019 12:37, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> 
> Extend existing driver to be able to handle SCIFA interface as well.

In general a patch should do only one thing. In this case, this should have been 
split in 2 patches: one to extend the driver, the second to add support for SCIFA.

Please split the patch accordingly.

> SCIF and SCIFA have lot in common, though SCIFA has different
> offsets and bits for some registers.
> 
> The "data" field in struct dt_device_match is used for recognizing
> what interface is present on a target board.
> 
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> 
> ---
>      Changes in v2:
>          - Name a enum for describing interfaces this driver supports
>          - Use local variable for "params" where appropriate
>          - Use "data" field in struct dt_device_match instead of calling
>            dt_device_is_compatible()
>          - Don't check for "overrun_reg != status_reg" condition during
>            initialization
> ---
>   xen/drivers/char/scif-uart.c    | 139 ++++++++++++++++++++++++++++++----------
>   xen/include/asm-arm/scif-uart.h |  44 +++++++++++--
>   2 files changed, 142 insertions(+), 41 deletions(-)
> +static const struct dt_device_match scif_uart_dt_match[] __initconst =
> +{
> +    { .compatible = "renesas,scif",  .data = (void *)SCIF_PORT },
> +    { .compatible = "renesas,scifa", .data = (void *)SCIFA_PORT },

The port_type is pretty much only used in scif_uart_init. So how about passing a 
pointer to the structure directly?

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 2/3] xen/arm: Clarify usage of earlyprintk for Lager board
  2019-02-01 12:37 ` [PATCH V2 2/3] xen/arm: Clarify usage of earlyprintk for Lager board Oleksandr Tyshchenko
@ 2019-02-18 14:01   ` Julien Grall
  0 siblings, 0 replies; 22+ messages in thread
From: Julien Grall @ 2019-02-18 14:01 UTC (permalink / raw)
  To: Oleksandr Tyshchenko, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini

Hi,

On 01/02/2019 12:37, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> 
> Current sentence is not entirely correct. Since SCIF0 interface is
> applicable for Lager board, but is not applicable for all R-Car H2
> based boards. For example, Stout board uses SCIFA0 interface.
> 
> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>

Acked-by: Julien Grall <julien.grall@arm.com>

> ---
>   docs/misc/arm/early-printk.txt | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt
> index f765f59..b23c54f 100644
> --- a/docs/misc/arm/early-printk.txt
> +++ b/docs/misc/arm/early-printk.txt
> @@ -39,7 +39,7 @@ the name of the machine:
>     - fastmodel: printk on ARM Fastmodel software emulators
>     - hikey960: printk with pl011 with Hikey 960
>     - juno: printk with pl011 on Juno platform
> -  - lager: printk with SCIF0 on Renesas R-Car H2 processors
> +  - lager: printk with SCIF0 on Renesas Lager board (R-Car H2 processor)
>     - midway: printk with the pl011 on Calxeda Midway processors
>     - mvebu: printk with the MVEBU for Marvell Armada 3700 SoCs
>     - omap5432: printk with UART3 on TI OMAP5432 processors
> 

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-01 12:37 ` [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk Oleksandr Tyshchenko
@ 2019-02-18 14:05   ` Julien Grall
  2019-02-18 20:41     ` Oleksandr
  0 siblings, 1 reply; 22+ messages in thread
From: Julien Grall @ 2019-02-18 14:05 UTC (permalink / raw)
  To: Oleksandr Tyshchenko, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini

Hi,

On 01/02/2019 12:37, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> 
> Add support for Renesas "Stout" development board based on
> R-Car H2 SoC which has SCIFA compatible UART.
> 
> Actually existing SCIF UART support (debug-scif.inc) and
> newly added SCIFA UART support (debug-scifa.inc) differ only
> in registers offsets.

Can we try to merge the two then? One solution is to provide another options 
similar to how we deal with REG_SHIFT on the 8250.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs
  2019-02-18 14:00   ` Julien Grall
@ 2019-02-18 20:14     ` Oleksandr
  2019-02-19 10:00       ` Julien Grall
  0 siblings, 1 reply; 22+ messages in thread
From: Oleksandr @ 2019-02-18 20:14 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini


On 18.02.19 16:00, Julien Grall wrote:
> Hi,

Hi


>
> On 01/02/2019 12:37, Oleksandr Tyshchenko wrote:
>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>
>> Extend existing driver to be able to handle SCIFA interface as well.
>
> In general a patch should do only one thing. In this case, this should 
> have been split in 2 patches: one to extend the driver, the second to 
> add support for SCIFA.
>
> Please split the patch accordingly.


Not entirely clear to me how the current patch should be split...

- The first patch will be just a copy of the current patch, but without 
new compatible string (SCIFA).

- The second patch will add new compatible string.

Did I get your point correctly?


>
>> SCIF and SCIFA have lot in common, though SCIFA has different
>> offsets and bits for some registers.
>>
>> The "data" field in struct dt_device_match is used for recognizing
>> what interface is present on a target board.
>>
>> Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>
>> ---
>>      Changes in v2:
>>          - Name a enum for describing interfaces this driver supports
>>          - Use local variable for "params" where appropriate
>>          - Use "data" field in struct dt_device_match instead of calling
>>            dt_device_is_compatible()
>>          - Don't check for "overrun_reg != status_reg" condition during
>>            initialization
>> ---
>>   xen/drivers/char/scif-uart.c    | 139 
>> ++++++++++++++++++++++++++++++----------
>>   xen/include/asm-arm/scif-uart.h |  44 +++++++++++--
>>   2 files changed, 142 insertions(+), 41 deletions(-)
>> +static const struct dt_device_match scif_uart_dt_match[] __initconst =
>> +{
>> +    { .compatible = "renesas,scif",  .data = (void *)SCIF_PORT },
>> +    { .compatible = "renesas,scifa", .data = (void *)SCIFA_PORT },
>
> The port_type is pretty much only used in scif_uart_init. So how about 
> passing a pointer to the structure directly?

Agree. Will do.


>
> Cheers,
>
-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-18 14:05   ` Julien Grall
@ 2019-02-18 20:41     ` Oleksandr
  2019-02-18 20:45       ` Oleksandr
  0 siblings, 1 reply; 22+ messages in thread
From: Oleksandr @ 2019-02-18 20:41 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini


On 18.02.19 16:05, Julien Grall wrote:
> Hi,


Hi


>
> On 01/02/2019 12:37, Oleksandr Tyshchenko wrote:
>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>
>> Add support for Renesas "Stout" development board based on
>> R-Car H2 SoC which has SCIFA compatible UART.
>>
>> Actually existing SCIF UART support (debug-scif.inc) and
>> newly added SCIFA UART support (debug-scifa.inc) differ only
>> in registers offsets.
>
> Can we try to merge the two then? One solution is to provide another 
> options similar to how we deal with REG_SHIFT on the 8250.


Actually, the main difference for the "early printk" support is in two 
reg offsets:

+#define SCIFA_SCASSR   0x14    /* Serial status register */
+#define SCIFA_SCAFTDR  0x20    /* Transmit FIFO data register */

+#define SCIF_SCFSR             0x10    /* Serial status register */
+#define SCIF_SCFTDR            0x0c    /* Transmit FIFO data register */


I am not mistaken, we will have to introduce two options to cover this 
case, as the offsets are not correlated with each other, no?


>
> Cheers,
>
-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-18 20:41     ` Oleksandr
@ 2019-02-18 20:45       ` Oleksandr
  2019-02-19 10:09         ` Julien Grall
  0 siblings, 1 reply; 22+ messages in thread
From: Oleksandr @ 2019-02-18 20:45 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini


On 18.02.19 22:41, Oleksandr wrote:
>
> On 18.02.19 16:05, Julien Grall wrote:
>> Hi,
>
>
> Hi
>
>
>>
>> On 01/02/2019 12:37, Oleksandr Tyshchenko wrote:
>>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>>
>>> Add support for Renesas "Stout" development board based on
>>> R-Car H2 SoC which has SCIFA compatible UART.
>>>
>>> Actually existing SCIF UART support (debug-scif.inc) and
>>> newly added SCIFA UART support (debug-scifa.inc) differ only
>>> in registers offsets.
>>
>> Can we try to merge the two then? One solution is to provide another 
>> options similar to how we deal with REG_SHIFT on the 8250.
>
>
> Actually, the main difference for the "early printk" support is in two 
> reg offsets:
>
> +#define SCIFA_SCASSR   0x14    /* Serial status register */
> +#define SCIFA_SCAFTDR  0x20    /* Transmit FIFO data register */
>
> +#define SCIF_SCFSR             0x10    /* Serial status register */
> +#define SCIF_SCFTDR            0x0c    /* Transmit FIFO data register */
>
>
> I am not mistaken, we will have to introduce two options to cover this 
> case, as the offsets are not correlated with each other, no?

Sorry, it should read as:

*If* I am not mistaken ...


>
>
>>
>> Cheers,
>>
-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs
  2019-02-18 20:14     ` Oleksandr
@ 2019-02-19 10:00       ` Julien Grall
  2019-02-20 17:11         ` Oleksandr
  0 siblings, 1 reply; 22+ messages in thread
From: Julien Grall @ 2019-02-19 10:00 UTC (permalink / raw)
  To: Oleksandr, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini

Hi Oleksandr,

On 2/18/19 8:14 PM, Oleksandr wrote:
> 
> On 18.02.19 16:00, Julien Grall wrote:
>> Hi,
> 
> Hi
> 
> 
>>
>> On 01/02/2019 12:37, Oleksandr Tyshchenko wrote:
>>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>>
>>> Extend existing driver to be able to handle SCIFA interface as well.
>>
>> In general a patch should do only one thing. In this case, this should 
>> have been split in 2 patches: one to extend the driver, the second to 
>> add support for SCIFA.
>>
>> Please split the patch accordingly.
> 
> 
> Not entirely clear to me how the current patch should be split...
> 
> - The first patch will be just a copy of the current patch, but without 
> new compatible string (SCIFA).

Without anything related to SCIFA. This patch would only contain the 
rework of the code.

> 
> - The second patch will add new compatible string.

+ anything related to SCIFA (Macros and the SCIFA element in the array 
port_params.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-18 20:45       ` Oleksandr
@ 2019-02-19 10:09         ` Julien Grall
  2019-02-20 18:03           ` Oleksandr
  0 siblings, 1 reply; 22+ messages in thread
From: Julien Grall @ 2019-02-19 10:09 UTC (permalink / raw)
  To: Oleksandr, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini

Hi Oleksandr,

On 2/18/19 8:45 PM, Oleksandr wrote:
> 
> On 18.02.19 22:41, Oleksandr wrote:
>>
>> On 18.02.19 16:05, Julien Grall wrote:
>>> Hi,
>>
>>
>> Hi
>>
>>
>>>
>>> On 01/02/2019 12:37, Oleksandr Tyshchenko wrote:
>>>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>>>
>>>> Add support for Renesas "Stout" development board based on
>>>> R-Car H2 SoC which has SCIFA compatible UART.
>>>>
>>>> Actually existing SCIF UART support (debug-scif.inc) and
>>>> newly added SCIFA UART support (debug-scifa.inc) differ only
>>>> in registers offsets.
>>>
>>> Can we try to merge the two then? One solution is to provide another 
>>> options similar to how we deal with REG_SHIFT on the 8250.
>>
>>
>> Actually, the main difference for the "early printk" support is in two 
>> reg offsets:
>>
>> +#define SCIFA_SCASSR   0x14    /* Serial status register */
>> +#define SCIFA_SCAFTDR  0x20    /* Transmit FIFO data register */
>>
>> +#define SCIF_SCFSR             0x10    /* Serial status register */
>> +#define SCIF_SCFTDR            0x0c    /* Transmit FIFO data register */
>>
>>
>> I am not mistaken, we will have to introduce two options to cover this 
>> case, as the offsets are not correlated with each other, no?

You don't need two options. For instance, you can only introduce an 
option SCIF_VERSION that would be 0 for SCIF and 61 (ascii 'a') for SCIFA.

Then in the code, you can use SCIF_VERSION to decides which sets of 
macros you are using.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs
  2019-02-19 10:00       ` Julien Grall
@ 2019-02-20 17:11         ` Oleksandr
  0 siblings, 0 replies; 22+ messages in thread
From: Oleksandr @ 2019-02-20 17:11 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini


On 19.02.19 12:00, Julien Grall wrote:
> Hi Oleksandr,
>
> On 2/18/19 8:14 PM, Oleksandr wrote:
>>
>> On 18.02.19 16:00, Julien Grall wrote:
>>> Hi,
>>
>> Hi

Hi Julien


>>
>>
>>>
>>> On 01/02/2019 12:37, Oleksandr Tyshchenko wrote:
>>>> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
>>>>
>>>> Extend existing driver to be able to handle SCIFA interface as well.
>>>
>>> In general a patch should do only one thing. In this case, this 
>>> should have been split in 2 patches: one to extend the driver, the 
>>> second to add support for SCIFA.
>>>
>>> Please split the patch accordingly.
>>
>>
>> Not entirely clear to me how the current patch should be split...
>>
>> - The first patch will be just a copy of the current patch, but 
>> without new compatible string (SCIFA).
>
> Without anything related to SCIFA. This patch would only contain the 
> rework of the code.
>
>>
>> - The second patch will add new compatible string.
>
> + anything related to SCIFA (Macros and the SCIFA element in the array 
> port_params.


It is clear now. Will do.


>
> Cheers,
>
-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-19 10:09         ` Julien Grall
@ 2019-02-20 18:03           ` Oleksandr
  2019-02-21 18:22             ` Oleksandr
  0 siblings, 1 reply; 22+ messages in thread
From: Oleksandr @ 2019-02-20 18:03 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini


On 19.02.19 12:09, Julien Grall wrote:
> Hi Oleksandr,

Hi Julien


>>>
>>> Actually, the main difference for the "early printk" support is in 
>>> two reg offsets:
>>>
>>> +#define SCIFA_SCASSR   0x14    /* Serial status register */
>>> +#define SCIFA_SCAFTDR  0x20    /* Transmit FIFO data register */
>>>
>>> +#define SCIF_SCFSR             0x10    /* Serial status register */
>>> +#define SCIF_SCFTDR            0x0c    /* Transmit FIFO data 
>>> register */
>>>
>>>
>>> I am not mistaken, we will have to introduce two options to cover 
>>> this case, as the offsets are not correlated with each other, no?
>
> You don't need two options. For instance, you can only introduce an 
> option SCIF_VERSION that would be 0 for SCIF and 61 (ascii 'a') for 
> SCIFA.
>
> Then in the code, you can use SCIF_VERSION to decides which sets of 
> macros you are using.

I think I understand the idea. Will try.


-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-20 18:03           ` Oleksandr
@ 2019-02-21 18:22             ` Oleksandr
  2019-02-21 18:43               ` Julien Grall
  0 siblings, 1 reply; 22+ messages in thread
From: Oleksandr @ 2019-02-21 18:22 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini

Hi Julien

>>>> Actually, the main difference for the "early printk" support is in 
>>>> two reg offsets:
>>>>
>>>> +#define SCIFA_SCASSR   0x14    /* Serial status register */
>>>> +#define SCIFA_SCAFTDR  0x20    /* Transmit FIFO data register */
>>>>
>>>> +#define SCIF_SCFSR             0x10    /* Serial status register */
>>>> +#define SCIF_SCFTDR            0x0c    /* Transmit FIFO data 
>>>> register */
>>>>
>>>>
>>>> I am not mistaken, we will have to introduce two options to cover 
>>>> this case, as the offsets are not correlated with each other, no?
>>
>> You don't need two options. For instance, you can only introduce an 
>> option SCIF_VERSION that would be 0 for SCIF and 61 (ascii 'a') for 
>> SCIFA.
>>
>> Then in the code, you can use SCIF_VERSION to decides which sets of 
>> macros you are using.
>
> I think I understand the idea. Will try.


Is it something you would like to see?

[Sorry for formatting]


---
  xen/arch/arm/Rules.mk             |  7 +++++++
  xen/arch/arm/arm32/debug-scif.inc | 22 +++++++++++++++-------
  2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index f264592..b29bd60 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -69,6 +69,12 @@ EARLY_PRINTK_BAUD := $(word 3,$(EARLY_PRINTK_CFG))
  endif
  endif

+# For the debug-scif.inc to recognize which UART offsets to apply
+ifeq ($(EARLY_PRINTK_INC),scifa)
+EARLY_PRINTK_SCIFA_OPTION := y
+EARLY_PRINTK_INC := scif
+endif
+
  ifneq ($(EARLY_PRINTK_INC),)
  EARLY_PRINTK := y
  endif
@@ -79,6 +85,7 @@ CFLAGS-$(EARLY_PRINTK) += 
-DEARLY_PRINTK_INC=\"debug-$(EARLY_PRINTK_INC).inc\"
  CFLAGS-$(EARLY_PRINTK) += -DEARLY_PRINTK_BAUD=$(EARLY_PRINTK_BAUD)
  CFLAGS-$(EARLY_PRINTK) += 
-DEARLY_UART_BASE_ADDRESS=$(EARLY_UART_BASE_ADDRESS)
  CFLAGS-$(EARLY_PRINTK) += -DEARLY_UART_REG_SHIFT=$(EARLY_UART_REG_SHIFT)
+CFLAGS-$(EARLY_PRINTK_SCIFA_OPTION) += -DEARLY_PRINTK_SCIFA_OPTION

  else # !CONFIG_DEBUG

diff --git a/xen/arch/arm/arm32/debug-scif.inc 
b/xen/arch/arm/arm32/debug-scif.inc
index 143f05d..49df616 100644
--- a/xen/arch/arm/arm32/debug-scif.inc
+++ b/xen/arch/arm/arm32/debug-scif.inc
@@ -1,7 +1,7 @@
  /*
   * xen/arch/arm/arm32/debug-scif.inc
   *
- * SCIF specific debug code
+ * SCIF(A) specific debug code
   *
   * Oleksandr Tyshchenko <oleksandr.tyshchenko@globallogic.com>
   * Copyright (C) 2014, Globallogic.
@@ -19,28 +19,36 @@

  #include <asm/scif-uart.h>

+#ifdef EARLY_PRINTK_SCIFA_OPTION
+#define STATUS_REG    SCIFA_SCASSR
+#define TX_FIFO_REG   SCIFA_SCAFTDR
+#else
+#define STATUS_REG    SCIF_SCFSR
+#define TX_FIFO_REG   SCIF_SCFTDR
+#endif
+
  /*
- * SCIF UART wait UART to be ready to transmit
+ * SCIF(A) UART wait UART to be ready to transmit
   * rb: register which contains the UART base address
   * rc: scratch register
   */
  .macro early_uart_ready rb rc
  1:
-        ldrh   \rc, [\rb, #SCIF_SCFSR]   /* <- SCFSR (status register) */
+        ldrh   \rc, [\rb, #STATUS_REG]   /* Read status register */
          tst    \rc, #SCFSR_TDFE          /* Check TDFE bit */
          beq    1b                        /* Wait for the UART to be 
ready */
  .endm

  /*
- * SCIF UART transmit character
+ * SCIF(A) UART transmit character
   * rb: register which contains the UART base address
   * rt: register which contains the character to transmit
   */
  .macro early_uart_transmit rb rt
-        strb   \rt, [\rb, #SCIF_SCFTDR]                  /* -> SCFTDR 
(data register) */
-        ldrh   \rt, [\rb, #SCIF_SCFSR]                   /* <- SCFSR 
(status register) */
+        strb   \rt, [\rb, #TX_FIFO_REG]                  /* Write data 
register */
+        ldrh   \rt, [\rb, #STATUS_REG]                   /* Read status 
register */
          and    \rt, \rt, #(~(SCFSR_TEND | SCFSR_TDFE))   /* Clear TEND 
and TDFE bits */
-        strh   \rt, [\rb, #SCIF_SCFSR]                   /* -> SCFSR 
(status register) */
+        strh   \rt, [\rb, #STATUS_REG]                   /* Write 
status register */
  .endm

  /*
-- 
2.7.4


>
>
-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-21 18:22             ` Oleksandr
@ 2019-02-21 18:43               ` Julien Grall
  2019-02-21 18:53                 ` Oleksandr
  0 siblings, 1 reply; 22+ messages in thread
From: Julien Grall @ 2019-02-21 18:43 UTC (permalink / raw)
  To: Oleksandr, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini

Hi Oleksandr,

On 2/21/19 6:22 PM, Oleksandr wrote:
=>>>>> Actually, the main difference for the "early printk" support is in
>>>>> two reg offsets:
>>>>>
>>>>> +#define SCIFA_SCASSR   0x14    /* Serial status register */
>>>>> +#define SCIFA_SCAFTDR  0x20    /* Transmit FIFO data register */
>>>>>
>>>>> +#define SCIF_SCFSR             0x10    /* Serial status register */
>>>>> +#define SCIF_SCFTDR            0x0c    /* Transmit FIFO data 
>>>>> register */
>>>>>
>>>>>
>>>>> I am not mistaken, we will have to introduce two options to cover 
>>>>> this case, as the offsets are not correlated with each other, no?
>>>
>>> You don't need two options. For instance, you can only introduce an 
>>> option SCIF_VERSION that would be 0 for SCIF and 61 (ascii 'a') for 
>>> SCIFA.
>>>
>>> Then in the code, you can use SCIF_VERSION to decides which sets of 
>>> macros you are using.
>>
>> I think I understand the idea. Will try.
> 
> 
> Is it something you would like to see?

Your solution below require to overwrite EARLY_PRINTK_INC and not very 
easy to extend of other version (e.g scifb). As I suggested earlier, we 
can introduce an option the same way REG_SHIFT exist for 8250. The 
definition of CONFIG_EARLY_PRINTK is:

CONFIG_EARLY_PRINTK=<INC>,<BASE_ADDRESS>,<OTHER_OPTIONS>

<OTHER_OPTIONS> would be the version. Nothing for SCIF and A for SCFIA.

Then in Rules.mk, you would have something like:

ifneq ($(word 3,$(EARLY_PRINTK_CFG)),)
CFLAGS-y += -DCONFIG_EARLY_PRINTK_VERSION_$(word 3, $(EARLY_PRINTK_CFG)
else
CFLAGS-y += -DCONFIG_EARLY_PRINTK_VERSION_NONE
endif

debug-scif.inc would then contain:

#ifdef CONFIG_EARLY_PRINTK_VERSION_A
#define foo
#define bar
#elifdef CONFIG_EARLY_PRINTK_VERSION_NONE
#define foo
#define bar
#endif

The CONFIG_EARLY_PRINTK_VERSION_NONE is here to help catching new 
addition. If someone if using a different version, it would not compile.
Also, the code in Rules.mk is generic enough to extend for other version 
(e.g scifb).

Does it make sense?

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-21 18:43               ` Julien Grall
@ 2019-02-21 18:53                 ` Oleksandr
  2019-02-22 17:34                   ` Oleksandr
  0 siblings, 1 reply; 22+ messages in thread
From: Oleksandr @ 2019-02-21 18:53 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini


On 21.02.19 20:43, Julien Grall wrote:
> Hi Oleksandr,

Hi Julien


>
> On 2/21/19 6:22 PM, Oleksandr wrote:
> =>>>>> Actually, the main difference for the "early printk" support is in
>>>>>> two reg offsets:
>>>>>>
>>>>>> +#define SCIFA_SCASSR   0x14    /* Serial status register */
>>>>>> +#define SCIFA_SCAFTDR  0x20    /* Transmit FIFO data register */
>>>>>>
>>>>>> +#define SCIF_SCFSR             0x10    /* Serial status register */
>>>>>> +#define SCIF_SCFTDR            0x0c    /* Transmit FIFO data 
>>>>>> register */
>>>>>>
>>>>>>
>>>>>> I am not mistaken, we will have to introduce two options to cover 
>>>>>> this case, as the offsets are not correlated with each other, no?
>>>>
>>>> You don't need two options. For instance, you can only introduce an 
>>>> option SCIF_VERSION that would be 0 for SCIF and 61 (ascii 'a') for 
>>>> SCIFA.
>>>>
>>>> Then in the code, you can use SCIF_VERSION to decides which sets of 
>>>> macros you are using.
>>>
>>> I think I understand the idea. Will try.
>>
>>
>> Is it something you would like to see?
>
> Your solution below require to overwrite EARLY_PRINTK_INC and not very 
> easy to extend of other version (e.g scifb). As I suggested earlier, 
> we can introduce an option the same way REG_SHIFT exist for 8250. The 
> definition of CONFIG_EARLY_PRINTK is:
>
> CONFIG_EARLY_PRINTK=<INC>,<BASE_ADDRESS>,<OTHER_OPTIONS>
>
> <OTHER_OPTIONS> would be the version. Nothing for SCIF and A for SCFIA.
>
> Then in Rules.mk, you would have something like:
>
> ifneq ($(word 3,$(EARLY_PRINTK_CFG)),)
> CFLAGS-y += -DCONFIG_EARLY_PRINTK_VERSION_$(word 3, $(EARLY_PRINTK_CFG)
> else
> CFLAGS-y += -DCONFIG_EARLY_PRINTK_VERSION_NONE
> endif
>
> debug-scif.inc would then contain:
>
> #ifdef CONFIG_EARLY_PRINTK_VERSION_A
> #define foo
> #define bar
> #elifdef CONFIG_EARLY_PRINTK_VERSION_NONE
> #define foo
> #define bar
> #endif
>
> The CONFIG_EARLY_PRINTK_VERSION_NONE is here to help catching new 
> addition. If someone if using a different version, it would not compile.
> Also, the code in Rules.mk is generic enough to extend for other 
> version (e.g scifb).
>
> Does it make sense?

Absolutely. Thank you


>
> Cheers,
>
-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-21 18:53                 ` Oleksandr
@ 2019-02-22 17:34                   ` Oleksandr
  2019-02-25 18:25                     ` Julien Grall
  0 siblings, 1 reply; 22+ messages in thread
From: Oleksandr @ 2019-02-22 17:34 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini


Hi, Julien


>> Your solution below require to overwrite EARLY_PRINTK_INC and not 
>> very easy to extend of other version (e.g scifb). As I suggested 
>> earlier, we can introduce an option the same way REG_SHIFT exist for 
>> 8250. The definition of CONFIG_EARLY_PRINTK is:
>>
>> CONFIG_EARLY_PRINTK=<INC>,<BASE_ADDRESS>,<OTHER_OPTIONS>
>>
>> <OTHER_OPTIONS> would be the version. Nothing for SCIF and A for SCFIA.
>>
>> Then in Rules.mk, you would have something like:
>>
>> ifneq ($(word 3,$(EARLY_PRINTK_CFG)),)
>> CFLAGS-y += -DCONFIG_EARLY_PRINTK_VERSION_$(word 3, $(EARLY_PRINTK_CFG)
>> else
>> CFLAGS-y += -DCONFIG_EARLY_PRINTK_VERSION_NONE
>> endif
>>
>> debug-scif.inc would then contain:
>>
>> #ifdef CONFIG_EARLY_PRINTK_VERSION_A
>> #define foo
>> #define bar
>> #elifdef CONFIG_EARLY_PRINTK_VERSION_NONE
>> #define foo
>> #define bar
>> #endif
>>
>> The CONFIG_EARLY_PRINTK_VERSION_NONE is here to help catching new 
>> addition. If someone if using a different version, it would not compile.
>> Also, the code in Rules.mk is generic enough to extend for other 
>> version (e.g scifb).
>>
>> Does it make sense?
>
> Absolutely. Thank you


Idea works as expected.


Just a quick question.

Shall I do this by a single patch or this should be spitted in two 
patches: "reworking current code" followed by "adding SCIFA"?


>
>
>>
>> Cheers,
>>
-- 
Regards,

Oleksandr Tyshchenko


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk
  2019-02-22 17:34                   ` Oleksandr
@ 2019-02-25 18:25                     ` Julien Grall
  0 siblings, 0 replies; 22+ messages in thread
From: Julien Grall @ 2019-02-25 18:25 UTC (permalink / raw)
  To: Oleksandr, xen-devel; +Cc: Oleksandr Tyshchenko, Stefano Stabellini

On 22/02/2019 17:34, Oleksandr wrote:
> 
> Hi, Julien

Hi Oleksandr,

> 
>>> Your solution below require to overwrite EARLY_PRINTK_INC and not very easy 
>>> to extend of other version (e.g scifb). As I suggested earlier, we can 
>>> introduce an option the same way REG_SHIFT exist for 8250. The definition of 
>>> CONFIG_EARLY_PRINTK is:
>>>
>>> CONFIG_EARLY_PRINTK=<INC>,<BASE_ADDRESS>,<OTHER_OPTIONS>
>>>
>>> <OTHER_OPTIONS> would be the version. Nothing for SCIF and A for SCFIA.
>>>
>>> Then in Rules.mk, you would have something like:
>>>
>>> ifneq ($(word 3,$(EARLY_PRINTK_CFG)),)
>>> CFLAGS-y += -DCONFIG_EARLY_PRINTK_VERSION_$(word 3, $(EARLY_PRINTK_CFG)
>>> else
>>> CFLAGS-y += -DCONFIG_EARLY_PRINTK_VERSION_NONE
>>> endif
>>>
>>> debug-scif.inc would then contain:
>>>
>>> #ifdef CONFIG_EARLY_PRINTK_VERSION_A
>>> #define foo
>>> #define bar
>>> #elifdef CONFIG_EARLY_PRINTK_VERSION_NONE
>>> #define foo
>>> #define bar
>>> #endif
>>>
>>> The CONFIG_EARLY_PRINTK_VERSION_NONE is here to help catching new addition. 
>>> If someone if using a different version, it would not compile.
>>> Also, the code in Rules.mk is generic enough to extend for other version (e.g 
>>> scifb).
>>>
>>> Does it make sense?
>>
>> Absolutely. Thank you
> 
> 
> Idea works as expected.
> 
> 
> Just a quick question.
> 
> Shall I do this by a single patch or this should be spitted in two patches: 
> "reworking current code" followed by "adding SCIFA"?

Separate patch if possible. Thank you!

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-02-25 18:26 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-01 12:37 [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2) Oleksandr Tyshchenko
2019-02-01 12:37 ` [PATCH V2 1/3] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs Oleksandr Tyshchenko
2019-02-18 14:00   ` Julien Grall
2019-02-18 20:14     ` Oleksandr
2019-02-19 10:00       ` Julien Grall
2019-02-20 17:11         ` Oleksandr
2019-02-01 12:37 ` [PATCH V2 2/3] xen/arm: Clarify usage of earlyprintk for Lager board Oleksandr Tyshchenko
2019-02-18 14:01   ` Julien Grall
2019-02-01 12:37 ` [PATCH V2 3/3] xen/arm: Add SCIFA UART support for early printk Oleksandr Tyshchenko
2019-02-18 14:05   ` Julien Grall
2019-02-18 20:41     ` Oleksandr
2019-02-18 20:45       ` Oleksandr
2019-02-19 10:09         ` Julien Grall
2019-02-20 18:03           ` Oleksandr
2019-02-21 18:22             ` Oleksandr
2019-02-21 18:43               ` Julien Grall
2019-02-21 18:53                 ` Oleksandr
2019-02-22 17:34                   ` Oleksandr
2019-02-25 18:25                     ` Julien Grall
2019-02-15 13:21 ` [PATCH V2 0/3] Renesas Stout board support (R-Car Gen2) Oleksandr
2019-02-15 13:30   ` Julien Grall
2019-02-15 13:39     ` Oleksandr

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.