History

Merge branches 'clk-bulk-optional', 'clk-kirkwood', 'clk-socfpga' and 'clk-docs' into clk-next

- Add a clk_bulk_get_optional() API (with devm too) - Support for Marvell 98DX1135 SoCs * clk-bulk-optional: clk: Document some devm_clk_bulk*() APIs clk: Add devm_clk_bulk_get_optional() function clk: Add clk_bulk_get_optional() function * clk-kirkwood: clk: kirkwood: Add support for MV98DX1135 dt-bindings: clock: mvebu: Add compatible string for 98dx1135 core clock * clk-socfpga: clk: socfpga: stratix10: fix divider entry for the emac clocks clk: socfpga: stratix10: add additional clocks needed for the NAND IP * clk-docs: clk: Grammar missing "and", Spelling s/statisfied/satisfied/

Stephen Boyd committed 7 years ago

Commit dfe1d3a5 parents e02cb1f 179175d 88aa7af 16e3c57 65e22189 files · +120 −12Browse files

Unified · Split

9 files
  1. Documentation/devicetree/bindings/clock/mvebu-core-clock.txt +1 −0
  2. Documentation/driver-model/devres.txt +4 −0
  3. drivers/clk/clk-bulk.c +20 −3
  4. drivers/clk/clk-devres.c +19 −3
  5. drivers/clk/clk.c +2 −2
  6. drivers/clk/mvebu/kirkwood.c +17 −0
  7. drivers/clk/socfpga/clk-s10.c +7 −3
  8. include/dt-bindings/clock/stratix10-clock.h +3 −1
  9. include/linux/clk.h +47 −0
