All of lore.kernel.org
 help / color / mirror / Atom feed
From: Awais Masood <awais.masood@vadion.com>
To: xen-devel@lists.xenproject.org
Cc: Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	xen-devel@lists.xen.org, Awais Masood <awais.masood@vadion.com>
Subject: [PATCH v2 1/2] xen/arm64: Add Support for Allwinner H5 (sun50i)
Date: Tue, 26 Sep 2017 14:37:13 +0500	[thread overview]
Message-ID: <1506418634-20366-2-git-send-email-awais.masood@vadion.com> (raw)
In-Reply-To: <1506418634-20366-1-git-send-email-awais.masood@vadion.com>

This patch adds support for Allwinner H5/sun50i SoC.

Makefile updated to enable ARM64 compilation for sunxi.c.

sunxi.c updates include:
  - Addition of H5/sun50i dt compatibility string.
  - Handling of different Watchdog timer base addresses on sun7i
    and sun50i.

Tested on Orange Pi PC2

Signed-off-by: Awais Masood <awais.masood@vadion.com>

---
Changes since v1:
  - Improved patch description
---
 xen/arch/arm/platforms/Makefile |  1 +
 xen/arch/arm/platforms/sunxi.c  | 40 +++++++++++++++++++++++++++++++---------
 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile
index 49fa683..722897a 100644
--- a/xen/arch/arm/platforms/Makefile
+++ b/xen/arch/arm/platforms/Makefile
@@ -6,5 +6,6 @@ obj-$(CONFIG_ARM_32) += omap5.o
 obj-$(CONFIG_ARM_32) += rcar2.o
 obj-$(CONFIG_ARM_64) += seattle.o
 obj-$(CONFIG_ARM_32) += sunxi.o
+obj-$(CONFIG_ARM_64) += sunxi.o
 obj-$(CONFIG_ARM_64) += xgene-storm.o
 obj-$(CONFIG_ARM_64) += xilinx-zynqmp.o
diff --git a/xen/arch/arm/platforms/sunxi.c b/xen/arch/arm/platforms/sunxi.c
index 0ba7b3d..06d62e7 100644
--- a/xen/arch/arm/platforms/sunxi.c
+++ b/xen/arch/arm/platforms/sunxi.c
@@ -22,18 +22,18 @@
 #include <asm/io.h>
 
 /* Watchdog constants: */
-#define SUNXI_WDT_BASE            0x01c20c90
+#define SUNXI_WDT_A20_BASE        0x01c20c90
+#define SUNXI_WDT_H5_BASE         0x01c20cA0
 #define SUNXI_WDT_MODE            0x04
-#define SUNXI_WDT_MODEADDR        (SUNXI_WDT_BASE + SUNXI_WDT_MODE)
 #define SUNXI_WDT_MODE_EN         (1 << 0)
 #define SUNXI_WDT_MODE_RST_EN     (1 << 1)
 
 
-static void sunxi_reset(void)
+static void sunxi_reset(u32 base)
 {
     void __iomem *wdt;
 
-    wdt = ioremap_nocache(SUNXI_WDT_MODEADDR & PAGE_MASK, PAGE_SIZE);
+    wdt = ioremap_nocache((base + SUNXI_WDT_MODE) & PAGE_MASK, PAGE_SIZE);
     if ( !wdt )
     {
         dprintk(XENLOG_ERR, "Unable to map watchdog register!\n");
@@ -42,19 +42,35 @@ static void sunxi_reset(void)
 
     /* Enable watchdog to trigger a reset after 500 ms: */
     writel(SUNXI_WDT_MODE_EN | SUNXI_WDT_MODE_RST_EN,
-      wdt + (SUNXI_WDT_MODEADDR & ~PAGE_MASK));
+      wdt + ((base + SUNXI_WDT_MODE) & ~PAGE_MASK));
     iounmap(wdt);
 
     for (;;)
         wfi();
 }
 
-static const char * const sunxi_dt_compat[] __initconst =
+static void sunxi_a20_reset(void)
+{
+    sunxi_reset(SUNXI_WDT_A20_BASE);
+}
+
+static void sunxi_h5_reset(void)
+{
+    sunxi_reset(SUNXI_WDT_H5_BASE);
+}
+
+static const char * const sunxi_dt_allwinner_a20_compat[] __initconst =
 {
     "allwinner,sun7i-a20",
     NULL
 };
 
+static const char * const sunxi_dt_allwinner_h5_compat[] __initconst =
+{
+    "allwinner,sun50i-h5",
+    NULL
+};
+
 static const struct dt_device_match sunxi_blacklist_dev[] __initconst =
 {
     /*
@@ -65,10 +81,16 @@ static const struct dt_device_match sunxi_blacklist_dev[] __initconst =
     { /* sentinel */ },
 };
 
-PLATFORM_START(sunxi, "Allwinner A20")
-    .compatible = sunxi_dt_compat,
+PLATFORM_START(sunxia20, "Allwinner A20")
+    .compatible = sunxi_dt_allwinner_a20_compat,
+    .blacklist_dev = sunxi_blacklist_dev,
+    .reset = sunxi_a20_reset,
+PLATFORM_END
+
+PLATFORM_START(sunxih5, "Allwinner H5")
+    .compatible = sunxi_dt_allwinner_h5_compat,
     .blacklist_dev = sunxi_blacklist_dev,
-    .reset = sunxi_reset,
+    .reset = sunxi_h5_reset,
 PLATFORM_END
 
 /*
-- 
2.7.4


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

  reply	other threads:[~2017-09-26  9:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 13:38 [PATCH 0/2] xen/arm64/ns16550: Support for Allwinner H5 SoC Awais Masood
2017-09-19 13:38 ` [PATCH 1/2] xen/arm64: Add Support for Allwinner H5 (sun50i) Awais Masood
2017-09-19 13:50   ` Jan Beulich
2017-09-19 13:38 ` [PATCH 2/2] xen/ns16550: Fix ISR lockup on Designware 8250 (H5) Awais Masood
2017-09-19 13:49   ` Jan Beulich
2017-09-26  9:37 ` [PATCH v2 0/2] xen/arm64/ns16550: Support for Allwinner H5 SoC Awais Masood
2017-09-26  9:37   ` Awais Masood [this message]
2017-09-28 20:03     ` [PATCH v2 1/2] xen/arm64: Add Support for Allwinner H5 (sun50i) Julien Grall
2017-09-28 22:49       ` Andre Przywara
2017-09-29 16:35         ` Andre Przywara
2017-10-04  9:16           ` Awais Masood
2017-10-04  9:26             ` Andre Przywara
2017-10-04  9:39               ` Awais Masood
2017-10-04 10:03                 ` Andre Przywara
2017-10-03 11:32         ` Julien Grall
2017-09-26  9:37   ` [PATCH v2 2/2] xen/ns16550: Fix ISR lockup on Designware 8250 (H5) Awais Masood
2017-09-26 11:58     ` Jan Beulich
2017-10-04 11:44   ` [PATCH v3] xen/ns16550: Fix ISR lockup on Allwinner uart Awais Masood
2017-10-06 14:50     ` Jan Beulich
2017-10-10 23:59     ` Stefano Stabellini

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=1506418634-20366-2-git-send-email-awais.masood@vadion.com \
    --to=awais.masood@vadion.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.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 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.