Skip to content

Commit

Permalink
Merge tag 'clk-imx-5.7' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/shawnguo/linux into clk-imx

Pull i.MX clk driver updates from Shawn Guo:

 - A series from Anson to convert i.MX8 clock bindings to json-schema
 - Update pll14xx driver to include new frequency entries for pll1443x
   table, and return error for invalid PLL type
 - Clean up header includes and unnecessary code on a few clock driver
 - Add mssing of_node_put() call for a number of clock drivers
 - Drop flag CLK_IS_CRITICAL from 'A53_CORE' mux clock, as we already
   have the flag on its child cpu clock
 - Fix a53 cpu clock for i.MX8 drivers to get it source from ARM PLL
   via CORE_SEL slice, and source from A53 CCM clk root when we need to
   change ARM PLL frequency. Thus, we can support core running above
   1GHz safely
 - Update pfdv2 driver to check zero rate and use determine_rate for
   getting the best rate
 - Add CLKO2 for imx8mm, SNVS clock for imx8mn, and PXP clock for imx7d

* tag 'clk-imx-5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: (41 commits)
  clk: imx: clk-gate2: Pass the device to the register function
  clk: imx7d: Add PXP clock
  clk: imx8mq: A53 core clock no need to be critical
  clk: imx8mp: A53 core clock no need to be critical
  clk: imx8mm: A53 core clock no need to be critical
  clk: imx8mn: A53 core clock no need to be critical
  clk: imx: pllv4: use prepare/unprepare
  clk: imx: pfdv2: determine best parent rate
  clk: imx: pfdv2: switch to use determine_rate
  clk: imx: Fix division by zero warning on pfdv2
  clk: imx: clk-sscg-pll: Drop unnecessary initialization
  clk: imx: pll14xx: Return error if pll type is invalid
  clk: imx: imx8mp: fix a53 cpu clock
  clk: imx: imx8mn: fix a53 cpu clock
  clk: imx: imx8mm: fix a53 cpu clock
  clk: imx: imx8mq: fix a53 cpu clock
  clk: imx8mp: Rename the IMX8MP_CLK_HDMI_27M clock
  clk: imx8mn: Remove unused includes
  clk: imx8mm: Remove unused includes
  clk: imx8mp: Include slab.h instead of clkdev.h
  ...
  • Loading branch information
Stephen Boyd committed Mar 25, 2020
2 parents bb6d3fb + b5881e8 commit 17bbcd7
Show file tree
Hide file tree
Showing 26 changed files with 383 additions and 211 deletions.
29 changes: 0 additions & 29 deletions Documentation/devicetree/bindings/clock/imx8mm-clock.txt

This file was deleted.

68 changes: 68 additions & 0 deletions Documentation/devicetree/bindings/clock/imx8mm-clock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/bindings/clock/imx8mm-clock.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NXP i.MX8M Mini Clock Control Module Binding

maintainers:
- Anson Huang <Anson.Huang@nxp.com>

description: |
NXP i.MX8M Mini clock control module is an integrated clock controller, which
generates and supplies to all modules.
properties:
compatible:
const: fsl,imx8mm-ccm

reg:
maxItems: 1

clocks:
items:
- description: 32k osc
- description: 24m osc
- description: ext1 clock input
- description: ext2 clock input
- description: ext3 clock input
- description: ext4 clock input

clock-names:
items:
- const: osc_32k
- const: osc_24m
- const: clk_ext1
- const: clk_ext2
- const: clk_ext3
- const: clk_ext4

'#clock-cells':
const: 1
description:
The clock consumer should specify the desired clock by having the clock
ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mm-clock.h
for the full list of i.MX8M Mini clock IDs.

required:
- compatible
- reg
- clocks
- clock-names
- '#clock-cells'

examples:
# Clock Control Module node:
- |
clk: clock-controller@30380000 {
compatible = "fsl,imx8mm-ccm";
reg = <0x30380000 0x10000>;
#clock-cells = <1>;
clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>, <&clk_ext2>,
<&clk_ext3>, <&clk_ext4>;
clock-names = "osc_32k", "osc_24m", "clk_ext1", "clk_ext2",
"clk_ext3", "clk_ext4";
};
...
48 changes: 2 additions & 46 deletions Documentation/devicetree/bindings/clock/imx8mn-clock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ properties:

