diff mbox series

[U-Boot,v2,2/3] rk3288: Disable JTAG function from sdmmc0 IO

Message ID 20180611080812.16786-3-carlo@caione.org
State Superseded
Headers show
Series rk3288: veyron: Enable SDMMC when booting from SPI | expand

Commit Message

Carlo Caione June 11, 2018, 8:08 a.m. UTC
From: Carlo Caione <carlo@endlessm.com>

The GRF_SOC_CON0.grf_force_jtag bit is automatically set at boot and it
is preventing the SDMMC to work correctly. Disable the JTAG function on
the assumption that a working SD has higher priority over JTAG.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
 arch/arm/mach-rockchip/rk3288-board.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Philipp Tomsich June 11, 2018, 8:41 a.m. UTC | #1
> On 11 Jun 2018, at 10:08, Carlo Caione <carlo@caione.org> wrote:
> 
> From: Carlo Caione <carlo@endlessm.com>
> 
> The GRF_SOC_CON0.grf_force_jtag bit is automatically set at boot and it
> is preventing the SDMMC to work correctly. Disable the JTAG function on
> the assumption that a working SD has higher priority over JTAG.
> 
> Signed-off-by: Carlo Caione <carlo@endlessm.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

See below for a nitpick ...

> ---
> arch/arm/mach-rockchip/rk3288-board.c | 7 +++++++
> 1 file changed, 7 insertions(+)
> 
> diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
> index 0365793009..bf24d8e074 100644
> --- a/arch/arm/mach-rockchip/rk3288-board.c
> +++ b/arch/arm/mach-rockchip/rk3288-board.c
> @@ -307,6 +307,7 @@ U_BOOT_CMD(
> 	""
> );
> 
> +#define GRF_SOC_CON0 0xff770244
> #define GRF_SOC_CON2 0xff77024c

Could you convert these to ‘const uintptr_t GRF_SOC_CON0 = …’ ?
The compiler will generate the same code for a const as if it’s a define, but we’ll
have full type-safety.

> 
> int board_early_init_f(void)
> @@ -339,5 +340,11 @@ int board_early_init_f(void)
> 	}
> 	rk_setreg(GRF_SOC_CON2, 1 << 0);
> 
> +	/*
> +	 * Disable JTAG on sdmmc0 IO. The SDMMC won't work until this bit is
> +	 * cleared
> +	 */
> +	rk_clrreg(GRF_SOC_CON0, 1 << 12);
> +
> 	return 0;
> }
> -- 
> 2.17.1
>
Carlo Caione June 11, 2018, 5:08 p.m. UTC | #2
On Mon, 2018-06-11 at 10:41 +0200, Dr. Philipp Tomsich wrote:
> > On 11 Jun 2018, at 10:08, Carlo Caione <carlo@caione.org> wrote:

/cut
> > +#define GRF_SOC_CON0 0xff770244
> > #define GRF_SOC_CON2 0xff77024c
> 
> Could you convert these to ‘const uintptr_t GRF_SOC_CON0 = …’ ?
> The compiler will generate the same code for a const as if it’s a
> define, but we’ll
> have full type-safety.

Yeah, no problem. But if this is ok with you in v3 I'm going to leave
this patch as is and adding one more patch to convert both the lines at
the same time.

Thanks.
Philipp Tomsich June 11, 2018, 5:50 p.m. UTC | #3
On 11 Jun 2018, at 19:08, Carlo Caione <carlo@endlessm.com> wrote:
> 
> On Mon, 2018-06-11 at 10:41 +0200, Dr. Philipp Tomsich wrote:
>>> On 11 Jun 2018, at 10:08, Carlo Caione <carlo@caione.org> wrote:
> 
> /cut
>>> +#define GRF_SOC_CON0 0xff770244
>>> #define GRF_SOC_CON2 0xff77024c
>> 
>> Could you convert these to ‘const uintptr_t GRF_SOC_CON0 = …’ ?
>> The compiler will generate the same code for a const as if it’s a
>> define, but we’ll
>> have full type-safety.
> 
> Yeah, no problem. But if this is ok with you in v3 I'm going to leave
> this patch as is and adding one more patch to convert both the lines at
> the same time.

Sure. Add another patch and I’ll squash it when applying.

—Philipp.
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index 0365793009..bf24d8e074 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -307,6 +307,7 @@  U_BOOT_CMD(
 	""
 );
 
+#define GRF_SOC_CON0 0xff770244
 #define GRF_SOC_CON2 0xff77024c
 
 int board_early_init_f(void)
@@ -339,5 +340,11 @@  int board_early_init_f(void)
 	}
 	rk_setreg(GRF_SOC_CON2, 1 << 0);
 
+	/*
+	 * Disable JTAG on sdmmc0 IO. The SDMMC won't work until this bit is
+	 * cleared
+	 */
+	rk_clrreg(GRF_SOC_CON0, 1 << 12);
+
 	return 0;
 }