Commit 28d3f06e authored by Abhishek Sahu's avatar Abhishek Sahu Committed by Stephen Boyd

clk: qcom: support for alpha pll properties

Alpha PLL is a generic name used for QCOM PLLs which uses L and
Alpha values for configuring the integer and fractional part.
QCOM SoCs use different types of Alpha PLLs for which basic
software configuration part is common with following differences.

  1. All these PLLs have the same basic registers like
     PLL_MODE, L_VAL, ALPHA_VAL but some of the register offsets are
     different between PLLs types.

  2. The dynamic programming sequence is different in some
     of the Alpha PLLs

  3. Some of the PLLs don’t have 64 bit config control, 64 bit
     user control, VCO configuration, etc.
Signed-off-by: default avatarAbhishek Sahu <absahu@codeaurora.org>
Signed-off-by: default avatarStephen Boyd <sboyd@codeaurora.org>
parent 4fbd8d19
This diff is collapsed.
...@@ -17,6 +17,28 @@ ...@@ -17,6 +17,28 @@
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include "clk-regmap.h" #include "clk-regmap.h"
/* Alpha PLL types */
enum {
CLK_ALPHA_PLL_TYPE_DEFAULT,
CLK_ALPHA_PLL_TYPE_MAX,
};
enum {
PLL_OFF_L_VAL,
PLL_OFF_ALPHA_VAL,
PLL_OFF_ALPHA_VAL_U,
PLL_OFF_USER_CTL,
PLL_OFF_USER_CTL_U,
PLL_OFF_CONFIG_CTL,
PLL_OFF_CONFIG_CTL_U,
PLL_OFF_TEST_CTL,
PLL_OFF_TEST_CTL_U,
PLL_OFF_STATUS,
PLL_OFF_MAX_REGS
};
extern const u8 clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_MAX][PLL_OFF_MAX_REGS];
struct pll_vco { struct pll_vco {
unsigned long min_freq; unsigned long min_freq;
unsigned long max_freq; unsigned long max_freq;
...@@ -27,10 +49,12 @@ struct pll_vco { ...@@ -27,10 +49,12 @@ struct pll_vco {
* struct clk_alpha_pll - phase locked loop (PLL) * struct clk_alpha_pll - phase locked loop (PLL)
* @offset: base address of registers * @offset: base address of registers
* @vco_table: array of VCO settings * @vco_table: array of VCO settings
* @regs: alpha pll register map (see @clk_alpha_pll_regs)
* @clkr: regmap clock handle * @clkr: regmap clock handle
*/ */
struct clk_alpha_pll { struct clk_alpha_pll {
u32 offset; u32 offset;
const u8 *regs;
const struct pll_vco *vco_table; const struct pll_vco *vco_table;
size_t num_vco; size_t num_vco;
...@@ -45,12 +69,14 @@ struct clk_alpha_pll { ...@@ -45,12 +69,14 @@ struct clk_alpha_pll {
/** /**
* struct clk_alpha_pll_postdiv - phase locked loop (PLL) post-divider * struct clk_alpha_pll_postdiv - phase locked loop (PLL) post-divider
* @offset: base address of registers * @offset: base address of registers
* @regs: alpha pll register map (see @clk_alpha_pll_regs)
* @width: width of post-divider * @width: width of post-divider
* @clkr: regmap clock handle * @clkr: regmap clock handle
*/ */
struct clk_alpha_pll_postdiv { struct clk_alpha_pll_postdiv {
u32 offset; u32 offset;
u8 width; u8 width;
const u8 *regs;
struct clk_regmap clkr; struct clk_regmap clkr;
}; };
......
...@@ -52,6 +52,7 @@ static const struct parent_map gcc_xo_gpll0_gpll0_out_main_div2_map[] = { ...@@ -52,6 +52,7 @@ static const struct parent_map gcc_xo_gpll0_gpll0_out_main_div2_map[] = {
static struct clk_alpha_pll gpll0_main = { static struct clk_alpha_pll gpll0_main = {
.offset = 0x21000, .offset = 0x21000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr = { .clkr = {
.enable_reg = 0x0b000, .enable_reg = 0x0b000,
.enable_mask = BIT(0), .enable_mask = BIT(0),
...@@ -82,6 +83,7 @@ static struct clk_fixed_factor gpll0_out_main_div2 = { ...@@ -82,6 +83,7 @@ static struct clk_fixed_factor gpll0_out_main_div2 = {
static struct clk_alpha_pll_postdiv gpll0 = { static struct clk_alpha_pll_postdiv gpll0 = {
.offset = 0x21000, .offset = 0x21000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll0", .name = "gpll0",
.parent_names = (const char *[]){ .parent_names = (const char *[]){
......
...@@ -73,6 +73,7 @@ static struct clk_fixed_factor xo = { ...@@ -73,6 +73,7 @@ static struct clk_fixed_factor xo = {
static struct clk_alpha_pll gpll0_early = { static struct clk_alpha_pll gpll0_early = {
.offset = 0x00000, .offset = 0x00000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr = { .clkr = {
.enable_reg = 0x1480, .enable_reg = 0x1480,
.enable_mask = BIT(0), .enable_mask = BIT(0),
...@@ -88,6 +89,7 @@ static struct clk_alpha_pll gpll0_early = { ...@@ -88,6 +89,7 @@ static struct clk_alpha_pll gpll0_early = {
static struct clk_alpha_pll_postdiv gpll0 = { static struct clk_alpha_pll_postdiv gpll0 = {
.offset = 0x00000, .offset = 0x00000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr.hw.init = &(struct clk_init_data) .clkr.hw.init = &(struct clk_init_data)
{ {
.name = "gpll0", .name = "gpll0",
...@@ -99,6 +101,7 @@ static struct clk_alpha_pll_postdiv gpll0 = { ...@@ -99,6 +101,7 @@ static struct clk_alpha_pll_postdiv gpll0 = {
static struct clk_alpha_pll gpll4_early = { static struct clk_alpha_pll gpll4_early = {
.offset = 0x1dc0, .offset = 0x1dc0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr = { .clkr = {
.enable_reg = 0x1480, .enable_reg = 0x1480,
.enable_mask = BIT(4), .enable_mask = BIT(4),
...@@ -114,6 +117,7 @@ static struct clk_alpha_pll gpll4_early = { ...@@ -114,6 +117,7 @@ static struct clk_alpha_pll gpll4_early = {
static struct clk_alpha_pll_postdiv gpll4 = { static struct clk_alpha_pll_postdiv gpll4 = {
.offset = 0x1dc0, .offset = 0x1dc0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr.hw.init = &(struct clk_init_data) .clkr.hw.init = &(struct clk_init_data)
{ {
.name = "gpll4", .name = "gpll4",
......
...@@ -227,6 +227,7 @@ static struct clk_fixed_factor xo = { ...@@ -227,6 +227,7 @@ static struct clk_fixed_factor xo = {
static struct clk_alpha_pll gpll0_early = { static struct clk_alpha_pll gpll0_early = {
.offset = 0x00000, .offset = 0x00000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr = { .clkr = {
.enable_reg = 0x52000, .enable_reg = 0x52000,
.enable_mask = BIT(0), .enable_mask = BIT(0),
...@@ -252,6 +253,7 @@ static struct clk_fixed_factor gpll0_early_div = { ...@@ -252,6 +253,7 @@ static struct clk_fixed_factor gpll0_early_div = {
static struct clk_alpha_pll_postdiv gpll0 = { static struct clk_alpha_pll_postdiv gpll0 = {
.offset = 0x00000, .offset = 0x00000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll0", .name = "gpll0",
.parent_names = (const char *[]){ "gpll0_early" }, .parent_names = (const char *[]){ "gpll0_early" },
...@@ -262,6 +264,7 @@ static struct clk_alpha_pll_postdiv gpll0 = { ...@@ -262,6 +264,7 @@ static struct clk_alpha_pll_postdiv gpll0 = {
static struct clk_alpha_pll gpll4_early = { static struct clk_alpha_pll gpll4_early = {
.offset = 0x77000, .offset = 0x77000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr = { .clkr = {
.enable_reg = 0x52000, .enable_reg = 0x52000,
.enable_mask = BIT(4), .enable_mask = BIT(4),
...@@ -276,6 +279,7 @@ static struct clk_alpha_pll gpll4_early = { ...@@ -276,6 +279,7 @@ static struct clk_alpha_pll gpll4_early = {
static struct clk_alpha_pll_postdiv gpll4 = { static struct clk_alpha_pll_postdiv gpll4 = {
.offset = 0x77000, .offset = 0x77000,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "gpll4", .name = "gpll4",
.parent_names = (const char *[]){ "gpll4_early" }, .parent_names = (const char *[]){ "gpll4_early" },
......
...@@ -267,6 +267,7 @@ static struct pll_vco mmpll_t_vco[] = { ...@@ -267,6 +267,7 @@ static struct pll_vco mmpll_t_vco[] = {
static struct clk_alpha_pll mmpll0_early = { static struct clk_alpha_pll mmpll0_early = {
.offset = 0x0, .offset = 0x0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.vco_table = mmpll_p_vco, .vco_table = mmpll_p_vco,
.num_vco = ARRAY_SIZE(mmpll_p_vco), .num_vco = ARRAY_SIZE(mmpll_p_vco),
.clkr = { .clkr = {
...@@ -283,6 +284,7 @@ static struct clk_alpha_pll mmpll0_early = { ...@@ -283,6 +284,7 @@ static struct clk_alpha_pll mmpll0_early = {
static struct clk_alpha_pll_postdiv mmpll0 = { static struct clk_alpha_pll_postdiv mmpll0 = {
.offset = 0x0, .offset = 0x0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.width = 4, .width = 4,
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "mmpll0", .name = "mmpll0",
...@@ -295,6 +297,7 @@ static struct clk_alpha_pll_postdiv mmpll0 = { ...@@ -295,6 +297,7 @@ static struct clk_alpha_pll_postdiv mmpll0 = {
static struct clk_alpha_pll mmpll1_early = { static struct clk_alpha_pll mmpll1_early = {
.offset = 0x30, .offset = 0x30,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.vco_table = mmpll_p_vco, .vco_table = mmpll_p_vco,
.num_vco = ARRAY_SIZE(mmpll_p_vco), .num_vco = ARRAY_SIZE(mmpll_p_vco),
.clkr = { .clkr = {
...@@ -311,6 +314,7 @@ static struct clk_alpha_pll mmpll1_early = { ...@@ -311,6 +314,7 @@ static struct clk_alpha_pll mmpll1_early = {
static struct clk_alpha_pll_postdiv mmpll1 = { static struct clk_alpha_pll_postdiv mmpll1 = {
.offset = 0x30, .offset = 0x30,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.width = 4, .width = 4,
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "mmpll1", .name = "mmpll1",
...@@ -323,6 +327,7 @@ static struct clk_alpha_pll_postdiv mmpll1 = { ...@@ -323,6 +327,7 @@ static struct clk_alpha_pll_postdiv mmpll1 = {
static struct clk_alpha_pll mmpll2_early = { static struct clk_alpha_pll mmpll2_early = {
.offset = 0x4100, .offset = 0x4100,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.vco_table = mmpll_gfx_vco, .vco_table = mmpll_gfx_vco,
.num_vco = ARRAY_SIZE(mmpll_gfx_vco), .num_vco = ARRAY_SIZE(mmpll_gfx_vco),
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
...@@ -335,6 +340,7 @@ static struct clk_alpha_pll mmpll2_early = { ...@@ -335,6 +340,7 @@ static struct clk_alpha_pll mmpll2_early = {
static struct clk_alpha_pll_postdiv mmpll2 = { static struct clk_alpha_pll_postdiv mmpll2 = {
.offset = 0x4100, .offset = 0x4100,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.width = 4, .width = 4,
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "mmpll2", .name = "mmpll2",
...@@ -347,6 +353,7 @@ static struct clk_alpha_pll_postdiv mmpll2 = { ...@@ -347,6 +353,7 @@ static struct clk_alpha_pll_postdiv mmpll2 = {
static struct clk_alpha_pll mmpll3_early = { static struct clk_alpha_pll mmpll3_early = {
.offset = 0x60, .offset = 0x60,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.vco_table = mmpll_p_vco, .vco_table = mmpll_p_vco,
.num_vco = ARRAY_SIZE(mmpll_p_vco), .num_vco = ARRAY_SIZE(mmpll_p_vco),
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
...@@ -359,6 +366,7 @@ static struct clk_alpha_pll mmpll3_early = { ...@@ -359,6 +366,7 @@ static struct clk_alpha_pll mmpll3_early = {
static struct clk_alpha_pll_postdiv mmpll3 = { static struct clk_alpha_pll_postdiv mmpll3 = {
.offset = 0x60, .offset = 0x60,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.width = 4, .width = 4,
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "mmpll3", .name = "mmpll3",
...@@ -371,6 +379,7 @@ static struct clk_alpha_pll_postdiv mmpll3 = { ...@@ -371,6 +379,7 @@ static struct clk_alpha_pll_postdiv mmpll3 = {
static struct clk_alpha_pll mmpll4_early = { static struct clk_alpha_pll mmpll4_early = {
.offset = 0x90, .offset = 0x90,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.vco_table = mmpll_t_vco, .vco_table = mmpll_t_vco,
.num_vco = ARRAY_SIZE(mmpll_t_vco), .num_vco = ARRAY_SIZE(mmpll_t_vco),
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
...@@ -383,6 +392,7 @@ static struct clk_alpha_pll mmpll4_early = { ...@@ -383,6 +392,7 @@ static struct clk_alpha_pll mmpll4_early = {
static struct clk_alpha_pll_postdiv mmpll4 = { static struct clk_alpha_pll_postdiv mmpll4 = {
.offset = 0x90, .offset = 0x90,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.width = 2, .width = 2,
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "mmpll4", .name = "mmpll4",
...@@ -395,6 +405,7 @@ static struct clk_alpha_pll_postdiv mmpll4 = { ...@@ -395,6 +405,7 @@ static struct clk_alpha_pll_postdiv mmpll4 = {
static struct clk_alpha_pll mmpll5_early = { static struct clk_alpha_pll mmpll5_early = {
.offset = 0xc0, .offset = 0xc0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.vco_table = mmpll_p_vco, .vco_table = mmpll_p_vco,
.num_vco = ARRAY_SIZE(mmpll_p_vco), .num_vco = ARRAY_SIZE(mmpll_p_vco),
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
...@@ -407,6 +418,7 @@ static struct clk_alpha_pll mmpll5_early = { ...@@ -407,6 +418,7 @@ static struct clk_alpha_pll mmpll5_early = {
static struct clk_alpha_pll_postdiv mmpll5 = { static struct clk_alpha_pll_postdiv mmpll5 = {
.offset = 0xc0, .offset = 0xc0,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.width = 4, .width = 4,
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "mmpll5", .name = "mmpll5",
...@@ -419,6 +431,7 @@ static struct clk_alpha_pll_postdiv mmpll5 = { ...@@ -419,6 +431,7 @@ static struct clk_alpha_pll_postdiv mmpll5 = {
static struct clk_alpha_pll mmpll8_early = { static struct clk_alpha_pll mmpll8_early = {
.offset = 0x4130, .offset = 0x4130,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.vco_table = mmpll_gfx_vco, .vco_table = mmpll_gfx_vco,
.num_vco = ARRAY_SIZE(mmpll_gfx_vco), .num_vco = ARRAY_SIZE(mmpll_gfx_vco),
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
...@@ -431,6 +444,7 @@ static struct clk_alpha_pll mmpll8_early = { ...@@ -431,6 +444,7 @@ static struct clk_alpha_pll mmpll8_early = {
static struct clk_alpha_pll_postdiv mmpll8 = { static struct clk_alpha_pll_postdiv mmpll8 = {
.offset = 0x4130, .offset = 0x4130,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.width = 4, .width = 4,
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "mmpll8", .name = "mmpll8",
...@@ -443,6 +457,7 @@ static struct clk_alpha_pll_postdiv mmpll8 = { ...@@ -443,6 +457,7 @@ static struct clk_alpha_pll_postdiv mmpll8 = {
static struct clk_alpha_pll mmpll9_early = { static struct clk_alpha_pll mmpll9_early = {
.offset = 0x4200, .offset = 0x4200,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.vco_table = mmpll_t_vco, .vco_table = mmpll_t_vco,
.num_vco = ARRAY_SIZE(mmpll_t_vco), .num_vco = ARRAY_SIZE(mmpll_t_vco),
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
...@@ -455,6 +470,7 @@ static struct clk_alpha_pll mmpll9_early = { ...@@ -455,6 +470,7 @@ static struct clk_alpha_pll mmpll9_early = {
static struct clk_alpha_pll_postdiv mmpll9 = { static struct clk_alpha_pll_postdiv mmpll9 = {
.offset = 0x4200, .offset = 0x4200,
.regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_DEFAULT],
.width = 2, .width = 2,
.clkr.hw.init = &(struct clk_init_data){ .clkr.hw.init = &(struct clk_init_data){
.name = "mmpll9", .name = "mmpll9",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment