Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Yuantian Tang and committed by
Jens Axboe
564a7eed 6cd32a44

+17 -3
+17 -3
drivers/ata/ahci_qoriq.c
··· 6 6 * Tang Yuantian <Yuantian.Tang@freescale.com> 7 7 */ 8 8 9 + #include <linux/acpi.h> 9 10 #include <linux/kernel.h> 10 11 #include <linux/module.h> 11 12 #include <linux/pm.h> ··· 80 79 {}, 81 80 }; 82 81 MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match); 82 + 83 + static const struct acpi_device_id ahci_qoriq_acpi_match[] = { 84 + {"NXP0004", .driver_data = (kernel_ulong_t)AHCI_LX2160A}, 85 + { } 86 + }; 87 + MODULE_DEVICE_TABLE(acpi, ahci_qoriq_acpi_match); 83 88 84 89 static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class, 85 90 unsigned long deadline) ··· 262 255 static int ahci_qoriq_probe(struct platform_device *pdev) 263 256 { 264 257 struct device_node *np = pdev->dev.of_node; 258 + const struct acpi_device_id *acpi_id; 265 259 struct device *dev = &pdev->dev; 266 260 struct ahci_host_priv *hpriv; 267 261 struct ahci_qoriq_priv *qoriq_priv; ··· 275 267 return PTR_ERR(hpriv); 276 268 277 269 of_id = of_match_node(ahci_qoriq_of_match, np); 278 - if (!of_id) 270 + acpi_id = acpi_match_device(ahci_qoriq_acpi_match, &pdev->dev); 271 + if (!(of_id || acpi_id)) 279 272 return -ENODEV; 280 273 281 274 qoriq_priv = devm_kzalloc(dev, sizeof(*qoriq_priv), GFP_KERNEL); 282 275 if (!qoriq_priv) 283 276 return -ENOMEM; 284 277 285 - qoriq_priv->type = (enum ahci_qoriq_type)of_id->data; 278 + if (of_id) 279 + qoriq_priv->type = (enum ahci_qoriq_type)of_id->data; 280 + else 281 + qoriq_priv->type = (enum ahci_qoriq_type)acpi_id->driver_data; 286 282 287 283 if (unlikely(!ecc_initialized)) { 288 284 res = platform_get_resource_byname(pdev, ··· 300 288 } 301 289 } 302 290 303 - qoriq_priv->is_dmacoherent = of_dma_is_coherent(np); 291 + if (device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT) 292 + qoriq_priv->is_dmacoherent = true; 304 293 305 294 rc = ahci_platform_enable_resources(hpriv); 306 295 if (rc) ··· 367 354 .driver = { 368 355 .name = DRV_NAME, 369 356 .of_match_table = ahci_qoriq_of_match, 357 + .acpi_match_table = ahci_qoriq_acpi_match, 370 358 .pm = &ahci_qoriq_pm_ops, 371 359 }, 372 360 };