Optimize Keystone2 code for other SoC types
v2 cover Optimize Keystone2 code for other SoC types
Optimize Keystone2 code. The Keystone2 code is going to be updated to support several SoC types. Before adding new SoC type it's good to add some general optimizations in order to avoid re patching after. So this series holds the optimizations.
Based on "[U-boot] [Patch v2 0/3] Add support for NAND U-boot image upgrade"
https://www.mail-archive.com/u-boot at lists.denx.de/msg141655.html
v2..v1:
Removed redundant [ in subj.
Hao Zhang (3):
keystone2: ddr: add DDR3 PHY configs updated for PG 2.0
keystone2: move cpu_to_bus() to keystone.c
keystone2: add possibility to turn off all dsps
Ivan Khoronzhuk (3):
ARM: keystone2: psc: use common PSC base
keystone: ddr3: add ddr3.h to hold ddr3 API
ARM: keystone2: keystone_nav: make it dependent on keystone driver
arch/arm/cpu/armv7/keystone/Makefile | 3 +- arch/arm/cpu/armv7/keystone/ddr3.c | 25 ++++- arch/arm/cpu/armv7/keystone/keystone.c | 87 +++++++++++++++++ arch/arm/cpu/armv7/keystone/psc.c | 42 ++++----- arch/arm/include/asm/arch-keystone/ddr3.h | 56 +++++++++++ arch/arm/include/asm/arch-keystone/hardware-k2hk.h | 6 +- arch/arm/include/asm/arch-keystone/hardware.h | 50 +++------- arch/arm/include/asm/arch-keystone/mon.h | 15 +++ board/ti/k2hk_evm/board.c | 17 +--- board/ti/k2hk_evm/ddr3.c | 103 ++++++++++++++++++--- 10 files changed, 309 insertions(+), 95 deletions(-) create mode 100644 arch/arm/cpu/armv7/keystone/keystone.c create mode 100644 arch/arm/include/asm/arch-keystone/ddr3.h create mode 100644 arch/arm/include/asm/arch-keystone/mon.h
Signature · 1 line
1.8.3.2
PATCH v2 1/6 ARM: keystone2: psc: use common PSC base
Use common keystone2 Power Sleep controller base address instead of directly deciding which keystone2 SoC is used in psc module.
--- arch/arm/cpu/armv7/keystone/psc.c | 42 ++++++++++------------ arch/arm/include/asm/arch-keystone/hardware-k2hk.h | 1 - arch/arm/include/asm/arch-keystone/hardware.h | 3 ++ 3 files changed, 22 insertions(+), 24 deletions(-)
arch/arm/cpu/armv7/keystone/psc.c +19 -23
@@ -16,10 +16,6 @@#define DEVICE_REG32_R (addr) __raw_readl((u32 *)(addr))#define DEVICE_REG32_W (addr, val) __raw_writel(val, (u32 *)(addr)) -#ifdef CONFIG_SOC_K2HK -#define DEVICE_PSC_BASE K2HK_PSC_BASE -#endif -int psc_delay (void ) {udelay (10 );
@@ -55,7 +51,7 @@ int psc_wait(u32 domain_num) retry =0 ;do { - ptstat =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_PSTAT ); + ptstat =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_PSTAT ); ptstat = ptstat & (1 << domain_num); }while ((ptstat !=0 ) && ((retry +=psc_delay ()) <PSC_PTSTAT_TIMEOUT_LIMIT ));
@@ -71,7 +67,7 @@ u32 psc_get_domain_num(u32 mod_num)u32 domain_num;/* Get the power domain associated with the module number */ - domain_num =DEVICE_REG32_R (DEVICE_PSC_BASE + + domain_num =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_MDCFG (mod_num)); domain_num =PSC_REG_MDCFG_GET_PD (domain_num);
@@ -106,7 +102,7 @@ int psc_set_state(u32 mod_num, u32 state)* Get the power domain associated with the module number, and reset * isolation functionality */ - v =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_MDCFG (mod_num)); + v =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_MDCFG (mod_num)); domain_num =PSC_REG_MDCFG_GET_PD (v); reset_iso =PSC_REG_MDCFG_GET_RESET_ISO (v);
@@ -123,24 +119,24 @@ int psc_set_state(u32 mod_num, u32 state)* change is made if the new state is power down. */ if (state ==PSC_REG_VAL_MDCTL_NEXT_ON ) { - pdctl =DEVICE_REG32_R (DEVICE_PSC_BASE + + pdctl =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_PDCTL (domain_num)); pdctl =PSC_REG_PDCTL_SET_NEXT (pdctl,PSC_REG_VAL_PDCTL_NEXT_ON ); -DEVICE_REG32_W (DEVICE_PSC_BASE +PSC_REG_PDCTL (domain_num), +DEVICE_REG32_W (KS2_PSC_BASE +PSC_REG_PDCTL (domain_num), pdctl); }/* Set the next state for the module to enabled/disabled */ - mdctl =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_MDCTL (mod_num)); + mdctl =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_MDCTL (mod_num)); mdctl =PSC_REG_MDCTL_SET_NEXT (mdctl, state); mdctl =PSC_REG_MDCTL_SET_RESET_ISO (mdctl, reset_iso); -DEVICE_REG32_W (DEVICE_PSC_BASE +PSC_REG_MDCTL (mod_num), mdctl); +DEVICE_REG32_W (KS2_PSC_BASE +PSC_REG_MDCTL (mod_num), mdctl);/* Trigger the enable */ - ptcmd =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_PTCMD ); + ptcmd =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_PTCMD ); ptcmd |= (u32)(1 <<domain_num); -DEVICE_REG32_W (DEVICE_PSC_BASE +PSC_REG_PTCMD , ptcmd); +DEVICE_REG32_W (KS2_PSC_BASE +PSC_REG_PTCMD , ptcmd);/* Wait on the complete */ return psc_wait (domain_num);
@@ -161,7 +157,7 @@ int psc_enable_module(u32 mod_num)u32 mdctl;/* Set the bit to apply reset */ - mdctl =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_MDCTL (mod_num)); + mdctl =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_MDCTL (mod_num));if ((mdctl &0x3f ) ==PSC_REG_VAL_MDSTAT_STATE_ON )return 0 ;
@@ -180,11 +176,11 @@ int psc_disable_module(u32 mod_num)u32 mdctl;/* Set the bit to apply reset */ - mdctl =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_MDCTL (mod_num)); + mdctl =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_MDCTL (mod_num));if ((mdctl &0x3f ) ==0 )return 0 ; mdctl =PSC_REG_MDCTL_SET_LRSTZ (mdctl,0 ); -DEVICE_REG32_W (DEVICE_PSC_BASE +PSC_REG_MDCTL (mod_num), mdctl); +DEVICE_REG32_W (KS2_PSC_BASE +PSC_REG_MDCTL (mod_num), mdctl);return psc_set_state (mod_num,PSC_REG_VAL_MDCTL_NEXT_SWRSTDISABLE ); }
@@ -203,11 +199,11 @@ int psc_set_reset_iso(u32 mod_num)u32 mdctl;/* Set the reset isolation bit */ - mdctl =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_MDCTL (mod_num)); + mdctl =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_MDCTL (mod_num)); mdctl =PSC_REG_MDCTL_SET_RESET_ISO (mdctl,1 ); -DEVICE_REG32_W (DEVICE_PSC_BASE +PSC_REG_MDCTL (mod_num), mdctl); +DEVICE_REG32_W (KS2_PSC_BASE +PSC_REG_MDCTL (mod_num), mdctl); - v =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_MDCFG (mod_num)); + v =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_MDCFG (mod_num));if (PSC_REG_MDCFG_GET_RESET_ISO (v) ==1 )return 0 ;
@@ -224,14 +220,14 @@ int psc_disable_domain(u32 domain_num)u32 pdctl;u32 ptcmd; - pdctl =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_PDCTL (domain_num)); + pdctl =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_PDCTL (domain_num)); pdctl =PSC_REG_PDCTL_SET_NEXT (pdctl,PSC_REG_VAL_PDCTL_NEXT_OFF ); pdctl =PSC_REG_PDCTL_SET_PDMODE (pdctl,PSC_REG_VAL_PDCTL_PDMODE_SLEEP ); -DEVICE_REG32_W (DEVICE_PSC_BASE +PSC_REG_PDCTL (domain_num), pdctl); +DEVICE_REG32_W (KS2_PSC_BASE +PSC_REG_PDCTL (domain_num), pdctl); - ptcmd =DEVICE_REG32_R (DEVICE_PSC_BASE +PSC_REG_PTCMD ); + ptcmd =DEVICE_REG32_R (KS2_PSC_BASE +PSC_REG_PTCMD ); ptcmd |= (u32)(1 << domain_num); -DEVICE_REG32_W (DEVICE_PSC_BASE +PSC_REG_PTCMD , ptcmd); +DEVICE_REG32_W (KS2_PSC_BASE +PSC_REG_PTCMD , ptcmd);return psc_wait (domain_num); }
arch/arm/include/asm/arch-keystone/hardware-k2hk.h +0 -1
@@ -16,7 +16,6 @@#define KS2_RSTCTRL_MASK 0xffff0000#define KS2_RSTCTRL_SWRST 0xfffe0000 -#define K2HK_PSC_BASE 0x02350000#define KS2_DEVICE_STATE_CTRL_BASE 0x02620000#define JTAG_ID_REG (KS2_DEVICE_STATE_CTRL_BASE + 0x18)#define K2HK_DEVSTAT (KS2_DEVICE_STATE_CTRL_BASE + 0x20)
arch/arm/include/asm/arch-keystone/hardware.h +3 -0
@@ -119,6 +119,9 @@ struct ddr3_emif_config {#define KS2_UART0_BASE 0x02530c00#define KS2_UART1_BASE 0x02531000 +/* PSC */ +#define KS2_PSC_BASE 0x02350000 +/* AEMIF */ #define KS2_AEMIF_CNTRL_BASE 0x21000a00#define DAVINCI_ASYNC_EMIF_CNTRL_BASE KS2_AEMIF_CNTRL_BASE
Signature · 1 line
1.8.3.2
PATCH v2 1/6 ARM: keystone2: psc: use common PSC base
Quoted 5 lines · Ivan
Use common keystone2 Power Sleep controller base address instead of directly deciding which keystone2 SoC is used in psc module.
Acked-by Murali Karicheri <[email protected]>Signed-off-by Ivan Khoronzhuk <[email protected]>
Applied to u-boot-ti/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/63e0f36a/attachment.pgp>
PATCH v2 2/6 keystone: ddr3: add ddr3.h to hold ddr3 API
In reply to Ivan KhoronzhukIt's convinient to hold ddr3 function definitions in separate file such as ddr3.h. So move this from hardware.h to ddr3.h.
--- arch/arm/cpu/armv7/keystone/ddr3.c | 6 +-- arch/arm/include/asm/arch-keystone/ddr3.h | 55 +++++++++++++++++++++++++++ arch/arm/include/asm/arch-keystone/hardware.h | 39 ------------------- board/ti/k2hk_evm/board.c | 3 +- board/ti/k2hk_evm/ddr3.c | 27 +++++++------ 5 files changed, 76 insertions(+), 54 deletions(-) create mode 100644 arch/arm/include/asm/arch-keystone/ddr3.h
arch/arm/cpu/armv7/keystone/ddr3.c +3 -3
@@ -7,10 +7,10 @@* SPDX-License-Identifier: GPL-2.0+ */ -#include <asm/arch/hardware.h> #include <asm/io.h> +#include <asm/arch/ddr3.h> -void init_ddrphy (u32 base,struct ddr3_phy_config *phy_cfg) +void ddr3_init_ddrphy (u32 base,struct ddr3_phy_config *phy_cfg) {unsigned int tmp;
@@ -57,7 +57,7 @@ void init_ddrphy(u32 base, struct ddr3_phy_config *phy_cfg) ; } -void init_ddremif (u32 base,struct ddr3_emif_config *emif_cfg) +void ddr3_init_ddremif (u32 base,struct ddr3_emif_config *emif_cfg) {__raw_writel (emif_cfg->sdcfg, base +KS2_DDR3_SDCFG_OFFSET );__raw_writel (emif_cfg->sdtim1, base +KS2_DDR3_SDTIM1_OFFSET );
arch/arm/include/asm/arch-keystone/ddr3.h new file +55 -0
55 lines not on this page · raw message
arch/arm/include/asm/arch-keystone/hardware.h +0 -39
@@ -22,42 +22,6 @@typedef volatile unsigned int dv_reg ;typedef volatile unsigned int *dv_reg_p ; -struct ddr3_phy_config { -unsigned int pllcr; -unsigned int pgcr1_mask; -unsigned int pgcr1_val; -unsigned int ptr0; -unsigned int ptr1; -unsigned int ptr2; -unsigned int ptr3; -unsigned int ptr4; -unsigned int dcr_mask; -unsigned int dcr_val; -unsigned int dtpr0; -unsigned int dtpr1; -unsigned int dtpr2; -unsigned int mr0; -unsigned int mr1; -unsigned int mr2; -unsigned int dtcr; -unsigned int pgcr2; -unsigned int zq0cr1; -unsigned int zq1cr1; -unsigned int zq2cr1; -unsigned int pir_v1; -unsigned int pir_v2; -}; - -struct ddr3_emif_config { -unsigned int sdcfg; -unsigned int sdtim1; -unsigned int sdtim2; -unsigned int sdtim3; -unsigned int sdtim4; -unsigned int zqcfg; -unsigned int sdrfc; -}; -#endif #define BIT (x) (1 << (x))
@@ -149,9 +113,6 @@ static inline int cpu_revision(void)void share_all_segments (int priv_id);int cpu_to_bus (u32 *ptr,u32 length); -void init_ddrphy (u32 base,struct ddr3_phy_config *phy_cfg); -void init_ddremif (u32 base,struct ddr3_emif_config *emif_cfg); -void init_ddr3 (void );void sdelay (unsigned long );#endif
board/ti/k2hk_evm/board.c +2 -1
@@ -12,6 +12,7 @@#include <fdt_support.h> #include <libfdt.h> +#include <asm/arch/ddr3.h> #include <asm/arch/hardware.h> #include <asm/arch/clock.h> #include <asm/io.h>
@@ -63,7 +64,7 @@ static struct pll_init_data pll_config[] = {int dram_init (void ) { -init_ddr3 (); +ddr3_init (); gd->ram_size =get_ram_size ((long *)CONFIG_SYS_SDRAM_BASE ,CONFIG_MAX_RAM_BANK_SIZE );
board/ti/k2hk_evm/ddr3.c +16 -11
@@ -8,6 +8,7 @@*/ #include <common.h> +#include <asm/arch/ddr3.h> #include <asm/arch/hardware.h> #include <asm/io.h> #include <i2c.h>
@@ -228,7 +229,7 @@ struct pll_init_data ddr3b_333 = DDR3_PLL_333(B);struct pll_init_data ddr3a_400 =DDR3_PLL_400 (A );struct pll_init_data ddr3b_400 =DDR3_PLL_400 (B ); -void init_ddr3 (void ) +void ddr3_init (void ) {char dimm_name[32 ];
@@ -239,22 +240,26 @@ void init_ddr3(void)if (!strcmp (dimm_name,"18KSF1G72HZ-1G6E2 " )) {init_pll (&ddr3a_400);if (cpu_revision () >0 ) { -init_ddrphy (K2HK_DDR3A_DDRPHYC , &ddr3phy_1600_64A); -init_ddremif (K2HK_DDR3A_EMIF_CTRL_BASE , &ddr3_1600_64); +ddr3_init_ddrphy (K2HK_DDR3A_DDRPHYC , &ddr3phy_1600_64A); +ddr3_init_ddremif (K2HK_DDR3A_EMIF_CTRL_BASE , + &ddr3_1600_64);printf ("DRAM: Capacity 8 GiB (includes reported below)\n" ); }else { -init_ddrphy (K2HK_DDR3A_DDRPHYC , &ddr3phy_1600_32); -init_ddremif (K2HK_DDR3A_EMIF_CTRL_BASE , &ddr3_1600_32); +ddr3_init_ddrphy (K2HK_DDR3A_DDRPHYC , &ddr3phy_1600_32); +ddr3_init_ddremif (K2HK_DDR3A_EMIF_CTRL_BASE , + &ddr3_1600_32);printf ("DRAM: Capacity 4 GiB (includes reported below)\n" ); } }else if (!strcmp (dimm_name,"SQR-SD3T-2G1333SED" )) {init_pll (&ddr3a_333);if (cpu_revision () >0 ) { -init_ddrphy (K2HK_DDR3A_DDRPHYC , &ddr3phy_1333_64A); -init_ddremif (K2HK_DDR3A_EMIF_CTRL_BASE , &ddr3_1333_64); +ddr3_init_ddrphy (K2HK_DDR3A_DDRPHYC , &ddr3phy_1333_64A); +ddr3_init_ddremif (K2HK_DDR3A_EMIF_CTRL_BASE , + &ddr3_1333_64); }else { -init_ddrphy (K2HK_DDR3A_DDRPHYC , &ddr3phy_1333_32); -init_ddremif (K2HK_DDR3A_EMIF_CTRL_BASE , &ddr3_1333_32); +ddr3_init_ddrphy (K2HK_DDR3A_DDRPHYC , &ddr3phy_1333_32); +ddr3_init_ddremif (K2HK_DDR3A_EMIF_CTRL_BASE , + &ddr3_1333_32); } }else {printf ("Unknown SO-DIMM. Cannot configure DDR3\n" );
@@ -263,6 +268,6 @@ void init_ddr3(void) }init_pll (&ddr3b_333); -init_ddrphy (K2HK_DDR3B_DDRPHYC , &ddr3phy_1333_64); -init_ddremif (K2HK_DDR3B_EMIF_CTRL_BASE , &ddr3_1333_64); +ddr3_init_ddrphy (K2HK_DDR3B_DDRPHYC , &ddr3phy_1333_64); +ddr3_init_ddremif (K2HK_DDR3B_EMIF_CTRL_BASE , &ddr3_1333_64); }
Signature · 1 line
1.8.3.2
PATCH v2 2/6 keystone: ddr3: add ddr3.h to hold ddr3 API
Quoted 5 lines · Ivan
It's convinient to hold ddr3 function definitions in separate file such as
ddr3.h. So move this fromhardware.htoddr3.h.Acked-by Murali Karicheri <[email protected]>Signed-off-by Ivan Khoronzhuk <[email protected]>
Applied to u-boot-ti/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/cfb51914/attachment.pgp>
PATCH v2 3/6 keystone2: ddr: add DDR3 PHY configs updated for PG 2.0
In reply to Ivan KhoronzhukFrom: Hao Zhang <[email protected]>
Add DDR3 PHY configs updated for PG 2.0
Also add DDR3A PHY reset before init for PG2.0 SoCs.
--- arch/arm/cpu/armv7/keystone/ddr3.c | 19 +++++++ arch/arm/include/asm/arch-keystone/ddr3.h | 1 + arch/arm/include/asm/arch-keystone/hardware.h | 2 + board/ti/k2hk_evm/ddr3.c | 80 ++++++++++++++++++++++++++- 4 files changed, 100 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/keystone/ddr3.c +19 -0
@@ -8,6 +8,7 @@*/ #include <asm/io.h> +#include <common.h> #include <asm/arch/ddr3.h> void ddr3_init_ddrphy (u32 base,struct ddr3_phy_config *phy_cfg)
@@ -67,3 +68,21 @@ void ddr3_init_ddremif(u32 base, struct ddr3_emif_config *emif_cfg)__raw_writel (emif_cfg->zqcfg, base +KS2_DDR3_ZQCFG_OFFSET );__raw_writel (emif_cfg->sdrfc, base +KS2_DDR3_SDRFC_OFFSET ); } + +void ddr3_reset_ddrphy (void ) +{ +u32 tmp; + +/* Assert DDR3A PHY reset */ + tmp =readl (K2HK_DDR3APLLCTL1 ); + tmp |=KS2_DDR3_PLLCTRL_PHY_RESET ; +writel (tmp,K2HK_DDR3APLLCTL1 ); + +/* wait 10us to catch the reset */ +udelay (10 ); + +/* Release DDR3A PHY reset */ + tmp =readl (K2HK_DDR3APLLCTL1 ); + tmp &= ~KS2_DDR3_PLLCTRL_PHY_RESET ; +__raw_writel (tmp,K2HK_DDR3APLLCTL1 ); +}
arch/arm/include/asm/arch-keystone/ddr3.h +1 -0
@@ -49,6 +49,7 @@ struct ddr3_emif_config { };void ddr3_init (void ); +void ddr3_reset_ddrphy (void );void ddr3_init_ddrphy (u32 base,struct ddr3_phy_config *phy_cfg);void ddr3_init_ddremif (u32 base,struct ddr3_emif_config *emif_cfg);
arch/arm/include/asm/arch-keystone/hardware.h +2 -0
@@ -80,6 +80,8 @@ typedef volatile unsigned int *dv_reg_p;#define KS2_DDR3_PMCTL_OFFSET 0x38#define KS2_DDR3_ZQCFG_OFFSET 0xC8 +#define KS2_DDR3_PLLCTRL_PHY_RESET 0x80000000 +#define KS2_UART0_BASE 0x02530c00#define KS2_UART1_BASE 0x02531000
board/ti/k2hk_evm/ddr3.c +78 -2
98 lines not on this page · raw message
Signature · 1 line
1.8.3.2
PATCH v2 3/6 keystone2: ddr: add DDR3 PHY configs updated for PG 2.0
Quoted 8 lines · Ivan
From: Hao Zhang <[email protected]>
Add DDR3 PHY configs updated for PG 2.0
Also add DDR3A PHY reset before init for PG2.0 SoCs.Acked-by Murali Karicheri <[email protected]>Signed-off-by Hao Zhang <[email protected]>Signed-off-by Ivan Khoronzhuk <[email protected]>
Applied to u-boot-ti/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/5785bb8a/attachment.pgp>
PATCH v2 4/6 ARM: keystone2: keystone_nav: make it dependent on keystone driver
In reply to Ivan KhoronzhukThis driver is needed in case if keystone driver is used. Currently only keystone_net driver uses it. So to avoid redundant code compilation make the keystone_nav dependent on keystone net driver. It also leads to compilation errors for boards that does't use it.
--- arch/arm/cpu/armv7/keystone/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/cpu/armv7/keystone/Makefile +1 -1
@@ -10,7 +10,7 @@ obj-y += psc.o obj-y += clock.o obj-y += cmd_clock.o obj-y += cmd_mon.o -obj-y += keystone_nav.o +obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_nav.o obj-y += msmc.o obj-$(CONFIG_SPL_BUILD) += spl.o obj-y += ddr3.o
Signature · 1 line
1.8.3.2
PATCH v2 4/6 ARM: keystone2: keystone_nav: make it dependent on keystone driver
Quoted 8 lines · Ivan
This driver is needed in case if keystone driver is used. Currently only
keystone_netdriver uses it. So to avoid redundant code compilation make thekeystone_navdependent on keystone net driver. It also leads to compilation errors for boards that does't use it.Acked-by Murali Karicheri <[email protected]>Signed-off-by Ivan Khoronzhuk <[email protected]>
Applied to u-boot-ti/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/3447b500/attachment.pgp>
PATCH v2 5/6 keystone2: move cpu_to_bus() to keystone.c
In reply to Ivan KhoronzhukFrom: Hao Zhang <[email protected]>
The SoC related common functions in board.c should be placed to a common keystone.c arch file.
--- arch/arm/cpu/armv7/keystone/Makefile | 1 + arch/arm/cpu/armv7/keystone/keystone.c | 28 ++++++++++++++++++++++++++++ board/ti/k2hk_evm/board.c | 14 -------------- 3 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 arch/arm/cpu/armv7/keystone/keystone.c
arch/arm/cpu/armv7/keystone/Makefile +1 -0
@@ -14,3 +14,4 @@ obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_nav.o obj-y += msmc.o obj-$(CONFIG_SPL_BUILD) += spl.o obj-y += ddr3.o +obj-y += keystone.o
arch/arm/cpu/armv7/keystone/keystone.c new file +28 -0
@@ -0,0 +1,28 @@ +/* +* Keystone EVM : Board initialization +* +* (C) Copyright 2014 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <asm/io.h> +#include <asm/arch/hardware.h> + +/** +* cpu_to_bus - swap bytes of the 32-bit data if the device is BE +* @ptr - array of data +* @length - lenght of data array +*/ +int cpu_to_bus (u32 *ptr,u32 length) +{ +u32 i; + +if (!(readl (K2HK_DEVSTAT ) &0x1 )) +for (i =0 ; i < length; i++, ptr++) + *ptr =cpu_to_be32 (*ptr); + +return 0 ; +}
board/ti/k2hk_evm/board.c +0 -14
@@ -23,8 +23,6 @@DECLARE_GLOBAL_DATA_PTR ; -u32 device_big_endian; -unsigned int external_clk[ext_clk_count] = { [sys_clk] =122880000 , [alt_core_clk] =125000000 ,
@@ -136,18 +134,6 @@ int board_eth_init(bd_t *bis) }#endif -/* Byte swap the 32-bit data if the device is BE */ -int cpu_to_bus (u32 *ptr,u32 length) -{ -u32 i; - -if (device_big_endian) -for (i =0 ; i < length; i++, ptr++) - *ptr =__swab32 (*ptr); - -return 0 ; -} -#if defined(CONFIG_BOARD_EARLY_INIT_F )int board_early_init_f (void ) {
Signature · 1 line
1.8.3.2
PATCH v2 5/6 keystone2: move cpu_to_bus() to keystone.c
Quoted 8 lines · Ivan
From: Hao Zhang <[email protected]>
The SoC related common functions in
board.cshould be placed to a commonkeystone.carch file.Acked-by Murali Karicheri <[email protected]>Signed-off-by Hao Zhang <[email protected]>Signed-off-by Ivan Khoronzhuk <[email protected]>
Applied to u-boot-ti/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/6ce6a725/attachment.pgp>
PATCH v2 6/6 keystone2: add possibility to turn off all dsps
In reply to Ivan KhoronzhukFrom: Hao Zhang <[email protected]>
By default all DSPs are turned off, for another case option to turn off them is added in this commit.
Also add command to turn off itself.
--- arch/arm/cpu/armv7/keystone/keystone.c | 59 ++++++++++++++++++++++ arch/arm/include/asm/arch-keystone/hardware-k2hk.h | 5 +- arch/arm/include/asm/arch-keystone/hardware.h | 6 +++ arch/arm/include/asm/arch-keystone/mon.h | 15 ++++++ 4 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 arch/arm/include/asm/arch-keystone/mon.h
arch/arm/cpu/armv7/keystone/keystone.c +59 -0
@@ -9,6 +9,9 @@#include <common.h> #include <asm/io.h> +#include <asm/arch/mon.h> +#include <asm/arch/psc_defs.h> +#include <asm/arch/hardware.h> #include <asm/arch/hardware.h> /**
@@ -26,3 +29,59 @@ int cpu_to_bus(u32 *ptr, u32 length)return 0 ; } + +static int turn_off_myself (void ) +{ +printf ("Turning off ourselves\r\n" ); +mon_power_off (0 ); + +psc_disable_module (KS2_LPSC_TETRIS ); +psc_disable_domain (KS2_TETRIS_PWR_DOMAIN ); + + asmvolatile ("isb\n" +"dsb\n" +"wfi\n" ); + +printf ("What! Should not see that\n" ); +return 0 ; +} + +static void turn_off_all_dsps (int num_dsps) +{ +int i; + +for (i =0 ; i < num_dsps; i++) { +if (psc_disable_module (i +KS2_LPSC_GEM_0 )) +printf ("Cannot disable module for #%d DSP" , i); + +if (psc_disable_domain (i +8 )) +printf ("Cannot disable domain for #%d DSP" , i); + } +} + +int do_killme_cmd (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +return turn_off_myself (); +} + +U_BOOT_CMD ( + killme,1 ,0 , do_killme_cmd, +"turn off main ARM core" , +"turn off main ARM core. Should not live after that :(\n" +); + +int misc_init_r (void ) +{ +char *env; +long ks2_debug =0 ; + + env =getenv ("ks2_debug" ); + +if (env) + ks2_debug =simple_strtol (env,NULL ,0 ); + +if ((ks2_debug &DBG_LEAVE_DSPS_ON ) ==0 ) +turn_off_all_dsps (KS2_NUM_DSPS ); + +return 0 ; +}
arch/arm/include/asm/arch-keystone/hardware-k2hk.h +3 -2
@@ -68,7 +68,6 @@#define K2HK_LPSC_VUSR0 12#define K2HK_LPSC_CHIP_SRSS 13#define K2HK_LPSC_MSMC 14 -#define K2HK_LPSC_GEM_0 15#define K2HK_LPSC_GEM_1 16#define K2HK_LPSC_GEM_2 17#define K2HK_LPSC_GEM_3 18
@@ -105,7 +104,6 @@#define K2HK_LPSC_VUSR1 49#define K2HK_LPSC_XGE 50#define K2HK_LPSC_ARM_SREFLEX 51 -#define K2HK_LPSC_TETRIS 52/* DDR3A definitions */ #define K2HK_DDR3A_EMIF_CTRL_BASE 0x21010000
@@ -137,4 +135,7 @@/* MSMC control */ #define K2HK_MSMC_CTRL_BASE 0x0bc00000 +/* Number of DSP cores */ +#define KS2_NUM_DSPS 8 +#endif /* __ASM_ARCH_HARDWARE_H */
arch/arm/include/asm/arch-keystone/hardware.h +6 -0
@@ -87,11 +87,17 @@ typedef volatile unsigned int *dv_reg_p;/* PSC */ #define KS2_PSC_BASE 0x02350000 +#define KS2_LPSC_GEM_0 15 +#define KS2_LPSC_TETRIS 52 +#define KS2_TETRIS_PWR_DOMAIN 31/* AEMIF */ #define KS2_AEMIF_CNTRL_BASE 0x21000a00#define DAVINCI_ASYNC_EMIF_CNTRL_BASE KS2_AEMIF_CNTRL_BASE +/* Flag from ks2_debug options to check if DSPs need to stay ON */ +#define DBG_LEAVE_DSPS_ON 0x1 +#ifdef CONFIG_SOC_K2HK #include <asm/arch/hardware-k2hk.h> #endif
arch/arm/include/asm/arch-keystone/mon.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* K2HK: secure kernel command header file +* +* (C) Copyright 2014 +* Texas Instruments Incorporated, <www.ti.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _MON_H_ +#define _MON_H_ + +int mon_power_off (int core_id); + +#endif
Signature · 1 line
1.8.3.2
PATCH v2 6/6 keystone2: add possibility to turn off all dsps
Quoted 9 lines · Ivan
From: Hao Zhang <[email protected]>
By default all DSPs are turned off, for another case option to turn off them is added in this commit.
Also add command to turn off itself.Acked-by Murali Karicheri <[email protected]>Signed-off-by Hao Zhang <[email protected]>Signed-off-by Ivan Khoronzhuk <[email protected]>
Applied to u-boot-ti/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140725/396602ed/attachment.pgp>