From patchwork Fri May 10 15:12:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 16868 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 87865238F6 for ; Fri, 10 May 2013 15:13:33 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id jz10sf5242345veb.0 for ; Fri, 10 May 2013 08:13:07 -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=7oPIqnjyF+ezcvR55xn3Un7gc5r5SqHyB9HifHVuwnc=; b=f4joL7fFsOi26e7nq3+AssHx+Ow79a0pvb70OidYohK0JZrUjpqb+Rx8ovVxkopZAM A7412AZwesXqtd8lJuzJgiPwaQ0BdGKdQaelEq35e56Z8j5//NvZRxQgtDiWFqQ+LHvR 2DUw1IRMlBEpPs0j9MC1osOul70bBy42j6jvuMKslYafSkALJWpyCk0L61vofgt7kPdA sekFfo7zfVtBlBg7pey4loLyZtMqL5uW4P0m4w2TVZcDaK64Q/PkbyOBR2WQk/cX61Pa M8XjUrjaThOJ9QdjpfDOUOmYVULI/xYKIpBEb6y26oExTx9e4z8ZRjbbvcxRnASPzRfC ZjjA== X-Received: by 10.224.130.195 with SMTP id u3mr12316600qas.1.1368198787544; Fri, 10 May 2013 08:13:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.196 with SMTP id 4ls1835201qeg.96.gmail; Fri, 10 May 2013 08:13:07 -0700 (PDT) X-Received: by 10.58.133.81 with SMTP id pa17mr11398912veb.37.1368198787237; Fri, 10 May 2013 08:13:07 -0700 (PDT) Received: from mail-ve0-x22e.google.com (mail-ve0-x22e.google.com [2607:f8b0:400c:c01::22e]) by mx.google.com with ESMTPS id bs2si1459327veb.32.2013.05.10.08.13.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 May 2013 08:13:07 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22e 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::22e; Received: by mail-ve0-f174.google.com with SMTP id pb11so3893659veb.19 for ; Fri, 10 May 2013 08:13:07 -0700 (PDT) X-Received: by 10.52.175.200 with SMTP id cc8mr9731912vdc.94.1368198787080; Fri, 10 May 2013 08:13:07 -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 hk15csp59294vcb; Fri, 10 May 2013 08:13:06 -0700 (PDT) X-Received: by 10.180.90.43 with SMTP id bt11mr168526wib.30.1368198766007; Fri, 10 May 2013 08:12:46 -0700 (PDT) Received: from mail-wi0-x22f.google.com (mail-wi0-x22f.google.com [2a00:1450:400c:c05::22f]) by mx.google.com with ESMTPS id l7si773135wjr.163.2013.05.10.08.12.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 May 2013 08:12:46 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::22f is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=2a00:1450:400c:c05::22f; Received: by mail-wi0-f175.google.com with SMTP id h11so739816wiv.14 for ; Fri, 10 May 2013 08:12:45 -0700 (PDT) X-Received: by 10.180.183.133 with SMTP id em5mr4564129wic.26.1368198761207; Fri, 10 May 2013 08:12:41 -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.39 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 10 May 2013 08:12:40 -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 30/32] xen/arm: Add platform specific code for the exynos5 Date: Fri, 10 May 2013 16:12:03 +0100 Message-Id: <1368198723-24639-12-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: ALoCoQn33WclQEr4Wy802hAFeRvEO47Pj7OoFQaB5L8aHsOiZBIN1mTnNZO+9mtEHGaoaGpTjVlq X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22e 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: , Signed-off-by: Julien Grall Acked-by: Ian Campbell Changes in v4: - Use ioremap_nocache instead of ioremap_attr(..., PAGE_HYPERVISOR_NOCACHE) Changes in v3: - Remove hard tab - Typoes - Replace platform_{read,write} call to ioremap_attr, ioreadl, iowritel Changes in v2: - Add dom0 1:1 mapping quirk for the arndale board - s/mapping/mappings/ in comment - Remove debug trap (unnecessary with linux 3.9) --- xen/arch/arm/platforms/Makefile | 1 + xen/arch/arm/platforms/exynos5.c | 110 +++++++++++++++++++++++++++++++ xen/include/asm-arm/platforms/exynos5.h | 39 +++++++++++ 3 files changed, 150 insertions(+) create mode 100644 xen/arch/arm/platforms/exynos5.c create mode 100644 xen/include/asm-arm/platforms/exynos5.h diff --git a/xen/arch/arm/platforms/Makefile b/xen/arch/arm/platforms/Makefile index 4313e95..ff2b65b 100644 --- a/xen/arch/arm/platforms/Makefile +++ b/xen/arch/arm/platforms/Makefile @@ -1 +1,2 @@ obj-y += vexpress.o +obj-y += exynos5.o diff --git a/xen/arch/arm/platforms/exynos5.c b/xen/arch/arm/platforms/exynos5.c new file mode 100644 index 0000000..1368a04 --- /dev/null +++ b/xen/arch/arm/platforms/exynos5.c @@ -0,0 +1,110 @@ +/* + * xen/arch/arm/platforms/exynos5.c + * + * Exynos5 specific settings + * + * Julien Grall + * Copyright (c) 2013 Linaro Limited. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static int exynos5_init_time(void) +{ + uint32_t reg; + void __iomem *mct; + + BUILD_BUG_ON(EXYNOS5_MCT_G_TCON >= PAGE_SIZE); + + mct = ioremap_attr(EXYNOS5_MCT_BASE, PAGE_SIZE, PAGE_HYPERVISOR_NOCACHE); + if ( !mct ) + { + dprintk(XENLOG_ERR, "Unable to map MCT\n"); + return -ENOMEM; + } + + /* Enable timer on Exynos 5250 should probably be done by u-boot */ + reg = ioreadl(mct + EXYNOS5_MCT_G_TCON); + iowritel(mct + EXYNOS5_MCT_G_TCON, reg | EXYNOS5_MCT_G_TCON_START); + + iounmap(mct); + + return 0; +} + +/* Additional mappings for dom0 (Not in the DTS) */ +static int exynos5_specific_mapping(struct domain *d) +{ + /* Map the chip ID */ + map_mmio_regions(d, EXYNOS5_PA_CHIPID, EXYNOS5_PA_CHIPID + PAGE_SIZE - 1, + EXYNOS5_PA_CHIPID); + + /* Map the PWM region */ + map_mmio_regions(d, EXYNOS5_PA_TIMER, + EXYNOS5_PA_TIMER + (PAGE_SIZE * 2) - 1, + EXYNOS5_PA_TIMER); + + return 0; +} + +static void exynos5_reset(void) +{ + void __iomem *pmu; + + BUILD_BUG_ON(EXYNOS5_SWRESET >= PAGE_SIZE); + + pmu = ioremap_nocache(EXYNOS5_PA_PMU, PAGE_SIZE); + if ( !pmu ) + { + dprintk(XENLOG_ERR, "Unable to map PMU\n"); + return; + } + + iowritel(pmu + EXYNOS5_SWRESET, 1); + iounmap(pmu); +} + +static uint32_t exynos5_quirks(void) +{ + return PLATFORM_QUIRK_DOM0_MAPPING_11; +} + +static const char const *exynos5_dt_compat[] __initdata = +{ + "samsung,exynos5250", + NULL +}; + +PLATFORM_START(exynos5, "SAMSUNG EXYNOS5") + .compatible = exynos5_dt_compat, + .init_time = exynos5_init_time, + .specific_mapping = exynos5_specific_mapping, + .reset = exynos5_reset, + .quirks = exynos5_quirks, +PLATFORM_END + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/include/asm-arm/platforms/exynos5.h b/xen/include/asm-arm/platforms/exynos5.h new file mode 100644 index 0000000..ee5bdfa --- /dev/null +++ b/xen/include/asm-arm/platforms/exynos5.h @@ -0,0 +1,39 @@ +#ifndef __ASM_ARM_PLATFORMS_EXYNOS5_H +#define __ASM_ASM_PLATFORMS_EXYSNO5_H + +#define EXYNOS5_MCT_BASE 0x101c0000 +#define EXYNOS5_MCT_G_TCON 0x240 /* Relative to MCT_BASE */ +#define EXYNOS5_MCT_G_TCON_START (1 << 8) + +#define EXYNOS5_PA_CHIPID 0x10000000 +#define EXYNOS5_PA_TIMER 0x12dd0000 +/* Base address of system controller */ +#define EXYNOS5_PA_PMU 0x10040000 + +#define EXYNOS5_SWRESET 0x0400 /* Relative to PA_PMU */ + +#define S5P_PA_SYSRAM 0x02020000 + +/* Constants below is only used in assembly because the DTS is not yet parsed */ +#ifdef __ASSEMBLY__ + +/* GIC Base Address */ +#define EXYNOS5_GIC_BASE_ADDRESS 0x10480000 + +/* Timer's frequency */ +#define EXYNOS5_TIMER_FREQUENCY (24 * 1000 * 1000) /* 24 MHz */ + +/* Arndale machine ID */ +#define MACH_TYPE_SMDK5250 3774 + +#endif /* __ASSEMBLY__ */ + +#endif /* __ASM_ARM_PLATFORMS_EXYNOS5_H */ +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */