From patchwork Mon Jan 27 11:34:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 23744 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0888320300 for ; Mon, 27 Jan 2014 11:35:04 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wo20sf22038754obc.3 for ; Mon, 27 Jan 2014 03:35:03 -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=2p62Br783ACLmzP6HRdwT2/nG8RVUS149dvATghBR/M=; b=PPWvnQn7GBCab9MDgJUkdpuSu0kY3z8R24zDtRVi/IuYVHzrrW+gFcVNqYt4bZLQAF 5Yiyo5wm2nbsyYcNHEi5RtDP0G168m6qNDy1n+QsOk763+WxZGqVkUSdtPKRJH1W6plP c01REOB349/TifYA7zDhs/+07acmcupx5fh4FYk1kAx/JA+7dL3Wovb98w6mLZA+Jb8x +drHOLxGujBUtcX5h5EGb/SxCvyBXFO1WfQVtjPMEucyBhzV9cfRG64Vr1BehtkeQ8jB 3edLtjELjUwvn80H5psFZ5+wjNZDC3WzK9Dg+XGijVa0mLbVjc3h80kxlU8tQZHOYWkP ufdA== X-Gm-Message-State: ALoCoQlS0BDt0uW+h0hVZa7PUyZywU1KdlF7G7VzLm3eUrRURqfKSMSG6F9wIu4dq0OH88s1Lihs X-Received: by 10.182.104.70 with SMTP id gc6mr10460780obb.35.1390822503926; Mon, 27 Jan 2014 03:35:03 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.71 with SMTP id c65ls1598381qge.4.gmail; Mon, 27 Jan 2014 03:35:03 -0800 (PST) X-Received: by 10.58.229.164 with SMTP id sr4mr15385375vec.18.1390822503796; Mon, 27 Jan 2014 03:35:03 -0800 (PST) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id sg4si1495972vdc.118.2014.01.27.03.35.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 03:35:03 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.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.220.175; Received: by mail-vc0-f175.google.com with SMTP id ij19so3284410vcb.20 for ; Mon, 27 Jan 2014 03:35:03 -0800 (PST) X-Received: by 10.58.90.202 with SMTP id by10mr15006526veb.6.1390822503724; Mon, 27 Jan 2014 03:35:03 -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 u4csp122562vcz; Mon, 27 Jan 2014 03:35:03 -0800 (PST) X-Received: by 10.66.228.37 with SMTP id sf5mr29625942pac.19.1390822502526; Mon, 27 Jan 2014 03:35:02 -0800 (PST) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by mx.google.com with ESMTPS id x3si11117980pbf.121.2014.01.27.03.35.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 03:35:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.42 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=209.85.220.42; Received: by mail-pa0-f42.google.com with SMTP id kl14so5850076pab.1 for ; Mon, 27 Jan 2014 03:35:02 -0800 (PST) X-Received: by 10.66.122.201 with SMTP id lu9mr29441992pab.40.1390822501982; Mon, 27 Jan 2014 03:35:01 -0800 (PST) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id vg1sm31092137pbc.44.2014.01.27.03.34.58 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Jan 2014 03:35:01 -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 V6] xen: arm: platforms: Adding reset support for xgene arm64 platform. Date: Mon, 27 Jan 2014 17:04:48 +0530 Message-Id: <1390822488-22183-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.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. V6: - Incorporating comments received on V5 patch. 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 Acked-by: Ian Campbell --- xen/arch/arm/platforms/xgene-storm.c | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c index 5b0bd5f..4fc185b 100644 --- a/xen/arch/arm/platforms/xgene-storm.c +++ b/xen/arch/arm/platforms/xgene-storm.c @@ -20,8 +20,16 @@ #include #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 bool reset_vals_valid = false; + static uint32_t xgene_storm_quirks(void) { return PLATFORM_QUIRK_GIC_64K_STRIDE; @@ -107,6 +115,68 @@ err: return ret; } +static void xgene_storm_reset(void) +{ + void __iomem *addr; + + if ( !reset_vals_valid ) + { + printk("XGENE: Invalid reset values, can not reset XGENE...\n"); + return; + } + + addr = ioremap_nocache(reset_addr, reset_size); + + if ( !addr ) + { + printk("XGENE: Unable to map xgene reset address, can not reset XGENE...\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; + } + + reset_vals_valid = true; + return 0; +} static const char * const xgene_storm_dt_compat[] __initconst = { @@ -116,6 +186,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,