From patchwork Fri Feb 13 01:40:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nobuhiro Iwamatsu X-Patchwork-Id: 5822791 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 A4B189F37F for ; Fri, 13 Feb 2015 01:40:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD5A12014A for ; Fri, 13 Feb 2015 01:40:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B80D200F3 for ; Fri, 13 Feb 2015 01:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751716AbbBMBkg (ORCPT ); Thu, 12 Feb 2015 20:40:36 -0500 Received: from mail-pd0-f174.google.com ([209.85.192.174]:44538 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751699AbbBMBke (ORCPT ); Thu, 12 Feb 2015 20:40:34 -0500 Received: by pdbnh10 with SMTP id nh10so11646566pdb.11 for ; Thu, 12 Feb 2015 17:40:33 -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=gYULXeN13OS/WO+foO9MlkVo4p+2J7c7e656K+ZiM4s=; b=TijWwPa3Lvm9dDfkD15nrF8zof/CFcPzG+nUsFGcv8s3x6CSA1IhIRCtb+wBzhDkwd KGrNto3CKn+l/JS7wA9LXMwai4tq8TRiM3qY8BWZyRmZXDlt06JAAIcz19+O3chz53vA N51hy0iEwHWqFeVz88J0ufgzUPHiHDnZR59HkOlM9p+XIUP88aPJ1nuOHNMH6+ePdKMT yD+immTen5gD96funRgFFj9DAzH6GOy9qWITmM7pyLob+7eALGdE1VhndTW3yx4JdAzi 2xJJaKy6K0xu0GCvFuiH9QgSubpn3m1Rl0hgbnT5jWD0mS0tLd34iXuBSE0fq3f0Iyog UdOQ== X-Gm-Message-State: ALoCoQk+t7TGbquM/a3YJZ1qwL0GBEJ4TdOS3/ME0mxqlIxOp01AfDx218dFS9gZiN/5FWbs9Q1L X-Received: by 10.66.66.135 with SMTP id f7mr10891906pat.93.1423791633844; Thu, 12 Feb 2015 17:40:33 -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 l2sm4931680pbq.50.2015.02.12.17.40.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Feb 2015 17:40:32 -0800 (PST) From: Nobuhiro Iwamatsu To: horms+renesas@verge.net.au Cc: linux-sh@vger.kernel.org, greet@linux-m68k.org, Nobuhiro Iwamatsu Subject: [PATCH 1/2 v2] ARM: shmobile: Add function to get SoCs revision data for R-Car Gen2 Date: Fri, 13 Feb 2015 10:40:21 +0900 Message-Id: <1423791622-30610-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 --- V2: - Dont remove lower 4bit. - Change function name from rcar_gen2_get_revision to rcar_gen2_get_cut. 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 ec7d97d..58e9b0f 100644 --- a/arch/arm/mach-shmobile/setup-r8a7790.c +++ b/arch/arm/mach-shmobile/setup-r8a7790.c @@ -311,6 +311,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 3dd6edd..4cc8492 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 @@ -23,6 +24,8 @@ #include #include #include +#include +#include #include #include "common.h" #include "rcar-gen2.h" @@ -204,3 +207,21 @@ void __init rcar_gen2_reserve(void) &rcar_gen2_dma_contiguous, true); #endif } + +#define PRR 0xFF000044 +static unsigned int __init rcar_gen2_get_cut(void) +{ + void __iomem *addr = ioremap_nocache(PRR, 4); + u32 data = ioread32(addr); + + iounmap(addr); + + return (data & 0xFF) + 0x10; +} + +void __init rcar_gen2_init_machine(void) +{ + system_rev = rcar_gen2_get_cut(); + + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); +}