From patchwork Fri Jan 24 11:58:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 23671 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EEA6320307 for ; Fri, 24 Jan 2014 11:58:17 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id oy12sf5714236veb.6 for ; Fri, 24 Jan 2014 03:58:17 -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=0uioFf4N1wTfMsL/ZjOl5CI9k47sa+kD1goBbMO+rTQ=; b=dLx+3fcDSUXnt/T2Ko1JMgPrRDdg5i2e3McDVKOjZBDMXq6/K8wvqNiROTlLwPPcac utcCOK5+Df+uBiQqtAkvVibWtLKrjOYGXn0f5ZNHhr8PJJzJ6/pUYgYjZpByHP5ZENV/ w4w4MRx3q9xelAEx6OnWTPBa8C5wGtmRpdHhq3EoXkNir5LxABDxPhEORtheNpu5TG89 ILajDwZY5hdUGR5Vmb0x1U2SKzA4ZK8JnZG/zDFOKfIGmmdq6LiBKUL4x0VBO9fRg9zz LeGs16CK1Q+XXSuFQk3akT+Yl3KbLe/o2qc2Z1dbo7Izwa2J1ibcrk9zAKn65VCnkOoO 7v1g== X-Gm-Message-State: ALoCoQlH9EcEmQnDXqDLFa6mq22Z3o/aBq0iztAOLPlVzqpjWNanJiHtnbUAOqJ+tpqowr8xKa/5 X-Received: by 10.58.215.108 with SMTP id oh12mr4735385vec.27.1390564697153; Fri, 24 Jan 2014 03:58:17 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.50.5 with SMTP id r5ls589461qga.22.gmail; Fri, 24 Jan 2014 03:58:17 -0800 (PST) X-Received: by 10.58.229.164 with SMTP id sr4mr7377363vec.18.1390564697050; Fri, 24 Jan 2014 03:58:17 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id k9si401732vez.11.2014.01.24.03.58.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 03:58:17 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id im17so1793322vcb.5 for ; Fri, 24 Jan 2014 03:58:17 -0800 (PST) X-Received: by 10.220.193.132 with SMTP id du4mr2960232vcb.39.1390564696977; Fri, 24 Jan 2014 03:58:16 -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 u4csp96561vcz; Fri, 24 Jan 2014 03:58:16 -0800 (PST) X-Received: by 10.68.37.42 with SMTP id v10mr13865405pbj.127.1390564696010; Fri, 24 Jan 2014 03:58:16 -0800 (PST) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx.google.com with ESMTPS id mj6si844491pab.333.2014.01.24.03.58.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 03:58:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.49 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=209.85.220.49; Received: by mail-pa0-f49.google.com with SMTP id hz1so3176499pad.22 for ; Fri, 24 Jan 2014 03:58:15 -0800 (PST) X-Received: by 10.66.188.203 with SMTP id gc11mr13821962pac.63.1390564695496; Fri, 24 Jan 2014 03:58:15 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id db3sm2556546pbb.10.2014.01.24.03.58.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 03:58:14 -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 V4] xen: arm: platforms: Adding reset support for xgene arm64 platform. Date: Fri, 24 Jan 2014 17:28:03 +0530 Message-Id: <1390564683-3905-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.220.174 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. 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 | 67 ++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c index 5b0bd5f..0ad4b4b 100644 --- a/xen/arch/arm/platforms/xgene-storm.c +++ b/xen/arch/arm/platforms/xgene-storm.c @@ -20,8 +20,17 @@ #include #include +#include +#include #include +#define DT_MATCH_RESET \ + DT_MATCH_COMPATIBLE("apm,xgene-reboot") + +/* 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 +116,62 @@ err: return ret; } +static void xgene_storm_reset(void) +{ + void __iomem *addr; + + addr = ioremap_nocache(reset_addr, reset_size); + + if ( !addr ) + { + printk("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_RESET, + {}, + }; + struct dt_device_node *dev; + int res; + + dev = dt_find_matching_node(NULL, reset_ids); + if ( !dev ) + { + printk("Unable to find a compatible reset node in " + "the device tree"); + return -ENODEV; + } + + 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("Unable to retrieve the base address for reset\n"); + return res; + } + + /* Get reset mask */ + res = dt_property_read_u32(dev, "mask", &reset_mask); + if ( !res ) + { + printk("Unable to retrieve the reset mask\n"); + return res; + } + + return 0; +} static const char * const xgene_storm_dt_compat[] __initconst = { @@ -116,6 +181,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,