xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Oleksandr Tyshchenko <olekstysh@gmail.com>
To: xen-devel@lists.xenproject.org
Cc: Artem_Mygaiev@epam.com, olekstysh@gmail.com,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Subject: [PATCH v1 3/4] xen/arm: Add SCIFA UART support for early printk
Date: Mon,  6 Aug 2018 21:35:51 +0300	[thread overview]
Message-ID: <1533580552-938-4-git-send-email-olekstysh@gmail.com> (raw)
In-Reply-To: <1533580552-938-1-git-send-email-olekstysh@gmail.com>

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>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
---
 docs/misc/arm/early-printk.txt     |  3 ++-
 xen/arch/arm/Rules.mk              |  1 +
 xen/arch/arm/arm32/debug-scifa.inc | 51 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 xen/arch/arm/arm32/debug-scifa.inc

diff --git a/docs/misc/arm/early-printk.txt b/docs/misc/arm/early-printk.txt
index f765f59..f1b55d3 100644
--- a/docs/misc/arm/early-printk.txt
+++ b/docs/misc/arm/early-printk.txt
@@ -39,12 +39,13 @@ 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
   - rcar3: printk with SCIF2 on Renesas R-Car Gen3 processors
   - seattle: printk with pl011 for AMD Seattle processor
+  - stout: printk with SCIFA0 on Renesas Stout board (R-Car H2 processor)
   - sun6i: printk with 8250 on Allwinner A31 processors
   - sun7i: printk with 8250 on Allwinner A20 processors
   - thunderx: printk with pl011 for Cavium ThunderX processor
diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk
index f264592..e011f8b 100644
--- a/xen/arch/arm/Rules.mk
+++ b/xen/arch/arm/Rules.mk
@@ -40,6 +40,7 @@ EARLY_PRINTK_mvebu          := mvebu,0xd0012000
 EARLY_PRINTK_omap5432       := 8250,0x48020000,2
 EARLY_PRINTK_rcar3          := scif,0xe6e88000
 EARLY_PRINTK_seattle        := pl011,0xe1010000
+EARLY_PRINTK_stout          := scifa,0xe6c40000
 EARLY_PRINTK_sun6i          := 8250,0x01c28000,2
 EARLY_PRINTK_sun7i          := 8250,0x01c28000,2
 EARLY_PRINTK_thunderx       := pl011,0x87e024000000
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

  parent reply	other threads:[~2018-08-06 18:36 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 18:35 [PATCH v1 0/4] Renesas Stout board support (R-Car Gen2) Oleksandr Tyshchenko
2018-08-06 18:35 ` [PATCH v1 1/4] xen/arm: drivers: scif: Remove unused #define-s Oleksandr Tyshchenko
2018-08-07 13:28   ` Julien Grall
2018-08-06 18:35 ` [PATCH v1 2/4] xen/arm: drivers: scif: Add support for SCIFA compatible UARTs Oleksandr Tyshchenko
2018-08-07 13:43   ` Julien Grall
2018-08-07 15:01     ` Oleksandr Tyshchenko
2018-08-07 15:20       ` Julien Grall
2018-08-06 18:35 ` Oleksandr Tyshchenko [this message]
2018-08-07 13:48   ` [PATCH v1 3/4] xen/arm: Add SCIFA UART support for early printk Julien Grall
2018-08-07 14:28     ` Oleksandr Tyshchenko
2018-08-07 15:22       ` Julien Grall
2018-08-07 17:18         ` Oleksandr Tyshchenko
2018-08-06 18:35 ` [PATCH v1 4/4] xen/arm: Reuse R-Car Gen2 platform code for Stout board Oleksandr Tyshchenko
2018-08-07 15:18   ` Julien Grall
2018-08-07 17:12     ` Oleksandr Tyshchenko
2018-08-07 17:21       ` Julien Grall
2018-08-07 19:13         ` Oleksandr Tyshchenko
2018-08-09 16:10           ` Julien Grall
2018-08-09 16:18             ` Oleksandr Tyshchenko
2018-08-09 16:19               ` Oleksandr Tyshchenko
2018-08-09 16:20               ` Julien Grall
2018-08-09 18:18                 ` Oleksandr Tyshchenko
2018-08-10  9:44                   ` Julien Grall
2018-08-10 11:47                     ` Oleksandr Tyshchenko
2018-08-10 12:50                       ` Julien Grall
2018-08-13 12:41                         ` Oleksandr Tyshchenko
2018-08-22 15:48 ` [PATCH v1 0/4] Renesas Stout board support (R-Car Gen2) Julien Grall
2018-08-22 15:53   ` Oleksandr Tyshchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1533580552-938-4-git-send-email-olekstysh@gmail.com \
    --to=olekstysh@gmail.com \
    --cc=Artem_Mygaiev@epam.com \
    --cc=julien.grall@arm.com \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).