• Peter Maydell's avatar
    clock: Provide builtin multiplier/divider · 99abcbc7
    Peter Maydell authored
    It is quite common for a clock tree to involve possibly programmable
    clock multipliers or dividers, where the frequency of a clock is for
    instance divided by 8 to produce a slower clock to feed to a
    particular device.
    Currently we provide no convenient mechanism for modelling this.  You
    can implement it by having an input Clock and an output Clock, and
    manually setting the period of the output clock in the period-changed
    callback of the input clock, but that's quite clunky.
    This patch adds support in the Clock objects themselves for setting a
    multiplier or divider.  The effect of setting this on a clock is that
    when the clock's period is changed, all the children of the clock are
    set to period * multiplier / divider, rather than being set to the
    same period as the parent clock.
    Signed-off-by: Peter Maydell's avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: erdnaxe's avatarAlexandre Iooss <erdnaxe@crans.org>
    Reviewed-by: default avatarAlistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Philippe Ma...