aw_ccung: changes to accommodate upcoming a83t support

Add a means to specify mask/value for the prediv condition instead of
shift/width/value for clocks that have a more complex mux scenario.

Specifically, ahb1 on the a83t has the prediv applied if mux is either b10
or b11.

Reviewed by:	manu
Approved by:	emaste (mentor)
Differential Revision:	https://reviews.freebsd.org/D12851
This commit is contained in:
Kyle Evans 2017-11-23 05:43:44 +00:00
parent 2d96bd8812
commit 0b7a88e60d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326113
2 changed files with 35 additions and 1 deletions

View File

@ -48,6 +48,7 @@ Periph clocks:
Clock Source/Divider N/Divider M
Clock Source/Divider N/Divider M/2
Clock Source*N/(Divider M+1)/(Divider P+1)
*/
@ -392,6 +393,36 @@ aw_clk_factor_get_value(struct aw_clk_factor *factor, uint32_t raw)
.prediv.cond_value = _prediv_cond_value, \
}
#define PREDIV_CLK_WITH_MASK(_clkname, _id, _name, _pnames, \
_offset, \
_mux_shift, _mux_width, \
_div_shift, _div_width, _div_value, _div_flags, \
_prediv_shift, _prediv_width, _prediv_value, _prediv_flags, \
_prediv_cond_mask, _prediv_cond_value) \
static struct aw_clk_prediv_mux_def _clkname = { \
.clkdef = { \
.id = _id, \
.name = _name, \
.parent_names = _pnames, \
.parent_cnt = nitems(_pnames), \
}, \
.offset = _offset, \
.mux_shift = _mux_shift, \
.mux_width = _mux_width, \
.div.shift = _div_shift, \
.div.width = _div_width, \
.div.value = _div_value, \
.div.flags = _div_flags, \
.prediv.shift = _prediv_shift, \
.prediv.width = _prediv_width, \
.prediv.value = _prediv_value, \
.prediv.flags = _prediv_flags, \
.prediv.cond_shift = 0, \
.prediv.cond_width = 0, \
.prediv.cond_mask = _prediv_cond_mask, \
.prediv.cond_value = _prediv_cond_value, \
}
#define MUX_CLK(_clkname, _id, _name, _pnames, \
_offset, _shift, _width) \
static struct clk_mux_def _clkname = { \

View File

@ -157,7 +157,10 @@ aw_clk_prediv_mux_register(struct clkdom *clkdom, struct aw_clk_prediv_mux_def *
sc->prediv.mask = ((1 << clkdef->prediv.width) - 1) << sc->prediv.shift;
sc->prediv.value = clkdef->prediv.value;
sc->prediv.cond_shift = clkdef->prediv.cond_shift;
sc->prediv.cond_mask = ((1 << clkdef->prediv.cond_width) - 1) << sc->prediv.shift;
if (clkdef->prediv.cond_width != 0)
sc->prediv.cond_mask = ((1 << clkdef->prediv.cond_width) - 1) << sc->prediv.shift;
else
sc->prediv.cond_mask = clkdef->prediv.cond_mask;
sc->prediv.cond_value = clkdef->prediv.cond_value;
sc->prediv.flags = clkdef->prediv.flags;