228-v6.3-clk-mediatek-clk-mt7986-topckgen-Migrate-to-mtk_clk_.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. From 9ce3b4e4719d4eec38b2c8da939c073835573d1d Mon Sep 17 00:00:00 2001
  2. From: AngeloGioacchino Del Regno <[email protected]>
  3. Date: Fri, 20 Jan 2023 10:20:53 +0100
  4. Subject: [PATCH 07/15] clk: mediatek: clk-mt7986-topckgen: Migrate to
  5. mtk_clk_simple_probe()
  6. There are no more non-common calls in clk_mt7986_topckgen_probe():
  7. migrate this driver to mtk_clk_simple_probe().
  8. Signed-off-by: AngeloGioacchino Del Regno <[email protected]>
  9. Reviewed-by: Miles Chen <[email protected]>
  10. Reviewed-by: Chen-Yu Tsai <[email protected]>
  11. Link: https://lore.kernel.org/r/[email protected]
  12. Tested-by: Mingming Su <[email protected]>
  13. Signed-off-by: Stephen Boyd <[email protected]>
  14. ---
  15. drivers/clk/mediatek/clk-mt7986-topckgen.c | 55 +++++-----------------
  16. 1 file changed, 13 insertions(+), 42 deletions(-)
  17. --- a/drivers/clk/mediatek/clk-mt7986-topckgen.c
  18. +++ b/drivers/clk/mediatek/clk-mt7986-topckgen.c
  19. @@ -290,53 +290,24 @@ static const struct mtk_mux top_muxes[]
  20. 0x1C4, 5),
  21. };
  22. -static int clk_mt7986_topckgen_probe(struct platform_device *pdev)
  23. -{
  24. - struct clk_hw_onecell_data *clk_data;
  25. - struct device_node *node = pdev->dev.of_node;
  26. - int r;
  27. - void __iomem *base;
  28. - int nr = ARRAY_SIZE(top_fixed_clks) + ARRAY_SIZE(top_divs) +
  29. - ARRAY_SIZE(top_muxes);
  30. -
  31. - base = of_iomap(node, 0);
  32. - if (!base) {
  33. - pr_err("%s(): ioremap failed\n", __func__);
  34. - return -ENOMEM;
  35. - }
  36. -
  37. - clk_data = mtk_alloc_clk_data(nr);
  38. - if (!clk_data)
  39. - return -ENOMEM;
  40. -
  41. - mtk_clk_register_fixed_clks(top_fixed_clks, ARRAY_SIZE(top_fixed_clks),
  42. - clk_data);
  43. - mtk_clk_register_factors(top_divs, ARRAY_SIZE(top_divs), clk_data);
  44. - mtk_clk_register_muxes(&pdev->dev, top_muxes,
  45. - ARRAY_SIZE(top_muxes), node,
  46. - &mt7986_clk_lock, clk_data);
  47. -
  48. - r = of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
  49. -
  50. - if (r) {
  51. - pr_err("%s(): could not register clock provider: %d\n",
  52. - __func__, r);
  53. - goto free_topckgen_data;
  54. - }
  55. - return r;
  56. -
  57. -free_topckgen_data:
  58. - mtk_free_clk_data(clk_data);
  59. - return r;
  60. -}
  61. +static const struct mtk_clk_desc topck_desc = {
  62. + .fixed_clks = top_fixed_clks,
  63. + .num_fixed_clks = ARRAY_SIZE(top_fixed_clks),
  64. + .factor_clks = top_divs,
  65. + .num_factor_clks = ARRAY_SIZE(top_divs),
  66. + .mux_clks = top_muxes,
  67. + .num_mux_clks = ARRAY_SIZE(top_muxes),
  68. + .clk_lock = &mt7986_clk_lock,
  69. +};
  70. static const struct of_device_id of_match_clk_mt7986_topckgen[] = {
  71. - { .compatible = "mediatek,mt7986-topckgen", },
  72. - {}
  73. + { .compatible = "mediatek,mt7986-topckgen", .data = &topck_desc },
  74. + { /* sentinel */ }
  75. };
  76. static struct platform_driver clk_mt7986_topckgen_drv = {
  77. - .probe = clk_mt7986_topckgen_probe,
  78. + .probe = mtk_clk_simple_probe,
  79. + .remove = mtk_clk_simple_remove,
  80. .driver = {
  81. .name = "clk-mt7986-topckgen",
  82. .of_match_table = of_match_clk_mt7986_topckgen,