• Hans de Goede's avatar
    reset: Add support for shared reset controls · 0b52297f
    Hans de Goede authored
    In some SoCs some hw-blocks share a reset control. Add support for this
    setup by adding new:
    
    reset_control_get_shared()
    devm_reset_control_get_shared()
    devm_reset_control_get_shared_by_index()
    
    methods to get a reset_control. Note that this patch omits adding of_
    variants, if these are needed later they can be easily added.
    
    This patch also changes the behavior of the existing exclusive
    reset_control_get() variants, if these are now called more then once
    for the same reset_control they will return -EBUSY. To catch existing
    drivers triggering this error (there should not be any) a WARN_ON(1)
    is added in this path.
    
    When a reset_control is shared, the behavior of reset_control_assert /
    deassert is changed, for shared reset_controls these will work like the
    clock-enable/disable and regulator-on/off functions. They will keep a
    deassert_count, and only (re-)assert the reset after reset_control_assert
    has been called as many times as reset_control_deassert was called.
    
    Calling reset_control_assert without first calling reset_control_deassert
    is not allowed on a shared reset control. Calling reset_control_reset is
    also not allowed on a shared reset control.
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
    0b52297f
reset.h 7.02 KB