• Tero Kristo's avatar
    clk: ti: divider: convert to use min,max,mask instead of width · 8ffea6ee
    Tero Kristo authored
    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: default avatarTero Kristo <t-kristo@ti.com>
    Tested-by: default avatarAdam Ford <aford173@gmail.com>
    8ffea6ee
clock.h 9.07 KB