Re: [PATCH 4/7] phy: meson: add USB2 PHY support for Meson8b and GXBB
From: Philipp Zabel <hidden>
Date: 2016-09-15 10:30:50
Also in:
linux-amlogic, linux-arm-kernel, linux-clk
Hi Martin, Am Mittwoch, den 14.09.2016, 23:23 +0200 schrieb Martin Blumenstingl: [...]
quoted
We could add a triggered flag or a counter to struct reset_control, and have reset_control_reset_once do nothing if it is already set / incremented. Since the reset_control goes away with the last consumer, the shared reset line would get triggered again after unbinding both PHY devices.I guess that'd do the trick for us: - we could use devm_reset_control_get_optional_shared() during probe - power_on would then call reset_control_reset() - the code in reset_control_reset would be changed: the if (WARN_ON(rstc->shared)) would be removed. then we return 0 if (rstc->shared && atomic_read(&rstc->shared_triggered)). otherwise we proceed with the old logic, except that we use atomic_set(&rstc->shared_triggerred, 1) in case of success (if an error was returned we leave it as "not triggered"). Let me know if you want me to (at least try to) implement that and send an RFC.
Yes, please give it a try. reset_control_reset should still WARN if the deassert count is set, and reset_(de)assert should do so if triggered is set. Mixing the two won't work. And it should be documented that shared reset_control_reset may do nothing if the reset was already triggered by another consumer. regards Philipp -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html