linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ahci: qoriq: enable acpi support in qoriq ahci driver
@ 2020-08-17  8:22 andy.tang
  2020-09-02  7:38 ` Andy Tang
  2020-10-02 20:53 ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: andy.tang @ 2020-08-17  8:22 UTC (permalink / raw)
  To: axboe; +Cc: linux-ide, linux-kernel, Yuantian Tang, Udit Kumar

From: Yuantian Tang <andy.tang@nxp.com>

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>
---
 drivers/ata/ahci_qoriq.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
index a330307d3201..5b46fc9aeb4a 100644
--- a/drivers/ata/ahci_qoriq.c
+++ b/drivers/ata/ahci_qoriq.c
@@ -6,6 +6,7 @@
  *   Tang Yuantian <Yuantian.Tang@freescale.com>
  */
 
+#include <linux/acpi.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pm.h>
@@ -80,6 +81,12 @@ static const struct of_device_id ahci_qoriq_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match);
 
+static const struct acpi_device_id ahci_qoriq_acpi_match[] = {
+	{"NXP0004", .driver_data = (kernel_ulong_t)AHCI_LX2160A},
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, ahci_qoriq_acpi_match);
+
 static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
 			  unsigned long deadline)
 {
@@ -255,6 +262,7 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv *hpriv)
 static int ahci_qoriq_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
+	const struct acpi_device_id *acpi_id;
 	struct device *dev = &pdev->dev;
 	struct ahci_host_priv *hpriv;
 	struct ahci_qoriq_priv *qoriq_priv;
@@ -267,14 +275,18 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
 		return PTR_ERR(hpriv);
 
 	of_id = of_match_node(ahci_qoriq_of_match, np);
-	if (!of_id)
+	acpi_id = acpi_match_device(ahci_qoriq_acpi_match, &pdev->dev);
+	if (!(of_id || acpi_id))
 		return -ENODEV;
 
 	qoriq_priv = devm_kzalloc(dev, sizeof(*qoriq_priv), GFP_KERNEL);
 	if (!qoriq_priv)
 		return -ENOMEM;
 
-	qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
+	if (of_id)
+		qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
+	else
+		qoriq_priv->type = (enum ahci_qoriq_type)acpi_id->driver_data;
 
 	if (unlikely(!ecc_initialized)) {
 		res = platform_get_resource_byname(pdev,
@@ -288,7 +300,8 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
 		}
 	}
 
-	qoriq_priv->is_dmacoherent = of_dma_is_coherent(np);
+	if (device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT)
+		qoriq_priv->is_dmacoherent = true;
 
 	rc = ahci_platform_enable_resources(hpriv);
 	if (rc)
@@ -354,6 +367,7 @@ static struct platform_driver ahci_qoriq_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_qoriq_of_match,
+		.acpi_match_table = ahci_qoriq_acpi_match,
 		.pm = &ahci_qoriq_pm_ops,
 	},
 };
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] ahci: qoriq: enable acpi support in qoriq ahci driver
  2020-08-17  8:22 [PATCH] ahci: qoriq: enable acpi support in qoriq ahci driver andy.tang
@ 2020-09-02  7:38 ` Andy Tang
  2020-10-02 20:53 ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Tang @ 2020-09-02  7:38 UTC (permalink / raw)
  To: axboe; +Cc: linux-ide, linux-kernel, Udit Kumar

Hi Axboe,

Please take some times reviewing this patch.

Thanks,
Andy

