Skip to content

Commit c1e102f

Browse files
committed
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
4 parents 3aae991 + acf800c + 597fe80 + 0485469 commit c1e102f

14 files changed

Lines changed: 674 additions & 52 deletions

File tree

Documentation/devicetree/bindings/clock/allwinner,sun55i-a523-ccu.yaml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@ properties:
1919
compatible:
2020
enum:
2121
- allwinner,sun55i-a523-ccu
22+
- allwinner,sun55i-a523-mcu-ccu
2223
- allwinner,sun55i-a523-r-ccu
2324

2425
reg:
2526
maxItems: 1
2627

2728
clocks:
2829
minItems: 4
29-
maxItems: 5
30+
maxItems: 9
3031

3132
clock-names:
3233
minItems: 4
33-
maxItems: 5
34+
maxItems: 9
3435

3536
required:
3637
- "#clock-cells"
@@ -63,6 +64,38 @@ allOf:
6364
- const: iosc
6465
- const: losc-fanout
6566

67+
- if:
68+
properties:
69+
compatible:
70+
enum:
71+
- allwinner,sun55i-a523-mcu-ccu
72+
73+
then:
74+
properties:
75+
clocks:
76+
items:
77+
- description: High Frequency Oscillator (usually at 24MHz)
78+
- description: Low Frequency Oscillator (usually at 32kHz)
79+
- description: Internal Oscillator
80+
- description: Audio PLL (4x)
81+
- description: Peripherals PLL 0 (300 MHz output)
82+
- description: DSP module clock
83+
- description: MBUS clock
84+
- description: PRCM AHB clock
85+
- description: PRCM APB0 clock
86+
87+
clock-names:
88+
items:
89+
- const: hosc
90+
- const: losc
91+
- const: iosc
92+
- const: pll-audio0-4x
93+
- const: pll-periph0-300m
94+
- const: dsp
95+
- const: mbus
96+
- const: r-ahb
97+
- const: r-apb0
98+
6699
- if:
67100
properties:
68101
compatible:

drivers/clk/imx/clk-imx95-blk-ctl.c

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct imx95_blk_ctl {
3636
void __iomem *base;
3737
/* clock gate register */
3838
u32 clk_reg_restore;
39+
const struct imx95_blk_ctl_dev_data *pdata;
3940
};
4041

4142
struct imx95_blk_ctl_clk_dev_data {
@@ -349,7 +350,6 @@ static const struct imx95_blk_ctl_dev_data imx94_dispmix_csr_dev_data = {
349350
static int imx95_bc_probe(struct platform_device *pdev)
350351
{
351352
struct device *dev = &pdev->dev;
352-
const struct imx95_blk_ctl_dev_data *bc_data;
353353
struct imx95_blk_ctl *bc;
354354
struct clk_hw_onecell_data *clk_hw_data;
355355
struct clk_hw **hws;
@@ -379,25 +379,25 @@ static int imx95_bc_probe(struct platform_device *pdev)
379379
return ret;
380380
}
381381

382-
bc_data = of_device_get_match_data(dev);
383-
if (!bc_data)
382+
bc->pdata = of_device_get_match_data(dev);
383+
if (!bc->pdata)
384384
return devm_of_platform_populate(dev);
385385

386-
clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, bc_data->num_clks),
386+
clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, bc->pdata->num_clks),
387387
GFP_KERNEL);
388388
if (!clk_hw_data)
389389
return -ENOMEM;
390390

