xref: /openbmc/linux/drivers/clk/at91/pmc.c (revision 23c2b932)
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 
11 #include <linux/clk-provider.h>
12 #include <linux/clkdev.h>
13 #include <linux/clk/at91_pmc.h>
14 #include <linux/of.h>
15 #include <linux/mfd/syscon.h>
16 #include <linux/regmap.h>
17 
18 #include <asm/proc-fns.h>
19 
20 #include "pmc.h"
21 
22 int of_at91_get_clk_range(struct device_node *np, const char *propname,
23 			  struct clk_range *range)
24 {
25 	u32 min, max;
26 	int ret;
27 
28 	ret = of_property_read_u32_index(np, propname, 0, &min);
29 	if (ret)
30 		return ret;
31 
32 	ret = of_property_read_u32_index(np, propname, 1, &max);
33 	if (ret)
34 		return ret;
35 
36 	if (range) {
37 		range->min = min;
38 		range->max = max;
39 	}
40 
41 	return 0;
42 }
43 EXPORT_SYMBOL_GPL(of_at91_get_clk_range);
44