From patchwork Tue Feb 11 17:10:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 24479 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B4502203F3 for ; Tue, 11 Feb 2014 17:11:51 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id fp1sf15821461pdb.6 for ; Tue, 11 Feb 2014 09:11:51 -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:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=UbIOrznmNKUeaBbc3kKcNwWfEzKFXhdhHxWUe88TYFs=; b=DcLJP5dPn5uD1HHtXgC59PG5Cw7VAjpTIaV4SMfapxU6LPJrGwV6zDXCE6ftv6G2Sa uCaDkBY4KzGc2GIf87NHS6io2Wdr6PqbX5700UFPTF1r6Vk3ZLtJnlxrFOEnxL5SVqc0 94QLrkeHY+G568pmRV8WoTzcTmPUaD7WjHiAXAmq8tXcRq7NElxORiw/ULX7LkxP9A4s SF/SHlapkpp58wAJLkVgHkWRP0I7cbGYocaxN3UxKsM3CHieB2LWR2UdeHBk77ac3KE1 T2bkPLFVALS9opgWEEgn9ij4UVwDLgJxqy0JnRb9UagBn48hIY/pD2RJEoZRHrcYieVT I+EQ== X-Gm-Message-State: ALoCoQmt5ReOBpBosxE+sqlVAxJLPSZnv/NkQs4fIUSnG8O7KY/vGFSl74NSPB3iOjRlMVILq4S3 X-Received: by 10.66.189.163 with SMTP id gj3mr189804pac.32.1392138710963; Tue, 11 Feb 2014 09:11:50 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.116 with SMTP id g107ls2708993qgg.49.gmail; Tue, 11 Feb 2014 09:11:50 -0800 (PST) X-Received: by 10.221.66.73 with SMTP id xp9mr1977437vcb.27.1392138710815; Tue, 11 Feb 2014 09:11:50 -0800 (PST) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id dc20si6144557vec.42.2014.02.11.09.11.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Feb 2014 09:11:50 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id ik5so6041537vcb.23 for ; Tue, 11 Feb 2014 09:11:50 -0800 (PST) X-Received: by 10.52.183.106 with SMTP id el10mr144936vdc.73.1392138710637; Tue, 11 Feb 2014 09:11:50 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp262267vcz; Tue, 11 Feb 2014 09:11:49 -0800 (PST) X-Received: by 10.68.241.198 with SMTP id wk6mr45895410pbc.11.1392138709577; Tue, 11 Feb 2014 09:11:49 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si19601976pbf.331.2014.02.11.09.11.48; Tue, 11 Feb 2014 09:11:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752018AbaBKRLA (ORCPT + 27 others); Tue, 11 Feb 2014 12:11:00 -0500 Received: from fw-tnat.austin.arm.com ([217.140.110.23]:25825 "EHLO collaborate-mta1.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752279AbaBKRK6 (ORCPT ); Tue, 11 Feb 2014 12:10:58 -0500 Received: from hornet.Cambridge.Arm.com (hornet.cambridge.arm.com [10.2.201.45]) by collaborate-mta1.arm.com (Postfix) with ESMTP id 6D7111401CB; Tue, 11 Feb 2014 11:10:57 -0600 (CST) From: Pawel Moll To: arm@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Pawel Moll Subject: [PATCH 12/12] ARM: vexpress: move HBI check to sysreg driver Date: Tue, 11 Feb 2014 17:10:36 +0000 Message-Id: <1392138636-29240-13-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1392138636-29240-1-git-send-email-pawel.moll@arm.com> References: <1392138636-29240-1-git-send-email-pawel.moll@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: pawel.moll@arm.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 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 Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The last reason for static memory mapping is the HBI (board identification number) check early in the machine code. Moving the check to the sysreg driver makes it possible to completely remove the early mapping and init functions. Signed-off-by: Pawel Moll --- arch/arm/mach-vexpress/v2m.c | 49 ------------------------------------------- drivers/mfd/vexpress-sysreg.c | 30 ++++++++++---------------- include/linux/vexpress.h | 1 - 3 files changed, 11 insertions(+), 69 deletions(-) diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c index d8b419b..38f4f6f 100644 --- a/arch/arm/mach-vexpress/v2m.c +++ b/arch/arm/mach-vexpress/v2m.c @@ -370,53 +370,6 @@ MACHINE_START(VEXPRESS, "ARM-Versatile Express") .init_machine = v2m_init, MACHINE_END -static struct map_desc v2m_rs1_io_desc __initdata = { - .virtual = V2M_PERIPH, - .pfn = __phys_to_pfn(0x1c000000), - .length = SZ_2M, - .type = MT_DEVICE, -}; - -static int __init v2m_dt_scan_memory_map(unsigned long node, const char *uname, - int depth, void *data) -{ - const char **map = data; - - if (strcmp(uname, "motherboard") != 0) - return 0; - - *map = of_get_flat_dt_prop(node, "arm,v2m-memory-map", NULL); - - return 1; -} - -void __init v2m_dt_map_io(void) -{ - const char *map = NULL; - - of_scan_flat_dt(v2m_dt_scan_memory_map, &map); - - if (map && strcmp(map, "rs1") == 0) - iotable_init(&v2m_rs1_io_desc, 1); - else - iotable_init(v2m_io_desc, ARRAY_SIZE(v2m_io_desc)); -} - -void __init v2m_dt_init_early(void) -{ - u32 dt_hbi; - - /* Confirm board type against DT property, if available */ - if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) { - u32 hbi = vexpress_get_hbi(VEXPRESS_SITE_MASTER); - - if (WARN_ON(dt_hbi != hbi)) - pr_warning("vexpress: DT HBI (%x) is not matching " - "hardware (%x)!\n", dt_hbi, hbi); - } -} - - static void __init v2m_dt_init(void) { l2x0_of_init(0x00400000, 0xfe0fffff); @@ -432,7 +385,5 @@ DT_MACHINE_START(VEXPRESS_DT, "ARM-Versatile Express") .dt_compat = v2m_dt_match, .smp = smp_ops(vexpress_smp_dt_ops), .smp_init = smp_init_ops(vexpress_smp_init_ops), - .map_io = v2m_dt_map_io, - .init_early = v2m_dt_init_early, .init_machine = v2m_dt_init, MACHINE_END diff --git a/drivers/mfd/vexpress-sysreg.c b/drivers/mfd/vexpress-sysreg.c index 57c21a0..3eb26e1 100644 --- a/drivers/mfd/vexpress-sysreg.c +++ b/drivers/mfd/vexpress-sysreg.c @@ -44,7 +44,6 @@ #define SYS_CFGSTAT 0x0a8 #define SYS_HBI_MASK 0xfff -#define SYS_ID_HBI_SHIFT 16 #define SYS_PROCIDx_HBI_SHIFT 0 #define SYS_MCI_CARDIN (1 << 0) @@ -98,24 +97,6 @@ u32 vexpress_get_procid(int site) SYS_PROCID0 : SYS_PROCID1)); } -u32 vexpress_get_hbi(int site) -{ - u32 id; - - switch (site) { - case VEXPRESS_SITE_MB: - id = readl(vexpress_sysreg_base() + SYS_ID); - return (id >> SYS_ID_HBI_SHIFT) & SYS_HBI_MASK; - case VEXPRESS_SITE_MASTER: - case VEXPRESS_SITE_DB1: - case VEXPRESS_SITE_DB2: - id = vexpress_get_procid(site); - return (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK; - } - - return ~0; -} - void __iomem *vexpress_get_24mhz_clock_base(void) { return vexpress_sysreg_base() + SYS_24MHZ; @@ -222,6 +203,7 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) struct resource *mem; void __iomem *base; struct bgpio_chip *mmc_gpio_chip; + u32 dt_hbi; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) @@ -233,6 +215,16 @@ static int vexpress_sysreg_probe(struct platform_device *pdev) vexpress_config_set_master(vexpress_sysreg_get_master()); + /* Confirm board type against DT property, if available */ + if (of_property_read_u32(of_allnodes, "arm,hbi", &dt_hbi) == 0) { + u32 id = vexpress_get_procid(VEXPRESS_SITE_MASTER); + u32 hbi = (id >> SYS_PROCIDx_HBI_SHIFT) & SYS_HBI_MASK; + + if (WARN_ON(dt_hbi != hbi)) + dev_warn(&pdev->dev, "DT HBI (%x) is not matching hardware (%x)!\n", + dt_hbi, hbi); + } + /* * Duplicated SYS_MCI pseudo-GPIO controller for compatibility with * older trees using sysreg node for MMC control lines. diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h index 0aee1b9..06e1ab8 100644 --- a/include/linux/vexpress.h +++ b/include/linux/vexpress.h @@ -60,7 +60,6 @@ struct regmap *devm_regmap_init_vexpress_config(struct device *dev); unsigned int vexpress_get_mci_cardin(struct device *dev); u32 vexpress_get_procid(int site); -u32 vexpress_get_hbi(int site); void *vexpress_get_24mhz_clock_base(void); void vexpress_flags_set(u32 data);