From patchwork Fri Feb 6 01:33:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nobuhiro Iwamatsu X-Patchwork-Id: 5787951 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7F4429F302 for ; Fri, 6 Feb 2015 01:33:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA85920219 for ; Fri, 6 Feb 2015 01:33:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CC6EC201FB for ; Fri, 6 Feb 2015 01:33:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753907AbbBFBdZ (ORCPT ); Thu, 5 Feb 2015 20:33:25 -0500 Received: from mail-pd0-f182.google.com ([209.85.192.182]:36055 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753724AbbBFBdZ (ORCPT ); Thu, 5 Feb 2015 20:33:25 -0500 Received: by pdjp10 with SMTP id p10so1265473pdj.3 for ; Thu, 05 Feb 2015 17:33:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=2wXMDFptZ61UbMqLctikM6XccCzhYQsmdOY3f918q/8=; b=P6qoh553Cr9gXu4kw4Moe6iROmm4WG1AVIoBxzYqXDbG94M9zcbEfEfH+zNURTjiDP Bt3beNEbbCqzLono39QA/2HjRrjgU4E587ypRzttpo3p2+L9j1gQ9AllwBsI1heKac3m yPh3H5LjRr8ncPYX793lkkeYXTVo/PT3AQvPmjyIruID27n37xIkqi66D8oEydpKE9T+ p275TUxY7GFHJopFpI5HLiX7Xqp7egOmdrln1bJF4tfX06pHfoQFGQh8Lc2EK+Uh5Nwl oIzkB1+OhphDFYrC4J7PIx3twbzOwgaPrwH7olREoYZcTy41cOns7p++5LrbXCu3sbGz ikcw== X-Gm-Message-State: ALoCoQlp56lvc0xPgya40SxppnxObGZjpkGj7KLS/+9HT61XEZ/C9jhloJ1ix7GAciPPC+ua+znq X-Received: by 10.70.128.202 with SMTP id nq10mr1635429pdb.45.1423186404569; Thu, 05 Feb 2015 17:33:24 -0800 (PST) Received: from xps-iwamatsu.renesas.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id pf10sm6220981pbc.82.2015.02.05.17.33.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Feb 2015 17:33:23 -0800 (PST) From: Nobuhiro Iwamatsu To: horms+renesas@verge.net.au Cc: linux-sh@vger.kernel.org, Nobuhiro Iwamatsu Subject: [PATCH 2/2] ARM: shmobile: Add support SOC_BUS to R-Car Gen2 Date: Fri, 6 Feb 2015 10:33:09 +0900 Message-Id: <1423186389-12861-2-git-send-email-nobuhiro.iwamatsu.yj@renesas.com> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1423186389-12861-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com> References: <1423186389-12861-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com> 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=ham 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 This provides information through SOC_BUS to sysfs. Signed-off-by: Nobuhiro Iwamatsu --- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 42 +++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig index 0ebe727..bf33915 100644 --- a/arch/arm/mach-shmobile/Kconfig +++ b/arch/arm/mach-shmobile/Kconfig @@ -18,6 +18,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 2230948..0fa3ef8 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" @@ -204,19 +206,53 @@ void __init rcar_gen2_reserve(void) } #define PRR 0xFF000044 -static unsigned int __init rcar_gen2_get_revision(void) +static unsigned int __init rcar_gen2_get_prr(void) { void __iomem *addr = ioremap_nocache(PRR, 4); u32 data = ioread32(addr); iounmap(addr); - return ((data & 0xF0) >> 4) + 1; + return data; +} + +static unsigned int __init rcar_gen2_get_revision(void) +{ + return ((rcar_gen2_get_prr() & 0xF0) >> 4) + 1; +} + +static u32 __init rcar_gen2_get_cpuid(void) +{ + return (rcar_gen2_get_prr() & 0x7F00) >> 8; } void __init rcar_gen2_init_machine(void) { + struct soc_device_attribute *soc_dev_attr; + struct soc_device *soc_dev; + struct device *parent = NULL; + + soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); + if (!soc_dev_attr) + goto out; + system_rev = rcar_gen2_get_revision(); - of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + soc_dev_attr->family = kasprintf(GFP_KERNEL, "Renesas R-Car Gen2"); + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "%d", system_rev); + soc_dev_attr->soc_id = kasprintf(GFP_KERNEL, "%04x", + rcar_gen2_get_cpuid()); + + 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; + } + + parent = soc_device_to_device(soc_dev); +out: + of_platform_populate(NULL, of_default_bus_match_table, NULL, parent); }