diff mbox series

[1/2] pinctrl: sh-pfc: r8a7790: initialize TDSEL register

Message ID 20181028212457.1017-2-wsa+renesas@sang-engineering.com
State New
Headers show
Series pinctrl: sh-pfc: gen2: initialize TDSEL register | expand

Commit Message

Wolfram Sang Oct. 28, 2018, 9:24 p.m. UTC
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 <wsa+renesas@sang-engineering.com>
---
 drivers/pinctrl/sh-pfc/pfc-r8a7790.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Simon Horman Oct. 30, 2018, 1:55 p.m. UTC | #1
On Sun, Oct 28, 2018 at 09:24:56PM +0000, Wolfram Sang wrote:
> 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 <wsa+renesas@sang-engineering.com>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Marek Vasut Oct. 31, 2018, 1:19 a.m. UTC | #2
On 10/28/2018 10:24 PM, Wolfram Sang wrote:
> 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 <wsa+renesas@sang-engineering.com>

Reviewed-by: Marek Vasut <marek.vasut@gmail.com>

> ---
>  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 <linux/io.h>
>  #include <linux/kernel.h>
>  
> +#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,
>  };
>  
>
Geert Uytterhoeven Nov. 8, 2018, 7:44 p.m. UTC | #3
On Sun, Oct 28, 2018 at 10:25 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> 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 <wsa+renesas@sang-engineering.com>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

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 <linux/io.h>
 #include <linux/kernel.h>
 
+#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,
 };