[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] xen/arm: Add i.MX lpuart early printk support


  • To: sstabellini@xxxxxxxxxx, julien@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, bertrand.marquis@xxxxxxx
  • From: "Peng Fan (OSS)" <peng.fan@xxxxxxxxxxx>
  • Date: Mon, 28 Feb 2022 09:07:10 +0800
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HQTF4tiGiA6bqr8wGDrApHkfcsxMIqMshDIrr4CmuTU=; b=Ok9F2B6SgOKau2+gFivh8Nj97bBBDFK1K+TzC/pedVZbh+YfjAoplkZYXQkg09I+X3bgr9eyWCHQFYNZezPHFt1keART70YDQWjDud3ypu8XaA5H5xxLuG5qJU3R8OixD5V47Q8Ua+1zqn7ZcdLevjQrkqSiQb4Oms2Cy6jw47cl7bXFoTnrhZyiJigLYpVgls83dWT5I4o7Q5H+GPFhnFJ17EFoA7gj9wmAVRnfDW9VzlRX9qVtc/3cE6/AXvUAPbilL9uV+7kgaoifHOBeBMbavp5eHs/O8i9RrSvRD7hXV1ltKJaOhlhMaM8fn4O9yH/wzpXlAjPtQtkA7gHB/g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hSfyKXEm88+iJ7OIfLAfKPjFKy6RT5jXGQrj3rrU4e1e6zsWPs+qo/1lWctfGLczFqStJdiZVAGZmRNYR4SSm1s8XbuGCo8UzfDFL0C+jP9AHRH8UVS9acrR8Pm52Y+Xtpn9+rBWcdP0vJG3Pkgd7EQHZUuWIAe2Ufp0sPRAKh2vcCdCBp5BDolmNVVfluL6uKk/tKleQJTdZyoL6PuB1xwZPzVsHtQztlYplQccPYwBde8E7E41mD/S6JbE3cvKxsQcuD67s1JygD5XqSKI4PWg8NouI1ujmPa5MCbPQ+5JcU/Yq3rwTzPH+MOYDf/+juL5WHabtlj8hw3C1+OJLQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, jbeulich@xxxxxxxx, wl@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, van.freenix@xxxxxxxxx, Peng Fan <peng.fan@xxxxxxx>
  • Delivery-date: Mon, 28 Feb 2022 05:12:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Peng Fan <peng.fan@xxxxxxx>

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---
 xen/arch/arm/Kconfig.debug              | 18 ++++++++++
 xen/arch/arm/arm64/debug-imx-lpuart.inc | 48 +++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
 create mode 100644 xen/arch/arm/arm64/debug-imx-lpuart.inc

diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index 35ccd13273..9ecb446b3a 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -55,6 +55,20 @@ choice
                        selecting one of the platform specific options below if
                        you know the parameters for the port.
 
+                       This option is preferred over the platform specific
+                       options; the platform specific options are deprecated
+                       and will soon be removed.
+       config EARLY_UART_CHOICE_IMX_LPUART
+               select EARLY_UART_IMX_LPUART
+               depends on ARM_64
+               bool "Early printk via i.MX LPUART"
+               help
+                       Say Y here if you wish the early printk to direct their
+                       output to a i.MX LPUART. You can use this option to
+                       provide the parameters for the i.MX LPUART rather than
+                       selecting one of the platform specific options below if
+                       you know the parameters for the port.
+
                        This option is preferred over the platform specific
                        options; the platform specific options are deprecated
                        and will soon be removed.
@@ -186,6 +200,9 @@ config EARLY_UART_CADENCE
 config EARLY_UART_EXYNOS4210
        select EARLY_PRINTK
        bool
+config EARLY_UART_IMX_LPUART
+       select EARLY_PRINTK
+       bool
 config EARLY_UART_MESON
        select EARLY_PRINTK
        bool
@@ -283,6 +300,7 @@ config EARLY_PRINTK_INC
        default "debug-8250.inc" if EARLY_UART_8250
        default "debug-cadence.inc" if EARLY_UART_CADENCE
        default "debug-exynos4210.inc" if EARLY_UART_EXYNOS4210
+       default "debug-imx-lpuart.inc" if EARLY_UART_IMX_LPUART
        default "debug-meson.inc" if EARLY_UART_MESON
        default "debug-mvebu.inc" if EARLY_UART_MVEBU
        default "debug-pl011.inc" if EARLY_UART_PL011
diff --git a/xen/arch/arm/arm64/debug-imx-lpuart.inc 
b/xen/arch/arm/arm64/debug-imx-lpuart.inc
new file mode 100644
index 0000000000..7510210d46
--- /dev/null
+++ b/xen/arch/arm/arm64/debug-imx-lpuart.inc
@@ -0,0 +1,48 @@
+/*
+ * xen/arch/arm/arm64/debug-imx8qm.inc
+ *
+ * i.MX8QM specific debug code
+ *
+ * Peng Fan <peng.fan@xxxxxxx>
+ * Copyright (C) 2016 Freescale 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 <xen/imx-lpuart.h>
+
+.macro early_uart_init wb wc wd
+/* Already initialized in bootloader */
+.endm
+/* i.MX8QM wait LPUART to be ready to transmit
+ * rb: register which contains the UART base address
+ * rc: scratch register
+ */
+.macro early_uart_ready xb, c
+1:
+        ldr   w\c, [\xb, #UARTSTAT]   /* <- Flag register */
+        tst   w\c, #UARTSTAT_TDRE     /* Check FIFO EMPTY bit */
+        beq   1b                      /* Wait for the UART to be ready */
+.endm
+
+/* i.MX8QM LPUART transmit character
+ * rb: register which contains the UART base address
+ * rt: register which contains the character to transmit */
+.macro early_uart_transmit xb, wt
+        str   \wt, [\xb, #UARTDATA]  /* -> Data Register */
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
-- 
2.30.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.