Skip to content

Commit 76b77f1

Browse files
committed
Merge tag 'imx-clk-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into clk-imx
Pull i.MX clk driver changes from Shawn Guo: - A series from Abel Vesa to switch i.MX6 and i.MX7 clock drivers to clk_hw based API - Add GPIO, SNVS and GIC clocks for i.MX8 drivers - Create a common function imx_mmdc_mask_handshake() for masking MMDC handshake - Drop __init for function imx_check_clocks() and imx_register_uart_clocks(), so that they can be used by i.MX8 clock drivers which use driver model - Use devm_platform_ioremap_resource() instead of of_iomap() for imx8mq clock driver - Mark imx6sx/ul/ull/sll MMDC_P1_IPG and imx8mm DRAM_APB as critical clock. - Correct imx7ulp nic1_bus_clk and imx8mm audio_pll2_clk clock setting * tag 'imx-clk-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: (38 commits) clk: imx8mq: Keep uart clocks on during system boot clk: imx: Remove __init for imx_register_uart_clocks() API clk: imx6q: fix section mismatch warning clk: imx8mq: Use devm_platform_ioremap_resource() instead of of_iomap() clk: imx8mq: Use imx_check_clocks() API directly clk: imx: Remove __init for imx_check_clocks() API clk: imx6sll: Switch to clk_hw based API clk: imx7d: Switch to clk_hw based API clk: imx6ul: Switch to clk_hw based API clk: imx6sx: Switch to clk_hw based API clk: imx6q: Switch to clk_hw based API clk: imx6sl: Switch to clk_hw based API clk: imx: Switch wrappers to clk_hw based API clk: imx: clk-fixup-mux: Switch to clk_hw based API clk: imx: clk-fixup-div: Switch to clk_hw based API clk: imx: clk-gate-exclusive: Switch to clk_hw based API clk: imx: clk-pfd: Switch to clk_hw based API clk: imx: clk-pllv3: Switch to clk_hw based API clk: imx: clk-gate2: Switch to clk_hw based API clk: imx: clk-cpu: Switch to clk_hw based API ...
2 parents a188339 + 15c64ff commit 76b77f1

21 files changed

Lines changed: 2225 additions & 1994 deletions

‎drivers/clk/imx/clk-busy.c‎

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,14 @@ static const struct clk_ops clk_busy_divider_ops = {
7878
.set_rate = clk_busy_divider_set_rate,
7979
};
8080

