123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- From c08886564938df6796a7d98495cf5cc3f7a09337 Mon Sep 17 00:00:00 2001
- From: Eric Anholt <eric@anholt.net>
- Date: Wed, 18 Jan 2017 07:31:55 +1100
- Subject: [PATCH] clk: bcm2835: Don't rate change PLLs on behalf of DSI PLL
- dividers (v2).
- Our core PLLs are intended to be configured once and left alone. With
- the SET_RATE_PARENT, asking to set the PLLD_DSI1 clock rate would
- change PLLD just to get closer to the requested DSI clock, thus
- changing PLLD_PER, the UART and ethernet PHY clock rates downstream of
- it, and breaking ethernet.
- We *do* want PLLH to change so that PLLH_AUX can be exactly the value
- we want, though. Thus, we need to have a per-divider policy of
- whether to pass rate changes up.
- Signed-off-by: Eric Anholt <eric@anholt.net>
- Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
- (cherry picked from commit 55486091bd1e1c5ed28c43c0d6b3392468a9adb5)
- ---
- drivers/clk/bcm/clk-bcm2835.c | 42 ++++++++++++++++++++++++++++--------------
- 1 file changed, 28 insertions(+), 14 deletions(-)
- --- a/drivers/clk/bcm/clk-bcm2835.c
- +++ b/drivers/clk/bcm/clk-bcm2835.c
- @@ -449,6 +449,7 @@ struct bcm2835_pll_divider_data {
- u32 load_mask;
- u32 hold_mask;
- u32 fixed_divider;
- + u32 flags;
- };
-
- struct bcm2835_clock_data {
- @@ -1292,7 +1293,7 @@ bcm2835_register_pll_divider(struct bcm2
- init.num_parents = 1;
- init.name = divider_name;
- init.ops = &bcm2835_pll_divider_clk_ops;
- - init.flags = CLK_IGNORE_UNUSED;
- + init.flags = data->flags | CLK_IGNORE_UNUSED;
-
- divider = devm_kzalloc(cprman->dev, sizeof(*divider), GFP_KERNEL);
- if (!divider)
- @@ -1531,7 +1532,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLA_CORE,
- .load_mask = CM_PLLA_LOADCORE,
- .hold_mask = CM_PLLA_HOLDCORE,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
- [BCM2835_PLLA_PER] = REGISTER_PLL_DIV(
- .name = "plla_per",
- .source_pll = "plla",
- @@ -1539,7 +1541,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLA_PER,
- .load_mask = CM_PLLA_LOADPER,
- .hold_mask = CM_PLLA_HOLDPER,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
- [BCM2835_PLLA_DSI0] = REGISTER_PLL_DIV(
- .name = "plla_dsi0",
- .source_pll = "plla",
- @@ -1555,7 +1558,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLA_CCP2,
- .load_mask = CM_PLLA_LOADCCP2,
- .hold_mask = CM_PLLA_HOLDCCP2,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
-
- /* PLLB is used for the ARM's clock. */
- [BCM2835_PLLB] = REGISTER_PLL(
- @@ -1579,7 +1583,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLB_ARM,
- .load_mask = CM_PLLB_LOADARM,
- .hold_mask = CM_PLLB_HOLDARM,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
-
- /*
- * PLLC is the core PLL, used to drive the core VPU clock.
- @@ -1608,7 +1613,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLC_CORE0,
- .load_mask = CM_PLLC_LOADCORE0,
- .hold_mask = CM_PLLC_HOLDCORE0,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
- [BCM2835_PLLC_CORE1] = REGISTER_PLL_DIV(
- .name = "pllc_core1",
- .source_pll = "pllc",
- @@ -1616,7 +1622,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLC_CORE1,
- .load_mask = CM_PLLC_LOADCORE1,
- .hold_mask = CM_PLLC_HOLDCORE1,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
- [BCM2835_PLLC_CORE2] = REGISTER_PLL_DIV(
- .name = "pllc_core2",
- .source_pll = "pllc",
- @@ -1624,7 +1631,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLC_CORE2,
- .load_mask = CM_PLLC_LOADCORE2,
- .hold_mask = CM_PLLC_HOLDCORE2,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
- [BCM2835_PLLC_PER] = REGISTER_PLL_DIV(
- .name = "pllc_per",
- .source_pll = "pllc",
- @@ -1632,7 +1640,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLC_PER,
- .load_mask = CM_PLLC_LOADPER,
- .hold_mask = CM_PLLC_HOLDPER,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
-
- /*
- * PLLD is the display PLL, used to drive DSI display panels.
- @@ -1661,7 +1670,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLD_CORE,
- .load_mask = CM_PLLD_LOADCORE,
- .hold_mask = CM_PLLD_HOLDCORE,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
- [BCM2835_PLLD_PER] = REGISTER_PLL_DIV(
- .name = "plld_per",
- .source_pll = "plld",
- @@ -1669,7 +1679,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLD_PER,
- .load_mask = CM_PLLD_LOADPER,
- .hold_mask = CM_PLLD_HOLDPER,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
- [BCM2835_PLLD_DSI0] = REGISTER_PLL_DIV(
- .name = "plld_dsi0",
- .source_pll = "plld",
- @@ -1714,7 +1725,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLH_RCAL,
- .load_mask = CM_PLLH_LOADRCAL,
- .hold_mask = 0,
- - .fixed_divider = 10),
- + .fixed_divider = 10,
- + .flags = CLK_SET_RATE_PARENT),
- [BCM2835_PLLH_AUX] = REGISTER_PLL_DIV(
- .name = "pllh_aux",
- .source_pll = "pllh",
- @@ -1722,7 +1734,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLH_AUX,
- .load_mask = CM_PLLH_LOADAUX,
- .hold_mask = 0,
- - .fixed_divider = 1),
- + .fixed_divider = 1,
- + .flags = CLK_SET_RATE_PARENT),
- [BCM2835_PLLH_PIX] = REGISTER_PLL_DIV(
- .name = "pllh_pix",
- .source_pll = "pllh",
- @@ -1730,7 +1743,8 @@ static const struct bcm2835_clk_desc clk
- .a2w_reg = A2W_PLLH_PIX,
- .load_mask = CM_PLLH_LOADPIX,
- .hold_mask = 0,
- - .fixed_divider = 10),
- + .fixed_divider = 10,
- + .flags = CLK_SET_RATE_PARENT),
-
- /* the clocks */
-
|