> -----Original Message-----
> From: andy.tang@nxp.com <andy.tang@nxp.com>
> Sent: 2020年8月17日 16:22
> To: axboe@kernel.dk
> Cc: linux-ide@vger.kernel.org; linux-kernel@vger.kernel.org; Andy Tang
> <andy.tang@nxp.com>; Udit Kumar <udit.kumar@nxp.com>
> Subject: [PATCH] ahci: qoriq: enable acpi support in qoriq ahci driver
> 
> From: Yuantian Tang <andy.tang@nxp.com>
> 
> 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>
> ---
>  drivers/ata/ahci_qoriq.c | 20 +++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c index
> a330307d3201..5b46fc9aeb4a 100644
> --- a/drivers/ata/ahci_qoriq.c
> +++ b/drivers/ata/ahci_qoriq.c
> @@ -6,6 +6,7 @@
>   *   Tang Yuantian <Yuantian.Tang@freescale.com>
>   */
> 
> +#include <linux/acpi.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/pm.h>
> @@ -80,6 +81,12 @@ static const struct of_device_id ahci_qoriq_of_match[] =
> {  };  MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match);
> 
> +static const struct acpi_device_id ahci_qoriq_acpi_match[] = {
> +	{"NXP0004", .driver_data = (kernel_ulong_t)AHCI_LX2160A},
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(acpi, ahci_qoriq_acpi_match);
> +
>  static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
>  			  unsigned long deadline)
>  {
> @@ -255,6 +262,7 @@ static int ahci_qoriq_phy_init(struct ahci_host_priv
> *hpriv)  static int ahci_qoriq_probe(struct platform_device *pdev)  {
>  	struct device_node *np = pdev->dev.of_node;
> +	const struct acpi_device_id *acpi_id;
>  	struct device *dev = &pdev->dev;
>  	struct ahci_host_priv *hpriv;
>  	struct ahci_qoriq_priv *qoriq_priv;
> @@ -267,14 +275,18 @@ static int ahci_qoriq_probe(struct platform_device
> *pdev)
>  		return PTR_ERR(hpriv);
> 
>  	of_id = of_match_node(ahci_qoriq_of_match, np);
> -	if (!of_id)
> +	acpi_id = acpi_match_device(ahci_qoriq_acpi_match, &pdev->dev);
> +	if (!(of_id || acpi_id))
>  		return -ENODEV;
> 
>  	qoriq_priv = devm_kzalloc(dev, sizeof(*qoriq_priv), GFP_KERNEL);
>  	if (!qoriq_priv)
>  		return -ENOMEM;
> 
> -	qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
> +	if (of_id)
> +		qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
> +	else
> +		qoriq_priv->type = (enum ahci_qoriq_type)acpi_id->driver_data;
> 
>  	if (unlikely(!ecc_initialized)) {
>  		res = platform_get_resource_byname(pdev,
> @@ -288,7 +300,8 @@ static int ahci_qoriq_probe(struct platform_device
> *pdev)
>  		}
>  	}
> 
> -	qoriq_priv->is_dmacoherent = of_dma_is_coherent(np);
> +	if (device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT)
> +		qoriq_priv->is_dmacoherent = true;
> 
>  	rc = ahci_platform_enable_resources(hpriv);
>  	if (rc)
> @@ -354,6 +367,7 @@ static struct platform_driver ahci_qoriq_driver = {
>  	.driver = {
>  		.name = DRV_NAME,
>  		.of_match_table = ahci_qoriq_of_match,
> +		.acpi_match_table = ahci_qoriq_acpi_match,
>  		.pm = &ahci_qoriq_pm_ops,
>  	},
>  };
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ahci: qoriq: enable acpi support in qoriq ahci driver
  2020-08-17  8:22 [PATCH] ahci: qoriq: enable acpi support in qoriq ahci driver andy.tang
  2020-09-02  7:38 ` Andy Tang
@ 2020-10-02 20:53 ` Jens Axboe
  1 sibling, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2020-10-02 20:53 UTC (permalink / raw)
  To: andy.tang; +Cc: linux-ide, linux-kernel, Udit Kumar

On 8/17/20 2:22 AM, andy.tang@nxp.com wrote:
> From: Yuantian Tang <andy.tang@nxp.com>
> 
> This patch enables ACPI support in qoriq ahci driver.

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] ahci_qoriq: enable acpi support in qoriq ahci driver
@ 2020-03-17  8:52 Peng Ma
  0 siblings, 0 replies; 4+ messages in thread
From: Peng Ma @ 2020-03-17  8:52 UTC (permalink / raw)
  To: axboe; +Cc: leoyang.li, andy.tang, linux-ide, linux-kernel, Udit Kumar, Peng Ma

From: Udit Kumar <udit.kumar@nxp.com>

This patch enables ACPI support in qoriq ahci driver.

Signed-off-by: Udit Kumar <udit.kumar@nxp.com>
Signed-off-by: Peng Ma <peng.ma@nxp.com>
---
 drivers/ata/ahci_qoriq.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
index a330307..f0f7723 100644
--- a/drivers/ata/ahci_qoriq.c
+++ b/drivers/ata/ahci_qoriq.c
@@ -6,6 +6,7 @@
  *   Tang Yuantian <Yuantian.Tang@freescale.com>
  */
 
+#include <linux/acpi.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/pm.h>
@@ -80,6 +81,12 @@ static const struct of_device_id ahci_qoriq_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, ahci_qoriq_of_match);
 
+static const struct acpi_device_id ahci_qoriq_acpi_match[] = {
+	{"NXP0004", .driver_data = (kernel_ulong_t)AHCI_LX2160A},
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, ahci_qoriq_acpi_match);
+
 static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
 			  unsigned long deadline)
 {
@@ -261,25 +268,28 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
 	const struct of_device_id *of_id;
 	struct resource *res;
 	int rc;
+	const struct acpi_device_id *acpi_id;
 
 	hpriv = ahci_platform_get_resources(pdev, 0);
 	if (IS_ERR(hpriv))
 		return PTR_ERR(hpriv);
 
 	of_id = of_match_node(ahci_qoriq_of_match, np);
-	if (!of_id)
+	acpi_id = acpi_match_device(ahci_qoriq_acpi_match, &pdev->dev);
+	if (!(of_id || acpi_id))
 		return -ENODEV;
 
 	qoriq_priv = devm_kzalloc(dev, sizeof(*qoriq_priv), GFP_KERNEL);
 	if (!qoriq_priv)
 		return -ENOMEM;
 
-	qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
+	if (of_id)
+		qoriq_priv->type = (enum ahci_qoriq_type)of_id->data;
+	else
+		qoriq_priv->type = (enum ahci_qoriq_type)acpi_id->driver_data;
 
 	if (unlikely(!ecc_initialized)) {
-		res = platform_get_resource_byname(pdev,
-						   IORESOURCE_MEM,
-						   "sata-ecc");
+		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 		if (res) {
 			qoriq_priv->ecc_addr =
 				devm_ioremap_resource(dev, res);
@@ -288,7 +298,8 @@ static int ahci_qoriq_probe(struct platform_device *pdev)
 		}
 	}
 
-	qoriq_priv->is_dmacoherent = of_dma_is_coherent(np);
+	if (device_get_dma_attr(&pdev->dev) == DEV_DMA_COHERENT)
+		qoriq_priv->is_dmacoherent = true;
 
 	rc = ahci_platform_enable_resources(hpriv);
 	if (rc)
@@ -354,6 +365,7 @@ static struct platform_driver ahci_qoriq_driver = {
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = ahci_qoriq_of_match,
+		.acpi_match_table = ahci_qoriq_acpi_match,
 		.pm = &ahci_qoriq_pm_ops,
 	},
 };
-- 
2.9.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-02 20:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-17  8:22 [PATCH] ahci: qoriq: enable acpi support in qoriq ahci driver andy.tang
2020-09-02  7:38 ` Andy Tang
2020-10-02 20:53 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2020-03-17  8:52 [PATCH] ahci_qoriq: " Peng Ma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).