[PATCH v3 2/2] net: dsa: mt7530: Use GPIO polarity to generate correct reset sequence

Krzysztof Kozlowski krzk at kernel.org
Sun Nov 30 23:50:15 PST 2025


On 30/11/2025 00:46, Chen Minqiang wrote:
> The MT7530/MT7531 reset pin is active-low in hardware, but the driver
> historically hardcoded a high-active reset sequence by toggling the GPIO
> as 0 → 1. This only worked because several DTS files incorrectly marked
> the reset GPIO as active-high, making both DTS and driver wrong in the
> same way.
> 
> This patch changes the driver to respect the GPIO polarity using
> gpiod_is_active_low(), and generates the reset sequence as:
> 
>     assert   = drive logical active level
>     deassert = drive logical inactive level
> 
> As a result, both cases now correctly produce the required
> high → low → high transition on the actual reset pin.
> 
> Compatibility
> -------------
> 
> This change makes the driver fully backward-compatible with older,
> incorrect DTS files that marked the reset line as GPIO_ACTIVE_HIGH:
> 

You must describe all cases, so old DTS using inverter, thus described
as active-low. This is perfectly possible setup.

>  * Old DTS marked active-high:
>        is_active_low = 0
>        driver drives 0 → 1
>        actual levels: high → low → high  (correct)
> 
>  * New DTS marked active-low:
>        is_active_low = 1
>        driver drives 1 → 0
>        actual levels: high → low → high  (correct)
> 

And new DTS working with inverter, so described with active-high.


Best regards,
Krzysztof



More information about the Linux-mediatek mailing list