From patchwork Wed May 25 08:58:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dirk Behme X-Patchwork-Id: 9135009 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7A63460221 for ; Wed, 25 May 2016 08:58:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E0E6280D2 for ; Wed, 25 May 2016 08:58:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62F88282DA; Wed, 25 May 2016 08:58:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 025FD280D2 for ; Wed, 25 May 2016 08:58:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752266AbcEYI6i (ORCPT ); Wed, 25 May 2016 04:58:38 -0400 Received: from smtp6-v.fe.bosch.de ([139.15.237.11]:10019 "EHLO smtp6-v.fe.bosch.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754002AbcEYI6f (ORCPT ); Wed, 25 May 2016 04:58:35 -0400 Received: from vsmta11.fe.internet.bosch.com (unknown [10.4.98.51]) by imta23.fe.bosch.de (Postfix) with ESMTP id 1C9361580207 for ; Wed, 25 May 2016 10:58:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=de.bosch.com; s=2015-01-21; t=1464166714; bh=c+V2yXwN6Pgxsi4oKIIzLPNFQKLiqJwQQl4hlKHw0Wk=; l=10; h=From:From:Reply-To:Sender; b=qf/lrCwB0hsQPfjra4IzMrdEfeC7jZpYOMrGHqCusgE0GtoI5aPbtAskWMM4J98mT 4f9JxlhdfA50T24HN5Oumt/AzJko6yKCETrnSae740fOiT5O/R+dhIn5J0TAnSEsw8 vGYGkmcm/o82m3tcf3gwGRxgIJUeTqsmu/BYqUDU= Received: from SI-HUB1001.de.bosch.com (vsgw24.fe.internet.bosch.com [10.4.98.24]) by vsmta11.fe.internet.bosch.com (Postfix) with ESMTP id 72F7C23803E9 for ; Wed, 25 May 2016 10:58:33 +0200 (CEST) Received: from hi-z08if.hi.de.bosch.com (10.34.209.31) by SI-HUB1001.de.bosch.com (10.4.103.108) with Microsoft SMTP Server id 14.3.195.1; Wed, 25 May 2016 10:58:32 +0200 Received: from hi-z08if.hi.de.bosch.com (localhost [127.0.0.1]) by hi-z08if.hi.de.bosch.com (Postfix) with ESMTP id BB8C9625EC2; Wed, 25 May 2016 10:58:30 +0200 (CEST) From: Dirk Behme To: Geert Uytterhoeven , Simon Horman , , Koji Matsuoka CC: Dirk Behme Subject: [PATCH 3/4] ARM: Renesas: R-Car3: Add cpu and revision handlers Date: Wed, 25 May 2016 10:58:27 +0200 Message-ID: <1464166708-18320-4-git-send-email-dirk.behme@de.bosch.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1464166708-18320-1-git-send-email-dirk.behme@de.bosch.com> References: <1464166708-18320-1-git-send-email-dirk.behme@de.bosch.com> MIME-Version: 1.0 X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-22342.006 X-TMASE-MatchedRID: dV0u7CPuH2p8aZSb8TGgolz+axQLnAVBBGvINcfHqhfJYIv7y0tu9uLM Mm2bmNjUs0hQNdjjnsqFECvR4Kt3tNUMAwTDOBnsA9lly13c/gGWHGENdT+VP05VvgDuaDCk2Uw BLM8az1QbD9jQlYfcdGOaTLwk0MuGGAS4UVZrvja628cXbnOhT30tCKdnhB589yM15V5aWpj6C0 ePs7A07VJr6OkoIOYRnL3yXZ8Zj0HFutmcaRZJkHTAk504n8dfGz4BRbpWwVMNXaa1oPerlBbhi LN++1luw6P76m2wjSPSLQ19QSKQqt4YwQ7+RS+ncyUqN3uQlbQ/aeuGnNOdfhIV4Rqq6XdoGtRT i+6w0SPAvpLE+mvX8g== Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The Renesas R-Car3 product register (PRR) helps us to identify the SoC and revision we are running on. Add helper functions to check for this easily in code where it's needed. Signed-off-by: Dirk Behme --- include/linux/soc/renesas/rcar3-prr.h | 51 +++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 include/linux/soc/renesas/rcar3-prr.h diff --git a/include/linux/soc/renesas/rcar3-prr.h b/include/linux/soc/renesas/rcar3-prr.h new file mode 100644 index 0000000..9bbe369 --- /dev/null +++ b/include/linux/soc/renesas/rcar3-prr.h @@ -0,0 +1,51 @@ +/* + * R-Car3 Product Register (PRR) support + * + * Copyright (C) 2016 Robert Bosch Car Multimedia GmbH + * Dirk Behme + * + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + */ + +#ifndef __SOC_RENESAS_RCAR3_PRR_H__ +#define __SOC_RENESAS_RCAR3_PRR_H__ + +#define PRODUCT_MASK (0x7f << 8) +#define PRODUCT_H3 (0x4f << 8) +#define PRODUCT_M3W (0x52 << 8) + +#define CUT_MASK (0x000000ff) +#define CUT_ES1 (0x0 << 0) +#define CUT_ES2 (0x1 << 4) +#define CUT_ES3 (0x1 << 5) + +extern unsigned int __rcar3_prr; + +static inline bool cpu_is_rcar3_h3(void) +{ + return (__rcar3_prr & PRODUCT_MASK) == PRODUCT_H3; +} + +static inline bool cpu_is_rcar3_m3w(void) +{ + return (__rcar3_prr & PRODUCT_MASK) == PRODUCT_M3W; +} + +static inline bool revision_is_rcar3_es1(void) +{ + return (__rcar3_prr & CUT_MASK) == CUT_ES1; +} + +static inline bool revision_is_rcar3_es2(void) +{ + return (__rcar3_prr & CUT_MASK) == CUT_ES2; +} + +static inline bool revision_is_rcar3_es3(void) +{ + return (__rcar3_prr & CUT_MASK) == CUT_ES3; +} + +#endif /* __SOC_RENESAS_RCAR3_PRR_H__ */