Boris BREZILLON | 0ad6125 | 2013-12-02 15:07:02 +0100 | [diff] [blame] | 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> |
Boris Brezillon | 863a81c | 2014-09-05 09:54:13 +0200 | [diff] [blame] | 15 | #include <linux/mfd/syscon.h> |
Boris Brezillon | 1bdf023 | 2014-09-07 08:14:29 +0200 | [diff] [blame] | 16 | #include <linux/regmap.h> |
Boris BREZILLON | 0ad6125 | 2013-12-02 15:07:02 +0100 | [diff] [blame] | 17 | |
| 18 | #include <asm/proc-fns.h> |
| 19 | |
| 20 | #include "pmc.h" |
| 21 | |
Boris BREZILLON | 0ad6125 | 2013-12-02 15:07:02 +0100 | [diff] [blame] | 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); |