pmc.c 954 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2013 Boris BREZILLON <b.brezillon@overkiz.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. */
  10. #include <linux/clk-provider.h>
  11. #include <linux/clkdev.h>
  12. #include <linux/clk/at91_pmc.h>
  13. #include <linux/of.h>
  14. #include <linux/mfd/syscon.h>
  15. #include <linux/regmap.h>
  16. #include <asm/proc-fns.h>
  17. #include "pmc.h"
  18. int of_at91_get_clk_range(struct device_node *np, const char *propname,
  19. struct clk_range *range)
  20. {
  21. u32 min, max;
  22. int ret;
  23. ret = of_property_read_u32_index(np, propname, 0, &min);
  24. if (ret)
  25. return ret;
  26. ret = of_property_read_u32_index(np, propname, 1, &max);
  27. if (ret)
  28. return ret;
  29. if (range) {
  30. range->min = min;
  31. range->max = max;
  32. }
  33. return 0;
  34. }
  35. EXPORT_SYMBOL_GPL(of_at91_get_clk_range);