ARM: keystone2: Clocls and PLLs cleanup
cover ARM: keystone2: Clocls and PLLs cleanup
This seires does a several bunch of cleanups for clock and PLL related definitions. This helps a lot in adding data for new Keystone2 SoCs. And also adds support for CPU detection.
This is based on Nishanth's config cleanup series:
https://www.mail-archive.com/u-boot%40lists.denx.de/msg177822.html
Tested on K2HK-evm: http://pastebin.ubuntu.com/11920541/
Lokesh Vutla (8):
ARM: keystone2: Cleanup SoC detection
ARM: keystone2: Enable CONFIG_DISPLAY_CPUINFO
ARM: keystone2: Cleanup PLL init code
ARM: keystone2: Fix dev and arm speed detection
ARM: keystone2: Use common address for PLL
ARM: keystone2: Cleanup pll calling
ARM: keystone2: Remove unsed externalk clocks
ARM: keystone2: Use common definition for clk_get_rate
arch/arm/mach-keystone/Makefile | 3 - arch/arm/mach-keystone/clock-k2e.c | 117 ----- arch/arm/mach-keystone/clock-k2hk.c | 145 ------ arch/arm/mach-keystone/clock-k2l.c | 138 ------ arch/arm/mach-keystone/clock.c | 527 +++++++++++++-------- arch/arm/mach-keystone/cmd_clock.c | 7 +- arch/arm/mach-keystone/include/mach/clock-k2e.h | 58 +-- arch/arm/mach-keystone/include/mach/clock-k2hk.h | 64 +-- arch/arm/mach-keystone/include/mach/clock-k2l.h | 59 +-- arch/arm/mach-keystone/include/mach/clock.h | 60 ++- arch/arm/mach-keystone/include/mach/clock_defs.h | 107 +++-- .../arm/mach-keystone/include/mach/hardware-k2hk.h | 4 - arch/arm/mach-keystone/include/mach/hardware.h | 51 +- arch/arm/mach-keystone/init.c | 24 + board/ti/ks2_evm/board.c | 1 - board/ti/ks2_evm/board_k2e.c | 41 +- board/ti/ks2_evm/board_k2hk.c | 47 +- board/ti/ks2_evm/board_k2l.c | 46 +- include/configs/ti_armv7_keystone2.h | 1 + 19 files changed, 603 insertions(+), 897 deletions(-) delete mode 100644 arch/arm/mach-keystone/clock-k2e.c delete mode 100644 arch/arm/mach-keystone/clock-k2hk.c delete mode 100644 arch/arm/mach-keystone/clock-k2l.c
Signature · 1 line
2.1.4
PATCH 1/8 ARM: keystone2: Cleanup SoC detection
Add proper register definition for JTAG ID and
cleanup cpu_is_* functions.
--- arch/arm/mach-keystone/include/mach/hardware.h | 42 ++++++++++++++++---------- 1 file changed, 26 insertions(+), 16 deletions(-)
arch/arm/mach-keystone/include/mach/hardware.h +26 -16
@@ -237,6 +237,17 @@ typedef volatile unsigned int *dv_reg_p;/* SGMII SerDes */ #define KS2_SGMII_SERDES_BASE 0x0232a000 +/* JTAG ID register */ +#define JTAGID_VARIANT_SHIFT 28 +#define JTAGID_VARIANT_MASK (0xf << 28) +#define JTAGID_PART_NUM_SHIFT 12 +#define JTAGID_PART_NUM_MASK (0xffff << 12) + +/* PART NUMBER definitions */ +#define CPU_66AK2Hx 0xb981 +#define CPU_66AK2Ex 0xb9a6 +#define CPU_66AK2Lx 0xb9a7 +#ifdef CONFIG_SOC_K2HK #include <asm/arch/hardware-k2hk.h> #endif
@@ -250,34 +261,33 @@ typedef volatile unsigned int *dv_reg_p;#endif #ifndef __ASSEMBLY__ -static inline int cpu_is_k2hk (void ) + +static inline u16 get_part_number (void ) { -unsigned int jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -unsigned int part_no = (jtag_id >>12 ) &0xffff ; +u32 jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -return (part_no ==0xb981 ) ?1 :0 ; +return (jtag_id &JTAGID_PART_NUM_MASK ) >>JTAGID_PART_NUM_SHIFT ; } -static inline int cpu_is_k2e (void ) +static inline u8 cpu_is_k2hk (void ) { -unsigned int jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -unsigned int part_no = (jtag_id >>12 ) &0xffff ; - -return (part_no ==0xb9a6 ) ?1 :0 ; +return get_part_number () == CPU_66AK2Hx; } -static inline int cpu_is_k2l (void ) +static inline u8 cpu_is_k2e (void ) { -unsigned int jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -unsigned int part_no = (jtag_id >>12 ) &0xffff ; +return get_part_number () == CPU_66AK2Ex; +} -return (part_no ==0xb9a7 ) ?1 :0 ; +static inline u8 cpu_is_k2l (void ) +{ +return get_part_number () == CPU_66AK2Lx; } -static inline int cpu_revision (void ) +static inline u8 cpu_revision (void ) { -unsigned int jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -unsigned int rev = (jtag_id >>28 ) &0xf ; +u32 jtag_id =__raw_readl (KS2_JTAG_ID_REG ); +u8 rev = (jtag_id &JTAGID_VARIANT_MASK ) &JTAGID_VARIANT_SHIFT ;return rev; }
Signature · 1 line
2.1.4
PATCH 1/8 ARM: keystone2: Cleanup SoC detection
Quoted 71 lines · Lokesh Vutla
Add proper register definition for JTAG ID and
cleanup cpu_is_* functions.Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/mach-keystone/include/mach/hardware.h | 42 ++++++++++++++++---------- 1 file changed, 26 insertions(+), 16 deletions(-)arch/arm/mach-keystone/include/mach/hardware.h +23
-13@@ -237,6 +237,17 @@ typedef volatile unsigned int *dv_reg_p;/* SGMII SerDes */ #define KS2_SGMII_SERDES_BASE 0x0232a000 +/* JTAG ID register */ +#define JTAGID_VARIANT_SHIFT 28 +#define JTAGID_VARIANT_MASK (0xf << 28) +#define JTAGID_PART_NUM_SHIFT 12 +#define JTAGID_PART_NUM_MASK (0xffff << 12) + +/* PART NUMBER definitions */ +#define CPU_66AK2Hx 0xb981 +#define CPU_66AK2Ex 0xb9a6 +#define CPU_66AK2Lx 0xb9a7 +#ifdef CONFIG_SOC_K2HK #include <asm/arch/hardware-k2hk.h> #endif @@ -250,34 +261,33 @@ typedef volatile unsigned int *dv_reg_p;#endif #ifndef __ASSEMBLY__ -static inline int cpu_is_k2hk (void ) + +static inline u16 get_part_number (void ) { -unsigned int jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -unsigned int part_no = (jtag_id >>12 ) &0xffff ; +u32 jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -return (part_no ==0xb981 ) ?1 :0 ; +return (jtag_id &JTAGID_PART_NUM_MASK ) >>JTAGID_PART_NUM_SHIFT ; } -static inline int cpu_is_k2e (void ) +static inline u8 cpu_is_k2hk (void ) { -unsigned int jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -unsigned int part_no = (jtag_id >>12 ) &0xffff ; - -return (part_no ==0xb9a6 ) ?1 :0 ; +return get_part_number () == CPU_66AK2Hx; } -static inline int cpu_is_k2l (void ) +static inline u8 cpu_is_k2e (void ) { -unsigned int jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -unsigned int part_no = (jtag_id >>12 ) &0xffff ; +return get_part_number () == CPU_66AK2Ex; +} -return (part_no ==0xb9a7 ) ?1 :0 ; +static inline u8 cpu_is_k2l (void ) +{ +return get_part_number () == CPU_66AK2Lx; }
arch/arm/mach-keystone/include/mach/hardware.h typedef volatile unsigned int *dv_reg_p; · line 293
Quoted 10 lines
arch/arm/mach-keystone/include/mach/hardware.h +3
-3-static inline int cpu_revision (void ) +static inline u8 cpu_revision (void ) { -unsigned int jtag_id =__raw_readl (KS2_JTAG_ID_REG ); -unsigned int rev = (jtag_id >>28 ) &0xf ; +u32 jtag_id =__raw_readl (KS2_JTAG_ID_REG ); +u8 rev = (jtag_id &JTAGID_VARIANT_MASK ) &JTAGID_VARIANT_SHIFT ;return rev; }
PATCH 1/8 ARM: keystone2: Cleanup SoC detection
In reply to Lokesh VutlaQuoted 4 lines · Lokesh Vutla
Add proper register definition for JTAG ID and
cleanup cpu_is_* functions.Signed-off-by Lokesh Vutla <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150723/91df3644/attachment.sig>
PATCH 1/8 ARM: keystone2: Cleanup SoC detection
Quoted 8 lines · Tom Rini
Quoted 4 lines · Lokesh Vutla
Add proper register definition for JTAG ID and
cleanup cpu_is_* functions.Signed-off-by Lokesh Vutla <[email protected]>Reviewed-by Tom Rini <[email protected]>
Thanks for the review Tom.
Vitaly has some comments. Ill repost this
series with Vitaly's comments addressed.
Thanks and regards,
Lokesh
Quoted 1 line
PATCH 2/8 ARM: keystone2: Enable CONFIG_DISPLAY_CPUINFO
In reply to Lokesh VutlaAdd print_cpuinfo() function and enableCONFIG_DISPLAY_CPUINFO for keystone platforms,
so that cpu info can be displayed during boot.
--- arch/arm/mach-keystone/init.c | 24 ++++++++++++++++++++++++ include/configs/ti_armv7_keystone2.h | 1 + 2 files changed, 25 insertions(+)
arch/arm/mach-keystone/init.c +24 -0
@@ -149,3 +149,27 @@ void enable_caches(void)dcache_enable ();#endif } + +#if defined(CONFIG_DISPLAY_CPUINFO ) +int print_cpuinfo (void ) +{ +u16 cpu =get_part_number (); + +puts ("CPU: " ); +switch (cpu) { +case CPU_66AK2Hx: +puts ("66AK2Hx\n" ); +break ; +case CPU_66AK2Lx: +puts ("66AK2Lx\n" ); +break ; +case CPU_66AK2Ex: +puts ("66AK2Ex\n" ); +break ; +default : +puts ("Unknown\n" ); + } + +return 0 ; +} +#endif
include/configs/ti_armv7_keystone2.h +1 -0
@@ -15,6 +15,7 @@/* U-Boot Build Configuration */ #define CONFIG_SKIP_LOWLEVEL_INIT /* U-Boot is a 2nd stage loader */ #define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_DISPLAY_CPUINFO /* SoC Configuration */ #define CONFIG_ARCH_CPU_INIT
Signature · 1 line
2.1.4
PATCH 2/8 ARM: keystone2: Enable CONFIG_DISPLAY_CPUINFO
Quoted 48 lines · Lokesh Vutla
Add
print_cpuinfo()function and enableCONFIG_DISPLAY_CPUINFOfor keystone platforms,
so that cpu info can be displayed during boot.Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/mach-keystone/init.c | 24 ++++++++++++++++++++++++ include/configs/ti_armv7_keystone2.h | 1 + 2 files changed, 25 insertions(+)arch/arm/mach-keystone/init.c +24
-0@@ -149,3 +149,27 @@ void enable_caches(void)dcache_enable ();#endif } + +#if defined(CONFIG_DISPLAY_CPUINFO ) +int print_cpuinfo (void ) +{ +u16 cpu =get_part_number (); + +puts ("CPU: " ); +switch (cpu) { +case CPU_66AK2Hx: +puts ("66AK2Hx\n" ); +break ; +case CPU_66AK2Lx: +puts ("66AK2Lx\n" ); +break ; +case CPU_66AK2Ex: +puts ("66AK2Ex\n" ); +break ; +default : +puts ("Unknown\n" ); + } + +return 0 ; +} +#endif include/configs/ti_armv7_keystone2.h +0
-0
include/configs/ti_armv7_keystone2.h line 21
Quoted 7 lines
include/configs/ti_armv7_keystone2.h +1
-0@@ -15,6 +15,7 @@/* U-Boot Build Configuration */ #define CONFIG_SKIP_LOWLEVEL_INIT /* U-Boot is a 2nd stage loader */ #define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_DISPLAY_CPUINFO /* SoC Configuration */ #define CONFIG_ARCH_CPU_INIT
PATCH 2/8 ARM: keystone2: Enable CONFIG_DISPLAY_CPUINFO
In reply to Lokesh VutlaQuoted 5 lines · Lokesh Vutla
Add
print_cpuinfo()function and enableCONFIG_DISPLAY_CPUINFOfor keystone platforms,
so that cpu info can be displayed during boot.Signed-off-by Lokesh Vutla <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150723/763df287/attachment.sig>
PATCH 3/8 ARM: keystone2: Cleanup PLL init code
In reply to Lokesh VutlaThere are two types of PLL for all keystone platforms:
Main PLL, Secondary PLL. Instead of duplicating the same definition for each secondary PLL, have a common function which does initialization for both PLLs. And also add proper register definitions.
--- arch/arm/mach-keystone/clock.c | 309 ++++++++++------------- arch/arm/mach-keystone/include/mach/clock-k2e.h | 1 + arch/arm/mach-keystone/include/mach/clock.h | 1 - arch/arm/mach-keystone/include/mach/clock_defs.h | 77 +++++- board/ti/ks2_evm/board.c | 1 - 5 files changed, 201 insertions(+), 188 deletions(-)
arch/arm/mach-keystone/clock.c +129 -180
@@ -18,195 +18,157 @@ static void wait_for_completion(const struct pll_init_data *data)int i;for (i =0 ; i <100 ; i++) {sdelay (450 ); -if ((pllctl_reg_read (data->pll, stat) &PLLSTAT_GO ) ==0 ) +if (!(pllctl_reg_read (data->pll, stat) &PLLSTAT_GOSTAT_MASK ))break ; } } -void init_pll (const struct pll_init_data *data) +static inline void bypass_main_pll (const struct pll_init_data *data) +{ +pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLENSRC_MASK | +PLLCTL_PLLEN_MASK ); + +/* 4 cycles of reference clock CLKIN*/ +sdelay (340 ); +} + +static void configure_mult_div (const struct pll_init_data *data) { -u32 tmp, tmp_ctl, pllm, plld, pllod, bwadj; +u32 pllm, plld, bwadj; pllm = data->pll_m -1 ; - plld = (data->pll_d -1 ) &PLL_DIV_MASK ; - pllod = (data->pll_od -1 ) &PLL_CLKOD_MASK ; + plld = (data->pll_d -1 ) &CFG_PLLCTL0_PLLD_MASK ; -if (data->pll ==MAIN_PLL ) { -/* The requered delay before main PLL configuration */ -sdelay (210000 ); +/* Program Multiplier */ +if (data->pll ==MAIN_PLL ) +pllctl_reg_write (data->pll, mult, pllm &PLLM_MULT_LO_MASK ); - tmp =pllctl_reg_read (data->pll, secctl); +clrsetbits_le32 (keystone_pll_regs[data->pll].reg0, +CFG_PLLCTL0_PLLM_MASK , + pllm <<CFG_PLLCTL0_PLLM_SHIFT ); + +/* Program BWADJ */ + bwadj = (data->pll_m -1 ) >>1 ;/* Divide pllm by 2 */ +clrsetbits_le32 (keystone_pll_regs[data->pll].reg0, +CFG_PLLCTL0_BWADJ_MASK , + (bwadj <<CFG_PLLCTL0_BWADJ_SHIFT ) & +CFG_PLLCTL0_BWADJ_MASK ); + bwadj = bwadj >>CFG_PLLCTL0_BWADJ_BITS ; +clrsetbits_le32 (keystone_pll_regs[data->pll].reg1, +CFG_PLLCTL1_BWADJ_MASK , bwadj); + +/* Program Divider */ +clrsetbits_le32 (keystone_pll_regs[data->pll].reg0, +CFG_PLLCTL0_PLLD_MASK , plld); +} -if (tmp & (PLLCTL_BYPASS )) { -setbits_le32 (keystone_pll_regs[data->pll].reg1, -BIT (MAIN_ENSAT_OFFSET )); +void configure_main_pll (const struct pll_init_data *data) +{ +u32 tmp, pllod; -pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLEN | -PLLCTL_PLLENSRC ); -sdelay (340 ); + pllod = data->pll_od -1 ; -pllctl_reg_setbits (data->pll, secctl,PLLCTL_BYPASS ); -pllctl_reg_setbits (data->pll, ctl,PLLCTL_PLLPWRDN ); -sdelay (21000 ); +/* 100 micro sec for stabilization */ +sdelay (210000 ); -pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLPWRDN ); - }else { -pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLEN | -PLLCTL_PLLENSRC ); -sdelay (340 ); - } + tmp =pllctl_reg_read (data->pll, secctl); -pllctl_reg_write (data->pll, mult, pllm &PLLM_MULT_LO_MASK ); +/* Check for Bypass */ +if (tmp &SECCTL_BYPASS_MASK ) { +setbits_le32 (keystone_pll_regs[data->pll].reg1, +CFG_PLLCTL1_ENSAT_MASK ); -clrsetbits_le32 (keystone_pll_regs[data->pll].reg0, -PLLM_MULT_HI_SMASK , (pllm <<6 )); - -/* Set the BWADJ (12 bit field) */ - tmp_ctl = pllm >>1 ;/* Divide the pllm by 2 */ -clrsetbits_le32 (keystone_pll_regs[data->pll].reg0, -PLL_BWADJ_LO_SMASK , - (tmp_ctl <<PLL_BWADJ_LO_SHIFT )); -clrsetbits_le32 (keystone_pll_regs[data->pll].reg1, -PLL_BWADJ_HI_MASK , - (tmp_ctl >>8 )); - -/* -* Set the pll divider (6 bit field) * -* PLLD[5:0] is located in MAINPLLCTL0 -*/ -clrsetbits_le32 (keystone_pll_regs[data->pll].reg0, -PLL_DIV_MASK , plld); - -/* Set the OUTPUT DIVIDE (4 bit field) in SECCTL */ -pllctl_reg_rmw (data->pll, secctl,PLL_CLKOD_SMASK , - (pllod <<PLL_CLKOD_SHIFT )); -wait_for_completion (data); - -pllctl_reg_write (data->pll, div1,PLLM_RATIO_DIV1 ); -pllctl_reg_write (data->pll, div2,PLLM_RATIO_DIV2 ); -pllctl_reg_write (data->pll, div3,PLLM_RATIO_DIV3 ); -pllctl_reg_write (data->pll, div4,PLLM_RATIO_DIV4 ); -pllctl_reg_write (data->pll, div5,PLLM_RATIO_DIV5 ); - -pllctl_reg_setbits (data->pll, alnctl,0x1f ); - -/* -* Set GOSET bit in PLLCMD to initiate the GO operation -* to change the divide -*/ -pllctl_reg_setbits (data->pll, cmd,PLLSTAT_GO ); -sdelay (1500 );/* wait for the phase adj */ -wait_for_completion (data); - -/* Reset PLL */ -pllctl_reg_setbits (data->pll, ctl,PLLCTL_PLLRST ); -sdelay (21000 );/* Wait for a minimum of 7 us*/ -pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLRST ); -sdelay (105000 );/* Wait for PLL Lock time (min 50 us) */ - -pllctl_reg_clrbits (data->pll, secctl,PLLCTL_BYPASS ); - - tmp =pllctl_reg_setbits (data->pll, ctl,PLLCTL_PLLEN ); +bypass_main_pll (data); -#ifndef CONFIG_SOC_K2E - }else if (data->pll ==TETRIS_PLL ) { - bwadj = pllm >>1 ; -/* 1.5 Set PLLCTL0[BYPASS] =1 (enable bypass), */ -setbits_le32 (keystone_pll_regs[data->pll].reg0,PLLCTL_BYPASS ); -/* -* Set CHIPMISCCTL1[13] = 0 (enable glitchfree bypass) -* only applicable for Kepler -*/ -clrbits_le32 (KS2_MISC_CTRL ,KS2_ARM_PLL_EN ); -/* 2 In PLLCTL1, write PLLRST = 1 (PLL is reset) */ -setbits_le32 (keystone_pll_regs[data->pll].reg1 , -PLL_PLLRST |PLLCTL_ENSAT ); - -/* -* 3 Program PLLM and PLLD in PLLCTL0 register -* 4 Program BWADJ[7:0] in PLLCTL0 and BWADJ[11:8] in -* PLLCTL1 register. BWADJ value must be set -* to ((PLLM + 1) >> 1) ? 1) -*/ - tmp = ((bwadj &PLL_BWADJ_LO_MASK ) <<PLL_BWADJ_LO_SHIFT ) | - (pllm <<6 ) | - (plld &PLL_DIV_MASK ) | - (pllod <<PLL_CLKOD_SHIFT ) |PLLCTL_BYPASS ; -__raw_writel (tmp, keystone_pll_regs[data->pll].reg0); - -/* Set BWADJ[11:8] bits */ - tmp =__raw_readl (keystone_pll_regs[data->pll].reg1); - tmp &= ~(PLL_BWADJ_HI_MASK ); - tmp |= ((bwadj>>8 ) &PLL_BWADJ_HI_MASK ); -__raw_writel (tmp, keystone_pll_regs[data->pll].reg1); -/* -* 5 Wait for at least 5 us based on the reference -* clock (PLL reset time) -*/ -sdelay (21000 );/* Wait for a minimum of 7 us*/ - -/* 6 In PLLCTL1, write PLLRST = 0 (PLL reset is released) */ -clrbits_le32 (keystone_pll_regs[data->pll].reg1,PLL_PLLRST ); -/* -* 7 Wait for at least 500 * REFCLK cycles * (PLLD + 1) -* (PLL lock time) -*/ -sdelay (105000 ); -/* 8 disable bypass */ -clrbits_le32 (keystone_pll_regs[data->pll].reg0,PLLCTL_BYPASS ); -/* -* 9 Set CHIPMISCCTL1[13] = 1 (disable glitchfree bypass) -* only applicable for Kepler -*/ -setbits_le32 (KS2_MISC_CTRL ,KS2_ARM_PLL_EN ); -#endif - }else { -setbits_le32 (keystone_pll_regs[data->pll].reg1,PLLCTL_ENSAT ); -/* -* process keeps state of Bypass bit while programming -* all other DDR PLL settings -*/ - tmp =__raw_readl (keystone_pll_regs[data->pll].reg0); - tmp &=PLLCTL_BYPASS ;/* clear everything except Bypass */ - -/* -* Set the BWADJ[7:0], PLLD[5:0] and PLLM to PLLCTL0, -* bypass disabled -*/ - bwadj = pllm >>1 ; - tmp |= ((bwadj &PLL_BWADJ_LO_MASK ) <<PLL_BWADJ_LO_SHIFT ) | - (pllm <<PLL_MULT_SHIFT ) | - (plld &PLL_DIV_MASK ) | - (pllod <<PLL_CLKOD_SHIFT ); -__raw_writel (tmp, keystone_pll_regs[data->pll].reg0); - -/* Set BWADJ[11:8] bits */ - tmp =__raw_readl (keystone_pll_regs[data->pll].reg1); - tmp &= ~(PLL_BWADJ_HI_MASK ); - tmp |= ((bwadj >>8 ) &PLL_BWADJ_HI_MASK ); - -__raw_writel (tmp, keystone_pll_regs[data->pll].reg1); - -/* Reset bit: bit 14 for both DDR3 & PASS PLL */ - tmp =PLL_PLLRST ; -/* Set RESET bit = 1 */ -setbits_le32 (keystone_pll_regs[data->pll].reg1, tmp); -/* Wait for a minimum of 7 us*/ +/* Powerdown and powerup Main Pll */ +pllctl_reg_setbits (data->pll, secctl,SECCTL_BYPASS_MASK ); +pllctl_reg_setbits (data->pll, ctl,PLLCTL_PLLPWRDN_MASK ); +/* 5 micro sec */ sdelay (21000 ); -/* Clear RESET bit */ -clrbits_le32 (keystone_pll_regs[data->pll].reg1, tmp); -sdelay (105000 ); -/* clear BYPASS (Enable PLL Mode) */ -clrbits_le32 (keystone_pll_regs[data->pll].reg0,PLLCTL_BYPASS ); -sdelay (21000 );/* Wait for a minimum of 7 us*/ +pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLPWRDN_MASK ); + }else { +bypass_main_pll (data); } +configure_mult_div (data); + +/* Program Output Divider */ +pllctl_reg_rmw (data->pll, secctl,SECCTL_OP_DIV_MASK , + ((pllod <<SECCTL_OP_DIV_SHIFT ) &SECCTL_OP_DIV_MASK )); + +/* Program PLLDIVn */ +wait_for_completion (data); +pllctl_reg_write (data->pll, div1,PLLM_RATIO_DIV1 ); +pllctl_reg_write (data->pll, div2,PLLM_RATIO_DIV2 ); +pllctl_reg_write (data->pll, div3,PLLM_RATIO_DIV3 ); +pllctl_reg_write (data->pll, div4,PLLM_RATIO_DIV4 ); +pllctl_reg_write (data->pll, div5,PLLM_RATIO_DIV5 ); +pllctl_reg_setbits (data->pll, alnctl,ALNCTL_ALN5_MASK );/* -* This is required to provide a delay between multiple -* consequent PPL configurations +* Set GOSET bit in PLLCMD to initiate the GO operation +* to change the divide */ -sdelay (210000 ); +pllctl_reg_setbits (data->pll, cmd,PLLSTAT_GOSTAT_MASK ); +wait_for_completion (data); + +/* Reset PLL */ +pllctl_reg_setbits (data->pll, ctl,PLLCTL_PLLRST_MASK ); +sdelay (21000 );/* Wait for a minimum of 7 us*/ +pllctl_reg_clrbits (data->pll, ctl,PLLCTL_PLLRST_MASK ); +sdelay (105000 );/* Wait for PLL Lock time (min 50 us) */ + +/* Enable PLL */ +pllctl_reg_clrbits (data->pll, secctl,SECCTL_BYPASS_MASK ); +pllctl_reg_setbits (data->pll, ctl,PLLCTL_PLLEN_MASK ); +} + +void configure_secondary_pll (const struct pll_init_data *data) +{ +int pllod = data->pll_od -1 ; + +/* Enable Bypass mode */ +setbits_le32 (keystone_pll_regs[data->pll].reg1,CFG_PLLCTL1_ENSAT_MASK ); +setbits_le32 (keystone_pll_regs[data->pll].reg0, +CFG_PLLCTL0_BYPASS_MASK ); + +configure_mult_div (data); + +/* Program Output Divider */ +clrsetbits_le32 (keystone_pll_regs[data->pll].reg0, +CFG_PLLCTL0_CLKOD_MASK , + (pllod <<CFG_PLLCTL0_CLKOD_SHIFT ) & +CFG_PLLCTL0_CLKOD_MASK ); + +/* Reset PLL */ +setbits_le32 (keystone_pll_regs[data->pll].reg1,CFG_PLLCTL1_RST_MASK ); +/* Wait for 5 micro seconds */ +sdelay (21000 ); + +/* Select the Output of PASS PLL as input to PASS */ +if (data->pll ==PASS_PLL ) +setbits_le32 (keystone_pll_regs[data->pll].reg1, +CFG_PLLCTL1_PAPLL_MASK ); + +/* Select the Output of ARM PLL as input to ARM */ +if (data->pll ==TETRIS_PLL ) +setbits_le32 (KS2_MISC_CTRL ,MISC_CTL1_ARM_PLL_EN ); + +clrbits_le32 (keystone_pll_regs[data->pll].reg1,CFG_PLLCTL1_RST_MASK ); +/* Wait for 500 * REFCLK cucles * (PLLD + 1) */ +sdelay (105000 ); + +/* Switch to PLL mode */ +clrbits_le32 (keystone_pll_regs[data->pll].reg0, +CFG_PLLCTL0_BYPASS_MASK ); +} + +void init_pll (const struct pll_init_data *data) +{ +if (data->pll ==MAIN_PLL ) +configure_main_pll (data); +else +configure_secondary_pll (data); }void init_plls (int num_pll,struct pll_init_data *config)
@@ -257,16 +219,3 @@ inline int get_max_dev_speed(void) {return get_max_speed ((read_efuse_bootrom () >>16 ) &0xffff , dev_speeds); } - -void pass_pll_pa_clk_enable (void ) -{ -u32 reg; - - reg =readl (keystone_pll_regs[PASS_PLL ].reg1); - - reg |=PLLCTL_PAPLL ; -writel (reg, keystone_pll_regs[PASS_PLL ].reg1); - -/* wait till clock is enabled */ -sdelay (15000 ); -}
arch/arm/mach-keystone/include/mach/clock-k2e.h +1 -0
@@ -55,6 +55,7 @@ enum pll_type_e {CORE_PLL ,PASS_PLL ,DDR3_PLL , + TETRIS_PLL, }; enum {
arch/arm/mach-keystone/include/mach/clock.h +0 -1
@@ -58,7 +58,6 @@ void init_pll(const struct pll_init_data *data);unsigned long clk_get_rate (unsigned int clk);unsigned long clk_round_rate (unsigned int clk,unsigned long hz);int clk_set_rate (unsigned int clk,unsigned long hz); -void pass_pll_pa_clk_enable (void );int get_max_dev_speed (void );int get_max_arm_speed (void );
arch/arm/mach-keystone/include/mach/clock_defs.h +71 -6
88 lines not on this page · raw message
board/ti/ks2_evm/board.c +0 -1
@@ -80,7 +80,6 @@ int board_eth_init(bd_t *bis)return -1 ;if (psc_enable_module (KS2_LPSC_CRYPTO ))return -1 ; -pass_pll_pa_clk_enable (); port_num =get_num_eth_ports ();
Signature · 1 line
2.1.4
PATCH 3/8 ARM: keystone2: Cleanup PLL init code
Quoted 7 lines · Lokesh Vutla
There are two types of PLL for all keystone platforms:
Main PLL, Secondary PLL. Instead of duplicating the same definition for each secondary PLL, have a common function which does initialization for both PLLs. And also add proper register definitions.Signed-off-by Lokesh Vutla <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150723/0c18d3ce/attachment.sig>
PATCH 4/8 ARM: keystone2: Fix dev and arm speed detection
In reply to Lokesh VutlaAs per the Documentation for K2HK[1], K2L[2], K2E[3], the definition of DEVSPEED register is same, only the supporting speeds are different. Hence use the same speed definition for all platforms, and read the DEVSPEED register to detect the supporting max speed.
[1] http://www.ti.com/lit/ds/symlink/66ak2h12.pdf
[2] http://www.ti.com/lit/ds/symlink/66ak2l06.pdf
[3] http://www.ti.com/lit/ds/symlink/am5k2e04.pdf
--- arch/arm/mach-keystone/clock-k2e.c | 16 ------ arch/arm/mach-keystone/clock-k2hk.c | 32 ----------- arch/arm/mach-keystone/clock-k2l.c | 32 ----------- arch/arm/mach-keystone/clock.c | 71 ++++++++++++++---------- arch/arm/mach-keystone/include/mach/clock-k2e.h | 15 ++--- arch/arm/mach-keystone/include/mach/clock-k2hk.h | 14 ++--- arch/arm/mach-keystone/include/mach/clock-k2l.h | 14 ++--- arch/arm/mach-keystone/include/mach/clock.h | 9 +++ arch/arm/mach-keystone/include/mach/hardware.h | 7 +++ board/ti/ks2_evm/board_k2e.c | 1 - 10 files changed, 73 insertions(+), 138 deletions(-)
arch/arm/mach-keystone/clock-k2e.c +0 -16
@@ -17,22 +17,6 @@ const struct keystone_pll_regs keystone_pll_regs[] = { [DDR3_PLL] = {KS2_DDR3APLLCTL0, KS2_DDR3APLLCTL1}, }; -int dev_speeds[] = { -SPD800 , -SPD850 , -SPD1000 , -SPD1250 , -SPD1350 , -SPD1400 , -SPD1500 , -SPD1400 , -SPD1350 , -SPD1250 , -SPD1000 , -SPD850 , -SPD800 -}; -/** * pll_freq_get - get pll frequency * Fout = Fref * NF(mult) / NR(prediv) / OD
arch/arm/mach-keystone/clock-k2hk.c +0 -32
@@ -19,38 +19,6 @@ const struct keystone_pll_regs keystone_pll_regs[] = { [DDR3B_PLL] = {KS2_DDR3BPLLCTL0, KS2_DDR3BPLLCTL1}, }; -int dev_speeds[] = { -SPD800 , -SPD1000 , -SPD1200 , -SPD800 , -SPD800 , -SPD800 , -SPD800 , -SPD800 , -SPD1200 , -SPD1000 , -SPD800 , -SPD800 , -SPD800 , -}; - -int arm_speeds[] = { -SPD800 , -SPD1000 , -SPD1200 , -SPD1350 , -SPD1400 , -SPD800 , -SPD1400 , -SPD1350 , -SPD1200 , -SPD1000 , -SPD800 , -SPD800 , -SPD800 , -}; -/** * pll_freq_get - get pll frequency * Fout = Fref * NF(mult) / NR(prediv) / OD
arch/arm/mach-keystone/clock-k2l.c +0 -32
@@ -18,38 +18,6 @@ const struct keystone_pll_regs keystone_pll_regs[] = { [DDR3_PLL] = {KS2_DDR3APLLCTL0, KS2_DDR3APLLCTL1}, }; -int dev_speeds[] = { -SPD800 , -SPD1000 , -SPD1200 , -SPD800 , -SPD800 , -SPD800 , -SPD800 , -SPD800 , -SPD1200 , -SPD1000 , -SPD800 , -SPD800 , -SPD800 , -}; - -int arm_speeds[] = { -SPD800 , -SPD1000 , -SPD1200 , -SPD1350 , -SPD1400 , -SPD800 , -SPD1400 , -SPD1350 , -SPD1200 , -SPD1000 , -SPD800 , -SPD800 , -SPD800 , -}; -/** * pll_freq_get - get pll frequency * Fout = Fref * NF(mult) / NR(prediv) / OD
arch/arm/mach-keystone/clock.c +43 -28
93 lines not on this page · raw message
arch/arm/mach-keystone/include/mach/clock-k2e.h +4 -11
@@ -58,17 +58,6 @@ enum pll_type_e { TETRIS_PLL, }; -enum { -SPD800 , -SPD850 , -SPD1000 , -SPD1250 , -SPD1350 , -SPD1400 , -SPD1500 , -SPD_RSV -}; -#define CORE_PLL_800 {CORE_PLL, 16, 1, 2}#define CORE_PLL_850 {CORE_PLL, 17, 1, 2}#define CORE_PLL_1000 {CORE_PLL, 20, 1, 2}
@@ -83,4 +72,8 @@ enum {#define DDR3_PLL_800 {DDR3_PLL, 16, 1, 2}#define DDR3_PLL_333 {DDR3_PLL, 20, 1, 6} +/* k2e DEV supports 800, 1000, 1200, 1350, 1400, 1500 MHz */ +#define DEV_SUPPORTED_SPEEDS 0x3FF +#define ARM_SUPPORTED_SPEEDS 0 +#endif
arch/arm/mach-keystone/include/mach/clock-k2hk.h +5 -9
@@ -64,15 +64,6 @@ enum pll_type_e { DDR3B_PLL, }; -enum { -SPD800 , -SPD1000 , -SPD1200 , -SPD1350 , -SPD1400 , -SPD_RSV -}; -#define CORE_PLL_799 {CORE_PLL, 13, 1, 2}#define CORE_PLL_983 {CORE_PLL, 16, 1, 2}#define CORE_PLL_999 {CORE_PLL, 122, 15, 1}
@@ -100,4 +91,9 @@ enum {#define DDR3_PLL_800 (x) {DDR3##x##_PLL, 16, 1, 2}#define DDR3_PLL_333 (x) {DDR3##x##_PLL, 20, 1, 6} +/* k2h DEV supports 800, 1000, 1200 MHz */ +#define DEV_SUPPORTED_SPEEDS 0x383 +/* k2h ARM supportd 800, 1000, 1200, 1350, 1400 MHz */ +#define ARM_SUPPORTED_SPEEDS 0x3EF +#endif
arch/arm/mach-keystone/include/mach/clock-k2l.h +5 -9
@@ -59,15 +59,6 @@ enum pll_type_e { DDR3_PLL, }; -enum { -SPD800 , -SPD1000 , -SPD1200 , -SPD1350 , -SPD1400 , -SPD_RSV -}; -#define CORE_PLL_799 {CORE_PLL, 13, 1, 2}#define CORE_PLL_983 {CORE_PLL, 16, 1, 2}#define CORE_PLL_1000 {CORE_PLL, 114, 7, 2}
@@ -92,4 +83,9 @@ enum {#define DDR3_PLL_800 {DDR3_PLL, 16, 1, 2}#define DDR3_PLL_333 {DDR3_PLL, 20, 1, 6} +/* k2l DEV supports 800, 1000, 1200 MHz */ +#define DEV_SUPPORTED_SPEEDS 0x383 +/* k2l ARM supportd 800, 1000, 1200, MHz */ +#define ARM_SUPPORTED_SPEEDS 0x383 +#endif
arch/arm/mach-keystone/include/mach/clock.h +9 -0
@@ -32,6 +32,15 @@#define GENERATE_INDX_STR (NUM ,STRING ) #NUM"\t- "#STRING"\n"#define CLOCK_INDEXES_LIST CLK_LIST(GENERATE_INDX_STR) +enum { +SPD800 , +SPD1000 , +SPD1200 , +SPD1350 , +SPD1400 , +SPD1500 , +}; +enum clk_e { CLK_LIST(GENERATE_ENUM) };
arch/arm/mach-keystone/include/mach/hardware.h +7 -0
@@ -248,6 +248,13 @@ typedef volatile unsigned int *dv_reg_p;#define CPU_66AK2Ex 0xb9a6#define CPU_66AK2Lx 0xb9a7 +/* DEVSPEED register */ +#define DEVSPEED_DEVSPEED_SHIFT 16 +#define DEVSPEED_DEVSPEED_MASK (0xfff << 16) +#define DEVSPEED_ARMSPEED_SHIFT 0 +#define DEVSPEED_ARMSPEED_MASK 0xfff +#define DEVSPEED_NUMSPDS 12 +#ifdef CONFIG_SOC_K2HK #include <asm/arch/hardware-k2hk.h> #endif
board/ti/ks2_evm/board_k2e.c +0 -1
@@ -28,7 +28,6 @@ unsigned int external_clk[ext_clk_count] = {static struct pll_init_data core_pll_config[] = {CORE_PLL_800 , -CORE_PLL_850 ,CORE_PLL_1000 ,CORE_PLL_1250 ,CORE_PLL_1350 ,
Signature · 1 line
2.1.4
PATCH 4/8 ARM: keystone2: Fix dev and arm speed detection
Quoted 10 lines · Lokesh Vutla
As per the Documentation for K2HK[1], K2L[2], K2E[3], the definition of DEVSPEED register is same, only the supporting speeds are different. Hence use the same speed definition for all platforms, and read the DEVSPEED register to detect the supporting max speed.
[1] http://www.ti.com/lit/ds/symlink/66ak2h12.pdf
[2] http://www.ti.com/lit/ds/symlink/66ak2l06.pdf
[3] http://www.ti.com/lit/ds/symlink/am5k2e04.pdfSigned-off-by Lokesh Vutla <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150723/c7622821/attachment.sig>
PATCH 5/8 ARM: keystone2: Use common structure for PLLs
In reply to Lokesh VutlaRegister Base addresses are same for PLLs in all keystone platforms. If a PLL is not available, the corresponding register addresses are marked as reserved.
Hence use a common definition.
--- arch/arm/mach-keystone/clock-k2e.c | 6 ------ arch/arm/mach-keystone/clock-k2hk.c | 8 -------- arch/arm/mach-keystone/clock-k2l.c | 7 ------- arch/arm/mach-keystone/clock.c | 8 ++++++++ arch/arm/mach-keystone/include/mach/clock-k2e.h | 8 -------- arch/arm/mach-keystone/include/mach/clock-k2hk.h | 9 --------- arch/arm/mach-keystone/include/mach/clock-k2l.h | 8 -------- arch/arm/mach-keystone/include/mach/clock.h | 13 ++++++++++++- arch/arm/mach-keystone/include/mach/hardware-k2hk.h | 4 ---- arch/arm/mach-keystone/include/mach/hardware.h | 2 ++ 10 files changed, 22 insertions(+), 51 deletions(-)
arch/arm/mach-keystone/clock-k2e.c +0 -6
@@ -11,12 +11,6 @@#include <asm/arch/clock.h> #include <asm/arch/clock_defs.h> -const struct keystone_pll_regs keystone_pll_regs[] = { - [CORE_PLL ] = {KS2_MAINPLLCTL0 ,KS2_MAINPLLCTL1 }, - [PASS_PLL ] = {KS2_PASSPLLCTL0 ,KS2_PASSPLLCTL1 }, - [DDR3_PLL ] = {KS2_DDR3APLLCTL0 ,KS2_DDR3APLLCTL1 }, -}; -/** * pll_freq_get - get pll frequency * Fout = Fref * NF(mult) / NR(prediv) / OD
arch/arm/mach-keystone/clock-k2hk.c +0 -8
@@ -11,14 +11,6 @@#include <asm/arch/clock.h> #include <asm/arch/clock_defs.h> -const struct keystone_pll_regs keystone_pll_regs[] = { - [CORE_PLL ] = {KS2_MAINPLLCTL0 ,KS2_MAINPLLCTL1 }, - [PASS_PLL ] = {KS2_PASSPLLCTL0 ,KS2_PASSPLLCTL1 }, - [TETRIS_PLL ] = {KS2_ARMPLLCTL0 ,KS2_ARMPLLCTL1 }, - [DDR3A_PLL ] = {KS2_DDR3APLLCTL0 ,KS2_DDR3APLLCTL1 }, - [DDR3B_PLL ] = {KS2_DDR3BPLLCTL0 ,KS2_DDR3BPLLCTL1 }, -}; -/** * pll_freq_get - get pll frequency * Fout = Fref * NF(mult) / NR(prediv) / OD
arch/arm/mach-keystone/clock-k2l.c +0 -7
@@ -11,13 +11,6 @@#include <asm/arch/clock.h> #include <asm/arch/clock_defs.h> -const struct keystone_pll_regs keystone_pll_regs[] = { - [CORE_PLL ] = {KS2_MAINPLLCTL0 ,KS2_MAINPLLCTL1 }, - [PASS_PLL ] = {KS2_PASSPLLCTL0 ,KS2_PASSPLLCTL1 }, - [TETRIS_PLL ] = {KS2_ARMPLLCTL0 ,KS2_ARMPLLCTL1 }, - [DDR3_PLL ] = {KS2_DDR3APLLCTL0 ,KS2_DDR3APLLCTL1 }, -}; -/** * pll_freq_get - get pll frequency * Fout = Fref * NF(mult) / NR(prediv) / OD
arch/arm/mach-keystone/clock.c +8 -0
@@ -25,6 +25,14 @@ static int speeds[] = { SPD800, }; +const struct keystone_pll_regs keystone_pll_regs[] = { + [CORE_PLL ] = {KS2_MAINPLLCTL0 ,KS2_MAINPLLCTL1 }, + [PASS_PLL ] = {KS2_PASSPLLCTL0 ,KS2_PASSPLLCTL1 }, + [TETRIS_PLL ] = {KS2_ARMPLLCTL0 ,KS2_ARMPLLCTL1 }, + [DDR3A_PLL ] = {KS2_DDR3APLLCTL0 ,KS2_DDR3APLLCTL1 }, + [DDR3B_PLL ] = {KS2_DDR3BPLLCTL0 ,KS2_DDR3BPLLCTL1 }, +}; +static void wait_for_completion (const struct pll_init_data *data) {int i;
arch/arm/mach-keystone/include/mach/clock-k2e.h +0 -8
@@ -50,14 +50,6 @@ extern unsigned int external_clk[ext_clk_count];#define KS2_CLK1_6 sys_clk0_6_clk -/* PLL identifiers */ -enum pll_type_e { -CORE_PLL , -PASS_PLL , -DDR3_PLL , -TETRIS_PLL , -}; -#define CORE_PLL_800 {CORE_PLL, 16, 1, 2}#define CORE_PLL_850 {CORE_PLL, 17, 1, 2}#define CORE_PLL_1000 {CORE_PLL, 20, 1, 2}
arch/arm/mach-keystone/include/mach/clock-k2hk.h +0 -9
@@ -55,15 +55,6 @@ extern unsigned int external_clk[ext_clk_count];#define KS2_CLK1_6 sys_clk0_6_clk -/* PLL identifiers */ -enum pll_type_e { -CORE_PLL , -PASS_PLL , -TETRIS_PLL , -DDR3A_PLL , -DDR3B_PLL , -}; -#define CORE_PLL_799 {CORE_PLL, 13, 1, 2}#define CORE_PLL_983 {CORE_PLL, 16, 1, 2}#define CORE_PLL_999 {CORE_PLL, 122, 15, 1}
arch/arm/mach-keystone/include/mach/clock-k2l.h +0 -8
@@ -51,14 +51,6 @@ extern unsigned int external_clk[ext_clk_count];#define KS2_CLK1_6 sys_clk0_6_clk -/* PLL identifiers */ -enum pll_type_e { -CORE_PLL , -PASS_PLL , -TETRIS_PLL , -DDR3_PLL , -}; -#define CORE_PLL_799 {CORE_PLL, 13, 1, 2}#define CORE_PLL_983 {CORE_PLL, 16, 1, 2}#define CORE_PLL_1000 {CORE_PLL, 114, 7, 2}
arch/arm/mach-keystone/include/mach/clock.h +12 -1
@@ -24,7 +24,8 @@#include <asm/arch/clock-k2l.h> #endif -#define MAIN_PLL CORE_PLL +#define CORE_PLL MAIN_PLL +#define DDR3_PLL DDR3A_PLL#include <asm/types.h>
@@ -41,6 +42,16 @@ enum { SPD1500, }; +/* PLL identifiers */ +enum { +MAIN_PLL , +TETRIS_PLL , +PASS_PLL , +DDR3A_PLL , +DDR3B_PLL , +MAX_PLL_COUNT , +}; +enum clk_e { CLK_LIST(GENERATE_ENUM) };
arch/arm/mach-keystone/include/mach/hardware-k2hk.h +0 -4
@@ -15,10 +15,6 @@/* PA SS Registers */ #define KS2_PASS_BASE 0x02000000 -/* PLL control registers */ -#define KS2_DDR3BPLLCTL0 (KS2_DEVICE_STATE_CTRL_BASE + 0x368) -#define KS2_DDR3BPLLCTL1 (KS2_DEVICE_STATE_CTRL_BASE + 0x36C) -/* Power and Sleep Controller (PSC) Domains */ #define KS2_LPSC_MOD 0#define KS2_LPSC_DUMMY1 1
arch/arm/mach-keystone/include/mach/hardware.h +2 -0
@@ -165,6 +165,8 @@ typedef volatile unsigned int *dv_reg_p;#define KS2_PASSPLLCTL1 (KS2_DEVICE_STATE_CTRL_BASE + 0x35C)#define KS2_DDR3APLLCTL0 (KS2_DEVICE_STATE_CTRL_BASE + 0x360)#define KS2_DDR3APLLCTL1 (KS2_DEVICE_STATE_CTRL_BASE + 0x364) +#define KS2_DDR3BPLLCTL0 (KS2_DEVICE_STATE_CTRL_BASE + 0x368) +#define KS2_DDR3BPLLCTL1 (KS2_DEVICE_STATE_CTRL_BASE + 0x36C)#define KS2_ARMPLLCTL0 (KS2_DEVICE_STATE_CTRL_BASE + 0x370)#define KS2_ARMPLLCTL1 (KS2_DEVICE_STATE_CTRL_BASE + 0x374)
Signature · 1 line
2.1.4
PATCH 5/8 ARM: keystone2: Use common structure for PLLs
Quoted 6 lines · Lokesh Vutla
Register Base addresses are same for PLLs in all keystone platforms. If a PLL is not available, the corresponding register addresses are marked as reserved.
Hence use a common definition.Signed-off-by Lokesh Vutla <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150723/a4313f37/attachment.sig>
PATCH 6/8 ARM: keystone2: Cleanup init_pll definition
In reply to Lokesh VutlaThis is just a cosmetic change that makes
the calling of pll init code looks much cleaner.
--- arch/arm/mach-keystone/clock.c | 12 ++++++--- arch/arm/mach-keystone/include/mach/clock.h | 3 ++- board/ti/ks2_evm/board_k2e.c | 33 +++++++++++++++-------- board/ti/ks2_evm/board_k2hk.c | 41 ++++++++++++++++++----------- board/ti/ks2_evm/board_k2l.c | 41 ++++++++++++++++++----------- 5 files changed, 84 insertions(+), 46 deletions(-)
arch/arm/mach-keystone/clock.c +8 -4
@@ -191,12 +191,16 @@ void init_pll(const struct pll_init_data *data)configure_secondary_pll (data); } -void init_plls (int num_pll,struct pll_init_data *config) +void init_plls (void ) { -int i; +struct pll_init_data *data; +int pll; -for (i =0 ; i < num_pll; i++) -init_pll (&config[i]); +for (pll =MAIN_PLL ; pll <MAX_PLL_COUNT ; pll++) { + data =get_pll_init_data (pll); +if (data) +init_pll (data); + } }static int get_max_speed (u32 val,u32 speed_supported)
arch/arm/mach-keystone/include/mach/clock.h +2 -1
@@ -73,8 +73,9 @@ extern const struct keystone_pll_regs keystone_pll_regs[];extern int dev_speeds[];extern int arm_speeds[]; -void init_plls (int num_pll,struct pll_init_data *config); +void init_plls (void );void init_pll (const struct pll_init_data *data); +struct pll_init_data *get_pll_init_data (int pll);unsigned long clk_get_rate (unsigned int clk);unsigned long clk_round_rate (unsigned int clk,unsigned long hz);int clk_set_rate (unsigned int clk,unsigned long hz);
board/ti/ks2_evm/board_k2e.c +22 -11
@@ -38,6 +38,26 @@ static struct pll_init_data core_pll_config[] = {static struct pll_init_data pa_pll_config =PASS_PLL_1000 ; +struct pll_init_data *get_pll_init_data (int pll) +{ +int speed; +struct pll_init_data *data; + +switch (pll) { +case MAIN_PLL : + speed =get_max_dev_speed (); + data = &core_pll_config[speed]; +break ; +case PASS_PLL : + data = &pa_pll_config; +break ; +default : + data =NULL ; + } + +return data; +} + #ifdef CONFIG_DRIVER_TI_KEYSTONE_NET struct eth_priv_t eth_priv_cfg[] = { {
@@ -107,24 +127,15 @@ int get_num_eth_ports(void)#if defined(CONFIG_BOARD_EARLY_INIT_F )int board_early_init_f (void ) { -int speed; - - speed =get_max_dev_speed (); -init_pll (&core_pll_config[speed]); - -init_pll (&pa_pll_config); +init_plls ();return 0 ; }#endif #ifdef CONFIG_SPL_BUILD -static struct pll_init_data spl_pll_config[] = { -CORE_PLL_800 , -}; -void spl_init_keystone_plls (void ) { -init_plls (ARRAY_SIZE (spl_pll_config), spl_pll_config); +init_plls (); }#endif
board/ti/ks2_evm/board_k2hk.c +26 -15
60 lines not on this page · raw message
board/ti/ks2_evm/board_k2l.c +26 -15
60 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH 6/8 ARM: keystone2: Cleanup init_pll definition
Quoted 26 lines · Lokesh Vutla
This is just a cosmetic change that makes
the calling of pll init code looks much cleaner.Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/mach-keystone/clock.c | 12 ++++++--- arch/arm/mach-keystone/include/mach/clock.h | 3 ++- board/ti/ks2_evm/board_k2e.c | 33 +++++++++++++++-------- board/ti/ks2_evm/board_k2hk.c | 41 ++++++++++++++++++----------- board/ti/ks2_evm/board_k2l.c | 41 ++++++++++++++++++----------- 5 files changed, 84 insertions(+), 46 deletions(-)arch/arm/mach-keystone/clock.c +3
-2@@ -191,12 +191,16 @@ void init_pll(const struct pll_init_data *data)configure_secondary_pll (data); } -void init_plls (int num_pll,struct pll_init_data *config) +void init_plls (void ) { -int i; +struct pll_init_data *data; +int pll;
arch/arm/mach-keystone/clock.c void init_pll(const struct pll_init_data *data) · line 205
Quoted 10 lines
arch/arm/mach-keystone/clock.c +5
-2-for (i =0 ; i < num_pll; i++) -init_pll (&config[i]); +for (pll =MAIN_PLL ; pll <MAX_PLL_COUNT ; pll++) { + data =get_pll_init_data (pll); +if (data) +init_pll (data); + } }
Does the MAX_PLL_COUNT represent all PLLs on board?
If that is true, I think the patch is incorrect.
If you look at the history of the PLL configuration code you will find that we had this cod in the past and changed it.
The currently working code doesn't configure all PLLs an advance. For example DDR3a PLLs is configured later, after getting information about required DDR3 speed. Also the current version of code doesn't configure DDR3B at all. And I don't see any reason why do we need to change it.
Quoted 207 lines
arch/arm/mach-keystone/clock.c +0
-0static int get_max_speed (u32 val,u32 speed_supported)arch/arm/mach-keystone/include/mach/clock.h +2
-1@@ -73,8 +73,9 @@ extern const struct keystone_pll_regs keystone_pll_regs[];extern int dev_speeds[];extern int arm_speeds[]; -void init_plls (int num_pll,struct pll_init_data *config); +void init_plls (void );void init_pll (const struct pll_init_data *data); +struct pll_init_data *get_pll_init_data (int pll);unsigned long clk_get_rate (unsigned int clk);unsigned long clk_round_rate (unsigned int clk,unsigned long hz);int clk_set_rate (unsigned int clk,unsigned long hz);board/ti/ks2_evm/board_k2e.c +22
-11@@ -38,6 +38,26 @@ static struct pll_init_data core_pll_config[] = {static struct pll_init_data pa_pll_config =PASS_PLL_1000 ; +struct pll_init_data *get_pll_init_data (int pll) +{ +int speed; +struct pll_init_data *data; + +switch (pll) { +case MAIN_PLL : + speed =get_max_dev_speed (); + data = &core_pll_config[speed]; +break ; +case PASS_PLL : + data = &pa_pll_config; +break ; +default : + data =NULL ; + } + +return data; +} + #ifdef CONFIG_DRIVER_TI_KEYSTONE_NET struct eth_priv_t eth_priv_cfg[] = { {@@ -107,24 +127,15 @@ int get_num_eth_ports(void)#if defined(CONFIG_BOARD_EARLY_INIT_F )int board_early_init_f (void ) { -int speed; - - speed =get_max_dev_speed (); -init_pll (&core_pll_config[speed]); - -init_pll (&pa_pll_config); +init_plls ();return 0 ; }#endif #ifdef CONFIG_SPL_BUILD -static struct pll_init_data spl_pll_config[] = { -CORE_PLL_800 , -}; -void spl_init_keystone_plls (void ) { -init_plls (ARRAY_SIZE (spl_pll_config), spl_pll_config); +init_plls (); }#endif board/ti/ks2_evm/board_k2hk.c +26
-15@@ -46,6 +46,30 @@ static struct pll_init_data tetris_pll_config[] = {static struct pll_init_data pa_pll_config =PASS_PLL_983 ; +struct pll_init_data *get_pll_init_data (int pll) +{ +int speed; +struct pll_init_data *data; + +switch (pll) { +case MAIN_PLL : + speed =get_max_dev_speed (); + data = &core_pll_config[speed]; +break ; +case TETRIS_PLL : + speed =get_max_arm_speed (); + data = &tetris_pll_config[speed]; +break ; +case PASS_PLL : + data = &pa_pll_config; +break ; +default : + data =NULL ; + } + +return data; +} + #ifdef CONFIG_DRIVER_TI_KEYSTONE_NET struct eth_priv_t eth_priv_cfg[] = { {@@ -87,28 +111,15 @@ int get_num_eth_ports(void)#ifdef CONFIG_BOARD_EARLY_INIT_F int board_early_init_f (void ) { -int speed; - - speed =get_max_dev_speed (); -init_pll (&core_pll_config[speed]); - -init_pll (&pa_pll_config); - - speed =get_max_arm_speed (); -init_pll (&tetris_pll_config[speed]); +init_plls ();return 0 ; }#endif #ifdef CONFIG_SPL_BUILD -static struct pll_init_data spl_pll_config[] = { -CORE_PLL_799 , -TETRIS_PLL_500 , -}; -void spl_init_keystone_plls (void ) { -init_plls (ARRAY_SIZE (spl_pll_config), spl_pll_config); +init_plls (); }#endif board/ti/ks2_evm/board_k2l.c +26
-15@@ -42,6 +42,30 @@ static struct pll_init_data tetris_pll_config[] = {static struct pll_init_data pa_pll_config =PASS_PLL_983 ; +struct pll_init_data *get_pll_init_data (int pll) +{ +int speed; +struct pll_init_data *data; + +switch (pll) { +case MAIN_PLL : + speed =get_max_dev_speed (); + data = &core_pll_config[speed]; +break ; +case TETRIS_PLL : + speed =get_max_arm_speed (); + data = &tetris_pll_config[speed]; +break ; +case PASS_PLL : + data = &pa_pll_config; +break ; +default : + data =NULL ; + } + +return data; +} + #ifdef CONFIG_DRIVER_TI_KEYSTONE_NET struct eth_priv_t eth_priv_cfg[] = { {@@ -83,28 +107,15 @@ int get_num_eth_ports(void)#ifdef CONFIG_BOARD_EARLY_INIT_F int board_early_init_f (void ) { -int speed; - - speed =get_max_dev_speed (); -init_pll (&core_pll_config[speed]); - -init_pll (&pa_pll_config); - - speed =get_max_arm_speed (); -init_pll (&tetris_pll_config[speed]); +init_plls ();return 0 ; }#endif #ifdef CONFIG_SPL_BUILD -static struct pll_init_data spl_pll_config[] = { -CORE_PLL_799 , -TETRIS_PLL_491 , -}; -void spl_init_keystone_plls (void ) { -init_plls (ARRAY_SIZE (spl_pll_config), spl_pll_config); +init_plls (); }#endif
PATCH 6/8 ARM: keystone2: Cleanup init_pll definition
Hi Vitaly,
Quoted 34 lines · Vitaly Andrianov
Quoted 31 lines · Lokesh Vutla
This is just a cosmetic change that makes
the calling of pll init code looks much cleaner.Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/mach-keystone/clock.c | 12 ++++++--- arch/arm/mach-keystone/include/mach/clock.h | 3 ++- board/ti/ks2_evm/board_k2e.c | 33 +++++++++++++++-------- board/ti/ks2_evm/board_k2hk.c | 41 ++++++++++++++++++----------- board/ti/ks2_evm/board_k2l.c | 41 ++++++++++++++++++----------- 5 files changed, 84 insertions(+), 46 deletions(-)arch/arm/mach-keystone/clock.c +3
-2@@ -191,12 +191,16 @@ void init_pll(const struct pll_init_data *data)configure_secondary_pll (data); } -void init_plls (int num_pll,struct pll_init_data *config) +void init_plls (void ) { -int i; +struct pll_init_data *data; +int pll;
Quoted 10 lines
arch/arm/mach-keystone/clock.c void init_pll(const struct pll_init_data *data) · line 205
Quoted 9 lines
arch/arm/mach-keystone/clock.c +5
-2-for (i =0 ; i < num_pll; i++) -init_pll (&config[i]); +for (pll =MAIN_PLL ; pll <MAX_PLL_COUNT ; pll++) { + data =get_pll_init_data (pll); +if (data) +init_pll (data); + } }Does the
MAX_PLL_COUNTrepresent all PLLs on board?
It includes all except DDR. I haven't touched DDR yet.
Quoted 3 lines
If that is true, I think the patch is incorrect.
If you look at the history of the PLL configuration code you will find that we had this cod in the past and changed it.
May I know why DDR pll cannot be initialized along with other PLLs?
Quoted 6 lines
The currently working code doesn't configure all PLLs an advance. For example DDR3a PLLs is configured later, after getting information about required DDR3 speed. Also the current version of code doesn't configure DDR3B at all. And I don't see any reason why do we need to change it.
So, get_pll_init_data() is defined in every board file and passes the correct
pll data. If pll is not available, it passes NULL so pll is not initialized.
Instead of calling init_pll for each pll separately, I made a single function
which takes care of all this stuff.
Thanks and regards,
Lokesh
Quoted 214 lines
Quoted 214 lines
arch/arm/mach-keystone/clock.c +0
-0static int get_max_speed (u32 val,u32 speed_supported)arch/arm/mach-keystone/include/mach/clock.h +2
-1@@ -73,8 +73,9 @@ extern const struct keystone_pll_regs keystone_pll_regs[];extern int dev_speeds[];extern int arm_speeds[]; -void init_plls (int num_pll,struct pll_init_data *config); +void init_plls (void );void init_pll (const struct pll_init_data *data); +struct pll_init_data *get_pll_init_data (int pll);unsigned long clk_get_rate (unsigned int clk);unsigned long clk_round_rate (unsigned int clk,unsigned long hz);int
clk_set_rate(unsigned int clk, unsigned long hz);board/ti/ks2_evm/board_k2e.c +22
-11@@ -38,6 +38,26 @@ static struct pll_init_data core_pll_config[] = {static struct pll_init_data pa_pll_config =PASS_PLL_1000 ; +struct pll_init_data *get_pll_init_data (int pll) +{ +int speed; +struct pll_init_data *data; + +switch (pll) { +case MAIN_PLL : + speed =get_max_dev_speed (); + data = &core_pll_config[speed]; +break ; +case PASS_PLL : + data = &pa_pll_config; +break ; +default : + data =NULL ; + } + +return data; +} + #ifdef CONFIG_DRIVER_TI_KEYSTONE_NET struct eth_priv_t eth_priv_cfg[] = { {@@ -107,24 +127,15 @@ int get_num_eth_ports(void)#if defined(CONFIG_BOARD_EARLY_INIT_F )int board_early_init_f (void ) { -int speed; - - speed =get_max_dev_speed (); -init_pll (&core_pll_config[speed]); - -init_pll (&pa_pll_config); +init_plls ();return 0 ; }#endif #ifdef CONFIG_SPL_BUILD -static struct pll_init_data spl_pll_config[] = { -CORE_PLL_800 , -}; -void spl_init_keystone_plls (void ) { -init_plls (ARRAY_SIZE (spl_pll_config), spl_pll_config); +init_plls (); }#endif board/ti/ks2_evm/board_k2hk.c +26
-15@@ -46,6 +46,30 @@ static struct pll_init_data tetris_pll_config[] = {static struct pll_init_data pa_pll_config =PASS_PLL_983 ; +struct pll_init_data *get_pll_init_data (int pll) +{ +int speed; +struct pll_init_data *data; + +switch (pll) { +case MAIN_PLL : + speed =get_max_dev_speed (); + data = &core_pll_config[speed]; +break ; +case TETRIS_PLL : + speed =get_max_arm_speed (); + data = &tetris_pll_config[speed]; +break ; +case PASS_PLL : + data = &pa_pll_config; +break ; +default : + data =NULL ; + } + +return data; +} + #ifdef CONFIG_DRIVER_TI_KEYSTONE_NET struct eth_priv_t eth_priv_cfg[] = { {@@ -87,28 +111,15 @@ int get_num_eth_ports(void)#ifdef CONFIG_BOARD_EARLY_INIT_F int board_early_init_f (void ) { -int speed; - - speed =get_max_dev_speed (); -init_pll (&core_pll_config[speed]); - -init_pll (&pa_pll_config); - - speed =get_max_arm_speed (); -init_pll (&tetris_pll_config[speed]); +init_plls ();return 0 ; }#endif #ifdef CONFIG_SPL_BUILD -static struct pll_init_data spl_pll_config[] = { -CORE_PLL_799 , -TETRIS_PLL_500 , -}; -void spl_init_keystone_plls (void ) { -init_plls (ARRAY_SIZE (spl_pll_config), spl_pll_config); +init_plls (); }#endif board/ti/ks2_evm/board_k2l.c +26
-15@@ -42,6 +42,30 @@ static struct pll_init_data tetris_pll_config[] = {static struct pll_init_data pa_pll_config =PASS_PLL_983 ; +struct pll_init_data *get_pll_init_data (int pll) +{ +int speed; +struct pll_init_data *data; + +switch (pll) { +case MAIN_PLL : + speed =get_max_dev_speed (); + data = &core_pll_config[speed]; +break ; +case TETRIS_PLL : + speed =get_max_arm_speed (); + data = &tetris_pll_config[speed]; +break ; +case PASS_PLL : + data = &pa_pll_config; +break ; +default : + data =NULL ; + } + +return data; +} + #ifdef CONFIG_DRIVER_TI_KEYSTONE_NET struct eth_priv_t eth_priv_cfg[] = { {@@ -83,28 +107,15 @@ int get_num_eth_ports(void)#ifdef CONFIG_BOARD_EARLY_INIT_F int board_early_init_f (void ) { -int speed; - - speed =get_max_dev_speed (); -init_pll (&core_pll_config[speed]); - -init_pll (&pa_pll_config); - - speed =get_max_arm_speed (); -init_pll (&tetris_pll_config[speed]); +init_plls ();return 0 ; }#endif #ifdef CONFIG_SPL_BUILD -static struct pll_init_data spl_pll_config[] = { -CORE_PLL_799 , -TETRIS_PLL_491 , -}; -void spl_init_keystone_plls (void ) { -init_plls (ARRAY_SIZE (spl_pll_config), spl_pll_config); +init_plls (); }#endif
PATCH 6/8 ARM: keystone2: Cleanup init_pll definition
Lokesh,
Quoted 46 lines · Lokesh Vutla
Hi Vitaly,
Quoted 34 lines · Vitaly Andrianov
Quoted 31 lines · Lokesh Vutla
This is just a cosmetic change that makes
the calling of pll init code looks much cleaner.Signed-off-by Lokesh Vutla <[email protected]>--- arch/arm/mach-keystone/clock.c | 12 ++++++--- arch/arm/mach-keystone/include/mach/clock.h | 3 ++- board/ti/ks2_evm/board_k2e.c | 33 +++++++++++++++-------- board/ti/ks2_evm/board_k2hk.c | 41 ++++++++++++++++++----------- board/ti/ks2_evm/board_k2l.c | 41 ++++++++++++++++++----------- 5 files changed, 84 insertions(+), 46 deletions(-)arch/arm/mach-keystone/clock.c +3
-2@@ -191,12 +191,16 @@ void init_pll(const struct pll_init_data *data)configure_secondary_pll (data); } -void init_plls (int num_pll,struct pll_init_data *config) +void init_plls (void ) { -int i; +struct pll_init_data *data; +int pll;Quoted 10 lines
arch/arm/mach-keystone/clock.c void init_pll(const struct pll_init_data *data) · line 205
Quoted 9 lines
arch/arm/mach-keystone/clock.c +5
-2-for (i =0 ; i < num_pll; i++) -init_pll (&config[i]); +for (pll =MAIN_PLL ; pll <MAX_PLL_COUNT ; pll++) { + data =get_pll_init_data (pll); +if (data) +init_pll (data); + } }Does the
MAX_PLL_COUNTrepresent all PLLs on board?
Quoted 1 line
It includes all except DDR. I haven't touched DDR yet.
I see.
Quoted 4 lines
Quoted 3 lines
If that is true, I think the patch is incorrect.
If you look at the history of the PLL configuration code you will find that we had this cod in the past and changed it.May I know why DDR pll cannot be initialized along with other PLLs?
The DDR PLL is to be configured later after reading SPD data and finding out required DDR3 speed.
Quoted 19 lines
Quoted 6 lines
The currently working code doesn't configure all PLLs an advance. For example DDR3a PLLs is configured later, after getting information about required DDR3 speed. Also the current version of code doesn't configure DDR3B at all. And I don't see any reason why do we need to change it.
So,
get_pll_init_data()is defined in every board file and passes the correct
pll data. If pll is not available, it passes NULL so pll is not initialized.Instead of calling
init_pllfor each pll separately, I made a single function
which takes care of all this stuff.Thanks and regards,
LokeshQuoted 2 lines
[snip]
PATCH 6/8 ARM: keystone2: Cleanup init_pll definition
In reply to Lokesh VutlaQuoted 4 lines · Lokesh Vutla
This is just a cosmetic change that makes
the calling of pll init code looks much cleaner.Signed-off-by Lokesh Vutla <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150723/f4f3f2d2/attachment.sig>
PATCH 7/8 ARM: keystone2: Remove unsed external clocks
In reply to Lokesh VutlaRemove unused external clocks and make a common definition for all keystone platforms.
--- arch/arm/mach-keystone/clock-k2e.c | 2 +- arch/arm/mach-keystone/clock-k2l.c | 2 +- arch/arm/mach-keystone/include/mach/clock-k2e.h | 15 --------------- arch/arm/mach-keystone/include/mach/clock-k2hk.h | 18 ------------------ arch/arm/mach-keystone/include/mach/clock-k2l.h | 15 --------------- arch/arm/mach-keystone/include/mach/clock.h | 11 +++++++++++ board/ti/ks2_evm/board_k2e.c | 7 +------ board/ti/ks2_evm/board_k2hk.c | 6 ------ board/ti/ks2_evm/board_k2l.c | 5 +---- 9 files changed, 15 insertions(+), 66 deletions(-)
arch/arm/mach-keystone/clock-k2e.c +1 -1
@@ -43,7 +43,7 @@ static unsigned long pll_freq_get(int pll) reg =KS2_PASSPLLCTL0 ;break ;case DDR3_PLL : - ret = external_clk[ddr3_clk]; + ret = external_clk[ddr3a_clk]; reg =KS2_DDR3APLLCTL0 ;break ;default :
arch/arm/mach-keystone/clock-k2l.c +1 -1
@@ -47,7 +47,7 @@ static unsigned long pll_freq_get(int pll) reg =KS2_ARMPLLCTL0 ;break ;case DDR3_PLL : - ret = external_clk[ddr3_clk]; + ret = external_clk[ddr3a_clk]; reg =KS2_DDR3APLLCTL0 ;break ;default :
arch/arm/mach-keystone/include/mach/clock-k2e.h +0 -15
@@ -10,21 +10,6 @@#ifndef __ASM_ARCH_CLOCK_K2E_H#define __ASM_ARCH_CLOCK_K2E_H -enum ext_clk_e { - sys_clk, - alt_core_clk, - pa_clk, - ddr3_clk, - mcm_clk, - pcie_clk, - sgmii_clk, - xgmii_clk, - usb_clk, - ext_clk_count/* number of external clocks */ -}; - -extern unsigned int external_clk[ext_clk_count]; -#define CLK_LIST (CLK )\ CLK(0, core_pll_clk)\ CLK(1, pass_pll_clk)\
arch/arm/mach-keystone/include/mach/clock-k2hk.h +0 -18
@@ -10,24 +10,6 @@#ifndef __ASM_ARCH_CLOCK_K2HK_H#define __ASM_ARCH_CLOCK_K2HK_H -enum ext_clk_e { - sys_clk, - alt_core_clk, - pa_clk, - tetris_clk, - ddr3a_clk, - ddr3b_clk, - mcm_clk, - pcie_clk, - sgmii_srio_clk, - xgmii_clk, - usb_clk, - rp1_clk, - ext_clk_count/* number of external clocks */ -}; - -extern unsigned int external_clk[ext_clk_count]; -#define CLK_LIST (CLK )\ CLK(0, core_pll_clk)\ CLK(1, pass_pll_clk)\
arch/arm/mach-keystone/include/mach/clock-k2l.h +0 -15
@@ -10,21 +10,6 @@#ifndef __ASM_ARCH_CLOCK_K2L_H#define __ASM_ARCH_CLOCK_K2L_H -enum ext_clk_e { - sys_clk, - alt_core_clk, - pa_clk, - tetris_clk, - ddr3_clk, - pcie_clk, - sgmii_clk, - usb_clk, - rp1_clk, - ext_clk_count/* number of external clocks */ -}; - -extern unsigned int external_clk[ext_clk_count]; -#define CLK_LIST (CLK )\ CLK(0, core_pll_clk)\ CLK(1, pass_pll_clk)\
arch/arm/mach-keystone/include/mach/clock.h +11 -0
@@ -52,6 +52,16 @@ enum { MAX_PLL_COUNT, }; +enum ext_clk_e { + sys_clk, + alt_core_clk, + pa_clk, + tetris_clk, + ddr3a_clk, + ddr3b_clk, + ext_clk_count/* number of external clocks */ +}; +enum clk_e { CLK_LIST(GENERATE_ENUM) };
@@ -69,6 +79,7 @@ struct pll_init_data {int pll_od;/* PLL output divider */ }; +extern unsigned int external_clk[ext_clk_count];extern const struct keystone_pll_regs keystone_pll_regs[];extern int dev_speeds[];extern int arm_speeds[];
board/ti/ks2_evm/board_k2e.c +1 -6
@@ -18,12 +18,7 @@ unsigned int external_clk[ext_clk_count] = { [sys_clk] = 100000000, [alt_core_clk] = 100000000, [pa_clk] = 100000000, - [ddr3_clk] = 100000000, - [mcm_clk] = 312500000, - [pcie_clk] = 100000000, - [sgmii_clk] = 156250000, - [xgmii_clk] = 156250000, - [usb_clk] = 100000000, + [ddr3a_clk] = 100000000, };static struct pll_init_data core_pll_config[] = {
board/ti/ks2_evm/board_k2hk.c +0 -6
@@ -21,12 +21,6 @@ unsigned int external_clk[ext_clk_count] = { [tetris_clk] = 125000000, [ddr3a_clk] = 100000000, [ddr3b_clk] = 100000000, - [mcm_clk] = 312500000, - [pcie_clk] = 100000000, - [sgmii_srio_clk] = 156250000, - [xgmii_clk] = 156250000, - [usb_clk] = 100000000, - [rp1_clk] =123456789 };static struct pll_init_data core_pll_config[] = {
board/ti/ks2_evm/board_k2l.c +1 -4
@@ -19,10 +19,7 @@ unsigned int external_clk[ext_clk_count] = { [alt_core_clk] = 100000000, [pa_clk] = 122880000, [tetris_clk] = 122880000, - [ddr3_clk] = 100000000, - [pcie_clk] = 100000000, - [sgmii_clk] = 156250000, - [usb_clk] = 100000000, + [ddr3a_clk] = 100000000, };static struct pll_init_data core_pll_config[] = {
Signature · 1 line
2.1.4
PATCH 7/8 ARM: keystone2: Remove unsed external clocks
Quoted 4 lines · Lokesh Vutla
Remove unused external clocks and make a common definition for all keystone platforms.
Signed-off-by Lokesh Vutla <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150723/7afa8ece/attachment.sig>
PATCH 8/8 ARM: keystone2: Use common definition for clk_get_rate
In reply to Lokesh VutlaSince all the clocks are defined common, and has the same logic to get the frequencies, use a common definition for for clk_get_rate().
--- arch/arm/mach-keystone/Makefile | 3 - arch/arm/mach-keystone/clock-k2e.c | 95 ---------------- arch/arm/mach-keystone/clock-k2hk.c | 105 ----------------- arch/arm/mach-keystone/clock-k2l.c | 99 ---------------- arch/arm/mach-keystone/clock.c | 139 +++++++++++++++++++++++ arch/arm/mach-keystone/cmd_clock.c | 7 +- arch/arm/mach-keystone/include/mach/clock-k2e.h | 21 ---- arch/arm/mach-keystone/include/mach/clock-k2hk.h | 23 ---- arch/arm/mach-keystone/include/mach/clock-k2l.h | 22 ---- arch/arm/mach-keystone/include/mach/clock.h | 23 ++++ arch/arm/mach-keystone/include/mach/clock_defs.h | 32 ------ 11 files changed, 167 insertions(+), 402 deletions(-) delete mode 100644 arch/arm/mach-keystone/clock-k2e.c delete mode 100644 arch/arm/mach-keystone/clock-k2hk.c delete mode 100644 arch/arm/mach-keystone/clock-k2l.c
arch/arm/mach-keystone/Makefile +0 -3
@@ -8,9 +8,6 @@ obj-y += init.o obj-y += psc.o obj-y += clock.o -obj-$(CONFIG_SOC_K2HK) += clock-k2hk.o -obj-$(CONFIG_SOC_K2E) += clock-k2e.o -obj-$(CONFIG_SOC_K2L) += clock-k2l.o obj-y += cmd_clock.o obj-y += cmd_mon.o obj-y += msmc.o
arch/arm/mach-keystone/clock-k2e.c deleted +0 -0
arch/arm/mach-keystone/clock-k2hk.c deleted +0 -0
arch/arm/mach-keystone/clock-k2l.c deleted +0 -0
arch/arm/mach-keystone/clock.c +139 -0
142 lines not on this page · raw message
arch/arm/mach-keystone/cmd_clock.c +5 -2
@@ -67,7 +67,7 @@ U_BOOT_CMD(int do_getclk_cmd (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) {unsigned int clk; -unsigned int freq; +unsigned long freq;if (argc !=2 ) goto getclk_cmd_usage;
@@ -75,7 +75,10 @@ int do_getclk_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) clk =simple_strtoul (argv[1 ],NULL ,10 ); freq =clk_get_rate (clk); -printf ("clock index [%d] - frequency %u\n" , clk, freq); +if (freq) +printf ("clock index [%d] - frequency %lu\n" , clk, freq); +else +printf ("clock index [%d] Not available\n" , clk);return 0 ; getclk_cmd_usage:
arch/arm/mach-keystone/include/mach/clock-k2e.h +0 -21
@@ -10,27 +10,6 @@#ifndef __ASM_ARCH_CLOCK_K2E_H#define __ASM_ARCH_CLOCK_K2E_H -#define CLK_LIST (CLK )\ - CLK(0, core_pll_clk)\ - CLK(1, pass_pll_clk)\ - CLK(2, ddr3_pll_clk)\ - CLK(3, sys_clk0_clk)\ - CLK(4, sys_clk0_1_clk)\ - CLK(5, sys_clk0_2_clk)\ - CLK(6, sys_clk0_3_clk)\ - CLK(7, sys_clk0_4_clk)\ - CLK(8, sys_clk0_6_clk)\ - CLK(9, sys_clk0_8_clk)\ - CLK(10, sys_clk0_12_clk)\ - CLK(11, sys_clk0_24_clk)\ - CLK(12, sys_clk1_clk)\ - CLK(13, sys_clk1_3_clk)\ - CLK(14, sys_clk1_4_clk)\ - CLK(15, sys_clk1_6_clk)\ - CLK(16, sys_clk1_12_clk)\ - CLK(17, sys_clk2_clk)\ - CLK(18, sys_clk3_clk) -#define PLLSET_CMD_LIST "<pa|ddr3>"#define KS2_CLK1_6 sys_clk0_6_clk
arch/arm/mach-keystone/include/mach/clock-k2hk.h +0 -23
@@ -10,29 +10,6 @@#ifndef __ASM_ARCH_CLOCK_K2HK_H#define __ASM_ARCH_CLOCK_K2HK_H -#define CLK_LIST (CLK )\ - CLK(0, core_pll_clk)\ - CLK(1, pass_pll_clk)\ - CLK(2, tetris_pll_clk)\ - CLK(3, ddr3a_pll_clk)\ - CLK(4, ddr3b_pll_clk)\ - CLK(5, sys_clk0_clk)\ - CLK(6, sys_clk0_1_clk)\ - CLK(7, sys_clk0_2_clk)\ - CLK(8, sys_clk0_3_clk)\ - CLK(9, sys_clk0_4_clk)\ - CLK(10, sys_clk0_6_clk)\ - CLK(11, sys_clk0_8_clk)\ - CLK(12, sys_clk0_12_clk)\ - CLK(13, sys_clk0_24_clk)\ - CLK(14, sys_clk1_clk)\ - CLK(15, sys_clk1_3_clk)\ - CLK(16, sys_clk1_4_clk)\ - CLK(17, sys_clk1_6_clk)\ - CLK(18, sys_clk1_12_clk)\ - CLK(19, sys_clk2_clk)\ - CLK(20, sys_clk3_clk) -#define PLLSET_CMD_LIST "<pa|arm|ddr3a|ddr3b>"#define KS2_CLK1_6 sys_clk0_6_clk
arch/arm/mach-keystone/include/mach/clock-k2l.h +0 -22
@@ -10,28 +10,6 @@#ifndef __ASM_ARCH_CLOCK_K2L_H#define __ASM_ARCH_CLOCK_K2L_H -#define CLK_LIST (CLK )\ - CLK(0, core_pll_clk)\ - CLK(1, pass_pll_clk)\ - CLK(2, tetris_pll_clk)\ - CLK(3, ddr3_pll_clk)\ - CLK(4, sys_clk0_clk)\ - CLK(5, sys_clk0_1_clk)\ - CLK(6, sys_clk0_2_clk)\ - CLK(7, sys_clk0_3_clk)\ - CLK(8, sys_clk0_4_clk)\ - CLK(9, sys_clk0_6_clk)\ - CLK(10, sys_clk0_8_clk)\ - CLK(11, sys_clk0_12_clk)\ - CLK(12, sys_clk0_24_clk)\ - CLK(13, sys_clk1_clk)\ - CLK(14, sys_clk1_3_clk)\ - CLK(15, sys_clk1_4_clk)\ - CLK(16, sys_clk1_6_clk)\ - CLK(17, sys_clk1_12_clk)\ - CLK(18, sys_clk2_clk)\ - CLK(19, sys_clk3_clk)\ -#define PLLSET_CMD_LIST "<pa|arm|ddr3>"#define KS2_CLK1_6 sys_clk0_6_clk
arch/arm/mach-keystone/include/mach/clock.h +23 -0
@@ -27,6 +27,29 @@#define CORE_PLL MAIN_PLL#define DDR3_PLL DDR3A_PLL +#define CLK_LIST (CLK )\ + CLK(0, core_pll_clk)\ + CLK(1, pass_pll_clk)\ + CLK(2, tetris_pll_clk)\ + CLK(3, ddr3a_pll_clk)\ + CLK(4, ddr3b_pll_clk)\ + CLK(5, sys_clk0_clk)\ + CLK(6, sys_clk0_1_clk)\ + CLK(7, sys_clk0_2_clk)\ + CLK(8, sys_clk0_3_clk)\ + CLK(9, sys_clk0_4_clk)\ + CLK(10, sys_clk0_6_clk)\ + CLK(11, sys_clk0_8_clk)\ + CLK(12, sys_clk0_12_clk)\ + CLK(13, sys_clk0_24_clk)\ + CLK(14, sys_clk1_clk)\ + CLK(15, sys_clk1_3_clk)\ + CLK(16, sys_clk1_4_clk)\ + CLK(17, sys_clk1_6_clk)\ + CLK(18, sys_clk1_12_clk)\ + CLK(19, sys_clk2_clk)\ + CLK(20, sys_clk3_clk) +#include <asm/types.h> #define GENERATE_ENUM (NUM ,ENUM ) ENUM = NUM,
arch/arm/mach-keystone/include/mach/clock_defs.h +0 -32
@@ -69,38 +69,6 @@ static struct pllctl_regs *pllctl_regs[] = {#define pll0div_read (N ) ((pllctl_reg_read(CORE_PLL, div##N) & 0xff) + 1) -#define PLLCTL_BYPASS BIT(23) -#define PLL_PLLRST BIT(14) -#define PLLCTL_PAPLL BIT(13) -#define PLLCTL_CLKMODE BIT(8) -#define PLLCTL_PLLSELB BIT(7) -#define PLLCTL_ENSAT BIT(6) -#define PLLCTL_PLLENSRC BIT(5) -#define PLLCTL_PLLDIS BIT(4) -#define PLLCTL_PLLRST BIT(3) -#define PLLCTL_PLLPWRDN BIT(1) -#define PLLCTL_PLLEN BIT(0) -#define PLLSTAT_GO BIT(0) - -#define MAIN_ENSAT_OFFSET 6 - -#define PLLDIV_ENABLE BIT(15) - -#define PLL_DIV_MASK 0x3f -#define PLL_MULT_MASK 0x1fff -#define PLL_MULT_SHIFT 6 -#define PLLM_MULT_HI_MASK 0x7f -#define PLLM_MULT_HI_SHIFT 12 -#define PLLM_MULT_HI_SMASK (PLLM_MULT_HI_MASK << PLLM_MULT_HI_SHIFT) -#define PLLM_MULT_LO_MASK 0x3f -#define PLL_CLKOD_MASK 0xf -#define PLL_CLKOD_SHIFT 19 -#define PLL_CLKOD_SMASK (PLL_CLKOD_MASK << PLL_CLKOD_SHIFT) -#define PLL_BWADJ_LO_MASK 0xff -#define PLL_BWADJ_LO_SHIFT 24 -#define PLL_BWADJ_LO_SMASK (PLL_BWADJ_LO_MASK << PLL_BWADJ_LO_SHIFT) -#define PLL_BWADJ_HI_MASK 0xf -/* PLLCTL Bits */ #define PLLCTL_PLLENSRC_SHIF 5#define PLLCTL_PLLENSRC_MASK BIT(5)
Signature · 1 line
2.1.4
PATCH 8/8 ARM: keystone2: Use common definition for clk_get_rate
Quoted 4 lines · Lokesh Vutla
Since all the clocks are defined common, and has the same logic to get the frequencies, use a common definition for for
clk_get_rate().Signed-off-by Lokesh Vutla <[email protected]>
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150723/e53f0706/attachment.sig>
cover ARM: keystone2: Clocls and PLLs cleanup
In reply to Lokesh VutlaHi,
Quoted 3 lines · Lokesh Vutla
This seires does a several bunch of cleanups for clock and PLL related definitions. This helps a lot in adding data for new Keystone2 SoCs. And also adds support for CPU detection.
Sorry about the typo in $subject. Will update it after the comments on this series.
Thanks and regards,
Lokesh
Quoted 40 lines
This is based on Nishanth's config cleanup series:
https://www.mail-archive.com/u-boot%40lists.denx.de/msg177822.htmlTested on K2HK-evm: http://pastebin.ubuntu.com/11920541/
Lokesh Vutla (8):
ARM: keystone2: Cleanup SoC detection
ARM: keystone2: EnableCONFIG_DISPLAY_CPUINFO
ARM: keystone2: Cleanup PLL init code
ARM: keystone2: Fix dev and arm speed detection
ARM: keystone2: Use common address for PLL
ARM: keystone2: Cleanup pll calling
ARM: keystone2: Remove unsed externalk clocks
ARM: keystone2: Use common definition forclk_get_ratearch/arm/mach-keystone/Makefile | 3 - arch/arm/mach-keystone/clock-k2e.c | 117 ----- arch/arm/mach-keystone/clock-k2hk.c | 145 ------ arch/arm/mach-keystone/clock-k2l.c | 138 ------ arch/arm/mach-keystone/clock.c | 527 +++++++++++++-------- arch/arm/mach-keystone/cmd_clock.c | 7 +- arch/arm/mach-keystone/include/mach/clock-k2e.h | 58 +-- arch/arm/mach-keystone/include/mach/clock-k2hk.h | 64 +-- arch/arm/mach-keystone/include/mach/clock-k2l.h | 59 +-- arch/arm/mach-keystone/include/mach/clock.h | 60 ++- arch/arm/mach-keystone/include/mach/clock_defs.h | 107 +++-- .../arm/mach-keystone/include/mach/hardware-k2hk.h | 4 - arch/arm/mach-keystone/include/mach/hardware.h | 51 +- arch/arm/mach-keystone/init.c | 24 + board/ti/ks2_evm/board.c | 1 - board/ti/ks2_evm/board_k2e.c | 41 +- board/ti/ks2_evm/board_k2hk.c | 47 +- board/ti/ks2_evm/board_k2l.c | 46 +- include/configs/ti_armv7_keystone2.h | 1 + 19 files changed, 603 insertions(+), 897 deletions(-)delete mode 100644
arch/arm/mach-keystone/clock-k2e.cdelete mode 100644arch/arm/mach-keystone/clock-k2hk.cdelete mode 100644arch/arm/mach-keystone/clock-k2l.c