Skip to content

Commit 701d105

Browse files
committed
Merge tag 'clk-imx-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux into clk-imx
Pull i.MX clk driver updates from Abel Vesa: - Select MXC_CLK when building in the CLK_IMX8QXP - Fixes for error handling paths in i.MX8 ACM driver - Move the clocks check in i.MX8 ACM driver in order to log any error - Drop the unused return value of clk_imx_acm_detach_pm_domains - Drop non-existant IMX8MP_CLK_AUDIOMIX_PDM_ROOT clock - Fix error handling in i.MX8MQ clock driver - Allow a different LCDIF1 clock parent if DT describes it for i.MX6SX - Keep the SCU resource table sorted in the i.MX8DXL rsrc driver - Move the elcdif PLL clock registration above lcd_clk, as it is its parent - Correct some ENET specific clocks for i.MX8DXL platform - Drop the VPU_UART and VPUCORE from i.MX8QM as latest HW revision doesn't have them - Remove "de-featured" MLB support from i.MX8QM/QXP/DXL platforms - Skip registering clocks owned by Cortex-A partition SCU-based platforms - Add CAN_1/2 to i.MX8QM and M4_0, PI_0_PWM_0 and PI_0_I2C_0 to i.MX8QXP resources * tag 'clk-imx-6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux: clk: imx: imx8qm/qxp: add more resources to whitelist clk: imx: scu: ignore clks not owned by Cortex-A partition clk: imx8: remove MLB support clk: imx: imx8qm-rsrc: drop VPU_UART/VPUCORE clk: imx: imx8qxp: correct the enet clocks for i.MX8DXL clk: imx: imx8qxp: Fix elcdif_pll clock clk: imx: imx8dxl-rsrc: keep sorted in the ascending order clk: imx: imx6sx: Allow a different LCDIF1 clock parent clk: imx: imx8mq: correct error handling path clk: imx8mp: Remove non-existent IMX8MP_CLK_AUDIOMIX_PDM_ROOT clk: imx: imx8: Simplify clk_imx_acm_detach_pm_domains() clk: imx: imx8: Add a message in case of devm_clk_hw_register_mux_parent_data_table() error clk: imx: imx8: Fix an error handling path in imx8_acm_clk_probe() clk: imx: imx8: Fix an error handling path if devm_clk_hw_register_mux_parent_data_table() fails clk: imx: imx8: Fix an error handling path in clk_imx_acm_attach_pm_domains() clk: imx: Select MXC_CLK for CLK_IMX8QXP
2 parents 0bb80ec + 2838820 commit 701d105

File tree

11 files changed

+76
-36
lines changed

11 files changed

+76
-36
lines changed

drivers/clk/imx/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ config CLK_IMX8QXP
9696
depends on (ARCH_MXC && ARM64) || COMPILE_TEST
9797
depends on IMX_SCU && HAVE_ARM_SMCCC
9898
select MXC_CLK_SCU
99+
select MXC_CLK
99100
help
100101
Build the driver for IMX8QXP SCU based clocks.
101102

drivers/clk/imx/clk-imx6sx.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
121121
{
122122
struct device_node *np;
123123
void __iomem *base;
124+
bool lcdif1_assigned_clk;
124125

125126
clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
126127
IMX6SX_CLK_CLK_END), GFP_KERNEL);
@@ -498,9 +499,16 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
498499
clk_set_parent(hws[IMX6SX_CLK_EIM_SLOW_SEL]->clk, hws[IMX6SX_CLK_PLL2_PFD2]->clk);
499500
clk_set_rate(hws[IMX6SX_CLK_EIM_SLOW]->clk, 132000000);
500501

501-
/* set parent clock for LCDIF1 pixel clock */
502-
clk_set_parent(hws[IMX6SX_CLK_LCDIF1_PRE_SEL]->clk, hws[IMX6SX_CLK_PLL5_VIDEO_DIV]->clk);
503-
clk_set_parent(hws[IMX6SX_CLK_LCDIF1_SEL]->clk, hws[IMX6SX_CLK_LCDIF1_PODF]->clk);
502+
np = of_find_node_by_path("/soc/bus@2200000/spba-bus@2240000/lcdif@2220000");
503+
lcdif1_assigned_clk = of_find_property(np, "assigned-clock-parents", NULL);
504+
505+
/* Set parent clock for LCDIF1 pixel clock if not done via devicetree */
506+
if (!lcdif1_assigned_clk) {
507+
clk_set_parent(hws[IMX6SX_CLK_LCDIF1_PRE_SEL]->clk,
508+
hws[IMX6SX_CLK_PLL5_VIDEO_DIV]->clk);
509+
clk_set_parent(hws[IMX6SX_CLK_LCDIF1_SEL]->clk,
510+
hws[IMX6SX_CLK_LCDIF1_PODF]->clk);
511+
}
504512

