i.MX clocks changes for 6.3
- Free the imx_uart_clocks even if imx_register_uart_clocks returns early. - Get the stdout clocks count from device tree. - Drop the clock count argument from imx_register_uart_clocks. - Keep the uart clocks on i.MX93 for when earlycon is used. - Fix SPDX comment in i.MX6SLL clocks bindings header. - Drop some unnecessary spaces from i.MX8ULP clocks bindings header. - Add a new clk-gpr-mux clock type and use it on i.MX6Q to add ENET ref clocks. - Add the imx_obtain_fixed_of_clock for allowing to add a clock that is not configured via devicetree. - Fix the ENET1 gate configuration for i.MX6UL according to the reference manual. - Add ENET refclock mux support for i.MX6UL. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEdRlgxHYCb3ovKt456LNSLBEEo7YFAmPc3zgACgkQ6LNSLBEE o7bKpg/8DZ6icvnAcV9PnjXnUIXfDxoXaBykblnqi6mK3NrU1FTI7UhYNYcv2xYx qG9jOJSk81/KIIXhql4seSYuP69bMLhNPcJQE5J5SnWMJfNDDlpcIKdLcHoaUNuT UjG6KRKiyIxoGZjrMVx8WSus0H6BiAt+mWGVjZ6KKAhEVs+wqjckJKQXPpgLZSS3 F1eISymvbUJlDjJTEJW/0Sl2V1YdyEC2YsWDv4J4S6Ip777AxmKzHTMWTJXwBqwq +6WxQlbkfpBz9ZUU1pLJF2P+Z+N/FmstELSSrudHUg2H0aI2JGEwcyObq/UtOBA4 JZZVdHtXO2ECw5oBnvxcSU/GJZ8t54QBnU36hRFig8B8AjU5AzXKf9ypV7Eo5dPO 5RNSN5PHCdDssUqVxpHgm1BqwWtXSrtkLddRut+oc65Pi1yvODSNqk9jTUsYABM/ fCX1pColo69uZ5UXsNV76OLxtPAOt+jDNqKCE8fdsPHAZzGqyKlmyb6u3B5xYQOf sO1RoABmu0SGbduPmVTQWEUhISpoLMryWB9xvBGmfiZtOMVhrLicU6SYC5q3HDKa uJh36P9j7/+ryWJTqwJKKaQioiGqY5NlgT9iD0HGeXh60U5rD6+BzKZqrqpMfDci zJh9RQWdbZuwlXfLLxTzCPbHGtwRtGRCVTl9JB4MVqiQS07bv78= =hRLd -----END PGP SIGNATURE----- Merge tag 'clk-imx-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux into clk-imx Pull i.MX clk driver updates from Abel Vesa: - Free the imx_uart_clocks even if imx_register_uart_clocks returns early - Get the stdout clocks count from device tree - Drop the clock count argument from imx_register_uart_clocks. - Keep the uart clocks on i.MX93 for when earlycon is used - Fix SPDX comment in i.MX6SLL clocks bindings header - Drop some unnecessary spaces from i.MX8ULP clocks bindings header - Add a new clk-gpr-mux clock type and use it on i.MX6Q to add ENET ref clocks - Add the imx_obtain_fixed_of_clock for allowing to add a clock that is not configured via devicetree - Fix the ENET1 gate configuration for i.MX6UL according to the reference manual - Add ENET refclock mux support for i.MX6UL * tag 'clk-imx-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux: clk: imx6ul: add ethernet refclock mux support clk: imx6ul: fix enet1 gate configuration clk: imx: add imx_obtain_fixed_of_clock() clk: imx6q: add ethernet refclock mux support clk: imx: add clk-gpr-mux driver dt-bindings: imx8ulp: clock: no spaces before tabs clk: imx6sll: add proper spdx license identifier clk: imx: imx93: invoke imx_register_uart_clocks clk: imx: remove clk_count of imx_register_uart_clocks clk: imx: get stdout clk count from device tree clk: imx: avoid memory leak
This commit is contained in:
commit
dede211f23
@ -22,6 +22,7 @@ mxc-clk-objs += clk-pllv3.o
|
||||
mxc-clk-objs += clk-pllv4.o
|
||||
mxc-clk-objs += clk-pll14xx.o
|
||||
mxc-clk-objs += clk-sscg-pll.o
|
||||
mxc-clk-objs += clk-gpr-mux.o
|
||||
obj-$(CONFIG_MXC_CLK) += mxc-clk.o
|
||||
|
||||
obj-$(CONFIG_CLK_IMX8MM) += clk-imx8mm.o
|
||||
|
119
drivers/clk/imx/clk-gpr-mux.c
Normal file
119
drivers/clk/imx/clk-gpr-mux.c
Normal file
@ -0,0 +1,119 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) "imx:clk-gpr-mux: " fmt
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
|
||||
#include "clk.h"
|
||||
|
||||
struct imx_clk_gpr {
|
||||
struct clk_hw hw;
|
||||
struct regmap *regmap;
|
||||
u32 mask;
|
||||
u32 reg;
|
||||
const u32 *mux_table;
|
||||
};
|
||||
|
||||
static struct imx_clk_gpr *to_imx_clk_gpr(struct clk_hw *hw)
|
||||
{
|
||||
return container_of(hw, struct imx_clk_gpr, hw);
|
||||
}
|
||||
|
||||
static u8 imx_clk_gpr_mux_get_parent(struct clk_hw *hw)
|
||||
{
|
||||
struct imx_clk_gpr *priv = to_imx_clk_gpr(hw);
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
ret = regmap_read(priv->regmap, priv->reg, &val);
|
||||
if (ret)
|
||||
goto get_parent_err;
|
||||
|
||||
val &= priv->mask;
|
||||
|
||||
ret = clk_mux_val_to_index(hw, priv->mux_table, 0, val);
|
||||
if (ret < 0)
|
||||
goto get_parent_err;
|
||||
|
||||
return ret;
|
||||
|
||||
get_parent_err:
|
||||
pr_err("failed to get parent (%pe)\n", ERR_PTR(ret));
|
||||
|
||||
/* return some realistic non negative value. Potentially we could
|
||||
* give index to some dummy error parent.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int imx_clk_gpr_mux_set_parent(struct clk_hw *hw, u8 index)
|
||||
{
|
||||
struct imx_clk_gpr *priv = to_imx_clk_gpr(hw);
|
||||
unsigned int val = clk_mux_index_to_val(priv->mux_table, 0, index);
|
||||
|
||||
return regmap_update_bits(priv->regmap, priv->reg, priv->mask, val);
|
||||
}
|
||||
|
||||
static int imx_clk_gpr_mux_determine_rate(struct clk_hw *hw,
|
||||
struct clk_rate_request *req)
|
||||
{
|
||||
return clk_mux_determine_rate_flags(hw, req, 0);
|
||||
}
|
||||
|
||||
const struct clk_ops imx_clk_gpr_mux_ops = {
|
||||
.get_parent = imx_clk_gpr_mux_get_parent,
|
||||
.set_parent = imx_clk_gpr_mux_set_parent,
|
||||
.determine_rate = imx_clk_gpr_mux_determine_rate,
|
||||
};
|
||||
|
||||
struct clk_hw *imx_clk_gpr_mux(const char *name, const char *compatible,
|
||||
u32 reg, const char **parent_names,
|
||||
u8 num_parents, const u32 *mux_table, u32 mask)
|
||||
{
|
||||
struct clk_init_data init = { };
|
||||
struct imx_clk_gpr *priv;
|
||||
struct regmap *regmap;
|
||||
struct clk_hw *hw;
|
||||
int ret;
|
||||
|
||||
regmap = syscon_regmap_lookup_by_compatible(compatible);
|
||||
if (IS_ERR(regmap)) {
|
||||
pr_err("failed to find %s regmap\n", compatible);
|
||||
return ERR_CAST(regmap);
|
||||
}
|
||||
|
||||
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
init.name = name;
|
||||
init.ops = &imx_clk_gpr_mux_ops;
|
||||
init.parent_names = parent_names;
|
||||
init.num_parents = num_parents;
|
||||
init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE;
|
||||
|
||||
priv->hw.init = &init;
|
||||
priv->regmap = regmap;
|
||||
priv->mux_table = mux_table;
|
||||
priv->reg = reg;
|
||||
priv->mask = mask;
|
||||
|
||||
hw = &priv->hw;
|
||||
ret = clk_hw_register(NULL, &priv->hw);
|
||||
if (ret) {
|
||||
kfree(priv);
|
||||
hw = ERR_PTR(ret);
|
||||
}
|
||||
|
||||
return hw;
|
||||
}
|
@ -218,7 +218,7 @@ static int __init __mx25_clocks_init(void __iomem *ccm_base)
|
||||
*/
|
||||
clk_set_parent(clk[cko_sel], clk[ipg]);
|
||||
|
||||
imx_register_uart_clocks(6);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ static void __init _mx27_clocks_init(unsigned long fref)
|
||||
|
||||
clk_prepare_enable(clk[IMX27_CLK_EMI_AHB_GATE]);
|
||||
|
||||
imx_register_uart_clocks(7);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
imx_print_silicon_rev("i.MX27", mx27_revision());
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ static void __init _mx35_clocks_init(void)
|
||||
*/
|
||||
clk_prepare_enable(clk[scc_gate]);
|
||||
|
||||
imx_register_uart_clocks(4);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
imx_print_silicon_rev("i.MX35", mx35_revision());
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ static void __init mx50_clocks_init(struct device_node *np)
|
||||
r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
|
||||
clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
|
||||
|
||||
imx_register_uart_clocks(5);
|
||||
imx_register_uart_clocks();
|
||||
}
|
||||
CLK_OF_DECLARE(imx50_ccm, "fsl,imx50-ccm", mx50_clocks_init);
|
||||
|
||||
@ -464,7 +464,7 @@ static void __init mx51_clocks_init(struct device_node *np)
|
||||
val |= 1 << 23;
|
||||
writel(val, MXC_CCM_CLPCR);
|
||||
|
||||
imx_register_uart_clocks(3);
|
||||
imx_register_uart_clocks();
|
||||
}
|
||||
CLK_OF_DECLARE(imx51_ccm, "fsl,imx51-ccm", mx51_clocks_init);
|
||||
|
||||
@ -609,6 +609,6 @@ static void __init mx53_clocks_init(struct device_node *np)
|
||||
r = clk_round_rate(clk[IMX5_CLK_USBOH3_PER_GATE], 54000000);
|
||||
clk_set_rate(clk[IMX5_CLK_USBOH3_PER_GATE], r);
|
||||
|
||||
imx_register_uart_clocks(5);
|
||||
imx_register_uart_clocks();
|
||||
}
|
||||
CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init);
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
@ -115,6 +116,10 @@ static struct clk_div_table video_div_table[] = {
|
||||
{ /* sentinel */ }
|
||||
};
|
||||
|
||||
static const char * enet_ref_sels[] = { "enet_ref", "enet_ref_pad", };
|
||||
static const u32 enet_ref_sels_table[] = { IMX6Q_GPR1_ENET_CLK_SEL_ANATOP, IMX6Q_GPR1_ENET_CLK_SEL_PAD };
|
||||
static const u32 enet_ref_sels_table_mask = IMX6Q_GPR1_ENET_CLK_SEL_ANATOP;
|
||||
|
||||
static unsigned int share_count_esai;
|
||||
static unsigned int share_count_asrc;
|
||||
static unsigned int share_count_ssi1;
|
||||
@ -908,6 +913,12 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
|
||||
if (clk_on_imx6q() && imx_get_soc_revision() == IMX_CHIP_REVISION_1_0)
|
||||
hws[IMX6QDL_CLK_GPT_3M] = hws[IMX6QDL_CLK_GPT_IPG_PER];
|
||||
|
||||
hws[IMX6QDL_CLK_ENET_REF_PAD] = imx6q_obtain_fixed_clk_hw(ccm_node, "enet_ref_pad", 0);
|
||||
|
||||
hws[IMX6QDL_CLK_ENET_REF_SEL] = imx_clk_gpr_mux("enet_ref_sel", "fsl,imx6q-iomuxc-gpr",
|
||||
IOMUXC_GPR1, enet_ref_sels, ARRAY_SIZE(enet_ref_sels),
|
||||
enet_ref_sels_table, enet_ref_sels_table_mask);
|
||||
|
||||
imx_check_clk_hws(hws, IMX6QDL_CLK_END);
|
||||
|
||||
of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
|
||||
@ -974,6 +985,8 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node)
|
||||
hws[IMX6QDL_CLK_PLL3_USB_OTG]->clk);
|
||||
}
|
||||
|
||||
imx_register_uart_clocks(2);
|
||||
clk_set_parent(hws[IMX6QDL_CLK_ENET_REF_SEL]->clk, hws[IMX6QDL_CLK_ENET_REF]->clk);
|
||||
|
||||
imx_register_uart_clocks();
|
||||
}
|
||||
CLK_OF_DECLARE(imx6q, "fsl,imx6q-ccm", imx6q_clocks_init);
|
||||
|
@ -440,6 +440,6 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
|
||||
clk_set_parent(hws[IMX6SL_CLK_LCDIF_AXI_SEL]->clk,
|
||||
hws[IMX6SL_CLK_PLL2_PFD2]->clk);
|
||||
|
||||
imx_register_uart_clocks(2);
|
||||
imx_register_uart_clocks();
|
||||
}
|
||||
CLK_OF_DECLARE(imx6sl, "fsl,imx6sl-ccm", imx6sl_clocks_init);
|
||||
|
@ -340,7 +340,7 @@ static void __init imx6sll_clocks_init(struct device_node *ccm_node)
|
||||
|
||||
of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
|
||||
|
||||
imx_register_uart_clocks(5);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
/* Lower the AHB clock rate before changing the clock source. */
|
||||
clk_set_rate(hws[IMX6SLL_CLK_AHB]->clk, 99000000);
|
||||
|
@ -548,6 +548,6 @@ static void __init imx6sx_clocks_init(struct device_node *ccm_node)
|
||||
clk_set_parent(hws[IMX6SX_CLK_QSPI1_SEL]->clk, hws[IMX6SX_CLK_PLL2_BUS]->clk);
|
||||
clk_set_parent(hws[IMX6SX_CLK_QSPI2_SEL]->clk, hws[IMX6SX_CLK_PLL2_BUS]->clk);
|
||||
|
||||
imx_register_uart_clocks(2);
|
||||
imx_register_uart_clocks();
|
||||
}
|
||||
CLK_OF_DECLARE(imx6sx, "fsl,imx6sx-ccm", imx6sx_clocks_init);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/mfd/syscon/imx6q-iomuxc-gpr.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/of_irq.h>
|
||||
@ -94,6 +95,17 @@ static const struct clk_div_table video_div_table[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
static const char * enet1_ref_sels[] = { "enet1_ref_125m", "enet1_ref_pad", };
|
||||
static const u32 enet1_ref_sels_table[] = { IMX6UL_GPR1_ENET1_TX_CLK_DIR,
|
||||
IMX6UL_GPR1_ENET1_CLK_SEL };
|
||||
static const u32 enet1_ref_sels_table_mask = IMX6UL_GPR1_ENET1_TX_CLK_DIR |
|
||||
IMX6UL_GPR1_ENET1_CLK_SEL;
|
||||
static const char * enet2_ref_sels[] = { "enet2_ref_125m", "enet2_ref_pad", };
|
||||
static const u32 enet2_ref_sels_table[] = { IMX6UL_GPR1_ENET2_TX_CLK_DIR,
|
||||
IMX6UL_GPR1_ENET2_CLK_SEL };
|
||||
static const u32 enet2_ref_sels_table_mask = IMX6UL_GPR1_ENET2_TX_CLK_DIR |
|
||||
IMX6UL_GPR1_ENET2_CLK_SEL;
|
||||
|
||||
static u32 share_count_asrc;
|
||||
static u32 share_count_audio;
|
||||
static u32 share_count_sai1;
|
||||
@ -176,7 +188,7 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
|
||||
hws[IMX6UL_CLK_PLL3_USB_OTG] = imx_clk_hw_gate("pll3_usb_otg", "pll3_bypass", base + 0x10, 13);
|
||||
hws[IMX6UL_CLK_PLL4_AUDIO] = imx_clk_hw_gate("pll4_audio", "pll4_bypass", base + 0x70, 13);
|
||||
hws[IMX6UL_CLK_PLL5_VIDEO] = imx_clk_hw_gate("pll5_video", "pll5_bypass", base + 0xa0, 13);
|
||||
hws[IMX6UL_CLK_PLL6_ENET] = imx_clk_hw_gate("pll6_enet", "pll6_bypass", base + 0xe0, 13);
|
||||
hws[IMX6UL_CLK_PLL6_ENET] = imx_clk_hw_fixed_factor("pll6_enet", "pll6_bypass", 1, 1);
|
||||
hws[IMX6UL_CLK_PLL7_USB_HOST] = imx_clk_hw_gate("pll7_usb_host", "pll7_bypass", base + 0x20, 13);
|
||||
|
||||
/*
|
||||
@ -205,12 +217,13 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
|
||||
hws[IMX6UL_CLK_PLL3_PFD2] = imx_clk_hw_pfd("pll3_pfd2_508m", "pll3_usb_otg", base + 0xf0, 2);
|
||||
hws[IMX6UL_CLK_PLL3_PFD3] = imx_clk_hw_pfd("pll3_pfd3_454m", "pll3_usb_otg", base + 0xf0, 3);
|
||||
|
||||
hws[IMX6UL_CLK_ENET_REF] = clk_hw_register_divider_table(NULL, "enet_ref", "pll6_enet", 0,
|
||||
hws[IMX6UL_CLK_ENET_REF] = clk_hw_register_divider_table(NULL, "enet1_ref", "pll6_enet", 0,
|
||||
base + 0xe0, 0, 2, 0, clk_enet_ref_table, &imx_ccm_lock);
|
||||
hws[IMX6UL_CLK_ENET2_REF] = clk_hw_register_divider_table(NULL, "enet2_ref", "pll6_enet", 0,
|
||||
base + 0xe0, 2, 2, 0, clk_enet_ref_table, &imx_ccm_lock);
|
||||
|
||||
hws[IMX6UL_CLK_ENET2_REF_125M] = imx_clk_hw_gate("enet_ref_125m", "enet2_ref", base + 0xe0, 20);
|
||||
hws[IMX6UL_CLK_ENET1_REF_125M] = imx_clk_hw_gate("enet1_ref_125m", "enet1_ref", base + 0xe0, 13);
|
||||
hws[IMX6UL_CLK_ENET2_REF_125M] = imx_clk_hw_gate("enet2_ref_125m", "enet2_ref", base + 0xe0, 20);
|
||||
hws[IMX6UL_CLK_ENET_PTP_REF] = imx_clk_hw_fixed_factor("enet_ptp_ref", "pll6_enet", 1, 20);
|
||||
hws[IMX6UL_CLK_ENET_PTP] = imx_clk_hw_gate("enet_ptp", "enet_ptp_ref", base + 0xe0, 21);
|
||||
|
||||
@ -471,6 +484,17 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
|
||||
/* mask handshake of mmdc */
|
||||
imx_mmdc_mask_handshake(base, 0);
|
||||
|
||||
hws[IMX6UL_CLK_ENET1_REF_PAD] = imx_obtain_fixed_of_clock(ccm_node, "enet1_ref_pad", 0);
|
||||
|
||||
hws[IMX6UL_CLK_ENET1_REF_SEL] = imx_clk_gpr_mux("enet1_ref_sel", "fsl,imx6ul-iomuxc-gpr",
|
||||
IOMUXC_GPR1, enet1_ref_sels, ARRAY_SIZE(enet1_ref_sels),
|
||||
enet1_ref_sels_table, enet1_ref_sels_table_mask);
|
||||
hws[IMX6UL_CLK_ENET2_REF_PAD] = imx_obtain_fixed_of_clock(ccm_node, "enet2_ref_pad", 0);
|
||||
|
||||
hws[IMX6UL_CLK_ENET2_REF_SEL] = imx_clk_gpr_mux("enet2_ref_sel", "fsl,imx6ul-iomuxc-gpr",
|
||||
IOMUXC_GPR1, enet2_ref_sels, ARRAY_SIZE(enet2_ref_sels),
|
||||
enet2_ref_sels_table, enet2_ref_sels_table_mask);
|
||||
|
||||
imx_check_clk_hws(hws, IMX6UL_CLK_END);
|
||||
|
||||
of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
|
||||
@ -515,6 +539,9 @@ static void __init imx6ul_clocks_init(struct device_node *ccm_node)
|
||||
clk_set_parent(hws[IMX6ULL_CLK_EPDC_PRE_SEL]->clk, hws[IMX6UL_CLK_PLL3_PFD2]->clk);
|
||||
|
||||
clk_set_parent(hws[IMX6UL_CLK_ENFC_SEL]->clk, hws[IMX6UL_CLK_PLL2_PFD2]->clk);
|
||||
|
||||
clk_set_parent(hws[IMX6UL_CLK_ENET1_REF_SEL]->clk, hws[IMX6UL_CLK_ENET_REF]->clk);
|
||||
clk_set_parent(hws[IMX6UL_CLK_ENET2_REF_SEL]->clk, hws[IMX6UL_CLK_ENET2_REF]->clk);
|
||||
}
|
||||
|
||||
CLK_OF_DECLARE(imx6ul, "fsl,imx6ul-ccm", imx6ul_clocks_init);
|
||||
|
@ -882,7 +882,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)
|
||||
hws[IMX7D_USB1_MAIN_480M_CLK] = imx_clk_hw_fixed_factor("pll_usb1_main_clk", "osc", 20, 1);
|
||||
hws[IMX7D_USB_MAIN_480M_CLK] = imx_clk_hw_fixed_factor("pll_usb_main_clk", "osc", 20, 1);
|
||||
|
||||
imx_register_uart_clocks(7);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
}
|
||||
CLK_OF_DECLARE(imx7d, "fsl,imx7d-ccm", imx7d_clocks_init);
|
||||
|
@ -176,7 +176,7 @@ static void __init imx7ulp_clk_pcc2_init(struct device_node *np)
|
||||
|
||||
of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
imx_register_uart_clocks(2);
|
||||
imx_register_uart_clocks();
|
||||
}
|
||||
CLK_OF_DECLARE(imx7ulp_clk_pcc2, "fsl,imx7ulp-pcc2", imx7ulp_clk_pcc2_init);
|
||||
|
||||
@ -223,7 +223,7 @@ static void __init imx7ulp_clk_pcc3_init(struct device_node *np)
|
||||
|
||||
of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_data);
|
||||
|
||||
imx_register_uart_clocks(7);
|
||||
imx_register_uart_clocks();
|
||||
}
|
||||
CLK_OF_DECLARE(imx7ulp_clk_pcc3, "fsl,imx7ulp-pcc3", imx7ulp_clk_pcc3_init);
|
||||
|
||||
|
@ -609,7 +609,7 @@ static int imx8mm_clocks_probe(struct platform_device *pdev)
|
||||
goto unregister_hws;
|
||||
}
|
||||
|
||||
imx_register_uart_clocks(4);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -602,7 +602,7 @@ static int imx8mn_clocks_probe(struct platform_device *pdev)
|
||||
goto unregister_hws;
|
||||
}
|
||||
|
||||
imx_register_uart_clocks(4);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -723,7 +723,7 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
|
||||
|
||||
of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
|
||||
|
||||
imx_register_uart_clocks(4);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -601,7 +601,7 @@ static int imx8mq_clocks_probe(struct platform_device *pdev)
|
||||
goto unregister_hws;
|
||||
}
|
||||
|
||||
imx_register_uart_clocks(4);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -385,7 +385,7 @@ static int imx8ulp_clk_pcc3_init(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
imx_register_uart_clocks(1);
|
||||
imx_register_uart_clocks();
|
||||
|
||||
/* register the pcc3 reset controller */
|
||||
return imx8ulp_pcc_reset_init(pdev, base, pcc3_resets, ARRAY_SIZE(pcc3_resets));
|
||||
|
@ -326,6 +326,8 @@ static int imx93_clocks_probe(struct platform_device *pdev)
|
||||
goto unregister_hws;
|
||||
}
|
||||
|
||||
imx_register_uart_clocks();
|
||||
|
||||
return 0;
|
||||
|
||||
unregister_hws:
|
||||
|
@ -110,6 +110,20 @@ struct clk_hw *imx_obtain_fixed_clock_hw(
|
||||
return __clk_get_hw(clk);
|
||||
}
|
||||
|
||||
struct clk_hw *imx_obtain_fixed_of_clock(struct device_node *np,
|
||||
const char *name, unsigned long rate)
|
||||
{
|
||||
struct clk *clk = of_clk_get_by_name(np, name);
|
||||
struct clk_hw *hw;
|
||||
|
||||
if (IS_ERR(clk))
|
||||
hw = imx_obtain_fixed_clock_hw(name, rate);
|
||||
else
|
||||
hw = __clk_get_hw(clk);
|
||||
|
||||
return hw;
|
||||
}
|
||||
|
||||
struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name)
|
||||
{
|
||||
struct clk *clk;
|
||||
@ -165,8 +179,10 @@ __setup_param("earlycon", imx_keep_uart_earlycon,
|
||||
__setup_param("earlyprintk", imx_keep_uart_earlyprintk,
|
||||
imx_keep_uart_clocks_param, 0);
|
||||
|
||||
void imx_register_uart_clocks(unsigned int clk_count)
|
||||
void imx_register_uart_clocks(void)
|
||||
{
|
||||
unsigned int num __maybe_unused;
|
||||
|
||||
imx_enabled_uart_clocks = 0;
|
||||
|
||||
/* i.MX boards use device trees now. For build tests without CONFIG_OF, do nothing */
|
||||
@ -174,14 +190,18 @@ void imx_register_uart_clocks(unsigned int clk_count)
|
||||
if (imx_keep_uart_clocks) {
|
||||
int i;
|
||||
|
||||
imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
|
||||
if (!imx_uart_clocks)
|
||||
num = of_clk_get_parent_count(of_stdout);
|
||||
if (!num)
|
||||
return;
|
||||
|
||||
if (!of_stdout)
|
||||
return;
|
||||
|
||||
for (i = 0; i < clk_count; i++) {
|
||||
imx_uart_clocks = kcalloc(num, sizeof(struct clk *), GFP_KERNEL);
|
||||
if (!imx_uart_clocks)
|
||||
return;
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
imx_uart_clocks[imx_enabled_uart_clocks] = of_clk_get(of_stdout, i);
|
||||
|
||||
/* Stop if there are no more of_stdout references */
|
||||
@ -205,9 +225,10 @@ static int __init imx_clk_disable_uart(void)
|
||||
clk_disable_unprepare(imx_uart_clocks[i]);
|
||||
clk_put(imx_uart_clocks[i]);
|
||||
}
|
||||
kfree(imx_uart_clocks);
|
||||
}
|
||||
|
||||
kfree(imx_uart_clocks);
|
||||
|
||||
return 0;
|
||||
}
|
||||
late_initcall_sync(imx_clk_disable_uart);
|
||||
|
@ -12,9 +12,9 @@ extern bool mcore_booted;
|
||||
void imx_check_clocks(struct clk *clks[], unsigned int count);
|
||||
void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count);
|
||||
#ifndef MODULE
|
||||
void imx_register_uart_clocks(unsigned int clk_count);
|
||||
void imx_register_uart_clocks(void);
|
||||
#else
|
||||
static inline void imx_register_uart_clocks(unsigned int clk_count)
|
||||
static inline void imx_register_uart_clocks(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@ -288,6 +288,9 @@ struct clk * imx_obtain_fixed_clock(
|
||||
struct clk_hw *imx_obtain_fixed_clock_hw(
|
||||
const char *name, unsigned long rate);
|
||||
|
||||
struct clk_hw *imx_obtain_fixed_of_clock(struct device_node *np,
|
||||
const char *name, unsigned long rate);
|
||||
|
||||
struct clk_hw *imx_get_clk_hw_by_name(struct device_node *np, const char *name);
|
||||
|
||||
struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent,
|
||||
@ -458,4 +461,9 @@ struct clk_hw *imx_clk_hw_divider_gate(const char *name, const char *parent_name
|
||||
unsigned long flags, void __iomem *reg, u8 shift, u8 width,
|
||||
u8 clk_divider_flags, const struct clk_div_table *table,
|
||||
spinlock_t *lock);
|
||||
|
||||
struct clk_hw *imx_clk_gpr_mux(const char *name, const char *compatible,
|
||||
u32 reg, const char **parent_names,
|
||||
u8 num_parents, const u32 *mux_table, u32 mask);
|
||||
|
||||
#endif
|
||||
|
@ -273,6 +273,8 @@
|
||||
#define IMX6QDL_CLK_MMDC_P0_IPG 263
|
||||
#define IMX6QDL_CLK_DCIC1 264
|
||||
#define IMX6QDL_CLK_DCIC2 265
|
||||
#define IMX6QDL_CLK_END 266
|
||||
#define IMX6QDL_CLK_ENET_REF_SEL 266
|
||||
#define IMX6QDL_CLK_ENET_REF_PAD 267
|
||||
#define IMX6QDL_CLK_END 268
|
||||
|
||||
#endif /* __DT_BINDINGS_CLOCK_IMX6QDL_H */
|
||||
|
@ -1,4 +1,4 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Copyright (C) 2016 Freescale Semiconductor, Inc.
|
||||
* Copyright 2017-2018 NXP.
|
||||
|
@ -256,7 +256,12 @@
|
||||
#define IMX6UL_CLK_GPIO4 247
|
||||
#define IMX6UL_CLK_GPIO5 248
|
||||
#define IMX6UL_CLK_MMDC_P1_IPG 249
|
||||
#define IMX6UL_CLK_ENET1_REF_125M 250
|
||||
#define IMX6UL_CLK_ENET1_REF_SEL 251
|
||||
#define IMX6UL_CLK_ENET1_REF_PAD 252
|
||||
#define IMX6UL_CLK_ENET2_REF_SEL 253
|
||||
#define IMX6UL_CLK_ENET2_REF_PAD 254
|
||||
|
||||
#define IMX6UL_CLK_END 250
|
||||
#define IMX6UL_CLK_END 255
|
||||
|
||||
#endif /* __DT_BINDINGS_CLOCK_IMX6UL_H */
|
||||
|
@ -201,7 +201,7 @@
|
||||
#define IMX8ULP_CLK_SAI7 2
|
||||
#define IMX8ULP_CLK_SPDIF 3
|
||||
#define IMX8ULP_CLK_ISI 4
|
||||
#define IMX8ULP_CLK_CSI_REGS 5
|
||||
#define IMX8ULP_CLK_CSI_REGS 5
|
||||
#define IMX8ULP_CLK_PCTLD 6
|
||||
#define IMX8ULP_CLK_CSI 7
|
||||
#define IMX8ULP_CLK_DSI 8
|
||||
@ -212,7 +212,7 @@
|
||||
#define IMX8ULP_CLK_GPU2D 13
|
||||
#define IMX8ULP_CLK_GPU3D 14
|
||||
#define IMX8ULP_CLK_DC_NANO 15
|
||||
#define IMX8ULP_CLK_CSI_CLK_UI 16
|
||||
#define IMX8ULP_CLK_CSI_CLK_UI 16
|
||||
#define IMX8ULP_CLK_CSI_CLK_ESC 17
|
||||
#define IMX8ULP_CLK_RGPIOD 18
|
||||
#define IMX8ULP_CLK_DMA2_MP 19
|
||||
|
@ -451,8 +451,10 @@
|
||||
#define IMX6SX_GPR12_PCIE_RX_EQ_2 (0x2 << 0)
|
||||
|
||||
/* For imx6ul iomux gpr register field define */
|
||||
#define IMX6UL_GPR1_ENET1_CLK_DIR (0x1 << 17)
|
||||
#define IMX6UL_GPR1_ENET2_CLK_DIR (0x1 << 18)
|
||||
#define IMX6UL_GPR1_ENET2_TX_CLK_DIR BIT(18)
|
||||
#define IMX6UL_GPR1_ENET1_TX_CLK_DIR BIT(17)
|
||||
#define IMX6UL_GPR1_ENET2_CLK_SEL BIT(14)
|
||||
#define IMX6UL_GPR1_ENET1_CLK_SEL BIT(13)
|
||||
#define IMX6UL_GPR1_ENET1_CLK_OUTPUT (0x1 << 17)
|
||||
#define IMX6UL_GPR1_ENET2_CLK_OUTPUT (0x1 << 18)
|
||||
#define IMX6UL_GPR1_ENET_CLK_DIR (0x3 << 17)
|
||||
|
Loading…
x
Reference in New Issue
Block a user