From patchwork Fri May 10 15:12:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 16869 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8D004238F6 for ; Fri, 10 May 2013 15:18:34 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id l18sf4117467wgh.8 for ; Fri, 10 May 2013 08:18:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=QuJ3b+BpaS8Ir9xlK8rtGvvFrw5TP98SgDyCmTrHUTc=; b=jVkWO9Edp15sMePpKCAqt/dPGjjY3W7/2tFuvUXkNSXXBcuHetEl3hNsRNsYFWaO0j NvfrURmZok/qY8udYESeod5qDzo64XkfJOWa+RgJt4EfnEbiR75I8CizQ9UNKgnJqP5I Bjan3eX0SDq7zhdnJkoAtzAqRXIWuby/ZBRqn0oAs0DNPq2kod/6oDOwKS2yDn7d8VOR cKTzRPTarrgSWJ1vSQlicui0XvWfcnAqH6j6RPnCsUyG8qSOv7ck0BhzY5CYQh5OBMwR VN3ZFxho3hu7g5Es3pws4pGrp5QJ1/QeGKwAZmwyuKiWHabi2B4qkJY1wfaT7WIOyKGA +Qtw== X-Received: by 10.180.85.5 with SMTP id d5mr900598wiz.0.1368199088057; Fri, 10 May 2013 08:18:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.183.237 with SMTP id ep13ls191960wic.2.gmail; Fri, 10 May 2013 08:18:08 -0700 (PDT) X-Received: by 10.180.109.80 with SMTP id hq16mr4590459wib.26.1368199087983; Fri, 10 May 2013 08:18:07 -0700 (PDT) Received: from mail-ve0-x234.google.com (mail-ve0-x234.google.com [2607:f8b0:400c:c01::234]) by mx.google.com with ESMTPS id x12si791579wjw.37.2013.05.10.08.18.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 May 2013 08:18:07 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::234 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::234; Received: by mail-ve0-f180.google.com with SMTP id pa12so3931304veb.39 for ; Fri, 10 May 2013 08:18:06 -0700 (PDT) X-Received: by 10.58.227.104 with SMTP id rz8mr11332818vec.22.1368199086794; Fri, 10 May 2013 08:18:06 -0700 (PDT) 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.217.15 with SMTP id hk15csp59461vcb; Fri, 10 May 2013 08:18:05 -0700 (PDT) X-Received: by 10.194.61.10 with SMTP id l10mr25423901wjr.32.1368199085384; Fri, 10 May 2013 08:18:05 -0700 (PDT) Received: from mail-wg0-x229.google.com (mail-wg0-x229.google.com [2a00:1450:400c:c00::229]) by mx.google.com with ESMTPS id y16si801085wij.40.2013.05.10.08.18.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 May 2013 08:18:05 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::229 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=2a00:1450:400c:c00::229; Received: by mail-wg0-f41.google.com with SMTP id y10so777302wgg.0 for ; Fri, 10 May 2013 08:18:04 -0700 (PDT) X-Received: by 10.194.178.74 with SMTP id cw10mr23129021wjc.22.1368198757988; Fri, 10 May 2013 08:12:37 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id e8sm4080359wic.5.2013.05.10.08.12.36 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 May 2013 08:12:37 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: Stefano.Stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, Julien Grall Subject: [PATCH V4 24/32] xen/arm: Add versatile express platform Date: Fri, 10 May 2013 16:12:01 +0100 Message-Id: <1368198723-24639-10-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1368198723-24639-1-git-send-email-julien.grall@linaro.org> References: <1368198723-24639-1-git-send-email-julien.grall@linaro.org> X-Gm-Message-State: ALoCoQlOoU96D+JplDsAZh23kM19guZmDLpYbEB4mgKyL8RyKjed4CclnITvasWskl3arc5zgdKf X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::234 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 platform contains nearly nothing specific except the reset function. Signed-off-by: Julien Grall Changes in v4: - Use ioremap_nocache - Directly give SP810_ADDRESS without page alignment Changes in v3: - Use ioremap_attr instead of fixmap Changes in v2: - Add TODO to retrieve reset base address in the DT Acked-by: Ian Campbell --- xen/arch/arm/platforms/vexpress.c | 40 ++++++++++++++++++++++++++++++ xen/arch/arm/shutdown.c | 14 ----------- xen/include/asm-arm/config.h | 3 --- xen/include/asm-arm/platforms/vexpress.h | 3 +++ 4 files changed, 43 insertions(+), 17 deletions(-) diff --git a/xen/arch/arm/platforms/vexpress.c b/xen/arch/arm/platforms/vexpress.c index fd4ce74..8fc30c4 100644 --- a/xen/arch/arm/platforms/vexpress.c +++ b/xen/arch/arm/platforms/vexpress.c @@ -18,7 +18,9 @@ */ #include +#include #include +#include #define DCC_SHIFT 26 #define FUNCTION_SHIFT 20 @@ -91,6 +93,44 @@ out: } /* + * TODO: Get base address from the device tree + * See arm,vexpress-reset node + */ +static void vexpress_reset(void) +{ + void __iomem *sp810; + + /* Use the SP810 system controller to force a reset */ + sp810 = ioremap_nocache(SP810_ADDRESS, PAGE_SIZE); + + if ( !sp810 ) + { + dprintk(XENLOG_ERR, "Unable to map SP810\n"); + return; + } + + /* switch to slow mode */ + iowritel(sp810, 0x3); + dsb(); isb(); + /* writing any value to SCSYSSTAT reg will reset the system */ + iowritel(sp810 + 4, 0x1); + dsb(); isb(); + + iounmap(sp810); +} + +static const char const *vexpress_dt_compat[] __initdata = +{ + "arm,vexpress", + NULL +}; + +PLATFORM_START(vexpress, "VERSATILE EXPRESS") + .compatible = vexpress_dt_compat, + .reset = vexpress_reset, +PLATFORM_END + +/* * Local variables: * mode: C * c-file-style: "BSD" diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c index 0903842..767cc12 100644 --- a/xen/arch/arm/shutdown.c +++ b/xen/arch/arm/shutdown.c @@ -3,25 +3,11 @@ #include #include #include -#include #include #include static void raw_machine_reset(void) { - /* XXX get this from device tree */ -#ifdef SP810_ADDRESS - /* Use the SP810 system controller to force a reset */ - volatile uint32_t *sp810; - set_fixmap(FIXMAP_MISC, SP810_ADDRESS >> PAGE_SHIFT, DEV_SHARED); - sp810 = ((uint32_t *) - (FIXMAP_ADDR(FIXMAP_MISC) + (SP810_ADDRESS & ~PAGE_MASK))); - sp810[0] = 0x3; /* switch to slow mode */ - dsb(); isb(); - sp810[1] = 0x1; /* writing any value to SCSYSSTAT reg will reset system */ - dsb(); isb(); - clear_fixmap(FIXMAP_MISC); -#endif platform_reset(); } diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h index 8ed72f5..7599202 100644 --- a/xen/include/asm-arm/config.h +++ b/xen/include/asm-arm/config.h @@ -149,9 +149,6 @@ extern unsigned long frametable_virt_end; #define GIC_CR_OFFSET 0x2000 #define GIC_HR_OFFSET 0x4000 /* Guess work http://lists.infradead.org/pipermail/linux-arm-kernel/2011-September/064219.html */ #define GIC_VR_OFFSET 0x6000 /* Virtual Machine CPU interface) */ -/* Board-specific: base address of system controller */ -#define SP810_ADDRESS 0x1C020000 - #endif /* __ARM_CONFIG_H__ */ /* diff --git a/xen/include/asm-arm/platforms/vexpress.h b/xen/include/asm-arm/platforms/vexpress.h index 67f8fef..5cf3aba 100644 --- a/xen/include/asm-arm/platforms/vexpress.h +++ b/xen/include/asm-arm/platforms/vexpress.h @@ -23,6 +23,9 @@ #define V2M_SYS_CFG_OSC4 4 #define V2M_SYS_CFG_OSC5 5 +/* Board-specific: base address of system controller */ +#define SP810_ADDRESS 0x1C020000 + #ifndef __ASSEMBLY__ #include