diff mbox series

[v2,22/28] arm: rockchip: rv1126: Set dram area unsecure for SPL

Message ID 20220818145246.201205-23-jagan@edgeble.ai
State Changes Requested
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series ARM: Add Rockchip RV1126 support | expand

Commit Message

Jagan Teki Aug. 18, 2022, 2:52 p.m. UTC
Unsecure the dram area so that MMC, USB, and SFC controllers
can able to read data from dram.

Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
Signed-off-by: Jagan Teki <jagan@edgeble.ai>
---
Changes for v2:
- use IS_ENABLED

 arch/arm/mach-rockchip/rv1126/rv1126.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Kever Yang Sept. 28, 2022, 12:26 p.m. UTC | #1
On 2022/8/18 22:52, Jagan Teki wrote:
> Unsecure the dram area so that MMC, USB, and SFC controllers
> can able to read data from dram.
>
> Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com>
> Signed-off-by: Jagan Teki <jagan@edgeble.ai>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
> Changes for v2:
> - use IS_ENABLED
>
>   arch/arm/mach-rockchip/rv1126/rv1126.c | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm/mach-rockchip/rv1126/rv1126.c b/arch/arm/mach-rockchip/rv1126/rv1126.c
> index 91554c98b6..b9b898756f 100644
> --- a/arch/arm/mach-rockchip/rv1126/rv1126.c
> +++ b/arch/arm/mach-rockchip/rv1126/rv1126.c
> @@ -10,6 +10,8 @@
>   #include <asm/arch-rockchip/hardware.h>
>   #include <asm/arch-rockchip/grf_rv1126.h>
>   
> +#define FIREWALL_APB_BASE	0xffa60000
> +#define FW_DDR_CON_REG		0x80
>   #define GRF_BASE		0xFE000000
>   
>   const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
> @@ -58,6 +60,16 @@ void board_debug_uart_init(void)
>   #ifndef CONFIG_TPL_BUILD
>   int arch_cpu_init(void)
>   {
> +	/**
> +	 * Set dram area unsecure in spl
> +	 *
> +	 * usb & mmc & sfc controllers can read data to dram
> +	 * since they are unsecure.
> +	 * (Note: only secure-world can access this register)
> +	 */
> +	if (IS_ENABLED(CONFIG_SPL_BUILD))
> +		writel(0, FIREWALL_APB_BASE + FW_DDR_CON_REG);
> +
>   	return 0;
>   }
>   #endif
diff mbox series

Patch

diff --git a/arch/arm/mach-rockchip/rv1126/rv1126.c b/arch/arm/mach-rockchip/rv1126/rv1126.c
index 91554c98b6..b9b898756f 100644
--- a/arch/arm/mach-rockchip/rv1126/rv1126.c
+++ b/arch/arm/mach-rockchip/rv1126/rv1126.c
@@ -10,6 +10,8 @@ 
 #include <asm/arch-rockchip/hardware.h>
 #include <asm/arch-rockchip/grf_rv1126.h>
 
+#define FIREWALL_APB_BASE	0xffa60000
+#define FW_DDR_CON_REG		0x80
 #define GRF_BASE		0xFE000000
 
 const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
@@ -58,6 +60,16 @@  void board_debug_uart_init(void)
 #ifndef CONFIG_TPL_BUILD
 int arch_cpu_init(void)
 {
+	/**
+	 * Set dram area unsecure in spl
+	 *
+	 * usb & mmc & sfc controllers can read data to dram
+	 * since they are unsecure.
+	 * (Note: only secure-world can access this register)
+	 */
+	if (IS_ENABLED(CONFIG_SPL_BUILD))
+		writel(0, FIREWALL_APB_BASE + FW_DDR_CON_REG);
+
 	return 0;
 }
 #endif