Skip to content

Commit

Permalink
Merge branches 'clk-socfpga', 'clk-toshiba', 'clk-st' and 'clk-bitmai…
Browse files Browse the repository at this point in the history
…n' into clk-next

 - Clock and reset driver for Toshiba Visconti SoCs

* clk-socfpga:
  clk: socfpga: s10: Make use of the helper function devm_platform_ioremap_resource()
  clk: socfpga: agilex: Make use of the helper function devm_platform_ioremap_resource()
  clk: socfpga: remove redundant assignment after a mask operation
  clk: socfpga: remove redundant assignment on division

* clk-toshiba:
  clk: visconti: Remove pointless NULL check in visconti_pll_add_lookup()
  MAINTAINERS: Add entries for Toshiba Visconti PLL and clock controller
  clk: visconti: Add support common clock driver and reset driver
  dt-bindings: clock: Add DT bindings for SMU of Toshiba Visconti TMPV770x SoC
  dt-bindings: clock: Add DT bindings for PLL of Toshiba Visconti TMPV770x SoC

* clk-st:
  clk: Drop unused COMMON_CLK_STM32MP157_SCMI config
  clk: st: clkgen-mux: search reg within node or parent
  clk: st: clkgen-fsyn: search reg within node or parent

* clk-bitmain:
  clk: bm1880: remove kfrees on static allocations
  • Loading branch information
Stephen Boyd committed Jan 12, 2022
5 parents f691c9b + b739bca + 4e31bfa + 5dcc0ef + c861c1b commit 1d0bd12
Show file tree
Hide file tree
Showing 24 changed files with 1,580 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/toshiba,tmpv770x-pipllct.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Toshiba Visconti5 TMPV770X PLL Controller Device Tree Bindings

maintainers:
- Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

description:
Toshia Visconti5 PLL controller which supports the PLLs on TMPV770X.

properties:
compatible:
const: toshiba,tmpv7708-pipllct

reg:
maxItems: 1

'#clock-cells':
const: 1

clocks:
description: External reference clock (OSC2)
maxItems: 1

required:
- compatible
- reg
- "#clock-cells"
- clocks

additionalProperties: false

examples:
- |
osc2_clk: osc2-clk {
compatible = "fixed-clock";
clock-frequency = <20000000>;
#clock-cells = <0>;
};
soc {
#address-cells = <2>;
#size-cells = <2>;
pipllct: clock-controller@24220000 {
compatible = "toshiba,tmpv7708-pipllct";
reg = <0 0x24220000 0 0x820>;
#clock-cells = <1>;
clocks = <&osc2_clk>;
};
};
...
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/toshiba,tmpv770x-pismu.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Toshiba Visconti5 TMPV770x SMU controller Device Tree Bindings

maintainers:
- Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

description:
Toshia Visconti5 SMU (System Management Unit) which supports the clock
and resets on TMPV770x.

properties:
compatible:
items:
- const: toshiba,tmpv7708-pismu
- const: syscon

reg:
maxItems: 1

'#clock-cells':
const: 1

'#reset-cells':
const: 1

required:
- compatible
- reg
- "#clock-cells"
- "#reset-cells"

additionalProperties: false