Documentation/devicetree/bindings/clock/mvebu-core-clock.txt+1−0
@@ -59,6 +59,7 @@ Required properties: · 58 unmodified lines
59 "marvell,dove-core-clock" - for Dove SoC core clocks59 "marvell,dove-core-clock" - for Dove SoC core clocks
60 "marvell,kirkwood-core-clock" - for Kirkwood SoC (except mv88f6180)60 "marvell,kirkwood-core-clock" - for Kirkwood SoC (except mv88f6180)
61 "marvell,mv88f6180-core-clock" - for Kirkwood MV88f6180 SoC61 "marvell,mv88f6180-core-clock" - for Kirkwood MV88f6180 SoC
62 "marvell,mv98dx1135-core-clock" - for Kirkwood 98dx1135 SoC
62 "marvell,mv88f5181-core-clock" - for Orion MV88F5181 SoC63 "marvell,mv88f5181-core-clock" - for Orion MV88F5181 SoC
63 "marvell,mv88f5182-core-clock" - for Orion MV88F5182 SoC64 "marvell,mv88f5182-core-clock" - for Orion MV88F5182 SoC
64 "marvell,mv88f5281-core-clock" - for Orion MV88F5281 SoC65 "marvell,mv88f5281-core-clock" - for Orion MV88F5281 SoC
Documentation/driver-model/devres.txt+4−0
@@ -244,6 +244,10 @@ CLOCK · 243 unmodified lines
244 devm_clk_get()244 devm_clk_get()
245 devm_clk_get_optional()245 devm_clk_get_optional()
246 devm_clk_put()246 devm_clk_put()
247 devm_clk_bulk_get()
248 devm_clk_bulk_get_all()
249 devm_clk_bulk_get_optional()
250 devm_get_clk_from_childl()
247 devm_clk_hw_register()251 devm_clk_hw_register()
248 devm_of_clk_add_hw_provider()252 devm_of_clk_add_hw_provider()
249 devm_clk_hw_register_clkdev()253 devm_clk_hw_register_clkdev()
drivers/clk/clk-bulk.c+20−3
@@ -75,8 +75,8 @@ void clk_bulk_put(int num_clks, struct clk_bulk_data *clks) · 74 unmodified lines
75}75}
76EXPORT_SYMBOL_GPL(clk_bulk_put);76EXPORT_SYMBOL_GPL(clk_bulk_put);
77 77
78int __must_check clk_bulk_get(struct device *dev, int num_clks,78static int __clk_bulk_get(struct device *dev, int num_clks,
79 struct clk_bulk_data *clks)79 struct clk_bulk_data *clks, bool optional)
80{80{
81 int ret;81 int ret;
82 int i;82 int i;
@@ -88,10 +88,14 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, · 5 unmodified lines
88 clks[i].clk = clk_get(dev, clks[i].id);88 clks[i].clk = clk_get(dev, clks[i].id);
89 if (IS_ERR(clks[i].clk)) {89 if (IS_ERR(clks[i].clk)) {
90 ret = PTR_ERR(clks[i].clk);90 ret = PTR_ERR(clks[i].clk);
91 clks[i].clk = NULL;
92
93 if (ret == -ENOENT && optional)
94 continue;
95
91 if (ret != -EPROBE_DEFER)96 if (ret != -EPROBE_DEFER)
92 dev_err(dev, "Failed to get clk '%s': %d\n",97 dev_err(dev, "Failed to get clk '%s': %d\n",
93 clks[i].id, ret);98 clks[i].id, ret);
94 clks[i].clk = NULL;
95 goto err;99 goto err;
96 }100 }
97 }101 }
@@ -103,8 +107,21 @@ err: · 5 unmodified lines
103 107
104 return ret;108 return ret;
105}109}
110
111int __must_check clk_bulk_get(struct device *dev, int num_clks,
112 struct clk_bulk_data *clks)
113{
114 return __clk_bulk_get(dev, num_clks, clks, false);
115}
106EXPORT_SYMBOL(clk_bulk_get);116EXPORT_SYMBOL(clk_bulk_get);
107 117
118int __must_check clk_bulk_get_optional(struct device *dev, int num_clks,
119 struct clk_bulk_data *clks)
120{
121 return __clk_bulk_get(dev, num_clks, clks, true);
122}
123EXPORT_SYMBOL_GPL(clk_bulk_get_optional);
124
108void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks)125void clk_bulk_put_all(int num_clks, struct clk_bulk_data *clks)
109{126{
110 if (IS_ERR_OR_NULL(clks))127 if (IS_ERR_OR_NULL(clks))
drivers/clk/clk-devres.c+19−3
@@ -52,8 +52,8 @@ static void devm_clk_bulk_release(struct device *dev, void *res) · 51 unmodified lines
52 clk_bulk_put(devres->num_clks, devres->clks);52 clk_bulk_put(devres->num_clks, devres->clks);
53}53}
54 54
55int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,55static int __devm_clk_bulk_get(struct device *dev, int num_clks,
56 struct clk_bulk_data *clks)56 struct clk_bulk_data *clks, bool optional)
57{57{
58 struct clk_bulk_devres *devres;58 struct clk_bulk_devres *devres;
59 int ret;59 int ret;
@@ -63,7 +63,10 @@ int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, · 3 unmodified lines
63 if (!devres)63 if (!devres)
64 return -ENOMEM;64 return -ENOMEM;
65 65
66 ret = clk_bulk_get(dev, num_clks, clks);66 if (optional)
67 ret = clk_bulk_get_optional(dev, num_clks, clks);
68 else
69 ret = clk_bulk_get(dev, num_clks, clks);
67 if (!ret) {70 if (!ret) {
68 devres->clks = clks;71 devres->clks = clks;
69 devres->num_clks = num_clks;72 devres->num_clks = num_clks;
@@ -74,8 +77,21 @@ int __must_check devm_clk_bulk_get(struct device *dev, int num_clks, · 4 unmodified lines
74 77
75 return ret;78 return ret;
76}79}
80
81int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
82 struct clk_bulk_data *clks)
83{
84 return __devm_clk_bulk_get(dev, num_clks, clks, false);
85}
77EXPORT_SYMBOL_GPL(devm_clk_bulk_get);86EXPORT_SYMBOL_GPL(devm_clk_bulk_get);
78 87
88int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks,
89 struct clk_bulk_data *clks)
90{
91 return __devm_clk_bulk_get(dev, num_clks, clks, true);
92}
93EXPORT_SYMBOL_GPL(devm_clk_bulk_get_optional);
94
79int __must_check devm_clk_bulk_get_all(struct device *dev,95int __must_check devm_clk_bulk_get_all(struct device *dev,
80 struct clk_bulk_data **clks)96 struct clk_bulk_data **clks)
81{97{
drivers/clk/clk.c+2−2
@@ -2194,7 +2194,7 @@ int clk_set_rate(struct clk *clk, unsigned long rate) · 2193 unmodified lines
2194EXPORT_SYMBOL_GPL(clk_set_rate);2194EXPORT_SYMBOL_GPL(clk_set_rate);
2195 2195
2196/**2196/**
2197 * clk_set_rate_exclusive - specify a new rate get exclusive control2197 * clk_set_rate_exclusive - specify a new rate and get exclusive control
2198 * @clk: the clk whose rate is being changed2198 * @clk: the clk whose rate is being changed
2199 * @rate: the new rate for clk2199 * @rate: the new rate for clk
2200 *2200 *
@@ -2202,7 +2202,7 @@ EXPORT_SYMBOL_GPL(clk_set_rate); · 1 unmodified line
2202 * within a critical section2202 * within a critical section
2203 *2203 *
2204 * This can be used initially to ensure that at least 1 consumer is2204 * This can be used initially to ensure that at least 1 consumer is
2205 * statisfied when several consumers are competing for exclusivity over the2205 * satisfied when several consumers are competing for exclusivity over the
2206 * same clock provider.2206 * same clock provider.
2207 *2207 *
2208 * The exclusivity is not applied if setting the rate failed.2208 * The exclusivity is not applied if setting the rate failed.
drivers/clk/mvebu/kirkwood.c+17−0
@@ -185,6 +185,11 @@ static void __init mv88f6180_get_clk_ratio( · 184 unmodified lines
185 }185 }
186}186}
187 187
188static u32 __init mv98dx1135_get_tclk_freq(void __iomem *sar)
189{
190 return 166666667;
191}
192
188static const struct coreclk_soc_desc kirkwood_coreclks = {193static const struct coreclk_soc_desc kirkwood_coreclks = {
189 .get_tclk_freq = kirkwood_get_tclk_freq,194 .get_tclk_freq = kirkwood_get_tclk_freq,
190 .get_cpu_freq = kirkwood_get_cpu_freq,195 .get_cpu_freq = kirkwood_get_cpu_freq,
@@ -201,6 +206,14 @@ static const struct coreclk_soc_desc mv88f6180_coreclks = { · 10 unmodified lines
201 .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios),206 .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios),
202};207};
203 208
209static const struct coreclk_soc_desc mv98dx1135_coreclks = {
210 .get_tclk_freq = mv98dx1135_get_tclk_freq,
211 .get_cpu_freq = kirkwood_get_cpu_freq,
212 .get_clk_ratio = kirkwood_get_clk_ratio,
213 .ratios = kirkwood_coreclk_ratios,
214 .num_ratios = ARRAY_SIZE(kirkwood_coreclk_ratios),
215};
216
204/*217/*
205 * Clock Gating Control218 * Clock Gating Control
206 */219 */
@@ -325,6 +338,8 @@ static void __init kirkwood_clk_init(struct device_node *np) · 118 unmodified lines
325 338
326 if (of_device_is_compatible(np, "marvell,mv88f6180-core-clock"))339 if (of_device_is_compatible(np, "marvell,mv88f6180-core-clock"))
327 mvebu_coreclk_setup(np, &mv88f6180_coreclks);340 mvebu_coreclk_setup(np, &mv88f6180_coreclks);
341 else if (of_device_is_compatible(np, "marvell,mv98dx1135-core-clock"))
342 mvebu_coreclk_setup(np, &mv98dx1135_coreclks);
328 else343 else
329 mvebu_coreclk_setup(np, &kirkwood_coreclks);344 mvebu_coreclk_setup(np, &kirkwood_coreclks);
330 345
@@ -339,3 +354,5 @@ CLK_OF_DECLARE(kirkwood_clk, "marvell,kirkwood-core-clock", · 8 unmodified lines
339 kirkwood_clk_init);354 kirkwood_clk_init);
340CLK_OF_DECLARE(mv88f6180_clk, "marvell,mv88f6180-core-clock",355CLK_OF_DECLARE(mv88f6180_clk, "marvell,mv88f6180-core-clock",
341 kirkwood_clk_init);356 kirkwood_clk_init);
357CLK_OF_DECLARE(98dx1135_clk, "marvell,mv98dx1135-core-clock",
358 kirkwood_clk_init);
drivers/clk/socfpga/clk-s10.c+7−3
@@ -103,9 +103,9 @@ static const struct stratix10_perip_cnt_clock s10_main_perip_cnt_clks[] = { · 102 unmodified lines
103 { STRATIX10_NOC_CLK, "noc_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux),103 { STRATIX10_NOC_CLK, "noc_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux),
104 0, 0, 0, 0x3C, 1},104 0, 0, 0, 0x3C, 1},
105 { STRATIX10_EMAC_A_FREE_CLK, "emaca_free_clk", NULL, emaca_free_mux, ARRAY_SIZE(emaca_free_mux),105 { STRATIX10_EMAC_A_FREE_CLK, "emaca_free_clk", NULL, emaca_free_mux, ARRAY_SIZE(emaca_free_mux),
106 0, 0, 4, 0xB0, 0},106 0, 0, 2, 0xB0, 0},
107 { STRATIX10_EMAC_B_FREE_CLK, "emacb_free_clk", NULL, emacb_free_mux, ARRAY_SIZE(emacb_free_mux),107 { STRATIX10_EMAC_B_FREE_CLK, "emacb_free_clk", NULL, emacb_free_mux, ARRAY_SIZE(emacb_free_mux),
108 0, 0, 4, 0xB0, 1},108 0, 0, 2, 0xB0, 1},
109 { STRATIX10_EMAC_PTP_FREE_CLK, "emac_ptp_free_clk", NULL, emac_ptp_free_mux,109 { STRATIX10_EMAC_PTP_FREE_CLK, "emac_ptp_free_clk", NULL, emac_ptp_free_mux,
110 ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 4, 0xB0, 2},110 ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 4, 0xB0, 2},
111 { STRATIX10_GPIO_DB_FREE_CLK, "gpio_db_free_clk", NULL, gpio_db_free_mux,111 { STRATIX10_GPIO_DB_FREE_CLK, "gpio_db_free_clk", NULL, gpio_db_free_mux,
@@ -161,8 +161,12 @@ static const struct stratix10_gate_clock s10_gate_clks[] = { · 49 unmodified lines
161 8, 0, 0, 0, 0, 0, 0},161 8, 0, 0, 0, 0, 0, 0},
162 { STRATIX10_SPI_M_CLK, "spi_m_clk", "l4_mp_clk", NULL, 1, 0, 0xA4,162 { STRATIX10_SPI_M_CLK, "spi_m_clk", "l4_mp_clk", NULL, 1, 0, 0xA4,
163 9, 0, 0, 0, 0, 0, 0},163 9, 0, 0, 0, 0, 0, 0},
164 { STRATIX10_NAND_CLK, "nand_clk", "l4_main_clk", NULL, 1, 0, 0xA4,164 { STRATIX10_NAND_X_CLK, "nand_x_clk", "l4_mp_clk", NULL, 1, 0, 0xA4,
165 10, 0, 0, 0, 0, 0, 0},165 10, 0, 0, 0, 0, 0, 0},
166 { STRATIX10_NAND_CLK, "nand_clk", "nand_x_clk", NULL, 1, 0, 0xA4,
167 10, 0, 0, 0, 0, 0, 4},
168 { STRATIX10_NAND_ECC_CLK, "nand_ecc_clk", "nand_x_clk", NULL, 1, 0, 0xA4,
169 10, 0, 0, 0, 0, 0, 4},
166};170};
167 171
168static int s10_clk_register_c_perip(const struct stratix10_perip_c_clock *clks,172static int s10_clk_register_c_perip(const struct stratix10_perip_c_clock *clks,
include/dt-bindings/clock/stratix10-clock.h+3−1
@@ -79,6 +79,8 @@ · 78 unmodified lines
79#define STRATIX10_USB_CLK 5979#define STRATIX10_USB_CLK 59
80#define STRATIX10_SPI_M_CLK 6080#define STRATIX10_SPI_M_CLK 60
81#define STRATIX10_NAND_CLK 6181#define STRATIX10_NAND_CLK 61
82#define STRATIX10_NUM_CLKS 6282#define STRATIX10_NAND_X_CLK 62
83#define STRATIX10_NAND_ECC_CLK 63
84#define STRATIX10_NUM_CLKS 64
83 85
84#endif /* __STRATIX10_CLOCK_H */86#endif /* __STRATIX10_CLOCK_H */
include/linux/clk.h+47−0
@@ -332,6 +332,19 @@ int __must_check clk_bulk_get(struct device *dev, int num_clks, · 331 unmodified lines
332 */332 */
333int __must_check clk_bulk_get_all(struct device *dev,333int __must_check clk_bulk_get_all(struct device *dev,
334 struct clk_bulk_data **clks);334 struct clk_bulk_data **clks);
335
336/**
337 * clk_bulk_get_optional - lookup and obtain a number of references to clock producer
338 * @dev: device for clock "consumer"
339 * @num_clks: the number of clk_bulk_data
340 * @clks: the clk_bulk_data table of consumer
341 *
342 * Behaves the same as clk_bulk_get() except where there is no clock producer.
343 * In this case, instead of returning -ENOENT, the function returns 0 and
344 * NULL for a clk for which a clock producer could not be determined.
345 */
346int __must_check clk_bulk_get_optional(struct device *dev, int num_clks,
347 struct clk_bulk_data *clks);
335/**348/**
336 * devm_clk_bulk_get - managed get multiple clk consumers349 * devm_clk_bulk_get - managed get multiple clk consumers
337 * @dev: device for clock "consumer"350 * @dev: device for clock "consumer"
@@ -346,6 +359,28 @@ int __must_check clk_bulk_get_all(struct device *dev, · 8 unmodified lines
346 */359 */
347int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,360int __must_check devm_clk_bulk_get(struct device *dev, int num_clks,
348 struct clk_bulk_data *clks);361 struct clk_bulk_data *clks);
362/**
363 * devm_clk_bulk_get_optional - managed get multiple optional consumer clocks
364 * @dev: device for clock "consumer"
365 * @clks: pointer to the clk_bulk_data table of consumer
366 *
367 * Behaves the same as devm_clk_bulk_get() except where there is no clock
368 * producer. In this case, instead of returning -ENOENT, the function returns
369 * NULL for given clk. It is assumed all clocks in clk_bulk_data are optional.
370 *
371 * Returns 0 if all clocks specified in clk_bulk_data table are obtained
372 * successfully or for any clk there was no clk provider available, otherwise
373 * returns valid IS_ERR() condition containing errno.
374 * The implementation uses @dev and @clk_bulk_data.id to determine the
375 * clock consumer, and thereby the clock producer.
376 * The clock returned is stored in each @clk_bulk_data.clk field.
377 *
378 * Drivers must assume that the clock source is not enabled.
379 *
380 * clk_bulk_get should not be called from within interrupt context.
381 */
382int __must_check devm_clk_bulk_get_optional(struct device *dev, int num_clks,
383 struct clk_bulk_data *clks);
349/**384/**
350 * devm_clk_bulk_get_all - managed get multiple clk consumers385 * devm_clk_bulk_get_all - managed get multiple clk consumers
351 * @dev: device for clock "consumer"386 * @dev: device for clock "consumer"
@@ -718,6 +753,12 @@ static inline int __must_check clk_bulk_get(struct device *dev, int num_clks, · 366 unmodified lines
718 return 0;753 return 0;
719}754}
720 755
756static inline int __must_check clk_bulk_get_optional(struct device *dev,
757 int num_clks, struct clk_bulk_data *clks)
758{
759 return 0;
760}
761
721static inline int __must_check clk_bulk_get_all(struct device *dev,762static inline int __must_check clk_bulk_get_all(struct device *dev,
722 struct clk_bulk_data **clks)763 struct clk_bulk_data **clks)
723{764{
@@ -741,6 +782,12 @@ static inline int __must_check devm_clk_bulk_get(struct device *dev, int num_clk · 17 unmodified lines
741 return 0;782 return 0;
742}783}
743 784
785static inline int __must_check devm_clk_bulk_get_optional(struct device *dev,
786 int num_clks, struct clk_bulk_data *clks)
787{
788 return 0;
789}
790
744static inline int __must_check devm_clk_bulk_get_all(struct device *dev,791static inline int __must_check devm_clk_bulk_get_all(struct device *dev,
745 struct clk_bulk_data **clks)792 struct clk_bulk_data **clks)
746{793{

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t