From patchwork Tue Oct 4 09:25:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9361409 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 32282608A6 for ; Tue, 4 Oct 2016 09:25:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 235E425EF7 for ; Tue, 4 Oct 2016 09:25:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17F9A28968; Tue, 4 Oct 2016 09:25:35 +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.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 B17DD26490 for ; Tue, 4 Oct 2016 09:25:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751657AbcJDJZe (ORCPT ); Tue, 4 Oct 2016 05:25:34 -0400 Received: from michel.telenet-ops.be ([195.130.137.88]:51500 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751789AbcJDJZd (ORCPT ); Tue, 4 Oct 2016 05:25:33 -0400 Received: from ayla.of.borg ([84.193.137.253]) by michel.telenet-ops.be with bizsmtp id rMRV1t00H5UCtCs06MRVE5; Tue, 04 Oct 2016 11:25:30 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.82) (envelope-from ) id 1brLyb-000400-36; Tue, 04 Oct 2016 11:25:29 +0200 Received: from geert by ramsan with local (Exim 4.82) (envelope-from ) id 1brLyb-0007pk-Oz; Tue, 04 Oct 2016 11:25:29 +0200 From: Geert Uytterhoeven To: Simon Horman , Magnus Damm Cc: Michael Turquette , Stephen Boyd , Laurent Pinchart , Linus Walleij , Arnd Bergmann , Yangbo Lu , Dirk Behme , linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH/RFC 4/4] pinctrl: sh-pfc: r8a7795: Add PoC support for R-Car H3 ES2.0 Date: Tue, 4 Oct 2016 11:25:27 +0200 Message-Id: <1475573127-30054-5-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1475573127-30054-1-git-send-email-geert+renesas@glider.be> References: <1475573127-30054-1-git-send-email-geert+renesas@glider.be> 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 Pin Function Controller module in R-Car H3 ES2.0 differs from ES1.x. Add a Proof-of-Concept for detecting the SoC revision at the runtime using the new soc_device_match() API, and skeleton code for selecting the pinctrl tables for the actual SoC revision. Signed-off-by: Geert Uytterhoeven --- drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c index 2e8cc2adbed7e251..3f58bfd676ce94c2 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7795.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7795.c @@ -9,6 +9,7 @@ */ #include +#include #include "core.h" #include "sh_pfc.h" @@ -5401,7 +5402,25 @@ static void r8a7795_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin, sh_pfc_write_reg(pfc, PUEN + reg, 32, enable); } +static const struct soc_device_attribute r8a7795es1[] = { + { .soc_id = "r8a7795", .revision = "ES1.*" }, + { /* sentinel */ } +}; + +static int r8a7795_pinmux_init(struct sh_pfc *pfc) +{ + if (soc_device_match(r8a7795es1)) { + pr_info("%s: R-Car H3 ES1.x detected\n", __func__); + // FIXME Fixup r8a7795_pinmux_info for ES1.x + } else { + pr_info("%s: R-Car H3 >= ES2.0\n", __func__); + // FIXME Fixup r8a7795_pinmux_info for ES2.0 + } + return 0; +} + static const struct sh_pfc_soc_operations r8a7795_pinmux_ops = { + .init = r8a7795_pinmux_init, .pin_to_pocctrl = r8a7795_pin_to_pocctrl, .get_bias = r8a7795_pinmux_get_bias, .set_bias = r8a7795_pinmux_set_bias,