History

clk: keystone: sci-clk: extend clock IDs to 32 bits

Currently, the clock identifiers are limited to 255. To support future SoCs, this muse be extended to 32 bits, which should provide way more than enough space. Basic support for extending the clock API is going to be implemented in the firmware driver, but there are some minor changes that need to be done on the clock driver side first.

Tero Kristo committed 7 years ago

Commit 3f1f22d1 parent 8e48b331 file · +28 −8Browse files

Unified · Split

drivers/clk/keystone/sci-clk.c+28−8
@@ -58,8 +58,8 @@ struct sci_clk_provider { · 57 unmodified lines
58struct sci_clk {58struct sci_clk {
59 struct clk_hw hw;59 struct clk_hw hw;
60 u16 dev_id;60 u16 dev_id;
61 u8 clk_id;61 u32 clk_id;
62 u8 num_parents;62 u32 num_parents;
63 struct sci_clk_provider *provider;63 struct sci_clk_provider *provider;
64 u8 flags;64 u8 flags;
65 struct list_head node;65 struct list_head node;
@@ -221,11 +221,11 @@ static int sci_clk_set_rate(struct clk_hw *hw, unsigned long rate, · 155 unmodified lines
221static u8 sci_clk_get_parent(struct clk_hw *hw)221static u8 sci_clk_get_parent(struct clk_hw *hw)
222{222{
223 struct sci_clk *clk = to_sci_clk(hw);223 struct sci_clk *clk = to_sci_clk(hw);
224 u8 parent_id;224 u32 parent_id = 0;
225 int ret;225 int ret;
226 226
227 ret = clk->provider->ops->get_parent(clk->provider->sci, clk->dev_id,227 ret = clk->provider->ops->get_parent(clk->provider->sci, clk->dev_id,
228 clk->clk_id, &parent_id);228 clk->clk_id, (void *)&parent_id);
229 if (ret) {229 if (ret) {
230 dev_err(clk->provider->dev,230 dev_err(clk->provider->dev,
231 "get-parent failed for dev=%d, clk=%d, ret=%d\n",231 "get-parent failed for dev=%d, clk=%d, ret=%d\n",
@@ -233,7 +233,9 @@ static u8 sci_clk_get_parent(struct clk_hw *hw) · 1 unmodified line
233 return 0;233 return 0;
234 }234 }
235 235
236 return parent_id - clk->clk_id - 1;236 parent_id = parent_id - clk->clk_id - 1;
237
238 return (u8)parent_id;
237}239}
238 240
239/**241/**
@@ -417,13 +419,14 @@ static int ti_sci_scan_clocks_from_fw(struct sci_clk_provider *provider) · 177 unmodified lines
417 int max_clks = 0;419 int max_clks = 0;
418 int clk_id = 0;420 int clk_id = 0;
419 int dev_id = 0;421 int dev_id = 0;
420 u8 num_parents;422 u32 num_parents = 0;
421 int gap_size = 0;423 int gap_size = 0;
422 struct device *dev = provider->dev;424 struct device *dev = provider->dev;
423 425
424 while (1) {426 while (1) {
425 ret = provider->ops->get_num_parents(provider->sci, dev_id,427 ret = provider->ops->get_num_parents(provider->sci, dev_id,
426 clk_id, &num_parents);428 clk_id,
429 (void *)&num_parents);
427 if (ret) {430 if (ret) {
428 gap_size++;431 gap_size++;
429 if (!clk_id) {432 if (!clk_id) {
@@ -546,7 +549,7 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider) · 116 unmodified lines
546 provider->ops->get_num_parents(provider->sci,549 provider->ops->get_num_parents(provider->sci,
547 sci_clk->dev_id,550 sci_clk->dev_id,
548 sci_clk->clk_id,551 sci_clk->clk_id,
549 &sci_clk->num_parents);552 (void *)&sci_clk->num_parents);
550 list_add_tail(&sci_clk->node, &clks);553 list_add_tail(&sci_clk->node, &clks);
551 554
552 num_clks++;555 num_clks++;
@@ -555,6 +558,23 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider) · 2 unmodified lines
555 if (num_parents == 1)558 if (num_parents == 1)
556 num_parents = 0;559 num_parents = 0;
557 560
561 /*
562 * Linux kernel has inherent limitation
563 * of 255 clock parents at the moment.
564 * Right now, it is not expected that
565 * any mux clock from sci-clk driver
566 * would exceed that limit either, but
567 * the ABI basically provides that
568 * possibility. Print out a warning if
569 * this happens for any clock.
570 */
571 if (num_parents >= 255) {
572 dev_warn(dev, "too many parents for dev=%d, clk=%d (%d), cropping to 255.\n",
573 sci_clk->dev_id,
574 sci_clk->clk_id, num_parents);
575 num_parents = 255;
576 }
577
558 clk_id = args.args[1] + 1;578 clk_id = args.args[1] + 1;
559 579
560 while (num_parents--) {580 while (num_parents--) {

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