aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-09-12 05:34:54 -0400
committerDavid S. Miller <davem@davemloft.net>2018-09-17 21:47:58 -0400
commitb1e3454d39f992e5409cd19f97782185950df6e7 (patch)
tree2638b0edce5e4a0fe8341d1b8d0ec2e4c484dfbf
parent0866cd15029baa3331ba347794053472306e8eb3 (diff)
clk: x86: add "ether_clk" alias for Bay Trail / Cherry Trail
Commit d31fd43c0f9a ("clk: x86: Do not gate clocks enabled by the firmware") causes all unclaimed PMC clocks on Cherry Trail devices to be on all the time, resulting on the device not being able to reach S0i2 or S0i3 when suspended. The reason for this commit is that on some Bay Trail / Cherry Trail devices the ethernet controller uses pmc_plt_clk_4. This commit adds an "ether_clk" alias, so that the relevant ethernet drivers can try to (optionally) use this, without needing X86 specific code / hacks, thus fixing ethernet on these devices without breaking S0i3 support. This commit uses clkdev_hw_create() to create the alias, mirroring the code for the already existing "mclk" alias for pmc_plt_clk_3. Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=193891#c102 Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=196861 Cc: Johannes Stezenbach <js@sig21.net> Cc: Carlo Caione <carlo@endlessm.com> Reported-by: Johannes Stezenbach <js@sig21.net> Acked-by: Stephen Boyd <sboyd@kernel.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/clk/x86/clk-pmc-atom.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/clk/x86/clk-pmc-atom.c b/drivers/clk/x86/clk-pmc-atom.c
index 08ef69945ffb..75151901ff7d 100644
--- a/drivers/clk/x86/clk-pmc-atom.c
+++ b/drivers/clk/x86/clk-pmc-atom.c
@@ -55,6 +55,7 @@ struct clk_plt_data {
55 u8 nparents; 55 u8 nparents;
56 struct clk_plt *clks[PMC_CLK_NUM]; 56 struct clk_plt *clks[PMC_CLK_NUM];
57 struct clk_lookup *mclk_lookup; 57 struct clk_lookup *mclk_lookup;
58 struct clk_lookup *ether_clk_lookup;
58}; 59};
59 60
60/* Return an index in parent table */ 61/* Return an index in parent table */
@@ -351,11 +352,20 @@ static int plt_clk_probe(struct platform_device *pdev)
351 goto err_unreg_clk_plt; 352 goto err_unreg_clk_plt;
352 } 353 }
353 354
355 data->ether_clk_lookup = clkdev_hw_create(&data->clks[4]->hw,
356 "ether_clk", NULL);
357 if (!data->ether_clk_lookup) {
358 err = -ENOMEM;
359 goto err_drop_mclk;
360 }
361
354 plt_clk_free_parent_names_loop(parent_names, data->nparents); 362 plt_clk_free_parent_names_loop(parent_names, data->nparents);
355 363
356 platform_set_drvdata(pdev, data); 364 platform_set_drvdata(pdev, data);
357 return 0; 365 return 0;
358 366
367err_drop_mclk:
368 clkdev_drop(data->mclk_lookup);
359err_unreg_clk_plt: 369err_unreg_clk_plt:
360 plt_clk_unregister_loop(data, i); 370 plt_clk_unregister_loop(data, i);
361 plt_clk_unregister_parents(data); 371 plt_clk_unregister_parents(data);
@@ -369,6 +379,7 @@ static int plt_clk_remove(struct platform_device *pdev)
369 379
370 data = platform_get_drvdata(pdev); 380 data = platform_get_drvdata(pdev);
371 381
382 clkdev_drop(data->ether_clk_lookup);
372 clkdev_drop(data->mclk_lookup); 383 clkdev_drop(data->mclk_lookup);
373 plt_clk_unregister_loop(data, PMC_CLK_NUM); 384 plt_clk_unregister_loop(data, PMC_CLK_NUM);
374 plt_clk_unregister_parents(data); 385 plt_clk_unregister_parents(data);