Add bus-reset-gpios and bus-reset-duration-us properties to the
marvell,mv64xxx-i2c binding. These can be used to describe hardware
where a common reset GPIO is connected to all downstream devices on and
I2C bus. This reset will be asserted then released before the downstream
devices on the bus are probed.
Signed-off-by: Chris Packham <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
---
Notes:
Changes in v5:
- Rename reset-gpios and reset-duration-us to bus-reset-gpios and
bus-reset-duration-us as requested by Wolfram
Changes in v4:
- Add r-by from Krzysztof
Changes in v3:
- Rename reset-delay-us to reset-duration-us to better reflect its
purpose
- Add default: for reset-duration-us
- Add description: for reset-gpios
Changes in v2:
- Update commit message
- Add reset-delay-us property
.../devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml b/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml
index 461d1c9ee3f7..b165d1c4f0b1 100644
--- a/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml
@@ -70,6 +70,16 @@ properties:
resets:
maxItems: 1
+ bus-reset-gpios:
+ description:
+ GPIO pin providing a common reset for all downstream devices. This GPIO
+ will be asserted then released before the downstream devices are probed.
+ maxItems: 1
+
+ bus-reset-duration-us:
+ description: Reset duration in us.
+ default: 1
+
dmas:
items:
- description: RX DMA Channel
--
2.42.0
On Fri, Oct 27, 2023 at 04:31:03PM +1300, Chris Packham wrote:
> Add bus-reset-gpios and bus-reset-duration-us properties to the
> marvell,mv64xxx-i2c binding. These can be used to describe hardware
> where a common reset GPIO is connected to all downstream devices on and
> I2C bus. This reset will be asserted then released before the downstream
> devices on the bus are probed.
>
> Signed-off-by: Chris Packham <[email protected]>
> Reviewed-by: Krzysztof Kozlowski <[email protected]>
Krzysztof, are you fine with this change?
> ---
>
> Notes:
> Changes in v5:
> - Rename reset-gpios and reset-duration-us to bus-reset-gpios and
> bus-reset-duration-us as requested by Wolfram
> Changes in v4:
> - Add r-by from Krzysztof
> Changes in v3:
> - Rename reset-delay-us to reset-duration-us to better reflect its
> purpose
> - Add default: for reset-duration-us
> - Add description: for reset-gpios
> Changes in v2:
> - Update commit message
> - Add reset-delay-us property
>
> .../devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml b/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml
> index 461d1c9ee3f7..b165d1c4f0b1 100644
> --- a/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml
> +++ b/Documentation/devicetree/bindings/i2c/marvell,mv64xxx-i2c.yaml
> @@ -70,6 +70,16 @@ properties:
> resets:
> maxItems: 1
>
> + bus-reset-gpios:
> + description:
> + GPIO pin providing a common reset for all downstream devices. This GPIO
> + will be asserted then released before the downstream devices are probed.
> + maxItems: 1
> +
> + bus-reset-duration-us:
> + description: Reset duration in us.
> + default: 1
> +
> dmas:
> items:
> - description: RX DMA Channel
> --
> 2.42.0
>
On 27/10/2023 11:09, Wolfram Sang wrote:
> On Fri, Oct 27, 2023 at 04:31:03PM +1300, Chris Packham wrote:
>> Add bus-reset-gpios and bus-reset-duration-us properties to the
>> marvell,mv64xxx-i2c binding. These can be used to describe hardware
>> where a common reset GPIO is connected to all downstream devices on and
>> I2C bus. This reset will be asserted then released before the downstream
>> devices on the bus are probed.
>>
>> Signed-off-by: Chris Packham <[email protected]>
>> Reviewed-by: Krzysztof Kozlowski <[email protected]>
>
> Krzysztof, are you fine with this change?
Actually no. NAK.
Not because of the naming, but because the new name triggered some new
paths in my brain which brought the point - this is old problem of power
sequencing of children.
I believe this must be solved in more generic way. First - generic for
all I2C devices. Second - generic also matching other buses/subsystems,
which have similar problem. We did it for USB (onboard USB), MMC
(unloved MMC power sequence) and now we are doing it for PCIe and few
others (Cc: Abel)
https://lpc.events/event/17/contributions/1507/
Current solution is heavily limited. What about regulators? What about
buses having 2 reset lines (still the same bus)? What about sequence?
Best regards,
Krzysztof
On Fri, Oct 27, 2023 at 01:25:56PM +0200, Krzysztof Kozlowski wrote:
> On 27/10/2023 11:09, Wolfram Sang wrote:
> > On Fri, Oct 27, 2023 at 04:31:03PM +1300, Chris Packham wrote:
> >> Add bus-reset-gpios and bus-reset-duration-us properties to the
> >> marvell,mv64xxx-i2c binding. These can be used to describe hardware
> >> where a common reset GPIO is connected to all downstream devices on and
> >> I2C bus. This reset will be asserted then released before the downstream
> >> devices on the bus are probed.
> >>
> >> Signed-off-by: Chris Packham <[email protected]>
> >> Reviewed-by: Krzysztof Kozlowski <[email protected]>
> >
> > Krzysztof, are you fine with this change?
>
> Actually no. NAK.
>
> Not because of the naming, but because the new name triggered some new
> paths in my brain which brought the point - this is old problem of power
> sequencing of children.
>
> I believe this must be solved in more generic way. First - generic for
> all I2C devices. Second - generic also matching other buses/subsystems,
> which have similar problem. We did it for USB (onboard USB), MMC
> (unloved MMC power sequence) and now we are doing it for PCIe and few
> others (Cc: Abel)
Unlike the others I2C doesn't expect to access the bus/device before
devices probe, right?
> https://lpc.events/event/17/contributions/1507/
Oh, good!
> Current solution is heavily limited. What about regulators? What about
> buses having 2 reset lines (still the same bus)? What about sequence?
A more complicated case should be handled by the device's driver. If the
GPIO reset was not shared we'd be handling it there too. I think what's
needed is to solve the shared aspect. That's already done with reset
subsys, so I think making 'reset-gpios' handled by it too is the way
forward. That would handle the QCA WiFi/BT case I think.
I'm not sure waiting for that or something else to happen is worth
holding up this simple case. It's not the only case of a common reset
for a bus (MDIO).
Rob
On 27/10/2023 21:22, Rob Herring wrote:
> On Fri, Oct 27, 2023 at 01:25:56PM +0200, Krzysztof Kozlowski wrote:
>> On 27/10/2023 11:09, Wolfram Sang wrote:
>>> On Fri, Oct 27, 2023 at 04:31:03PM +1300, Chris Packham wrote:
>>>> Add bus-reset-gpios and bus-reset-duration-us properties to the
>>>> marvell,mv64xxx-i2c binding. These can be used to describe hardware
>>>> where a common reset GPIO is connected to all downstream devices on and
>>>> I2C bus. This reset will be asserted then released before the downstream
>>>> devices on the bus are probed.
>>>>
>>>> Signed-off-by: Chris Packham <[email protected]>
>>>> Reviewed-by: Krzysztof Kozlowski <[email protected]>
>>>
>>> Krzysztof, are you fine with this change?
>>
>> Actually no. NAK.
>>
>> Not because of the naming, but because the new name triggered some new
>> paths in my brain which brought the point - this is old problem of power
>> sequencing of children.
>>
>> I believe this must be solved in more generic way. First - generic for
>> all I2C devices. Second - generic also matching other buses/subsystems,
>> which have similar problem. We did it for USB (onboard USB), MMC
>> (unloved MMC power sequence) and now we are doing it for PCIe and few
>> others (Cc: Abel)
>
> Unlike the others I2C doesn't expect to access the bus/device before
> devices probe, right?
>
>> https://lpc.events/event/17/contributions/1507/
>
> Oh, good!
>
>> Current solution is heavily limited. What about regulators? What about
>> buses having 2 reset lines (still the same bus)? What about sequence?
>
> A more complicated case should be handled by the device's driver. If the
> GPIO reset was not shared we'd be handling it there too. I think what's
> needed is to solve the shared aspect. That's already done with reset
> subsys, so I think making 'reset-gpios' handled by it too is the way
> forward. That would handle the QCA WiFi/BT case I think.
>
> I'm not sure waiting for that or something else to happen is worth
> holding up this simple case. It's not the only case of a common reset
> for a bus (MDIO).
I argue also that this bus-reset-gpios is not a property of this I2C
controller. IIUC, the I2C controller does not have a line to reset all
children. It's the children who have reset lines and it happens it is
shared. Just like my WSA884x case:
https://lore.kernel.org/alsa-devel/[email protected]/
Best regards,
Krzysztof