Skip to content

Commit b7f257c

Browse files
committed
Merge branches 'clk-fixed-rate', 'clk-spreadtrum', 'clk-pxa' and 'clk-ti' into clk-next
- More devm helpers for fixed rate registration - Add Spreadtrum UMS512 SoC clk support - Various PXA168 clk driver fixes * clk-fixed-rate: clk: fixed-rate: add devm_clk_hw_register_fixed_rate clk: asm9260: use parent index to link the reference clock * clk-spreadtrum: clk: sprd: Add clocks support for UMS512 * clk-pxa: clk: pxa: add a check for the return value of kzalloc() clk: mmp: pxa168: control shared SDH bits with separate clock dt-bindings: marvell,pxa168: add clock ids for SDH AXI clocks clk: mmp: pxa168: add clocks for SDH2 and SDH3 dt-bindings: marvell,pxa168: add clock id for SDH3 clk: mmp: pxa168: fix GPIO clock enable bits clk: mmp: pxa168: add muxes for more peripherals clk: mmp: pxa168: fix incorrect parent clocks clk: mmp: pxa168: fix const-correctness clk: mmp: pxa168: add new clocks for peripherals dt-bindings: marvell,pxa168: add clock ids for additional dividers clk: mmp: pxa168: fix incorrect dividers clk: mmp: pxa168: add additional register defines * clk-ti: clk: davinci: cfgchip: Use dev_err_probe() helper clk: davinci: pll: fix spelling typo in comment MAINTAINERS: add header file to TI DAVINCI SERIES CLOCK DRIVER
5 parents 26bebbf + 1d7d206 + af3bd36 + 117a154 + 3475c88 commit b7f257c

File tree

12 files changed

+2379
-62
lines changed

12 files changed

+2379
-62
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20308,6 +20308,7 @@ R: Sekhar Nori <nsekhar@ti.com>
2030820308
S: Maintained
2030920309
F: Documentation/devicetree/bindings/clock/ti/davinci/
2031020310
F: drivers/clk/davinci/
20311+
F: include/linux/clk/davinci.h
2031120312

2031220313
TI DAVINCI SERIES GPIO DRIVER
2031320314
M: Keerthy <j-keerthy@ti.com>

drivers/clk/clk-asm9260.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct asm9260_mux_clock {
8080
u8 mask;
8181
u32 *table;
8282
const char *name;
83-
const char **parent_names;
83+
const struct clk_parent_data *parent_data;
8484
u8 num_parents;
8585
unsigned long offset;
8686
unsigned long flags;
@@ -232,10 +232,10 @@ static const struct asm9260_gate_data asm9260_ahb_gates[] __initconst = {
232232
HW_AHBCLKCTRL1, 16 },
233233
};
234234

235-
static const char __initdata *main_mux_p[] = { NULL, NULL };
236-
static const char __initdata *i2s0_mux_p[] = { NULL, NULL, "i2s0m_div"};
237-
static const char __initdata *i2s1_mux_p[] = { NULL, NULL, "i2s1m_div"};
238-
static const char __initdata *clkout_mux_p[] = { NULL, NULL, "rtc"};
235+
static struct clk_parent_data __initdata main_mux_p[] = { { .index = 0, }, { .name = "pll" } };
236+
static struct clk_parent_data __initdata i2s0_mux_p[] = { { .index = 0, }, { .name = "pll" }, { .name = "i2s0m_div"} };
237+
static struct clk_parent_data __initdata i2s1_mux_p[] = { { .index = 0, }, { .name = "pll" }, { .name = "i2s1m_div"} };
238+
static struct clk_parent_data __initdata clkout_mux_p[] = { { .index = 0, }, { .name = "pll" }, { .name = "rtc"} };
239239
static u32 three_mux_table[] = {0, 1, 3};
240240

