]> git.baikalelectronics.ru Git - kernel.git/commitdiff
clk: at91: allow setting all PMC clock parents via DT
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Mon, 4 May 2020 22:37:57 +0000 (00:37 +0200)
committerStephen Boyd <sboyd@kernel.org>
Wed, 27 May 2020 03:22:50 +0000 (20:22 -0700)
We need to have clocks accessible via phandle to select them
as peripheral clock parent using assigned-clock-parents in DT.
Add support for PLLACK/PLLBCK/AUDIOPLLCK clocks where available.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lkml.kernel.org/r/fa39cc10dab8341ea4bc2b7152be9217b2cd34a5.1588630999.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/at91/at91rm9200.c
drivers/clk/at91/at91sam9260.c
drivers/clk/at91/at91sam9g45.c
drivers/clk/at91/at91sam9n12.c
drivers/clk/at91/at91sam9rl.c
drivers/clk/at91/at91sam9x5.c
drivers/clk/at91/sam9x60.c
drivers/clk/at91/sama5d2.c
drivers/clk/at91/sama5d3.c
drivers/clk/at91/sama5d4.c
include/dt-bindings/clock/at91.h

index 8da88e9a95d82524c2ea9cd55d56789c2bd7f60f..38bdb498131584d4c1270f1b37f0f5f8b40f9124 100644 (file)
@@ -98,7 +98,7 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
        if (IS_ERR(regmap))
                return;
 
