diff options
author | Tero Kristo <t-kristo@ti.com> | 2019-10-02 14:06:10 +0200 |
---|---|---|
committer | Tero Kristo <t-kristo@ti.com> | 2019-10-31 14:32:36 +0100 |
commit | 8ffea6eef4ace7e207fc2fe852d2019d93f51d1a (patch) | |
tree | 2a85ca80ee3c32c01eacb1aee7f6a9acf73f750f /drivers/clk/ti/clock.h | |
parent | clk: ti: divider: cleanup ti_clk_parse_divider_data API (diff) | |
download | linux-8ffea6eef4ace7e207fc2fe852d2019d93f51d1a.tar.xz linux-8ffea6eef4ace7e207fc2fe852d2019d93f51d1a.zip |
clk: ti: divider: convert to use min,max,mask instead of width
The existing width field used to check divider validity does not provide
enough protection against bad values. For example, if max divider value
is 4, the smallest all-1 bitmask that can hold this value is 7, which
allows values higher than 4 to be used. This typically causes
unpredictable results with hardware. So far this issue hasn't been
noticed as most of the dividers actually have maximum values which fit
the whole bitfield, but there are certain clocks for which this is a
problem, like dpll4_m4 divider on omap3 devices.
Thus, convert the whole validity logic to use min,max and mask values
for determining if a specific divider is valid or not. This prevents
the odd cases where bad value would otherwise be written to a divider
config register.
Signed-off-by: Tero Kristo <t-kristo@ti.com>
Tested-by: Adam Ford <aford173@gmail.com>
Diffstat (limited to 'drivers/clk/ti/clock.h')
-rw-r--r-- | drivers/clk/ti/clock.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h index f6b6876dfdee..e6995c04001e 100644 --- a/drivers/clk/ti/clock.h +++ b/drivers/clk/ti/clock.h @@ -20,9 +20,11 @@ struct clk_omap_divider { struct clk_hw hw; struct clk_omap_reg reg; u8 shift; - u8 width; u8 flags; s8 latch; + u16 min; + u16 max; + u16 mask; const struct clk_div_table *table; u32 context; }; |