clk-bringup.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright (c) 2015 MediaTek Inc.
  3. * Author: James Liao <jamesjj.liao@mediatek.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #include <linux/clk.h>
  15. #include <linux/kernel.h>
  16. #include <linux/module.h>
  17. #include <linux/of.h>
  18. #include <linux/of_platform.h>
  19. static const struct of_device_id bring_up_id_table[] = {
  20. { .compatible = "mediatek,clk-bring-up",},
  21. { .compatible = "mediatek,mt8163-bring-up",},
  22. { .compatible = "mediatek,mt8173-bring-up",},
  23. { },
  24. };
  25. MODULE_DEVICE_TABLE(of, bring_up_id_table);
  26. static int bring_up_probe(struct platform_device *pdev)
  27. {
  28. const int NR_CLKS = 300;
  29. char clk_name_buf[16];
  30. struct clk *clk;
  31. int i;
  32. for (i = 0; i < NR_CLKS; i++) {
  33. sprintf(clk_name_buf, "%d", i);
  34. clk = devm_clk_get(&pdev->dev, clk_name_buf);
  35. if (!IS_ERR(clk))
  36. clk_prepare_enable(clk);
  37. }
  38. return 0;
  39. }
  40. static int bring_up_remove(struct platform_device *pdev)
  41. {
  42. return 0;
  43. }
  44. static struct platform_driver bring_up = {
  45. .probe = bring_up_probe,
  46. .remove = bring_up_remove,
  47. .driver = {
  48. .name = "bring_up",
  49. .owner = THIS_MODULE,
  50. .of_match_table = bring_up_id_table,
  51. },
  52. };
  53. module_platform_driver(bring_up);