Unverified Commit c1e102f3 authored by Stephen Boyd's avatar Stephen Boyd
Browse files

Merge branches 'clk-imx', 'clk-allwinner' and 'clk-ti' into clk-next

* clk-imx:
  clk: imx95-blk-ctl: Save/restore registers when RPM routines are called
  clk: imx95-blk-ctl: Save platform data in imx95_blk_ctl structure

* clk-allwinner:
  clk: sunxi-ng: add support for the A523/T527 MCU CCU
  clk: sunxi-ng: div: support power-of-two dividers
  clk: sunxi-ng: sun55i-a523-ccu: Add missing NPU module clock
  dt-bindings: clock: sun55i-a523-ccu: Add A523 MCU CCU clock controller
  dt-bindings: clock: sun55i-a523-ccu: Add missing NPU module clock
  clk: sunxi-ng: sun6i-rtc: Add A523 specifics

* clk-ti:
  clk: keystone: sci-clk: use devm_kmemdup_array()
  clk: ti: am33xx: keep WKUP_DEBUGSS_CLKCTRL enabled
Loading
Loading
Loading
Loading
+35 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ properties:
  compatible:
    enum:
      - allwinner,sun55i-a523-ccu
      - allwinner,sun55i-a523-mcu-ccu
      - allwinner,sun55i-a523-r-ccu

  reg:
@@ -26,11 +27,11 @@ properties:

  clocks:
    minItems: 4
    maxItems: 5
    maxItems: 9

  clock-names:
    minItems: 4
    maxItems: 5
    maxItems: 9

required:
  - "#clock-cells"
@@ -63,6 +64,38 @@ allOf:
            - const: iosc
            - const: losc-fanout

  - if:
      properties:
        compatible:
          enum:
            - allwinner,sun55i-a523-mcu-ccu

    then:
      properties:
        clocks:
          items:
            - description: High Frequency Oscillator (usually at 24MHz)
            - description: Low Frequency Oscillator (usually at 32kHz)
            - description: Internal Oscillator
            - description: Audio PLL (4x)
            - description: Peripherals PLL 0 (300 MHz output)
            - description: DSP module clock
            - description: MBUS clock
            - description: PRCM AHB clock
            - description: PRCM APB0 clock

        clock-names:
          items:
            - const: hosc
            - const: losc
            - const: iosc
            - const: pll-audio0-4x
            - const: pll-periph0-300m
            - const: dsp
            - const: mbus
            - const: r-ahb
            - const: r-apb0

  - if:
      properties:
        compatible:
+28 −29
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ struct imx95_blk_ctl {
	void __iomem *base;
	/* clock gate register */
	u32 clk_reg_restore;
	const struct imx95_blk_ctl_dev_data *pdata;
};

struct imx95_blk_ctl_clk_dev_data {
@@ -349,7 +350,6 @@ static const struct imx95_blk_ctl_dev_data imx94_dispmix_csr_dev_data = {
static int imx95_bc_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	const struct imx95_blk_ctl_dev_data *bc_data;
	struct imx95_blk_ctl *bc;
	struct clk_hw_onecell_data *clk_hw_data;
	struct clk_hw **hws;
@@ -379,25 +379,25 @@ static int imx95_bc_probe(struct platform_device *pdev)
		return ret;
	}

