Skip to content

Commit 564a7ee

Browse files
andynxpaxboe
authored andcommitted
ahci: qoriq: enable acpi support in qoriq ahci driver
This patch enables ACPI support in qoriq ahci driver. Signed-off-by: Udit Kumar <udit.kumar@nxp.com> Signed-off-by: Yuantian Tang <andy.tang@nxp.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 6cd32a4 commit 564a7ee

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

drivers/ata/ahci_qoriq.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* Tang Yuantian <Yuantian.Tang@freescale.com>
77
*/
88

9+
#include <linux/acpi.h>
910
#include <linux/kernel.h>
1011
#include <linux/module.h>
1112
#include <linux/pm.h>
@@ -80,6 +81,12 @@ static const struct of_device_id ahci_qoriq_of_match[] = {
8081
};
8182
MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match);
8283

84+
static const struct acpi_device_id ahci_qoriq_acpi_match[] = {
85+
{"NXP0004", .driver_data = (kernel_ulong_t)AHCI_LX2160A},
86+
{ }
87+
};
88+
MODULE_DEVICE_TABLE(acpi, ahci_qoriq_acpi_match);
89+
8390
static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
8491
unsigned long deadline)
8592
{
@@ -255,6 +262,7 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv)
255262
static int ahci_qoriq_probe(struct platform_device *pdev)
256263
{
257264
struct device_node *np = pdev->dev.of_node;
265+
const struct acpi_device_id *acpi_id;
258266
struct device *dev = &pdev->dev;
259267
struct ahci_host_priv *hpriv;
260268
struct ahci_qoriq_priv *qoriq_priv;
@@ -267,14 +275,18 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
267275
return PTR_ERR(hpriv);
268276

269277
of_id = of_match_node(ahci_qoriq_of_match, np);
270-
if (!of_id)
278+
acpi_id = acpi_match_device(ahci_qoriq_acpi_match, &pdev->dev);
279+
if (!(of_id || acpi_id))
271280
return -ENODEV;
272281

273282
qoriq_priv = devm_kzalloc(dev, sizeof(*qoriq_priv), GFP_KERNEL);
274283
if (!qoriq_priv)
275284
return -ENOMEM;
276285

277-
qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
286+
if (of_id)
287+
qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
288+
else
289+
qoriq_priv->type = (enum ahci_qoriq_type)acpi_id->driver_data;
278290

279291
if (unlikely(!ecc_initialized)) {
280292
res = platform_get_resource_byname(pdev,
@@ -288,7 +300,8 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
288300
}
289301
}
290302

291-
qoriq_priv->is_dmacoherent = of_dma_is_coherent(np);
303+
if (device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT)
304+
qoriq_priv->is_dmacoherent = true;
292305

293306
rc = ahci_platform_enable_resources(hpriv);
294307
if (rc)
@@ -354,6 +367,7 @@ static struct platform_driver ahci_qoriq_driver = {
354367
.driver = {
355368
.name = DRV_NAME,
356369
.of_match_table = ahci_qoriq_of_match,
370+
.acpi_match_table = ahci_qoriq_acpi_match,
357371
.pm = &ahci_qoriq_pm_ops,
358372
},
359373
};

0 commit comments

Comments
 (0)