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

[PATCH 4/4] xen/arm: pl011: Add SBSA UART device-tree support


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 7 Jun 2023 11:27:27 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); 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=Bdyg4wduBHS4jVU1X22vJpEOlAmdB1Wdxc+0O1Wdu78=; b=DvhLKzNwd7eZ3v/1347Dg+zNdhLBpfJLDffNfyPoDJBQw2G8dffACDy/sNk+4Y9JfeZetTaoyB1Wpb4MbeYjQM9qLN/xabBx92pUMx/3gPfnGkMEfRv6/PFi39KpIX0sRT3BojmS5M+v7wvI08gglscS5iEV74M2cV/eHqanJAnWa2hOXDYYjuLR81wl7Dt3hxb6dYEIvj4eV/iE/m4eVppf/6ZrKxKMq+Y4OeatzgswiX3rWV6jv1sIImCfFsco/6I99YM4qNuoRBWM7JchwT1dLXqZQhluCtDmdM3dCXFrGU65T82cCQhj+/8cMYvFC0A3HAQh/WJ0mUlwN+N7Hg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SGV4gzwikXD0RhBY7ZkIGrFXVMstyQ4eZQz+WRQbc57DKZ/IhdDAo3JRVwNwH65T/oaswEQ7gbeMJeeMqU4i+74x2FRyeMmIBmuYs0lH0X7CGmWrMrN/+BtNrX7JIttyryX35LOFYC4yniQqawQ8CueDMH6v4bgdha4nSyos6euLEj/tQEyfXCM+MTNaJhvGhC/pjaT0CRuj+PDmEAqmuOtDlTzigIQlSGpjWa3oeqHjhqeu2ftXbvBHfpTORP3HKQkXs8XkyTuHwhEiXIRY5ESOlMJ7hQzDY+A01lq14vdu+1K4CxtXyCdJkTl01JWcbBB1OzJk3eR942eyxNSLog==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 07 Jun 2023 09:28:02 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

We already have all the bits necessary in PL011 driver to support SBSA
UART thanks to commit 032ea8c736d10f02672863c6e369338f948f7ed8 that
enabled it for ACPI. Plumb in the remaining part for device-tree boot:
 - add arm,sbsa-uart compatible to pl011_dt_match (no need for a separate
   struct and DT_DEVICE_START as SBSA is a subset of PL011),
 - from pl011_dt_uart_init(), check for SBSA UART compatible to determine
   the UART type in use.

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
---
After this series the last thing not to be in spec for newer UARTs (well,
for rev1.5 introduced in 2007 I believe) is incorrect FIFO size. We hardcode it
to 16 but in r1.5 it is 32. This requires checking the peripheral ID register
or using arm,primecell-periphid dt property for overriding HW. Something to
be done in the future (at least 16 is not harmful).
---
 xen/drivers/char/pl011.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/pl011.c b/xen/drivers/char/pl011.c
index 403b1ac06551..f7bf3ad117af 100644
--- a/xen/drivers/char/pl011.c
+++ b/xen/drivers/char/pl011.c
@@ -286,7 +286,7 @@ static int __init pl011_dt_uart_init(struct dt_device_node 
*dev,
     int res;
     paddr_t addr, size;
     uint32_t io_width;
-    bool mmio32 = false;
+    bool mmio32 = false, sbsa;
 
     if ( strcmp(config, "") )
     {
@@ -320,7 +320,9 @@ static int __init pl011_dt_uart_init(struct dt_device_node 
*dev,
         }
     }
 
-    res = pl011_uart_init(res, addr, size, false, mmio32);
+    sbsa = dt_device_is_compatible(dev, "arm,sbsa-uart");
+
+    res = pl011_uart_init(res, addr, size, sbsa, mmio32);
     if ( res < 0 )
     {
         printk("pl011: Unable to initialize\n");
@@ -335,6 +337,8 @@ static int __init pl011_dt_uart_init(struct dt_device_node 
*dev,
 static const struct dt_device_match pl011_dt_match[] __initconst =
 {
     DT_MATCH_COMPATIBLE("arm,pl011"),
+    /* No need for a separate struct as SBSA UART is a subset of PL011 */
+    DT_MATCH_COMPATIBLE("arm,sbsa-uart"),
     { /* sentinel */ },
 };
 
-- 
2.25.1




 


Rackspace

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