'#clock-cells':
const: 1
description: |
description:
The clock consumer should specify the desired clock by having the clock
ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mn-clock.h
for the full list of i.MX8M Nano clock IDs.
Expand All @@ -57,56 +57,12 @@ examples:
- |
clk: clock-controller@30380000 {
compatible = "fsl,imx8mn-ccm";
reg = <0x0 0x30380000 0x0 0x10000>;
reg = <0x30380000 0x10000>;
#clock-cells = <1>;
clocks = <&osc_32k>, <&osc_24m>, <&clk_ext1>,
<&clk_ext2>, <&clk_ext3>, <&clk_ext4>;
clock-names = "osc_32k", "osc_24m", "clk_ext1",
"clk_ext2", "clk_ext3", "clk_ext4";
};
# Required external clocks for Clock Control Module node:
- |
osc_32k: clock-osc-32k {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <32768>;
clock-output-names = "osc_32k";
};
osc_24m: clock-osc-24m {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <24000000>;
clock-output-names = "osc_24m";
};
clk_ext1: clock-ext1 {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <133000000>;
clock-output-names = "clk_ext1";
};
clk_ext2: clock-ext2 {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <133000000>;
clock-output-names = "clk_ext2";
};
clk_ext3: clock-ext3 {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <133000000>;
clock-output-names = "clk_ext3";
};
clk_ext4: clock-ext4 {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency= <133000000>;
clock-output-names = "clk_ext4";
};
...
20 changes: 0 additions & 20 deletions Documentation/devicetree/bindings/clock/imx8mq-clock.txt

This file was deleted.

72 changes: 72 additions & 0 deletions Documentation/devicetree/bindings/clock/imx8mq-clock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/bindings/clock/imx8mq-clock.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: NXP i.MX8M Quad Clock Control Module Binding

maintainers:
- Anson Huang <Anson.Huang@nxp.com>

description: |
NXP i.MX8M Quad clock control module is an integrated clock controller, which
generates and supplies to all modules.
properties:
compatible:
const: fsl,imx8mq-ccm

reg:
maxItems: 1

clocks:
items:
- description: 32k osc
- description: 25m osc
- description: 27m osc
- description: ext1 clock input
- description: ext2 clock input
- description: ext3 clock input
- description: ext4 clock input

clock-names:
items:
- const: ckil
- const: osc_25m
- const: osc_27m
- const: clk_ext1
- const: clk_ext2
- const: clk_ext3
- const: clk_ext4

'#clock-cells':
const: 1
description:
The clock consumer should specify the desired clock by having the clock
ID in its "clocks" phandle cell. See include/dt-bindings/clock/imx8mq-clock.h
for the full list of i.MX8M Quad clock IDs.

required:
- compatible
- reg
- clocks
- clock-names
- '#clock-cells'

examples:
# Clock Control Module node:
- |
clk: clock-controller@30380000 {
compatible = "fsl,imx8mq-ccm";
reg = <0x30380000 0x10000>;
#clock-cells = <1>;
clocks = <&ckil>, <&osc_25m>, <&osc_27m>,
<&clk_ext1>, <&clk_ext2>,
<&clk_ext3>, <&clk_ext4>;
clock-names = "ckil", "osc_25m", "osc_27m",
"clk_ext1", "clk_ext2",
"clk_ext3", "clk_ext4";
};
...
20 changes: 15 additions & 5 deletions drivers/clk/imx/clk-composite-8m.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define PCG_PREDIV_MAX 8

#define PCG_DIV_SHIFT 0
#define PCG_CORE_DIV_WIDTH 3
#define PCG_DIV_WIDTH 6
#define PCG_DIV_MAX 64

