]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: keystone2: Allow for board specific speed definitions
authorLokesh Vutla <lokeshvutla@ti.com>
Fri, 4 Mar 2016 16:36:40 +0000 (10:36 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 14 Mar 2016 23:18:43 +0000 (19:18 -0400)
Its not compulsory that speed definition should be same on EFUSE_BOOTROM
register for all keystone 2 devices. So, allow for board specific
speed definitions.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
arch/arm/mach-keystone/clock.c
arch/arm/mach-keystone/include/mach/clock.h
board/ti/ks2_evm/board_k2e.c
board/ti/ks2_evm/board_k2hk.c
board/ti/ks2_evm/board_k2l.c

index 5c6051e76db88807734b910010c659414060a23b..1ae3baf982a170829d896ce3b27370d264c976c6 100644 (file)
@@ -228,14 +228,14 @@ void init_plls(void)
        }
 }
 
-static int get_max_speed(u32 val, u32 speed_supported)
+static int get_max_speed(u32 val, u32 speed_supported, int *spds)
 {
        int speed;
 
        /* Left most setbit gives the speed */
        for (speed = DEVSPEED_NUMSPDS; speed >= 0; speed--) {
                if ((val & BIT(speed)) & speed_supported)
-                       return speeds[speed];
+                       return spds[speed];
        }
 
        /* If no bit is set, use SPD800 */
@@ -250,24 +250,24 @@ static inline u32 read_efuse_bootrom(void)
                return __raw_readl(KS2_EFUSE_BOOTROM);
 }
 
-int get_max_arm_speed(void)
+int get_max_arm_speed(int *spds)
 {
        u32 armspeed = read_efuse_bootrom();
 
        armspeed = (armspeed & DEVSPEED_ARMSPEED_MASK) >>
                    DEVSPEED_ARMSPEED_SHIFT;
 
-       return get_max_speed(armspeed, ARM_SUPPORTED_SPEEDS);
+       return get_max_speed(armspeed, ARM_SUPPORTED_SPEEDS, spds);
 }
 
-int get_max_dev_speed(void)
+int get_max_dev_speed(int *spds)
 {
        u32 devspeed = read_efuse_bootrom();
 
        devspeed = (devspeed & DEVSPEED_DEVSPEED_MASK) >>
                    DEVSPEED_DEVSPEED_SHIFT;
 
-       return get_max_speed(devspeed, DEV_SUPPORTED_SPEEDS);
+       return get_max_speed(devspeed, DEV_SUPPORTED_SPEEDS, spds);
 }
 
 /**
index cdcff3baee36f1220108f5942a10ef157101fe51..dfebcb03ea57f4d0982970008aa2615adb6b61cb 100644 (file)
@@ -124,8 +124,8 @@ 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);
-int get_max_dev_speed(void);
-int get_max_arm_speed(void);
+int get_max_dev_speed(int *spds);
+int get_max_arm_speed(int *spds);
 void pll_pa_clk_sel(void);
 
 #endif
index f58f62358d3efd62d06370d398dfaaf64d4dc534..cbb3077bc36ca4ff4d5abdc75e5a7aabe5649606 100644 (file)
@@ -61,7 +61,7 @@ struct pll_init_data *get_pll_init_data(int pll)
 
        switch (pll) {
        case MAIN_PLL:
-               speed = get_max_dev_speed();
+               speed = get_max_dev_speed(speeds);
                data = &core_pll_config[speed];
                break;
        case PASS_PLL:
index 0bd6b86e25732ad1e8cc35f3d8f3f38bf20c6aac..e217beaed5e4494fd900d8a0acbcb259926b38da 100644 (file)
@@ -51,11 +51,11 @@ struct pll_init_data *get_pll_init_data(int pll)
 
        switch (pll) {
        case MAIN_PLL:
-               speed = get_max_dev_speed();
+               speed = get_max_dev_speed(speeds);
                data = &core_pll_config[speed];
                break;
        case TETRIS_PLL:
-               speed = get_max_arm_speed();
+               speed = get_max_arm_speed(speeds);
                data = &tetris_pll_config[speed];
                break;
        case PASS_PLL:
index d750ad3c0b057d6159775f387569478d548ed81d..2a2e0057e24efd2fd4832f5e07c025de102c4a09 100644 (file)
@@ -50,11 +50,11 @@ struct pll_init_data *get_pll_init_data(int pll)
 
        switch (pll) {
        case MAIN_PLL:
-               speed = get_max_dev_speed();
+               speed = get_max_dev_speed(speeds);
                data = &core_pll_config[speed];
                break;
        case TETRIS_PLL:
-               speed = get_max_arm_speed();
+               speed = get_max_arm_speed(speeds);
                data = &tetris_pll_config[speed];
                break;
        case PASS_PLL: