Commit 7029db09 authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Stephen Boyd
Browse files

clk: at91: clk-master: add notifier for divider



SAMA7G5 supports DVFS by changing cpuck. On SAMA7G5 mck0 shares the same
parent with cpuck as seen in the following clock tree:

                       +----------> cpuck
                       |
FRAC PLL ---> DIV PLL -+-> DIV ---> mck0

mck0 could go b/w 32KHz and 200MHz on SAMA7G5. To avoid mck0 overclocking
while changing FRAC PLL or DIV PLL the commit implements a notifier for
mck0 which applies a safe divider to register (maximum value of the divider
which is 5) on PRE_RATE_CHANGE events (such that changes on PLL to not
overclock mck0) and sets the maximum allowed rate on POST_RATE_CHANGE
events.

Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20211011112719.3951784-13-claudiu.beznea@microchip.com


Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: default avatarStephen Boyd <sboyd@kernel.org>
parent 1e229c21
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
					  "masterck_pres",
					  &at91rm9200_master_layout,
					  &rm9200_mck_characteristics,
					  &rm9200_mck_lock, CLK_SET_RATE_GATE);
					  &rm9200_mck_lock, CLK_SET_RATE_GATE, 0);
	if (IS_ERR(hw))
		goto err_free;

+1 −1
Original line number Diff line number Diff line
@@ -429,7 +429,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
					  &at91rm9200_master_layout,
					  data->mck_characteristics,
					  &at91sam9260_mck_lock,
					  CLK_SET_RATE_GATE);
					  CLK_SET_RATE_GATE, 0);
	if (IS_ERR(hw))
		goto err_free;

+1 −1
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
					  &at91rm9200_master_layout,
					  &mck_characteristics,
					  &at91sam9g45_mck_lock,
					  CLK_SET_RATE_GATE);
					  CLK_SET_RATE_GATE, 0);
	if (IS_ERR(hw))
		goto err_free;

+1 −1
Original line number Diff line number Diff line
@@ -191,7 +191,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
					  &at91sam9x5_master_layout,
					  &mck_characteristics,
					  &at91sam9n12_mck_lock,
					  CLK_SET_RATE_GATE);
					  CLK_SET_RATE_GATE, 0);
	if (IS_ERR(hw))
		goto err_free;

+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
					  "masterck_pres",
					  &at91rm9200_master_layout,
					  &sam9rl_mck_characteristics,
					  &sam9rl_mck_lock, CLK_SET_RATE_GATE);
					  &sam9rl_mck_lock, CLK_SET_RATE_GATE, 0);
	if (IS_ERR(hw))
		goto err_free;

Loading