From patchwork Mon Jan 27 08:42:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 23740 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1CD0E2130F for ; Mon, 27 Jan 2014 08:43:10 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id c9sf10888287qcz.5 for ; Mon, 27 Jan 2014 00:43:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=L4mlK/J5Qdoa5WRgA+Z1lGbBDDJdNMwsvnuWvj8gVW0=; b=aHEK8XVY1eJcUtsjgug9up5yk4nDPQok3zu5b81c8z8n8kCpbopNqao2yWvVvFIbwg tI/yYvH6rhfwZ3j3QWVljbUIsbGeb9Gik/HvwtjRwFRi03iHz2SKw2N08+CgcRxvD81j nmQow6W67ECVjMO6G4vi8orBiTh1NQ6PP8tBe8ij6Uk8D/Ay9PJTqxW+45znXhaFbYGH q4W0u8EkJgUeUGf9aEuxlmQfyyKy+OOU9oh5nYWS5ofXfmT/MsJsEuwuy+Keimwivv/h uIt6Y6J7ePZ/MWw51E75nemlxYOVr+v+Ob0CGmmx1kvre8VEtGXvZfA6rGCVSWQbpzwU 3eFA== X-Gm-Message-State: ALoCoQnXL91wm6V8DXo+anXCDDPB30UE/oX9ccPtm0zulnn23jK8uO2cII186ogu6O6oDXczl4vC X-Received: by 10.236.18.196 with SMTP id l44mr660495yhl.52.1390812189177; Mon, 27 Jan 2014 00:43:09 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.39.37 with SMTP id u34ls1397318qgu.37.gmail; Mon, 27 Jan 2014 00:43:09 -0800 (PST) X-Received: by 10.58.208.130 with SMTP id me2mr15197007vec.13.1390812189077; Mon, 27 Jan 2014 00:43:09 -0800 (PST) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id ry8si4880365vcb.46.2014.01.27.00.43.09 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 00:43:09 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id c14so3284647vea.6 for ; Mon, 27 Jan 2014 00:43:09 -0800 (PST) X-Received: by 10.52.189.33 with SMTP id gf1mr2657660vdc.26.1390812188965; Mon, 27 Jan 2014 00:43:08 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp113760vcz; Mon, 27 Jan 2014 00:43:08 -0800 (PST) X-Received: by 10.68.114.163 with SMTP id jh3mr28394579pbb.99.1390812187872; Mon, 27 Jan 2014 00:43:07 -0800 (PST) Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com [209.85.220.50]) by mx.google.com with ESMTPS id s4si10482810pbg.243.2014.01.27.00.43.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 00:43:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.50 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=209.85.220.50; Received: by mail-pa0-f50.google.com with SMTP id kp14so5667928pab.9 for ; Mon, 27 Jan 2014 00:43:07 -0800 (PST) X-Received: by 10.68.133.138 with SMTP id pc10mr2537129pbb.98.1390812187268; Mon, 27 Jan 2014 00:43:07 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id sd3sm29616576pbb.42.2014.01.27.00.43.02 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 00:43:06 -0800 (PST) From: Pranavkumar Sawargaonkar To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, stefano.stabellini@citrix.com, patches@apm.com, patches@linaro.org, Pranavkumar Sawargaonkar , Anup Patel Subject: [PATCH V5] xen: arm: platforms: Adding reset support for xgene arm64 platform. Date: Mon, 27 Jan 2014 14:12:52 +0530 Message-Id: <1390812173-12081-1-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pranavkumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch adds a reset support for xgene arm64 platform. V5: - Incorporating comments received on V4 patch. V4: - Removing TODO comment about retriving reset base address from dts as that is done now. V3: - Retriving reset base address and reset mask from device tree. - Removed unnecssary header files included earlier. V2: - Removed unnecssary mdelay in code. - Adding iounmap of the base address. V1: -Initial patch. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Anup Patel --- xen/arch/arm/platforms/xgene-storm.c | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c index 5b0bd5f..3825269 100644 --- a/xen/arch/arm/platforms/xgene-storm.c +++ b/xen/arch/arm/platforms/xgene-storm.c @@ -20,8 +20,14 @@ #include #include +#include +#include #include +/* Variables to save reset address of soc during platform initialization. */ +static u64 reset_addr, reset_size; +static u32 reset_mask; + static uint32_t xgene_storm_quirks(void) { return PLATFORM_QUIRK_GIC_64K_STRIDE; @@ -107,6 +113,61 @@ err: return ret; } +static void xgene_storm_reset(void) +{ + void __iomem *addr; + + addr = ioremap_nocache(reset_addr, reset_size); + + if ( !addr ) + { + printk("XGENE: Unable to map xgene reset address\n"); + return; + } + + /* Write reset mask to base address */ + writel(reset_mask, addr); + + iounmap(addr); +} + +static int xgene_storm_init(void) +{ + static const struct dt_device_match reset_ids[] __initconst = + { + DT_MATCH_COMPATIBLE("apm,xgene-reboot"), + {}, + }; + struct dt_device_node *dev; + int res; + + dev = dt_find_matching_node(NULL, reset_ids); + if ( !dev ) + { + printk("XGENE: Unable to find a compatible reset node in the device tree"); + return 0; + } + + dt_device_set_used_by(dev, DOMID_XEN); + + /* Retrieve base address and size */ + res = dt_device_get_address(dev, 0, &reset_addr, &reset_size); + if ( res ) + { + printk("XGENE: Unable to retrieve the base address for reset\n"); + return 0; + } + + /* Get reset mask */ + res = dt_property_read_u32(dev, "mask", &reset_mask); + if ( !res ) + { + printk("XGENE: Unable to retrieve the reset mask\n"); + return 0; + } + + return 0; +} static const char * const xgene_storm_dt_compat[] __initconst = { @@ -116,6 +177,8 @@ static const char * const xgene_storm_dt_compat[] __initconst = PLATFORM_START(xgene_storm, "APM X-GENE STORM") .compatible = xgene_storm_dt_compat, + .init = xgene_storm_init, + .reset = xgene_storm_reset, .quirks = xgene_storm_quirks, .specific_mapping = xgene_storm_specific_mapping,