| .. | .. |
|---|
| 14 | 14 | |
|---|
| 15 | 15 | #include <soc/at91/atmel-sfr.h> |
|---|
| 16 | 16 | |
|---|
| 17 | | -#define I2S_BUS_NR 2 |
|---|
| 17 | +#include "pmc.h" |
|---|
| 18 | 18 | |
|---|
| 19 | 19 | struct clk_i2s_mux { |
|---|
| 20 | 20 | struct clk_hw hw; |
|---|
| .. | .. |
|---|
| 48 | 48 | .determine_rate = __clk_mux_determine_rate, |
|---|
| 49 | 49 | }; |
|---|
| 50 | 50 | |
|---|
| 51 | | -static struct clk_hw * __init |
|---|
| 51 | +struct clk_hw * __init |
|---|
| 52 | 52 | at91_clk_i2s_mux_register(struct regmap *regmap, const char *name, |
|---|
| 53 | 53 | const char * const *parent_names, |
|---|
| 54 | 54 | unsigned int num_parents, u8 bus_id) |
|---|
| .. | .. |
|---|
| 78 | 78 | |
|---|
| 79 | 79 | return &i2s_ck->hw; |
|---|
| 80 | 80 | } |
|---|
| 81 | | - |
|---|
| 82 | | -static void __init of_sama5d2_clk_i2s_mux_setup(struct device_node *np) |
|---|
| 83 | | -{ |
|---|
| 84 | | - struct regmap *regmap_sfr; |
|---|
| 85 | | - u8 bus_id; |
|---|
| 86 | | - const char *parent_names[2]; |
|---|
| 87 | | - struct device_node *i2s_mux_np; |
|---|
| 88 | | - struct clk_hw *hw; |
|---|
| 89 | | - int ret; |
|---|
| 90 | | - |
|---|
| 91 | | - regmap_sfr = syscon_regmap_lookup_by_compatible("atmel,sama5d2-sfr"); |
|---|
| 92 | | - if (IS_ERR(regmap_sfr)) |
|---|
| 93 | | - return; |
|---|
| 94 | | - |
|---|
| 95 | | - for_each_child_of_node(np, i2s_mux_np) { |
|---|
| 96 | | - if (of_property_read_u8(i2s_mux_np, "reg", &bus_id)) |
|---|
| 97 | | - continue; |
|---|
| 98 | | - |
|---|
| 99 | | - if (bus_id > I2S_BUS_NR) |
|---|
| 100 | | - continue; |
|---|
| 101 | | - |
|---|
| 102 | | - ret = of_clk_parent_fill(i2s_mux_np, parent_names, 2); |
|---|
| 103 | | - if (ret != 2) |
|---|
| 104 | | - continue; |
|---|
| 105 | | - |
|---|
| 106 | | - hw = at91_clk_i2s_mux_register(regmap_sfr, i2s_mux_np->name, |
|---|
| 107 | | - parent_names, 2, bus_id); |
|---|
| 108 | | - if (IS_ERR(hw)) |
|---|
| 109 | | - continue; |
|---|
| 110 | | - |
|---|
| 111 | | - of_clk_add_hw_provider(i2s_mux_np, of_clk_hw_simple_get, hw); |
|---|
| 112 | | - } |
|---|
| 113 | | -} |
|---|
| 114 | | - |
|---|
| 115 | | -CLK_OF_DECLARE(sama5d2_clk_i2s_mux, "atmel,sama5d2-clk-i2s-mux", |
|---|
| 116 | | - of_sama5d2_clk_i2s_mux_setup); |
|---|