From patchwork Mon Jun 24 18:55:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 807476 Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on2047.outbound.protection.outlook.com [40.107.103.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F5832E400; Mon, 24 Jun 2024 18:56:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.103.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719255363; cv=fail; b=WJRiqzoNgEZEgZswZLGWdaHYgjEBUorMO9cJ/5z99sDDA72ccF9c77FVsRPrhDiX9yLUGYn7a6jcT5wA1cWrgYHkwcfy087El0yYDozwAaN9axcMdN5kzXq2EjQR8/BK3ylql73RrZGPS5RYadaFT5dD+wpv2r+kGUQKxnIZoo4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719255363; c=relaxed/simple; bh=xom/Q3xfIs6MEGezVp+EwKNwxIbMrLVo+r2BbHJc6Ag=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=AeBmMa5UnyVwwwxCyUIaFnd+r0fZ306HpR2u+EijDALsyJb2opuevZykh04sDL7jS0JRQtiy57uir6eg6i4zLrT6t6vwGigyb2rJyfUL/V+ss0a0fVbr1KuNEpoa3myx3z0bqcZblJxeSfvb71TWvRSmCuG/XOBN5x7R8RiZo/U= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=dz9MxRFa; arc=fail smtp.client-ip=40.107.103.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="dz9MxRFa" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XKaw+j58nTBa6BG3ZpXsyBXZtp+Fa8z6Jltj1gc8QTrVNL6ZOP+Ta7q8UuTaP4pS1Z1WXsf55biDnVYS0nvUpY/AgQOHF64YixqopL6XlCxorgRshOsNLxm3VmRHbgMP1LDg3vTqp8OZV5F3sv8NFbKs7TEiiMLB3jBBJMqdCOMcs1Dn1q+XfDvwP2/sMVH2maQLXjbJzfkXwHh4WN0BurHwVx7cYTmJ2va9g8YQRTxX/BdGP70UbxD3BOZ/6TVJE9OyUACYhNVZfN7opU8yn3wPX9G1+N7J7wGArHgiNeHrz97KELW8p3Oa/HzfgwvdEXlYfQe6A5seWzsBeFEvcQ== 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=PJKKqVfAjX5PWwwKAK7uVs21vcu3dYerlaGHxHm/1vI=; b=XIeZmEUB5TqXk21fJc+g9VikLlfOAbEkjK5++OrLnkk6IehbGrdjEEUAkVsd9U2bIZxCaYLvzDOIFIpaJi9aUEf6ihOcB2nwrjWSB6Ukbgzf0jkbFyIv2Pjoe1lrUUPoJMQ4Ob7b/wzoAFGMyUMCs9y4qVmwAejgYHPMHPYAOUY800hjm+6uxoEifome2ATUmiG+onTzBoohqGjnGcnhU1CT6iy58VVHN+CwtJVu6ZzYVgBYhUpOVky5WFjDXUXvbIs9dUyaowOmz7aLsRElMVJ2CcymKJ7Pg51igeMSYEGV7f1FzRoSwc6H25F4J4LSC0hPmreKSTksrkc+LwsYUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PJKKqVfAjX5PWwwKAK7uVs21vcu3dYerlaGHxHm/1vI=; b=dz9MxRFa+31XA1xfvIAVPw/4M6qSsJgTH0BvxCiCky9ZxHknNUWyO4kIaETFWZp4jEs2y0B9pehZqE+o95fWe+AQ08oya7N/FWChCNmdKQDD8wLuHqpi8s/ueWiDRETOoL7cxKtJb8C9F6VEApC2RlgsxgywvnOvEmptpmY0U5o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by VI0PR04MB10138.eurprd04.prod.outlook.com (2603:10a6:800:242::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.27; Mon, 24 Jun 2024 18:55:57 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%2]) with mapi id 15.20.7698.020; Mon, 24 Jun 2024 18:55:56 +0000 From: Frank Li Date: Mon, 24 Jun 2024 14:55:27 -0400 Subject: [PATCH v4 1/3] spi: fsl-dspi: use common proptery 'spi-cs-setup(hold)-delay-ns' Message-Id: <20240624-ls_qspi-v4-1-3d1c6f5005bf@nxp.com> References: <20240624-ls_qspi-v4-0-3d1c6f5005bf@nxp.com> In-Reply-To: <20240624-ls_qspi-v4-0-3d1c6f5005bf@nxp.com> To: Vladimir Oltean , Mark Brown , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1719255350; l=1796; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=xom/Q3xfIs6MEGezVp+EwKNwxIbMrLVo+r2BbHJc6Ag=; b=ds6pgWYJLc+WeFySdsnjMC9kS9ey9jjlIFm7dr+I7yx1KQ9RuAbBAOxxrdUNz1N/RomWv4BQk JCtsvyAj/hdDF6DTEWvNg37IByCj7GDAG+F5uL80aDQlIzgOic1yU6+ X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR03CA0014.namprd03.prod.outlook.com (2603:10b6:a02:a8::27) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI0PR04MB10138:EE_ X-MS-Office365-Filtering-Correlation-Id: fa926f46-26bd-48e1-a577-08dc947f47e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|376011|7416011|1800799021|52116011|366013|38350700011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?twGJOgt2C4/cbvSqMAfY0sGH9ho9UIE?= =?utf-8?q?bF+rykrInXaTxUBfYHeU+513Aq2aZxlfm0Qz2+IWxB2K27JjVQlscpYQCjaJByyoC?= =?utf-8?q?1usrDbSkRFao0+OqNH9NpdCIngRO4oGJNh89dHKPO0e/Iq8C4HWYZL5TNF15WdOg7?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MAJQoDOyeFEdlHM9O6jdw/szsIq/Zvncga0E/9ybBMzSuR2AxpmNgR86aVl5F?= =?utf-8?q?3ck/efxKeuMU6/eDHGgWPCdpiLgUM9eDvvUOgnwT0rmXdiD0n0EqaSqzVVXcL4/I6?= =?utf-8?q?4h8JHKy9WXf6aSZy2jhfplLFCVYartcQGyAWDO+2huJVP7DmrKY2GPCoMp+XXj6Mq?= =?utf-8?q?DkeJMScWNWeL7Gfl1k3MLCym49QtlLwvoxFfgr2Q5T/odNqbYP7i1jsMfW4fLqabf?= =?utf-8?q?pq0GuEyjI+2u7Utyf6OjsUf9wftWWoDgEnD6HHrGZKxEld8wrSeDGxWs=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAXPR04MB9642.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(376011)(7416011)(1800799021)(52116011)(366013)(38350700011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?km+x2bzZIxWG9FUJaXZeD4SLO00u?= =?utf-8?q?XlNvkDeTVKmPSzj5iLaTQpHK4ahDP/B2GnTJJhmJz6BNwv1n7MGvAmmCI9nxe9bdG?= =?utf-8?q?NT3QYv60nrlvtI8FcCHy+i6zXLfn9k9T2GqX2CUG7HDEH04COp7tU7xZ7R/ypNFGR?= =?utf-8?q?emf12Ms5J6dUis0JmpJKvNShGgvD+iZBmsEjTw6/73TfLlPmb0jV459Lw5tNYVGSC?= =?utf-8?q?r5Qos3Rapu+2plZsq+oFnJXeo0yZm/1Gx49fb5O/i6991zGr2OneX6Di6eQgWcKJp?= =?utf-8?q?fICX9OziI8YHcshXnL3tpybzWqD4Pf3fBjDvzvMQhT+X/gN9h6++W1fWRYe9scYQO?= =?utf-8?q?y3avzWrz4SIs7omYL5yqj8EtTdsuThW9ZDtVYD97iHp9YvaKYz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bQe6G95q6g2oHbd?= =?utf-8?q?eITgxtXf3XRfQ7Qp9xaYH/2TxpVWUcAgKFD8C63iKA3PQS5ZIVFZv1fgCSbI1Z8m7?= =?utf-8?q?czSIBPcHz5n7KuZtpWEqeRZIecXhBiowQ+aTVARA95dIf+xKYgWIZC3Sc8FdDQReC?= =?utf-8?q?+JEGP4K3yIYPtgPcUqcUr23AkZqbHSXkydx4y5NbwnUY5Za1XNmXCUo/ZCqK9rZ5n?= =?utf-8?q?Pe55t+26PTNS2Pg4pE9PAQsHzYJBSPQmul+1RVc3HjD7VbQ8PolD+++QM1mZ8pVZm?= =?utf-8?q?f4QIUiiU0hDm?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa926f46-26bd-48e1-a577-08dc947f47e9 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2024 18:55:56.8809 (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-CrossTenant-UserPrincipalName: 5MT7PxS8TaTDtPEbTttKt7KPG3GKS2xpf1LskO5YKpYEMq77eDMVBpnMNwn+gV/v5WOUq567jjKP9PPfKJMaaA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10138 Use SPI common DT binding properties 'spi-cs-setup-delay-ns' and 'spi-cs-hold-delay-ns'. If these properties do not exist, fall back to legacy 'fsl,spi-cs-sck-delay' and 'fsl,spi-sck-cs-delay'. Signed-off-by: Frank Li --- Change from v3 to v4 - check spi_delay_to_ns() return value, which may return negative value as error code. It will be very big value when cast to u32. --- drivers/spi/spi-fsl-dspi.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 0a2730cd07c6a..191de1917f831 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -1006,6 +1006,7 @@ static int dspi_setup(struct spi_device *spi) struct chip_data *chip; unsigned long clkrate; bool cs = true; + int val; /* Only alloc on first setup */ chip = spi_get_ctldata(spi); @@ -1018,11 +1019,19 @@ static int dspi_setup(struct spi_device *spi) pdata = dev_get_platdata(&dspi->pdev->dev); if (!pdata) { - of_property_read_u32(spi->dev.of_node, "fsl,spi-cs-sck-delay", - &cs_sck_delay); - - of_property_read_u32(spi->dev.of_node, "fsl,spi-sck-cs-delay", - &sck_cs_delay); + val = spi_delay_to_ns(&spi->cs_setup, NULL); + cs_sck_delay = val >= 0 ? val : 0; + if (!cs_sck_delay) + of_property_read_u32(spi->dev.of_node, + "fsl,spi-cs-sck-delay", + &cs_sck_delay); + + val = spi_delay_to_ns(&spi->cs_hold, NULL); + sck_cs_delay = val >= 0 ? val : 0; + if (!sck_cs_delay) + of_property_read_u32(spi->dev.of_node, + "fsl,spi-sck-cs-delay", + &sck_cs_delay); } else { cs_sck_delay = pdata->cs_sck_delay; sck_cs_delay = pdata->sck_cs_delay;