examples:
- |
soc {
#address-cells = <2>;
#size-cells = <2>;
pismu: syscon@24200000 {
compatible = "toshiba,tmpv7708-pismu", "syscon";
reg = <0 0x24200000 0 0x2140>;
#clock-cells = <1>;
#reset-cells = <1>;
};
};
...
3 changes: 3 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2782,12 +2782,15 @@ L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/iwamatsu/linux-visconti.git
F: Documentation/devicetree/bindings/arm/toshiba.yaml
F: Documentation/devicetree/bindings/clock/toshiba,tmpv770x-pipllct.yaml
F: Documentation/devicetree/bindings/clock/toshiba,tmpv770x-pismu.yaml
F: Documentation/devicetree/bindings/net/toshiba,visconti-dwmac.yaml
F: Documentation/devicetree/bindings/gpio/toshiba,gpio-visconti.yaml
F: Documentation/devicetree/bindings/pci/toshiba,visconti-pcie.yaml
F: Documentation/devicetree/bindings/pinctrl/toshiba,visconti-pinctrl.yaml
F: Documentation/devicetree/bindings/watchdog/toshiba,visconti-wdt.yaml
F: arch/arm64/boot/dts/toshiba/
F: drivers/clk/visconti/
F: drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c
F: drivers/gpio/gpio-visconti.c
F: drivers/pci/controller/dwc/pcie-visconti.c
Expand Down
11 changes: 1 addition & 10 deletions drivers/clk/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -354,16 +354,6 @@ config COMMON_CLK_STM32MP157
help
Support for stm32mp157 SoC family clocks

config COMMON_CLK_STM32MP157_SCMI
bool "stm32mp157 Clock driver with Trusted Firmware"
depends on COMMON_CLK_STM32MP157
select COMMON_CLK_SCMI
select ARM_SCMI_PROTOCOL
default y
help
Support for stm32mp157 SoC family clocks with Trusted Firmware using
SCMI protocol.

config COMMON_CLK_STM32F
def_bool COMMON_CLK && (MACH_STM32F429 || MACH_STM32F469 || MACH_STM32F746)
help
Expand Down Expand Up @@ -432,6 +422,7 @@ source "drivers/clk/sunxi-ng/Kconfig"
source "drivers/clk/tegra/Kconfig"
source "drivers/clk/ti/Kconfig"
source "drivers/clk/uniphier/Kconfig"
source "drivers/clk/visconti/Kconfig"
source "drivers/clk/x86/Kconfig"
source "drivers/clk/xilinx/Kconfig"
source "drivers/clk/zynqmp/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/clk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ obj-y += ti/
obj-$(CONFIG_CLK_UNIPHIER) += uniphier/
obj-$(CONFIG_ARCH_U8500) += ux500/
obj-y += versatile/
obj-$(CONFIG_COMMON_CLK_VISCONTI) += visconti/
ifeq ($(CONFIG_COMMON_CLK), y)
obj-$(CONFIG_X86) += x86/
endif
Expand Down
20 changes: 2 additions & 18 deletions drivers/clk/clk-bm1880.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,14 +522,6 @@ static struct clk_hw *bm1880_clk_register_pll(struct bm1880_pll_hw_clock *pll_cl
return hw;
}

static void bm1880_clk_unregister_pll(struct clk_hw *hw)
{
struct bm1880_pll_hw_clock *pll_hw = to_bm1880_pll_clk(hw);

clk_hw_unregister(hw);
kfree(pll_hw);
}

static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks,
int num_clks,
struct bm1880_clock_data *data)
Expand All @@ -555,7 +547,7 @@ static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks,

err_clk:
while (i--)
bm1880_clk_unregister_pll(data->hw_data.hws[clks[i].pll.id]);
clk_hw_unregister(data->hw_data.hws[clks[i].pll.id]);

return PTR_ERR(hw);
}
Expand Down Expand Up @@ -695,14 +687,6 @@ static struct clk_hw *bm1880_clk_register_div(struct bm1880_div_hw_clock *div_cl
return hw;
}

static void bm1880_clk_unregister_div(struct clk_hw *hw)
{
struct bm1880_div_hw_clock *div_hw = to_bm1880_div_clk(hw);

clk_hw_unregister(hw);
kfree(div_hw);
}

static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks,
int num_clks,
struct bm1880_clock_data *data)
Expand All @@ -729,7 +713,7 @@ static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks,

err_clk:
while (i--)
bm1880_clk_unregister_div(data->hw_data.hws[clks[i].div.id]);
clk_hw_unregister(data->hw_data.hws[clks[i].div.id]);

return PTR_ERR(hw);
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/clk/socfpga/clk-agilex.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,10 @@ static int n5x_clkmgr_init(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
struct stratix10_clock_data *clk_data;
struct resource *res;
void __iomem *base;
int i, num_clks;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(dev, res);
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);