-       at91rm9200_pmc = pmc_data_allocate(PMC_MAIN + 1,
+       at91rm9200_pmc = pmc_data_allocate(PMC_PLLBCK + 1,
                                            nck(at91rm9200_systemck),
                                            nck(at91rm9200_periphck), 0, 4);
        if (!at91rm9200_pmc)
@@ -123,12 +123,16 @@ static void __init at91rm9200_pmc_setup(struct device_node *np)
        if (IS_ERR(hw))
                goto err_free;
 
+       at91rm9200_pmc->chws[PMC_PLLACK] = hw;
+
        hw = at91_clk_register_pll(regmap, "pllbck", "mainck", 1,
                                   &at91rm9200_pll_layout,
                                   &rm9200_pll_characteristics);
        if (IS_ERR(hw))
                goto err_free;
 
+       at91rm9200_pmc->chws[PMC_PLLBCK] = hw;
+
        parent_names[0] = slowxtal_name;
        parent_names[1] = "mainck";
        parent_names[2] = "pllack";
index 7e5ff252fffce49c516886c41a55dbb6f5b9e997..6d0723aa8b1380e2419ba084ec5797b6605ee7be 100644 (file)
@@ -352,7 +352,7 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
        if (IS_ERR(regmap))
                return;
 
-       at91sam9260_pmc = pmc_data_allocate(PMC_MAIN + 1,
+       at91sam9260_pmc = pmc_data_allocate(PMC_PLLBCK + 1,
                                            ndck(data->sck, data->num_sck),
                                            ndck(data->pck, data->num_pck),
                                            0, data->num_progck);
@@ -399,12 +399,16 @@ static void __init at91sam926x_pmc_setup(struct device_node *np,
        if (IS_ERR(hw))
                goto err_free;
 
+       at91sam9260_pmc->chws[PMC_PLLACK] = hw;
+
        hw = at91_clk_register_pll(regmap, "pllbck", "mainck", 1,
                                   data->pllb_layout,
                                   data->pllb_characteristics);
        if (IS_ERR(hw))
                goto err_free;
 
+       at91sam9260_pmc->chws[PMC_PLLBCK] = hw;
+
        parent_names[0] = slck_name;
        parent_names[1] = "mainck";
        parent_names[2] = "pllack";
index 5d18eb04c2184d509dae11f84c29cd9035cb632f..9873b583c26045e1b807c7fde906da3f9fa0e1fb 100644 (file)
@@ -115,7 +115,7 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
        if (IS_ERR(regmap))
                return;
 
-       at91sam9g45_pmc = pmc_data_allocate(PMC_MAIN + 1,
+       at91sam9g45_pmc = pmc_data_allocate(PMC_PLLACK + 1,
                                            nck(at91sam9g45_systemck),
                                            nck(at91sam9g45_periphck), 0, 2);
        if (!at91sam9g45_pmc)
@@ -143,6 +143,8 @@ static void __init at91sam9g45_pmc_setup(struct device_node *np)
        if (IS_ERR(hw))
                goto err_free;
 
+       at91sam9g45_pmc->chws[PMC_PLLACK] = hw;
+
        hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck");
        if (IS_ERR(hw))
                goto err_free;
index 3a2564c2f724d00cfa2171b6af8b8844dd3e8b96..630dc5d87171ad74d7d95e841e915fe56d24f28f 100644 (file)
@@ -128,7 +128,7 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
        if (IS_ERR(regmap))
                return;
 
-       at91sam9n12_pmc = pmc_data_allocate(PMC_MAIN + 1,
+       at91sam9n12_pmc = pmc_data_allocate(PMC_PLLBCK + 1,
                                           nck(at91sam9n12_systemck), 31, 0, 2);
        if (!at91sam9n12_pmc)
                return;
@@ -162,11 +162,15 @@ static void __init at91sam9n12_pmc_setup(struct device_node *np)
        if (IS_ERR(hw))
                goto err_free;
 
+       at91sam9n12_pmc->chws[PMC_PLLACK] = hw;
+
        hw = at91_clk_register_pll(regmap, "pllbck", "mainck", 1,
                                   &at91rm9200_pll_layout, &pllb_characteristics);
        if (IS_ERR(hw))
                goto err_free;
 
+       at91sam9n12_pmc->chws[PMC_PLLBCK] = hw;
+
        parent_names[0] = slck_name;
        parent_names[1] = "mainck";
        parent_names[2] = "plladivck";
index bcf07f6a0e0ee47bddaf39162024abf77fa96c77..0d1cc44b056ff42e8aeff4386fb307f4a0a0b785 100644 (file)
@@ -87,7 +87,7 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
        if (IS_ERR(regmap))
                return;
 
-       at91sam9rl_pmc = pmc_data_allocate(PMC_MAIN + 1,
+       at91sam9rl_pmc = pmc_data_allocate(PMC_PLLACK + 1,
                                           nck(at91sam9rl_systemck),
                                           nck(at91sam9rl_periphck), 0, 2);
        if (!at91sam9rl_pmc)
@@ -105,6 +105,8 @@ static void __init at91sam9rl_pmc_setup(struct device_node *np)
        if (IS_ERR(hw))
                goto err_free;
 
+       at91sam9rl_pmc->chws[PMC_PLLACK] = hw;
+
        hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck");
        if (IS_ERR(hw))
                goto err_free;
index f13756b407e2c303b1ddf762e19cfded68325bc7..0ce3da0802876af0ff0a8b6026e49c781b369b20 100644 (file)
@@ -150,7 +150,7 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
        if (IS_ERR(regmap))
                return;
 
-       at91sam9x5_pmc = pmc_data_allocate(PMC_MAIN + 1,
+       at91sam9x5_pmc = pmc_data_allocate(PMC_PLLACK + 1,
                                           nck(at91sam9x5_systemck), 31, 0, 2);
        if (!at91sam9x5_pmc)
                return;
@@ -184,6 +184,8 @@ static void __init at91sam9x5_pmc_setup(struct device_node *np,
        if (IS_ERR(hw))
                goto err_free;
 
+       at91sam9x5_pmc->chws[PMC_PLLACK] = hw;
+
        hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck");
        if (IS_ERR(hw))
                goto err_free;
index db14e0427c7fa527eaf3fc8881f69d7e1ee31b41..3e20aa68259fd2aa9a7fb958baadf6b11b101c03 100644 (file)
@@ -182,7 +182,7 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
        if (IS_ERR(regmap))
                return;
 
-       sam9x60_pmc = pmc_data_allocate(PMC_MAIN + 1,
+       sam9x60_pmc = pmc_data_allocate(PMC_PLLACK + 1,
                                        nck(sam9x60_systemck),
                                        nck(sam9x60_periphck),
                                        nck(sam9x60_gck), 8);
@@ -214,6 +214,8 @@ static void __init sam9x60_pmc_setup(struct device_node *np)
        if (IS_ERR(hw))
                goto err_free;
 
+       sam9x60_pmc->chws[PMC_PLLACK] = hw;
+
        hw = sam9x60_clk_register_pll(regmap, &pmc_pll_lock, "upllck",
                                      "main_osc", 1, &upll_characteristics);
        if (IS_ERR(hw))
index fa9f6126c158745489ae5b118c9fe1cb05ad6d70..d69421d71daf03948eafc383d7e89d1c6318afdd 100644 (file)
@@ -167,7 +167,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
        if (IS_ERR(regmap))
                return;
 
-       sama5d2_pmc = pmc_data_allocate(PMC_I2S1_MUX + 1,
+       sama5d2_pmc = pmc_data_allocate(PMC_AUDIOPLLCK + 1,
                                        nck(sama5d2_systemck),
                                        nck(sama5d2_periph32ck),
                                        nck(sama5d2_gck), 3);
@@ -203,6 +203,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
        if (IS_ERR(hw))
                goto err_free;
 
+       sama5d2_pmc->chws[PMC_PLLACK] = hw;
+
        hw = at91_clk_register_audio_pll_frac(regmap, "audiopll_fracck",
                                              "mainck");
        if (IS_ERR(hw))
@@ -218,6 +220,8 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
        if (IS_ERR(hw))
                goto err_free;
 
+       sama5d2_pmc->chws[PMC_AUDIOPLLCK] = hw;
+
        regmap_sfr = syscon_regmap_lookup_by_compatible("atmel,sama5d2-sfr");
        if (IS_ERR(regmap_sfr))
                regmap_sfr = NULL;
index 507eef6797f1b7ce2a3f637090a2fdc518b4dc14..5e4e44dd4c37c39b22f5aeb28882e405563055f0 100644 (file)
@@ -125,7 +125,7 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
        if (IS_ERR(regmap))
                return;
 
-       sama5d3_pmc = pmc_data_allocate(PMC_MAIN + 1,
+       sama5d3_pmc = pmc_data_allocate(PMC_PLLACK + 1,
                                        nck(sama5d3_systemck),
                                        nck(sama5d3_periphck), 0, 3);
        if (!sama5d3_pmc)
@@ -158,6 +158,8 @@ static void __init sama5d3_pmc_setup(struct device_node *np)
        if (IS_ERR(hw))
                goto err_free;
 
+       sama5d3_pmc->chws[PMC_PLLACK] = hw;
+
        hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck");
        if (IS_ERR(hw))
                goto err_free;
index 80692902b4e41ac8dc20e0fc9205a7891cbb153b..662ff5fa6e9868f6a1a870ee915012ad08d8c938 100644 (file)
@@ -140,7 +140,7 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
        if (IS_ERR(regmap))
                return;
 
-       sama5d4_pmc = pmc_data_allocate(PMC_MCK2 + 1,
+       sama5d4_pmc = pmc_data_allocate(PMC_PLLACK + 1,
                                        nck(sama5d4_systemck),
                                        nck(sama5d4_periph32ck), 0, 3);
        if (!sama5d4_pmc)
@@ -173,6 +173,8 @@ static void __init sama5d4_pmc_setup(struct device_node *np)
        if (IS_ERR(hw))
                goto err_free;
 
+       sama5d4_pmc->chws[PMC_PLLACK] = hw;
+
        hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck");
        if (IS_ERR(hw))
                goto err_free;
index c3f4aa6a2d296b695142513b1022d57cefc88725..eba17106608b3b03b973d0ab0aa495dd22da1183 100644 (file)
@@ -21,6 +21,9 @@
 #define PMC_MCK2               4
 #define PMC_I2S0_MUX           5
 #define PMC_I2S1_MUX           6
+#define PMC_PLLACK             7
+#define PMC_PLLBCK             8
+#define PMC_AUDIOPLLCK         9
 
 #ifndef AT91_PMC_MOSCS
 #define AT91_PMC_MOSCS         0               /* MOSCS Flag */