241241
static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = {
@@ -255,9 +255,10 @@ static struct asm9260_mux_clock asm9260_mux_clks[] __initdata = {
255255

256256
static void __init asm9260_acc_init(struct device_node *np)
257257
{
258-
struct clk_hw *hw;
258+
struct clk_hw *hw, *pll_hw;
259259
struct clk_hw **hws;
260-
const char *ref_clk, *pll_clk = "pll";
260+
const char *pll_clk = "pll";
261+
struct clk_parent_data pll_parent_data = { .index = 0 };
261262
u32 rate;
262263
int n;
263264

@@ -274,21 +275,15 @@ static void __init asm9260_acc_init(struct device_node *np)
274275
/* register pll */
275276
rate = (ioread32(base + HW_SYSPLLCTRL) & 0xffff) * 1000000;
276277

277-
/* TODO: Convert to DT parent scheme */
278-
ref_clk = of_clk_get_parent_name(np, 0);
279-
hw = __clk_hw_register_fixed_rate(NULL, NULL, pll_clk,
280-
ref_clk, NULL, NULL, 0, rate, 0,
281-
CLK_FIXED_RATE_PARENT_ACCURACY);
282-
283-
if (IS_ERR(hw))
278+
pll_hw = clk_hw_register_fixed_rate_parent_accuracy(NULL, pll_clk, &pll_parent_data,
279+
0, rate);
280+
if (IS_ERR(pll_hw))
284281
panic("%pOFn: can't register REFCLK. Check DT!", np);
285282

286283
for (n = 0; n < ARRAY_SIZE(asm9260_mux_clks); n++) {
287284
const struct asm9260_mux_clock *mc = &asm9260_mux_clks[n];
288285

289-
mc->parent_names[0] = ref_clk;
290-
mc->parent_names[1] = pll_clk;
291-
hw = clk_hw_register_mux_table(NULL, mc->name, mc->parent_names,
286+
hw = clk_hw_register_mux_table_parent_data(NULL, mc->name, mc->parent_data,
292287
mc->num_parents, mc->flags, base + mc->offset,
293288
0, mc->mask, 0, mc->table, &asm9260_clk_lock);
294289
}

drivers/clk/clk-fixed-rate.c

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,36 @@ const struct clk_ops clk_fixed_rate_ops = {
4949
};
5050
EXPORT_SYMBOL_GPL(clk_fixed_rate_ops);
5151

52+
static void devm_clk_hw_register_fixed_rate_release(struct device *dev, void *res)
53+
{
54+
struct clk_fixed_rate *fix = res;
55+
56+
/*
57+
* We can not use clk_hw_unregister_fixed_rate, since it will kfree()
58+
* the hw, resulting in double free. Just unregister the hw and let
59+
* devres code kfree() it.
60+
*/
61+
clk_hw_unregister(&fix->hw);
62+
}
63+
5264
struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
5365
struct device_node *np, const char *name,
5466
const char *parent_name, const struct clk_hw *parent_hw,
5567
const struct clk_parent_data *parent_data, unsigned long flags,
5668
unsigned long fixed_rate, unsigned long fixed_accuracy,
57-
unsigned long clk_fixed_flags)
69+
unsigned long clk_fixed_flags, bool devm)
5870
{
5971
struct clk_fixed_rate *fixed;
6072
struct clk_hw *hw;
6173
struct clk_init_data init = {};
6274
int ret = -EINVAL;
6375

6476
/* allocate fixed-rate clock */
65-
fixed = kzalloc(sizeof(*fixed), GFP_KERNEL);
77+
if (devm)
78+
fixed = devres_alloc(devm_clk_hw_register_fixed_rate_release,
79+
sizeof(*fixed), GFP_KERNEL);
80+
else
81+
fixed = kzalloc(sizeof(*fixed), GFP_KERNEL);
6682
if (!fixed)
6783
return ERR_PTR(-ENOMEM);
6884

@@ -90,9 +106,13 @@ struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev,
90106
else
91107
ret = of_clk_hw_register(np, hw);
92108
if (ret) {
93-
kfree(fixed);
109+
if (devm)
110+
devres_free(fixed);
111+
else
112+
kfree(fixed);
94113
hw = ERR_PTR(ret);
95-
}
114+
} else if (devm)
115+
devres_add(dev, fixed);
96116

97117
return hw;
98118
}

drivers/clk/davinci/da8xx-cfgchip.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,7 @@ da8xx_cfgchip_register_usb0_clk48(struct device *dev,
510510

511511
fck_clk = devm_clk_get(dev, "fck");
512512
if (IS_ERR(fck_clk)) {
513-
if (PTR_ERR(fck_clk) != -EPROBE_DEFER)
514-
dev_err(dev, "Missing fck clock\n");
513+
dev_err_probe(dev, PTR_ERR(fck_clk), "Missing fck clock\n");
515514
return ERR_CAST(fck_clk);
516515
}
517516

drivers/clk/davinci/pll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
* @hw: clk_hw for the pll
9999
* @base: Base memory address
100100
* @pllm_min: The minimum allowable PLLM[PLLM] value
101-
* @pllm_max: The maxiumum allowable PLLM[PLLM] value
101+
* @pllm_max: The maximum allowable PLLM[PLLM] value
102102
* @pllm_mask: Bitmask for PLLM[PLLM] value
103103
*/
104104
struct davinci_pll_clk {

drivers/clk/mmp/clk-of-pxa168.c

Lines changed: 82 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,47 @@
1919
#include "clk.h"
2020
#include "reset.h"
2121

22-
#define APBC_RTC 0x28
23-
#define APBC_TWSI0 0x2c
24-
#define APBC_KPC 0x30
2522
#define APBC_UART0 0x0
2623
#define APBC_UART1 0x4
2724
#define APBC_GPIO 0x8
2825
#define APBC_PWM0 0xc
2926
#define APBC_PWM1 0x10
3027
#define APBC_PWM2 0x14
3128
#define APBC_PWM3 0x18
29+
#define APBC_RTC 0x28
30+
#define APBC_TWSI0 0x2c
31+
#define APBC_KPC 0x30
3232
#define APBC_TIMER 0x34
33+
#define APBC_AIB 0x3c
34+
#define APBC_SW_JTAG 0x40
35+
#define APBC_ONEWIRE 0x48
36+
#define APBC_TWSI1 0x6c
37+
#define APBC_UART2 0x70
38+
#define APBC_AC97 0x84
3339
#define APBC_SSP0 0x81c
3440
#define APBC_SSP1 0x820
3541
#define APBC_SSP2 0x84c
3642
#define APBC_SSP3 0x858
3743
#define APBC_SSP4 0x85c
38-
#define APBC_TWSI1 0x6c
39-
#define APBC_UART2 0x70
44+
#define APMU_DISP0 0x4c
45+
#define APMU_CCIC0 0x50
4046
#define APMU_SDH0 0x54
4147
#define APMU_SDH1 0x58
4248
#define APMU_USB 0x5c
43-
#define APMU_DISP0 0x4c
44-
#define APMU_CCIC0 0x50
4549
#define APMU_DFC 0x60
50+
#define APMU_DMA 0x64
51+
#define APMU_BUS 0x6c
52+
#define APMU_GC 0xcc
53+
#define APMU_SMC 0xd4
54+
#define APMU_XD 0xdc
55+
#define APMU_SDH2 0xe0
56+
#define APMU_SDH3 0xe4
57+
#define APMU_CF 0xf0
58+
#define APMU_MSP 0xf4
59+
#define APMU_CMU 0xf8
60+
#define APMU_FE 0xfc
61+
#define APMU_PCIE 0x100
62+
#define APMU_EPD 0x104
4663
#define MPMU_UART_PLL 0x14
4764

4865
struct pxa168_clk_unit {
@@ -71,9 +88,12 @@ static struct mmp_param_fixed_factor_clk fixed_factor_clks[] = {
7188
{PXA168_CLK_PLL1_96, "pll1_96", "pll1_48", 1, 2, 0},
7289
{PXA168_CLK_PLL1_192, "pll1_192", "pll1_96", 1, 2, 0},
7390
{PXA168_CLK_PLL1_13, "pll1_13", "pll1", 1, 13, 0},
74-
{PXA168_CLK_PLL1_13_1_5, "pll1_13_1_5", "pll1_13", 2, 3, 0},
75-
{PXA168_CLK_PLL1_2_1_5, "pll1_2_1_5", "pll1_2", 2, 3, 0},
91+
{PXA168_CLK_PLL1_13_1_5, "pll1_13_1_5", "pll1_13", 1, 5, 0},
92+
{PXA168_CLK_PLL1_2_1_5, "pll1_2_1_5", "pll1_2", 1, 5, 0},
7693
{PXA168_CLK_PLL1_3_16, "pll1_3_16", "pll1", 3, 16, 0},
94+
{PXA168_CLK_PLL1_2_1_10, "pll1_2_1_10", "pll1_2", 1, 10, 0},
95+
{PXA168_CLK_PLL1_2_3_16, "pll1_2_3_16", "pll1_2", 3, 16, 0},
96+
{PXA168_CLK_CLK32_2, "clk32_2", "clk32", 1, 2, 0},
7797
};
7898

7999
static struct mmp_clk_factor_masks uart_factor_masks = {
@@ -107,24 +127,44 @@ static void pxa168_pll_init(struct pxa168_clk_unit *pxa_unit)
107127
mmp_clk_add(unit, PXA168_CLK_UART_PLL, clk);
108128
}
109129

130+
static DEFINE_SPINLOCK(twsi0_lock);
131+
static DEFINE_SPINLOCK(twsi1_lock);
132+
static const char * const twsi_parent_names[] = {"pll1_2_1_10", "pll1_2_1_5"};
133+
134+
static DEFINE_SPINLOCK(kpc_lock);
135+
static const char * const kpc_parent_names[] = {"clk32", "clk32_2", "pll1_24"};
136+
137+
static DEFINE_SPINLOCK(pwm0_lock);
138+
static DEFINE_SPINLOCK(pwm1_lock);
139+
static DEFINE_SPINLOCK(pwm2_lock);
140+
static DEFINE_SPINLOCK(pwm3_lock);
141+
static const char * const pwm_parent_names[] = {"pll1_48", "clk32"};
142+
110143
static DEFINE_SPINLOCK(uart0_lock);
111144
static DEFINE_SPINLOCK(uart1_lock);
112145
static DEFINE_SPINLOCK(uart2_lock);
113-
static const char *uart_parent_names[] = {"pll1_3_16", "uart_pll"};
146+
static const char * const uart_parent_names[] = {"pll1_2_3_16", "uart_pll"};
114147

115148
static DEFINE_SPINLOCK(ssp0_lock);
116149
static DEFINE_SPINLOCK(ssp1_lock);
117150
static DEFINE_SPINLOCK(ssp2_lock);
118151
static DEFINE_SPINLOCK(ssp3_lock);
119152
static DEFINE_SPINLOCK(ssp4_lock);
120-
static const char *ssp_parent_names[] = {"pll1_96", "pll1_48", "pll1_24", "pll1_12"};
153+
static const char * const ssp_parent_names[] = {"pll1_96", "pll1_48", "pll1_24", "pll1_12"};
121154

122155
static DEFINE_SPINLOCK(timer_lock);
123-
static const char *timer_parent_names[] = {"pll1_48", "clk32", "pll1_96", "pll1_192"};
156+
static const char * const timer_parent_names[] = {"pll1_48", "clk32", "pll1_96", "pll1_192"};
124157

125158
static DEFINE_SPINLOCK(reset_lock);
126159

127160
static struct mmp_param_mux_clk apbc_mux_clks[] = {
161+
{0, "twsi0_mux", twsi_parent_names, ARRAY_SIZE(twsi_parent_names), CLK_SET_RATE_PARENT, APBC_TWSI0, 4, 3, 0, &twsi0_lock},
162+
{0, "twsi1_mux", twsi_parent_names, ARRAY_SIZE(twsi_parent_names), CLK_SET_RATE_PARENT, APBC_TWSI1, 4, 3, 0, &twsi1_lock},
163+
{0, "kpc_mux", kpc_parent_names, ARRAY_SIZE(kpc_parent_names), CLK_SET_RATE_PARENT, APBC_KPC, 4, 3, 0, &kpc_lock},
164+
{0, "pwm0_mux", pwm_parent_names, ARRAY_SIZE(pwm_parent_names), CLK_SET_RATE_PARENT, APBC_PWM0, 4, 3, 0, &pwm0_lock},
165+
{0, "pwm1_mux", pwm_parent_names, ARRAY_SIZE(pwm_parent_names), CLK_SET_RATE_PARENT, APBC_PWM1, 4, 3, 0, &pwm1_lock},
166+
{0, "pwm2_mux", pwm_parent_names, ARRAY_SIZE(pwm_parent_names), CLK_SET_RATE_PARENT, APBC_PWM2, 4, 3, 0, &pwm2_lock},
167+
{0, "pwm3_mux", pwm_parent_names, ARRAY_SIZE(pwm_parent_names), CLK_SET_RATE_PARENT, APBC_PWM3, 4, 3, 0, &pwm3_lock},
128168
{0, "uart0_mux", uart_parent_names, ARRAY_SIZE(uart_parent_names), CLK_SET_RATE_PARENT, APBC_UART0, 4, 3, 0, &uart0_lock},
129169
{0, "uart1_mux", uart_parent_names, ARRAY_SIZE(uart_parent_names), CLK_SET_RATE_PARENT, APBC_UART1, 4, 3, 0, &uart1_lock},
130170
{0, "uart2_mux", uart_parent_names, ARRAY_SIZE(uart_parent_names), CLK_SET_RATE_PARENT, APBC_UART2, 4, 3, 0, &uart2_lock},
@@ -137,16 +177,15 @@ static struct mmp_param_mux_clk apbc_mux_clks[] = {
137177
};
138178

139179
static struct mmp_param_gate_clk apbc_gate_clks[] = {
140-
{PXA168_CLK_TWSI0, "twsi0_clk", "pll1_13_1_5", CLK_SET_RATE_PARENT, APBC_TWSI0, 0x3, 0x3, 0x0, 0, &reset_lock},
141-
{PXA168_CLK_TWSI1, "twsi1_clk", "pll1_13_1_5", CLK_SET_RATE_PARENT, APBC_TWSI1, 0x3, 0x3, 0x0, 0, &reset_lock},
142-
{PXA168_CLK_GPIO, "gpio_clk", "vctcxo", CLK_SET_RATE_PARENT, APBC_GPIO, 0x3, 0x3, 0x0, 0, &reset_lock},
143-
{PXA168_CLK_KPC, "kpc_clk", "clk32", CLK_SET_RATE_PARENT, APBC_KPC, 0x3, 0x3, 0x0, MMP_CLK_GATE_NEED_DELAY, NULL},
180+
{PXA168_CLK_TWSI0, "twsi0_clk", "twsi0_mux", CLK_SET_RATE_PARENT, APBC_TWSI0, 0x3, 0x3, 0x0, 0, &twsi0_lock},
181+
{PXA168_CLK_TWSI1, "twsi1_clk", "twsi1_mux", CLK_SET_RATE_PARENT, APBC_TWSI1, 0x3, 0x3, 0x0, 0, &twsi1_lock},
182+
{PXA168_CLK_GPIO, "gpio_clk", "vctcxo", CLK_SET_RATE_PARENT, APBC_GPIO, 0x1, 0x1, 0x0, 0, &reset_lock},
183+
{PXA168_CLK_KPC, "kpc_clk", "kpc_mux", CLK_SET_RATE_PARENT, APBC_KPC, 0x3, 0x3, 0x0, MMP_CLK_GATE_NEED_DELAY, &kpc_lock},
144184
{PXA168_CLK_RTC, "rtc_clk", "clk32", CLK_SET_RATE_PARENT, APBC_RTC, 0x83, 0x83, 0x0, MMP_CLK_GATE_NEED_DELAY, NULL},
145-
{PXA168_CLK_PWM0, "pwm0_clk", "pll1_48", CLK_SET_RATE_PARENT, APBC_PWM0, 0x3, 0x3, 0x0, 0, &reset_lock},
146-
{PXA168_CLK_PWM1, "pwm1_clk", "pll1_48", CLK_SET_RATE_PARENT, APBC_PWM1, 0x3, 0x3, 0x0, 0, &reset_lock},
147-
{PXA168_CLK_PWM2, "pwm2_clk", "pll1_48", CLK_SET_RATE_PARENT, APBC_PWM2, 0x3, 0x3, 0x0, 0, &reset_lock},
148-
{PXA168_CLK_PWM3, "pwm3_clk", "pll1_48", CLK_SET_RATE_PARENT, APBC_PWM3, 0x3, 0x3, 0x0, 0, &reset_lock},
149-
/* The gate clocks has mux parent. */
185+
{PXA168_CLK_PWM0, "pwm0_clk", "pwm0_mux", CLK_SET_RATE_PARENT, APBC_PWM0, 0x3, 0x3, 0x0, 0, &pwm0_lock},
186+
{PXA168_CLK_PWM1, "pwm1_clk", "pwm1_mux", CLK_SET_RATE_PARENT, APBC_PWM1, 0x3, 0x3, 0x0, 0, &pwm1_lock},
187+
{PXA168_CLK_PWM2, "pwm2_clk", "pwm2_mux", CLK_SET_RATE_PARENT, APBC_PWM2, 0x3, 0x3, 0x0, 0, &pwm2_lock},
188+
{PXA168_CLK_PWM3, "pwm3_clk", "pwm3_mux", CLK_SET_RATE_PARENT, APBC_PWM3, 0x3, 0x3, 0x0, 0, &pwm3_lock},
150189
{PXA168_CLK_UART0, "uart0_clk", "uart0_mux", CLK_SET_RATE_PARENT, APBC_UART0, 0x3, 0x3, 0x0, 0, &uart0_lock},
151190
{PXA168_CLK_UART1, "uart1_clk", "uart1_mux", CLK_SET_RATE_PARENT, APBC_UART1, 0x3, 0x3, 0x0, 0, &uart1_lock},
152191
{PXA168_CLK_UART2, "uart2_clk", "uart2_mux", CLK_SET_RATE_PARENT, APBC_UART2, 0x3, 0x3, 0x0, 0, &uart2_lock},
@@ -170,22 +209,30 @@ static void pxa168_apb_periph_clk_init(struct pxa168_clk_unit *pxa_unit)
170209

171210
}
172211

212+
static DEFINE_SPINLOCK(dfc_lock);
213+
static const char * const dfc_parent_names[] = {"pll1_4", "pll1_8"};
214+
173215
static DEFINE_SPINLOCK(sdh0_lock);
174216
static DEFINE_SPINLOCK(sdh1_lock);
175-
static const char *sdh_parent_names[] = {"pll1_12", "pll1_13"};
217+
static DEFINE_SPINLOCK(sdh2_lock);
218+
static DEFINE_SPINLOCK(sdh3_lock);
219+
static const char * const sdh_parent_names[] = {"pll1_13", "pll1_12", "pll1_8"};
176220

177221
static DEFINE_SPINLOCK(usb_lock);
178222

179223
static DEFINE_SPINLOCK(disp0_lock);
180-
static const char *disp_parent_names[] = {"pll1_2", "pll1_12"};
224+
static const char * const disp_parent_names[] = {"pll1", "pll1_2"};
181225

182226
static DEFINE_SPINLOCK(ccic0_lock);
183-
static const char *ccic_parent_names[] = {"pll1_2", "pll1_12"};
184-
static const char *ccic_phy_parent_names[] = {"pll1_6", "pll1_12"};
227+
static const char * const ccic_parent_names[] = {"pll1_4", "pll1_8"};
228+
static const char * const ccic_phy_parent_names[] = {"pll1_6", "pll1_12"};
185229

186230
static struct mmp_param_mux_clk apmu_mux_clks[] = {
187-
{0, "sdh0_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH0, 6, 1, 0, &sdh0_lock},
188-
{0, "sdh1_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH1, 6, 1, 0, &sdh1_lock},
231+
{0, "dfc_mux", dfc_parent_names, ARRAY_SIZE(dfc_parent_names), CLK_SET_RATE_PARENT, APMU_DFC, 6, 1, 0, &dfc_lock},
232+
{0, "sdh0_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH0, 6, 2, 0, &sdh0_lock},
233+
{0, "sdh1_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH1, 6, 2, 0, &sdh1_lock},
234+
{0, "sdh2_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH2, 6, 2, 0, &sdh2_lock},
235+
{0, "sdh3_mux", sdh_parent_names, ARRAY_SIZE(sdh_parent_names), CLK_SET_RATE_PARENT, APMU_SDH3, 6, 2, 0, &sdh3_lock},
189236
{0, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 1, 0, &disp0_lock},
190237
{0, "ccic0_mux", ccic_parent_names, ARRAY_SIZE(ccic_parent_names), CLK_SET_RATE_PARENT, APMU_CCIC0, 6, 1, 0, &ccic0_lock},
191238
{0, "ccic0_phy_mux", ccic_phy_parent_names, ARRAY_SIZE(ccic_phy_parent_names), CLK_SET_RATE_PARENT, APMU_CCIC0, 7, 1, 0, &ccic0_lock},
@@ -196,12 +243,16 @@ static struct mmp_param_div_clk apmu_div_clks[] = {
196243
};
197244

198245
static struct mmp_param_gate_clk apmu_gate_clks[] = {
199-
{PXA168_CLK_DFC, "dfc_clk", "pll1_4", CLK_SET_RATE_PARENT, APMU_DFC, 0x19b, 0x19b, 0x0, 0, NULL},
246+
{PXA168_CLK_DFC, "dfc_clk", "dfc_mux", CLK_SET_RATE_PARENT, APMU_DFC, 0x19b, 0x19b, 0x0, 0, &dfc_lock},
200247
{PXA168_CLK_USB, "usb_clk", "usb_pll", 0, APMU_USB, 0x9, 0x9, 0x0, 0, &usb_lock},
201248
{PXA168_CLK_SPH, "sph_clk", "usb_pll", 0, APMU_USB, 0x12, 0x12, 0x0, 0, &usb_lock},
202-
/* The gate clocks has mux parent. */
203-
{PXA168_CLK_SDH0, "sdh0_clk", "sdh0_mux", CLK_SET_RATE_PARENT, APMU_SDH0, 0x1b, 0x1b, 0x0, 0, &sdh0_lock},
204-
{PXA168_CLK_SDH1, "sdh1_clk", "sdh1_mux", CLK_SET_RATE_PARENT, APMU_SDH1, 0x1b, 0x1b, 0x0, 0, &sdh1_lock},
249+
{PXA168_CLK_SDH0, "sdh0_clk", "sdh0_mux", CLK_SET_RATE_PARENT, APMU_SDH0, 0x12, 0x12, 0x0, 0, &sdh0_lock},
250+
{PXA168_CLK_SDH1, "sdh1_clk", "sdh1_mux", CLK_SET_RATE_PARENT, APMU_SDH1, 0x12, 0x12, 0x0, 0, &sdh1_lock},
251+
{PXA168_CLK_SDH2, "sdh2_clk", "sdh2_mux", CLK_SET_RATE_PARENT, APMU_SDH2, 0x12, 0x12, 0x0, 0, &sdh2_lock},
252+
{PXA168_CLK_SDH3, "sdh3_clk", "sdh3_mux", CLK_SET_RATE_PARENT, APMU_SDH3, 0x12, 0x12, 0x0, 0, &sdh3_lock},
253+
/* SDH0/1 and 2/3 AXI clocks are also gated by common bits in SDH0 and SDH2 registers */
254+
{PXA168_CLK_SDH01_AXI, "sdh01_axi_clk", NULL, CLK_SET_RATE_PARENT, APMU_SDH0, 0x9, 0x9, 0x0, 0, &sdh0_lock},
255+
{PXA168_CLK_SDH23_AXI, "sdh23_axi_clk", NULL, CLK_SET_RATE_PARENT, APMU_SDH2, 0x9, 0x9, 0x0, 0, &sdh2_lock},
205256
{PXA168_CLK_DISP0, "disp0_clk", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 0x1b, 0x1b, 0x0, 0, &disp0_lock},
206257
{PXA168_CLK_CCIC0, "ccic0_clk", "ccic0_mux", CLK_SET_RATE_PARENT, APMU_CCIC0, 0x1b, 0x1b, 0x0, 0, &ccic0_lock},
207258
{PXA168_CLK_CCIC0_PHY, "ccic0_phy_clk", "ccic0_phy_mux", CLK_SET_RATE_PARENT, APMU_CCIC0, 0x24, 0x24, 0x0, 0, &ccic0_lock},

drivers/clk/pxa/clk-pxa.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ int __init clk_pxa_cken_init(const struct desc_clk_cken *clks,
104104

105105
for (i = 0; i < nb_clks; i++) {
106106
pxa_clk = kzalloc(sizeof(*pxa_clk), GFP_KERNEL);
107+
if (!pxa_clk)
108+
return -ENOMEM;
107109
pxa_clk->is_in_low_power = clks[i].is_in_low_power;
108110
pxa_clk->lp = clks[i].lp;
109111
pxa_clk->hp = clks[i].hp;

drivers/clk/sprd/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@ config SPRD_SC9863A_CLK
2121
help
2222
Support for the global clock controller on sc9863a devices.
2323
Say Y if you want to use peripheral devices on sc9863a SoC.
24+
25+
config SPRD_UMS512_CLK
26+
tristate "Support for the Spreadtrum UMS512 clocks"
27+
help
28+
Support for the global clock controller on ums512 devices.
29+
Say Y if you want to use peripheral devices on ums512 SoC.
2430
endif

drivers/clk/sprd/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ clk-sprd-y += pll.o
1111
## SoC support
1212
obj-$(CONFIG_SPRD_SC9860_CLK) += sc9860-clk.o
1313
obj-$(CONFIG_SPRD_SC9863A_CLK) += sc9863a-clk.o
14+
obj-$(CONFIG_SPRD_UMS512_CLK) += ums512-clk.o

0 commit comments

Comments
 (0)