Skip to content

Commit f04f287

Browse files
committed
Merge tag 'clk-imx-5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux into clk-imx
Pull i.MX clk driver updates from Abel Vesa: - Correct adc1, nic_media and edma1's parents for i.MX93 - Fix rdiv, mfd values, the return rate in recalc_rate and add more frequencies in the table for fracn-gppll * tag 'clk-imx-5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux: clk: imx: clk-fracn-gppll: Add more freq config for video pll clk: imx: clk-fracn-gppll: correct rdiv clk: imx: clk-fracn-gppll: Return rate in rate table properly in ->recalc_rate() clk: imx: clk-fracn-gppll: fix mfd value clk: imx93: Correct the edma1's parent clock clk: imx93: correct nic_media parent clk: imx93: use adc_root as the parent clock of adc1
2 parents f2906aa + c196175 commit f04f287

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

drivers/clk/imx/clk-fracn-gppll.c

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,13 @@ struct clk_fracn_gppll {
6464
* Fout = Fvco / (rdiv * odiv)
6565
*/
6666
static const struct imx_fracn_gppll_rate_table fracn_tbl[] = {
67-
PLL_FRACN_GP(650000000U, 81, 0, 0, 0, 3),
68-
PLL_FRACN_GP(594000000U, 198, 0, 0, 0, 8),
69-
PLL_FRACN_GP(560000000U, 70, 0, 0, 0, 3),
70-
PLL_FRACN_GP(400000000U, 50, 0, 0, 0, 3),
67+
PLL_FRACN_GP(650000000U, 81, 0, 1, 0, 3),
68+
PLL_FRACN_GP(594000000U, 198, 0, 1, 0, 8),
69+
PLL_FRACN_GP(560000000U, 70, 0, 1, 0, 3),
70+
PLL_FRACN_GP(498000000U, 83, 0, 1, 0, 4),
71+
PLL_FRACN_GP(484000000U, 121, 0, 1, 0, 6),
72+
PLL_FRACN_GP(445333333U, 167, 0, 1, 0, 9),
73+
PLL_FRACN_GP(400000000U, 50, 0, 1, 0, 3),
7174
PLL_FRACN_GP(393216000U, 81, 92, 100, 0, 5)
7275
};
7376

@@ -131,18 +134,7 @@ static unsigned long clk_fracn_gppll_recalc_rate(struct clk_hw *hw, unsigned lon
131134
mfi = FIELD_GET(PLL_MFI_MASK, pll_div);
132135

133136
rdiv = FIELD_GET(PLL_RDIV_MASK, pll_div);
134-
rdiv = rdiv + 1;
135137
odiv = FIELD_GET(PLL_ODIV_MASK, pll_div);
136-
switch (odiv) {
137-
case 0:
138-
odiv = 2;
139-
break;
140-
case 1:
141-
odiv = 3;
142-
break;
143-
default:
144-
break;
145-
}
146138

147139
/*
148140
* Sometimes, the recalculated rate has deviation due to
@@ -160,6 +152,20 @@ static unsigned long clk_fracn_gppll_recalc_rate(struct clk_hw *hw, unsigned lon
160152
if (rate)
161153
return (unsigned long)rate;
162154

155+
if (!rdiv)
156+
rdiv = rdiv + 1;
157+
158+
switch (odiv) {
159+
case 0:
160+
odiv = 2;
161+
break;
162+
case 1:
163+
odiv = 3;
164+
break;
165+
default:
166+
break;
167+
}
168+
163169
/* Fvco = Fref * (MFI + MFN / MFD) */
164170
fvco = fvco * mfi * mfd + fvco * mfn;
165171
do_div(fvco, mfd * rdiv * odiv);

drivers/clk/imx/clk-imx93.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static const struct imx93_clk_ccgr {
150150
{ IMX93_CLK_A55_GATE, "a55", "a55_root", 0x8000, },
151151
/* M33 critical clk for system run */
152152
{ IMX93_CLK_CM33_GATE, "cm33", "m33_root", 0x8040, CLK_IS_CRITICAL },
153-
{ IMX93_CLK_ADC1_GATE, "adc1", "osc_24m", 0x82c0, },
153+
{ IMX93_CLK_ADC1_GATE, "adc1", "adc_root", 0x82c0, },
154154
{ IMX93_CLK_WDOG1_GATE, "wdog1", "osc_24m", 0x8300, },
155155
{ IMX93_CLK_WDOG2_GATE, "wdog2", "osc_24m", 0x8340, },
156156
{ IMX93_CLK_WDOG3_GATE, "wdog3", "osc_24m", 0x8380, },
@@ -160,7 +160,7 @@ static const struct imx93_clk_ccgr {
160160
{ IMX93_CLK_SEMA2_GATE, "sema2", "bus_wakeup_root", 0x8480, },
161161
{ IMX93_CLK_MU_A_GATE, "mu_a", "bus_aon_root", 0x84c0, },
162162
{ IMX93_CLK_MU_B_GATE, "mu_b", "bus_aon_root", 0x8500, },
163-
{ IMX93_CLK_EDMA1_GATE, "edma1", "wakeup_axi_root", 0x8540, },
163+
{ IMX93_CLK_EDMA1_GATE, "edma1", "m33_root", 0x8540, },
164164
{ IMX93_CLK_EDMA2_GATE, "edma2", "wakeup_axi_root", 0x8580, },
165165
{ IMX93_CLK_FLEXSPI1_GATE, "flexspi", "flexspi_root", 0x8640, },
166166
{ IMX93_CLK_GPIO1_GATE, "gpio1", "m33_root", 0x8880, },
@@ -219,7 +219,7 @@ static const struct imx93_clk_ccgr {
219219
{ IMX93_CLK_LCDIF_GATE, "lcdif", "media_apb_root", 0x9640, },
220220
{ IMX93_CLK_PXP_GATE, "pxp", "media_apb_root", 0x9680, },
221221
{ IMX93_CLK_ISI_GATE, "isi", "media_apb_root", 0x96c0, },
222-
{ IMX93_CLK_NIC_MEDIA_GATE, "nic_media", "media_apb_root", 0x9700, },
222+
{ IMX93_CLK_NIC_MEDIA_GATE, "nic_media", "media_axi_root", 0x9700, },
223223
{ IMX93_CLK_USB_CONTROLLER_GATE, "usb_controller", "hsio_root", 0x9a00, },
224224
{ IMX93_CLK_USB_TEST_60M_GATE, "usb_test_60m", "hsio_usb_test_60m_root", 0x9a40, },
225225
{ IMX93_CLK_HSIO_TROUT_24M_GATE, "hsio_trout_24m", "osc_24m", 0x9a80, },

0 commit comments

Comments
 (0)