clk: sunxi: make factors clock mux mask configurable

Some of the factors-style clocks on the A80 have different widths
for the mux values in the registers.

Add a .muxmask field to clk_factors_config to make it configurable.
Passing a bitmask instead of a width parameter will allow reuse
in case we support table-based muxes in the future.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
This commit is contained in:
Chen-Yu Tsai 2014-10-20 22:10:26 +08:00 committed by Maxime Ripard
parent f114040e3e
commit e94f8cb32d
5 changed files with 5 additions and 3 deletions

View file

@ -224,7 +224,7 @@ struct clk * __init sunxi_factors_register(struct device_node *node,
/* set up gate properties */ /* set up gate properties */
mux->reg = reg; mux->reg = reg;
mux->shift = data->mux; mux->shift = data->mux;
mux->mask = SUNXI_FACTORS_MUX_MASK; mux->mask = data->muxmask;
mux->lock = factors->lock; mux->lock = factors->lock;
mux_hw = &mux->hw; mux_hw = &mux->hw;
} }

View file

@ -7,8 +7,6 @@
#define SUNXI_FACTORS_NOT_APPLICABLE (0) #define SUNXI_FACTORS_NOT_APPLICABLE (0)
#define SUNXI_FACTORS_MUX_MASK 0x3
struct clk_factors_config { struct clk_factors_config {
u8 nshift; u8 nshift;
u8 nwidth; u8 nwidth;
@ -24,6 +22,7 @@ struct clk_factors_config {
struct factors_data { struct factors_data {
int enable; int enable;
int mux; int mux;
int muxmask;
struct clk_factors_config *table; struct clk_factors_config *table;
void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p); void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
const char *name; const char *name;

View file

@ -70,6 +70,7 @@ static struct clk_factors_config sun4i_a10_mod0_config = {
static const struct factors_data sun4i_a10_mod0_data __initconst = { static const struct factors_data sun4i_a10_mod0_data __initconst = {
.enable = 31, .enable = 31,
.mux = 24, .mux = 24,
.muxmask = BIT(1) | BIT(0),
.table = &sun4i_a10_mod0_config, .table = &sun4i_a10_mod0_config,
.getter = sun4i_a10_get_mod0_factors, .getter = sun4i_a10_get_mod0_factors,
}; };

View file

@ -60,6 +60,7 @@ static struct clk_factors_config sun8i_a23_mbus_config = {
static const struct factors_data sun8i_a23_mbus_data __initconst = { static const struct factors_data sun8i_a23_mbus_data __initconst = {
.enable = 31, .enable = 31,
.mux = 24, .mux = 24,
.muxmask = BIT(1) | BIT(0),
.table = &sun8i_a23_mbus_config, .table = &sun8i_a23_mbus_config,
.getter = sun8i_a23_get_mbus_factors, .getter = sun8i_a23_get_mbus_factors,
}; };

View file

@ -514,6 +514,7 @@ static const struct factors_data sun4i_apb1_data __initconst = {
static const struct factors_data sun7i_a20_out_data __initconst = { static const struct factors_data sun7i_a20_out_data __initconst = {
.enable = 31, .enable = 31,
.mux = 24, .mux = 24,
.muxmask = BIT(1) | BIT(0),
.table = &sun7i_a20_out_config, .table = &sun7i_a20_out_config,
.getter = sun7i_a20_get_out_factors, .getter = sun7i_a20_get_out_factors,
}; };