Johnny Hughes
2019-02-04 c1f36c28393a7bb126cbf436cd6a4077a5b5c313
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 38b559f8ab1a556cab575c907202dcc7027bc4d2 Mon Sep 17 00:00:00 2001
From: Khuong Dinh <khuong.dinh@amperecomputing.com>
Date: Fri, 7 Sep 2018 08:32:17 -0600
Subject: [PATCH 09/11] BACKPORT ata: Disable AHCI ALPM feature for Ampere
 Computing eMAG SATA
 
Due to hardware errata, Ampere Computing eMAG SATA can't support
AHCI ALPM feature. This patch disables the AHCI ALPM feature for
eMAG SATA.
 
This patch is backported from:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20180913&id=20bdc376b427cb420836f39ee8f281ea85dbaeef
 
Change-Id: I21d4a6ed7bd1f103f696b3865248c562288e2886
Signed-off-by: Suman Trpathi <stripathi@amperecomputing.com>
Signed-off-by: Rameshwar Prasad Sahu <rameshwar.sahu@amperecomputing.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Khuong Dinh <khuong.dinh@amperecomputing.com>
---
 drivers/ata/ahci_platform.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
 
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 99f9a89..9ba283f 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -33,6 +33,13 @@
     .port_ops    = &ahci_platform_ops,
 };
 
+static const struct ata_port_info ahci_port_info_nolpm = {
+    .flags        = AHCI_FLAG_COMMON | ATA_FLAG_NO_LPM,
+    .pio_mask    = ATA_PIO4,
+    .udma_mask    = ATA_UDMA6,
+    .port_ops    = &ahci_platform_ops,
+};
+
 static struct scsi_host_template ahci_platform_sht = {
     AHCI_SHT(DRV_NAME),
 };
@@ -41,6 +48,7 @@ static int ahci_probe(struct platform_device *pdev)
 {
     struct device *dev = &pdev->dev;
     struct ahci_host_priv *hpriv;
+    const struct ata_port_info *port;
     int rc;
 
     hpriv = ahci_platform_get_resources(pdev);
@@ -57,7 +65,11 @@ static int ahci_probe(struct platform_device *pdev)
     if (of_device_is_compatible(dev->of_node, "hisilicon,hisi-ahci"))
         hpriv->flags |= AHCI_HFLAG_NO_FBS | AHCI_HFLAG_NO_NCQ;
 
-    rc = ahci_platform_init_host(pdev, hpriv, &ahci_port_info,
+    port = acpi_device_get_match_data(dev);
+    if (!port)
+        port = &ahci_port_info;
+
+    rc = ahci_platform_init_host(pdev, hpriv, port,
                      &ahci_platform_sht);
     if (rc)
         goto disable_resources;
@@ -85,6 +97,7 @@ static SIMPLE_DEV_PM_OPS(ahci_pm_ops, ahci_platform_suspend,
 MODULE_DEVICE_TABLE(of, ahci_of_match);
 
 static const struct acpi_device_id ahci_acpi_match[] = {
+    { "APMC0D33", (unsigned long)&ahci_port_info_nolpm },
     { ACPI_DEVICE_CLASS(PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff) },
     {},
 };
-- 
1.8.3.1