svn commit: r326113 - head/sys/arm/allwinner/clkng
Kyle Evans
kevans at FreeBSD.org
Thu Nov 23 05:43:46 UTC 2017
Author: kevans
Date: Thu Nov 23 05:43:44 2017
New Revision: 326113
URL: https://svnweb.freebsd.org/changeset/base/326113
Log:
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
Modified:
head/sys/arm/allwinner/clkng/aw_clk.h
head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c
Modified: head/sys/arm/allwinner/clkng/aw_clk.h
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_clk.h Thu Nov 23 03:40:51 2017 (r326112)
+++ head/sys/arm/allwinner/clkng/aw_clk.h Thu Nov 23 05:43:44 2017 (r326113)
@@ -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)
*/
@@ -389,6 +390,36 @@ aw_clk_factor_get_value(struct aw_clk_factor *factor,
.prediv.flags = _prediv_flags, \
.prediv.cond_shift = _prediv_cond_shift, \
.prediv.cond_width = _prediv_cond_width, \
+ .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, \
}
Modified: head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c Thu Nov 23 03:40:51 2017 (r326112)
+++ head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c Thu Nov 23 05:43:44 2017 (r326113)
@@ -157,7 +157,10 @@ aw_clk_prediv_mux_register(struct clkdom *clkdom, stru
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;
More information about the svn-src-head
mailing list