From patchwork Fri Apr 26 11:19:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Udit Kumar X-Patchwork-Id: 1091494 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="fYHwa6Vv"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44rBQM75S9z9s5c for ; Fri, 26 Apr 2019 21:19:07 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725954AbfDZLTH (ORCPT ); Fri, 26 Apr 2019 07:19:07 -0400 Received: from mail-eopbgr40049.outbound.protection.outlook.com ([40.107.4.49]:25558 "EHLO EUR03-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725901AbfDZLTH (ORCPT ); Fri, 26 Apr 2019 07:19:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hi/zC6D/HNvWBYqzxAWFwisNm9PbaCjOFL6Dn3mQfEs=; b=fYHwa6VvOqp1L9Be9CnOaTld3UcSM1cGK09ikABZmpFRWkfJzgLHGGhd7m/9AFdVSZSFap1jxBAWMlxVMr+pqAz+FCzjc9+NwitQsmGTpOgtRuoP4PgNrN8dGS1tYGaW/42uwLlOG22Z1/0dsGhQCRtr4r+a6OTKju8pVZQPe5c= Received: from VI1PR04MB4640.eurprd04.prod.outlook.com (20.177.56.27) by VI1PR04MB5598.eurprd04.prod.outlook.com (20.178.125.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1835.13; Fri, 26 Apr 2019 11:19:03 +0000 Received: from VI1PR04MB4640.eurprd04.prod.outlook.com ([fe80::2454:dc20:78ac:f7d]) by VI1PR04MB4640.eurprd04.prod.outlook.com ([fe80::2454:dc20:78ac:f7d%3]) with mapi id 15.20.1835.010; Fri, 26 Apr 2019 11:19:03 +0000 From: Udit Kumar To: "linux-ide@vger.kernel.org" , "axboe@kernel.dk" CC: "varun.sethi@nxp.com" , Leo Li , Andy Tang , Udit Kumar Subject: [PATCH] enable acpi support in qoriq ahci driver Thread-Topic: [PATCH] enable acpi support in qoriq ahci driver Thread-Index: AQHU/CHZ1DJxo8fmBU6S1s+xlqbwYKZOS3kA Date: Fri, 26 Apr 2019 11:19:03 +0000 Message-ID: <1556277550-26082-2-git-send-email-udit.kumar@nxp.com> References: <1556277550-26082-1-git-send-email-udit.kumar@nxp.com> In-Reply-To: <1556277550-26082-1-git-send-email-udit.kumar@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: BM1PR01CA0102.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::18) To VI1PR04MB4640.eurprd04.prod.outlook.com (2603:10a6:803:70::27) authentication-results: spf=none (sender IP is ) smtp.mailfrom=udit.kumar@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-originating-ip: [92.120.1.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 89a26162-11fa-4464-c12b-08d6ca38fd01 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:VI1PR04MB5598; x-ms-traffictypediagnostic: VI1PR04MB5598: x-microsoft-antispam-prvs: x-forefront-prvs: 001968DD50 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(396003)(136003)(346002)(366004)(376002)(189003)(199004)(44832011)(186003)(5660300002)(81156014)(66946007)(66476007)(66556008)(64756008)(7736002)(386003)(86362001)(14444005)(305945005)(256004)(25786009)(97736004)(6506007)(76176011)(73956011)(8676002)(8936002)(71190400001)(71200400001)(81166006)(486006)(66446008)(50226002)(53936002)(68736007)(446003)(2616005)(476003)(2906002)(11346002)(3846002)(6116002)(110136005)(36756003)(66066001)(54906003)(52116002)(6512007)(6436002)(478600001)(2501003)(102836004)(26005)(4326008)(316002)(99286004)(6486002)(14454004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB5598; H:VI1PR04MB4640.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: CyMim9rEmRSrDeBFcr+/CcEQAxLU3n6y73S7AmDcfVXNz8/ZkDhV3MFIOYtCy4I4Kzz2EYjuSav2fbLQS92ias5wdlAWltY7maOtsG9qxZ+o5YqeF7PJqpl220UX/SB6loYG42e11uXL27JvsSYyIq1jf/wLIPPYCIcNmS3qWCE4BCl+IeZ6ucWoNoWeg9fGOLdgBc5+OCpN1kDsxyKV3iWdSXEWR+tpKodnj2V+6WkbMxSPVyVUXUYMAZD7LAF3i4VtO8GKna73GY/mKQugz9IPhaC47bu8AVDVeoeNVWg+hqRAgvMREWSp3xfrm1qFBx5oc40249050V518RSP63RbpKpaQtFAlwYj6TgJjVP937DMPhOq0cCu1GvLS6luX6a8VonWKrfGlCHKEgFmGs3aEHLUq3eFtLJtMRFyEj4= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 89a26162-11fa-4464-c12b-08d6ca38fd01 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2019 11:19:03.5076 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5598 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org This patch enables ACPI support in qoriq ahci driver. Signed-off-by: Udit Kumar --- 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 ea1175f..9b53992 100644 --- a/drivers/ata/ahci_qoriq.c +++ b/drivers/ata/ahci_qoriq.c @@ -10,6 +10,7 @@ * any later version. */ +#include #include #include #include @@ -84,6 +85,12 @@ struct ahci_qoriq_priv { }; 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) { @@ -265,20 +272,25 @@ 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, @@ -292,7 +304,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) @@ -358,6 +371,7 @@ static SIMPLE_DEV_PM_OPS(ahci_qoriq_pm_ops, ahci_platform_suspend, .driver = { .name = DRV_NAME, .of_match_table = ahci_qoriq_of_match, + .acpi_match_table = ahci_qoriq_acpi_match, .pm = &ahci_qoriq_pm_ops, }, };