505513
/* Set the parent clks of PCIe lvds1 and pcie_axi to be pcie ref, axi */
506514
if (clk_set_parent(hws[IMX6SX_CLK_LVDS1_SEL]->clk, hws[IMX6SX_CLK_PCIE_REF_125M]->clk))

drivers/clk/imx/clk-imx8-acm.c

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct imx8_acm_priv {
7777
static const struct clk_parent_data imx8qm_aud_clk_sels[] = {
7878
{ .fw_name = "aud_rec_clk0_lpcg_clk" },
7979
{ .fw_name = "aud_rec_clk1_lpcg_clk" },
80-
{ .fw_name = "mlb_clk" },
80+
{ .fw_name = "dummy" },
8181
{ .fw_name = "hdmi_rx_mclk" },
8282
{ .fw_name = "ext_aud_mclk0" },
8383
{ .fw_name = "ext_aud_mclk1" },
@@ -103,7 +103,7 @@ static const struct clk_parent_data imx8qm_aud_clk_sels[] = {
103103
static const struct clk_parent_data imx8qm_mclk_out_sels[] = {
104104
{ .fw_name = "aud_rec_clk0_lpcg_clk" },
105105
{ .fw_name = "aud_rec_clk1_lpcg_clk" },
106-
{ .fw_name = "mlb_clk" },
106+
{ .fw_name = "dummy" },
107107
{ .fw_name = "hdmi_rx_mclk" },
108108
{ .fw_name = "spdif0_rx" },
109109
{ .fw_name = "spdif1_rx" },
@@ -122,7 +122,7 @@ static const struct clk_parent_data imx8qm_asrc_mux_clk_sels[] = {
122122
{ .fw_name = "sai4_rx_bclk" },
123123
{ .fw_name = "sai5_tx_bclk" },
124124
{ .index = -1 },
125-
{ .fw_name = "mlb_clk" },
125+
{ .fw_name = "dummy" },
126126

127127
};
128128

@@ -279,8 +279,10 @@ static int clk_imx_acm_attach_pm_domains(struct device *dev,
279279

280280
for (i = 0; i < dev_pm->num_domains; i++) {
281281
dev_pm->pd_dev[i] = dev_pm_domain_attach_by_id(dev, i);
282-
if (IS_ERR(dev_pm->pd_dev[i]))
283-
return PTR_ERR(dev_pm->pd_dev[i]);
282+
if (IS_ERR(dev_pm->pd_dev[i])) {
283+
ret = PTR_ERR(dev_pm->pd_dev[i]);
284+
goto detach_pm;
285+
}
284286

285287
dev_pm->pd_dev_link[i] = device_link_add(dev,
286288
dev_pm->pd_dev[i],
@@ -308,20 +310,18 @@ static int clk_imx_acm_attach_pm_domains(struct device *dev,
308310
* @dev: deivice pointer
309311
* @dev_pm: multi power domain for device
310312
*/
311-
static int clk_imx_acm_detach_pm_domains(struct device *dev,
312-
struct clk_imx_acm_pm_domains *dev_pm)
313+
static void clk_imx_acm_detach_pm_domains(struct device *dev,
314+
struct clk_imx_acm_pm_domains *dev_pm)
313315
{
314316
int i;
315317

316318
if (dev_pm->num_domains <= 1)
317-
return 0;
319+
return;
318320

319321
for (i = 0; i < dev_pm->num_domains; i++) {
320322
device_link_del(dev_pm->pd_dev_link[i]);
321323
dev_pm_domain_detach(dev_pm->pd_dev[i], false);
322324
}
323-
324-
return 0;
325325
}
326326

327327
static int imx8_acm_clk_probe(struct platform_device *pdev)
@@ -371,22 +371,25 @@ static int imx8_acm_clk_probe(struct platform_device *pdev)
371371
sels[i].shift, sels[i].width,
372372
0, NULL, NULL);
373373
if (IS_ERR(hws[sels[i].clkid])) {
374-
pm_runtime_disable(&pdev->dev);
374+
ret = PTR_ERR(hws[sels[i].clkid]);
375+
imx_check_clk_hws(hws, IMX_ADMA_ACM_CLK_END);
375376
goto err_clk_register;
376377
}
377378
}
378379

379-
imx_check_clk_hws(hws, IMX_ADMA_ACM_CLK_END);
380-
381380
ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, clk_hw_data);
382381
if (ret < 0) {
383382
dev_err(dev, "failed to register hws for ACM\n");
384-
pm_runtime_disable(&pdev->dev);
383+
goto err_clk_register;
385384
}
386385

387-
err_clk_register:
386+
pm_runtime_put_sync(&pdev->dev);
387+
return 0;
388388

389+
err_clk_register:
389390
pm_runtime_put_sync(&pdev->dev);
391+
pm_runtime_disable(&pdev->dev);
392+
clk_imx_acm_detach_pm_domains(&pdev->dev, &priv->dev_pm);
390393

391394
return ret;
392395
}

drivers/clk/imx/clk-imx8dxl-rsrc.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,10 @@ static u32 imx8dxl_clk_scu_rsrc_table[] = {
4747
IMX_SC_R_SDHC_2,
4848
IMX_SC_R_ENET_0,
4949
IMX_SC_R_ENET_1,
50-
IMX_SC_R_MLB_0,
5150
IMX_SC_R_USB_1,
5251
IMX_SC_R_NAND,
53-
IMX_SC_R_M4_0_I2C,
5452
IMX_SC_R_M4_0_UART,
53+
IMX_SC_R_M4_0_I2C,
5554
IMX_SC_R_ELCDIF_PLL,
5655
IMX_SC_R_AUDIO_PLL_0,
5756
IMX_SC_R_AUDIO_PLL_1,

drivers/clk/imx/clk-imx8mq.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
288288
void __iomem *base;
289289
int err;
290290

291-
clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
292-
IMX8MQ_CLK_END), GFP_KERNEL);
291+
clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, IMX8MQ_CLK_END), GFP_KERNEL);
293292
if (WARN_ON(!clk_hw_data))
294293
return -ENOMEM;
295294

@@ -306,10 +305,12 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
306305
hws[IMX8MQ_CLK_EXT4] = imx_get_clk_hw_by_name(np, "clk_ext4");
307306

308307
np = of_find_compatible_node(NULL, NULL, "fsl,imx8mq-anatop");
309-
base = of_iomap(np, 0);
308+
base = devm_of_iomap(dev, np, 0, NULL);
310309
of_node_put(np);
311-
if (WARN_ON(!base))
312-
return -ENOMEM;
310+
if (WARN_ON(IS_ERR(base))) {
311+
err = PTR_ERR(base);
312+
goto unregister_hws;
313+
}
313314

314315
hws[IMX8MQ_ARM_PLL_REF_SEL] = imx_clk_hw_mux("arm_pll_ref_sel", base + 0x28, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels));
315316
hws[IMX8MQ_GPU_PLL_REF_SEL] = imx_clk_hw_mux("gpu_pll_ref_sel", base + 0x18, 16, 2, pll_ref_sels, ARRAY_SIZE(pll_ref_sels));
@@ -395,8 +396,10 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
395396

