From patchwork Tue Sep 19 13:38:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Awais Masood X-Patchwork-Id: 9959005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1D74F60568 for ; Tue, 19 Sep 2017 13:42:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DE5741FFAE for ; Tue, 19 Sep 2017 13:42:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6AD228E63; Tue, 19 Sep 2017 13:42:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 53D8E28EA8 for ; Tue, 19 Sep 2017 13:41:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duIkY-0001ps-Uj; Tue, 19 Sep 2017 13:39:42 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1duIkX-0001pU-5V for xen-devel@lists.xenproject.org; Tue, 19 Sep 2017 13:39:41 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id 5E/92-02226-B1E11C95; Tue, 19 Sep 2017 13:39:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRWlGSWpSXmKPExsXiVRuspSspdzD S4MxeRYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNeNn/0X2gqlSFf9W7GFpYLwg2sXIxSEkMJ1R 4m3jC3YQh0WgkVXi2cHjrCCOhEA/q8TKpvtsXYycQE6RxJutMxgh7DSJVasXM0HYFRILpjwFq xES0JA40fScFWLsL0aJq7s2gTWwCehIzNv/BMwWEVCSuLdqMhNIEbNAI5PEpK6PQA4Hh7CAq8 TD28kgNSwCqhIvNx4CC/MKuEvMu5cIsUtO4ua5TmYQm1PAQ+Lu2WtMEHvdJf5fWsc2gVFwASP DKkaN4tSistQiXUNjvaSizPSMktzEzBxdQwNjvdzU4uLE9NScxKRiveT83E2MwJBjAIIdjNu2 ex5ilORgUhLlLZI+GCnEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgjdCFignWJSanlqRlpkDDH6Yt AQHj5IIrwJImre4IDG3ODMdInWK0Zhj355bf5g4Om7e/cMkxJKXn5cqJc77WwaoVACkNKM0D2 4QLCovMcpKCfMyAp0mxFOQWpSbWYIq/4pRnINRSZjXCmQhT2ZeCdy+V0CnMAGdkr3hAMgpJYk IKakGRr682vPij+cUf5ANzyzbMifn90lPr0UlrbZvBZWz7046KeSd5tt0cqVdyL202Zyz/ucq pSz7eqp/R+Tz7TtqlZlLNnY7Khn0nv57yZu9xOdUz93tvFGJF5tv8m5esnv6814V+/qtJsvkf 7Kc51gt9fjQX6nl08zkFZRWptixl60pOCG+jGXxYyWW4oxEQy3mouJEABzPybHFAgAA X-Env-Sender: awais.masood@softrove.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1505828376!57443299!1 X-Originating-IP: [74.125.83.42] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48649 invoked from network); 19 Sep 2017 13:39:37 -0000 Received: from mail-pg0-f42.google.com (HELO mail-pg0-f42.google.com) (74.125.83.42) by server-4.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 19 Sep 2017 13:39:37 -0000 Received: by mail-pg0-f42.google.com with SMTP id v23so2012754pgc.5 for ; Tue, 19 Sep 2017 06:39:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vadion-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vaKU+7pberFPsZzjX4vMPstswYOVTav3XYv2g57r9ZQ=; b=S72B+Va0kF4jxeto06As1/ldrZfYuBdXomA6IK9NIteAD57f8GWz3Xmxdynh+HznvD rvAZ9gZ4a/KS4sxAXFkQ17bdXEu4pNK/VydQKlbNgE0ZmLW7V4+5QeiW7tWBPjThsiRS o51Unyy5ki2HEwQmIcnB15bHQF0pXzklFnQhQ4z1URarFtGQIGKRFgOV+vuSN0KXdd5N kBdZVMKDl/mtNhrfpfEwg+TkCVeEYNpPLmi9+f/HRJ8XsChySeRXOtChg+ezYoOyIvgd 28uvDWWJjRCoHeM+MC7FII94JtLe56XYnVQJprLbUvhPhQALpv9rcRg/8rXyMPAM4A1I bYog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vaKU+7pberFPsZzjX4vMPstswYOVTav3XYv2g57r9ZQ=; b=ieBs/gSDqfLUkOqG1FR/IoYITapTbdSKLlVMRCGuYQJdN0c5d379qxY8zkdW1Chumr DjdS0U/ivLreeZ0Y+DseIACKTDNLq/UFpuvaB94Va6zZVbK14lGJvf+/wwXCj+F9mpqP 3C5VPHZB+rgL0nFkC8q+r8XzAlqbkWcJS79leoWaHVylMml6IGzYCWSrkr8FHF/QBbjn e3aKeYx1bHoy7/5hiHjlS0riCz/A+HJ21iS3RmldCMGGXcZNfRtxMevETusnyibXSivo QwX9JHZqsfpmkYCGk4/k+rvzhD/XUupPLDgYXdkDtoV5i2ARU+0/CZ5D/nu7+T4y4dqt oG1w== X-Gm-Message-State: AHPjjUhZUXweScvOzxMWERLWyiXoBemr87u9105leYgjF+YYI3JRmi4u Ti3bYx7XtO7XoKcYbEK+k0fNZyZ/oEtgTA== X-Google-Smtp-Source: AOwi7QBJL5NornTUn7kG/e83TB3S8LeauhgaebfK7MIHwiAtXL7gg0PF4NF6gnFexkuPt0SOxTJszw== X-Received: by 10.99.42.72 with SMTP id q69mr1347898pgq.379.1505828375545; Tue, 19 Sep 2017 06:39:35 -0700 (PDT) Received: from localhost.localdomain ([182.185.155.152]) by smtp.gmail.com with ESMTPSA id v71sm3828620pfa.45.2017.09.19.06.39.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Sep 2017 06:39:34 -0700 (PDT) From: Awais Masood To: xen-devel@lists.xenproject.org Date: Tue, 19 Sep 2017 18:38:53 +0500 Message-Id: <1505828334-29109-2-git-send-email-awais.masood@vadion.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505828334-29109-1-git-send-email-awais.masood@vadion.com> References: <1505828334-29109-1-git-send-email-awais.masood@vadion.com> Cc: sstabellini@kernel.org, wei.liu2@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, Awais Masood , ian.jackson@eu.citrix.com, tim@xen.org, julien.grall@arm.com, jbeulich@suse.com Subject: [Xen-devel] [PATCH 1/2] xen/arm64: Add Support for Allwinner H5 (sun50i) X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Tested on Orange Pi PC2. Makefile updated to enable ARM64 compilation of sunxi.c. sunxi.c updates include: Added H5 dt compatibility string. Watchdog timer base address is different on sun5oi as compared to sun7i. Reset function updated to handle different base addresses. Signed-off-by: Awais Masood --- 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 /* 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 /*