81-
struct clk *imx_clk_busy_divider(const char *name, const char *parent_name,
81+
struct clk_hw *imx_clk_hw_busy_divider(const char *name, const char *parent_name,
8282
void __iomem *reg, u8 shift, u8 width,
8383
void __iomem *busy_reg, u8 busy_shift)
8484
{
8585
struct clk_busy_divider *busy;
86-
struct clk *clk;
86+
struct clk_hw *hw;
8787
struct clk_init_data init;
88+
int ret;
8889

8990
busy = kzalloc(sizeof(*busy), GFP_KERNEL);
9091
if (!busy)
@@ -107,11 +108,15 @@ struct clk *imx_clk_busy_divider(const char *name, const char *parent_name,
107108

108109
busy->div.hw.init = &init;
109110

110-
clk = clk_register(NULL, &busy->div.hw);
111-
if (IS_ERR(clk))
111+
hw = &busy->div.hw;
112+
113+
ret = clk_hw_register(NULL, hw);
114+
if (ret) {
112115
kfree(busy);
116+
return ERR_PTR(ret);
117+
}
113118

114-
return clk;
119+
return hw;
115120
}
116121

117122
struct clk_busy_mux {
@@ -152,13 +157,14 @@ static const struct clk_ops clk_busy_mux_ops = {
152157
.set_parent = clk_busy_mux_set_parent,
153158
};
154159

155-
struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift,
160+
struct clk_hw *imx_clk_hw_busy_mux(const char *name, void __iomem *reg, u8 shift,
156161
u8 width, void __iomem *busy_reg, u8 busy_shift,
157162
const char * const *parent_names, int num_parents)
158163
{
159164
struct clk_busy_mux *busy;
160-
struct clk *clk;
165+
struct clk_hw *hw;
161166
struct clk_init_data init;
167+
int ret;
162168

163169
busy = kzalloc(sizeof(*busy), GFP_KERNEL);
164170
if (!busy)
@@ -181,9 +187,13 @@ struct clk *imx_clk_busy_mux(const char *name, void __iomem *reg, u8 shift,
181187

182188
busy->mux.hw.init = &init;
183189

184-
clk = clk_register(NULL, &busy->mux.hw);
185-
if (IS_ERR(clk))
190+
hw = &busy->mux.hw;
191+
192+
ret = clk_hw_register(NULL, hw);
193+
if (ret) {
186194
kfree(busy);
195+
return ERR_PTR(ret);
196+
}
187197

188-
return clk;
198+
return hw;
189199
}

‎drivers/clk/imx/clk-cpu.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@ static const struct clk_ops clk_cpu_ops = {
7575
.set_rate = clk_cpu_set_rate,
7676
};
7777

78-
struct clk *imx_clk_cpu(const char *name, const char *parent_name,
78+
struct clk_hw *imx_clk_hw_cpu(const char *name, const char *parent_name,
7979
struct clk *div, struct clk *mux, struct clk *pll,
8080
struct clk *step)
8181
{
8282
struct clk_cpu *cpu;
83-
struct clk *clk;
83+
struct clk_hw *hw;
8484
struct clk_init_data init;
85+
int ret;
8586

8687
cpu = kzalloc(sizeof(*cpu), GFP_KERNEL);
8788
if (!cpu)
@@ -99,10 +100,13 @@ struct clk *imx_clk_cpu(const char *name, const char *parent_name,
99100
init.num_parents = 1;
100101

101102
cpu->hw.init = &init;
103+
hw = &cpu->hw;
102104

103-
clk = clk_register(NULL, &cpu->hw);
104-
if (IS_ERR(clk))
105+
ret = clk_hw_register(NULL, hw);
106+
if (ret) {
105107
kfree(cpu);
108+
return ERR_PTR(ret);
109+
}
106110

107-
return clk;
111+
return hw;
108112
}

‎drivers/clk/imx/clk-fixup-div.c‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ static const struct clk_ops clk_fixup_div_ops = {
9191
.set_rate = clk_fixup_div_set_rate,
9292
};
9393

94-
struct clk *imx_clk_fixup_divider(const char *name, const char *parent,
94+
struct clk_hw *imx_clk_hw_fixup_divider(const char *name, const char *parent,
9595
void __iomem *reg, u8 shift, u8 width,
9696
void (*fixup)(u32 *val))
9797
{
9898
struct clk_fixup_div *fixup_div;
99-
struct clk *clk;
99+
struct clk_hw *hw;
100100
struct clk_init_data init;
101+
int ret;
101102

102103
if (!fixup)
103104
return ERR_PTR(-EINVAL);
@@ -120,9 +121,13 @@ struct clk *imx_clk_fixup_divider(const char *name, const char *parent,
120121
fixup_div->ops = &clk_divider_ops;
121122
fixup_div->fixup = fixup;
122123

123-
clk = clk_register(NULL, &fixup_div->divider.hw);
124-
if (IS_ERR(clk))
124+
hw = &fixup_div->divider.hw;
125+
126+
ret = clk_hw_register(NULL, hw);
127+
if (ret) {
125128
kfree(fixup_div);
129+
return ERR_PTR(ret);
130+
}
126131

127-
return clk;
132+
return hw;
128133
}

‎drivers/clk/imx/clk-fixup-mux.c‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ static const struct clk_ops clk_fixup_mux_ops = {
6969
.set_parent = clk_fixup_mux_set_parent,
7070
};
7171

72-
struct clk *imx_clk_fixup_mux(const char *name, void __iomem *reg,
72+
struct clk_hw *imx_clk_hw_fixup_mux(const char *name, void __iomem *reg,
7373
u8 shift, u8 width, const char * const *parents,
7474
int num_parents, void (*fixup)(u32 *val))
7575
{
7676
struct clk_fixup_mux *fixup_mux;
77-
struct clk *clk;
77+
struct clk_hw *hw;
7878
struct clk_init_data init;
79+
int ret;
7980

8081
if (!fixup)
8182
return ERR_PTR(-EINVAL);
@@ -98,9 +99,13 @@ struct clk *imx_clk_fixup_mux(const char *name, void __iomem *reg,
9899
fixup_mux->ops = &clk_mux_ops;
99100
fixup_mux->fixup = fixup;
100101

101-
clk = clk_register(NULL, &fixup_mux->mux.hw);
102-
if (IS_ERR(clk))
102+
hw = &fixup_mux->mux.hw;
103+
104+
ret = clk_hw_register(NULL, hw);
105+
if (ret) {
103106
kfree(fixup_mux);
107+
return ERR_PTR(ret);
108+
}
104109

105-
return clk;
110+
return hw;
106111
}

‎drivers/clk/imx/clk-gate-exclusive.c‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,14 @@ static const struct clk_ops clk_gate_exclusive_ops = {
5858
.is_enabled = clk_gate_exclusive_is_enabled,
5959
};
6060

61-
struct clk *imx_clk_gate_exclusive(const char *name, const char *parent,
61+
struct clk_hw *imx_clk_hw_gate_exclusive(const char *name, const char *parent,
6262
void __iomem *reg, u8 shift, u32 exclusive_mask)
6363
{
6464
struct clk_gate_exclusive *exgate;
6565
struct clk_gate *gate;
66-
struct clk *clk;
66+
struct clk_hw *hw;
6767
struct clk_init_data init;
68+
int ret;
6869

6970
if (exclusive_mask == 0)
7071
return ERR_PTR(-EINVAL);
@@ -86,9 +87,13 @@ struct clk *imx_clk_gate_exclusive(const char *name, const char *parent,
8687
gate->hw.init = &init;
8788
exgate->exclusive_mask = exclusive_mask;
8889

89-
clk = clk_register(NULL, &gate->hw);
90-
if (IS_ERR(clk))
91-
kfree(exgate);
90+
hw = &gate->hw;
9291

93-
return clk;
92+
ret = clk_hw_register(NULL, hw);
93+
if (ret) {
94+
kfree(gate);
95+
return ERR_PTR(ret);
96+
}
97+
98+
return hw;
9499
}

‎drivers/clk/imx/clk-gate2.c‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,16 @@ static const struct clk_ops clk_gate2_ops = {
125125
.is_enabled = clk_gate2_is_enabled,
126126
};
127127

128-
struct clk *clk_register_gate2(struct device *dev, const char *name,
128+
struct clk_hw *clk_hw_register_gate2(struct device *dev, const char *name,
129129
const char *parent_name, unsigned long flags,
130130
void __iomem *reg, u8 bit_idx, u8 cgr_val,
131131
u8 clk_gate2_flags, spinlock_t *lock,
132132
unsigned int *share_count)
133133
{
134134
struct clk_gate2 *gate;
135-
struct clk *clk;
135+
struct clk_hw *hw;
136136
struct clk_init_data init;
137+
int ret;
137138

138139
gate = kzalloc(sizeof(struct clk_gate2), GFP_KERNEL);
139140
if (!gate)
@@ -154,10 +155,13 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,
154155
init.num_parents = parent_name ? 1 : 0;
155156

156157
gate->hw.init = &init;
158+
hw = &gate->hw;
157159

158-
clk = clk_register(dev, &gate->hw);
159-
if (IS_ERR(clk))
160+
ret = clk_hw_register(NULL, hw);
161+
if (ret) {
160162
kfree(gate);
163+
return ERR_PTR(ret);
164+
}
161165

162-
return clk;
166+
return hw;
163167
}

0 commit comments

Comments
 (0)