Expand Down
4 changes: 2 additions & 2 deletions drivers/clk/socfpga/clk-gate.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static u8 socfpga_clk_get_parent(struct clk_hw *hwclk)

if (streq(name, SOCFPGA_L4_MP_CLK)) {
l4_src = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
return l4_src &= 0x1;
return l4_src & 0x1;
}
if (streq(name, SOCFPGA_L4_SP_CLK)) {
l4_src = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
Expand All @@ -43,7 +43,7 @@ static u8 socfpga_clk_get_parent(struct clk_hw *hwclk)

perpll_src = readl(clk_mgr_base_addr + CLKMGR_PERPLL_SRC);
if (streq(name, SOCFPGA_MMC_CLK))
return perpll_src &= 0x3;
return perpll_src & 0x3;
if (streq(name, SOCFPGA_NAND_CLK) ||
streq(name, SOCFPGA_NAND_X_CLK))
return (perpll_src >> 2) & 3;
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/socfpga/clk-pll-s10.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static unsigned long clk_boot_clk_recalc_rate(struct clk_hw *hwclk,
SWCTRLBTCLKSEL_MASK) >>
SWCTRLBTCLKSEL_SHIFT);
div += 1;
return parent_rate /= div;
return parent_rate / div;
}


Expand Down
4 changes: 1 addition & 3 deletions drivers/clk/socfpga/clk-s10.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,10 @@ static int s10_clkmgr_init(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
struct stratix10_clock_data *clk_data;
struct resource *res;
void __iomem *base;
int i, num_clks;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(dev, res);
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base)) {
pr_err("%s: failed to map clock registers\n", __func__);
return PTR_ERR(base);
Expand Down
13 changes: 11 additions & 2 deletions drivers/clk/st/clkgen-fsyn.c
Original file line number Diff line number Diff line change
Expand Up @@ -988,9 +988,18 @@ static void __init st_of_quadfs_setup(struct device_node *np,
void __iomem *reg;
spinlock_t *lock;

/*
* First check for reg property within the node to keep backward
* compatibility, then if reg doesn't exist look at the parent node
*/
reg = of_iomap(np, 0);
if (!reg)
return;
if (!reg) {
reg = of_iomap(of_get_parent(np), 0);
if (!reg) {
pr_err("%s: Failed to get base address\n", __func__);
return;
}
}

clk_parent_name = of_clk_get_parent_name(np, 0);
if (!clk_parent_name)
Expand Down
11 changes: 9 additions & 2 deletions drivers/clk/st/clkgen-mux.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ static void __init st_of_clkgen_mux_setup(struct device_node *np,
const char **parents;
int num_parents = 0;

/*
* First check for reg property within the node to keep backward
* compatibility, then if reg doesn't exist look at the parent node
*/
reg = of_iomap(np, 0);
if (!reg) {
pr_err("%s: Failed to get base address\n", __func__);
return;
reg = of_iomap(of_get_parent(np), 0);
if (!reg) {
pr_err("%s: Failed to get base address\n", __func__);
return;
}
}

parents = clkgen_mux_get_parents(np, &num_parents);
Expand Down
9 changes: 9 additions & 0 deletions drivers/clk/visconti/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-only

config COMMON_CLK_VISCONTI
bool "Support for Toshiba Visconti5 ARM SoC clock controllers"
depends on ARCH_VISCONTI || COMPILE_TEST
default ARCH_VISCONTI
help
Support for the Toshiba Visconti5 ARM SoC clock controller.
Say Y if you want to include clock support.
5 changes: 5 additions & 0 deletions drivers/clk/visconti/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
# Makefile for Toshiba Visconti clock

obj-y += clkc.o pll.o reset.o
obj-y += pll-tmpv770x.o clkc-tmpv770x.o
Loading

0 comments on commit 1d0bd12

Please sign in to comment.