Re: [PATCH v3 09/15] ata: ahci: add PCI AHCI and Marvell 9170 controller support

"Sascha Hauer" <[email protected]> Mon, 03 Aug 2026 21:33:03 +0000
Newsgroups org.infradead.lists.barebox
Message-ID <[email protected]>
On 2026-08-02 15:16, Luca Lauro via B4 Relay wrote:
> From: Luca Lauro <[email protected]>
>=20
> Barebox previously supported only memory-mapped AHCI controllers.
> Some devices expose their AHCI controller through PCI BARs, such as the
> Marvell 9170 controller found in Netgear RN102/RN104 NAS devices,
> requiring a dedicated probing path and MMIO mapping.
> This patch extends the barebox AHCI driver with full support for
> PCI-based AHCI controllers, adding:
>=20
> - A PCI probe path that enables AHCI initialization via
> pci_enable_device(), pci_iomap() and ahci_add_host().
>=20
> - A small device list to keep track of PCI AHCI instances.
>=20
> Changes are based on the upstream Linux driver, with some adaptations.
>=20
> Signed-off-by: Luca Lauro <[email protected]>
> ---
>  drivers/ata/ahci.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++=
++++++
>  drivers/ata/ahci.h |  1 +
>  2 files changed, 55 insertions(+)
>=20
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 819dc37b3e..0ac1a9dead 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -19,6 +19,7 @@
>  #include <disks.h>
>  #include <ata_drive.h>
>  #include <linux/sizes.h>
> +#include <linux/pci.h>
>  #include <clock.h>
> =20
>  #include "ahci.h"
> @@ -47,6 +48,51 @@
>  #define ahci_debug(ahci, fmt, arg...) \
>  	dev_dbg(ahci->dev, fmt, ##arg)
> =20
> +#ifndef PCI_VENDOR_ID_MARVELL_EXT
> +#define PCI_VENDOR_ID_MARVELL_EXT 0x1b4b
> +#endif

This is defined in include/linux/pci_ids.h already. Please use it.

> +
> +static LIST_HEAD(ahci_devices);

This list is only added to, but not used here. If it's used in a later
patch please move this there.

Sascha

--
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |