From patchwork Thu Nov 25 09:55:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 518795 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE1E7C433FE for ; Thu, 25 Nov 2021 09:58:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346063AbhKYKB1 (ORCPT ); Thu, 25 Nov 2021 05:01:27 -0500 Received: from mail-dm6nam11on2062.outbound.protection.outlook.com ([40.107.223.62]:20193 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1354091AbhKYJ71 (ORCPT ); Thu, 25 Nov 2021 04:59:27 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PjgfVSMKOcjBGI+TzxBc6EIkYT4l2WcVYcaCNIYLvzYB5aeoFdULgCo/Ie7gslMz4pR/OpFpF1uMWUFVfPTG6JzbgHQSZOwTIVCluS2v9E97mBM5lEnc3OCOh6wfFG9HWpwVZtXqnl4NZAxad0zBVNHYc1ixtWVJ5d9wAPAzjpAGsjzxAiq345MUAsmdSLLMg3ve+lZ5zK4rdpZ4j/vQQeTTsShqXMBGix1bbuO7Pq9N0OWd2CuGU/v2mVPQ/7kNMzIomP3wUA+s9sm8WuGDZmUiL2Qz69cN80TIcPiw1+u5b7oOQwULKQB7xlYzWFs4XWCknIb8p4v3Kord92Xq2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uKOHTZ8sxZlNIkWbInk0cfd1ut4fbU7U3yP/JoH5I6Y=; b=cnCwaqZIULlQdutXG842Zn6MlHKV/sJqCx08XXO1KAsLX7FujufEPCPimE3xAlh5+42T7FSFKuTU+M4IZhcCK8KVgCDrKWl955410Bd0J+LR7jFp9YssLFcp8pQHTRS/qF/q7ALLj3zXrAVFwaWKtPycJ6k89MDDFg3FpJWthb3Kpi50+G7amoJ2yer7BsXEAYM6OxihUp0xdMulU9Lrc9cWYOa5bid+yJZsgHJBte0ttpowvg/nnUoPu9FMt1jVSppBhSOV+ZUv4pAk90lzBn5257hoQ80WdCN5MOjMHzg8PU9f2HC+jedZjoKcaWCqD5hCeAU2YjSC4UT+iXoLaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.35) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uKOHTZ8sxZlNIkWbInk0cfd1ut4fbU7U3yP/JoH5I6Y=; b=pPyrcsEu7INNxJyjPmTRJHXGPwmEgCAQ3kEcAVRYA5IM/7GTUsARfK0DbTPluZhIumgSsazHsUmZD/GqF4VYvy1C20KsSzz82cl3/q2jPih6dapq2wlWcAidxkn6+WPfe3fuT67IPIUNAEJ/odqJY+FKkIVSxyEntrNobYW5vK2ZW+77O5KPTb8hrs/w4jsVJifPPpYgdNiyIJ3howjKBcDYwZGoWxf5R7/j9qNNiEF8O8EB/Wj9DBqdOIkMgACrj90soBHyJbHKyUA5epzJEDV4D4E/MdoSeoxR6i/oWM5dOIq5/plZkSbnSs40G46H/4B+AOnrcHJsg8urmvawFg== Received: from BN6PR1101CA0009.namprd11.prod.outlook.com (2603:10b6:405:4a::19) by MWHPR1201MB0109.namprd12.prod.outlook.com (2603:10b6:301:52::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 25 Nov 2021 09:56:14 +0000 Received: from BN8NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:405:4a:cafe::2a) by BN6PR1101CA0009.outlook.office365.com (2603:10b6:405:4a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.24 via Frontend Transport; Thu, 25 Nov 2021 09:56:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.35) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.35 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.35; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.35) by BN8NAM11FT015.mail.protection.outlook.com (10.13.176.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4734.22 via Frontend Transport; Thu, 25 Nov 2021 09:56:13 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 25 Nov 2021 09:56:11 +0000 Received: from kyarlagadda-linux.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 25 Nov 2021 01:56:08 -0800 From: Krishna Yarlagadda To: Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , "Laxman Dewangan" , Mark Brown CC: Krishna Yarlagadda , , , Subject: [PATCH 1/2] spi: tegra210-quad: use devm call for cdata memory Date: Thu, 25 Nov 2021 15:25:51 +0530 Message-ID: <1637834152-32093-1-git-send-email-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fec9a35f-2eff-424c-9ce6-08d9aff9d13c X-MS-TrafficTypeDiagnostic: MWHPR1201MB0109: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1417; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S+cjT102aFeHIHvdFB1WJbAZ2527RmKQ+4OV9/dUpxahIgOkDmCPWyo6pU0l8soWLo5NE+qzH/w0IXF4CHAo9K+NXpQyQriqwmSJ/VXnAkGjLsyuRfL/vX1FXe1aSu5S9umemwb9xw0vQ+MLxzJwbtRqRNLBBXurytC8/zbhoIqAJVbmqzp1EyE880tGFvVF72HBRg/Y7WVfymn0adejngEuvL3hE2A+qTygtukfXuqcBqeHZLWbR2cIHAgVbQZ7ePLR35O2u87jKcn9qgYhpPEhHQ71TeuXvXnA4qNr5Z4v/v1UVGokALWGLPLGBC+P6ph7e+wYBIcCBRT7oCrvb8WazVjSP6X52P6Hym3wIETowlGQfsvAL9n931+W0WKZBLQp01tFsEPbsUD09U9AltFF9GzUt6pN3NnjCt2JjIVzO5Syg3qwcxaB0Rz2grXtymszTy2H7hiejPZzydGeQ6HIFicI/GdbZA3ZHNNnyvYPS7hOTwfS0+2dY1wI+zI0TJN1A7o5jp60bLgCeruA8RQYacEHN9GnkiCKLDo/G5jcVrT1JZ6H9nLtuZORLbnlsVinhcUPtQWTpcPI9lHTBUm516dg7d0MDT5jHo3GJozI0LdxZ9hw2K6olzmi/OLui9pbkcZO+qgZFgi39/627Byw2N4SEBVUO81NRLwj+paR8WJ73uePJ2DOpUS0cRwJ2dHauTaXnR3IxFiWd03UUw== X-Forefront-Antispam-Report: CIP:216.228.112.35; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid04.nvidia.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(36756003)(2906002)(110136005)(54906003)(7696005)(36860700001)(26005)(47076005)(426003)(4326008)(336012)(186003)(82310400004)(86362001)(6666004)(70586007)(356005)(70206006)(83380400001)(7636003)(2616005)(5660300002)(8676002)(316002)(8936002)(508600001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2021 09:56:13.9864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fec9a35f-2eff-424c-9ce6-08d9aff9d13c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.35]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0109 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Use devm alloc call to allocate memory for spi controller data and remove free calls from cleanup. Signed-off-by: Krishna Yarlagadda --- drivers/spi/spi-tegra210-quad.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index c0f9a75..ce1bdb4 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -877,7 +877,7 @@ static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_devic struct tegra_qspi_client_data *cdata; struct device_node *slave_np = spi->dev.of_node; - cdata = kzalloc(sizeof(*cdata), GFP_KERNEL); + cdata = devm_kzalloc(&spi->dev, sizeof(*cdata), GFP_KERNEL); if (!cdata) return NULL; @@ -888,14 +888,6 @@ static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_devic return cdata; } -static void tegra_qspi_cleanup(struct spi_device *spi) -{ - struct tegra_qspi_client_data *cdata = spi->controller_data; - - spi->controller_data = NULL; - kfree(cdata); -} - static int tegra_qspi_setup(struct spi_device *spi) { struct tegra_qspi *tqspi = spi_master_get_devdata(spi->master); @@ -1229,7 +1221,6 @@ static int tegra_qspi_probe(struct platform_device *pdev) SPI_TX_DUAL | SPI_RX_DUAL | SPI_TX_QUAD | SPI_RX_QUAD; master->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) | SPI_BPW_MASK(8); master->setup = tegra_qspi_setup; - master->cleanup = tegra_qspi_cleanup; master->transfer_one_message = tegra_qspi_transfer_one_message; master->num_chipselect = 1; master->auto_runtime_pm = true; From patchwork Thu Nov 25 09:55:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krishna Yarlagadda X-Patchwork-Id: 517705 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51CBCC43217 for ; Thu, 25 Nov 2021 09:58:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350024AbhKYKB2 (ORCPT ); Thu, 25 Nov 2021 05:01:28 -0500 Received: from mail-bn8nam11on2062.outbound.protection.outlook.com ([40.107.236.62]:31296 "EHLO NAM11-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1347793AbhKYJ72 (ORCPT ); Thu, 25 Nov 2021 04:59:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a7SMvna9RH9tC7K7omJ2p8n1vYyNk4da51v/Nope0TECrITBqv05hVVe33/P62nVpkdQ59nuWmuZmUJNaK+wTuDCP2VZtSnfYMuD2Zqa1mFdGN4/mRvyoZIOQ2l0LMgqHz4rKGF4QRx6+ZCdnVxYug1URXBhSOI75mMxw5dMRFA/1ki9k5bbQeHjhDGRmoePLD0/gb6VWnIyz6KYQEKhv+T0ltaXmozj8pAZo637pbeM9ncsWGTAphKDJyyoGLqx8lXyZmD8CLKAguRa2LeUIdJUG9OeuFvO5TJ1AXrT6QRHh7Pp6QMYQfMgGONIDhBmrnSF5rvknHZ+BKSIU4IeSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=A6X7sv0mgRedp6/gRHB3RCvjWo7ithMwxxZeA6oJHrw=; b=Hg2qd4KvKnvh0CIj9yBAY7jl/GV6q7tHeG18xtVToJAJ+Q/pu5hvmx5Kxqz1Uyy6TkfW/mDe9Ch2CMW5flxpSxIwsrq4qvDEIRBMqk7159MBuw0D2oz83siDisOTAN5jNQ/gBIhfCoB8W4Iben38BCYZzgsTpakgBZw+UZR19lzWvplBjgiSrZjWbSOFJ47S+ebD2XSpLATXS/Y2hXZkmbq0pvs29zEKnUDt5TBmjt2joJUa9gfNZvVe10Fh4/IkxhevKnyca5Z99cSEKAMpzM7ISglQh6vggZEIS5ltEdB1kXnLRUfFL7KKJBKeJrkKSwovgcoY9PSyfDOL8jQCDA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.34) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=A6X7sv0mgRedp6/gRHB3RCvjWo7ithMwxxZeA6oJHrw=; b=aBJbfdjqtY19cmmtZkj0RMcDobpM7MQ3GuQFwdHuLo773nm/dV/YWbVCqTB+lRgjHCnbwSqcscuB8vlB6Esot6FqTBf431Xcz9KXHO9qZQJPz0Gkn/U8HLGhHNRu/VfS+jH+2hX9lj5N1V1e+k912blxADncflrU3SpRnHQpNnx6I4maRbmjoyuWUlFN0DJz8fmLkSjsDYA0+2xWjP8vbcQM5gt8MObhRf8MkS0l5+f/kq1sXVervRyN7jV0O/WWNbVdZYY1AFCkD+79Aj7768+2NceEEcALk3qKkoWfbfFg7rEXZC/BuNAkJoDoQcKs6bGiYusWTxdSR+uwpRfpCA== Received: from CO2PR18CA0065.namprd18.prod.outlook.com (2603:10b6:104:2::33) by DM5PR1201MB0170.namprd12.prod.outlook.com (2603:10b6:4:59::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.22; Thu, 25 Nov 2021 09:56:15 +0000 Received: from CO1NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:104:2:cafe::c0) by CO2PR18CA0065.outlook.office365.com (2603:10b6:104:2::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4734.22 via Frontend Transport; Thu, 25 Nov 2021 09:56:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.34) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.34 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.34; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.34) by CO1NAM11FT067.mail.protection.outlook.com (10.13.174.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4734.22 via Frontend Transport; Thu, 25 Nov 2021 09:56:14 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Thu, 25 Nov 2021 09:56:14 +0000 Received: from kyarlagadda-linux.nvidia.com (172.20.187.5) by mail.nvidia.com (172.20.187.15) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Thu, 25 Nov 2021 01:56:11 -0800 From: Krishna Yarlagadda To: Laxman Dewangan , Thierry Reding , Jonathan Hunter , "Sowjanya Komatineni" , Mark Brown , "Philipp Zabel" CC: Krishna Yarlagadda , , , Subject: [PATCH 2/2] spi: tegra210-quad: add acpi support Date: Thu, 25 Nov 2021 15:25:52 +0530 Message-ID: <1637834152-32093-2-git-send-email-kyarlagadda@nvidia.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1637834152-32093-1-git-send-email-kyarlagadda@nvidia.com> References: <1637834152-32093-1-git-send-email-kyarlagadda@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: dab4b455-40a2-4dbd-ded8-08d9aff9d1c6 X-MS-TrafficTypeDiagnostic: DM5PR1201MB0170: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1751; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jn+HEo8+BZewjNyoDmD4W2E50n+b5J8WnC2EWJqGBanX/8BoLM/aHCrlUh9Y7Kx8DgZY0U1ngGSuaaZiXgIfiPQZLRhB9K9POPj2t0MCUMCm03JsXrFrX4QvexMsX9fO0VC3v5CGzhtH605CNp/6LLqdZsltnAzSn2VH7ePf9a3ogom3aESyEtdLHoj2sWJvzKVn6VUT1W2rk1GFakDwUzU07dBae1li2MbztUeibg6RPzcmgCKO7YCepe2FJtjlbhcyawluWQwYMBHBDCwtlAnXUOoCnaezv6I/0/auMfViQ2rHdtpa5YhvgRmgiaXdsBH26K7T6aPp7hfqpoPZuAc0GSgm4O2KYBNZwVnref1NU9764378h/1CdvKBJl5jZkiHiz4XkJX00KQH7iO7hjDYUFHuMZ03SyF67X/4qGCxXOEri0cN0ZBSJBauLxQqN0sj1CbImGOVtfzO8/UquSLtBIWlRl9H1dSXzLAeV2GEk6FZHbf4ZERKiSfYozmR4DlHFayCGtEpvjk0K9q0DmSTDMBsg6LCcuKYsKL38NHg3hsP2KmdUH3iVGzyCdf6yhM3wnOmB7UhGix4xDe43HCQsdKvErhEaqEQzGRPLkSnlJxKAXEn1R6clGyW/OENh9tOGaqbhppQwb9wYALEaZ0Jde/Syzj8+S4+icKz4lMieEVKL57S8r7mnipd9asbGEyRlrIKOrdwfn6vV8JzyQ== X-Forefront-Antispam-Report: CIP:216.228.112.34; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:schybrid03.nvidia.com; CAT:NONE; SFS:(4636009)(46966006)(36840700001)(26005)(8936002)(110136005)(54906003)(5660300002)(6666004)(70586007)(47076005)(82310400004)(508600001)(426003)(336012)(8676002)(2616005)(2906002)(7696005)(70206006)(316002)(7636003)(86362001)(36860700001)(356005)(36756003)(186003)(83380400001)(4326008); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Nov 2021 09:56:14.9716 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dab4b455-40a2-4dbd-ded8-08d9aff9d1c6 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.112.34]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1201MB0170 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org Support ACPI device enumeration for Tegra QUAD SPI driver. Also pick device features from device tree. Signed-off-by: Krishna Yarlagadda --- drivers/spi/spi-tegra210-quad.c | 74 ++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c index ce1bdb4..20c1fa6 100644 --- a/drivers/spi/spi-tegra210-quad.c +++ b/drivers/spi/spi-tegra210-quad.c @@ -21,6 +21,8 @@ #include #include #include +#include +#include #define QSPI_COMMAND1 0x000 #define QSPI_BIT_LENGTH(x) (((x) & 0x1f) << 0) @@ -767,7 +769,7 @@ static u32 tegra_qspi_setup_transfer_one(struct spi_device *spi, struct spi_tran u32 tx_tap = 0, rx_tap = 0; int req_mode; - if (speed != tqspi->cur_speed) { + if (!has_acpi_companion(tqspi->dev) && speed != tqspi->cur_speed) { clk_set_rate(tqspi->clk, speed); tqspi->cur_speed = speed; } @@ -875,16 +877,15 @@ static int tegra_qspi_start_transfer_one(struct spi_device *spi, static struct tegra_qspi_client_data *tegra_qspi_parse_cdata_dt(struct spi_device *spi) { struct tegra_qspi_client_data *cdata; - struct device_node *slave_np = spi->dev.of_node; cdata = devm_kzalloc(&spi->dev, sizeof(*cdata), GFP_KERNEL); if (!cdata) return NULL; - of_property_read_u32(slave_np, "nvidia,tx-clk-tap-delay", - &cdata->tx_clk_tap_delay); - of_property_read_u32(slave_np, "nvidia,rx-clk-tap-delay", - &cdata->rx_clk_tap_delay); + device_property_read_u32(&spi->dev, "nvidia,tx-clk-tap-delay", + &cdata->tx_clk_tap_delay); + device_property_read_u32(&spi->dev, "nvidia,rx-clk-tap-delay", + &cdata->rx_clk_tap_delay); return cdata; } @@ -943,14 +944,27 @@ static void tegra_qspi_dump_regs(struct tegra_qspi *tqspi) tegra_qspi_readl(tqspi, QSPI_FIFO_STATUS)); } +static void tegra_qspi_reset(struct tegra_qspi *tqspi) +{ + if (tqspi->rst) { + reset_control_assert(tqspi->rst); + udelay(2); + reset_control_deassert(tqspi->rst); + return; + } +#ifdef CONFIG_ACPI + if (ACPI_FAILURE(acpi_evaluate_object(ACPI_HANDLE(tqspi->dev), + "_RST", NULL, NULL))) + dev_err(tqspi->dev, "failed to reset device\n"); +#endif +} + static void tegra_qspi_handle_error(struct tegra_qspi *tqspi) { dev_err(tqspi->dev, "error in transfer, fifo status 0x%08x\n", tqspi->status_reg); tegra_qspi_dump_regs(tqspi); tegra_qspi_flush_fifos(tqspi, true); - reset_control_assert(tqspi->rst); - udelay(2); - reset_control_deassert(tqspi->rst); + tegra_qspi_reset(tqspi); } static void tegra_qspi_transfer_end(struct spi_device *spi) @@ -1202,6 +1216,14 @@ static const struct of_device_id tegra_qspi_of_match[] = { MODULE_DEVICE_TABLE(of, tegra_qspi_of_match); +#ifdef CONFIG_ACPI +static const struct acpi_device_id tegra_qspi_acpi_match[] = { + { .id = "NVDA14E2", }, + {} +}; +MODULE_DEVICE_TABLE(acpi, tegra_qspi_acpi_match); +#endif + static int tegra_qspi_probe(struct platform_device *pdev) { struct spi_master *master; @@ -1242,18 +1264,20 @@ static int tegra_qspi_probe(struct platform_device *pdev) qspi_irq = platform_get_irq(pdev, 0); tqspi->irq = qspi_irq; - tqspi->clk = devm_clk_get(&pdev->dev, "qspi"); - if (IS_ERR(tqspi->clk)) { - ret = PTR_ERR(tqspi->clk); - dev_err(&pdev->dev, "failed to get clock: %d\n", ret); - return ret; - } + if (!has_acpi_companion(tqspi->dev)) { + tqspi->clk = devm_clk_get(&pdev->dev, "qspi"); + if (IS_ERR(tqspi->clk)) { + ret = PTR_ERR(tqspi->clk); + dev_err(&pdev->dev, "failed to get clock: %d\n", ret); + return ret; + } - tqspi->rst = devm_reset_control_get_exclusive(&pdev->dev, NULL); - if (IS_ERR(tqspi->rst)) { - ret = PTR_ERR(tqspi->rst); - dev_err(&pdev->dev, "failed to get reset control: %d\n", ret); - return ret; + tqspi->rst = devm_reset_control_get_exclusive(&pdev->dev, NULL); + if (IS_ERR(tqspi->rst)) { + dev_err(&pdev->dev, "failed to get reset control: %d\n", ret); + ret = PTR_ERR(tqspi->rst); + return ret; + } } tqspi->max_buf_size = QSPI_FIFO_DEPTH << 2; @@ -1277,9 +1301,7 @@ static int tegra_qspi_probe(struct platform_device *pdev) goto exit_pm_disable; } - reset_control_assert(tqspi->rst); - udelay(2); - reset_control_deassert(tqspi->rst); + tegra_qspi_reset(tqspi); tqspi->def_command1_reg = QSPI_M_S | QSPI_CS_SW_HW | QSPI_CS_SW_VAL; tegra_qspi_writel(tqspi, tqspi->def_command1_reg, QSPI_COMMAND1); @@ -1353,6 +1375,10 @@ static int __maybe_unused tegra_qspi_resume(struct device *dev) return spi_master_resume(master); } +#ifdef CONFIG_ACPI +static int __maybe_unused tegra_qspi_runtime_suspend(struct device *dev) { return 0; } +static int __maybe_unused tegra_qspi_runtime_resume(struct device *dev) { return 0; } +#else static int __maybe_unused tegra_qspi_runtime_suspend(struct device *dev) { struct spi_master *master = dev_get_drvdata(dev); @@ -1378,6 +1404,7 @@ static int __maybe_unused tegra_qspi_runtime_resume(struct device *dev) return ret; } +#endif static const struct dev_pm_ops tegra_qspi_pm_ops = { SET_RUNTIME_PM_OPS(tegra_qspi_runtime_suspend, tegra_qspi_runtime_resume, NULL) @@ -1389,6 +1416,7 @@ static struct platform_driver tegra_qspi_driver = { .name = "tegra-qspi", .pm = &tegra_qspi_pm_ops, .of_match_table = tegra_qspi_of_match, + .acpi_match_table = ACPI_PTR(tegra_qspi_acpi_match), }, .probe = tegra_qspi_probe, .remove = tegra_qspi_remove,