From patchwork Fri Feb 6 01:33:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nobuhiro Iwamatsu X-Patchwork-Id: 5787941 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 232A59F302 for ; Fri, 6 Feb 2015 01:33:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 313DA20219 for ; Fri, 6 Feb 2015 01:33:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01255201FB for ; Fri, 6 Feb 2015 01:33:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753700AbbBFBdV (ORCPT ); Thu, 5 Feb 2015 20:33:21 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:63823 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752550AbbBFBdU (ORCPT ); Thu, 5 Feb 2015 20:33:20 -0500 Received: by mail-pa0-f50.google.com with SMTP id rd3so13618842pab.9 for ; Thu, 05 Feb 2015 17:33:20 -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; bh=892KFFCuXeoa4Xg0YhYpkxa2I+pVJOm/URmH3c3m3Tc=; b=mlzHhBiwxrfQJihlvHAoh148Cs3sNTlngEVCFUzqK0Eo0tRxkxJDSbI3bkDjIo/sM2 PbYIIAlZagZkA/heJpksXqOQc4g0kU4wTGGA1nzo0EKjIzvyMS1YCWqrx1cLREb71pBu OlT03tAQxHzaFK1cMndHngAus+SpsURD87moEi5fJVOjtN8f1s52yySEpgsCusRAERrO S2Do3a2FkcTNvqwmtD1buRBN/Z8TFxbua1IVGnzzD38Jlk8Wj/zUYTV4f3NCrfKrsDzh aFoDkt3VdRu0eTnKNFxzKmKqHZrG4v/nt6akKz9yyRyEvFwIaSMdX4yIdbU+qKm8wG/U HPaQ== X-Gm-Message-State: ALoCoQnNvZtKdnI4+CrEbU9Nex0rCJOllXCrztUmpdGsPniy8S+q3WULvthl/Xi+aKFVMl3neMcC X-Received: by 10.69.25.6 with SMTP id im6mr1617312pbd.37.1423186400291; Thu, 05 Feb 2015 17:33:20 -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.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Feb 2015 17:33:18 -0800 (PST) From: Nobuhiro Iwamatsu To: horms+renesas@verge.net.au Cc: linux-sh@vger.kernel.org, Nobuhiro Iwamatsu Subject: [PATCH 1/2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2 Date: Fri, 6 Feb 2015 10:33:08 +0900 Message-Id: <1423186389-12861-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com> X-Mailer: git-send-email 2.1.3 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 SoCs of R-Car Gen2 have some revision. This adds function to get SoCs revision data, and change so that user can confirm from /proc/cpuinfo. Signed-off-by: Nobuhiro Iwamatsu --- arch/arm/mach-shmobile/rcar-gen2.h | 1 + arch/arm/mach-shmobile/setup-r8a7790.c | 1 + arch/arm/mach-shmobile/setup-r8a7791.c | 1 + arch/arm/mach-shmobile/setup-r8a7794.c | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 21 +++++++++++++++++++++ 5 files changed, 25 insertions(+) diff --git a/arch/arm/mach-shmobile/rcar-gen2.h b/arch/arm/mach-shmobile/rcar-gen2.h index ce53cb5..b232956 100644 --- a/arch/arm/mach-shmobile/rcar-gen2.h +++ b/arch/arm/mach-shmobile/rcar-gen2.h @@ -5,5 +5,6 @@ void rcar_gen2_timer_init(void); #define MD(nr) BIT(nr) u32 rcar_gen2_read_mode_pins(void); void rcar_gen2_reserve(void); +void __init rcar_gen2_init_machine(void); #endif /* __ASM_RCAR_GEN2_H__ */ diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c index 3a18af4..8d26ab0 100644 --- a/arch/arm/mach-shmobile/setup-r8a7790.c +++ b/arch/arm/mach-shmobile/setup-r8a7790.c @@ -30,6 +30,7 @@ static const char * const r8a7790_boards_compat_dt[] __initconst = { DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)") .smp = smp_ops(r8a7790_smp_ops), .init_early = shmobile_init_delay, + .init_machine = rcar_gen2_init_machine, .init_time = rcar_gen2_timer_init, .init_late = shmobile_init_late, .reserve = rcar_gen2_reserve, diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c index ef8eb3a..c528b0f 100644 --- a/arch/arm/mach-shmobile/setup-r8a7791.c +++ b/arch/arm/mach-shmobile/setup-r8a7791.c @@ -33,6 +33,7 @@ DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)") .init_early = shmobile_init_delay, .init_time = rcar_gen2_timer_init, .init_late = shmobile_init_late, + .init_machine = rcar_gen2_init_machine, .reserve = rcar_gen2_reserve, .dt_compat = r8a7791_boards_compat_dt, MACHINE_END diff --git a/arch/arm/mach-shmobile/setup-r8a7794.c b/arch/arm/mach-shmobile/setup-r8a7794.c index d2b0930..eb86656 100644 --- a/arch/arm/mach-shmobile/setup-r8a7794.c +++ b/arch/arm/mach-shmobile/setup-r8a7794.c @@ -27,6 +27,7 @@ static const char * const r8a7794_boards_compat_dt[] __initconst = { DT_MACHINE_START(R8A7794_DT, "Generic R8A7794 (Flattened Device Tree)") .init_early = shmobile_init_delay, .init_late = shmobile_init_late, + .init_machine = rcar_gen2_init_machine, .init_time = rcar_gen2_timer_init, .reserve = rcar_gen2_reserve, .dt_compat = r8a7794_boards_compat_dt, diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c index aa33392..2230948 100644 --- a/arch/arm/mach-shmobile/setup-rcar-gen2.c +++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c @@ -4,6 +4,7 @@ * Copyright (C) 2013 Renesas Solutions Corp. * Copyright (C) 2013 Magnus Damm * Copyright (C) 2014 Ulrich Hecht + * Copyright (C) 2015 Nobuhiro Iwamatsu * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +25,8 @@ #include #include #include +#include +#include #include #include "common.h" #include "rcar-gen2.h" @@ -199,3 +202,21 @@ void __init rcar_gen2_reserve(void) &rcar_gen2_dma_contiguous, true); #endif } + +#define PRR 0xFF000044 +static unsigned int __init rcar_gen2_get_revision(void) +{ + void __iomem *addr = ioremap_nocache(PRR, 4); + u32 data = ioread32(addr); + + iounmap(addr); + + return ((data & 0xF0) >> 4) + 1; +} + +void __init rcar_gen2_init_machine(void) +{ + system_rev = rcar_gen2_get_revision(); + + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); +}