391-
if (bc_data->rpm_enabled) {
391+
if (bc->pdata->rpm_enabled) {
392392
devm_pm_runtime_enable(&pdev->dev);
393393
pm_runtime_resume_and_get(&pdev->dev);
394394
}
395395

396-
clk_hw_data->num = bc_data->num_clks;
396+
clk_hw_data->num = bc->pdata->num_clks;
397397
hws = clk_hw_data->hws;
398398

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

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

441441
cleanup:
442-
for (i = 0; i < bc_data->num_clks; i++) {
442+
for (i = 0; i < bc->pdata->num_clks; i++) {
443443
if (IS_ERR_OR_NULL(hws[i]))
444444
continue;
445445
clk_hw_unregister(hws[i]);
@@ -453,55 +453,54 @@ static int imx95_bc_runtime_suspend(struct device *dev)
453453
{
454454
struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
455455

456+
bc->clk_reg_restore = readl(bc->base + bc->pdata->clk_reg_offset);
456457
clk_disable_unprepare(bc->clk_apb);
458+
457459
return 0;
458460
}
459461

460462
static int imx95_bc_runtime_resume(struct device *dev)
461463
{
462464
struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
465+
int ret;
463466

464-
return clk_prepare_enable(bc->clk_apb);
467+
ret = clk_prepare_enable(bc->clk_apb);
468+
if (ret)
469+
return ret;
470+
471+
writel(bc->clk_reg_restore, bc->base + bc->pdata->clk_reg_offset);
472+
473+
return 0;
465474
}
466475
#endif
467476

468477
#ifdef CONFIG_PM_SLEEP
469478
static int imx95_bc_suspend(struct device *dev)
470479
{
471480
struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
472-
const struct imx95_blk_ctl_dev_data *bc_data;
473-
int ret;
474481

475-
bc_data = of_device_get_match_data(dev);
476-
if (!bc_data)
482+
if (pm_runtime_suspended(dev))
477483
return 0;
478484

479-
if (bc_data->rpm_enabled) {
480-
ret = pm_runtime_get_sync(bc->dev);
481-
if (ret < 0) {
482-
pm_runtime_put_noidle(bc->dev);
483-
return ret;
484-
}
485-
}
486-
487-
bc->clk_reg_restore = readl(bc->base + bc_data->clk_reg_offset);
485+
bc->clk_reg_restore = readl(bc->base + bc->pdata->clk_reg_offset);
486+
clk_disable_unprepare(bc->clk_apb);
488487

489488
return 0;
490489
}
491490

492491
static int imx95_bc_resume(struct device *dev)
493492
{
494493
struct imx95_blk_ctl *bc = dev_get_drvdata(dev);
495-
const struct imx95_blk_ctl_dev_data *bc_data;
494+
int ret;
496495

497-
bc_data = of_device_get_match_data(dev);
498-
if (!bc_data)
496+
if (pm_runtime_suspended(dev))
499497
return 0;
500498

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

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

506505
return 0;
507506
}

drivers/clk/keystone/sci-clk.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,13 +480,10 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider)
480480
num_clks++;
481481
}
482482

483-
provider->clocks = devm_kmalloc_array(dev, num_clks, sizeof(sci_clk),
484-
GFP_KERNEL);
483+
provider->clocks = devm_kmemdup_array(dev, clks, num_clks, sizeof(sci_clk), GFP_KERNEL);
485484
if (!provider->clocks)
486485
return -ENOMEM;
487486

488-
memcpy(provider->clocks, clks, num_clks * sizeof(sci_clk));
489-
490487
provider->num_clocks = num_clks;
491488

492489
devm_kfree(dev, clks);

drivers/clk/sunxi-ng/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ config SUN55I_A523_CCU
5757
default ARCH_SUNXI
5858
depends on ARM64 || COMPILE_TEST
5959

60+
config SUN55I_A523_MCU_CCU
61+
tristate "Support for the Allwinner A523/T527 MCU CCU"
62+
default ARCH_SUNXI
63+
depends on ARM64 || COMPILE_TEST
64+
6065
config SUN55I_A523_R_CCU
6166
tristate "Support for the Allwinner A523/T527 PRCM CCU"
6267
default ARCH_SUNXI

drivers/clk/sunxi-ng/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ obj-$(CONFIG_SUN50I_H6_CCU) += sun50i-h6-ccu.o
3434
obj-$(CONFIG_SUN50I_H6_R_CCU) += sun50i-h6-r-ccu.o
3535
obj-$(CONFIG_SUN50I_H616_CCU) += sun50i-h616-ccu.o
3636
obj-$(CONFIG_SUN55I_A523_CCU) += sun55i-a523-ccu.o
37+
obj-$(CONFIG_SUN55I_A523_MCU_CCU) += sun55i-a523-mcu-ccu.o
3738
obj-$(CONFIG_SUN55I_A523_R_CCU) += sun55i-a523-r-ccu.o
3839
obj-$(CONFIG_SUN4I_A10_CCU) += sun4i-a10-ccu.o
3940
obj-$(CONFIG_SUN5I_CCU) += sun5i-ccu.o
@@ -61,6 +62,7 @@ sun50i-h6-ccu-y += ccu-sun50i-h6.o
6162
sun50i-h6-r-ccu-y += ccu-sun50i-h6-r.o
6263
sun50i-h616-ccu-y += ccu-sun50i-h616.o
6364
sun55i-a523-ccu-y += ccu-sun55i-a523.o
65+
sun55i-a523-mcu-ccu-y += ccu-sun55i-a523-mcu.o
6466
sun55i-a523-r-ccu-y += ccu-sun55i-a523-r.o
6567
sun4i-a10-ccu-y += ccu-sun4i-a10.o
6668
sun5i-ccu-y += ccu-sun5i.o

0 commit comments

Comments
 (0)