From patchwork Thu Feb 26 06:22:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 5888031 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E1557BF440 for ; Thu, 26 Feb 2015 06:23:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EE383201CD for ; Thu, 26 Feb 2015 06:23:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E9329201CE for ; Thu, 26 Feb 2015 06:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753502AbbBZGXB (ORCPT ); Thu, 26 Feb 2015 01:23:01 -0500 Received: from kirsty.vergenet.net ([202.4.237.240]:46531 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753426AbbBZGXA (ORCPT ); Thu, 26 Feb 2015 01:23:00 -0500 Received: from ayumi.isobedori.kobe.vergenet.net (p8130-ipbfp1005kobeminato.hyogo.ocn.ne.jp [118.10.149.130]) by kirsty.vergenet.net (Postfix) with ESMTP id 0C20A2671F1; Thu, 26 Feb 2015 17:22:48 +1100 (EST) Received: by ayumi.isobedori.kobe.vergenet.net (Postfix, from userid 7100) id 84EE6EDEC3C; Thu, 26 Feb 2015 15:22:46 +0900 (JST) From: Simon Horman To: linux-sh@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Magnus Damm , Nobuhiro Iwamatsu , Simon Horman Subject: [PATCH 4/5] ARM: shmobile: Add support SOC_BUS to R-Car Gen2 Date: Thu, 26 Feb 2015 15:22:44 +0900 Message-Id: <3a8e2822e1351c0ef8f9dd1c3e81cd5bfeb319e5.1424931398.git.horms+renesas@verge.net.au> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nobuhiro Iwamatsu This provides information through SOC_BUS to sysfs. And this moves all on-SoC devices from /sys/devices/platform to /sys/devices/socX/. Signed-off-by: Nobuhiro Iwamatsu Acked-by: Geert Uytterhoeven Signed-off-by: Simon Horman --- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 38 ++++++++++++++++++++++++++++---- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 2f36c85..a7f5ab5 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -19,6 +19,7 @@ config ARCH_RCAR_GEN2 bool select PM_RCAR if PM || SMP select RENESAS_IRQC + select SOC_BUS select SYS_SUPPORTS_SH_CMT select PCI_DOMAINS if PCI diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c index 6f290a8..9cc2a90 100644 --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include #include #include "common.h" @@ -206,19 +208,47 @@ void __init rcar_gen2_reserve(void) } #define PRR 0xFF000044 -static unsigned int __init rcar_gen2_get_cut(void) +static u32 __init rcar_gen2_get_prr(void) { void __iomem *addr = ioremap_nocache(PRR, 4); u32 data = ioread32(addr); iounmap(addr); - return (data & 0xFF) + 0x10; + return data; } void __init rcar_gen2_init_machine(void) { - system_rev = rcar_gen2_get_cut(); + struct soc_device_attribute *soc_dev_attr; + struct soc_device *soc_dev; + struct device *parent = NULL; + u32 prr; + + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); + if (!soc_dev_attr) + goto out; + + prr = rcar_gen2_get_prr(); + system_rev = (prr & 0xFF) + 0x10; + + soc_dev_attr->machine = of_flat_dt_get_machine_name(); + soc_dev_attr->family = kasprintf(GFP_KERNEL, "Renesas R-Car Gen2"); + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%u.%u", + system_rev >> 4, system_rev & 0xF); + soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%04x", + (prr & 0x7F00) >> 8); + + soc_dev = soc_device_register(soc_dev_attr); + if (IS_ERR(soc_dev)) { + kfree(soc_dev_attr->family); + kfree(soc_dev_attr->revision); + kfree(soc_dev_attr->soc_id); + kfree(soc_dev_attr); + goto out; + } - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + parent = soc_device_to_device(soc_dev); +out: + of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); }