From patchwork Mon Apr 28 17:57:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawel Moll X-Patchwork-Id: 29267 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5AEEF20553 for ; Mon, 28 Apr 2014 18:01:50 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id lx4sf43063327iec.3 for ; Mon, 28 Apr 2014 11:01:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=O41yHhX9iqSP+VjV+LQmYUyncVgLhEcqGN+X71e7aZg=; b=FrBxh8KKtl1rDVxFmkqHnilupTTmbRsYj8ueVLodz2GkZf8gc3iLgJs30kgDN79669 CId+5fl9H8xMCPbAojJXw3FffsOPBdIcqqOW9Vu7vFxVKTS2qp+TGwghiLFUr4Oaj2AK U/o1urReeqXQTFk/cptESvLbStjorWFVIhW2msle2sTO2RjmRvFWGw4dj7KuO6pOAg7d d8VuaTZ/d8hImJYzLK5ZgAwEwcbKD8t9KSAh0go11Mnf+o1tF7+ypfLosZ1jmStFAtDR acFUU1Y5QQSzV00RcGECR+BKvIocR7bnBLect/azt8D3HKw7yGQhhn+aAphlswhfqLLY adVw== X-Gm-Message-State: ALoCoQkzVIeLikOUy/ouXoA5EIP5l8ReZS4dEv8Yrd2ENbKLQqVXjAWr1Bxn+hNPUYrO/wOFh9F8 X-Received: by 10.182.106.229 with SMTP id gx5mr13983980obb.31.1398708109774; Mon, 28 Apr 2014 11:01:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.54 with SMTP id b51ls986458qgf.48.gmail; Mon, 28 Apr 2014 11:01:49 -0700 (PDT) X-Received: by 10.220.133.197 with SMTP id g5mr24909834vct.20.1398708109642; Mon, 28 Apr 2014 11:01:49 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id s7si3824896vev.110.2014.04.28.11.01.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Apr 2014 11:01:49 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oy12so8688102veb.32 for ; Mon, 28 Apr 2014 11:01:49 -0700 (PDT) X-Received: by 10.52.175.166 with SMTP id cb6mr20910927vdc.1.1398708109566; Mon, 28 Apr 2014 11:01:49 -0700 (PDT) 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.221.72 with SMTP id ib8csp136162vcb; Mon, 28 Apr 2014 11:01:43 -0700 (PDT) X-Received: by 10.140.29.34 with SMTP id a31mr11311042qga.95.1398708103332; Mon, 28 Apr 2014 11:01:43 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id k47si2151356qgd.52.2014.04.28.11.01.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Apr 2014 11:01:43 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WepqP-000492-En; Mon, 28 Apr 2014 17:59:57 +0000 Received: from fw-tnat.austin.arm.com ([217.140.110.23] helo=collaborate-mta1.arm.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WeppI-000363-B9 for linux-arm-kernel@lists.infradead.org; Mon, 28 Apr 2014 17:58:49 +0000 Received: from hornet.Cambridge.Arm.com (hornet.cambridge.arm.com [10.2.201.45]) by collaborate-mta1.arm.com (Postfix) with ESMTP id F38CD13FF26; Mon, 28 Apr 2014 12:58:15 -0500 (CDT) From: Pawel Moll To: Grant Likely , Rob Herring , Samuel Ortiz , Lee Jones , Arnd Bergmann , Greg Kroah-Hartman , Russell King Subject: [PATCH 09/10] ARM: vexpress: move HBI check to sysreg driver Date: Mon, 28 Apr 2014 18:57:56 +0100 Message-Id: <1398707877-22596-10-git-send-email-pawel.moll@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1398707877-22596-1-git-send-email-pawel.moll@arm.com> References: <1398707877-22596-1-git-send-email-pawel.moll@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140428_105848_515935_0073B9E9 X-CRM114-Status: GOOD ( 16.24 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: arm@kernel.org, Pawel Moll , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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 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 Acked-by: Lee Jones --- 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 952df84..9e21e4f 100644 --- a/drivers/mfd/vexpress-sysreg.c +++ b/drivers/mfd/vexpress-sysreg.c @@ -45,7 +45,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) @@ -99,24 +98,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; @@ -229,6 +210,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) @@ -240,6 +222,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 46636e3..a4c9547 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);