396397
np = dev->of_node;
397398
base = devm_platform_ioremap_resource(pdev, 0);
398-
if (WARN_ON(IS_ERR(base)))
399-
return PTR_ERR(base);
399+
if (WARN_ON(IS_ERR(base))) {
400+
err = PTR_ERR(base);
401+
goto unregister_hws;
402+
}
400403

401404
/* CORE */
402405
hws[IMX8MQ_CLK_A53_DIV] = imx8m_clk_hw_composite_core("arm_a53_div", imx8mq_a53_sels, base + 0x8000);

drivers/clk/imx/clk-imx8qm-rsrc.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ static const u32 imx8qm_clk_scu_rsrc_table[] = {
4343
IMX_SC_R_FTM_0,
4444
IMX_SC_R_FTM_1,
4545
IMX_SC_R_CAN_0,
46+
IMX_SC_R_CAN_1,
47+
IMX_SC_R_CAN_2,
4648
IMX_SC_R_GPU_0_PID0,
4749
IMX_SC_R_GPU_1_PID0,
4850
IMX_SC_R_PWM_0,
@@ -65,7 +67,6 @@ static const u32 imx8qm_clk_scu_rsrc_table[] = {
6567
IMX_SC_R_SDHC_2,
6668
IMX_SC_R_ENET_0,
6769
IMX_SC_R_ENET_1,
68-
IMX_SC_R_MLB_0,
6970
IMX_SC_R_USB_2,
7071
IMX_SC_R_NAND,
7172
IMX_SC_R_LVDS_0,
@@ -79,8 +80,6 @@ static const u32 imx8qm_clk_scu_rsrc_table[] = {
7980
IMX_SC_R_M4_0_I2C,
8081
IMX_SC_R_M4_1_I2C,
8182
IMX_SC_R_AUDIO_PLL_0,
82-
IMX_SC_R_VPU_UART,
83-
IMX_SC_R_VPUCORE,
8483
IMX_SC_R_MIPI_0,
8584
IMX_SC_R_MIPI_0_PWM_0,
8685
IMX_SC_R_MIPI_0_I2C_0,

drivers/clk/imx/clk-imx8qxp-lpcg.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#define CONN_ENET_0_LPCG 0x30000
4343
#define CONN_ENET_1_LPCG 0x40000
4444
#define CONN_DTCP_LPCG 0x50000
45-
#define CONN_MLB_LPCG 0x60000
4645
#define CONN_USB_2_LPCG 0x70000
4746
#define CONN_USB_3_LPCG 0x80000
4847
#define CONN_NAND_LPCG 0x90000

drivers/clk/imx/clk-imx8qxp-rsrc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,17 @@ static const u32 imx8qxp_clk_scu_rsrc_table[] = {
5454
IMX_SC_R_SDHC_2,
5555
IMX_SC_R_ENET_0,
5656
IMX_SC_R_ENET_1,
57-
IMX_SC_R_MLB_0,
5857
IMX_SC_R_USB_2,
5958
IMX_SC_R_NAND,
6059
IMX_SC_R_LVDS_0,
6160
IMX_SC_R_LVDS_1,
61+
IMX_SC_R_M4_0_UART,
6262
IMX_SC_R_M4_0_I2C,
6363
IMX_SC_R_ELCDIF_PLL,
6464
IMX_SC_R_AUDIO_PLL_0,
6565
IMX_SC_R_PI_0,
66+
IMX_SC_R_PI_0_PWM_0,
67+
IMX_SC_R_PI_0_I2C_0,
6668
IMX_SC_R_PI_0_PLL,
6769
IMX_SC_R_MIPI_0,
6870
IMX_SC_R_MIPI_0_PWM_0,

drivers/clk/imx/clk-imx8qxp.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ static const char * const pi_pll0_sels[] = {
9090
"clk_dummy",
9191
};
9292

93+
static inline bool clk_on_imx8dxl(struct device_node *node)
94+
{
95+
return of_device_is_compatible(node, "fsl,imx8dxl-clk");
96+
}
97+
9398
static int imx8qxp_clk_probe(struct platform_device *pdev)
9499
{
95100
struct device_node *ccm_node = pdev->dev.of_node;
@@ -147,10 +152,10 @@ static int imx8qxp_clk_probe(struct platform_device *pdev)
147152
imx_clk_scu("adc0_clk", IMX_SC_R_ADC_0, IMX_SC_PM_CLK_PER);
148153
imx_clk_scu("adc1_clk", IMX_SC_R_ADC_1, IMX_SC_PM_CLK_PER);
149154
imx_clk_scu("pwm_clk", IMX_SC_R_LCD_0_PWM_0, IMX_SC_PM_CLK_PER);
155+
imx_clk_scu("elcdif_pll", IMX_SC_R_ELCDIF_PLL, IMX_SC_PM_CLK_PLL);
150156
imx_clk_scu2("lcd_clk", lcd_sels, ARRAY_SIZE(lcd_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_PER);
151157
imx_clk_scu2("lcd_pxl_clk", lcd_pxl_sels, ARRAY_SIZE(lcd_pxl_sels), IMX_SC_R_LCD_0, IMX_SC_PM_CLK_MISC0);
152158
imx_clk_scu("lcd_pxl_bypass_div_clk", IMX_SC_R_LCD_0, IMX_SC_PM_CLK_BYPASS);
153-
imx_clk_scu("elcdif_pll", IMX_SC_R_ELCDIF_PLL, IMX_SC_PM_CLK_PLL);
154159

155160
/* Audio SS */
156161
imx_clk_scu("audio_pll0_clk", IMX_SC_R_AUDIO_PLL_0, IMX_SC_PM_CLK_PLL);
@@ -169,13 +174,15 @@ static int imx8qxp_clk_probe(struct platform_device *pdev)
169174
imx_clk_mux_gpr_scu("enet0_rgmii_txc_sel", enet0_rgmii_txc_sels, ARRAY_SIZE(enet0_rgmii_txc_sels), IMX_SC_R_ENET_0, IMX_SC_C_TXCLK);
170175
imx_clk_scu("enet0_bypass_clk", IMX_SC_R_ENET_0, IMX_SC_PM_CLK_BYPASS);
171176
imx_clk_gate_gpr_scu("enet0_ref_50_clk", "clk_dummy", IMX_SC_R_ENET_0, IMX_SC_C_DISABLE_50, true);
172-
imx_clk_scu("enet0_rgmii_rx_clk", IMX_SC_R_ENET_0, IMX_SC_PM_CLK_MISC0);
177+
if (!clk_on_imx8dxl(ccm_node)) {
178+
imx_clk_scu("enet0_rgmii_rx_clk", IMX_SC_R_ENET_0, IMX_SC_PM_CLK_MISC0);
179+
imx_clk_scu("enet1_rgmii_rx_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_MISC0);
180+
}
173181
imx_clk_scu("enet1_root_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_PER);
174182
imx_clk_divider_gpr_scu("enet1_ref_div", "enet1_root_clk", IMX_SC_R_ENET_1, IMX_SC_C_CLKDIV);
175183
imx_clk_mux_gpr_scu("enet1_rgmii_txc_sel", enet1_rgmii_txc_sels, ARRAY_SIZE(enet1_rgmii_txc_sels), IMX_SC_R_ENET_1, IMX_SC_C_TXCLK);
176184
imx_clk_scu("enet1_bypass_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_BYPASS);
177185
imx_clk_gate_gpr_scu("enet1_ref_50_clk", "clk_dummy", IMX_SC_R_ENET_1, IMX_SC_C_DISABLE_50, true);
178-
imx_clk_scu("enet1_rgmii_rx_clk", IMX_SC_R_ENET_1, IMX_SC_PM_CLK_MISC0);
179186
imx_clk_scu("gpmi_io_clk", IMX_SC_R_NAND, IMX_SC_PM_CLK_MST_BUS);
180187
imx_clk_scu("gpmi_bch_clk", IMX_SC_R_NAND, IMX_SC_PM_CLK_PER);
181188
imx_clk_scu("usb3_aclk_div", IMX_SC_R_USB_2, IMX_SC_PM_CLK_PER);

drivers/clk/imx/clk-scu.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
#include <linux/clk-provider.h>
1111
#include <linux/err.h>
1212
#include <linux/of.h>
13+
#include <linux/firmware/imx/svc/rm.h>
1314
#include <linux/platform_device.h>
1415
#include <linux/pm_domain.h>
1516
#include <linux/pm_runtime.h>
1617
#include <linux/slab.h>
18+
#include <xen/xen.h>
1719

1820
#include "clk-scu.h"
1921

@@ -670,6 +672,18 @@ static int imx_clk_scu_attach_pd(struct device *dev, u32 rsrc_id)
670672
return of_genpd_add_device(&genpdspec, dev);
671673
}
672674

675+
static bool imx_clk_is_resource_owned(u32 rsrc)
676+
{
677+
/*
678+
* A-core resources are special. SCFW reports they are not "owned" by
679+
* current partition but linux can still adjust them for cpufreq.
680+
*/
681+
if (rsrc == IMX_SC_R_A53 || rsrc == IMX_SC_R_A72 || rsrc == IMX_SC_R_A35)
682+
return true;
683+
684+
return imx_sc_rm_is_resource_owned(ccm_ipc_handle, rsrc);
685+
}
686+
673687
struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
674688
const char * const *parents,
675689
int num_parents, u32 rsrc_id, u8 clk_type)
@@ -687,6 +701,9 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
687701
if (!imx_scu_clk_is_valid(rsrc_id))
688702
return ERR_PTR(-EINVAL);
689703

704+
if (!imx_clk_is_resource_owned(rsrc_id))
705+
return NULL;
706+
690707
pdev = platform_device_alloc(name, PLATFORM_DEVID_NONE);
691708
if (!pdev) {
692709
pr_err("%s: failed to allocate scu clk dev rsrc %d type %d\n",
@@ -869,6 +886,9 @@ struct clk_hw *__imx_clk_gpr_scu(const char *name, const char * const *parent_na
869886
return ERR_PTR(-EINVAL);
870887
}
871888

889+
if (!imx_clk_is_resource_owned(rsrc_id))
890+
return NULL;
891+
872892
clk = kzalloc(sizeof(*clk), GFP_KERNEL);
873893
if (!clk) {
874894
kfree(clk_node);

0 commit comments

Comments
 (0)