2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2014-04-04 17:16:53 +00:00
|
|
|
/*
|
|
|
|
* keystone2: common clock header file
|
|
|
|
*
|
|
|
|
* (C) Copyright 2012-2014
|
|
|
|
* Texas Instruments Incorporated, <www.ti.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ASM_ARCH_CLOCK_H
|
|
|
|
#define __ASM_ARCH_CLOCK_H
|
|
|
|
|
2014-07-09 20:44:47 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
|
2014-04-04 17:16:53 +00:00
|
|
|
#ifdef CONFIG_SOC_K2HK
|
|
|
|
#include <asm/arch/clock-k2hk.h>
|
|
|
|
#endif
|
|
|
|
|
2014-07-15 21:59:23 +00:00
|
|
|
#ifdef CONFIG_SOC_K2E
|
|
|
|
#include <asm/arch/clock-k2e.h>
|
|
|
|
#endif
|
|
|
|
|
2014-10-22 13:32:29 +00:00
|
|
|
#ifdef CONFIG_SOC_K2L
|
|
|
|
#include <asm/arch/clock-k2l.h>
|
|
|
|
#endif
|
|
|
|
|
2015-09-19 10:56:40 +00:00
|
|
|
#ifdef CONFIG_SOC_K2G
|
|
|
|
#include <asm/arch/clock-k2g.h>
|
|
|
|
#endif
|
|
|
|
|
2015-07-28 08:46:45 +00:00
|
|
|
#define CORE_PLL MAIN_PLL
|
|
|
|
#define DDR3_PLL DDR3A_PLL
|
2015-09-19 10:56:40 +00:00
|
|
|
#define NSS_PLL PASS_PLL
|
2014-07-09 20:44:47 +00:00
|
|
|
|
2015-07-28 08:46:48 +00:00
|
|
|
#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)\
|
2015-09-19 10:56:41 +00:00
|
|
|
CLK(20, sys_clk3_clk)\
|
|
|
|
CLK(21, uart_pll_clk)
|
2015-07-28 08:46:48 +00:00
|
|
|
|
2014-07-09 20:44:47 +00:00
|
|
|
#include <asm/types.h>
|
|
|
|
|
2014-10-22 13:01:28 +00:00
|
|
|
#define GENERATE_ENUM(NUM, ENUM) ENUM = NUM,
|
|
|
|
#define GENERATE_INDX_STR(NUM, STRING) #NUM"\t- "#STRING"\n"
|
|
|
|
#define CLOCK_INDEXES_LIST CLK_LIST(GENERATE_INDX_STR)
|
|
|
|
|
2015-07-28 08:46:44 +00:00
|
|
|
enum {
|
2016-03-04 16:36:41 +00:00
|
|
|
SPD200,
|
|
|
|
SPD400,
|
|
|
|
SPD600,
|
2015-07-28 08:46:44 +00:00
|
|
|
SPD800,
|
|
|
|
SPD850,
|
2016-03-04 16:36:41 +00:00
|
|
|
SPD900,
|
2015-07-28 08:46:44 +00:00
|
|
|
SPD1000,
|
|
|
|
SPD1200,
|
|
|
|
SPD1250,
|
|
|
|
SPD1350,
|
|
|
|
SPD1400,
|
|
|
|
SPD1500,
|
|
|
|
NUM_SPDS,
|
|
|
|
};
|
|
|
|
|
2015-07-28 08:46:45 +00:00
|
|
|
/* PLL identifiers */
|
|
|
|
enum {
|
|
|
|
MAIN_PLL,
|
|
|
|
TETRIS_PLL,
|
|
|
|
PASS_PLL,
|
|
|
|
DDR3A_PLL,
|
|
|
|
DDR3B_PLL,
|
2015-09-19 10:56:40 +00:00
|
|
|
UART_PLL,
|
2015-07-28 08:46:45 +00:00
|
|
|
MAX_PLL_COUNT,
|
|
|
|
};
|
|
|
|
|
2015-07-28 08:46:47 +00:00
|
|
|
enum ext_clk_e {
|
|
|
|
sys_clk,
|
|
|
|
alt_core_clk,
|
|
|
|
pa_clk,
|
|
|
|
tetris_clk,
|
|
|
|
ddr3a_clk,
|
|
|
|
ddr3b_clk,
|
2015-09-19 10:56:41 +00:00
|
|
|
uart_clk,
|
2015-07-28 08:46:47 +00:00
|
|
|
ext_clk_count /* number of external clocks */
|
|
|
|
};
|
|
|
|
|
2014-10-22 13:01:28 +00:00
|
|
|
enum clk_e {
|
|
|
|
CLK_LIST(GENERATE_ENUM)
|
|
|
|
};
|
|
|
|
|
2014-07-09 20:44:47 +00:00
|
|
|
struct keystone_pll_regs {
|
|
|
|
u32 reg0;
|
|
|
|
u32 reg1;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* PLL configuration data */
|
|
|
|
struct pll_init_data {
|
|
|
|
int pll;
|
|
|
|
int pll_m; /* PLL Multiplier */
|
|
|
|
int pll_d; /* PLL divider */
|
|
|
|
int pll_od; /* PLL output divider */
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const struct keystone_pll_regs keystone_pll_regs[];
|
2015-07-28 08:46:43 +00:00
|
|
|
extern s16 divn_val[];
|
2015-07-28 08:46:44 +00:00
|
|
|
extern int speeds[];
|
2014-07-09 20:44:47 +00:00
|
|
|
|
2015-07-28 08:46:46 +00:00
|
|
|
void init_plls(void);
|
2014-07-09 20:44:47 +00:00
|
|
|
void init_pll(const struct pll_init_data *data);
|
2015-07-28 08:46:46 +00:00
|
|
|
struct pll_init_data *get_pll_init_data(int pll);
|
2016-09-26 11:45:26 +00:00
|
|
|
unsigned long ks_clk_get_rate(unsigned int clk);
|
2016-03-04 16:36:40 +00:00
|
|
|
int get_max_dev_speed(int *spds);
|
|
|
|
int get_max_arm_speed(int *spds);
|
2015-10-08 06:01:47 +00:00
|
|
|
void pll_pa_clk_sel(void);
|
2017-05-03 11:28:26 +00:00
|
|
|
unsigned int get_external_clk(u32 clk);
|
2014-07-09 20:44:47 +00:00
|
|
|
|
|
|
|
#endif
|
2014-04-04 17:16:53 +00:00
|
|
|
#endif
|