Re: [PATCH v2] ata: libahci_platform: support non-consecutive port numbers

From: Damien Le Moal
Date: Mon Jan 06 2025 - 00:28:42 EST


On 1/1/25 9:13 PM, Josua Mayer wrote:
> So far ahci_platform relied on number of child nodes in firmware to
> allocate arrays and expected port numbers to start from 0 without holes.
> This number of ports is then set in private structure for use when
> configuring phys and regulators.
>
> Some platforms may not use every port of an ahci controller.
> E.g. SolidRUN CN9130 Clearfog uses only port 1 but not port 0, leading
> to the following errors during boot:
> [ 1.719476] ahci f2540000.sata: invalid port number 1
> [ 1.724562] ahci f2540000.sata: No port enabled
>
> Update all accessesors of ahci_host_priv phys and target_pwrs arrays to
> support holes. Access is gated by hpriv->mask_port_map which has a bit
> set for each enabled port.
>
> Update ahci_platform_get_resources to ignore holes in the port numbers
> and enable ports defined in firmware by their reg property only.
>
> When firmware does not define children it is assumed that there is
> exactly one port, using index 0.
>
> Signed-off-by: Josua Mayer <josua@xxxxxxxxxxxxx>

Applied to for-6.14. Thanks !

--
Damien Le Moal
Western Digital Research