From patchwork Fri Jun 24 09:41:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102097 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp855130qgy; Fri, 24 Jun 2016 02:41:51 -0700 (PDT) X-Received: by 10.98.70.11 with SMTP id t11mr5693691pfa.16.1466761311841; Fri, 24 Jun 2016 02:41:51 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id o90si5902899pfj.121.2016.06.24.02.41.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jun 2016 02:41:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bGNbV-0006Sc-Kb; Fri, 24 Jun 2016 09:40:49 +0000 Received: from mout.kundenserver.de ([217.72.192.73]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bGNac-0004cC-JC for linux-arm-kernel@lists.infradead.org; Fri, 24 Jun 2016 09:39:58 +0000 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0MJTL9-1bEzbk09Wd-0038ah; Fri, 24 Jun 2016 11:39:31 +0200 From: Arnd Bergmann To: Linus Walleij Subject: [PATCH 6/7] ARM: ux500: move soc_id driver to drivers/soc Date: Fri, 24 Jun 2016 11:41:31 +0200 Message-Id: <20160624094132.1852086-7-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160624094132.1852086-1-arnd@arndb.de> References: <20160624094132.1852086-1-arnd@arndb.de> X-Provags-ID: V03:K0:t1CiX6WDP/HttfILM92s3QJiqzHOlUhGYVOfruaxbbHMGS+RivK hl8sCe3kdyFXXYv2NuAu5ZkVYLSVOQq5SC++UdphvadS2BaOySH7idOnp/9jBBjH4CrhRJT gevd67+dvA18xu4cO8ARTWpFvu6W2+rww3/sY6ipryIhDaJ9WZJqpM57pR4rllMltTk3LPM YZAycXQyWlB6UgyWWN8Vg== X-UI-Out-Filterresults: notjunk:1; V01:K0:lwxC6wdcOsU=:xoM+yMz4hMsjNrGBwWn39I CRA9E425LXUFIa4+sAtssEkQB7x7qOJDV1Mgyf9oZ5x5p92dPDHQPpF61wjESH6n4H1oI0tZu XV0zz1gA/Gijl/lZkqYH7kfaPr/yY66sBkYJThAV3ggBjCvfQkzdMZ7ajwEKZt3VMu+Ed6ta1 Da75MRsfauuN6uOLE2ldNPy+S1GxMGk6Ydm5ahsmPa8XWZxyQPzue0c6rYDmR2FCBk1kEEwNq 53twv6vx2zTK4xNG6yjyqbIhRMGlt5k7/uYuyL20sBEVsMcRTq9gafWNsIBuSEnFcNXXv1/Mx ehY2lIpybXJEK/ETgRlzvS6fC7yTnuW6/f9xdd47sFzetB0ikA1RurE2j7bS1fzfSkHXPSrsq X0N6XXTXclCKg+PXVMMSuW3XWsXCv9rvFMGHa1KVgcFsizCVliaESYPPlWsakdnYjpcELqLgv j4VPqdOPIRw7Qrb8JIN3vJQ9W0pAuC+PoCezIbvn7PqSnZc3XIZbeERdqXNUnwX/xHWRb05Nt kjp/eRsCb7QPpqtyK/ZuVPwiUvVNZ9ib0vsUPVekuJJQmo33mel6CbXzIsZ1mSRnE+AkiCQ6o T8p2VxdfP93/CoMlRcsC4VsBRsCOBuC3FO/RaYQ1XBLagEA2g64TYHfAbjqIsiUorH0C6YC9M wVeOl4jZcqhgo7INjsNGBhzoMj9Tsf6ix4ZSjjwqRE6TE/2+IcuZSmTwMoHjyzeICVOs= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160624_023955_020153_7B084373 X-CRM114-Status: GOOD ( 25.76 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [217.72.192.73 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [217.72.192.73 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Lee Jones , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org As the ux500 id code is basically a standalone driver, we can move it out of the arch code into drivers/soc/ux500. This is a user-visible change, as it moves all the devices in sysfs from /sys/devices/soc0/ to /sys/devices/ and leaves the soc0 node as a separate device. Originally the idea was to put all on-chip devices under the soc node, and ux500 was the first platform to have this device, but later platforms almost all didn't follow that pattern, so this makes the platform do the same thing as everyone else. Since the platform is really obsolete now, I am optimistic that nothing will break after moving the devices around. As the SoC driver no longer has access to the private header files, I'm changing the code to instead look up the address of the backupram from devicetree, which is a good idea anyway. Finally, having a separate Kconfig symbol means the driver is now optional and could even be a loadable module rather than always being built-in if we allowed that for soc_device. Signed-off-by: Arnd Bergmann --- arch/arm/mach-ux500/Makefile | 2 +- arch/arm/mach-ux500/cpu-db8500.c | 6 ++-- arch/arm/mach-ux500/setup.h | 2 -- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/ux500/Kconfig | 7 ++++ .../id.c => drivers/soc/ux500/ux500-soc-id.c | 39 +++++++++++++--------- 7 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 drivers/soc/ux500/Kconfig rename arch/arm/mach-ux500/id.c => drivers/soc/ux500/ux500-soc-id.c (86%) -- 2.9.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index ea8893fd128f..753d3eed1985 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -2,7 +2,7 @@ # Makefile for the linux kernel, U8500 machine. # -obj-y := cpu.o id.o pm.o +obj-y := cpu.o pm.o obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o obj-$(CONFIG_MACH_MOP500) += board-mop500-audio.o diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 881cafbc4d97..c9c9832f79e9 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -88,15 +88,13 @@ static const struct of_device_id u8500_local_bus_nodes[] = { static void __init u8500_init_machine(void) { - struct device *parent = ux500_soc_device_init(); - /* automatically probe child nodes of dbx5x0 devices */ if (of_machine_is_compatible("st-ericsson,u8540")) of_platform_populate(NULL, u8500_local_bus_nodes, - u8540_auxdata_lookup, parent); + u8540_auxdata_lookup, NULL); else of_platform_populate(NULL, u8500_local_bus_nodes, - u8500_auxdata_lookup, parent); + u8500_auxdata_lookup, NULL); } static const char * stericsson_dt_platform_compat[] = { diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h index 1e9e7c55df75..85b7819a40ab 100644 --- a/arch/arm/mach-ux500/setup.h +++ b/arch/arm/mach-ux500/setup.h @@ -21,8 +21,6 @@ void ux500_restart(enum reboot_mode mode, const char *cmd); extern void __init ux500_init_irq(void); -extern struct device *ux500_soc_device_init(void); - extern void ux500_cpu_die(unsigned int cpu); #endif /* __ASM_ARCH_SETUP_H */ diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig index 58547f48ebcd..f31bceb69c0d 100644 --- a/drivers/soc/Kconfig +++ b/drivers/soc/Kconfig @@ -9,6 +9,7 @@ source "drivers/soc/samsung/Kconfig" source "drivers/soc/sunxi/Kconfig" source "drivers/soc/tegra/Kconfig" source "drivers/soc/ti/Kconfig" +source "drivers/soc/ux500/Kconfig" source "drivers/soc/versatile/Kconfig" endmenu diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile index b75e3bd0a01e..50c23d0bd457 100644 --- a/drivers/soc/Makefile +++ b/drivers/soc/Makefile @@ -14,4 +14,5 @@ obj-$(CONFIG_SOC_SAMSUNG) += samsung/ obj-$(CONFIG_ARCH_SUNXI) += sunxi/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-$(CONFIG_SOC_TI) += ti/ +obj-$(CONFIG_ARCH_U8500) += ux500/ obj-$(CONFIG_PLAT_VERSATILE) += versatile/ diff --git a/drivers/soc/ux500/Kconfig b/drivers/soc/ux500/Kconfig new file mode 100644 index 000000000000..025a44aef5db --- /dev/null +++ b/drivers/soc/ux500/Kconfig @@ -0,0 +1,7 @@ +config UX500_SOC_ID + bool "SoC bus for ST-Ericsson ux500" + depends on ARCH_U8500 || COMPILE_TEST + default ARCH_U8500 + help + Include support for the SoC bus on the ARM RealView platforms + providing some sysfs information about the ASIC variant. diff --git a/arch/arm/mach-ux500/id.c b/drivers/soc/ux500/ux500-soc-id.c similarity index 86% rename from arch/arm/mach-ux500/id.c rename to drivers/soc/ux500/ux500-soc-id.c index 983004d0fef2..49a811edce25 100644 --- a/arch/arm/mach-ux500/id.c +++ b/drivers/soc/ux500/ux500-soc-id.c @@ -8,8 +8,11 @@ #include #include #include +#include #include #include +#include +#include #include #include @@ -17,10 +20,6 @@ #include #include -#include "setup.h" - -#include "db8500-regs.h" - /** * struct dbx500_asic_id - fields of the ASIC ID * @process: the manufacturing process, 0x40 is 40 nm 0x00 is "standard" @@ -157,27 +156,31 @@ static ssize_t ux500_get_process(struct device *dev, return sprintf(buf, "%02xnm\n", dbx500_id.process); } -static const char *db8500_read_soc_id(void) +static const char *db8500_read_soc_id(struct device_node *backupram) { + void __iomem *base; void __iomem *uid; const char *retstr; - uid = ioremap(U8500_BB_UID_BASE, 0x20); - if (!uid) + base = of_iomap(backupram, 0); + if (!base) return NULL; + uid = base + 0xfc0; + /* Throw these device-specific numbers into the entropy pool */ add_device_randomness(uid, 0x14); retstr = kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x", readl((u32 *)uid+0), readl((u32 *)uid+1), readl((u32 *)uid+2), readl((u32 *)uid+3), readl((u32 *)uid+4)); - iounmap(uid); + iounmap(base); return retstr; } -static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr) +static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr, + struct device_node *backupram) { - soc_dev_attr->soc_id = db8500_read_soc_id(); + soc_dev_attr->soc_id = db8500_read_soc_id(backupram); soc_dev_attr->machine = ux500_get_machine(); soc_dev_attr->family = ux500_get_family(); soc_dev_attr->revision = ux500_get_revision(); @@ -186,28 +189,34 @@ static void __init soc_info_populate(struct soc_device_attribute *soc_dev_attr) static const struct device_attribute ux500_soc_attr = __ATTR(process, S_IRUGO, ux500_get_process, NULL); -struct device * __init ux500_soc_device_init(void) +static int __init ux500_soc_device_init(void) { struct device *parent; struct soc_device *soc_dev; struct soc_device_attribute *soc_dev_attr; + struct device_node *backupram; + + backupram = of_find_compatible_node(NULL, NULL, "ste,dbx500-backupram"); + if (!backupram) + return 0; ux500_setup_id(); soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); if (!soc_dev_attr) - return ERR_PTR(-ENOMEM); + return -ENOMEM; - soc_info_populate(soc_dev_attr); + soc_info_populate(soc_dev_attr, backupram); soc_dev = soc_device_register(soc_dev_attr); if (IS_ERR(soc_dev)) { kfree(soc_dev_attr); - return NULL; + return PTR_ERR(soc_dev); } parent = soc_device_to_device(soc_dev); device_create_file(parent, &ux500_soc_attr); - return parent; + return 0; } +subsys_initcall(ux500_soc_device_init);