From patchwork Fri Jan 24 11:48:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 23670 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f197.google.com (mail-gg0-f197.google.com [209.85.161.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 54E2420307 for ; Fri, 24 Jan 2014 11:49:08 +0000 (UTC) Received: by mail-gg0-f197.google.com with SMTP id q3sf3388891gge.4 for ; Fri, 24 Jan 2014 03:49:07 -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=olKxaI7Im4eNyPbWBTntwcTVwu8gRZ2ep3V/8uEjshs=; b=E5LtJJNYFsNgdMrAbJTnaBfvci39/frzadIKnZ315vis6NAXM4XLLQ4wgkN+aoLQHU 3Bjo/SxWDVlqxh1Lvc2AhwUD69k8MMgUKWtylP7iyvxNT7QSoHjYrfg+dXBwHxhZ8jAx 3YEGy2oW8mC8/EdTaSTLOaJaMNytQPo32b/R6ffa+YDUtcyK0Zusn3q5srXmNEoKqh6l LsPdgB4HGEeWU/AuXpeCL08rvrvsg+Q/XTHW3Jqy4VhhWJbkoAxhtwqqtMi5b3p1E0Lv a53esZ/zQynUE8nM0c0RZrQXDcguLuyQm8qsBIHftfj3rMiAX2nNCOmQJ0Y0+HwzbVUE beSA== X-Gm-Message-State: ALoCoQm/hWXWM7FjjydfolENRV3/XZ0wf+TLDzFMXoyWyC6Ji0FYCFyT45BrLNuhlI9icpz+ik3t X-Received: by 10.236.94.113 with SMTP id m77mr4824387yhf.33.1390564147225; Fri, 24 Jan 2014 03:49:07 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.80.98 with SMTP id b89ls589989qgd.9.gmail; Fri, 24 Jan 2014 03:49:07 -0800 (PST) X-Received: by 10.220.188.10 with SMTP id cy10mr2939673vcb.36.1390564147124; Fri, 24 Jan 2014 03:49:07 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id yb7si373814vec.77.2014.01.24.03.49.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 03:49:07 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 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.179; Received: by mail-ve0-f179.google.com with SMTP id jx11so1896517veb.10 for ; Fri, 24 Jan 2014 03:49:07 -0800 (PST) X-Received: by 10.220.76.201 with SMTP id d9mr4463665vck.33.1390564147026; Fri, 24 Jan 2014 03:49:07 -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 u4csp96115vcz; Fri, 24 Jan 2014 03:49:06 -0800 (PST) X-Received: by 10.68.164.4 with SMTP id ym4mr14099612pbb.53.1390564145947; Fri, 24 Jan 2014 03:49:05 -0800 (PST) Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by mx.google.com with ESMTPS id oq9si853039pac.209.2014.01.24.03.49.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 03:49:05 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.42 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=209.85.160.42; Received: by mail-pb0-f42.google.com with SMTP id jt11so3156012pbb.15 for ; Fri, 24 Jan 2014 03:49:05 -0800 (PST) X-Received: by 10.68.196.226 with SMTP id ip2mr13780413pbc.106.1390564145387; Fri, 24 Jan 2014 03:49:05 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id i10sm5621665pat.11.2014.01.24.03.48.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Jan 2014 03:49:04 -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 V3] xen: arm: platforms: Adding reset support for xgene arm64 platform. Date: Fri, 24 Jan 2014 17:18:49 +0530 Message-Id: <1390564129-32611-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.179 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. 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 | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c index 5b0bd5f..986284c 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,65 @@ err: return ret; } +/* + * TODO: Get base address and mask from the device tree + */ +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 mask 0x1 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 +184,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,