Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: imx: imx6sx: Allow a different LCDIF1 clock parent

It is not a good idea to hardcode the LCDIF1 parent inside the
clock driver because some users may want to use a different clock
parent for LCDIF1. One of the reasons could be related to EMI tests.

Remove the harcoded LCDIF1 parent when the LCDIF1 parent is described
via devicetree.

Old dtb's that do not describe the LCDIF1 parent via devicetree will
use the same PLL5 clock as parent to keep the original behavior.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Reviewed-by: Abel Vesa <abel.vesa@linaro.org>
Link: https://lore.kernel.org/r/20230815130923.775117-1-festevam@gmail.com
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>

authored by

Fabio Estevam and committed by
Abel Vesa
0a22b3a6 577ad169

+11 -3
+11 -3
drivers/clk/imx/clk-imx6sx.c
··· 121 121 { 122 122 struct device_node *np; 123 123 void __iomem *base; 124 + bool lcdif1_assigned_clk; 124 125 125 126 clk_hw_data = kzalloc(struct_size(clk_hw_data, hws, 126 127 IMX6SX_CLK_CLK_END), GFP_KERNEL); ··· 499 498 clk_set_parent(hws[IMX6SX_CLK_EIM_SLOW_SEL]->clk, hws[IMX6SX_CLK_PLL2_PFD2]->clk); 500 499 clk_set_rate(hws[IMX6SX_CLK_EIM_SLOW]->clk, 132000000); 501 500 502 - /* set parent clock for LCDIF1 pixel clock */ 503 - clk_set_parent(hws[IMX6SX_CLK_LCDIF1_PRE_SEL]->clk, hws[IMX6SX_CLK_PLL5_VIDEO_DIV]->clk); 504 - clk_set_parent(hws[IMX6SX_CLK_LCDIF1_SEL]->clk, hws[IMX6SX_CLK_LCDIF1_PODF]->clk); 501 + np = of_find_node_by_path("/soc/bus@2200000/spba-bus@2240000/lcdif@2220000"); 502 + lcdif1_assigned_clk = of_find_property(np, "assigned-clock-parents", NULL); 503 + 504 + /* Set parent clock for LCDIF1 pixel clock if not done via devicetree */ 505 + if (!lcdif1_assigned_clk) { 506 + clk_set_parent(hws[IMX6SX_CLK_LCDIF1_PRE_SEL]->clk, 507 + hws[IMX6SX_CLK_PLL5_VIDEO_DIV]->clk); 508 + clk_set_parent(hws[IMX6SX_CLK_LCDIF1_SEL]->clk, 509 + hws[IMX6SX_CLK_LCDIF1_PODF]->clk); 510 + } 505 511 506 512 /* Set the parent clks of PCIe lvds1 and pcie_axi to be pcie ref, axi */ 507 513 if (clk_set_parent(hws[IMX6SX_CLK_LVDS1_SEL]->clk, hws[IMX6SX_CLK_PCIE_REF_125M]->clk))