	bc_data = of_device_get_match_data(dev);
	if (!bc_data)
	bc->pdata = of_device_get_match_data(dev);
	if (!bc->pdata)
		return devm_of_platform_populate(dev);

	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, bc_data->num_clks),
	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, bc->pdata->num_clks),
				   GFP_KERNEL);
	if (!clk_hw_data)
		return -ENOMEM;

	if (bc_data->rpm_enabled) {
	if (bc->pdata->rpm_enabled) {
		devm_pm_runtime_enable(&pdev->dev);
		pm_runtime_resume_and_get(&pdev->dev);
	}

	clk_hw_data->num = bc_data->num_clks;
	clk_hw_data->num = bc->pdata->num_clks;
	hws = clk_hw_data->hws;

	for (i = 0; i < bc_data->num_clks; i++) {
		const struct imx95_blk_ctl_clk_dev_data *data = &bc_data->clk_dev_data[i];
	for (i = 0; i < bc->pdata->num_clks; i++) {
		const struct imx95_blk_ctl_clk_dev_data *data = &bc->pdata->clk_dev_data[i];
		void __iomem *reg = base + data->reg;

		if (data->type == CLK_MUX) {
@@ -439,7 +439,7 @@ static int imx95_bc_probe(struct platform_device *pdev)
	return 0;

cleanup:
	for (i = 0; i < bc_data->num_clks; i++) {
	for (i = 0; i < bc->pdata->num_clks; i++) {
		if (IS_ERR_OR_NULL(hws[i]))
			continue;
		clk_hw_unregister(hws[i]);
@@ -453,15 +453,24 @@ static int imx95_bc_runtime_suspend(struct device *dev)
{
	struct imx95_blk_ctl *bc = dev_get_drvdata(dev);

	bc->clk_reg_restore = readl(bc->base + bc->pdata->clk_reg_offset);
	clk_disable_unprepare(bc->clk_apb);

	return 0;
}

static int imx95_bc_runtime_resume(struct device *dev)
{
	struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
	int ret;

	return clk_prepare_enable(bc->clk_apb);
	ret = clk_prepare_enable(bc->clk_apb);
	if (ret)
		return ret;

	writel(bc->clk_reg_restore, bc->base + bc->pdata->clk_reg_offset);

	return 0;
}
#endif

@@ -469,22 +478,12 @@ static int imx95_bc_runtime_resume(struct device *dev)
static int imx95_bc_suspend(struct device *dev)
{
	struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
	const struct imx95_blk_ctl_dev_data *bc_data;
	int ret;

	bc_data = of_device_get_match_data(dev);
	if (!bc_data)
	if (pm_runtime_suspended(dev))
		return 0;

	if (bc_data->rpm_enabled) {
		ret = pm_runtime_get_sync(bc->dev);
		if (ret < 0) {
			pm_runtime_put_noidle(bc->dev);
			return ret;
		}
	}

	bc->clk_reg_restore = readl(bc->base + bc_data->clk_reg_offset);
	bc->clk_reg_restore = readl(bc->base + bc->pdata->clk_reg_offset);
	clk_disable_unprepare(bc->clk_apb);

	return 0;
}
@@ -492,16 +491,16 @@ static int imx95_bc_suspend(struct device *dev)
static int imx95_bc_resume(struct device *dev)
{
	struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
	const struct imx95_blk_ctl_dev_data *bc_data;
	int ret;

	bc_data = of_device_get_match_data(dev);
	if (!bc_data)
	if (pm_runtime_suspended(dev))
		return 0;

	writel(bc->clk_reg_restore, bc->base + bc_data->clk_reg_offset);
	ret = clk_prepare_enable(bc->clk_apb);
	if (ret)
		return ret;

	if (bc_data->rpm_enabled)
		pm_runtime_put(bc->dev);
	writel(bc->clk_reg_restore, bc->base + bc->pdata->clk_reg_offset);

	return 0;
}
+1 −4
Original line number Diff line number Diff line
@@ -480,13 +480,10 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider)
		num_clks++;
	}

	provider->clocks = devm_kmalloc_array(dev, num_clks, sizeof(sci_clk),
					      GFP_KERNEL);
	provider->clocks = devm_kmemdup_array(dev, clks, num_clks, sizeof(sci_clk), GFP_KERNEL);
	if (!provider->clocks)
		return -ENOMEM;

	memcpy(provider->clocks, clks, num_clks * sizeof(sci_clk));

	provider->num_clocks = num_clks;

	devm_kfree(dev, clks);
+5 −0
Original line number Diff line number Diff line
@@ -57,6 +57,11 @@ config SUN55I_A523_CCU
	default ARCH_SUNXI
	depends on ARM64 || COMPILE_TEST

config SUN55I_A523_MCU_CCU
	tristate "Support for the Allwinner A523/T527 MCU CCU"
	default ARCH_SUNXI
	depends on ARM64 || COMPILE_TEST

config SUN55I_A523_R_CCU
	tristate "Support for the Allwinner A523/T527 PRCM CCU"
	default ARCH_SUNXI
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ obj-$(CONFIG_SUN50I_H6_CCU) += sun50i-h6-ccu.o
obj-$(CONFIG_SUN50I_H6_R_CCU)	+= sun50i-h6-r-ccu.o
obj-$(CONFIG_SUN50I_H616_CCU)	+= sun50i-h616-ccu.o
obj-$(CONFIG_SUN55I_A523_CCU)	+= sun55i-a523-ccu.o
obj-$(CONFIG_SUN55I_A523_MCU_CCU)	+= sun55i-a523-mcu-ccu.o
obj-$(CONFIG_SUN55I_A523_R_CCU)	+= sun55i-a523-r-ccu.o
obj-$(CONFIG_SUN4I_A10_CCU)	+= sun4i-a10-ccu.o
obj-$(CONFIG_SUN5I_CCU)		+= sun5i-ccu.o
@@ -61,6 +62,7 @@ sun50i-h6-ccu-y += ccu-sun50i-h6.o
sun50i-h6-r-ccu-y		+= ccu-sun50i-h6-r.o
sun50i-h616-ccu-y		+= ccu-sun50i-h616.o
sun55i-a523-ccu-y		+= ccu-sun55i-a523.o
sun55i-a523-mcu-ccu-y		+= ccu-sun55i-a523-mcu.o
sun55i-a523-r-ccu-y		+= ccu-sun55i-a523-r.o
sun4i-a10-ccu-y			+= ccu-sun4i-a10.o
sun5i-ccu-y			+= ccu-sun5i.o
Loading