Vitaly Andrianov | ef509b9 | 2014-04-04 13:16:53 -0400 | [diff] [blame] | 1 | /* |
| 2 | * K2HK: Clock management APIs |
| 3 | * |
| 4 | * (C) Copyright 2012-2014 |
| 5 | * Texas Instruments Incorporated, <www.ti.com> |
| 6 | * |
| 7 | * SPDX-License-Identifier: GPL-2.0+ |
| 8 | */ |
| 9 | |
| 10 | #ifndef __ASM_ARCH_CLOCK_K2HK_H |
| 11 | #define __ASM_ARCH_CLOCK_K2HK_H |
| 12 | |
| 13 | #include <asm/arch/hardware.h> |
| 14 | |
| 15 | #ifndef __ASSEMBLY__ |
| 16 | |
| 17 | enum ext_clk_e { |
| 18 | sys_clk, |
| 19 | alt_core_clk, |
| 20 | pa_clk, |
| 21 | tetris_clk, |
| 22 | ddr3a_clk, |
| 23 | ddr3b_clk, |
| 24 | mcm_clk, |
| 25 | pcie_clk, |
| 26 | sgmii_srio_clk, |
| 27 | xgmii_clk, |
| 28 | usb_clk, |
| 29 | rp1_clk, |
| 30 | ext_clk_count /* number of external clocks */ |
| 31 | }; |
| 32 | |
| 33 | extern unsigned int external_clk[ext_clk_count]; |
| 34 | |
| 35 | enum clk_e { |
| 36 | core_pll_clk, |
| 37 | pass_pll_clk, |
| 38 | tetris_pll_clk, |
| 39 | ddr3a_pll_clk, |
| 40 | ddr3b_pll_clk, |
| 41 | sys_clk0_clk, |
| 42 | sys_clk0_1_clk, |
| 43 | sys_clk0_2_clk, |
| 44 | sys_clk0_3_clk, |
| 45 | sys_clk0_4_clk, |
| 46 | sys_clk0_6_clk, |
| 47 | sys_clk0_8_clk, |
| 48 | sys_clk0_12_clk, |
| 49 | sys_clk0_24_clk, |
| 50 | sys_clk1_clk, |
| 51 | sys_clk1_3_clk, |
| 52 | sys_clk1_4_clk, |
| 53 | sys_clk1_6_clk, |
| 54 | sys_clk1_12_clk, |
| 55 | sys_clk2_clk, |
| 56 | sys_clk3_clk |
| 57 | }; |
| 58 | |
Khoronzhuk, Ivan | 3d31538 | 2014-07-09 23:44:44 +0300 | [diff] [blame^] | 59 | #define KS2_CLK1_6 sys_clk0_6_clk |
Vitaly Andrianov | ef509b9 | 2014-04-04 13:16:53 -0400 | [diff] [blame] | 60 | |
| 61 | /* PLL identifiers */ |
| 62 | enum pll_type_e { |
| 63 | CORE_PLL, |
| 64 | PASS_PLL, |
| 65 | TETRIS_PLL, |
| 66 | DDR3A_PLL, |
| 67 | DDR3B_PLL, |
| 68 | }; |
| 69 | #define MAIN_PLL CORE_PLL |
| 70 | |
| 71 | /* PLL configuration data */ |
| 72 | struct pll_init_data { |
| 73 | int pll; |
| 74 | int pll_m; /* PLL Multiplier */ |
| 75 | int pll_d; /* PLL divider */ |
| 76 | int pll_od; /* PLL output divider */ |
| 77 | }; |
| 78 | |
| 79 | #define CORE_PLL_799 {CORE_PLL, 13, 1, 2} |
| 80 | #define CORE_PLL_983 {CORE_PLL, 16, 1, 2} |
| 81 | #define CORE_PLL_1167 {CORE_PLL, 19, 1, 2} |
| 82 | #define CORE_PLL_1228 {CORE_PLL, 20, 1, 2} |
| 83 | #define PASS_PLL_1228 {PASS_PLL, 20, 1, 2} |
| 84 | #define PASS_PLL_983 {PASS_PLL, 16, 1, 2} |
| 85 | #define PASS_PLL_1050 {PASS_PLL, 205, 12, 2} |
| 86 | #define TETRIS_PLL_500 {TETRIS_PLL, 8, 1, 2} |
| 87 | #define TETRIS_PLL_750 {TETRIS_PLL, 12, 1, 2} |
| 88 | #define TETRIS_PLL_687 {TETRIS_PLL, 11, 1, 2} |
| 89 | #define TETRIS_PLL_625 {TETRIS_PLL, 10, 1, 2} |
| 90 | #define TETRIS_PLL_812 {TETRIS_PLL, 13, 1, 2} |
| 91 | #define TETRIS_PLL_875 {TETRIS_PLL, 14, 1, 2} |
| 92 | #define TETRIS_PLL_1188 {TETRIS_PLL, 19, 2, 1} |
| 93 | #define TETRIS_PLL_1200 {TETRIS_PLL, 48, 5, 1} |
| 94 | #define TETRIS_PLL_1375 {TETRIS_PLL, 22, 2, 1} |
| 95 | #define TETRIS_PLL_1400 {TETRIS_PLL, 56, 5, 1} |
| 96 | #define DDR3_PLL_200(x) {DDR3##x##_PLL, 4, 1, 2} |
| 97 | #define DDR3_PLL_400(x) {DDR3##x##_PLL, 16, 1, 4} |
| 98 | #define DDR3_PLL_800(x) {DDR3##x##_PLL, 16, 1, 2} |
| 99 | #define DDR3_PLL_333(x) {DDR3##x##_PLL, 20, 1, 6} |
| 100 | |
| 101 | void init_plls(int num_pll, struct pll_init_data *config); |
| 102 | void init_pll(const struct pll_init_data *data); |
| 103 | unsigned long clk_get_rate(unsigned int clk); |
| 104 | unsigned long clk_round_rate(unsigned int clk, unsigned long hz); |
| 105 | int clk_set_rate(unsigned int clk, unsigned long hz); |
| 106 | |
| 107 | #endif |
| 108 | |
| 109 | #endif |