From patchwork Sun Oct 28 21:24:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 990014 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42jrNq0ZZRz9s9h for ; Mon, 29 Oct 2018 08:25:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727639AbeJ2GLB (ORCPT ); Mon, 29 Oct 2018 02:11:01 -0400 Received: from sauhun.de ([88.99.104.3]:57636 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727653AbeJ2GLB (ORCPT ); Mon, 29 Oct 2018 02:11:01 -0400 Received: from localhost (unknown [87.113.172.131]) by pokefinder.org (Postfix) with ESMTPSA id 4FE384A1CAD; Sun, 28 Oct 2018 22:25:08 +0100 (CET) From: Wolfram Sang To: linux-gpio@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , Wolfram Sang Subject: [PATCH 1/2] pinctrl: sh-pfc: r8a7790: initialize TDSEL register Date: Sun, 28 Oct 2018 21:24:56 +0000 Message-Id: <20181028212457.1017-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181028212457.1017-1-wsa+renesas@sang-engineering.com> References: <20181028212457.1017-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Documentation says that some bits in TDSEL must be set (ch 5.3.39 in R-Car H2 v0.91). However, the reset value of the register is 0, so software has to do it. Add this to the kernel driver to ensure this is really done independent of firmware versions. This is needed for some SD cards supporting SDR104 transfer mode. For me, TDSEL was not initialized by the firmware and I had problems with the card when re-inserting it. Signed-off-by: Wolfram Sang Reviewed-by: Simon Horman Reviewed-by: Marek Vasut Reviewed-by: Geert Uytterhoeven --- drivers/pinctrl/sh-pfc/pfc-r8a7790.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c index ab7a35392cd8..c0e679105df9 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7790.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7790.c @@ -11,6 +11,7 @@ #include #include +#include "core.h" #include "sh_pfc.h" /* @@ -5691,7 +5692,16 @@ static int r8a7790_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *poc return 31 - (pin & 0x1f); } +static int r8a7790_pinmux_soc_init(struct sh_pfc *pfc) +{ + /* Initialize TDSEL according to datasheet */ + sh_pfc_write(pfc, 0xe6060088, 0x00155554); + + return 0; +} + static const struct sh_pfc_soc_operations r8a7790_pinmux_ops = { + .init = r8a7790_pinmux_soc_init, .pin_to_pocctrl = r8a7790_pin_to_pocctrl, }; From patchwork Sun Oct 28 21:24:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 990015 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42jrNq5zrDz9s9J for ; Mon, 29 Oct 2018 08:25:15 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727990AbeJ2GLD (ORCPT ); Mon, 29 Oct 2018 02:11:03 -0400 Received: from sauhun.de ([88.99.104.3]:57638 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727653AbeJ2GLD (ORCPT ); Mon, 29 Oct 2018 02:11:03 -0400 Received: from localhost (unknown [87.113.172.131]) by pokefinder.org (Postfix) with ESMTPSA id 76F2C4A1CCD; Sun, 28 Oct 2018 22:25:10 +0100 (CET) From: Wolfram Sang To: linux-gpio@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , Wolfram Sang Subject: [PATCH 2/2] pinctrl: sh-pfc: r8a7794: initialize TDSEL register Date: Sun, 28 Oct 2018 21:24:57 +0000 Message-Id: <20181028212457.1017-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181028212457.1017-1-wsa+renesas@sang-engineering.com> References: <20181028212457.1017-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Documentation says that some bits in TDSEL must be set (ch 5.3.35 in R-Car E2 v0.5). However, the reset value of the register is 0, so software has to do it. Add this to the kernel driver to ensure this is really done independent of firmware versions. This is needed for some SD cards supporting SDR104 transfer mode. Signed-off-by: Wolfram Sang Reviewed-by: Simon Horman Reviewed-by: Marek Vasut Reviewed-by: Geert Uytterhoeven --- drivers/pinctrl/sh-pfc/pfc-r8a7794.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c index 6d1e5fdc03f8..8a16053d2bec 100644 --- a/drivers/pinctrl/sh-pfc/pfc-r8a7794.c +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7794.c @@ -5560,7 +5560,16 @@ static int r8a7794_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *poc return -EINVAL; } +static int r8a7794_pinmux_soc_init(struct sh_pfc *pfc) +{ + /* Initialize TDSEL according to datasheet */ + sh_pfc_write(pfc, 0xe6060068, 0x55555500); + + return 0; +} + static const struct sh_pfc_soc_operations r8a7794_pinmux_ops = { + .init = r8a7794_pinmux_soc_init, .pin_to_pocctrl = r8a7794_pin_to_pocctrl, };