sunxi: add PRCM secure switch register definition
Subsystems (3)
PATCH 1/2 sunxi: add PRCM secure switch register definition
Some new Allwinner SoCs' PRCM has a secure switch register, which controls the access to some clock and power registers in PRCM block.
Add the definition of this register and its bits in the PRCM header file.
--- arch/arm/include/asm/arch-sunxi/prcm.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/include/asm/arch-sunxi/prcm.h +6 -0
@@ -196,6 +196,10 @@#define PRCM_CPU3_PWR_CLAMP (n) (((n) & 0xff) << 0)#define PRCM_CPU3_PWR_CLAMP_MASK PRCM_CPU3_PWR_CLAMP(0xff) +#define PRCM_SEC_SWITCH_APB0_CLK_NONSEC (0x1 << 0) +#define PRCM_SEC_SWITCH_PLL_CFG_NONSEC (0x1 << 1) +#define PRCM_SEC_SWITCH_PWR_GATE_NONSEC (0x1 << 2) +#ifndef __ASSEMBLY__#include <linux/compiler.h>
@@ -233,6 +237,8 @@ struct __packed sunxi_prcm_reg {u32 dram_pwr;/* 0x180 */ u8 res12[0xc ];/* 0x184 */ u32 dram_tst;/* 0x190 */ +u8 res13[0x3c ];/* 0x194 */ +u32 prcm_sec_switch;/* 0x1d0 */ };void prcm_apb0_enable (u32 flags);
Signature · 1 line
2.13.0
PATCH 2/2 sunxi: switch PRCM to non-secure on H3/H5 SoCs
The PRCM of H3/H5 SoCs have a secure/non-secure switch, which controls the access to some clock/power related registers in PRCM.
Current Linux kernel will access the CPUS (AR100) clock in the PRCM block, so the PRCM should be switched to non-secure.
Add code to switch the PRCM to non-secure.
--- arch/arm/mach-sunxi/clock_sun6i.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-sunxi/clock_sun6i.c +6 -0
@@ -66,11 +66,17 @@ void clock_init_sec(void)#ifdef CONFIG_MACH_SUNXI_H3_H5 struct sunxi_ccm_reg *const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; +struct sunxi_prcm_reg *const prcm = + (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE ;setbits_le32 (&ccm->ccu_sec_switch,CCM_SEC_SWITCH_MBUS_NONSEC |CCM_SEC_SWITCH_BUS_NONSEC |CCM_SEC_SWITCH_PLL_NONSEC ); +setbits_le32 (&prcm->prcm_sec_switch, +PRCM_SEC_SWITCH_APB0_CLK_NONSEC | +PRCM_SEC_SWITCH_PLL_CFG_NONSEC | +PRCM_SEC_SWITCH_PWR_GATE_NONSEC );#endif }
Signature · 1 line
2.13.0
PATCH 2/2 sunxi: switch PRCM to non-secure on H3/H5 SoCs
Quoted 7 lines · 在 2017-07-20 14:00,Icenowy Zheng 写道:
The PRCM of H3/H5 SoCs have a secure/non-secure switch, which controls the access to some clock/power related registers in PRCM.
Current Linux kernel will access the CPUS (AR100) clock in the PRCM block, so the PRCM should be switched to non-secure.
Add code to switch the PRCM to non-secure.
Ping.
Maxime and Jagan, can you merge this patchset?
This is necessary for R_CCU to work properly on H3.
Quoted 28 lines
Signed-off-by Icenowy Zheng <[email protected]>--- arch/arm/mach-sunxi/clock_sun6i.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/arm/mach-sunxi/clock_sun6i.c +6
-0@@ -66,11 +66,17 @@ void clock_init_sec(void)#ifdef CONFIG_MACH_SUNXI_H3_H5 struct sunxi_ccm_reg *const ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; +struct sunxi_prcm_reg *const prcm = + (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE ;setbits_le32 (&ccm->ccu_sec_switch,CCM_SEC_SWITCH_MBUS_NONSEC |CCM_SEC_SWITCH_BUS_NONSEC |CCM_SEC_SWITCH_PLL_NONSEC ); +setbits_le32 (&prcm->prcm_sec_switch, +PRCM_SEC_SWITCH_APB0_CLK_NONSEC | +PRCM_SEC_SWITCH_PLL_CFG_NONSEC | +PRCM_SEC_SWITCH_PWR_GATE_NONSEC );#endif }
PATCH 2/2 sunxi: switch PRCM to non-secure on H3/H5 SoCs
Quoted 7 lines · icenowy at aosc.io
Quoted 6 lines · 在 2017-07-20 14:00,Icenowy Zheng 写道:
The PRCM of H3/H5 SoCs have a secure/non-secure switch, which controls the access to some clock/power related registers in PRCM.
Current Linux kernel will access the CPUS (AR100) clock in the PRCM block, so the PRCM should be switched to non-secure.
Quoted 7 lines
Quoted 1 line
Add code to switch the PRCM to non-secure.
Ping.
Maxime and Jagan, can you merge this patchset?
This is necessary for
R_CCUto work properly on H3.
Maxime
Signature · 10 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 801 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170726/9c164f2d/attachment.sig>
PATCH 2/2 sunxi: switch PRCM to non-secure on H3/H5 SoCs
Quoted 10 lines · Maxime Ripard
Quoted 9 lines · icenowy at aosc.io
Quoted 7 lines · 在 2017-07-20 14:00,Icenowy Zheng 写道:
The PRCM of H3/H5 SoCs have a secure/non-secure switch, which controls the access to some clock/power related registers in PRCM.
Current Linux kernel will access the CPUS (AR100) clock in the PRCM block, so the PRCM should be switched to non-secure.
Add code to switch the PRCM to non-secure.
Quoted 7 lines
Quoted 5 lines
Ping.
Maxime and Jagan, can you merge this patchset?
This is necessary for
R_CCUto work properly on H3.Acked-by Maxime Ripard <[email protected]>
PATCH 1/2 sunxi: add PRCM secure switch register definition
In reply to Icenowy ZhengQuoted 7 lines · Icenowy Zheng
Some new Allwinner SoCs' PRCM has a secure switch register, which controls the access to some clock and power registers in PRCM block.
Add the definition of this register and its bits in the PRCM header file.
Signed-off-by Icenowy Zheng <[email protected]>
Could you provide a reference as to where or how you found out about this?
Thanks
ChenYu
PATCH 1/2 sunxi: add PRCM secure switch register definition
Quoted 11 lines · 在 2017-08-08 12:13,Chen-Yu Tsai 写道:
Quoted 7 lines · Icenowy Zheng
Some new Allwinner SoCs' PRCM has a secure switch register, which controls the access to some clock and power registers in PRCM block.
Add the definition of this register and its bits in the PRCM header file.
Signed-off-by Icenowy Zheng <[email protected]>Could you provide a reference as to where or how you found out about this?
Quoted 3 lines
Thanks
ChenYu
PATCH 1/2 sunxi: add PRCM secure switch register definition
Quoted 10 lines · On Tue, Aug 8, 2017 at 2:46 PM, <[email protected]> wrote:
Quoted 9 lines · 在 2017-08-08 12:13,Chen-Yu Tsai 写道:
Quoted 7 lines · Icenowy Zheng
Some new Allwinner SoCs' PRCM has a secure switch register, which controls the access to some clock and power registers in PRCM block.
Add the definition of this register and its bits in the PRCM header file.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Icenowy Zheng <[email protected]>Could you provide a reference as to where or how you found out about this?
I assume you've mapped out what each bit means by testing it?
PATCH 1/2 sunxi: add PRCM secure switch register definition
Quoted 15 lines · 在 2017-08-09 11:46,Chen-Yu Tsai 写道:
Quoted 14 lines · On Tue, Aug 8, 2017 at 2:46 PM, <[email protected]> wrote:
Quoted 13 lines · 在 2017-08-08 12:13,Chen-Yu Tsai 写道:
Quoted 8 lines · Icenowy Zheng
Some new Allwinner SoCs' PRCM has a secure switch register, which controls the access to some clock and power registers in PRCM block.
Add the definition of this register and its bits in the PRCM header file.
Signed-off-by Icenowy Zheng <[email protected]>
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Could you provide a reference as to where or how you found out about this?
I assume you've mapped out what each bit means by testing it?
Yes.
Toggling bit 0 will make at least 0x0 (CPUS_CFG_REG) inaccessible. Toggling bit 1 will make at least 0x40 and 0x44 (PLL_CTRL_REG{0,1}) inaccessible.
Toggling bit 2 will make at least 0x120 (VDD_SYS_PWR_RST) inaccessible.
(The register names are from http://linux-sunxi.org/PRCM )
Quoted 2 lines
Tested-by Chen-Yu Tsai <[email protected]>
PATCH 1/2 sunxi: add PRCM secure switch register definition
In reply to Icenowy ZhengQuoted 7 lines · Icenowy Zheng
Some new Allwinner SoCs' PRCM has a secure switch register, which controls the access to some clock and power registers in PRCM block.
Add the definition of this register and its bits in the PRCM header file.
Signed-off-by Icenowy Zheng <[email protected]>
Applied both in u-boot-sunxi/master
thanks!
Signature · 4 lines
Jagan Teki Free Software Engineer | www.openedev.com U-Boot, Linux | Upstream Maintainer Hyderabad, India.