From patchwork Fri May 10 02:18:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 16845 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f200.google.com (mail-gh0-f200.google.com [209.85.160.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BDDB3238F7 for ; Fri, 10 May 2013 02:20:14 +0000 (UTC) Received: by mail-gh0-f200.google.com with SMTP id 10sf161077ghy.11 for ; Thu, 09 May 2013 19:19:50 -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=mFlXVU8ETpHem/HfNpUClT9RBm37vYGrdf+N53pcKbs=; b=Es/vVCH6j3XuJIVSTG7UlyiA/7sGL0YRkqyLvWudy0emo3Bmv5zi3huOcI4ejtghE/ 69SQnRz7W+BSc3HvpHGhJB/fU5Ox0Be9rAJrbHe6DFBIyrcUuS9IDofI+CJ9zD+32ZHM ETuoOpN0mREC8tPgbSbz004TV9TTIlbnaeAj+FNguvRPmDK3XjObkmgOQxF9sNI73/tj J9XVIXL3krwQhijuZgAjjgmZv2pBvIJ6Xkdq64EraMnr+G4AaCNz713JSv08RGqh3TQs hGXvGXaaaIvBcpr0HjrmnwBMBlPbLeXh2I0ffBEMtfxurdV00jG3/fsinAbnKEk7DRnQ 4spg== X-Received: by 10.236.93.116 with SMTP id k80mr7267425yhf.32.1368152390184; Thu, 09 May 2013 19:19:50 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.27.231 with SMTP id w7ls1826359qeg.41.gmail; Thu, 09 May 2013 19:19:50 -0700 (PDT) X-Received: by 10.220.177.8 with SMTP id bg8mr9688394vcb.35.1368152389988; Thu, 09 May 2013 19:19:49 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id gs2si335864vdc.89.2013.05.09.19.19.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 May 2013 19:19:49 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 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.170; Received: by mail-vc0-f170.google.com with SMTP id gf12so3304618vcb.15 for ; Thu, 09 May 2013 19:19:49 -0700 (PDT) X-Received: by 10.58.144.170 with SMTP id sn10mr9679210veb.7.1368152389858; Thu, 09 May 2013 19:19:49 -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 hk15csp36244vcb; Thu, 9 May 2013 19:19:49 -0700 (PDT) X-Received: by 10.195.13.75 with SMTP id ew11mr21450175wjd.25.1368152388358; Thu, 09 May 2013 19:19:48 -0700 (PDT) Received: from mail-wg0-x235.google.com (mail-wg0-x235.google.com [2a00:1450:400c:c00::235]) by mx.google.com with ESMTPS id f9si169041wie.113.2013.05.09.19.19.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 May 2013 19:19:48 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::235 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=2a00:1450:400c:c00::235; Received: by mail-wg0-f53.google.com with SMTP id y10so3681420wgg.20 for ; Thu, 09 May 2013 19:19:48 -0700 (PDT) X-Received: by 10.194.61.10 with SMTP id l10mr21362922wjr.32.1368152387975; Thu, 09 May 2013 19:19:47 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id dj7sm597075wib.6.2013.05.09.19.19.46 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 May 2013 19:19:47 -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 V3 33/41] xen/arm: Add versatile express platform Date: Fri, 10 May 2013 03:18:19 +0100 Message-Id: <1368152307-598-34-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1368152307-598-1-git-send-email-julien.grall@linaro.org> References: <1368152307-598-1-git-send-email-julien.grall@linaro.org> X-Gm-Message-State: ALoCoQld/VDhOSu0RCdjn9kJFNWG2P6BDSUh+6IVjX/rz+LM+0o4jf/ITzrJfdx+xBw4Se22v7JS X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 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 v3: - Use ioremap_attr instead of fixmap Changes in v2: - Add TODO to retrieve reset base address in the DT --- xen/arch/arm/platforms/vexpress.c | 43 ++++++++++++++++++++++++++++++ xen/arch/arm/shutdown.c | 14 ---------- xen/include/asm-arm/config.h | 3 --- xen/include/asm-arm/platforms/vexpress.h | 3 +++ 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/xen/arch/arm/platforms/vexpress.c b/xen/arch/arm/platforms/vexpress.c index fd4ce74..9b35e9d 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,47 @@ out: } /* + * TODO: Get base address from the device tree + * See arm,vexpress-reset node + */ +static void vexpress_reset(void) +{ + void __iomem *base; + void __iomem *sp810; + + /* Use the SP810 system controller to force a reset */ + base = ioremap_attr(SP810_ADDRESS & PAGE_MASK, PAGE_SIZE, + PAGE_HYPERVISOR_NOCACHE); + if ( !base ) + { + dprintk(XENLOG_ERR, "Unable to map SP810\n"); + return; + } + + sp810 = base + (SP810_ADDRESS & ~PAGE_MASK); + + /* 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(base); +} + +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