All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc)
@ 2017-03-29 19:20 Philipp Tomsich
  2017-03-29 19:20 ` [U-Boot] [PATCH v3 2/2] dts: rk3399-puma: disable 'fifo-mode' in sdmmc Philipp Tomsich
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Philipp Tomsich @ 2017-03-29 19:20 UTC (permalink / raw)
  To: u-boot

The RK3399 hangs during DMA of the Designware MMC controller, when
performing DMA-based transactions in SPL due to the DDR security settings
left behind by the BootROM (i.e. accesses to the first MB of DRAM are
restricted... however, the DMA is likely to target this first MB, as it
transfers from/to the stack).

System security is not affected, as the final security configuration is
performed by the ATF, which is executed after the SPL stage.

With this fix in place, we can now drop 'fifo-mode' in the DTS for the
RK3399-Q7 (Puma).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

---

Changes in v3:
- replaces the work-around (i.e. falling back to fifo-mode in SPL) with
  a permanent fix

 arch/arm/mach-rockchip/rk3399-board-spl.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c b/arch/arm/mach-rockchip/rk3399-board-spl.c
index 3bfc2d9..c5e32c4 100644
--- a/arch/arm/mach-rockchip/rk3399-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3399-board-spl.c
@@ -186,6 +186,7 @@ void board_debug_uart_init(void)
 }
 
 #define GRF_EMMCCORE_CON11 0xff77f02c
+#define SGRF_DDR_RGN_CON16 0xff330040
 void board_init_f(ulong dummy)
 {
 	struct udevice *pinctrl;
@@ -214,6 +215,17 @@ void board_init_f(ulong dummy)
 		hang();
 	}
 
+	/*
+	 * Disable DDR security regions.
+	 *
+	 * As we are entered from the BootROM, the region from
+	 * 0x0 through 0xfffff (i.e. the first MB of memory) will
+	 * be protected. This will cause issues with the DW_MMC
+	 * driver, which tries to DMA from/to the stack (likely)
+	 * located in this range.
+	 */
+	rk_clrsetreg(SGRF_DDR_RGN_CON16, 0x1FF, 0);
+
 	secure_timer_init();
 
 	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
@@ -251,6 +263,7 @@ void spl_board_init(void)
 #ifdef CONFIG_ROCKCHIP_SPL_BACK_TO_BROM
 	back_to_bootrom();
 #endif
+
 	return;
 err:
 	printf("spl_board_init: Error %d\n", ret);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3 2/2] dts: rk3399-puma: disable 'fifo-mode' in sdmmc
  2017-03-29 19:20 [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc) Philipp Tomsich
@ 2017-03-29 19:20 ` Philipp Tomsich
  2017-04-01  4:23   ` Simon Glass
  2017-03-30  3:22 ` [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc) Kever Yang
  2017-04-01  4:23 ` Simon Glass
  2 siblings, 1 reply; 7+ messages in thread
From: Philipp Tomsich @ 2017-03-29 19:20 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
---

Changes in v3: None

 arch/arm/dts/rk3399-puma.dts | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/dts/rk3399-puma.dts b/arch/arm/dts/rk3399-puma.dts
index 09b3858..50e43c7 100644
--- a/arch/arm/dts/rk3399-puma.dts
+++ b/arch/arm/dts/rk3399-puma.dts
@@ -91,7 +91,6 @@
 &sdmmc {
         u-boot,dm-pre-reloc;
 	bus-width = <4>;
-	fifo-mode; /* until we fix DMA in SPL */
 	status = "okay";
 };
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc)
  2017-03-29 19:20 [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc) Philipp Tomsich
  2017-03-29 19:20 ` [U-Boot] [PATCH v3 2/2] dts: rk3399-puma: disable 'fifo-mode' in sdmmc Philipp Tomsich
@ 2017-03-30  3:22 ` Kever Yang
  2017-04-01  4:23 ` Simon Glass
  2 siblings, 0 replies; 7+ messages in thread
From: Kever Yang @ 2017-03-30  3:22 UTC (permalink / raw)
  To: u-boot

Hi Philipp,


On 03/30/2017 03:20 AM, Philipp Tomsich wrote:
> The RK3399 hangs during DMA of the Designware MMC controller, when
> performing DMA-based transactions in SPL due to the DDR security settings
> left behind by the BootROM (i.e. accesses to the first MB of DRAM are
> restricted... however, the DMA is likely to target this first MB, as it
> transfers from/to the stack).
>
> System security is not affected, as the final security configuration is
> performed by the ATF, which is executed after the SPL stage.
>
> With this fix in place, we can now drop 'fifo-mode' in the DTS for the
> RK3399-Q7 (Puma).
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> ---
>
> Changes in v3:
> - replaces the work-around (i.e. falling back to fifo-mode in SPL) with
>    a permanent fix
>
>   arch/arm/mach-rockchip/rk3399-board-spl.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c b/arch/arm/mach-rockchip/rk3399-board-spl.c
> index 3bfc2d9..c5e32c4 100644
> --- a/arch/arm/mach-rockchip/rk3399-board-spl.c
> +++ b/arch/arm/mach-rockchip/rk3399-board-spl.c
> @@ -186,6 +186,7 @@ void board_debug_uart_init(void)
>   }
>   
>   #define GRF_EMMCCORE_CON11 0xff77f02c
> +#define SGRF_DDR_RGN_CON16 0xff330040
>   void board_init_f(ulong dummy)
>   {
>   	struct udevice *pinctrl;
> @@ -214,6 +215,17 @@ void board_init_f(ulong dummy)
>   		hang();
>   	}
>   
> +	/*
> +	 * Disable DDR security regions.
> +	 *
> +	 * As we are entered from the BootROM, the region from
> +	 * 0x0 through 0xfffff (i.e. the first MB of memory) will
> +	 * be protected. This will cause issues with the DW_MMC
> +	 * driver, which tries to DMA from/to the stack (likely)
> +	 * located in this range.
> +	 */
> +	rk_clrsetreg(SGRF_DDR_RGN_CON16, 0x1FF, 0);
> +
>   	secure_timer_init();
>   
>   	ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
> @@ -251,6 +263,7 @@ void spl_board_init(void)
>   #ifdef CONFIG_ROCKCHIP_SPL_BACK_TO_BROM
>   	back_to_bootrom();
>   #endif
> +
>   	return;
>   err:
>   	printf("spl_board_init: Error %d\n", ret);
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc)
  2017-03-29 19:20 [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc) Philipp Tomsich
  2017-03-29 19:20 ` [U-Boot] [PATCH v3 2/2] dts: rk3399-puma: disable 'fifo-mode' in sdmmc Philipp Tomsich
  2017-03-30  3:22 ` [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc) Kever Yang
