This patch allows using reset_control_reset on a shared reset line. There are some restrictions though (all of these only apply to shared resets): - reset_control_reset cannot be used after reset_control_assert - reset_control_assert cannot be used after reset_control_reset - only the first call to reset_control_reset will be passed to the hardware. The only exception is when all consumers of the reset_control are gone (reset_control_put) The idea came up when discussing the reset logic in the phy-meson8b-usb2 PHY driver, see [0] and [1] An example where this is needed is the Amlogic Meson8b and GXBB SoCs where two USB PHYs share one reset line. The reset controller only supports reset pulses (and thus only implements .reset). The only workaround so far is to make the reset optional in the driver and only add the reset to one of the two PHYs, to mimic the behavior implemented by patch 1. I also added the Meson USB2 PHY patch to this series to show that this new functionality can be used with only minimal changes. These patches can simply be dropped as they depend on the phy-meson8b-usb2 driver patch, and the dts patch has a runtime-dependency on patch 1 and 2 (otherwise the phy-meson8b-usb2 driver would try to request the reset line exclusively, preventing the other PHY from initializing). Changes since RFC (thanks to Philipp Zabel for reviewing the RFC): - refined kernel documentation of triggered_count and fixed missing struct member "@" prefix - refined reset_control_reset kernel documentation - added note that reset_control_(de)assert and reset_control_reset can not be used together for shared resets) in the kernel documentation - fixed a potential race condition in reset_control_reset (the new logic still has a potential race condition, but only in the error case, which is pretty unlikely to happen in my opinion) - rebased to apply after reset/core.c changes ("reset: warn on invalid input to reset_control_reset/assert/deassert/status") [0] http://lists.infradead.org/pipermail/linux-amlogic/2016-September/001233.html [1] http://lists.infradead.org/pipermail/linux-amlogic/2016-September/001197.html Martin Blumenstingl (3): reset: allow using reset_control_reset with shared reset phy: meson8b-usb2: request a shared reset line ARM64: dts: meson-gxbb: add the USB reset also to the second USB PHY arch/arm64/boot/dts/amlogic/meson-gxbb.dtsi | 1 + drivers/phy/phy-meson8b-usb2.c | 3 +- drivers/reset/core.c | 43 +++++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 8 deletions(-) -- 2.10.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html