Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2135302pxa; Mon, 17 Aug 2020 01:32:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7V8qHAsTsEAtCXumMWrXfsvIZDBomScS47ItuEQn7YNysv0aPhoqjTKRVpLa4xgUsq07S X-Received: by 2002:a17:906:7e0a:: with SMTP id e10mr13777060ejr.312.1597653137191; Mon, 17 Aug 2020 01:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597653137; cv=none; d=google.com; s=arc-20160816; b=cl/vaUWcsOzWI8VU797fQeu4BRvtF2ov4ETStCH1hTpzBVHTvTC/KgQbfsCkLCaTiL zWoQzUIRz59dBe805Tf7pCeVGWHXn/K6O8MSsX0PU3Y5Ac95w65VuQlTNdVx+ide7epD O8DndILe8li8catANvwyzW+upptyQMU7/z16tkfvu+4NfK5S9UXK0j4OnaijuUygtR4v CihPejVwsEo8+CuUXVxM1ziKuJtZI3kDjJEtXTKFOA1FBy/xuryYqkutRQu2QfPklwhX gCj42g+KbVO+gs59np6JW3IeMvOZcCcRYqocK7o4bbHAm/hfW6mmEg8fvL2NFJ9xRF0X 0G2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=6WY3UMeE9m9H1vbjKPMBJA10qjqPzCklvoxDqOKqbnY=; b=oXQIsG3++avYbEaQZnrcow6bXOrsRsWlDE8rsshHKlnmFgXQhR/e1tLaINehGYosKR dF4f+1v308mpPY1MVj+G59lBquuEQlireT6C4KcucC6KfUbM+VtAsnNuNLXE1sdfEq1S 7PomYjq31u/eJr6avQCYWcccv/OkGBowH2t3Iqtxw/dVTsIKFcRN0k8E6U4vTut0oBX6 +9uP5Cnoxgw9NSaNuD9SmAtWCAsiDiHJgpnux91OaLOJA9mko7I5kU/6zxWyOKS5IjHv Kh5jWG2Hb8cu0DHPPypUaGBTM4cgjW+2FvfW+GBP3Jnv91DI1vwlTjJJe8ieHqQj7Pg9 0L5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y23si10976216ejd.544.2020.08.17.01.31.54; Mon, 17 Aug 2020 01:32:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728565AbgHQI33 (ORCPT + 99 others); Mon, 17 Aug 2020 04:29:29 -0400 Received: from inva020.nxp.com ([92.121.34.13]:45170 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728230AbgHQI3X (ORCPT ); Mon, 17 Aug 2020 04:29:23 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 451011A0078; Mon, 17 Aug 2020 10:29:21 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id D409F1A0CB3; Mon, 17 Aug 2020 10:29:18 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 7B9A6402BE; Mon, 17 Aug 2020 10:29:15 +0200 (CEST) From: andy.tang@nxp.com To: axboe@kernel.dk Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Yuantian Tang , Udit Kumar Subject: [PATCH] ahci: qoriq: enable acpi support in qoriq ahci driver Date: Mon, 17 Aug 2020 16:22:04 +0800 Message-Id: <20200817082204.13523-1-andy.tang@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yuantian Tang This patch enables ACPI support in qoriq ahci driver. Signed-off-by: Udit Kumar Signed-off-by: Yuantian Tang --- 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 */ +#include #include #include #include @@ -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