From: Jesse Taube <mr.bossman075@gmail.com>
To: Stephen Boyd <sboyd@kernel.org>, linux-imx@nxp.com
Cc: robh+dt@kernel.org, mturquette@baylibre.com, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com, aisheng.dong@nxp.com, stefan@agner.ch,
linus.walleij@linaro.org, daniel.lezcano@linaro.org,
tglx@linutronix.de, arnd@arndb.de, olof@lixom.net,
soc@kernel.org, linux@armlinux.org.uk, abel.vesa@nxp.com,
dev@lynxeye.de, marcel.ziswiler@toradex.com,
tharvey@gateworks.com, leoyang.li@nxp.com,
sebastian.reichel@collabora.com, cniedermaier@dh-electronics.com,
clin@suse.com, giulio.benetti@benettiengineering.com,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-gpio@vger.kernel.org
Subject: Re: [PATCH v6 08/10] clk: imx: Add initial support for i.MXRT1170 clock driver
Date: Sat, 1 Oct 2022 12:15:38 -0400 [thread overview]
Message-ID: <663cdebe-755f-3a93-07f4-da662ccb5a43@gmail.com> (raw)
In-Reply-To: <20220930202819.C4952C433D6@smtp.kernel.org>
On 9/30/22 16:28, Stephen Boyd wrote:
> Quoting Jesse Taube (2022-09-01 11:33:41)
>> Add clock driver support for i.MXRT1170.
>>
>> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
>> ---
>> V1 -> V2:
>> - Add slab.h and clock-provider.h
>> - Add spaces in `root_clocks`
>> - Expand and sort macro
>> - Move `clk_hw` structs to `clocks_probe`
>> - Remove of_irq.h
>> - Remove unused code/comments
>> V2 -> V3:
>> - Expand root_clocks names array
>> - Remove root_clock_names enum
>> V3 -> V4:
>> - Nothing done
>> V4 -> V5:
>> - Use __imx_clk_hw_pllv3 to change power bit
>> V5 -> V6:
>> - Nothing done
>> ---
>> drivers/clk/imx/Kconfig | 7 +
>> drivers/clk/imx/Makefile | 1 +
>> drivers/clk/imx/clk-imxrt1170.c | 749 ++++++++++++++++++++++++++++++++
>> 3 files changed, 757 insertions(+)
>> create mode 100644 drivers/clk/imx/clk-imxrt1170.c
>>
>> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
>> index 25785ec9c276..704a7777af4f 100644
>> --- a/drivers/clk/imx/Kconfig
>> +++ b/drivers/clk/imx/Kconfig
>> @@ -119,3 +119,10 @@ config CLK_IMXRT1050
>> select MXC_CLK
>> help
>> Build the driver for i.MXRT1050 CCM Clock Driver
>> +
>> +config CLK_IMXRT1170
>> + tristate "IMXRT1170 CCM Clock Driver"
>> + depends on SOC_IMXRT
>> + select MXC_CLK
>> + help
>> + Build the driver for i.MXRT1170 CCM Clock Driver
>> diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
>> index 88b9b9285d22..d607a6d8138a 100644
>> --- a/drivers/clk/imx/Makefile
>> +++ b/drivers/clk/imx/Makefile
>> @@ -52,4 +52,5 @@ obj-$(CONFIG_CLK_IMX6UL) += clk-imx6ul.o
>> obj-$(CONFIG_CLK_IMX7D) += clk-imx7d.o
>> obj-$(CONFIG_CLK_IMX7ULP) += clk-imx7ulp.o
>> obj-$(CONFIG_CLK_IMXRT1050) += clk-imxrt1050.o
>> +obj-$(CONFIG_CLK_IMXRT1170) += clk-imxrt1170.o
>> obj-$(CONFIG_CLK_VF610) += clk-vf610.o
>> diff --git a/drivers/clk/imx/clk-imxrt1170.c b/drivers/clk/imx/clk-imxrt1170.c
>> new file mode 100644
>> index 000000000000..71d9aacf9751
>> --- /dev/null
>> +++ b/drivers/clk/imx/clk-imxrt1170.c
>> @@ -0,0 +1,749 @@
>> +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
>> +/*
>> + * Copyright (C) 2022
>> + * Author(s):
>> + * Jesse Taube <Mr.Bossman075@gmail.com>
>> + */
>> +#include <linux/clk.h>
>
> Please don't include clk.h unless you use consumer clk APIs. Doesn't
> look like it is used here?
>
>> +#include <linux/of_address.h>
>> +#include <linux/slab.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/platform_device.h>
>
> Sorting alphabetically is nice.
Oh my bad, will fix.
>> +#include <dt-bindings/clock/imxrt1170-clock.h>
>> +
>> +#include "clk.h"
>> +
>> +#define CLOCK_MUX_DEFAULT "rcosc48M_div2", "osc", "rcosc400M", "rcosc16M"
> [...]
>> +
>> +static int imxrt1170_clocks_probe(struct platform_device *pdev)
>> +{
>> + void __iomem *ccm_base;
>> + void __iomem *pll_base;
>> + struct clk_hw **hws;
>> + struct clk_hw_onecell_data *clk_hw_data;
>> + struct device *dev = &pdev->dev;
>> + struct device_node *np = dev->of_node;
>> + struct device_node *anp;
>> + int ret;
>> +
>> + clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
>> + IMXRT1170_CLK_END), GFP_KERNEL);
>> + if (WARN_ON(!clk_hw_data))
>> + return -ENOMEM;
>> +
>> + clk_hw_data->num = IMXRT1170_CLK_END;
>> + hws = clk_hw_data->hws;
>> +
>> + hws[IMXRT1170_CLK_OSC] = imx_obtain_fixed_clk_hw(np, "osc");
>> + hws[IMXRT1170_CLK_RCOSC_16M] = imx_obtain_fixed_clk_hw(np, "rcosc16M");
>> + hws[IMXRT1170_CLK_OSC_32K] = imx_obtain_fixed_clk_hw(np, "osc32k");
>> +
>> + hws[IMXRT1170_CLK_RCOSC_48M] = imx_clk_hw_fixed_factor("rcosc48M", "rcosc16M", 3, 1);
>> + hws[IMXRT1170_CLK_RCOSC_400M] = imx_clk_hw_fixed_factor("rcosc400M", "rcosc16M", 25, 1);
>> + hws[IMXRT1170_CLK_RCOSC_48M_DIV2] = imx_clk_hw_fixed_factor("rcosc48M_div2", "rcosc48M", 1, 2);
>> +
>> + anp = of_find_compatible_node(NULL, NULL, "fsl,imxrt-anatop");
>> + pll_base = of_iomap(anp, 0);
>> + of_node_put(anp);
>> + if (WARN_ON(!pll_base))
>> + return -ENOMEM;
>
> The kzalloc() leaked.
LOL `grep -r of_find_compatible_node drivers/clk/imx`...
Shall I send patches for the rest of IMX.
>
>> +
>> + /* Anatop clocks */
>> + hws[IMXRT1170_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0UL);
>> +
>> + hws[IMXRT1170_CLK_PLL_ARM_PRE] = __imx_clk_hw_pllv3(IMX_PLLV3_SYSV2, "pll_arm_pre", "osc",
>> + pll_base + 0x200, 0xff, 13);
>> + hws[IMXRT1170_CLK_PLL_ARM_BYPASS] = imx_clk_hw_mux("pll_arm_bypass", pll_base + 0x200, 17,
>> + 1, pll_arm_mux, 2);
>> + hws[IMXRT1170_CLK_PLL_ARM_DIV] = clk_hw_register_divider_table(NULL, "pll_arm_div",
>> + "pll_arm_bypass", CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE,
>> + pll_base + 0x200, 15, 2, 0, post_div_table, &imx_ccm_lock);
>> + hws[IMXRT1170_CLK_PLL_ARM] = imx_clk_hw_gate("pll_arm", "pll_arm_div", pll_base + 0x200, 14);
>> +
>> + hws[IMXRT1170_CLK_PLL3_PRE] = __imx_clk_hw_pllv3(IMX_PLLV3_GENERICV2, "pll3_pre", "osc",
>> + pll_base + 0x210, 0x1, 21);
>> + hws[IMXRT1170_CLK_PLL3_BYPASS] = imx_clk_hw_mux("pll3_bypass",
>> + pll_base + 0x210, 16, 1, pll3_mux, 2);
>> + hws[IMXRT1170_CLK_PLL3] = imx_clk_hw_gate("pll3_sys", "pll3_bypass", pll_base + 0x210, 13);
>> +
>> + hws[IMXRT1170_CLK_PLL2_PRE] = __imx_clk_hw_pllv3(IMX_PLLV3_GENERICV2, "pll2_pre", "osc",
>> + pll_base + 0x240, 0x1, 23);
>> + hws[IMXRT1170_CLK_PLL2_BYPASS] = imx_clk_hw_mux("pll2_bypass",
>> + pll_base + 0x240, 16, 1, pll2_mux, 2);
>> + hws[IMXRT1170_CLK_PLL2] = imx_clk_hw_gate("pll2_sys", "pll2_bypass", pll_base + 0x240, 13);
>> +
>> + hws[IMXRT1170_CLK_PLL3_PFD0] = imx_clk_hw_pfd("pll3_pfd0", "pll3_sys", pll_base + 0x230, 0);
>> + hws[IMXRT1170_CLK_PLL3_PFD1] = imx_clk_hw_pfd("pll3_pfd1", "pll3_sys", pll_base + 0x230, 1);
>> + hws[IMXRT1170_CLK_PLL3_PFD2] = imx_clk_hw_pfd("pll3_pfd2", "pll3_sys", pll_base + 0x230, 2);
>> + hws[IMXRT1170_CLK_PLL3_PFD3] = imx_clk_hw_pfd("pll3_pfd3", "pll3_sys", pll_base + 0x230, 3);
>> + hws[IMXRT1170_CLK_PLL3_DIV2_GATE] = imx_clk_hw_fixed_factor("pll3_div2_gate", "pll3_sys", 1, 2);
>> + hws[IMXRT1170_CLK_PLL3_DIV2] = imx_clk_hw_gate("pll3_div2", "pll3_sys", pll_base + 0x210, 3);
>> +
>> + hws[IMXRT1170_CLK_PLL2_PFD0] = imx_clk_hw_pfd("pll2_pfd0", "pll2_sys", pll_base + 0x270, 0);
>> + hws[IMXRT1170_CLK_PLL2_PFD1] = imx_clk_hw_pfd("pll2_pfd1", "pll2_sys", pll_base + 0x270, 1);
>> + hws[IMXRT1170_CLK_PLL2_PFD2] = imx_clk_hw_pfd("pll2_pfd2", "pll2_sys", pll_base + 0x270, 2);
>> + hws[IMXRT1170_CLK_PLL2_PFD3] = imx_clk_hw_pfd("pll2_pfd3", "pll2_sys", pll_base + 0x270, 3);
>> +
>> + /* CCM clocks */
>> + ccm_base = devm_platform_ioremap_resource(pdev, 0);
>> + if (WARN_ON(IS_ERR(ccm_base)))
>> + return PTR_ERR(ccm_base);
>> +
>> + hws[IMXRT1170_CLK_M7_SEL] = imx_clk_hw_mux("m7_sel", ccm_base + (1 * 0x80),
> [....]
>> + hws[IMXRT1170_CLK_CSI2_UI] = imx_clk_hw_divider("csi2_ui", "csi2_ui_gate", ccm_base +
>> + (76 * 0x80), 0, 8);
>> + hws[IMXRT1170_CLK_CSI] = imx_clk_hw_divider("csi", "csi_gate", ccm_base + (77 * 0x80), 0, 8);
>> + hws[IMXRT1170_CLK_CKO1] = imx_clk_hw_divider("cko1", "cko1_gate", ccm_base + (78 * 0x80), 0, 8);
>> + hws[IMXRT1170_CLK_CKO2] = imx_clk_hw_divider("cko2", "cko2_gate", ccm_base + (79 * 0x80), 0, 8);
>> +
>> + hws[IMXRT1170_CLK_USB] = imx_clk_hw_gate("usb", "bus", ccm_base + LPCG_GATE(115), 0);
>> +
>> + imx_check_clk_hws(hws, IMXRT1170_CLK_END);
>> +
>> + ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
>
> Use devm? Or implement a driver remove function?
Uh this is the same in the rest of imx could you explain a bit more?
Very sorry for the low quality code :(
Thanks,
Jesse Taube
>> + if (ret < 0) {
>> + dev_err(dev, "Failed to register clks for i.MXRT1170.\n");
>> + imx_unregister_hw_clocks(hws, IMXRT1170_CLK_END);
>> + }
>> + return ret;
>> +}
>> +
>> +static const struct of_device_id imxrt1170_clk_of_match[] = {
>> + { .compatible = "fsl,imxrt1170-ccm" },
>> + { /* Sentinel */ }
>> +};
>> +MODULE_DEVICE_TABLE(of, imxrt1170_clk_of_match);
>> +
>> +static struct platform_driver imxrt1170_clk_driver = {
>> + .probe = imxrt1170_clocks_probe,
>> + .driver = {
>> + .name = "imxrt1170-ccm",
>> + .of_match_table = imxrt1170_clk_of_match,
>> + },
WARNING: multiple messages have this Message-ID (diff)
From: Jesse Taube <mr.bossman075@gmail.com>
To: Stephen Boyd <sboyd@kernel.org>, linux-imx@nxp.com
Cc: robh+dt@kernel.org, mturquette@baylibre.com, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de,
festevam@gmail.com, aisheng.dong@nxp.com, stefan@agner.ch,
linus.walleij@linaro.org, daniel.lezcano@linaro.org,
tglx@linutronix.de, arnd@arndb.de, olof@lixom.net,
soc@kernel.org, linux@armlinux.org.uk, abel.vesa@nxp.com,
dev@lynxeye.de, marcel.ziswiler@toradex.com,
tharvey@gateworks.com, leoyang.li@nxp.com,
sebastian.reichel@collabora.com, cniedermaier@dh-electronics.com,
clin@suse.com, giulio.benetti@benettiengineering.com,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-gpio@vger.kernel.org
Subject: Re: [PATCH v6 08/10] clk: imx: Add initial support for i.MXRT1170 clock driver
Date: Sat, 1 Oct 2022 12:15:38 -0400 [thread overview]
Message-ID: <663cdebe-755f-3a93-07f4-da662ccb5a43@gmail.com> (raw)
In-Reply-To: <20220930202819.C4952C433D6@smtp.kernel.org>
On 9/30/22 16:28, Stephen Boyd wrote:
> Quoting Jesse Taube (2022-09-01 11:33:41)
>> Add clock driver support for i.MXRT1170.
>>
>> Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
>> ---
>> V1 -> V2:
>> - Add slab.h and clock-provider.h
>> - Add spaces in `root_clocks`
>> - Expand and sort macro
>> - Move `clk_hw` structs to `clocks_probe`
>> - Remove of_irq.h
>> - Remove unused code/comments
>> V2 -> V3:
>> - Expand root_clocks names array
>> - Remove root_clock_names enum
>> V3 -> V4:
>> - Nothing done
>> V4 -> V5:
>> - Use __imx_clk_hw_pllv3 to change power bit
>> V5 -> V6:
>> - Nothing done
>> ---
>> drivers/clk/imx/Kconfig | 7 +
>> drivers/clk/imx/Makefile | 1 +
>> drivers/clk/imx/clk-imxrt1170.c | 749 ++++++++++++++++++++++++++++++++
>> 3 files changed, 757 insertions(+)
>> create mode 100644 drivers/clk/imx/clk-imxrt1170.c
>>
>> diff --git a/drivers/clk/imx/Kconfig b/drivers/clk/imx/Kconfig
>> index 25785ec9c276..704a7777af4f 100644
>> --- a/drivers/clk/imx/Kconfig
>> +++ b/drivers/clk/imx/Kconfig
>> @@ -119,3 +119,10 @@ config CLK_IMXRT1050
>> select MXC_CLK
>> help
>> Build the driver for i.MXRT1050 CCM Clock Driver
>> +
>> +config CLK_IMXRT1170
>> + tristate "IMXRT1170 CCM Clock Driver"
>> + depends on SOC_IMXRT
>> + select MXC_CLK
>> + help
>> + Build the driver for i.MXRT1170 CCM Clock Driver
>> diff --git a/drivers/clk/imx/Makefile b/drivers/clk/imx/Makefile
>> index 88b9b9285d22..d607a6d8138a 100644
>> --- a/drivers/clk/imx/Makefile
>> +++ b/drivers/clk/imx/Makefile
>> @@ -52,4 +52,5 @@ obj-$(CONFIG_CLK_IMX6UL) += clk-imx6ul.o
>> obj-$(CONFIG_CLK_IMX7D) += clk-imx7d.o
>> obj-$(CONFIG_CLK_IMX7ULP) += clk-imx7ulp.o
>> obj-$(CONFIG_CLK_IMXRT1050) += clk-imxrt1050.o
>> +obj-$(CONFIG_CLK_IMXRT1170) += clk-imxrt1170.o
>> obj-$(CONFIG_CLK_VF610) += clk-vf610.o
>> diff --git a/drivers/clk/imx/clk-imxrt1170.c b/drivers/clk/imx/clk-imxrt1170.c
>> new file mode 100644
>> index 000000000000..71d9aacf9751
>> --- /dev/null
>> +++ b/drivers/clk/imx/clk-imxrt1170.c
>> @@ -0,0 +1,749 @@
>> +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
>> +/*
>> + * Copyright (C) 2022
>> + * Author(s):
>> + * Jesse Taube <Mr.Bossman075@gmail.com>
>> + */
>> +#include <linux/clk.h>
>
> Please don't include clk.h unless you use consumer clk APIs. Doesn't
> look like it is used here?
>
>> +#include <linux/of_address.h>
>> +#include <linux/slab.h>
>> +#include <linux/clk-provider.h>
>> +#include <linux/platform_device.h>
>
> Sorting alphabetically is nice.
Oh my bad, will fix.
>> +#include <dt-bindings/clock/imxrt1170-clock.h>
>> +
>> +#include "clk.h"
>> +
>> +#define CLOCK_MUX_DEFAULT "rcosc48M_div2", "osc", "rcosc400M", "rcosc16M"
> [...]
>> +
>> +static int imxrt1170_clocks_probe(struct platform_device *pdev)
>> +{
>> + void __iomem *ccm_base;
>> + void __iomem *pll_base;
>> + struct clk_hw **hws;
>> + struct clk_hw_onecell_data *clk_hw_data;
>> + struct device *dev = &pdev->dev;
>> + struct device_node *np = dev->of_node;
>> + struct device_node *anp;
>> + int ret;
>> +
>> + clk_hw_data = kzalloc(struct_size(clk_hw_data, hws,
>> + IMXRT1170_CLK_END), GFP_KERNEL);
>> + if (WARN_ON(!clk_hw_data))
>> + return -ENOMEM;
>> +
>> + clk_hw_data->num = IMXRT1170_CLK_END;
>> + hws = clk_hw_data->hws;
>> +
>> + hws[IMXRT1170_CLK_OSC] = imx_obtain_fixed_clk_hw(np, "osc");
>> + hws[IMXRT1170_CLK_RCOSC_16M] = imx_obtain_fixed_clk_hw(np, "rcosc16M");
>> + hws[IMXRT1170_CLK_OSC_32K] = imx_obtain_fixed_clk_hw(np, "osc32k");
>> +
>> + hws[IMXRT1170_CLK_RCOSC_48M] = imx_clk_hw_fixed_factor("rcosc48M", "rcosc16M", 3, 1);
>> + hws[IMXRT1170_CLK_RCOSC_400M] = imx_clk_hw_fixed_factor("rcosc400M", "rcosc16M", 25, 1);
>> + hws[IMXRT1170_CLK_RCOSC_48M_DIV2] = imx_clk_hw_fixed_factor("rcosc48M_div2", "rcosc48M", 1, 2);
>> +
>> + anp = of_find_compatible_node(NULL, NULL, "fsl,imxrt-anatop");
>> + pll_base = of_iomap(anp, 0);
>> + of_node_put(anp);
>> + if (WARN_ON(!pll_base))
>> + return -ENOMEM;
>
> The kzalloc() leaked.
LOL `grep -r of_find_compatible_node drivers/clk/imx`...
Shall I send patches for the rest of IMX.
>
>> +
>> + /* Anatop clocks */
>> + hws[IMXRT1170_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0UL);
>> +
>> + hws[IMXRT1170_CLK_PLL_ARM_PRE] = __imx_clk_hw_pllv3(IMX_PLLV3_SYSV2, "pll_arm_pre", "osc",
>> + pll_base + 0x200, 0xff, 13);
>> + hws[IMXRT1170_CLK_PLL_ARM_BYPASS] = imx_clk_hw_mux("pll_arm_bypass", pll_base + 0x200, 17,
>> + 1, pll_arm_mux, 2);
>> + hws[IMXRT1170_CLK_PLL_ARM_DIV] = clk_hw_register_divider_table(NULL, "pll_arm_div",
>> + "pll_arm_bypass", CLK_SET_RATE_PARENT | CLK_SET_RATE_GATE,
>> + pll_base + 0x200, 15, 2, 0, post_div_table, &imx_ccm_lock);
>> + hws[IMXRT1170_CLK_PLL_ARM] = imx_clk_hw_gate("pll_arm", "pll_arm_div", pll_base + 0x200, 14);
>> +
>> + hws[IMXRT1170_CLK_PLL3_PRE] = __imx_clk_hw_pllv3(IMX_PLLV3_GENERICV2, "pll3_pre", "osc",
>> + pll_base + 0x210, 0x1, 21);
>> + hws[IMXRT1170_CLK_PLL3_BYPASS] = imx_clk_hw_mux("pll3_bypass",
>> + pll_base + 0x210, 16, 1, pll3_mux, 2);
>> + hws[IMXRT1170_CLK_PLL3] = imx_clk_hw_gate("pll3_sys", "pll3_bypass", pll_base + 0x210, 13);
>> +
>> + hws[IMXRT1170_CLK_PLL2_PRE] = __imx_clk_hw_pllv3(IMX_PLLV3_GENERICV2, "pll2_pre", "osc",
>> + pll_base + 0x240, 0x1, 23);
>> + hws[IMXRT1170_CLK_PLL2_BYPASS] = imx_clk_hw_mux("pll2_bypass",
>> + pll_base + 0x240, 16, 1, pll2_mux, 2);
>> + hws[IMXRT1170_CLK_PLL2] = imx_clk_hw_gate("pll2_sys", "pll2_bypass", pll_base + 0x240, 13);
>> +
>> + hws[IMXRT1170_CLK_PLL3_PFD0] = imx_clk_hw_pfd("pll3_pfd0", "pll3_sys", pll_base + 0x230, 0);
>> + hws[IMXRT1170_CLK_PLL3_PFD1] = imx_clk_hw_pfd("pll3_pfd1", "pll3_sys", pll_base + 0x230, 1);
>> + hws[IMXRT1170_CLK_PLL3_PFD2] = imx_clk_hw_pfd("pll3_pfd2", "pll3_sys", pll_base + 0x230, 2);
>> + hws[IMXRT1170_CLK_PLL3_PFD3] = imx_clk_hw_pfd("pll3_pfd3", "pll3_sys", pll_base + 0x230, 3);
>> + hws[IMXRT1170_CLK_PLL3_DIV2_GATE] = imx_clk_hw_fixed_factor("pll3_div2_gate", "pll3_sys", 1, 2);
>> + hws[IMXRT1170_CLK_PLL3_DIV2] = imx_clk_hw_gate("pll3_div2", "pll3_sys", pll_base + 0x210, 3);
>> +
>> + hws[IMXRT1170_CLK_PLL2_PFD0] = imx_clk_hw_pfd("pll2_pfd0", "pll2_sys", pll_base + 0x270, 0);
>> + hws[IMXRT1170_CLK_PLL2_PFD1] = imx_clk_hw_pfd("pll2_pfd1", "pll2_sys", pll_base + 0x270, 1);
>> + hws[IMXRT1170_CLK_PLL2_PFD2] = imx_clk_hw_pfd("pll2_pfd2", "pll2_sys", pll_base + 0x270, 2);
>> + hws[IMXRT1170_CLK_PLL2_PFD3] = imx_clk_hw_pfd("pll2_pfd3", "pll2_sys", pll_base + 0x270, 3);
>> +
>> + /* CCM clocks */
>> + ccm_base = devm_platform_ioremap_resource(pdev, 0);
>> + if (WARN_ON(IS_ERR(ccm_base)))
>> + return PTR_ERR(ccm_base);
>> +
>> + hws[IMXRT1170_CLK_M7_SEL] = imx_clk_hw_mux("m7_sel", ccm_base + (1 * 0x80),
> [....]
>> + hws[IMXRT1170_CLK_CSI2_UI] = imx_clk_hw_divider("csi2_ui", "csi2_ui_gate", ccm_base +
>> + (76 * 0x80), 0, 8);
>> + hws[IMXRT1170_CLK_CSI] = imx_clk_hw_divider("csi", "csi_gate", ccm_base + (77 * 0x80), 0, 8);
>> + hws[IMXRT1170_CLK_CKO1] = imx_clk_hw_divider("cko1", "cko1_gate", ccm_base + (78 * 0x80), 0, 8);
>> + hws[IMXRT1170_CLK_CKO2] = imx_clk_hw_divider("cko2", "cko2_gate", ccm_base + (79 * 0x80), 0, 8);
>> +
>> + hws[IMXRT1170_CLK_USB] = imx_clk_hw_gate("usb", "bus", ccm_base + LPCG_GATE(115), 0);
>> +
>> + imx_check_clk_hws(hws, IMXRT1170_CLK_END);
>> +
>> + ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
>
> Use devm? Or implement a driver remove function?
Uh this is the same in the rest of imx could you explain a bit more?
Very sorry for the low quality code :(
Thanks,
Jesse Taube
>> + if (ret < 0) {
>> + dev_err(dev, "Failed to register clks for i.MXRT1170.\n");
>> + imx_unregister_hw_clocks(hws, IMXRT1170_CLK_END);
>> + }
>> + return ret;
>> +}
>> +
>> +static const struct of_device_id imxrt1170_clk_of_match[] = {
>> + { .compatible = "fsl,imxrt1170-ccm" },
>> + { /* Sentinel */ }
>> +};
>> +MODULE_DEVICE_TABLE(of, imxrt1170_clk_of_match);
>> +
>> +static struct platform_driver imxrt1170_clk_driver = {
>> + .probe = imxrt1170_clocks_probe,
>> + .driver = {
>> + .name = "imxrt1170-ccm",
>> + .of_match_table = imxrt1170_clk_of_match,
>> + },
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-10-01 16:15 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 18:33 [PATCH v6 00/10] Add support for i.MXRT1170-evk Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-01 18:33 ` [PATCH v6 01/10] dt-bindings: arm: imx: Add i.MXRT compatible Documentation Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-01 18:33 ` [PATCH v6 02/10] dt-bindings: timer: gpt: " Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-01 18:33 ` [PATCH v6 03/10] dt-bindings: mmc: fsl-imx-esdhc: add i.MXRT1170 compatible Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-01 18:33 ` [PATCH v6 04/10] dt-bindings: serial: fsl-lpuart: " Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-01 18:33 ` [PATCH v6 05/10] ARM: mach-imx: Add support for i.MXRT1170 Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-01 18:33 ` [PATCH v6 06/10] clk: imx: Update pllv3 to support i.MXRT1170 Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-02 4:58 ` kernel test robot
2022-09-01 18:33 ` [PATCH v6 07/10] dt-bindings: imx: Add clock binding for i.MXRT1170 Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-01 18:33 ` [PATCH v6 08/10] clk: imx: Add initial support for i.MXRT1170 clock driver Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-30 20:28 ` Stephen Boyd
2022-09-30 20:28 ` Stephen Boyd
2022-10-01 16:15 ` Jesse Taube [this message]
2022-10-01 16:15 ` Jesse Taube
2022-10-03 19:29 ` Stephen Boyd
2022-10-03 19:29 ` Stephen Boyd
2022-09-01 18:33 ` [PATCH v6 09/10] ARM: dts: imx: Add i.MXRT1170-EVK support Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-01 18:33 ` [PATCH v6 10/10] ARM: imxrt_defconfig: Add i.MXRT1170 Jesse Taube
2022-09-01 18:33 ` Jesse Taube
2022-09-02 8:06 ` [PATCH v6 00/10] Add support for i.MXRT1170-evk Linus Walleij
2022-09-02 8:06 ` Linus Walleij
2022-09-02 12:56 ` Jesse Taube
2022-09-02 12:56 ` Jesse Taube
2022-09-02 13:26 ` Linus Walleij
2022-09-02 13:26 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=663cdebe-755f-3a93-07f4-da662ccb5a43@gmail.com \
--to=mr.bossman075@gmail.com \
--cc=abel.vesa@nxp.com \
--cc=aisheng.dong@nxp.com \
--cc=arnd@arndb.de \
--cc=clin@suse.com \
--cc=cniedermaier@dh-electronics.com \
--cc=daniel.lezcano@linaro.org \
--cc=dev@lynxeye.de \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=giulio.benetti@benettiengineering.com \
--cc=kernel@pengutronix.de \
--cc=leoyang.li@nxp.com \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=marcel.ziswiler@toradex.com \
--cc=mturquette@baylibre.com \
--cc=olof@lixom.net \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sboyd@kernel.org \
--cc=sebastian.reichel@collabora.com \
--cc=shawnguo@kernel.org \
--cc=soc@kernel.org \
--cc=stefan@agner.ch \
--cc=tglx@linutronix.de \
--cc=tharvey@gateworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.