diff mbox series

[5/5] libata/ahci: Apply non-standard BAR fix for Loongson

Message ID 20191030135347.3636-6-jiaxun.yang@flygoat.com (mailing list archive)
State Not Applicable, archived
Headers show
Series PCI Devices for Loongson PCH | expand

Commit Message

Jiaxun Yang Oct. 30, 2019, 1:53 p.m. UTC
Loongson is using BAR0 as AHCI registers BAR.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 drivers/ata/ahci.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

John Garry Oct. 31, 2019, 10:39 a.m. UTC | #1
On 30/10/2019 13:53, Jiaxun Yang wrote:
> Loongson is using BAR0 as AHCI registers BAR.
> 
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>   drivers/ata/ahci.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index dd92faf197d5..db3d7b94ad53 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -42,6 +42,7 @@ enum {
>   	AHCI_PCI_BAR_CAVIUM	= 0,
>   	AHCI_PCI_BAR_ENMOTUS	= 2,
>   	AHCI_PCI_BAR_CAVIUM_GEN5	= 4,
> +	AHCI_PCI_BAR_LOONGSON	= 0,

nit: these seem to be ordered by ascending BAR index

>   	AHCI_PCI_BAR_STANDARD	= 5,
>   };
>   
> @@ -575,6 +576,9 @@ static const struct pci_device_id ahci_pci_tbl[] = {
>   	/* Enmotus */
>   	{ PCI_DEVICE(0x1c44, 0x8000), board_ahci },
>   
> +	/* Loongson */
> +	{ PCI_VDEVICE(LOONGSON, 0x7a08), board_ahci },
> +
>   	/* Generic, PCI class code for AHCI */
>   	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
>   	  PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
> @@ -1663,6 +1667,9 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>   			ahci_pci_bar = AHCI_PCI_BAR_CAVIUM;
>   		if (pdev->device == 0xa084)
>   			ahci_pci_bar = AHCI_PCI_BAR_CAVIUM_GEN5;
> +	} else if (pdev->vendor == PCI_VENDOR_ID_LOONGSON) {
> +		if (pdev->device == PCI_DEVICE_ID_LOONGSON_AHCI)
> +			ahci_pci_bar = AHCI_PCI_BAR_LOONGSON;
>   	}
>   
>   	/* acquire resources */
>
diff mbox series

Patch

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index dd92faf197d5..db3d7b94ad53 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -42,6 +42,7 @@  enum {
 	AHCI_PCI_BAR_CAVIUM	= 0,
 	AHCI_PCI_BAR_ENMOTUS	= 2,
 	AHCI_PCI_BAR_CAVIUM_GEN5	= 4,
+	AHCI_PCI_BAR_LOONGSON	= 0,
 	AHCI_PCI_BAR_STANDARD	= 5,
 };
 
@@ -575,6 +576,9 @@  static const struct pci_device_id ahci_pci_tbl[] = {
 	/* Enmotus */
 	{ PCI_DEVICE(0x1c44, 0x8000), board_ahci },
 
+	/* Loongson */
+	{ PCI_VDEVICE(LOONGSON, 0x7a08), board_ahci },
+
 	/* Generic, PCI class code for AHCI */
 	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
 	  PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci },
@@ -1663,6 +1667,9 @@  static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 			ahci_pci_bar = AHCI_PCI_BAR_CAVIUM;
 		if (pdev->device == 0xa084)
 			ahci_pci_bar = AHCI_PCI_BAR_CAVIUM_GEN5;
+	} else if (pdev->vendor == PCI_VENDOR_ID_LOONGSON) {
+		if (pdev->device == PCI_DEVICE_ID_LOONGSON_AHCI)
+			ahci_pci_bar = AHCI_PCI_BAR_LOONGSON;
 	}
 
 	/* acquire resources */