Expand Down Expand Up @@ -91,7 +92,7 @@ static int imx8m_clk_composite_divider_set_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct clk_divider *divider = to_clk_divider(hw);
unsigned long flags = 0;
unsigned long flags;
int prediv_value;
int div_value;
int ret;
Expand Down Expand Up @@ -126,13 +127,15 @@ static const struct clk_ops imx8m_clk_composite_divider_ops = {
struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,
const char * const *parent_names,
int num_parents, void __iomem *reg,
u32 composite_flags,
unsigned long flags)
{
struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;
struct clk_hw *div_hw, *gate_hw;
struct clk_divider *div = NULL;
struct clk_gate *gate = NULL;
struct clk_mux *mux = NULL;
const struct clk_ops *divider_ops;

mux = kzalloc(sizeof(*mux), GFP_KERNEL);
if (!mux)
Expand All @@ -150,8 +153,16 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,

div_hw = &div->hw;
div->reg = reg;
div->shift = PCG_PREDIV_SHIFT;
div->width = PCG_PREDIV_WIDTH;
if (composite_flags & IMX_COMPOSITE_CORE) {
div->shift = PCG_DIV_SHIFT;
div->width = PCG_CORE_DIV_WIDTH;
divider_ops = &clk_divider_ops;
} else {
div->shift = PCG_PREDIV_SHIFT;
div->width = PCG_PREDIV_WIDTH;
divider_ops = &imx8m_clk_composite_divider_ops;
}

div->lock = &imx_ccm_lock;
div->flags = CLK_DIVIDER_ROUND_CLOSEST;

Expand All @@ -166,8 +177,7 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,

hw = clk_hw_register_composite(NULL, name, parent_names, num_parents,
mux_hw, &clk_mux_ops, div_hw,
&imx8m_clk_composite_divider_ops,
gate_hw, &clk_gate_ops, flags);
divider_ops, gate_hw, &clk_gate_ops, flags);
if (IS_ERR(hw))
goto fail;

Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/imx/clk-fixup-div.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int clk_fixup_div_set_rate(struct clk_hw *hw, unsigned long rate,
struct clk_fixup_div *fixup_div = to_clk_fixup_div(hw);
struct clk_divider *div = to_clk_divider(hw);
unsigned int divider, value;
unsigned long flags = 0;
unsigned long flags;
u32 val;

divider = parent_rate / rate;
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/imx/clk-fixup-mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static int clk_fixup_mux_set_parent(struct clk_hw *hw, u8 index)
{
struct clk_fixup_mux *fixup_mux = to_clk_fixup_mux(hw);
struct clk_mux *mux = to_clk_mux(hw);
unsigned long flags = 0;
unsigned long flags;
u32 val;

spin_lock_irqsave(mux->lock, flags);
Expand Down
8 changes: 4 additions & 4 deletions drivers/clk/imx/clk-gate2.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static int clk_gate2_enable(struct clk_hw *hw)
{
struct clk_gate2 *gate = to_clk_gate2(hw);
u32 reg;
unsigned long flags = 0;
unsigned long flags;

spin_lock_irqsave(gate->lock, flags);

Expand All @@ -62,7 +62,7 @@ static void clk_gate2_disable(struct clk_hw *hw)
{
struct clk_gate2 *gate = to_clk_gate2(hw);
u32 reg;
unsigned long flags = 0;
unsigned long flags;

spin_lock_irqsave(gate->lock, flags);

Expand Down Expand Up @@ -101,7 +101,7 @@ static int clk_gate2_is_enabled(struct clk_hw *hw)
static void clk_gate2_disable_unused(struct clk_hw *hw)
{
struct clk_gate2 *gate = to_clk_gate2(hw);
unsigned long flags = 0;
unsigned long flags;
u32 reg;

spin_lock_irqsave(gate->lock, flags);
Expand Down Expand Up @@ -154,7 +154,7 @@ struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name,
gate->hw.init = &init;
hw = &gate->hw;

ret = clk_hw_register(NULL, hw);
ret = clk_hw_register(dev, hw);
if (ret) {
kfree(gate);
return ERR_PTR(ret);
Expand Down
1 change: 1 addition & 0 deletions drivers/clk/imx/clk-imx6sl.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ static void __init imx6sl_clocks_init(struct device_node *ccm_node)
np = of_find_compatible_node(NULL, NULL, "fsl,imx6sl-anatop");
base = of_iomap(np, 0);
WARN_ON(!base);
of_node_put(np);
anatop_base = base;

hws[IMX6SL_PLL1_BYPASS_SRC] = imx_clk_hw_mux("pll1_bypass_src", base + 0x00, 14, 1, pll_bypass_src_sels, ARRAY_SIZE(pll_bypass_src_sels));
Expand Down
1 change: 1 addition & 0 deletions drivers/clk/imx/clk-imx7d.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,6 +802,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)
hws[IMX7D_PCIE_PHY_ROOT_CLK] = imx_clk_hw_gate4("pcie_phy_root_clk", "pcie_phy_post_div", base + 0x4600, 0);
hws[IMX7D_EPDC_PIXEL_ROOT_CLK] = imx_clk_hw_gate4("epdc_pixel_root_clk", "epdc_pixel_post_div", base + 0x44a0, 0);
hws[IMX7D_LCDIF_PIXEL_ROOT_CLK] = imx_clk_hw_gate4("lcdif_pixel_root_clk", "lcdif_pixel_post_div", base + 0x44b0, 0);
hws[IMX7D_PXP_CLK] = imx_clk_hw_gate4("pxp_clk", "main_axi_root_clk", base + 0x44c0, 0);
hws[IMX7D_MIPI_DSI_ROOT_CLK] = imx_clk_hw_gate4("mipi_dsi_root_clk", "mipi_dsi_post_div", base + 0x4650, 0);
hws[IMX7D_MIPI_CSI_ROOT_CLK] = imx_clk_hw_gate4("mipi_csi_root_clk", "mipi_csi_post_div", base + 0x4640, 0);
hws[IMX7D_MIPI_DPHY_ROOT_CLK] = imx_clk_hw_gate4("mipi_dphy_root_clk", "mipi_dphy_post_div", base + 0x4660, 0);
Expand Down
Loading

0 comments on commit 17bbcd7

Please sign in to comment.