Commit f04f2870 authored by Stephen Boyd's avatar Stephen Boyd
Browse files

Merge tag 'clk-imx-5.20' of...

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
parents f2906aa8 c196175a
Loading
Loading
Loading
Loading
+21 −15
Original line number Diff line number Diff line
@@ -64,10 +64,13 @@ struct clk_fracn_gppll {
 * Fout = Fvco / (rdiv * odiv)
 */
static const struct imx_fracn_gppll_rate_table fracn_tbl[] = {
	PLL_FRACN_GP(650000000U, 81, 0, 0, 0, 3),
	PLL_FRACN_GP(594000000U, 198, 0, 0, 0, 8),
	PLL_FRACN_GP(560000000U, 70, 0, 0, 0, 3),
	PLL_FRACN_GP(400000000U, 50, 0, 0, 0, 3),
	PLL_FRACN_GP(650000000U, 81, 0, 1, 0, 3),
	PLL_FRACN_GP(594000000U, 198, 0, 1, 0, 8),
	PLL_FRACN_GP(560000000U, 70, 0, 1, 0, 3),
	PLL_FRACN_GP(498000000U, 83, 0, 1, 0, 4),
	PLL_FRACN_GP(484000000U, 121, 0, 1, 0, 6),
	PLL_FRACN_GP(445333333U, 167, 0, 1, 0, 9),
	PLL_FRACN_GP(400000000U, 50, 0, 1, 0, 3),
	PLL_FRACN_GP(393216000U, 81, 92, 100, 0, 5)
};

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

	rdiv = FIELD_GET(PLL_RDIV_MASK, pll_div);
	rdiv = rdiv + 1;
	odiv = FIELD_GET(PLL_ODIV_MASK, pll_div);
	switch (odiv) {
	case 0:
		odiv = 2;
		break;
	case 1:
		odiv = 3;
		break;
	default:
		break;
	}

	/*
	 * 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
	if (rate)
		return (unsigned long)rate;

	if (!rdiv)
		rdiv = rdiv + 1;

	switch (odiv) {
	case 0:
		odiv = 2;
		break;
	case 1:
		odiv = 3;
		break;
	default:
		break;
	}

	/* Fvco = Fref * (MFI + MFN / MFD) */
	fvco = fvco * mfi * mfd + fvco * mfn;
	do_div(fvco, mfd * rdiv * odiv);
+3 −3
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ static const struct imx93_clk_ccgr {
	{ IMX93_CLK_A55_GATE,		"a55",		"a55_root",		0x8000, },
	/* M33 critical clk for system run */
	{ IMX93_CLK_CM33_GATE,		"cm33",		"m33_root",		0x8040, CLK_IS_CRITICAL },
	{ IMX93_CLK_ADC1_GATE,		"adc1",		"osc_24m",		0x82c0, },
	{ IMX93_CLK_ADC1_GATE,		"adc1",		"adc_root",		0x82c0, },
	{ IMX93_CLK_WDOG1_GATE,		"wdog1",	"osc_24m",		0x8300, },
	{ IMX93_CLK_WDOG2_GATE,		"wdog2",	"osc_24m",		0x8340, },
	{ IMX93_CLK_WDOG3_GATE,		"wdog3",	"osc_24m",		0x8380, },
@@ -160,7 +160,7 @@ static const struct imx93_clk_ccgr {
	{ IMX93_CLK_SEMA2_GATE,		"sema2",	"bus_wakeup_root",	0x8480, },
	{ IMX93_CLK_MU_A_GATE,		"mu_a",		"bus_aon_root",		0x84c0, },
	{ IMX93_CLK_MU_B_GATE,		"mu_b",		"bus_aon_root",		0x8500, },
	{ IMX93_CLK_EDMA1_GATE,		"edma1",	"wakeup_axi_root",	0x8540, },
	{ IMX93_CLK_EDMA1_GATE,		"edma1",	"m33_root",		0x8540, },
	{ IMX93_CLK_EDMA2_GATE,		"edma2",	"wakeup_axi_root",	0x8580, },
	{ IMX93_CLK_FLEXSPI1_GATE,	"flexspi",	"flexspi_root",		0x8640, },
	{ IMX93_CLK_GPIO1_GATE,		"gpio1",	"m33_root",		0x8880, },
@@ -219,7 +219,7 @@ static const struct imx93_clk_ccgr {
	{ IMX93_CLK_LCDIF_GATE,		"lcdif",	"media_apb_root",	0x9640, },
	{ IMX93_CLK_PXP_GATE,		"pxp",		"media_apb_root",	0x9680, },
	{ IMX93_CLK_ISI_GATE,		"isi",		"media_apb_root",	0x96c0, },
	{ IMX93_CLK_NIC_MEDIA_GATE,	"nic_media",	"media_apb_root",	0x9700, },
	{ IMX93_CLK_NIC_MEDIA_GATE,	"nic_media",	"media_axi_root",	0x9700, },
	{ IMX93_CLK_USB_CONTROLLER_GATE, "usb_controller", "hsio_root",		0x9a00, },
	{ IMX93_CLK_USB_TEST_60M_GATE,	"usb_test_60m",	"hsio_usb_test_60m_root", 0x9a40, },
	{ IMX93_CLK_HSIO_TROUT_24M_GATE, "hsio_trout_24m", "osc_24m",		0x9a80, },