@ 2017-04-01  4:23 ` Simon Glass
  2017-04-14 10:15   ` Simon Glass
  2 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2017-04-01  4:23 UTC (permalink / raw)
  To: u-boot

On 29 March 2017 at 13:20, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> The RK3399 hangs during DMA of the Designware MMC controller, when
> performing DMA-based transactions in SPL due to the DDR security settings
> left behind by the BootROM (i.e. accesses to the first MB of DRAM are
> restricted... however, the DMA is likely to target this first MB, as it
> transfers from/to the stack).
>
> System security is not affected, as the final security configuration is
> performed by the ATF, which is executed after the SPL stage.
>
> With this fix in place, we can now drop 'fifo-mode' in the DTS for the
> RK3399-Q7 (Puma).
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> ---
>
> Changes in v3:
> - replaces the work-around (i.e. falling back to fifo-mode in SPL) with
>   a permanent fix
>
>  arch/arm/mach-rockchip/rk3399-board-spl.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3 2/2] dts: rk3399-puma: disable 'fifo-mode' in sdmmc
  2017-03-29 19:20 ` [U-Boot] [PATCH v3 2/2] dts: rk3399-puma: disable 'fifo-mode' in sdmmc Philipp Tomsich
@ 2017-04-01  4:23   ` Simon Glass
  2017-04-14 10:15     ` Simon Glass
  0 siblings, 1 reply; 7+ messages in thread
From: Simon Glass @ 2017-04-01  4:23 UTC (permalink / raw)
  To: u-boot

On 29 March 2017 at 13:20, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Always nice to have a commit message. Also, please can you always add
a 'rockchip: ' tag?
> ---
>
> Changes in v3: None
>
>  arch/arm/dts/rk3399-puma.dts | 1 -
>  1 file changed, 1 deletion(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc)
  2017-04-01  4:23 ` Simon Glass
@ 2017-04-14 10:15   ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2017-04-14 10:15 UTC (permalink / raw)
  To: u-boot

On 31 March 2017 at 22:23, Simon Glass <sjg@chromium.org> wrote:
>
> On 29 March 2017 at 13:20, Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com> wrote:
> > The RK3399 hangs during DMA of the Designware MMC controller, when
> > performing DMA-based transactions in SPL due to the DDR security settings
> > left behind by the BootROM (i.e. accesses to the first MB of DRAM are
> > restricted... however, the DMA is likely to target this first MB, as it
> > transfers from/to the stack).
> >
> > System security is not affected, as the final security configuration is
> > performed by the ATF, which is executed after the SPL stage.
> >
> > With this fix in place, we can now drop 'fifo-mode' in the DTS for the
> > RK3399-Q7 (Puma).
> >
> > Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> >
> > ---
> >
> > Changes in v3:
> > - replaces the work-around (i.e. falling back to fifo-mode in SPL) with
> >   a permanent fix
> >
> >  arch/arm/mach-rockchip/rk3399-board-spl.c | 13 +++++++++++++
> >  1 file changed, 13 insertions(+)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Added rockchip: tag and

Applied to u-boot-rockchip, thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v3 2/2] dts: rk3399-puma: disable 'fifo-mode' in sdmmc
  2017-04-01  4:23   ` Simon Glass
@ 2017-04-14 10:15     ` Simon Glass
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Glass @ 2017-04-14 10:15 UTC (permalink / raw)
  To: u-boot

On 31 March 2017 at 22:23, Simon Glass <sjg@chromium.org> wrote:
> On 29 March 2017 at 13:20, Philipp Tomsich
> <philipp.tomsich@theobroma-systems.com> wrote:
>> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>
> Always nice to have a commit message. Also, please can you always add
> a 'rockchip: ' tag?
>> ---
>>
>> Changes in v3: None
>>
>>  arch/arm/dts/rk3399-puma.dts | 1 -
>>  1 file changed, 1 deletion(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>

Added rockchip tag and:

Applied to u-boot-rockchip, thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-04-14 10:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-29 19:20 [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc) Philipp Tomsich
2017-03-29 19:20 ` [U-Boot] [PATCH v3 2/2] dts: rk3399-puma: disable 'fifo-mode' in sdmmc Philipp Tomsich
2017-04-01  4:23   ` Simon Glass
2017-04-14 10:15     ` Simon Glass
2017-03-30  3:22 ` [U-Boot] [PATCH v3 1/2] spl: rk3399: disable DDR security regions for SPL (for DMA in dw_mmc) Kever Yang
2017-04-01  4:23 ` Simon Glass
2017-04-14 10:15   ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.