From patchwork Fri Sep 13 11:45:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144127 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A59F0912 for ; Fri, 13 Sep 2019 08:47:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 81151208C0 for ; Fri, 13 Sep 2019 08:47:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vBn0vSgK"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="uMxdIdAd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81151208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FFfFvhfmmNSn7WZciQhMSMKZrAJxwCAUuhXYGxAMK7g=; b=vBn0vSgKkjJ9ek pekKkwVZTFwGhFrknDMkTZ/UQooAEJfZlEvjEmH5bDDkoxmG5CVjkQVy9KyNf20jEfDtl5Nb9sWQp 7RGmc0Kae4nZdCIEaFo2wVfcICaL9TjzunoHYikdoXiQOFbR69SvlNcaLbpyybn6MPvmU4S0ptfam vh/XwaIwI6fAsYt4wHCAf73IQ5udOn2kPemzBeeejF/0+eb83xi7q10/n9jG/OnJ92dFdhPtlarcH jJa64Epbsy6z9sJ7pmlMRSHc1SEguGgNkpdgZ4URJj7SMxn9up2kdVTYkzgOw43Bt/EsvoTCdQq/6 WSoaEMB+EVFgVDMPvSNA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hEE-0002wQ-4w; Fri, 13 Sep 2019 08:46:54 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hDf-0002OF-FY for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:20 +0000 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gcTc001861; Fri, 13 Sep 2019 04:46:15 -0400 Received: from nam05-by2-obe.outbound.protection.outlook.com (mail-by2nam05lp2052.outbound.protection.outlook.com [104.47.50.52]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdfsa7q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:14 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ROrJexbhJ1m5+kYR8JflDXwIvObj1/izgBNd9O8aZt8NTZdTdT8cUFclNkCZBWqSMu5UzmL0ndtOYihwwPqUCOlFV7mur1FVju3kGxzeQfPsfBnDkkj5/7USiXsfq7/TgUN7nI+k9XxIEcnc7YQZkebh4UQn3Y8H64T3AvHM/Pw7REWnXlk1R5DrUGdlxJa3IXP+WE8ddra/AwiOva4BxYmV0ETXh4pt7KRmAjim5MIIJcOJ2JE0znW5wAS5CG1Y9aUgxEHttge2F7zYIzPtCtlcAvpWA0v7vDJvRKkxhxEmks+b/iFPAB/lHG7sR1E4XLZ+FWIK5fTzZc3DHrCfTA== 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-SenderADCheck; bh=N//v9tP42mO82MASuaLghoW7AUmfw1VhX5gXorThYfI=; b=XvLGRjJ5AVsJ6CRTjB/caI5OJ3B3BtJ21ReCDDN9kaaX6T9224xm0Z1KOw4o9/XULf6gYcTccF+6QkD6NtzSOL6be7BKF+CHDz/DKClNySC8j3l9RUIqt+jK1Xt2g83vKngq6Ylgw8f3HNYzlI/LxxdiooWsGeWU+tqtHjRz/URkO6MhtPd0+cK5IzPcIYCmgNFLFEZLR+yemViBWl2OS556cdaV3M8/lvuInd1rxRZUwPB3kIMCQ74lJtK4IKzHf/8zT7Ft4TDFiW6iwyeEAXTXJ2vf6I29S0b09M7cHN6GGN9BMNMBu+6hq+i/QwPGeGiv3aKpjX/K1hO+qpp64w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N//v9tP42mO82MASuaLghoW7AUmfw1VhX5gXorThYfI=; b=uMxdIdAdbWshGF02IWid+YvFfuQRTBiFiYV0jYYoJrnd6QTEqWAFOIZl/IqdOYk53MCM6q8PQpJHqqOKSD4VIfVvfaN8OvqQH6NIrZHlmG0eZ3268g5YQc+7tFYx9r7nv9/TtZ0FqVxMYbfh5hoPe079Cf8E5dVRGioCIr5BHvU= Received: from BN6PR03CA0085.namprd03.prod.outlook.com (2603:10b6:405:6f::23) by BN8PR03MB5025.namprd03.prod.outlook.com (2603:10b6:408:d6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17; Fri, 13 Sep 2019 08:46:13 +0000 Received: from SN1NAM02FT051.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::208) by BN6PR03CA0085.outlook.office365.com (2603:10b6:405:6f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:13 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by SN1NAM02FT051.mail.protection.outlook.com (10.152.73.103) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:12 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8k7Vs030556 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:07 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:11 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 01/15] spi: move `cs_change_delay` backwards compat logic outside switch Date: Fri, 13 Sep 2019 14:45:36 +0300 Message-ID: <20190913114550.956-2-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(136003)(396003)(376002)(346002)(189003)(199004)(7416002)(7696005)(51416003)(478600001)(316002)(4326008)(2870700001)(7636002)(305945005)(76176011)(2201001)(486006)(86362001)(44832011)(110136005)(476003)(126002)(50466002)(4744005)(106002)(54906003)(5660300002)(356004)(6666004)(1076003)(446003)(11346002)(2616005)(246002)(426003)(336012)(47776003)(8936002)(8676002)(2906002)(186003)(107886003)(26005)(70586007)(70206006)(50226002)(48376002)(36756003)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN8PR03MB5025; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f6deb5d8-f951-4e55-b301-08d73826d4fb X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:BN8PR03MB5025; X-MS-TrafficTypeDiagnostic: BN8PR03MB5025: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: fhilP7BnyrXrXHuYvY9vZj1zOe123En7IWai4Ydqd7mUK6G/f1Vyp2tTs8ydT4A2x1hoCImrLYeuWxTOqyXWmqevRmxFocID9jl8rpb0jwSYwvJcMJ/7QY6zsb82oW38j8xOCyuXaMgdHYK+BK9gCGosD3c5NF8DyNcB/TxWmyFiYoAH4/c+PSGfaAB/0gqklsREQ9xzMjQjlixYpU6AnbHsedAxAxxYlE3EVfcHCHuIs479+ZJHiFo0/j3iCQSySJ+VC6fAMrKSWRuu+j+jIqQWS/auehQ6PlA6po1jOmJmhWhbWLI6jtViJHlM/sG85mvOA6RsvcJ63Z56D6zq5GmhRs+ZeMy9ZENpr9xltFIof+zMBj5QwTUwj4c6Gr1kNuB8eVGUfP5wPgRSJAzCzOGyIrHCwgMM073vQqJSzS4= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:12.8091 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6deb5d8-f951-4e55-b301-08d73826d4fb X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR03MB5025 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014619_678208_4F64FA60 X-CRM114-Status: GOOD ( 12.63 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The `cs_change_delay` backwards compatibility value could be moved outside of the switch statement. The only reason to do it, is to make the next patches easier to diff. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 75ac046cae52..c90e02e6d62f 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1114,16 +1114,15 @@ static void _spi_transfer_cs_change_delay(struct spi_message *msg, u32 hz; /* return early on "fast" mode - for everything but USECS */ - if (!delay && unit != SPI_DELAY_UNIT_USECS) + if (!delay) { + if (unit == SPI_DELAY_UNIT_USECS) + _spi_transfer_delay_ns(10000); return; + } switch (unit) { case SPI_DELAY_UNIT_USECS: - /* for compatibility use default of 10us */ - if (!delay) - delay = 10000; - else - delay *= 1000; + delay *= 1000; break; case SPI_DELAY_UNIT_NSECS: /* nothing to do here */ break; From patchwork Fri Sep 13 11:45:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144175 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 978151395 for ; Fri, 13 Sep 2019 08:47:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 73625208C2 for ; Fri, 13 Sep 2019 08:47:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Q+CDvuSQ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="KL3QjYWu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73625208C2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=up2ni7lk9LrX+nkkwQ3U404NVZFX4UkB6to21604kkc=; b=Q+CDvuSQ0mLV3K R5fhb9Xni9e6izyBg+nCBY0Ds2GyOeqXqX/u00+LkIITygE+ydRRKG8LVF6vW2lCBjVNgI9eRR0iF v1qcR+fnbXcpnai/gBynUoZzJON4E/WE02UADvWIjepR6k41vTimrzWBPH9IGr14pOhf91dcLHJqB /UUd9exbGhs0R6SJhSqjd9ALTZ2n29oYokt0ifSF64L23UEOKpC+/XHDmAFKeqZROSLZ1qkZVEAEy q1QbXlXgSLEI3BGjnzz8be6/8Nd6EYsRFX7SIuQUk/SeE6Sef/g90njlPfb0ptLqY5gUXLfE0U1SG ekIrxo1emL6DRPM0kQkg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hEw-0003ec-As; Fri, 13 Sep 2019 08:47:38 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hDh-0002Oy-AH for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:22 +0000 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gcTd001861; Fri, 13 Sep 2019 04:46:17 -0400 Received: from nam01-sn1-obe.outbound.protection.outlook.com (mail-sn1nam01lp2050.outbound.protection.outlook.com [104.47.32.50]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdfsa7t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:17 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xcc57aZMs89FHXJWvyCAOPbpUJHOCqgdeqoCvpK4C/n2JNJkVkusYJKwPGXZBmyV0UPxdBTVWbsJTvXheV138gygY4CeOV3dJQuBdz9e0FoJ2WoXmM23nEMA6bT0gN4GmAjzdDSiMZ8+GTAM1+hD7YK9KdGX1xafp/hJ/DDGgQJl0HyIkRiSkbHprv6wDkLkvLh/GReimJZjON7Lyrco8Cl7AKcyA+LTXcq+DHYAnWcBwTayOGQzHNYV4oLFZhJdJ6wMpUy1fs+m+wDqlb6pXiD+5ndD5+6YjOi0nh4ucn6H0QDRQGkl1ZXwXsly4H0XbWRMSDC5JflpHWmEzGbM6w== 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-SenderADCheck; bh=ESeHHXBfFrG988glXvaIvhiPmUc6BnNdkc+lsz3piTo=; b=me79giXRLGKdjIUC2SafIMABt4ASFQu7J1Bx2UDk1N3BHNWUXoJKQaxf+cUHvKfwXrmsKxS7W7goCJmN0Lk/YY1G2DaTtidWGYD+OCL42mkFZ2N1esUxIxVQuOFtfPfNNaLDejyyagXC3hrZFXsS9tmf4g8qP/cfgiRNzOxbJPmZojc4GM2MTLJH/TITf/QYs9wCw+HdnOB1/u8q7MWUsqIunGO+A5jU/zG70uLjcHE3ZUYIJJUa+rNBU5XYBoTWq7JeeM9FgG6Ipy9EB0KGn3/ixQAcqfDrcpvDmVi9st9kjaVei0f7ucg/8NYSAbRO2KFauONhh9/DCWtjG+yHCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ESeHHXBfFrG988glXvaIvhiPmUc6BnNdkc+lsz3piTo=; b=KL3QjYWuhzB2b7fr/uoS5UWddVrDZFnPzqxZIv/WM7rU85W0z3nwx+yR1gJmhJHBCWx41yk10Nt1qcKUrtgLK6UVV+JaGBYuMnBmumjOSXZE9qXMoPk3xNcSFN/0ZdwPvneNVzQp9mTKsZMiJCW45F4phx2e2vM7sPIhlg6DCDQ= Received: from BN6PR03CA0062.namprd03.prod.outlook.com (2603:10b6:404:4c::24) by SN6PR03MB3806.namprd03.prod.outlook.com (2603:10b6:805:6a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.20; Fri, 13 Sep 2019 08:46:15 +0000 Received: from SN1NAM02FT048.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::209) by BN6PR03CA0062.outlook.office365.com (2603:10b6:404:4c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:15 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by SN1NAM02FT048.mail.protection.outlook.com (10.152.72.202) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2241.14 via Frontend Transport; Fri, 13 Sep 2019 08:46:15 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kAVv030611 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:10 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:14 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 02/15] spi: introduce spi_delay struct as "value + unit" & spi_delay_exec() Date: Fri, 13 Sep 2019 14:45:37 +0300 Message-ID: <20190913114550.956-3-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(396003)(136003)(376002)(39860400002)(199004)(189003)(2201001)(426003)(7696005)(51416003)(14444005)(316002)(110136005)(76176011)(54906003)(2906002)(8936002)(50226002)(70586007)(70206006)(44832011)(486006)(36756003)(2870700001)(7416002)(86362001)(26005)(336012)(106002)(186003)(305945005)(11346002)(2616005)(107886003)(446003)(47776003)(1076003)(478600001)(126002)(356004)(246002)(8676002)(6666004)(48376002)(50466002)(5660300002)(4326008)(7636002)(476003)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR03MB3806; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 714ced24-9e3c-4869-8f80-08d73826d68a X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:SN6PR03MB3806; X-MS-TrafficTypeDiagnostic: SN6PR03MB3806: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 6l1XnoKGWXWzCRMQEDiQUrubWL+RBbwWA2jZj9vXXHZJ18ROjphPn6ez7YmTvsTwddYY5FQ18eeMwPRAtGq+utZIroj+GPoWRXUVFX8aVh7QJuOCIBQMB7jAUl1uuiKarbna3+325l5qHQt57FFxTFW7R6QqeqvmNtYEYBTZCCH1rxaRKskSV7vN5gZCYOvAmtnREDuWVWjyJl5ohxqn+AKVS1hLpJNpOjggT2pJ5UaSIUrEYUVEILv/Rh9wRMAuDa/MyjrKfkECdevNcq4N9kYWDILYZ/CmE1+xPJ3oCyhhobxNtKrqJc17NELoVNY/+L58PX2KA3vQjxyxS0moT4QLVOOmUnL/stNLu49L/Y0acpjKiy7IB70EMjhJaIWld68XnoWyriJ/3WvmIJjuJZzBDIdZtG5pQu0X3zirCAY= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:15.4301 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 714ced24-9e3c-4869-8f80-08d73826d68a X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR03MB3806 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014621_359729_272A3F33 X-CRM114-Status: GOOD ( 16.67 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org There are plenty of delays that have been introduced in SPI core. Most of them are in micro-seconds, some need to be in nano-seconds, and some in clock-cycles. For some of these delays (related to transfers & CS timing) it may make sense to have a `spi_delay` struct that abstracts these a bit. The important element of these delays [for unification] seems to be the `unit` of the delay. It looks like micro-seconds is good enough for most people, but every-once in a while, some delays seem to require other units of measurement. This change adds the `spi_delay` struct & a `spi_delay_exec()` function that processes a `spi_delay` object/struct to execute the delay. It's a copy of the `cs_change_delay` mechanism, but without the default for 10 uS. The clock-cycle delay unit is a bit special, as it needs to be bound to an `spi_transfer` object to execute. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi.c | 51 +++++++++++++++++++++++++++++++++++++++++ include/linux/spi/spi.h | 18 ++++++++++++--- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c90e02e6d62f..1883de8ffa82 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1106,6 +1106,57 @@ static void _spi_transfer_delay_ns(u32 ns) } } +static int _spi_delay_to_ns(struct spi_delay *_delay, struct spi_transfer *xfer) +{ + u32 delay = _delay->value; + u32 unit = _delay->unit; + u32 hz; + + if (!delay) + return 0; + + switch (unit) { + case SPI_DELAY_UNIT_USECS: + delay *= 1000; + break; + case SPI_DELAY_UNIT_NSECS: /* nothing to do here */ + break; + case SPI_DELAY_UNIT_SCK: + /* clock cycles need to be obtained from spi_transfer */ + if (!xfer) + return -EINVAL; + /* if there is no effective speed know, then approximate + * by underestimating with half the requested hz + */ + hz = xfer->effective_speed_hz ?: xfer->speed_hz / 2; + if (!hz) + return -EINVAL; + delay *= DIV_ROUND_UP(1000000000, hz); + break; + default: + return -EINVAL; + } + + return delay; +} + +int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer) +{ + int delay; + + if (!_delay) + return -EINVAL; + + delay = _spi_delay_to_ns(_delay, xfer); + if (delay < 0) + return delay; + + _spi_transfer_delay_ns(delay); + + return 0; +} +EXPORT_SYMBOL_GPL(spi_delay_exec); + static void _spi_transfer_cs_change_delay(struct spi_message *msg, struct spi_transfer *xfer) { diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index af4f265d0f67..c18cfa7cda35 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -89,6 +89,21 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats, #define SPI_STATISTICS_INCREMENT_FIELD(stats, field) \ SPI_STATISTICS_ADD_TO_FIELD(stats, field, 1) +/** + * struct spi_delay - SPI delay information + * @value: Value for the delay + * @unit: Unit for the delay + */ +struct spi_delay { +#define SPI_DELAY_UNIT_USECS 0 +#define SPI_DELAY_UNIT_NSECS 1 +#define SPI_DELAY_UNIT_SCK 2 + u16 value; + u8 unit; +}; + +extern int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer); + /** * struct spi_device - Controller side proxy for an SPI slave device * @dev: Driver model representation of the device. @@ -834,9 +849,6 @@ struct spi_transfer { u16 delay_usecs; u16 cs_change_delay; u8 cs_change_delay_unit; -#define SPI_DELAY_UNIT_USECS 0 -#define SPI_DELAY_UNIT_NSECS 1 -#define SPI_DELAY_UNIT_SCK 2 u32 speed_hz; u16 word_delay; From patchwork Fri Sep 13 11:45:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144177 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E6F79912 for ; Fri, 13 Sep 2019 08:48:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C497C208C2 for ; Fri, 13 Sep 2019 08:48:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NOgDCMmO"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="3KuqL4b3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C497C208C2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ch1I3rXKSo9MdOGPkEXz2eO8dToEFcIo0guj2U4/VVg=; b=NOgDCMmOkzQ1Bd cpntPkemdNnGrlENqlIPVXzcWd6P5oxYg406sCUQwaFTKqdXfM8MBCHUnnDQcFTdcfXT3rs8eAPmY hRUkhza79H+j1HmIp7Rww1HEt1VN5K2Mcp3ngTNeS5JgnMKJ642r08LNYl3EuRgqcMsbvSNdOqVsB 1+GGN/zSqiRfRvxT5S8DtWhZTc/iZQji9CGvT+ugOb8p6lmjHXAwJuBHf6pfjQE4Eq6qRyuVGbC7z dAbwH9UvH/EnGNSZR5N08U7hro8yiAzxlbwqhYVKffwOXN5CgBM/wAZMBBSPA37C4dfMOZex/+NHs D/4vmZLCF+4jupkwcVTQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hFK-0003tW-N3; Fri, 13 Sep 2019 08:48:02 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hDi-0002Px-J9 for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:24 +0000 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gaUA015969; Fri, 13 Sep 2019 04:46:20 -0400 Received: from nam04-co1-obe.outbound.protection.outlook.com (mail-co1nam04lp2059.outbound.protection.outlook.com [104.47.45.59]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdksa67-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:19 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mh/R5u66BOW4fOT4zHO2FmbX9DZOdZP6ITD0O1i2rE+fdXVKJK+V5SwPl+BUvtEpmC5DdemMT2XRPYoAzk+h45bY2qgScgKxRzzeBrQVpqwNmLBK3A7Q+wt8w0HRHew6VW7h4IxHCnQTUKnhw+BL9sw6ot3KI8MR+FLu+oJg8zHGeq5kcSY+mqPXz3xeuXyK91V6hve/1UOkr+eG97Z/D0L5HJKvdRRMseoOJMjAJf15iMt3Q2JaFvzS4XedO8jvhdUhgAbwIC6K2/joXiqB+Fn63qQg4i61CgGvyKtFNJFyNg5Em8TZMchg+Itx3Mqt2X5sZHdT2nN4q/pgZanFqw== 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-SenderADCheck; bh=8DSsgUaiyPcfIXlk2vetnOMbPD9B8m8+una/987DFjo=; b=OcaoCo4RPgYCP0sn2BDBMFBC1+SjsSYz5u6Bje3PRviFrNuJNl+LjDuy003jEeIk3WzwlElfVfjswkGZYip7bbW5Ez7SacmQuR4VAR+MiMDnjbKovBwEfq79XuJAWROc17WKys5RG6IqAjGGTWE5B8m7TJgHwM1chjt17Av1Oi992Dbqv7tN2WLKDmJ2VZzttRwUqLVZohEU4yzjyYJd/Go2EE173XUmby+h4p4KKxYe+SNOB/HVlZSXaaH4aj219snSjjesc2P8NF28VzRBmocvQQKBXLNduDSVBqf7w8MN8NgeRQOMObmFnigcT23kh6p1SgR9BQaYoBWxAeCsjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8DSsgUaiyPcfIXlk2vetnOMbPD9B8m8+una/987DFjo=; b=3KuqL4b3L3isNwlAC8nXgAma5s4Z3sUoHP09rMB6GpVZAm63RLHKqkvsSeZsKRh6Pj2xvIYryi3lxKWeTDoUOcTkwGZJowJ5JPrOGvRfXscFM9zs+NgveVOH2Gil6FjMc+GyBYy7gpmjATRN2c6A0BOiEVk/oLjkvs1y6BGfLEw= Received: from CY1PR03CA0005.namprd03.prod.outlook.com (2603:10b6:600::15) by SN6SPR01MB0060.namprd03.prod.outlook.com (2603:10b6:805:107::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.14; Fri, 13 Sep 2019 08:46:18 +0000 Received: from SN1NAM02FT050.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::204) by CY1PR03CA0005.outlook.office365.com (2603:10b6:600::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.14 via Frontend Transport; Fri, 13 Sep 2019 08:46:18 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by SN1NAM02FT050.mail.protection.outlook.com (10.152.72.128) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2241.14 via Frontend Transport; Fri, 13 Sep 2019 08:46:17 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kCeq030628 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:12 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:17 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 03/15] spi: make `cs_change_delay` the first user of the `spi_delay` logic Date: Fri, 13 Sep 2019 14:45:38 +0300 Message-ID: <20190913114550.956-4-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(136003)(39860400002)(346002)(376002)(199004)(189003)(70206006)(70586007)(54906003)(316002)(110136005)(336012)(2616005)(486006)(476003)(126002)(356004)(6666004)(106002)(7416002)(2906002)(26005)(186003)(2870700001)(5660300002)(48376002)(50226002)(426003)(44832011)(11346002)(446003)(7636002)(51416003)(8936002)(4326008)(50466002)(76176011)(2201001)(7696005)(8676002)(86362001)(36756003)(107886003)(305945005)(478600001)(246002)(1076003)(47776003)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6SPR01MB0060; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 11085ce2-6d45-40c4-7d8f-08d73826d805 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328); SRVR:SN6SPR01MB0060; X-MS-TrafficTypeDiagnostic: SN6SPR01MB0060: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: j2m2rWa7j8CxH4VtpCixydB4gjddpAPlkd41KEc70a3ZoXEMweSSMPkm03yj4X1v1lQwSJu1O9iGCxKPSUHDSDmaLN5v8plfyK7iip4oFIICAMSwFTy9b4rzTmAnduG1rOjMgjqm39hZXVgLjdk4wVBGY05LSx+zsoJZu+ZovdtbjvpSHXj7O59ewszgGobq6wNhGO8HXeZju9x7wmRR4/aTMLyUXNNEovV3wjW4uw25UgPXqU6BdrNZ7Q5+0VP171wJXW7grq9xq1tAvB76tvyHr/wU2vRHP4RYudP3kNPyx5C5iTt53KhLgQFbS6SWuMfyAmk0NIq7aW1SZdXRncc9HEqK5HIMt10PK/hRCYppX+eOLEQU4QhBYyK9C/U0GWvpTkBTGRBjvisw2OAmMS7tZKJEobaHhCftXfdRhNE= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:17.9130 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11085ce2-6d45-40c4-7d8f-08d73826d805 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6SPR01MB0060 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014623_045031_65EDD0BD X-CRM114-Status: GOOD ( 16.39 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Since the logic for `spi_delay` struct + `spi_delay_exec()` has been copied from the `cs_change_delay` logic, it's natural to make this delay, the first user. The `cs_change_delay` logic requires that the default remain 10 uS, in case it is unspecified/unconfigured. So, there is some special handling needed to do that. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi.c | 28 +++++++--------------------- include/linux/spi/spi.h | 4 +--- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 1883de8ffa82..d0bf0ffca042 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1160,9 +1160,9 @@ EXPORT_SYMBOL_GPL(spi_delay_exec); static void _spi_transfer_cs_change_delay(struct spi_message *msg, struct spi_transfer *xfer) { - u32 delay = xfer->cs_change_delay; - u32 unit = xfer->cs_change_delay_unit; - u32 hz; + u32 delay = xfer->cs_change_delay.value; + u32 unit = xfer->cs_change_delay.unit; + int ret; /* return early on "fast" mode - for everything but USECS */ if (!delay) { @@ -1171,27 +1171,13 @@ static void _spi_transfer_cs_change_delay(struct spi_message *msg, return; } - switch (unit) { - case SPI_DELAY_UNIT_USECS: - delay *= 1000; - break; - case SPI_DELAY_UNIT_NSECS: /* nothing to do here */ - break; - case SPI_DELAY_UNIT_SCK: - /* if there is no effective speed know, then approximate - * by underestimating with half the requested hz - */ - hz = xfer->effective_speed_hz ?: xfer->speed_hz / 2; - delay *= DIV_ROUND_UP(1000000000, hz); - break; - default: + ret = spi_delay_exec(&xfer->cs_change_delay, xfer); + if (ret) { dev_err_once(&msg->spi->dev, "Use of unsupported delay unit %i, using default of 10us\n", - xfer->cs_change_delay_unit); - delay = 10000; + unit); + _spi_transfer_delay_ns(10000); } - /* now sleep for the requested amount of time */ - _spi_transfer_delay_ns(delay); } /* diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index c18cfa7cda35..9ded3f44d58e 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -754,7 +754,6 @@ extern void spi_res_release(struct spi_controller *ctlr, * @cs_change: affects chipselect after this transfer completes * @cs_change_delay: delay between cs deassert and assert when * @cs_change is set and @spi_transfer is not the last in @spi_message - * @cs_change_delay_unit: unit of cs_change_delay * @delay_usecs: microseconds to delay after this transfer before * (optionally) changing the chipselect status, then starting * the next transfer or completing this @spi_message. @@ -847,8 +846,7 @@ struct spi_transfer { u8 bits_per_word; u8 word_delay_usecs; u16 delay_usecs; - u16 cs_change_delay; - u8 cs_change_delay_unit; + struct spi_delay cs_change_delay; u32 speed_hz; u16 word_delay; From patchwork Fri Sep 13 11:45:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144179 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E07C4912 for ; Fri, 13 Sep 2019 08:48:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BD8AB208C0 for ; Fri, 13 Sep 2019 08:48:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GxtEERR8"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="aK8RiKuW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BD8AB208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=achY8Xc065hsbgeSPlEvZkiwcJMr0vHDQhhHdXZHubw=; b=GxtEERR86Z/PJl kKeO+I6wZHNuwI4ACBuUlEtQV+zRU1uT/AGMxauysJ1Q1aXbctkOT2qirlUkEMgbu+neE8PjCvY2G 5BTeB9NxcWh3/S/biOo8uRc4ElK4yRl7QoviuW9bY7jcxLd9Y9ilvndEbz/nefHHRxrcr4O7+JU/m CvJRErx0/u52DYgZvwCzORx+eAadRKAV1IafLXocmdmbmL2WgXa8jQ52mP3IvLFwqlSzsa5xanIaZ pWGYrlQORf3BTOYyf6Vd5JYjjwyDvhFLhSHitIzvUE8BZWGPx2Aoms0OS3u+8BdI4h2Zu8VQhSi5S IImBVKLoGXhyjjREKe+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hFb-00047l-7s; Fri, 13 Sep 2019 08:48:19 +0000 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hDm-0002SG-9T for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:28 +0000 Received: from pps.filterd (m0167090.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gdsS020116; Fri, 13 Sep 2019 04:46:23 -0400 Received: from nam05-by2-obe.outbound.protection.outlook.com (mail-by2nam05lp2055.outbound.protection.outlook.com [104.47.50.55]) by mx0b-00128a01.pphosted.com with ESMTP id 2uytcwh98w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:23 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dtyfwgaMP+33407o1/b2cOVQ8msQSqS/8uTbZl1bG+2deL7piaES700w6HSwbP23nNGjyRgcRn3584Vpb4fzzgmWmlrhFRUVZ4dn6KMBp82RHQ660S0z7H2qwBLUnvE8wUlFN29P9BQsGXLj8zr6h8XWGrrZqhHxGkAqek02mGH+jPboqONlxsB8Ktk1bz46b+GnFZ2fr0sunmpg91KDMev8rsuQG/FwujOHSyxJRr66OZEBbJsSD9hroBdY8YZTYlzH9xjhRbAz8CZHbkt27vvtR4SYeqL1V8AYRnNfOSrdShwrnf8lpFNJq7ZisW/8yvSP9jYJEBMnb14fMnNLwA== 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-SenderADCheck; bh=nPQK7zz576sQdtlwSJKuqf0ppZ90iGSqdT8AmnEL2t0=; b=JP5EFGF5dRmJLihUJwhUpJXcjXQIZ5bmgJRH7WEgJHEi0PRbo4J3loon5af4oNHcHjVDbxDXTuNWhERhyYZfAcC7pIn7ep6xn9Se6JlJsoIz9sHJnRu7iKdt9STn2pQSHBGVI2vy5VaSiM1f26igLYVqvEi0iQNoNWcBpPqXuYMkd6LjTh4vf6gOpchg8vRktgsMiwA8z5ZZ/esa1XXq02Dy5ylRBO1H25a4gwPw5N7iBb59QRqYgL0LklJAL2J8jlJPcmuqljSv1fAWUHKyPdkDj3cXu8BYphcNUIZ4lGyY/coKRUYpSUnht1W0DQdbhDyclVAwlprr/q5XTMjlTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nPQK7zz576sQdtlwSJKuqf0ppZ90iGSqdT8AmnEL2t0=; b=aK8RiKuWWwUdBot4J5XX+Lht/K9erq9Zckkgm49NGda7xLsWz3+INxdDvm8T428Js4wJqNvgUFWPCBo3cDyQNTzrtOYgHUsOjRzGyy4LdSqgjDkQKf8v1udPSLNqkM1ifMybe3eHinr9GiSgkeMZrfNeVX2LE79jwk0sYukcJPE= Received: from CY4PR03CA0097.namprd03.prod.outlook.com (2603:10b6:910:4d::38) by BN6PR03MB2627.namprd03.prod.outlook.com (2603:10b6:404:5d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.15; Fri, 13 Sep 2019 08:46:21 +0000 Received: from CY1NAM02FT051.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::207) by CY4PR03CA0097.outlook.office365.com (2603:10b6:910:4d::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2220.16 via Frontend Transport; Fri, 13 Sep 2019 08:46:20 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT051.mail.protection.outlook.com (10.152.74.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:20 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kF6d030640 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:15 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:19 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 04/15] iio: imu: adis: convert cs_change_delay to spi_delay struct Date: Fri, 13 Sep 2019 14:45:39 +0300 Message-ID: <20190913114550.956-5-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(39860400002)(396003)(376002)(346002)(199004)(189003)(44832011)(2201001)(356004)(14444005)(106002)(316002)(7696005)(36756003)(110136005)(478600001)(51416003)(50466002)(107886003)(48376002)(5660300002)(54906003)(4326008)(1076003)(426003)(47776003)(305945005)(476003)(186003)(126002)(7416002)(70586007)(86362001)(7636002)(76176011)(486006)(2616005)(70206006)(11346002)(6666004)(446003)(2870700001)(50226002)(8676002)(246002)(336012)(26005)(2906002)(8936002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2627; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 528f22cb-a150-4b94-e4ae-08d73826d9a9 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:BN6PR03MB2627; X-MS-TrafficTypeDiagnostic: BN6PR03MB2627: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: FuQxc3ja9yYVIKBJL0TEUDOKplqz0IXQOJS3y9emfNecIz4LmXJMJDduxwLZjC6DKLWXOkqkvw/jZajhu7Lukt+jouzpZ78wNDizN7fT8x9RVOxlQzm3OwnoKrKme/C/48N7kTFBZO8PhGKiq7tgcCLnJ+j7gyOs7IVZc/gbaj/CwFrCA0HhVI5DsFfoYR47yM6Pl+hJqDRbXjUEG2BKWH7ACLKbxffm8unFmF0hV9BSddCuqr7PZf9v39myqknGJdjyqVi/BF7LqsL22KWyaX/ezFX801Mr1m7wP76HfBrky/B9IGgEhUhUbj+Rb1QBG5JZa8VDjZ68AgdsrPMV8iyv610EmyvSZs82JXO712E9q4eKVibbhgdJjMnIGHFK8rEI7UHGpiJryMULAXGGF0p7Rb551BCYGz8fazo+dXc= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:20.6025 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 528f22cb-a150-4b94-e4ae-08d73826d9a9 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2627 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 phishscore=0 impostorscore=0 mlxlogscore=963 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014626_813535_FB2C8ABD X-CRM114-Status: UNSURE ( 8.80 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.139.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The ADIS library is one of the few users of the new `cs_change_delay` parameter for an spi_transfer. The introduction of the `spi_delay` struct, requires that the users of of `cs_change_delay` get an update. This change updates the ADIS library. Signed-off-by: Alexandru Ardelean --- drivers/iio/imu/adis.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/iio/imu/adis.c b/drivers/iio/imu/adis.c index 1631c255deab..2cd2cc2316c6 100644 --- a/drivers/iio/imu/adis.c +++ b/drivers/iio/imu/adis.c @@ -39,24 +39,24 @@ int adis_write_reg(struct adis *adis, unsigned int reg, .len = 2, .cs_change = 1, .delay_usecs = adis->data->write_delay, - .cs_change_delay = adis->data->cs_change_delay, - .cs_change_delay_unit = SPI_DELAY_UNIT_USECS, + .cs_change_delay.value = adis->data->cs_change_delay, + .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 2, .bits_per_word = 8, .len = 2, .cs_change = 1, .delay_usecs = adis->data->write_delay, - .cs_change_delay = adis->data->cs_change_delay, - .cs_change_delay_unit = SPI_DELAY_UNIT_USECS, + .cs_change_delay.value = adis->data->cs_change_delay, + .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 4, .bits_per_word = 8, .len = 2, .cs_change = 1, .delay_usecs = adis->data->write_delay, - .cs_change_delay = adis->data->cs_change_delay, - .cs_change_delay_unit = SPI_DELAY_UNIT_USECS, + .cs_change_delay.value = adis->data->cs_change_delay, + .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 6, .bits_per_word = 8, @@ -139,16 +139,16 @@ int adis_read_reg(struct adis *adis, unsigned int reg, .len = 2, .cs_change = 1, .delay_usecs = adis->data->write_delay, - .cs_change_delay = adis->data->cs_change_delay, - .cs_change_delay_unit = SPI_DELAY_UNIT_USECS, + .cs_change_delay.value = adis->data->cs_change_delay, + .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 2, .bits_per_word = 8, .len = 2, .cs_change = 1, .delay_usecs = adis->data->read_delay, - .cs_change_delay = adis->data->cs_change_delay, - .cs_change_delay_unit = SPI_DELAY_UNIT_USECS, + .cs_change_delay.value = adis->data->cs_change_delay, + .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .tx_buf = adis->tx + 4, .rx_buf = adis->rx, @@ -156,8 +156,8 @@ int adis_read_reg(struct adis *adis, unsigned int reg, .len = 2, .cs_change = 1, .delay_usecs = adis->data->read_delay, - .cs_change_delay = adis->data->cs_change_delay, - .cs_change_delay_unit = SPI_DELAY_UNIT_USECS, + .cs_change_delay.value = adis->data->cs_change_delay, + .cs_change_delay.unit = SPI_DELAY_UNIT_USECS, }, { .rx_buf = adis->rx + 2, .bits_per_word = 8, From patchwork Fri Sep 13 11:45:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144181 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3654214DB for ; Fri, 13 Sep 2019 08:48:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 12F2B208C0 for ; Fri, 13 Sep 2019 08:48:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="EzCZiIwQ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="TLtwHFRh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 12F2B208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s0lxII9VW/q+1pth/Nori3IekYVKytDO0n721emiFjg=; b=EzCZiIwQuw+CA3 wNxcoIZIrxsKJNtRzNsNwNzrf8sqcgEQizVDs2KtUvLfvra/h7eF/p1jtO35D31Bzlg5vvu9HOCXN v4fuLrFgPKEFqOGOlxY8EOYCtRbt0dTSD4uD3fF6Oz2sPyW585ONJWeLlFufY9mRCCOqjL9J/AFlX Hzj/ARDkffFfmwvBnFQcqspBEpWNmc8wmJjs6Fa26olLhHOQHBVx1NBk9w+DTA/MF2/pu8ncfUXRo jUVHBvGDwjnsDmVIzeMfBkI/bfo3CuCxW1Jo9UUBLdd7B/wYj2VM5KgMMVnC4fTaDoKA9F48AX189 l3HZpUZsIx/u8TIvUY9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hFu-0004Vj-L0; Fri, 13 Sep 2019 08:48:39 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hDo-0002X5-5w for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:30 +0000 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8h2qn016487; Fri, 13 Sep 2019 04:46:26 -0400 Received: from nam05-by2-obe.outbound.protection.outlook.com (mail-by2nam05lp2058.outbound.protection.outlook.com [104.47.50.58]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdksa6a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:25 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I7zxbLDRVpVfGH4NZMffWEIFeGc7eCzcWlzqBRBt+ecp7RJugGoD+N7ZMVq1ZbNTYO4tjJtUvtMMS9N9cVk+GIWMOqXTLRVW7dHD9GrH/pgcBEmigUJfY9a7sr3xwzirMuLbFiNCrML3wFYxUYwZZ+e1jdWEBm3Ap9LPAeoRHnPubEz9m14IJV0ma4llJl5ZK5MKwOcoA86ZvGpXlyKSfGXCoD01gm/o3x1z5I3RzJoFehRxkGJg7Z7DvfXdbcDs7q6DOPWy5JRU5FIOVaqHnfc3zIN85LvEZqZBoij8RIt2Y8fq9JxB7ieZkvVnL26gdsbLhst7cp3crVAN2uRlTA== 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-SenderADCheck; bh=ayt80fwvpB829Bt6euVneY1BsrkmJUopnKwAKBkNrcE=; b=FmApK0hxrJrgTxgGEtZOXecSfYD9qLWkL498s3MjGnNXT8ANBDFQDu0sh51mAGQFSPTtPAO2MgvDbsKcYT58cRBwqj5lVl+2x4+kbp3ETdtg3NQjHbPR8VxQ4HQu9Fcrh/8UkecJLxgG9EWiIrkKArxFukfhxVcBpku+IQyQU7+/0mLp3j4X2ob+FvYPlfhzUjw6BrYAXFRq7ry+1GIJDpfhOw0zuI8locnUVaCwi5whR5oaI2BCrODXZbdyAu56QrD6O92eefkSOfArBG0Ldu62kLXDU0Ju10A5U6tIOZ4b1vIT01k9qKAql9YJ5gdVB47tfKV6LdDRnlVfUb2qnQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ayt80fwvpB829Bt6euVneY1BsrkmJUopnKwAKBkNrcE=; b=TLtwHFRh81pHhBhyfTpNvHyAnDVg7PnbKVcf4KCV0Kzqqtn+f2gHVN++rdz72gLavYnlmz5CqKRSj5r4Qe9fez5u96N+63M2Ohv6kR40Cjvy2usbciVPcVafPfeYZq+EPmVKqtBH2IfziQa5c32FfGlE93zUfyI9o5Sh3aiEjVk= Received: from DM6PR03CA0071.namprd03.prod.outlook.com (2603:10b6:5:100::48) by BYAPR03MB3573.namprd03.prod.outlook.com (2603:10b6:a02:ae::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.18; Fri, 13 Sep 2019 08:46:23 +0000 Received: from CY1NAM02FT032.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::209) by DM6PR03CA0071.outlook.office365.com (2603:10b6:5:100::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.19 via Frontend Transport; Fri, 13 Sep 2019 08:46:23 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT032.mail.protection.outlook.com (10.152.75.184) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:23 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kHVR030654 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:17 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:22 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 05/15] spi: sprd: convert transfer word delay to spi_delay struct Date: Fri, 13 Sep 2019 14:45:40 +0300 Message-ID: <20190913114550.956-6-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(346002)(39860400002)(376002)(396003)(189003)(199004)(86362001)(5660300002)(7416002)(51416003)(54906003)(186003)(8936002)(50226002)(50466002)(1076003)(7636002)(305945005)(36756003)(107886003)(44832011)(7696005)(356004)(76176011)(8676002)(446003)(2616005)(47776003)(6666004)(476003)(426003)(486006)(2870700001)(70586007)(4326008)(48376002)(478600001)(26005)(2201001)(126002)(106002)(11346002)(316002)(70206006)(110136005)(2906002)(336012)(246002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB3573; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 107d0e70-0a27-41c4-9a6c-08d73826db38 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:BYAPR03MB3573; X-MS-TrafficTypeDiagnostic: BYAPR03MB3573: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: RTs1JyH0lSdsPEwocnRu8pSs+Iq9U5+wL5NUE13roqg3YUq3vhJRpYGPxacQiqE5IKdeSNz5oJIOY/rWdQisEjgkSZQAByQc/PEs9nL32hffbIkdMS1bJUOzjRIKaVcy2shLLIcwXo2PvWiCEMK4FM7sUQCF1OeJXuZdG0mVat83qPU6QcGqiSgevQqMdaueo0xxT64255Av2Fqphu3Qzqwqq8OYZN3ESgapDBLjIMKX5F714CoOK5G22e4VtX0tSFdlQ84BhE3nQB5qPRNGylcLgwxvTljJsWfLZtg9dQGGHkBw5Wb/FXzwXQpl7y4F7WKPjSt0xkNRJx6MTt/79QZTBTKIGFPHFHoG/Wqz6m9dYxB0t/iDT/QF+3t2+Y0FGSbCsYG6bzNYLzerdH80w6bk7OFqxEXNFR3sa/FkTMM= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:23.2665 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 107d0e70-0a27-41c4-9a6c-08d73826db38 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB3573 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 mlxlogscore=999 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014628_239538_0F593432 X-CRM114-Status: GOOD ( 14.33 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The Spreadtrum SPI driver is the only user of the `word_delay` field in the `spi_transfer` struct. This change converts the field to use the `spi_delay` struct. This also enforces the users to specify the delay unit to be `SPI_DELAY_UNIT_SCK`. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-sprd.c | 11 +++++++++-- include/linux/spi/spi.h | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c index 1b7eebb72c07..5634cd3e4a8d 100644 --- a/drivers/spi/spi-sprd.c +++ b/drivers/spi/spi-sprd.c @@ -671,9 +671,13 @@ static void sprd_spi_set_speed(struct sprd_spi *ss, u32 speed_hz) static void sprd_spi_init_hw(struct sprd_spi *ss, struct spi_transfer *t) { + struct spi_delay *d = &t->word_delay; u16 word_delay, interval; u32 val; + if (t->unit != SPI_DELAY_UNIT_SCK) + return -EINVAL; + val = readl_relaxed(ss->base + SPRD_SPI_CTL7); val &= ~(SPRD_SPI_SCK_REV | SPRD_SPI_NG_TX | SPRD_SPI_NG_RX); /* Set default chip selection, clock phase and clock polarity */ @@ -686,7 +690,7 @@ static void sprd_spi_init_hw(struct sprd_spi *ss, struct spi_transfer *t) * formula as below per datasheet: * interval time (source clock cycles) = interval * 4 + 10. */ - word_delay = clamp_t(u16, t->word_delay, SPRD_SPI_MIN_DELAY_CYCLE, + word_delay = clamp_t(u16, d->value, SPRD_SPI_MIN_DELAY_CYCLE, SPRD_SPI_MAX_DELAY_CYCLE); interval = DIV_ROUND_UP(word_delay - 10, 4); ss->word_delay = interval * 4 + 10; @@ -719,13 +723,16 @@ static int sprd_spi_setup_transfer(struct spi_device *sdev, struct sprd_spi *ss = spi_controller_get_devdata(sdev->controller); u8 bits_per_word = t->bits_per_word; u32 val, mode = 0; + int ret; ss->len = t->len; ss->tx_buf = t->tx_buf; ss->rx_buf = t->rx_buf; ss->hw_mode = sdev->mode; - sprd_spi_init_hw(ss, t); + ret = sprd_spi_init_hw(ss, t); + if (ret) + return ret; /* Set tansfer speed and valid bits */ sprd_spi_set_speed(ss, t->speed_hz); diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 9ded3f44d58e..16397b210e0c 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -759,7 +759,7 @@ extern void spi_res_release(struct spi_controller *ctlr, * the next transfer or completing this @spi_message. * @word_delay_usecs: microseconds to inter word delay after each word size * (set by bits_per_word) transmission. - * @word_delay: clock cycles to inter word delay after each word size + * @word_delay: inter word delay to be introduced after each word size * (set by bits_per_word) transmission. * @effective_speed_hz: the effective SCK-speed that was used to * transfer this transfer. Set to 0 if the spi bus driver does @@ -847,8 +847,8 @@ struct spi_transfer { u8 word_delay_usecs; u16 delay_usecs; struct spi_delay cs_change_delay; + struct spi_delay word_delay; u32 speed_hz; - u16 word_delay; u32 effective_speed_hz; From patchwork Fri Sep 13 11:45:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144183 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 85F101599 for ; Fri, 13 Sep 2019 08:49:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 63FCF208C0 for ; Fri, 13 Sep 2019 08:49:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IvcOxWEO"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="EGzAfhTI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63FCF208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w0Qd2wf3whEYWqP7rLryfJ1joFUEa96+SEIcFtkIUGM=; b=IvcOxWEOMqT6qu qkKZeXE4Ul/PfuSFWnjjLwdyy55w/tf6VqWZAHLZqaaHg7B8Lql6lpbuqNBLkcQbahVONRPAXKpIt InMFAvKPvp0aREQbDYXsqZTXNj3QVcozuOHHAKIva+KuYE0k0h1Blg7LXnLC9XcaFD4ZLFAHzo/ga HD16Fq/mIcnmnzAH5Ldz7Zon3u6hhc1cn8pU29NZFQhFPkFLfM0T2jQXNRdw5/NBMKXrdEGfsHM4Y hsm2lDJvX3NhQnwhr4Y0mtbR2hGKqgkj+Quxhvrro2IS052kNw/fYWK4CIdn+d6gCrzsUfSMiJwJ/ fHb2Y5SQUZ/OsGULW2Rg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hGH-0004x1-J1; Fri, 13 Sep 2019 08:49:01 +0000 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hDq-0002eH-Ug for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:36 +0000 Received: from pps.filterd (m0167091.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gikP017287; Fri, 13 Sep 2019 04:46:28 -0400 Received: from nam05-by2-obe.outbound.protection.outlook.com (mail-by2nam05lp2051.outbound.protection.outlook.com [104.47.50.51]) by mx0b-00128a01.pphosted.com with ESMTP id 2uytd1h9ay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XkbyOh5elzWjYWnGN8xf55IbDvw/rT/aIlkuQJiNrxqc1va571aaGh9LrvaWheWPGv/hQRmn2CxWKuQkgg6wYKY62kKBYGkRi40R3fhr/+ysQP/QZzdr0irTcSIuG5Funlma+O/3O2HzS9nDCizziO5cRzX/JiV2VpQFdIxIe5Ez2QQ3u1F0G8pWcQmjywPVNewXvoXZPaubt8cN9XpLm03y3MioO5TdrMStFkEbxBucKuVJHwU6TuemLvMFA1+V8Edkx4dSznmyZmSIAsPEZ/wuUlVxjJC8WTLz4g4VsOWhYHMY042Wbo75A1di69nWOGvTHcrdykjf1gSTwRUQEA== 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-SenderADCheck; bh=4tAthPJJ00Md+QA2VffHOABt3RVqF/+sx3EiB52xHYc=; b=FYhzj6ThiDguruXNw1CihFEEVpjdZ0deNJekzlcBM12179L/TIVJV9M45kd12FTyFIm/JnVZX7JBDk/6m+z+B9HgtXf43KPApsLgezu9XC12kDAgAAtdiJYTpusHWXZdJ1zXqUw2V2qyuOqvbu12cv9B8ngXlDA5nM1+AV4AcbaEfpLQf1PM96ftDEmA12kDjRWvXfUNBkIHOj3W/Y1rBQLARirqYFsb/PkvlJiNGd5JF+c0SUHqDzUU0dPJn3ogE/i6zoFNUIzC95AxanBmXDfCLDuhClrCKRl/LSU89dzZkw4W9vNxMqc65kEN9wZwsaanJ+iXKBUtbTHKCQTHXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4tAthPJJ00Md+QA2VffHOABt3RVqF/+sx3EiB52xHYc=; b=EGzAfhTInmsFz+Z/PDybcFkUTmcHsT4HW2T7ArbeXVzDXviDH2UUT96ELkoe6J2ngUvy8qSjDD/B8H/wFoMFg1T4lREPJV4qebBZlaWXs3KYio8sfWwQZQ82TTlkg7SU5DilC9JM2KbZ5OYV6gbYZnxTX2S6/azW1VT/io7dbXA= Received: from CY4PR03CA0017.namprd03.prod.outlook.com (2603:10b6:903:33::27) by BN8PR03MB5058.namprd03.prod.outlook.com (2603:10b6:408:d9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.15; Fri, 13 Sep 2019 08:46:26 +0000 Received: from CY1NAM02FT011.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::202) by CY4PR03CA0017.outlook.office365.com (2603:10b6:903:33::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:26 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT011.mail.protection.outlook.com (10.152.75.156) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:26 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kKog030667 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:20 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:24 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 06/15] spi: orion: use new `word_delay` field for SPI transfers Date: Fri, 13 Sep 2019 14:45:41 +0300 Message-ID: <20190913114550.956-7-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(136003)(346002)(396003)(376002)(199004)(189003)(54906003)(50466002)(186003)(50226002)(8676002)(11346002)(107886003)(446003)(47776003)(36756003)(48376002)(4326008)(356004)(70586007)(6666004)(70206006)(2906002)(7696005)(486006)(5660300002)(8936002)(44832011)(336012)(316002)(86362001)(51416003)(26005)(2616005)(2201001)(246002)(7636002)(478600001)(110136005)(106002)(426003)(1076003)(7416002)(305945005)(476003)(126002)(2870700001)(76176011)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN8PR03MB5058; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2db00d43-9f73-4c49-79e7-08d73826dceb X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:BN8PR03MB5058; X-MS-TrafficTypeDiagnostic: BN8PR03MB5058: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2089; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: LjdkS8oN9oFQwdrfav8dXbSTt94/KuCQ5olWEh0xrnfca8FbmkcsCH/Suwme7fdzCd7awroe9iwIu6hQS5OMrGA8UyJYsPvlHvtRPUiu1InlJupaopUnNv8ynrQM10EJ9aEjKS8L0m7ctGtWfM/xamPmAuUhR3g3RGeKsYRKW2Q40J183NN2DnrUgoyQ6mQmV6zSWK/N6zdFEJCt3vbWM5/+xqw/aUui7KX6bxndfPLe+OpgATV+nBg3OCuj4av8Ngb3jJA0uJG22S5Bf7mHwsohDl31bpniOlcvt69vpxmvx4hFO45RPFbmAUleG161vIZez6AqipT3fR2CEOk2V02a/R2RKr6GW8tod0blA/bdqOrXSl7sLbj3vVcPTLrOXtbNR7sLiVU+xrdABx3mz6QL43CpwidhnShr5D7kViI= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:26.1125 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2db00d43-9f73-4c49-79e7-08d73826dceb X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR03MB5058 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 impostorscore=0 suspectscore=0 mlxlogscore=802 clxscore=1015 lowpriorityscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014631_886526_7C50DE4A X-CRM114-Status: GOOD ( 11.54 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.139.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The `word_delay` field had it's type changed to `struct spi_delay`. This allows users to specify nano-second or clock-cycle delays (if needed). Converting to use `word_delay` is straightforward: it just uses the new `spi_delay_exec()` routine, that handles the `unit` part. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-orion.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index 6643ccdc2508..756c37e32dfe 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -467,8 +467,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) if (orion_spi_write_read_8bit(spi, &tx, &rx) < 0) goto out; count--; - if (xfer->word_delay_usecs) - udelay(xfer->word_delay_usecs); + spi_delay_exec(&xfer->word_delay, xfer); } while (count); } else if (word_len == 16) { const u16 *tx = xfer->tx_buf; @@ -478,8 +477,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) if (orion_spi_write_read_16bit(spi, &tx, &rx) < 0) goto out; count -= 2; - if (xfer->word_delay_usecs) - udelay(xfer->word_delay_usecs); + spi_delay_exec(&xfer->word_delay, xfer); } while (count); } From patchwork Fri Sep 13 11:45:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144185 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5499114DB for ; Fri, 13 Sep 2019 08:49:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31F85208C0 for ; Fri, 13 Sep 2019 08:49:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="m9+3af1Y"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="zQZu59kf" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31F85208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ogRIh0B4dJT4ulfP//rrxImsBa7IXy5TbAwSbiCaXbQ=; b=m9+3af1YMMjDkO CRsC8Xa06dDpuzQ03gbcnMdbzM5jVDnjuyQ72FeXOI+M3ztY44kLlsZHsjSt90PbfU/959VJozAiw gJHfXNufu6M1UT04qfKSs9NRQsCYPl8MWTPs17zwjfTKHjf7Ky1bqXjr97ndKqqTefL699JxcW8op kl0sgHPep5wmctmVxHDvW84jAXa4egH5qjIOLj+Te4haHmh03JY2mTBb87OahI6lrYrzbgfwyjwV+ sRl33/hsG4pkyytOV72ilkg7aoDw8OSn3Cq8lI1mzngSP3xFOM+F+Bt+UYg9JrtMZ5wzFQ7PDHfgK D6gilopuqOMHa9A66stg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hGg-0005B2-Rc; Fri, 13 Sep 2019 08:49:27 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hDt-0002jC-GC for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:36 +0000 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gaAe015972; Fri, 13 Sep 2019 04:46:31 -0400 Received: from nam03-co1-obe.outbound.protection.outlook.com (mail-co1nam03lp2052.outbound.protection.outlook.com [104.47.40.52]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdksa6f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GU0bJwiEo2gLUAlSjbI0/SV8Q94Dn8AYc6NL+7MlXoZ4UtCOJ3vNoLaXSHukye8xJ1/2Y6ojk4uwYwuOLidHq9NmqZy4k18ko8oDiSbtK9zOkOL2gujo865HilWXg18UovWAwx7I+vZ9UtV81PCzmXNGQmXWOGhEC2eWgH0Wan42Ra6Tqc0YjiiADbZDMXBnkCdgceeLPuhv6jfZ85i1nW1XKpL3zoMUvTr+lw1t/XyF22l/xQqaiz+aCH77q/85nspnmqrcEOlgWSP9X2OZCUDf2JxWjxG03wvMRq0A7BoCunET534xjj/VKEgVRoyWwb2XeNo8bYuL5ox4bGiBjg== 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-SenderADCheck; bh=jZSDTjpFf1yZc16/IDU9rKofLB8/ySMkTzgyv2YEtVU=; b=fmqdr89Pys4zAwQ+l8WzDY1Zj3UJMglpgqLiSnbi9B5cRWiFenKMTAY2w7CP7ajG8n0ERE9aOROIUyzuC7j+opboyHDVzXA9TNkW6JpeOYPoYRh4GAxJHF2NPfUqXUM+91hBktRC6PzrwO3nQ5pHLjMSs5zNERoBkl93mfDH9bMnwiDUkg/zvUUUBF1UeMUE0V2kq6qKG3ynRtq1BG/3FXQE5pDC/Pd1Ee+nZYpNW4DEgWCLx3YJUsGDbe3r62BNimd+1znMb/kBnfNNb8GtsyHADWCK7Pp8OoCxJwf+tKip8rSxgL6kT0rfCTOAdoZiuggX260BBJhbRmZ9UDSoZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jZSDTjpFf1yZc16/IDU9rKofLB8/ySMkTzgyv2YEtVU=; b=zQZu59kf//DDNYsEcv1ThQzjxknwdaZZDdH97quPqqBAuC6jMIVnYvaS+pxv/pMVDmi1YQJwKzmpkXsOwm3y4GTYsZ0lVvAQfJyHG6zTAB0Mbin4gnM3+2+1ZYthebkETdAMkUCFv8mUYHGjN6QB1YjtBMwugrs7eCxshkb6x8k= Received: from DM5PR03CA0049.namprd03.prod.outlook.com (2603:10b6:4:3b::38) by DM6PR03MB3611.namprd03.prod.outlook.com (2603:10b6:5:b6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.18; Fri, 13 Sep 2019 08:46:29 +0000 Received: from CY1NAM02FT008.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::209) by DM5PR03CA0049.outlook.office365.com (2603:10b6:4:3b::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.16 via Frontend Transport; Fri, 13 Sep 2019 08:46:29 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT008.mail.protection.outlook.com (10.152.75.59) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:28 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kNKJ030677 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:23 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:27 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 07/15] spi: spidev: use new `word_delay` field for spi transfers Date: Fri, 13 Sep 2019 14:45:42 +0300 Message-ID: <20190913114550.956-8-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(346002)(39860400002)(136003)(376002)(199004)(189003)(186003)(48376002)(8936002)(50226002)(336012)(426003)(126002)(446003)(476003)(86362001)(2201001)(2616005)(2870700001)(11346002)(7696005)(51416003)(76176011)(5660300002)(36756003)(6666004)(106002)(50466002)(486006)(26005)(54906003)(316002)(110136005)(1076003)(47776003)(70586007)(4326008)(44832011)(246002)(356004)(70206006)(8676002)(14444005)(2906002)(478600001)(305945005)(7636002)(7416002)(107886003)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR03MB3611; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 392e077a-1c0d-483a-8f05-08d73826de8f X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328); SRVR:DM6PR03MB3611; X-MS-TrafficTypeDiagnostic: DM6PR03MB3611: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: MvMnJZpD4UA27SawFtG1rCdEBzPabJd69SyMjrwoaQxTUXwnAJM5MksW/gV2+HtN58VFoDk7L25JWxILcSa6z9D6sx8B5O0hHyCX+b3PAmxflgSbvBEmN9bLlu+Z4TpwewWbvampLgMnKATAtaLt4lauoOEDfqkF1CyeQ5M+lkfToO1n/4gpUwEESG2FC8Ekwa8U8tVItUVXMQQeO8wnb8CFJb6jFKDec5ms11ewWchEY5/QIzuEA4dEO1EMxkLib5PxyZYgMuf/bC5J1fiTRIE1IgxSBLSO8hfzthRplJnB8xo+BdYmzDE7QJPPxf/d/VW0kI7wWdjfKs/ZIJAAT+PxyPZaONtuqC8q6Kj5JrgzRkk4T1tRl06onMkutmzLe6gx0rr3mb7YbM5YYzFJmsqMhMUy+QJFTL6BdcoWQO8= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:28.8756 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 392e077a-1c0d-483a-8f05-08d73826de8f X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR03MB3611 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 mlxlogscore=769 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014633_700023_2AC7697D X-CRM114-Status: GOOD ( 11.90 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The `word_delay` field had it's type changed to `struct spi_delay`. This allows users to specify nano-second or clock-cycle delays (if needed). Converting to use `word_delay` is straightforward: it's just assigning the value to `word_delay.value` and hard-coding the `word_delay.unit` to `SPI_DELAY_UNIT_USECS` This keeps the uapi for spidev un-changed. Changing it can be part of another changeset and discussion. Signed-off-by: Alexandru Ardelean --- drivers/spi/spidev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 255786f2e844..495319c2fa11 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -267,7 +267,8 @@ static int spidev_message(struct spidev_data *spidev, k_tmp->bits_per_word = u_tmp->bits_per_word; k_tmp->delay_usecs = u_tmp->delay_usecs; k_tmp->speed_hz = u_tmp->speed_hz; - k_tmp->word_delay_usecs = u_tmp->word_delay_usecs; + k_tmp->word_delay.value = u_tmp->word_delay_usecs; + k_tmp->word_delay.unit = SPI_DELAY_UNIT_USECS; if (!k_tmp->speed_hz) k_tmp->speed_hz = spidev->speed_hz; #ifdef VERBOSE From patchwork Fri Sep 13 11:45:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144187 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 563401599 for ; Fri, 13 Sep 2019 08:49:51 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2C437208C0 for ; Fri, 13 Sep 2019 08:49:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="YPn9nQ/m"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="SpbpG12e" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C437208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PDgz1FVvPTmjFPqN2iuFwt4AhdGZyQRDGWQ8uHCk4cE=; b=YPn9nQ/mPkdMAF ZWKTR5+MFdQ22D08x3Dpn2WTZ/FgTcCXSTBsBsRT4BLb8IzbEi+H0lrd7y95yU/NKH80uTCUH1CxE 90gDyBgVCIsX7JYj0LWxgpsW+0zC4ZWOK4d71YksuBtayhTmGey+V3jQAu51XZxpktX7bWDk9bafv AEcF3UclrQuDhhaRBSc4H5si6Z3Qn3xN3ehaeJ/kp1/J5Okq45DtVNMED6xur2Rh1SbBgdJTfsREA 3o8HhQ3dYoseRPQKodtQrV4UIkubzJZa6F2kDwAktyLAUuJF2gWunRMley8U7da0vNgAQjG4vKxc2 TeqxuIYPnPwfof5DMPEg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hGy-0005Oo-WF; Fri, 13 Sep 2019 08:49:45 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hDx-0002mD-1l for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:39 +0000 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gsta001935; Fri, 13 Sep 2019 04:46:34 -0400 Received: from nam01-by2-obe.outbound.protection.outlook.com (mail-by2nam01lp2058.outbound.protection.outlook.com [104.47.34.58]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdfsa85-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:34 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AGmFx0b/y7/0tkBVloHzr44Zhknq2Y7C5lmAXJSwUVuJcK6ZK27a2lzHnxyfMERuGImWt/gxaK5uL1VNiXZz9YLXkSBdgEMknNOC+x/rzAI1kPIJPiXDa3ljYhHkk20Np0o+kcjc5rfIuGDqqzifbcZbmcWqUOaAj74fNrOoOC9Omy4PjmDhhbA8Mcu4uq+C5Rq0wV4IFf9rSQKscCapKtNzIWQrZtRwqnLvVE6Jq3w4PhXRZZmj31edooWuRhndJVMU61rBgpCt6tFyBmqt3EZikAsVp0v9u2jNVyHDmUKAPvvWuFL/eswzxTCaSlmIwW3tAHZ+TorqPQU73vk1tQ== 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-SenderADCheck; bh=hfHznp9C/uGwlBu8jzfVRiiAcVsPibiwgdWvzbHijTM=; b=A+ZxWru9mLGsc9w7sgFpv+C4Ge8Zg/AHUIet1RCfLYkmPjQ2ZzWozIDzRp0/XxUJ6cL9V2pHDG9dfVhPH1DWEnqVjLx/I5IqX4cIDRc9jNpw16jX0LDzO3WB+XjIRoSDIRoOOT6mzR1e81AwOMZIZumIj+w4HlalU8r2fRAebsRBuQ4g8xyBXL6J1taqifbEIr7WCH7xlz9MirLF9WkccWhy0nFRPqOH9aMSfFsYW1eiqkHa9Ba+y2c9fva8hIxcQ/iTTN6lQjhwTNtvun+efIaPj7noGElaoTV9tpigEphBMqsVvoxmVMDKY2QPTAIsy23G9BeOC1yN0i5oh0HUgw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hfHznp9C/uGwlBu8jzfVRiiAcVsPibiwgdWvzbHijTM=; b=SpbpG12eqce0ul1uYaIwAOUvb4pELMWyv+n7FnEtP4XHJ9vKrM8RFF9xbg0dOSp3zcBtoX+Y/obv916/wpLDQwsC32mFZ3ta7+jwKf3ic9LJufns+TfxL9spLqjqypV3iRtnzMAez6+TUhS8rWt3Y3e/MdJH6CxC42WXrEKahA0= Received: from CY4PR03CA0012.namprd03.prod.outlook.com (2603:10b6:903:33::22) by BYAPR03MB4790.namprd03.prod.outlook.com (2603:10b6:a03:135::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.18; Fri, 13 Sep 2019 08:46:32 +0000 Received: from CY1NAM02FT019.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::204) by CY4PR03CA0012.outlook.office365.com (2603:10b6:903:33::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.15 via Frontend Transport; Fri, 13 Sep 2019 08:46:31 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT019.mail.protection.outlook.com (10.152.75.177) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:31 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kQkP030691 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:26 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:30 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 08/15] spi: core, atmel: convert `word_delay_usecs` -> `word_delay` for spi_device Date: Fri, 13 Sep 2019 14:45:43 +0300 Message-ID: <20190913114550.956-9-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(346002)(136003)(376002)(396003)(189003)(199004)(2201001)(305945005)(76176011)(36756003)(14444005)(44832011)(2870700001)(54906003)(106002)(110136005)(8676002)(336012)(476003)(50226002)(478600001)(2906002)(5660300002)(4326008)(2616005)(70586007)(86362001)(186003)(70206006)(11346002)(486006)(7696005)(246002)(47776003)(7416002)(8936002)(356004)(107886003)(426003)(50466002)(316002)(446003)(48376002)(26005)(7636002)(51416003)(1076003)(6666004)(126002)(142933001)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4790; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 197dd7dd-8d79-4dfa-ee28-08d73826e025 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:BYAPR03MB4790; X-MS-TrafficTypeDiagnostic: BYAPR03MB4790: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: hkzuZ4EgFWxaaRFAsuTbZ6xlrUqsy407WTj1MXXi+xT+oNtUuvuajs4yOnjsd25VLGQj2Od2+UfCv8N1XEk4AOFsth4x/BV33C5ptxcWEChBBRQAyFlh1iX3SEgV/rzDH0OHwIdmMbJFZxr9SJD6QgiUH2cFtIU1zLH+lv8ljjTQcCZPcGUYnhKfgtLRM+ceRMqw/dajB64vgjPKLhkSAnaCS+PEFWT9zFXcCW8qDYqEPggfGJcIEOySab/MLK0cQEFjoX7s+Pzu4bAnuN0VUzg0VahBGNcWrhZERQr3ii3QfH9rt1OCLGOhhPLDYwB602YZy9cBF//QGK8GYc2boXtftDU4ReRy4wg/530Zpc+qNJoozyxzOrohRBxdCTmFH3gtKzx/ccZaxTcb+z4tl6Jl4MYDccd7X9Qo+/6IysY= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:31.5398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 197dd7dd-8d79-4dfa-ee28-08d73826e025 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4790 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014637_206256_FAB9FE36 X-CRM114-Status: GOOD ( 16.79 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This change does a conversion from the `word_delay_usecs` -> `word_delay` for the `spi_device` struct. This allows users to specify inter-word delays in other unit types (nano-seconds or clock cycles), depending on how users want. The Atmel SPI driver is the only current user of the `word_delay_usecs` field (from the `spi_device` struct). So, it needed a slight conversion to use the `word_delay` as an `spi_delay` struct. In SPI core, the only required mechanism is to update the `word_delay` information per `spi_transfer`. This requires a bit more logic than before, because it needs that both delays be converted to a common unit (nano-seconds) for comparison. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-atmel.c | 26 ++++++++++++++++++++++++-- drivers/spi/spi.c | 24 ++++++++++++++++++++++-- include/linux/spi/spi.h | 7 ++----- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index f00b367523cd..009bb4fb5e5f 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1172,12 +1172,31 @@ atmel_spi_pdc_interrupt(int irq, void *dev_id) return ret; } +static int atmel_word_delay_csr(struct spi_device *spi, struct atmel_spi *as) +{ + struct spi_delay *delay = &spi->word_delay; + u32 value = delay->value; + + switch (delay->unit) { + case SPI_DELAY_UNIT_NSECS: + value /= 1000; + break; + case SPI_DELAY_UNIT_USECS: + break; + default: + return -EINVAL; + } + + return (as->spi_clk / 1000000 * value) >> 5; +} + static int atmel_spi_setup(struct spi_device *spi) { struct atmel_spi *as; struct atmel_spi_device *asd; u32 csr; unsigned int bits = spi->bits_per_word; + int word_delay_csr; as = spi_master_get_devdata(spi->master); @@ -1201,11 +1220,14 @@ static int atmel_spi_setup(struct spi_device *spi) */ csr |= SPI_BF(DLYBS, 0); + word_delay_csr = atmel_word_delay_csr(as, spi); + if (word_delay_csr < 0) + return word_delay_csr; + /* DLYBCT adds delays between words. This is useful for slow devices * that need a bit of time to setup the next transfer. */ - csr |= SPI_BF(DLYBCT, - (as->spi_clk / 1000000 * spi->word_delay_usecs) >> 5); + csr |= SPI_BF(DLYBCT, word_delay_csr); asd = spi->controller_state; if (!asd) { diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d0bf0ffca042..ba8731b77753 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3159,6 +3159,26 @@ void spi_set_cs_timing(struct spi_device *spi, u8 setup, u8 hold, } EXPORT_SYMBOL_GPL(spi_set_cs_timing); +static int _spi_xfer_word_delay_update(struct spi_transfer *xfer, + struct spi_device *spi) +{ + int delay1, delay2; + + delay1 = _spi_delay_to_ns(&xfer->word_delay, xfer); + if (delay1 < 0) + return delay1; + + delay2 = _spi_delay_to_ns(&spi->word_delay, xfer); + if (delay2 < 0) + return delay2; + + if (delay1 < delay2) + memcpy(&xfer->word_delay, &spi->word_delay, + sizeof(xfer->word_delay)); + + return 0; +} + static int __spi_validate(struct spi_device *spi, struct spi_message *message) { struct spi_controller *ctlr = spi->controller; @@ -3294,8 +3314,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) return -EINVAL; } - if (xfer->word_delay_usecs < spi->word_delay_usecs) - xfer->word_delay_usecs = spi->word_delay_usecs; + if (_spi_xfer_word_delay_update(xfer, spi)) + return -EINVAL; } message->status = -EINPROGRESS; diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 16397b210e0c..e7ec0be16a82 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -138,7 +138,7 @@ extern int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer); * the spi_master. * @cs_gpiod: gpio descriptor of the chipselect line (optional, NULL when * not using a GPIO line) - * @word_delay_usecs: microsecond delay to be inserted between consecutive + * @word_delay: delay to be inserted between consecutive * words of a transfer * * @statistics: statistics for the spi_device @@ -188,7 +188,7 @@ struct spi_device { const char *driver_override; int cs_gpio; /* LEGACY: chip select gpio */ struct gpio_desc *cs_gpiod; /* chip select gpio desc */ - uint8_t word_delay_usecs; /* inter-word delay */ + struct spi_delay word_delay; /* inter-word delay */ /* the statistics */ struct spi_statistics statistics; @@ -757,8 +757,6 @@ extern void spi_res_release(struct spi_controller *ctlr, * @delay_usecs: microseconds to delay after this transfer before * (optionally) changing the chipselect status, then starting * the next transfer or completing this @spi_message. - * @word_delay_usecs: microseconds to inter word delay after each word size - * (set by bits_per_word) transmission. * @word_delay: inter word delay to be introduced after each word size * (set by bits_per_word) transmission. * @effective_speed_hz: the effective SCK-speed that was used to @@ -844,7 +842,6 @@ struct spi_transfer { #define SPI_NBITS_DUAL 0x02 /* 2bits transfer */ #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ u8 bits_per_word; - u8 word_delay_usecs; u16 delay_usecs; struct spi_delay cs_change_delay; struct spi_delay word_delay; From patchwork Fri Sep 13 11:45:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144189 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 382B71599 for ; Fri, 13 Sep 2019 08:50:10 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0EFF7208C0 for ; Fri, 13 Sep 2019 08:50:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lEwq6BnC"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="7i2mRiJq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0EFF7208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XUQ654HSI14yiJz0Au8Tr5tCx52OAIeCo9f6ize6FlE=; b=lEwq6BnCgV53p5 WGsgjHYZ3ypNTcX1Vbcgz0YSkr+1/7gIhDMqnHG7NbqwR7kr7tONSdUCCM1+Q31JRVRMb6ppjAT02 qUWELIecrHqOq0C7HrbXTH7BwdYwsXXVyn9trEN/DkQbRtQBj+tEaczeWf+bYIgzb4nB3Dhx3y5gd +FZ+mwCTYXm5cCNCh0uA1isIhkkNlHF80Tgao8uyx6HiDGoItY9f+TtKP6awV6x+doC/mqJ9W9UhY 7e4lYDQdEXOgEBL2CxjAFSVn1KH3o4Xl2XpKkxpXvfBD54I6/jR+12Uz6cO58lDavcsZ5KTN/5nxg Z18V60mWtqKEMI86EecQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hHN-0006Sw-Aw; Fri, 13 Sep 2019 08:50:09 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hDz-0002oB-AG for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:41 +0000 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gstb001935; Fri, 13 Sep 2019 04:46:37 -0400 Received: from nam01-bn3-obe.outbound.protection.outlook.com (mail-bn3nam01lp2059.outbound.protection.outlook.com [104.47.33.59]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdfsa86-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:36 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=POfPkCTzfnBqkTgIS+LIJzC0/5jAJH3lnhFtSgpJaZ0p8UbYD0u9t5cWcEQ6zR9CpCQnmhDgTqTRbRFOXLKrBJZj2uvJtDZXXeIydiRMPrI/hDndJD32Ia4sN7xuPRdnG5Vq3/uuVL8E0JxchyZ0slj9BmFWoy6o3EbiCULJi11cx4QPmhoMr3VmaQOa8wBYdBUNCsfbyi+9DQKs9Yu6lhmjHJevkAnLzoL0ZSoxqflakP0ZyaS/wHKFcF121XNx6dKkju2YFqXdC/DlLRdKjqCdzIMsLH2TdlS80t38zVlA8MT7uhZY5AOEZ/Keg1DGI53Z/hu5HX3nUn3IRKSUdg== 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-SenderADCheck; bh=/Y3GGrVxMcz7PgGfQOjRf7e5LOWNqoiJ34Iy5XvCBqM=; b=kJJUX4gVQKnI1CxeAtxYE7JAkGsE/FUeuy67j3pdqtY5YPbayF+XcYnhKUVnmwAqYZp0KrJYzJwEY/zbA23ZnJqX+SuMKBoHKkzZe13grludony72xGJuLCQK59i/GuUjuTt9UxAFpr0kiAnn+PdqbnEsXLLmyTa3ZArHvf6uoMkAYg58joDDOVFGExIn7GT/C5l7nwMhYzs9rFX4LduA86lYEow1iPpTHK+6unF5t/d1X9j4/NuYdenBgVFGDGUYs4g/6GQ4No8eFsPM6C4HVzGgoSfUK89692a1ETlkhH6PP5F2W99lXEOjJCjFRQ8LBnhzo+YAQzpzlUvdrL0Dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/Y3GGrVxMcz7PgGfQOjRf7e5LOWNqoiJ34Iy5XvCBqM=; b=7i2mRiJqkAEMHbnOGwKQQYIvR0RVuGd3lz32BzlFaLfVLMBWYZNyO4J3jx2n95pW4aUyCbiePKtYHBmlKyEwbikJMtPq/5hHFlV1KnpTFo/ESqiFj0j+ZlswxL0/H5wiblo6Ixw22YcvV6ZQPEpG/SUDc+TO1s7BX+1lM/eU4Wo= Received: from BN6PR03CA0104.namprd03.prod.outlook.com (2603:10b6:404:10::18) by BN6PR03MB2625.namprd03.prod.outlook.com (2603:10b6:404:58::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.15; Fri, 13 Sep 2019 08:46:34 +0000 Received: from CY1NAM02FT055.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::209) by BN6PR03CA0104.outlook.office365.com (2603:10b6:404:10::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.15 via Frontend Transport; Fri, 13 Sep 2019 08:46:34 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT055.mail.protection.outlook.com (10.152.74.80) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:34 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kSYS030701 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:28 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:33 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 09/15] spi: introduce `delay` field for `spi_transfer` + spi_transfer_exec() Date: Fri, 13 Sep 2019 14:45:44 +0300 Message-ID: <20190913114550.956-10-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(346002)(376002)(39860400002)(396003)(189003)(199004)(2616005)(8936002)(2870700001)(7636002)(110136005)(1076003)(50226002)(54906003)(106002)(7416002)(356004)(305945005)(478600001)(8676002)(2906002)(7696005)(86362001)(6666004)(2201001)(476003)(126002)(44832011)(36756003)(26005)(446003)(4326008)(47776003)(246002)(70206006)(76176011)(70586007)(316002)(48376002)(5660300002)(107886003)(486006)(426003)(336012)(50466002)(51416003)(186003)(11346002)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2625; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c0529882-af6e-498b-1bc3-08d73826e1b9 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328); SRVR:BN6PR03MB2625; X-MS-TrafficTypeDiagnostic: BN6PR03MB2625: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: Byzk5bfCKwdXmhFwyaU7nM59K3yxS4+f9qdL8jCOsUR++UKAd7VwI7XJiJknW4LwVAeUeHAdA3TMvaVOpjL8gEIPolnIxJFYBEAlOe3hrC/wkuXbYtLb4FJCMBsfKcKoNM4p+POj28jIgxPZsI4X0RbKYkNh436OX0BiBabl3oZ97SBQ1yALyyil6CoYJFUPzEpMjgBufoTm7q2qOWQM18YShShqQGqMBiuRsocIhsu1n89hC/MP5svMpimYgTvYOXhzM1z9AhOQTb+wKuDzRjMuxDp47y1RxZ/BvGx1uGWNZRoJlqmPOaCyCnDhe9p2/uN/+QY63BsgrzoSFos/kUNanw7RTRLcN1t8JBG/W8qWxIt5V0R0bptl8ShNBivJTMSDZ6PzmX0w7Kr2Ds3vT1Ly2jPRbXxHRxWN0S63+1A= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:34.1815 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c0529882-af6e-498b-1bc3-08d73826e1b9 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2625 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014639_731295_98E4E79D X-CRM114-Status: GOOD ( 15.26 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The change introduces the `delay` field to the `spi_transfer` struct as an `struct spi_delay` type. This intends to eventually replace `delay_usecs`. But, since there are many users of `delay_usecs`, this needs some intermediate work. A helper called `spi_transfer_delay()` is also added, which maintains backwards compatibility with `delay_usecs`, by assigning the value to `delay` if non-zero. This should maintain backwards compatibility with current users of `udelay_usecs`. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi.c | 6 +++--- include/linux/spi/spi.h | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index ba8731b77753..c55d55acbbb0 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1238,8 +1238,7 @@ static int spi_transfer_one_message(struct spi_controller *ctlr, if (msg->status != -EINPROGRESS) goto out; - if (xfer->delay_usecs) - _spi_transfer_delay_ns(xfer->delay_usecs * 1000); + spi_transfer_delay(xfer); if (xfer->cs_change) { if (list_is_last(&xfer->transfer_list, @@ -2904,10 +2903,11 @@ struct spi_replaced_transfers *spi_replace_transfers( /* add to list */ list_add(&xfer->transfer_list, rxfer->replaced_after); - /* clear cs_change and delay_usecs for all but the last */ + /* clear cs_change and delay for all but the last */ if (i) { xfer->cs_change = false; xfer->delay_usecs = 0; + xfer->delay.value = 0; } } diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index e7ec0be16a82..c7f90a0129be 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -754,6 +754,9 @@ extern void spi_res_release(struct spi_controller *ctlr, * @cs_change: affects chipselect after this transfer completes * @cs_change_delay: delay between cs deassert and assert when * @cs_change is set and @spi_transfer is not the last in @spi_message + * @delay: delay to be introduced after this transfer before + * (optionally) changing the chipselect status, then starting + * the next transfer or completing this @spi_message. * @delay_usecs: microseconds to delay after this transfer before * (optionally) changing the chipselect status, then starting * the next transfer or completing this @spi_message. @@ -843,6 +846,7 @@ struct spi_transfer { #define SPI_NBITS_QUAD 0x04 /* 4bits transfer */ u8 bits_per_word; u16 delay_usecs; + struct spi_delay delay; struct spi_delay cs_change_delay; struct spi_delay word_delay; u32 speed_hz; @@ -942,6 +946,20 @@ spi_transfer_del(struct spi_transfer *t) list_del(&t->transfer_list); } +static inline int +spi_transfer_delay(struct spi_transfer *t) +{ + struct spi_delay d; + + if (t->delay_usecs) { + d.value = t->delay_usecs; + d.unit = SPI_DELAY_UNIT_USECS; + return spi_delay_exec(&d, NULL); + } + + return spi_delay_exec(&t->delay, t); +} + /** * spi_message_init_with_transfers - Initialize spi_message and append transfers * @m: spi_message to be initialized From patchwork Fri Sep 13 11:45:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144191 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6963714DB for ; Fri, 13 Sep 2019 08:50:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 44D8A208C0 for ; Fri, 13 Sep 2019 08:50:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hJDKbgZP"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="iJD2IC2R" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 44D8A208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NixhXcu7DwvzPTaeCHSzyrEFmvRIMGtfTsCJYLWbvwg=; b=hJDKbgZPKgqiXf Zc4Fbrw9Mg+xA47rBaHscqlxXjf6qzdSind1lLFj2iXlXSHaqRhEvc7ncQiK7gjCXeVIP+fpuaeS2 6amq1TyTCMWLeGSNO7PCrJV2ZNPcf8dAgJgYVYhL59IBJ8urDKd0WgfYbM/inQYgCPbmSfPFrKm9e GtVb8n9hW5xifLbNQOhzA1KOBnAc+vky9KPvg3NbBdRltBm8KcV+ra8u/P0UUeIAhDCHtK+5jm9+G 97m7MBH5f+a6fLjov2RePn2T8//xkppKTZA+D877eyrZJHz1ZZNuMW7i/7q3TY/Fz6uOSjM16yQrb P5BdJP3hoML+dGjx7FVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hHj-0007Mx-TM; Fri, 13 Sep 2019 08:50:31 +0000 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hE1-0002pN-Bu for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:44 +0000 Received: from pps.filterd (m0167091.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8giVD017273; Fri, 13 Sep 2019 04:46:39 -0400 Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2050.outbound.protection.outlook.com [104.47.36.50]) by mx0b-00128a01.pphosted.com with ESMTP id 2uytd1h9b5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bF9QV9QMJ8UfyTzFcn9HlErtTaL3SEKGhqjhHSAiPtOlGQkxwTrBe8uVMcJWj3mDyYyQbej9XH+96P1DDuQ0FMTXnhbpPOihnap5y6VoHXbJpIoygHDIsiv/PsQss8iVHERfsvj5OSS1BLcRQ/k2VGkpHsHhrhhJsHjnnqd5jTp2VN9pdGQndWADDIQay/gfGbJ3wOuMx/md1Cg/bLAn+hycKl1efP5XKRN1XgLOrXMeQsofN1yXGXY4PMEo71XtjimsF83D+x75BIU/Kdb2H+GOA10leiS5gjMUE1KkT2e4u1x63UD+vcrMkD1DPo4xGnGcLn/5uUqcj/bT5ii1mQ== 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-SenderADCheck; bh=BpKiYYuwdSMIyBrVg+DpNvJAloR/Z2RTpZzqG3TLjyo=; b=DkLW+G4z25t2UeuTVV5wO8ezs98BvFvaXzC8hTN6XDcidIUCFBERd9TBKVfWjeTVrHKeJSYZwsfZ2ogy4wmw1tgJDx1sR3YvtSJJF13pjBz+O2fS7i5jSsKmR8Klzm/Q2aU4bMl+q2ICu97kZodfkUO/BiqK9kGS+QE4B79iUnKukuu4Z1ycGSPl74f4/TLShNZ6XfFwLUEhB6aJ1na0nqRkN2kJHb8/bxChBWA0rO/V4G4T0O5Sk7kIheGDnZCXG4WJb4hTuD8lISVgksKXJyPzYdABu+iwj8kF6kJ+1H+T/07M6jvzLZ5RGJqTjQyEtCTEt0cB4gCNmb2Du93aNg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BpKiYYuwdSMIyBrVg+DpNvJAloR/Z2RTpZzqG3TLjyo=; b=iJD2IC2RjRJR7ecwWM87FKF36dBNlv3sYPoSkRSk00P9xa4FQBZDyFqhgcD+kxXDIlBNKILtR0HGay4s2horWGELKAmukeNlDq8FNYcQHLKnXfaDWulRtFMjY65jP/5MPOeLEa43Ko8nrGlrubxTIJMc88EOsl6TjAlNZr77K7E= Received: from CH2PR03CA0004.namprd03.prod.outlook.com (2603:10b6:610:59::14) by BYAPR03MB4869.namprd03.prod.outlook.com (2603:10b6:a03:139::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.15; Fri, 13 Sep 2019 08:46:37 +0000 Received: from SN1NAM02FT019.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::204) by CH2PR03CA0004.outlook.office365.com (2603:10b6:610:59::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.13 via Frontend Transport; Fri, 13 Sep 2019 08:46:37 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by SN1NAM02FT019.mail.protection.outlook.com (10.152.72.130) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:36 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kVhA030711 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:31 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:35 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 10/15] spi: use new `spi_transfer_delay` helper where straightforward Date: Fri, 13 Sep 2019 14:45:45 +0300 Message-ID: <20190913114550.956-11-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(136003)(396003)(39860400002)(376002)(346002)(199004)(189003)(2616005)(305945005)(8676002)(336012)(50226002)(70586007)(186003)(86362001)(107886003)(110136005)(54906003)(446003)(106002)(5660300002)(478600001)(316002)(7636002)(7416002)(246002)(14444005)(6666004)(356004)(44832011)(36756003)(2870700001)(70206006)(2906002)(26005)(2201001)(486006)(48376002)(126002)(476003)(4326008)(50466002)(11346002)(7696005)(76176011)(426003)(8936002)(47776003)(1076003)(51416003)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4869; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3aa3495a-1bf0-4d6f-4f1d-08d73826e361 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328); SRVR:BYAPR03MB4869; X-MS-TrafficTypeDiagnostic: BYAPR03MB4869: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:983; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 2RMcB2cx2er62QduEC8VmS2E1rrrqxwDUPB2H+OLcsgyjeX5zUc6cl0yJa0RHqhEFoxsSv9eSDtbICjvA1ZVMwOrQWdDgyVgXv4yC+c1oi8/WNeF97NzVGxZtcpHXSQv0kcKVJVluR55oe9byl68up0RBrcu5rde9mS1usF/0WJDukaCWQpi/YobWTkoPROJQDE346Rv1Ywl8BY41H/P7NYYLvGHPjb+BnBady2YbLuq2eg0mOu3uwRkij0AMFrOmYRELmAQIL9fh4SMDP86y/G6AMthHaoUukSTZ7/Z50/Kzhzx7QirHNnbSGxwda5Xr6hoGEWIIVkkdeWPrEqyDKGy3G/4fXXpWIlCEFwkQSbLhj93s43nWPRPmXiOM1+jsOUGVAd5pWvOIaJ7pNPIb6hQ4eKrda389cmx1A6Xiek= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:36.9661 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3aa3495a-1bf0-4d6f-4f1d-08d73826e361 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4869 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 impostorscore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 lowpriorityscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014642_264232_1822186D X-CRM114-Status: GOOD ( 14.08 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.139.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org For many places in the spi drivers, using the new `spi_transfer_delay` helper is straightforward. It's just replacing: ``` if (t->delay_usecs) udelay(t->delay_usecs); ``` with `spi_transfer_delay(t)` which handles both `delay_usecs` and the new `delay` field. This change replaces in all places (in the spi drivers) where this change is simple. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-atmel.c | 3 +-- drivers/spi/spi-bcm63xx-hsspi.c | 3 +-- drivers/spi/spi-cavium.c | 3 +-- drivers/spi/spi-fsl-dspi.c | 3 +-- drivers/spi/spi-fsl-espi.c | 3 +-- drivers/spi/spi-fsl-spi.c | 3 +-- drivers/spi/spi-mpc512x-psc.c | 3 +-- drivers/spi/spi-mpc52xx-psc.c | 3 +-- drivers/spi/spi-omap-100k.c | 3 +-- drivers/spi/spi-pl022.c | 25 +++++++++++-------------- drivers/spi/spi-sc18is602.c | 3 +-- drivers/spi/spi-sh-hspi.c | 3 +-- drivers/spi/spi-tegra20-sflash.c | 2 +- drivers/spi/spi-topcliff-pch.c | 7 +------ drivers/spi/spi-txx9.c | 3 +-- drivers/spi/spi-xcomm.c | 3 +-- 16 files changed, 26 insertions(+), 47 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 009bb4fb5e5f..f51af930c7a4 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1389,8 +1389,7 @@ static int atmel_spi_one_transfer(struct spi_master *master, && as->use_pdc) atmel_spi_dma_unmap_xfer(master, xfer); - if (xfer->delay_usecs) - udelay(xfer->delay_usecs); + spi_transfer_delay(xfer); if (xfer->cs_change) { if (list_is_last(&xfer->transfer_list, diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c index 9a06ffdb73b8..d9f5c241e2aa 100644 --- a/drivers/spi/spi-bcm63xx-hsspi.c +++ b/drivers/spi/spi-bcm63xx-hsspi.c @@ -291,8 +291,7 @@ static int bcm63xx_hsspi_transfer_one(struct spi_master *master, msg->actual_length += t->len; - if (t->delay_usecs) - udelay(t->delay_usecs); + spi_transfer_delay(t); if (t->cs_change) bcm63xx_hsspi_set_cs(bs, spi->chip_select, false); diff --git a/drivers/spi/spi-cavium.c b/drivers/spi/spi-cavium.c index 5aaf21582cb5..db7f5f94c525 100644 --- a/drivers/spi/spi-cavium.c +++ b/drivers/spi/spi-cavium.c @@ -119,8 +119,7 @@ static int octeon_spi_do_transfer(struct octeon_spi *p, *rx_buf++ = (u8)v; } - if (xfer->delay_usecs) - udelay(xfer->delay_usecs); + spi_transfer_delay(xfer); return xfer->len; } diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 53335ccc98f6..0b761352c16a 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -752,8 +752,7 @@ static int dspi_transfer_one_message(struct spi_master *master, dspi->waitflags = 0; } - if (transfer->delay_usecs) - udelay(transfer->delay_usecs); + spi_transfer_delay(transfer); } out: diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index f20326714b9d..a3af12127c40 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -427,8 +427,7 @@ static int fsl_espi_trans(struct spi_message *m, struct spi_transfer *trans) ret = fsl_espi_bufs(spi, trans); - if (trans->delay_usecs) - udelay(trans->delay_usecs); + spi_transfer_delay(trans); return ret; } diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 1d9b33aa1a3b..9352b127d5b8 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c @@ -417,8 +417,7 @@ static int fsl_spi_do_one_msg(struct spi_master *master, } m->actual_length += t->len; - if (t->delay_usecs) - udelay(t->delay_usecs); + spi_transfer_delay(t); if (cs_change) { ndelay(nsecs); diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c index a337b842ae8c..329bbdd1f15f 100644 --- a/drivers/spi/spi-mpc512x-psc.c +++ b/drivers/spi/spi-mpc512x-psc.c @@ -311,8 +311,7 @@ static int mpc512x_psc_spi_msg_xfer(struct spi_master *master, break; m->actual_length += t->len; - if (t->delay_usecs) - udelay(t->delay_usecs); + spi_transfer_delay(t); if (cs_change) mpc512x_psc_spi_deactivate_cs(spi); diff --git a/drivers/spi/spi-mpc52xx-psc.c b/drivers/spi/spi-mpc52xx-psc.c index c7e478b9b586..dd79d7fd3687 100644 --- a/drivers/spi/spi-mpc52xx-psc.c +++ b/drivers/spi/spi-mpc52xx-psc.c @@ -234,8 +234,7 @@ static void mpc52xx_psc_spi_work(struct work_struct *work) break; m->actual_length += t->len; - if (t->delay_usecs) - udelay(t->delay_usecs); + spi_transfer_delay(t); if (cs_change) mpc52xx_psc_spi_deactivate_cs(spi); diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c index b955ca8796d2..eb5b51bd5126 100644 --- a/drivers/spi/spi-omap-100k.c +++ b/drivers/spi/spi-omap-100k.c @@ -321,8 +321,7 @@ static int omap1_spi100k_transfer_one_message(struct spi_master *master, } } - if (t->delay_usecs) - udelay(t->delay_usecs); + spi_transfer_delay(t); /* ignore the "leave it on after last xfer" hint */ diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 7fedea67159c..42cf800073e4 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -485,12 +485,11 @@ static void giveback(struct pl022 *pl022) struct spi_transfer, transfer_list); /* Delay if requested before any change in chip select */ - if (last_transfer->delay_usecs) - /* - * FIXME: This runs in interrupt context. - * Is this really smart? - */ - udelay(last_transfer->delay_usecs); + /* + * FIXME: This runs in interrupt context. + * Is this really smart? + */ + spi_transfer_delay(last_transfer); if (!last_transfer->cs_change) { struct spi_message *next_msg; @@ -1401,12 +1400,11 @@ static void pump_transfers(unsigned long data) previous = list_entry(transfer->transfer_list.prev, struct spi_transfer, transfer_list); - if (previous->delay_usecs) - /* - * FIXME: This runs in interrupt context. - * Is this really smart? - */ - udelay(previous->delay_usecs); + /* + * FIXME: This runs in interrupt context. + * Is this really smart? + */ + spi_transfer_delay(previous); /* Reselect chip select only if cs_change was requested */ if (previous->cs_change) @@ -1520,8 +1518,7 @@ static void do_polling_transfer(struct pl022 *pl022) previous = list_entry(transfer->transfer_list.prev, struct spi_transfer, transfer_list); - if (previous->delay_usecs) - udelay(previous->delay_usecs); + spi_transfer_delay(previous); if (previous->cs_change) pl022_cs_control(pl022, SSP_CHIP_SELECT); } else { diff --git a/drivers/spi/spi-sc18is602.c b/drivers/spi/spi-sc18is602.c index 11acddc83304..13cb992df712 100644 --- a/drivers/spi/spi-sc18is602.c +++ b/drivers/spi/spi-sc18is602.c @@ -211,8 +211,7 @@ static int sc18is602_transfer_one(struct spi_master *master, } status = 0; - if (t->delay_usecs) - udelay(t->delay_usecs); + spi_transfer_delay(t); } m->status = status; spi_finalize_current_message(master); diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c index 7f73f91d412a..4edad22c222e 100644 --- a/drivers/spi/spi-sh-hspi.c +++ b/drivers/spi/spi-sh-hspi.c @@ -190,8 +190,7 @@ static int hspi_transfer_one_message(struct spi_controller *ctlr, msg->actual_length += t->len; - if (t->delay_usecs) - udelay(t->delay_usecs); + spi_transfer_delay(t); if (cs_change) { ndelay(nsecs); diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index cd714a4f52c6..00593096cfed 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c @@ -344,7 +344,7 @@ static int tegra_sflash_transfer_one_message(struct spi_master *master, if (xfer->cs_change && xfer->delay_usecs) { tegra_sflash_writel(tsd, tsd->def_command_reg, SPI_COMMAND); - udelay(xfer->delay_usecs); + spi_transfer_delay(xfer); } } ret = 0; diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index f88cbb94ce12..645b086eece8 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c @@ -1229,12 +1229,7 @@ static void pch_spi_process_messages(struct work_struct *pwork) "%s:data->current_msg->actual_length=%d\n", __func__, data->current_msg->actual_length); - /* check for delay */ - if (data->cur_trans->delay_usecs) { - dev_dbg(&data->master->dev, "%s:delay in usec=%d\n", - __func__, data->cur_trans->delay_usecs); - udelay(data->cur_trans->delay_usecs); - } + spi_transfer_delay(data->cur_trans); spin_lock(&data->lock); diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c index 51759d3fd45f..65aa736783ae 100644 --- a/drivers/spi/spi-txx9.c +++ b/drivers/spi/spi-txx9.c @@ -248,8 +248,7 @@ static void txx9spi_work_one(struct txx9spi *c, struct spi_message *m) len -= count * wsize; } m->actual_length += t->len; - if (t->delay_usecs) - udelay(t->delay_usecs); + spi_transfer_delay(t); if (!cs_change) continue; diff --git a/drivers/spi/spi-xcomm.c b/drivers/spi/spi-xcomm.c index a3496c46cc1b..3aaae32b0384 100644 --- a/drivers/spi/spi-xcomm.c +++ b/drivers/spi/spi-xcomm.c @@ -188,8 +188,7 @@ static int spi_xcomm_transfer_one(struct spi_master *master, } status = 0; - if (t->delay_usecs) - udelay(t->delay_usecs); + spi_transfer_delay(t); is_first = false; } From patchwork Fri Sep 13 11:45:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144193 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 639B514DB for ; Fri, 13 Sep 2019 08:50:59 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 412DB208C0 for ; Fri, 13 Sep 2019 08:50:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rKR9hJ/G"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="ohR6I03u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 412DB208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0LrgVRJ+H1sGMGhg7LoBV8Yp3eysS4ec8Y1neC0nWwI=; b=rKR9hJ/GqzO4P3 E5HQaJfUPLucVnPW/vAqNz6J8salYrbU30EHSlfbBJ8XP95rf9p984GT5eqEUaliCBJX3n6pu7gjx Z4jghhhEGDP5Gf109qcJGpvw2Wl7agbeNXN055GFcERI0j9kh/+vVkXZU4B4TeHP37kZV5COEAPs+ elbiqMSzqmi+sn3scqowoMWWHlY5dh5FYFxUTBB8W8n1t8+n49DsyWcoXKncMPLvHUdsa46W9q7oo uaoJKVtOMiZN20pOYFudN8vZfIa8RMQ47If5iPcc0JF6a5zMzqzpQSYbkZQiUcRjxdFDaMzfuOevP +W5qj44sS8CGdmA343pA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hIA-0007p1-58; Fri, 13 Sep 2019 08:50:58 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hE3-0002rA-Om for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:46 +0000 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gdff001882; Fri, 13 Sep 2019 04:46:41 -0400 Received: from nam05-dm3-obe.outbound.protection.outlook.com (mail-dm3nam05lp2059.outbound.protection.outlook.com [104.47.49.59]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdfsa8b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kz00pCfBzxIKRhh+yvxtVr9DnveytKqdDDJ1pshj6u9PoipFPnigQJrcsj9rFhVjoF2+Cat6Q4TGspdn1dsDC1/yvNfDv7Vy4f+oQnt1janMaPdejKXsQdgfthLqBijpedBGhRmWQJemOPMEv/U4gvvLCUCCu2pWdpLRe7tn+8Qf3LokRDtlCntTTVw7oalIoVeG576h8yfhuWdoAzQRY8KD1V5k6/CRUAfwhaODEDCnx55uvXVS40RPXa2h09Dlew606iTfwABICV/IfPa6XJUIVtz1mPUNVDHWJPMUAAq6pWOjUXWf/MpdV5Qf/Yq3CBzs0R464LqVnrjHEha+uQ== 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-SenderADCheck; bh=JAzmWXSpswo0ycbRrXhqzNN7339/xyAx7A2OJPftb4I=; b=EZD9CqlFMH2V8Mo4uSaNeK5yyiQFbNbay/DR20nQOU8kRjJOA4WnvV7falUlltQgrCjjIa5A8rrPsUgyk1qaGFwrX5lPcy5xP+C8wwuArKMZWeBTRF7HDS5hCRSglyjUew7M48corHBnKV70bIM5pC+HWHwGEYgMhQjRTKB+hKp+rhm899Dv5ff5zBfUW4EyWHU3alRxdYBaJGJGQYQvJ0n/lDnbkG9OA1c06XurobET6mfLNo+JzT0mbNoHZtu5taOo28L8v2uMR///9t7gz+PI+QOGy5D2bE+WISRu7OzXdUzq9MuYjj5bcxJJoR0oMAExIWhXwEtY2thkorKVSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JAzmWXSpswo0ycbRrXhqzNN7339/xyAx7A2OJPftb4I=; b=ohR6I03uTzCoOdKQ2ggFWR3EQ2+e42A/Um1IDTiKvjgLKjUl8gH1VCgFj1Cu+SW2Wv2Ub7JmJ5qZRe6mM6ivncDvT0mAcY5kFBTBPF2zxtLTTjLE04w8x0vYDPYQa4+lFNkHxelsohFbjgT0zEH9MEByz0FH+0L/2mz5JEJ6cr0= Received: from DM6PR03CA0036.namprd03.prod.outlook.com (2603:10b6:5:40::49) by BN7PR03MB3907.namprd03.prod.outlook.com (2603:10b6:408:2d::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.15; Fri, 13 Sep 2019 08:46:39 +0000 Received: from SN1NAM02FT060.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::200) by DM6PR03CA0036.outlook.office365.com (2603:10b6:5:40::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2157.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:39 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by SN1NAM02FT060.mail.protection.outlook.com (10.152.72.192) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:39 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kYFQ030721 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:34 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:38 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 11/15] spi: tegra114: use `spi_transfer_delay` helper Date: Fri, 13 Sep 2019 14:45:46 +0300 Message-ID: <20190913114550.956-12-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(346002)(39860400002)(136003)(376002)(189003)(199004)(4326008)(305945005)(5660300002)(47776003)(2201001)(7636002)(106002)(48376002)(356004)(7416002)(70586007)(26005)(486006)(70206006)(6666004)(44832011)(478600001)(54906003)(2616005)(2906002)(316002)(476003)(126002)(36756003)(336012)(2870700001)(50466002)(186003)(110136005)(8936002)(11346002)(86362001)(246002)(50226002)(1076003)(8676002)(51416003)(7696005)(107886003)(426003)(446003)(76176011)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR03MB3907; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c6f280a6-e6a3-4f1a-24ce-08d73826e4d5 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:BN7PR03MB3907; X-MS-TrafficTypeDiagnostic: BN7PR03MB3907: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:751; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: egxlt7syyxLSegU9uS2TtOR/KUiMy5fQW+9sK7JXvAvEPZLdgOCzUpMefTCVE/Pz5CBXRw1iaMAh7+acYIfDsdmws5y9xXo8vNM1Os7sZ8mruTcqba/ZmIU2edzUl0m8M/WmtSaI3t+MUdAw0XR0UTkv8xze2J3QiOZn691T1LajExNsrkdJ02w7Na371mOGrTgXI6T0vmRZBrSAG9bO4XteQ+tUFtIAffvbDVi7GIU4/peDAYdcvWhBqylw2wJS9UkEbNt5XfQjkN2ovDjdfwZxLO0jwcnbNcZx3V+gY433S5cEuEwynYpd+7BFNj4hKRUfIx+5G7WECuSjTr06YrtGutbw3QoImbx6HVppXQDhoXp5RptvUly4T6G72rRQALe/d+R4QJzADuQimXoi0s/8Ke7n2p4l19EhC+sMcVU= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:39.4042 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c6f280a6-e6a3-4f1a-24ce-08d73826e4d5 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR03MB3907 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014644_792169_9FFD54CD X-CRM114-Status: GOOD ( 14.45 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The tegra114 driver has a weird/separate `tegra_spi_transfer_delay()` function that does 2 delays: one mdelay() and one udelay(). This was introduced via commit f4fade12d506e14867a2b0a5e2f7aaf227297d8b ("spi/tegra114: Correct support for cs_change"). There doesn't seem to be a mention in that commit message to suggest a specific need/use-case for having the 2 delay calls. For the most part, udelay() should be sufficient. This change replaces it with the new `spi_transfer_delay()`, which should do the same thing. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-tegra114.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index 39374c2edcf3..5ac2ceb234fc 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -984,17 +984,6 @@ static int tegra_spi_setup(struct spi_device *spi) return 0; } -static void tegra_spi_transfer_delay(int delay) -{ - if (!delay) - return; - - if (delay >= 1000) - mdelay(delay / 1000); - - udelay(delay % 1000); -} - static void tegra_spi_transfer_end(struct spi_device *spi) { struct tegra_spi_data *tspi = spi_master_get_devdata(spi->master); @@ -1098,7 +1087,7 @@ static int tegra_spi_transfer_one_message(struct spi_master *master, complete_xfer: if (ret < 0 || skip) { tegra_spi_transfer_end(spi); - tegra_spi_transfer_delay(xfer->delay_usecs); + spi_transfer_delay(xfer); goto exit; } else if (list_is_last(&xfer->transfer_list, &msg->transfers)) { @@ -1106,11 +1095,11 @@ static int tegra_spi_transfer_one_message(struct spi_master *master, tspi->cs_control = spi; else { tegra_spi_transfer_end(spi); - tegra_spi_transfer_delay(xfer->delay_usecs); + spi_transfer_delay(xfer); } } else if (xfer->cs_change) { tegra_spi_transfer_end(spi); - tegra_spi_transfer_delay(xfer->delay_usecs); + spi_transfer_delay(xfer); } } From patchwork Fri Sep 13 11:45:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144195 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C837F14DB for ; Fri, 13 Sep 2019 08:51:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A59FB208C0 for ; Fri, 13 Sep 2019 08:51:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ajl4Lb++"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="CLnDKCHK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A59FB208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9lnPKUAY2K2m2T1g0h2Ls01jiAKBmM84xh+xpr3LKuw=; b=ajl4Lb++ed2rOr mf/1MOf9L3PSn/DvrKRxv85Xs6toSHpcpqNoV9J1jJwt56DRTmXi99UMD4JnnRg/WfgTmGEJkrwgD lDDxUwGanX0m1CWLFeA9WPkaM3mVhHvBisvp3Xfj4WPQOMLgW/7lTML0JKEfPUVdQBjKYp2Tiqr3B qJXLmmgGmaKNUX+8mlWVLAuWSOTyHP/vq+a33QmvxKwArY6KyHMjdRa3AurFULCuQSfPrA16uRmlk ncz/d1eZ0i1M2MHVlnWWw9ag4qIP4rjCv/UQhGwGoBzJjAFEy7iPT3VB226IrMAXhfda5EzLZKI50 1XtuqYDkv+IFWKagij4w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hIm-0008Dc-DF; Fri, 13 Sep 2019 08:51:36 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hE6-0002sr-Fb for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:48 +0000 Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gaUD015969; Fri, 13 Sep 2019 04:46:44 -0400 Received: from nam01-by2-obe.outbound.protection.outlook.com (mail-by2nam01lp2058.outbound.protection.outlook.com [104.47.34.58]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdksa6u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nU7wHEOcRG4BSrs+Fd8uhS16hBZ2h1bd19B7ZNh00g63oQIw9eOCR9esJSD51kRHG52xSBeYqv4yi6w5raAicNrYR3muD+seccDeSPRBYV3XYuND3l+G8QHm8OQta/c7W3otOhbPozMSPeu3R8n2DwodPUNV5041OO0MnDRd09+68vl1PQ6p97qK9hCLzDOwINJrhaVBuyjOrJRxcUTE6smvGkhO0WL6vqc19bnBLGCiU5P4Iz8Ey7z4kIy8OP1Aho4fa/ZiHNIFaaa2TRHZkDwQBQJMLGyjPtAgANHqU1Vk8Ji2fvjxyvkPrmAoK2QQ/Ish97D/WlLboZ/OGq3TjA== 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-SenderADCheck; bh=8eZVsTNwzDgCxa0wjOHr/PorZMO2qAzcIXvyuqXf5D8=; b=g35Niy49efBTyFAqgezP7MYvp42HiC8lPlDVdxmSMgMFQgS0G2RsCTRFDN32ULwt7N7TThvES2+BAhmOWGi9Pzph3VH4x3Ni9VDyfSHT5LUm5+UI34426v2GVaDKY4KsQsQt0SeLKsOkKvgNhcbDcIhVkcrA5/C3lJCgmm69jIa+uBQcZN5OeCQEwU/BegBkmJ4Njh+45d2uKoRspJFucU8S6HkT/yICpKNgihBVHRozbnPhlqQPipE26OPemdLk1epCZsKQeAJPDc1rHIejTMV0BjKtaqVFEdKm2x3LMEuCbhT7KeGgvguInu3kOZq9uD7Z8lEEEm0GWvZJUT1/AQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8eZVsTNwzDgCxa0wjOHr/PorZMO2qAzcIXvyuqXf5D8=; b=CLnDKCHKy+QfVgosMCioGEr9HTSJx4ujbab6aGzedBrMSvpQC0u6anQ7tdKVKQg7Yz7lo3hfCyqlpfj6WPDk2G0kwzn83hWwhUfQpkO2R01DhxYDoSR0yETQlu+L4VhItrUovsUjj7yE4kLqHplgpyMgjbjggvTBLjL3He517k4= Received: from BN3PR03CA0100.namprd03.prod.outlook.com (2603:10b6:400:4::18) by BYAPR03MB3799.namprd03.prod.outlook.com (2603:10b6:a03:6f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.15; Fri, 13 Sep 2019 08:46:43 +0000 Received: from CY1NAM02FT036.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::203) by BN3PR03CA0100.outlook.office365.com (2603:10b6:400:4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.13 via Frontend Transport; Fri, 13 Sep 2019 08:46:42 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT036.mail.protection.outlook.com (10.152.75.124) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:42 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kbhW030732 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:37 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:41 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 12/15] spi: spi-loopback-test: use new `delay` field Date: Fri, 13 Sep 2019 14:45:47 +0300 Message-ID: <20190913114550.956-13-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39860400002)(346002)(136003)(396003)(199004)(189003)(54906003)(426003)(446003)(356004)(50226002)(86362001)(44832011)(476003)(486006)(2870700001)(70206006)(51416003)(11346002)(7696005)(7636002)(126002)(8936002)(70586007)(107886003)(305945005)(8676002)(246002)(76176011)(2616005)(478600001)(186003)(36756003)(2201001)(7416002)(2906002)(316002)(110136005)(48376002)(4326008)(26005)(5660300002)(1076003)(106002)(50466002)(47776003)(336012)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB3799; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 492ce2f4-6f95-4897-0d66-08d73826e6a8 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328); SRVR:BYAPR03MB3799; X-MS-TrafficTypeDiagnostic: BYAPR03MB3799: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: aRPsKEtJCzprUENgjeZBi73UwzYkamBAcK5VhMKCTRYg0QmGY6e7fpUC5P8aUtiBOWl0ShdDdoavlnCRiRUmQJqfB/LcUFT84FYkT0MizdDn2niN3SstaWvvfUwpazdF0Jw5vLQe1t2qCp83wt1AEQHKZ8Z4+I4EYPLySy2Jm5sRtU8qrEQTLS2yWioeLrIzFjJDWFqnMoX4Ej+xk03yrgVKHQ2dByLLNtRQ97S2LKL2m/5TlWCbJebf1nHv9s4Q6NMYvJThXXulY4FKHDgbroED9uRK8RIFlzJlkRkcYbgJ5vqjLMTmJ8FI1J3fXkucnyHmVHcwdFEDFHFqPPZPv0bP4eW4jk/aUkpRh3vMXGusmmoEhQ1axGwc5fe1TqrUUriik9O5/N+ogY0jS6sqdNfJ8gq0kimIxZ/hPR0Wqjs= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:42.4579 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 492ce2f4-6f95-4897-0d66-08d73826e6a8 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB3799 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 mlxlogscore=937 spamscore=0 suspectscore=0 malwarescore=0 clxscore=1015 impostorscore=0 mlxscore=0 phishscore=0 adultscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014646_870754_E8875327 X-CRM114-Status: GOOD ( 11.56 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This change replaces the use of the `delay_usecs` field with the new `delay` field. The code/test still uses micro-seconds, but they are now configured and used via the `struct spi_delay` format of the `delay` field. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-loopback-test.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c index 6f18d4952767..b6d79cd156fb 100644 --- a/drivers/spi/spi-loopback-test.c +++ b/drivers/spi/spi-loopback-test.c @@ -298,12 +298,18 @@ static struct spi_test spi_tests[] = { { .tx_buf = TX(0), .rx_buf = RX(0), - .delay_usecs = 1000, + .delay = { + .value = 1000, + .unit = SPI_DELAY_UNIT_USECS, + }, }, { .tx_buf = TX(0), .rx_buf = RX(0), - .delay_usecs = 1000, + .delay = { + .value = 1000, + .unit = SPI_DELAY_UNIT_USECS, + }, }, }, }, @@ -537,7 +543,7 @@ static int spi_test_check_elapsed_time(struct spi_device *spi, unsigned long long nbits = (unsigned long long)BITS_PER_BYTE * xfer->len; - delay_usecs += xfer->delay_usecs; + delay_usecs += xfer->delay.value; if (!xfer->speed_hz) continue; estimated_time += div_u64(nbits * NSEC_PER_SEC, xfer->speed_hz); From patchwork Fri Sep 13 11:45:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144197 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F272914DB for ; Fri, 13 Sep 2019 08:52:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CFBC8208C0 for ; Fri, 13 Sep 2019 08:52:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="tRV5/OP0"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="qtgkwIBC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFBC8208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2ym4DKwrpR/+sfpQmiD/MNz4uu2JQgq4lE9o/VNAcMk=; b=tRV5/OP0yyOcrL AFiE+NN1wd6GG+XoYnI/ccDpYg5915hlNnNpVlQmHu+P/4rSMB2kHIAYIwjMzyEONvpl68k1Zh8Fn eDKAsEKdMKv4Cb9jpkhPqKJu4oaGty9Rdmr6lHxZBjx1Gm4mgvFtg5TSTfMn3shyKdorF4AHtXyUK xezMaAd0EJsD5S92JOzT5uU0DaSLg61v5tTu84bon83kBkjuA1N5D0Cy3mg0UVCFlycb3b4SL/qRx aTgceGyRud9wq/CxfYEUbutC2sVS4ySNkVGgDctgQ5TNbPsOswULhWSh8wby/wYYqDekbLWrNw1e3 9AmqTn5y9UaO20GA9XpA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hJm-0000V8-TJ; Fri, 13 Sep 2019 08:52:39 +0000 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hEA-0002uF-Pt for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:52 +0000 Received: from pps.filterd (m0167090.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gi83020152; Fri, 13 Sep 2019 04:46:48 -0400 Received: from nam03-co1-obe.outbound.protection.outlook.com (mail-co1nam03lp2053.outbound.protection.outlook.com [104.47.40.53]) by mx0b-00128a01.pphosted.com with ESMTP id 2uytcwh99c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:48 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AdEhegvscTd2BBpXm+maRW5UG0LbSHxbBNVmeMHaXrjj297MbS9AWYFNdODc4TbKKXsxJAn2IzeDek24HAD+jgiCxzCtHN9AqlfwpMmtidKnxFEAJUl/dztYksz5siSM8Kj3HGBtgom4OwWARbvD8YHEQenqH87oKxf+J1Ly6X1q3Vxep0Japi0TYdrFbD4QewH0yR3ioPW66WDOuvjrkpGhrHXHcoqLIlBCcIhgr188gv3ol+s90Yjof008+IH6+3kdHwRZxXMxC+wRUe4sw7gQ4kJA1ZbfWwQkyJqRuvtfVRn6hWfnIQ94jNZKhvMp1y1oRgm60QrxL//4BTW8wA== 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-SenderADCheck; bh=wcho7dNaBtNYW5hFLUgvhiw90bmxoe0Gvww+cecPTYg=; b=IS57/vUqLHpV4lIBXTuHoIETjd30FL+kJhbfcdtlLwe8+wTfs+4wPBxwE4zyYBjNhWOWVDnDP4eJE6/KW8Fcec09JiNrKB5QmnisjTXr88k+aplL4kE3yv0rNPzVH25pX+lbNw6dTuk261lT4Ov6FEScoZMdbVDJQdIlNnWRHMe/b2pTOHKun8ktmfO1OjCoTplj1H7Q1Sewj59yuci+zjP0g1ShnbPp2EZ4tx9pjJjb1bp9UKxsgy2dSr9SO11/p6Uw5OckXBitVlBH9jMRLvGclS/JrT/BDn9q+oZunNGMEVwR6/Vq6qcDgxIlGKfsJWB4jwDr9dmEerXWhExWnw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wcho7dNaBtNYW5hFLUgvhiw90bmxoe0Gvww+cecPTYg=; b=qtgkwIBCaZLnrOLIeNigt1ExnpadBNslgEqreFsXUjbxBPQ25bhnZwehknl5kFR8jVTf/DTJokkOCz07K6BirQFoaSC/vj1dKFx0h1Ya8DainG8uVRowe1BKIyPSQabRLumVj/V1mZy7qJIIHjMdoq/ptGSrgzILDanamVCfPk0= Received: from CH2PR03CA0004.namprd03.prod.outlook.com (2603:10b6:610:59::14) by MN2PR03MB4877.namprd03.prod.outlook.com (2603:10b6:208:aa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17; Fri, 13 Sep 2019 08:46:45 +0000 Received: from CY1NAM02FT048.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::202) by CH2PR03CA0004.outlook.office365.com (2603:10b6:610:59::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2263.13 via Frontend Transport; Fri, 13 Sep 2019 08:46:45 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT048.mail.protection.outlook.com (10.152.74.227) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:45 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kdtm030741 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:39 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:44 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 13/15] spi: spidev: use new `delay` field for spi transfers Date: Fri, 13 Sep 2019 14:45:48 +0300 Message-ID: <20190913114550.956-14-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(136003)(346002)(376002)(396003)(189003)(199004)(1076003)(5660300002)(11346002)(446003)(107886003)(336012)(50466002)(2616005)(26005)(7696005)(76176011)(305945005)(51416003)(8936002)(36756003)(7636002)(50226002)(14444005)(7416002)(2906002)(186003)(426003)(4326008)(2870700001)(44832011)(8676002)(126002)(110136005)(246002)(106002)(2201001)(70206006)(70586007)(486006)(478600001)(47776003)(316002)(476003)(48376002)(356004)(86362001)(54906003)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR03MB4877; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ed6d18b-f31e-450f-ed63-08d73826e85c X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:MN2PR03MB4877; X-MS-TrafficTypeDiagnostic: MN2PR03MB4877: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: 2O8ulFftCn2n2WSMY4L5G3L+F1FkZhoTnzRNtDcALnw4uc3PlQ+YllsumUzig3VDQ2u/vfGTWvEYE25Nu3+gWUSOaakM1Eram6bNg99eZnfIlyOY8DrwKtFiKynEuAQTIGcN29tD4tP9XB/zUjBErX6GzftNtC3DtGib8RqlbwVj3XgMFLAT/rbZ/b0WZwL055Y9qi47clPH3ixWoEFqbQ8vyoGfHDCZRfA5BgrQHQro9d1qvDjaHRWAMoDC6ZweprGUOLBgc7DS7fgcGS3VmETG0K9aMZ7y2E0e0sn6GYSTcHuGHctap+A7W8Z1tqAaoZiiNKMRtxYSi8agtjwHO9Gv8fhJLPWYQbnsCAQUbY+8luTyXeWCpOAb8wxK5O4VB7XVnips8BT3xh7cc6uvlZtDewKOybFvj4H+vkKxVzE= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:45.3210 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ed6d18b-f31e-450f-ed63-08d73826e85c X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR03MB4877 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 phishscore=0 impostorscore=0 mlxlogscore=690 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014651_002117_2B548DAA X-CRM114-Status: GOOD ( 11.27 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.139.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The `delay` field has type `struct spi_delay`. This allows users to specify nano-second or clock-cycle delays (if needed). Converting to use `delay` is straightforward: it's just assigning the value to `delay.value` and hard-coding the `delay.unit` to `SPI_DELAY_UNIT_USECS`. This keeps the uapi for spidev un-changed. Changing it can be part of another changeset and discussion. Signed-off-by: Alexandru Ardelean --- drivers/spi/spidev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c index 495319c2fa11..6b6afd27f4a1 100644 --- a/drivers/spi/spidev.c +++ b/drivers/spi/spidev.c @@ -265,7 +265,8 @@ static int spidev_message(struct spidev_data *spidev, k_tmp->tx_nbits = u_tmp->tx_nbits; k_tmp->rx_nbits = u_tmp->rx_nbits; k_tmp->bits_per_word = u_tmp->bits_per_word; - k_tmp->delay_usecs = u_tmp->delay_usecs; + k_tmp->delay.value = u_tmp->delay_usecs; + k_tmp->delay.unit = SPI_DELAY_UNIT_USECS; k_tmp->speed_hz = u_tmp->speed_hz; k_tmp->word_delay.value = u_tmp->word_delay_usecs; k_tmp->word_delay.unit = SPI_DELAY_UNIT_USECS; From patchwork Fri Sep 13 11:45:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144199 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A05B81599 for ; Fri, 13 Sep 2019 08:53:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7BFD420CC7 for ; Fri, 13 Sep 2019 08:53:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="vBJ471PS"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="aHUq47n5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7BFD420CC7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GERmrz3529j6ChYwy5onGyYEM63atJCztWqQRBOCRJE=; b=vBJ471PS1y/GNl rISSz0rBlWAxnPJ59NNNY7Zb6iwaTWAJvaVQHfL/JkwbJemQfj8xciiRLD61uav5SiJwhtL019e4m hGMrMKsPeejuhW/bvoWgDu+jkdEeyiDXdtR4ddNwu+x3efGXsHoo+HXs6s0iBSHjdXK4p5i29H8LM LC2fO+6EcVghpxDuzS3QgbVmHYnpek53SvV99MRPRMJsOhvfZhNwrVL9NvIb5EhHoBZR3lCtL9cLi Un1ERjWIws1Be4nyXqQvqLATH2d+Vze3bX+7TObjYnIx0ves167avfMtQfh4odhWxg/13Vqo+XxrL rW3e4tRwoUfCeH7aoqMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hKS-0000l7-5D; Fri, 13 Sep 2019 08:53:20 +0000 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hED-0002wf-DU for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:55 +0000 Received: from pps.filterd (m0167091.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8giVE017273; Fri, 13 Sep 2019 04:46:51 -0400 Received: from nam05-co1-obe.outbound.protection.outlook.com (mail-co1nam05lp2053.outbound.protection.outlook.com [104.47.48.53]) by mx0b-00128a01.pphosted.com with ESMTP id 2uytd1h9bg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:51 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VBZWMGO8l2pm/51MaVABH2hP5W7pVShWY9pXXYEmkqk2H3o0P20vvZUfs76b5GPW+yNaHaKWge+R6ll9z3NRzOQ0AXLEarb+OJz88umLBeBgUnlCDobnq+XNHlGckqCJfZEQsDihTEgfzHiEeWRi26iNYmxO/2iCaaDnvj3HScrOqLk94YJYc/aJWGrkn1uPfI/hmhu3uTVrYXldep9JQd8ceSE/bnuPcCliDdKabdnU8vqFyCJ9TtLFVHL3eOzMOtOKpo/7H+imCkSZWR33NE9+hoViR+ejzWtNl+2IlSt39xq4LuwjI/JSSQs92rXD/Bx+GgfRJcfJyMyGYxqEzw== 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-SenderADCheck; bh=QXLRuMGRfkk1Xiwfr0phB9Pf8l/4nkEANrVfU4Zp1dA=; b=H+d+moC9lrZLhi/8IL6wApY91LTwb8/JuDbksnU4zQOln4k66QK52Q1whGnoev14QZgkEGRv1yZ78I47jPEMbYK9W9NSbyXS3EjF5ji6cJxkfbQLWsRc/Vh70iDOnUfdYDYj8goADUxVsEa6418ag0bqlwcsFW/i+wu0N2L50vrhDCRR2rQsF1kpm+DXYmnPZNZYz9FZ98Bpsxl7F418nGRU//FUjHKtJ+hg7Hqq6SyOr2VaLg5Mc56e+DyEDfgj3gkYg5y1ZVA2HMzTPXmBXFzADy5mj8SWAWWOQt9H44P/qMwf91jdQ5VFAqjokAC6NhwJoahJpJ171Xj9/Xs5ow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QXLRuMGRfkk1Xiwfr0phB9Pf8l/4nkEANrVfU4Zp1dA=; b=aHUq47n5Px4RKQrB/Qjf0UCc1//RS4hdhWNPZ7tyCje7qt83oCBGhH9/HtHzLgEbyT+vjXw8QRY6l4nkYgMrj/wAyKPsiVNx8mkwsemabgwBEV4whN5rN3rEmDIdOl09HH5wYAEalf8j6f+SdCtmVIzPPEmocvEqN6IR6vElLIM= Received: from DM6PR03CA0057.namprd03.prod.outlook.com (2603:10b6:5:100::34) by DM5PR03MB2699.namprd03.prod.outlook.com (2603:10b6:3:42::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17; Fri, 13 Sep 2019 08:46:48 +0000 Received: from CY1NAM02FT039.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::200) by DM6PR03CA0057.outlook.office365.com (2603:10b6:5:100::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.14 via Frontend Transport; Fri, 13 Sep 2019 08:46:48 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT039.mail.protection.outlook.com (10.152.75.140) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:47 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kgvi030749 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:42 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:46 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 14/15] spi: tegra114: change format for `spi_set_cs_timing()` function Date: Fri, 13 Sep 2019 14:45:49 +0300 Message-ID: <20190913114550.956-15-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(346002)(376002)(39860400002)(136003)(199004)(189003)(76176011)(478600001)(356004)(2870700001)(2906002)(70586007)(70206006)(50226002)(48376002)(8936002)(8676002)(5660300002)(51416003)(47776003)(7696005)(7636002)(305945005)(246002)(1076003)(186003)(7416002)(426003)(54906003)(110136005)(50466002)(446003)(26005)(106002)(126002)(107886003)(11346002)(476003)(2201001)(336012)(316002)(486006)(36756003)(44832011)(2616005)(4326008)(86362001)(81973001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2699; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ba8ff26b-05fb-43d8-69c9-08d73826e9ec X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:DM5PR03MB2699; X-MS-TrafficTypeDiagnostic: DM5PR03MB2699: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: BMOwiUHJ6lFKwFUh/wjkeNutWxfRs+D9IxdHltSEBwwOorhw0VRZJAHZYOAem8VQstEUwfTSUbrFTjA9Q7AAqp1UVTux6ZC/WWKjpD7lzMM/Pgd5LbqF1DoFIjD6htMhOxYm8Fz0VOhTPx7RTK8+6O1YVY2O86fr+oZY3d4F1NGe0CrYkbmmpnVEWI+0jBOM6w1YflteLEYIT60nYED8/+JSrP1Te+EgzeYRBL+dCBOj463PiL1i65GpRfXlS07eTv3gxri5+uE1KU7QYa/i/EMrch3kof3mjoiBlyOB3w4YGj0DYK8iVMLvM0C4TJHFUCsnLzP/AJ1HWeLWgew/x3nJYeOPdDGeafeulYaL2pcEDz/jH6OjEKC6tvPs59WQnQyDFCAsE8E/uiZHmmpIycyMtxWSf4f3DW/RkTqMB3o= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:47.9391 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba8ff26b-05fb-43d8-69c9-08d73826e9ec X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2699 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 spamscore=0 mlxscore=0 phishscore=0 impostorscore=0 suspectscore=2 mlxlogscore=999 clxscore=1015 lowpriorityscore=0 priorityscore=1501 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014653_732930_543ED2F0 X-CRM114-Status: GOOD ( 13.34 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.139.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The initial version of `spi_set_cs_timing()` was implemented with consideration only for clock-cycles as delay. For cases like `CS setup` time, it's sometimes needed that micro-seconds (or nano-seconds) are required, or sometimes even longer delays, for cases where the device needs a little longer to start transferring that after CS is asserted. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi-tegra114.c | 22 ++++++++++++++++++++-- drivers/spi/spi.c | 16 ++++++++++------ include/linux/spi/spi.h | 9 ++++++--- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index 5ac2ceb234fc..d8db4af08fff 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -723,15 +723,31 @@ static void tegra_spi_deinit_dma_param(struct tegra_spi_data *tspi, dma_release_channel(dma_chan); } -static void tegra_spi_set_hw_cs_timing(struct spi_device *spi, u8 setup_dly, - u8 hold_dly, u8 inactive_dly) +static int tegra_spi_set_hw_cs_timing(struct spi_device *spi, + struct spi_delay *setup, + struct spi_delay *hold, + struct spi_delay *inactive) { struct tegra_spi_data *tspi = spi_master_get_devdata(spi->master); + u8 setup_dly, hold_dly, inactive_dly; u32 setup_hold; u32 spi_cs_timing; u32 inactive_cycles; u8 cs_state; + if ((setup && setup->unit != SPI_DELAY_UNIT_SCK) || + (hold && hold->unit != SPI_DELAY_UNIT_SCK) || + (inactive && inactive != SPI_DELAY_UNIT_SCK)) { + dev_err(&spi->dev, + "Invalid delay unit %d, should be SPI_DELAY_UNIT_SCK\n", + SPI_DELAY_UNIT_SCK); + return -EINVAL; + } + + setup_dly = setup ? setup->value : 0; + hold_dly = hold ? hold->value : 0; + inactive_dly = inactive ? inactive->value : 0; + setup_dly = min_t(u8, setup_dly, MAX_SETUP_HOLD_CYCLES); hold_dly = min_t(u8, hold_dly, MAX_SETUP_HOLD_CYCLES); if (setup_dly && hold_dly) { @@ -758,6 +774,8 @@ static void tegra_spi_set_hw_cs_timing(struct spi_device *spi, u8 setup_dly, tspi->spi_cs_timing2 = spi_cs_timing; tegra_spi_writel(tspi, spi_cs_timing, SPI_CS_TIMING2); } + + return 0; } static u32 tegra_spi_setup_transfer_one(struct spi_device *spi, diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c55d55acbbb0..54d00c0a26d2 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3147,15 +3147,19 @@ EXPORT_SYMBOL_GPL(spi_setup); /** * spi_set_cs_timing - configure CS setup, hold, and inactive delays * @spi: the device that requires specific CS timing configuration - * @setup: CS setup time in terms of clock count - * @hold: CS hold time in terms of clock count - * @inactive_dly: CS inactive delay between transfers in terms of clock count + * @setup: CS setup time specified via @spi_delay + * @hold: CS hold time specified via @spi_delay + * @inactive: CS inactive delay between transfers specified via @spi_delay + * + * Return: zero on success, else a negative error code. */ -void spi_set_cs_timing(struct spi_device *spi, u8 setup, u8 hold, - u8 inactive_dly) +int spi_set_cs_timing(struct spi_device *spi, struct spi_delay *setup, + struct spi_delay *hold, struct spi_delay *inactive) { if (spi->controller->set_cs_timing) - spi->controller->set_cs_timing(spi, setup, hold, inactive_dly); + return spi->controller->set_cs_timing(spi, setup, hold, + inactive); + return -ENOTSUPP; } EXPORT_SYMBOL_GPL(spi_set_cs_timing); diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index c7f90a0129be..292e752ce34a 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -517,8 +517,8 @@ struct spi_controller { * to configure specific CS timing through spi_set_cs_timing() after * spi_setup(). */ - void (*set_cs_timing)(struct spi_device *spi, u8 setup_clk_cycles, - u8 hold_clk_cycles, u8 inactive_clk_cycles); + int (*set_cs_timing)(struct spi_device *spi, struct spi_delay *setup, + struct spi_delay *hold, struct spi_delay *inactive); /* bidirectional bulk transfers * @@ -1007,7 +1007,10 @@ static inline void spi_message_free(struct spi_message *m) kfree(m); } -extern void spi_set_cs_timing(struct spi_device *spi, u8 setup, u8 hold, u8 inactive_dly); +extern int spi_set_cs_timing(struct spi_device *spi, + struct spi_delay *setup, + struct spi_delay *hold, + struct spi_delay *inactive); extern int spi_setup(struct spi_device *spi); extern int spi_async(struct spi_device *spi, struct spi_message *message); From patchwork Fri Sep 13 11:45:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 11144201 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D6DC14DB for ; Fri, 13 Sep 2019 08:53:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 156EA208C0 for ; Fri, 13 Sep 2019 08:53:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AjtKzBEl"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="YMfbWMvC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 156EA208C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=analog.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=upYsc+RDbOM3dHnMM3NCgLEgZjX+f/GwokUsQukrClM=; b=AjtKzBEl7/MLRN B5umsJ6UZP/0Swk4v/GJpLA5K19vbQ9mUnLsMKY41z7g2pLOl/NrZC35YwJ8/Ba78fUTm9qlfGxUq 7yMyBP5J3aLJMHdkFdWhgKAcUk/XtmnVq7u4TZymq51iRYUdCdecGt3bttOi7soGUBEzCbwCgjeB0 eKLyqzThyl7A27Q2cEje869leZP22Pe9tSi/1wHSo4p5dECW4yM8MZ0uXEkybjVmFqR1mLgNAV5LC 1RVI4Yke/iK81HcX5U0c1V+fTLLSc5CfQIyJTK7QIGcACE4ihky8gq0vXxP19r/75gMOKRGZMiwKu aqTa1d/BJNUifHqTGI5A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hKt-00013a-Gx; Fri, 13 Sep 2019 08:53:47 +0000 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1i8hEF-0002zz-FJ for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2019 08:46:57 +0000 Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8D8gds8001890; Fri, 13 Sep 2019 04:46:53 -0400 Received: from nam05-co1-obe.outbound.protection.outlook.com (mail-co1nam05lp2055.outbound.protection.outlook.com [104.47.48.55]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdfsa8m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:46:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QcwrP4QnIjetMkoH5NLf0ibgB9XU8/pdiylNwS3t6rOtwBkduCCGpuk8Is56K34nb1SPkn6hIr62CBxeabWWWoGVvdRzxMbl1wb3C7tZuslc6373drm33AhmhZhm1zxKX3+Bn1sYH1SfxwgQdL6dim+cb6x2pP/KWXn0qq3FhgOKFKyGi70igoDXwMCEGI8uN/idIXAeIBq6jlFlLAy0o1Xy1hAndD0hM4P79+CqH3eX7556mNJ+cJR3UZlayCx4yO+LDRJ3u2zwFX5z9W6TQ6TXGLS4CpLqq/jZjcOKmN0MJWImEgFhHCNEiOk4uIt4iAy6ssjDSS1BXUY/faWnag== 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-SenderADCheck; bh=8SJm80TJlRotqx116nuGen8V9eGqdAKty0mbD7a8DOQ=; b=XNga6HYc2Kcgx5P195thaxhG2CSVGlOnmHVy4vYEZETvUGQbLxbtRVzIRuZB0mcz/LlkVb220hmQ45kQ2wwvcDrJK1ioVIpN8bstPT95hmI7nXBVNutKrPnw899YH+IrwSXLWJ1x1oJgjFGkHhcFadGnw/rZS9eEpE0sbTTop04o+nfYLlEKHcPYe6d2jIdaphDz+zFnM3X9ky/84TPRvrs8i0xtnHfXjrbJ8X+DOvGHoLOM4FqDuiEjV0rBoahBWC3b98hkv5gOgCaacelQ6aB9ZMtZXbEbk2R72bdmmKztnVhpZzeoe14AQSr0TKrRsJgB87Rii0c582j82kGHzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 137.71.25.57) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=analog.com; dmarc=bestguesspass action=none header.from=analog.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector2-analog-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8SJm80TJlRotqx116nuGen8V9eGqdAKty0mbD7a8DOQ=; b=YMfbWMvCIS24KwC8FESpwzHFLIw802RdIEKduP+Iq7T/elCOnj0tBGgkvSahy5x6SCV9RHaI6M/vOh8g0hrLpa5rRYVBDOJZq9kEe2jlFrl4s3XPtUTRXlKOZKGnKhbfYh+z0SsC3ueGfOLJMWCs/dDw7yOZJUZkMBJ9wuHmiL4= Received: from BN6PR03CA0072.namprd03.prod.outlook.com (2603:10b6:404:4c::34) by MN2PR03MB4669.namprd03.prod.outlook.com (2603:10b6:208:ab::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.18; Fri, 13 Sep 2019 08:46:51 +0000 Received: from CY1NAM02FT031.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::207) by BN6PR03CA0072.outlook.office365.com (2603:10b6:404:4c::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.13 via Frontend Transport; Fri, 13 Sep 2019 08:46:50 +0000 Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta2.analog.com; Received: from nwd2mta2.analog.com (137.71.25.57) by CY1NAM02FT031.mail.protection.outlook.com (10.152.75.180) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2263.17 via Frontend Transport; Fri, 13 Sep 2019 08:46:50 +0000 Received: from NWD2HUBCAS7.ad.analog.com (nwd2hubcas7.ad.analog.com [10.64.69.107]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id x8D8kjL3030753 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:46:45 -0700 Received: from saturn.ad.analog.com (10.48.65.123) by NWD2HUBCAS7.ad.analog.com (10.64.69.107) with Microsoft SMTP Server id 14.3.408.0; Fri, 13 Sep 2019 04:46:49 -0400 From: Alexandru Ardelean To: , , , , , Subject: [RFC PATCH 15/15] spi: implement SW control for CS times Date: Fri, 13 Sep 2019 14:45:50 +0300 Message-ID: <20190913114550.956-16-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913114550.956-1-alexandru.ardelean@analog.com> References: <20190913114550.956-1-alexandru.ardelean@analog.com> MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(396003)(136003)(39860400002)(376002)(189003)(199004)(476003)(2870700001)(70206006)(44832011)(6666004)(50226002)(356004)(336012)(316002)(47776003)(76176011)(7416002)(70586007)(8936002)(305945005)(478600001)(51416003)(186003)(48376002)(5660300002)(50466002)(1076003)(26005)(14444005)(2201001)(86362001)(7696005)(54906003)(36756003)(107886003)(126002)(486006)(4326008)(2616005)(2906002)(11346002)(446003)(110136005)(7636002)(246002)(106002)(426003)(8676002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR03MB4669; H:nwd2mta2.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; MX:1; A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e1bd2e00-ffbe-4a16-3d62-08d73826eb84 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(4709080)(1401327)(4618075)(2017052603328); SRVR:MN2PR03MB4669; X-MS-TrafficTypeDiagnostic: MN2PR03MB4669: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-Forefront-PRVS: 0159AC2B97 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: MtOCtlAqxM26bNa3hsjw+2gnJn3dlX2tC865y3toh/UR92xJvEcH4zTQ3qBcIvlw51PFY6rbQmo3et2T7zrak2eQP2GTXm6MKiXnJQn4tlpXXCz1BQQajZfAj/O2Gv5phiZujog/UPXp8UYrupPM8E1UEIcHsr/RpxnwQ7PO7Tq4omIKmf9GsH/3N3Ivpz4LhkB/+o6UDTqgxPUaQCpIoSlEhlFURksYMMdL7LFZtVFx8AN+kg60kHgON2/RZNrffzjZYDOustViWlCUWcXWopu90ZIZAW/bDdQbvJOOIoQQjnrR4PyZLkNy/EpFRPXwistSZaFdrW76bkVKWGqhUziPjdKx60sFL2OFyW1FWrEUyhR+c1Ep1T+BFpYRT8c2Mb2/PdJFw3zdR6rXAPBjjY5nTQKiUIofQVGWXf3vjto= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:46:50.6098 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1bd2e00-ffbe-4a16-3d62-08d73826eb84 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta2.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR03MB4669 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-13_05:2019-09-11,2019-09-13 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 impostorscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 spamscore=0 adultscore=0 mlxscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130083 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190913_014655_747418_3E9D5CCD X-CRM114-Status: GOOD ( 19.12 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [148.163.135.77 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: f.fainelli@gmail.com, baolin.wang@linaro.org, zhang.lyra@gmail.com, linus.walleij@linaro.org, broonie@kernel.org, orsonzhai@gmail.com, Alexandru Ardelean , jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This change implements CS control for setup, hold & inactive delays. The `cs_setup` delay is completely new, and can help with cases where asserting the CS, also brings the device out of power-sleep, where there needs to be a longer (than usual), before transferring data. The `cs_hold` time can overlap with the `delay` (or `delay_usecs`) from an SPI transfer. The main difference is that `cs_hold` implies that CS will be de-asserted. The `cs_inactive` delay does not have a clear use-case yet. It has been implemented mostly because the `spi_set_cs_timing()` function implements it. To some degree, this could overlap or replace `cs_change_delay`, but this will require more consideration/investigation in the future. All these delays have been added to the `spi_controller` struct, as they would typically be configured by calling `spi_set_cs_timing()` after an `spi_setup()` call. Software-mode for CS control, implies that the `set_cs_timing()` hook has not been provided for the `spi_controller` object. Signed-off-by: Alexandru Ardelean --- drivers/spi/spi.c | 50 ++++++++++++++++++++++++++++++++++++++++- include/linux/spi/spi.h | 5 +++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 54d00c0a26d2..acbbfee837ed 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -775,6 +775,15 @@ int spi_register_board_info(struct spi_board_info const *info, unsigned n) static void spi_set_cs(struct spi_device *spi, bool enable) { + bool enable1 = enable; + + if (!spi->controller->set_cs_timing) { + if (enable1) + spi_delay_exec(&spi->controller->cs_setup, NULL); + else + spi_delay_exec(&spi->controller->cs_hold, NULL); + } + if (spi->mode & SPI_CS_HIGH) enable = !enable; @@ -800,6 +809,11 @@ static void spi_set_cs(struct spi_device *spi, bool enable) } else if (spi->controller->set_cs) { spi->controller->set_cs(spi, !enable); } + + if (!spi->controller->set_cs_timing) { + if (!enable1) + spi_delay_exec(&spi->controller->cs_inactive, NULL); + } } #ifdef CONFIG_HAS_DMA @@ -3144,6 +3158,11 @@ int spi_setup(struct spi_device *spi) } EXPORT_SYMBOL_GPL(spi_setup); +static inline bool _spi_delay_clock_cycles(struct spi_delay *d) +{ + return d && d->unit == SPI_DELAY_UNIT_SCK; +} + /** * spi_set_cs_timing - configure CS setup, hold, and inactive delays * @spi: the device that requires specific CS timing configuration @@ -3156,10 +3175,39 @@ EXPORT_SYMBOL_GPL(spi_setup); int spi_set_cs_timing(struct spi_device *spi, struct spi_delay *setup, struct spi_delay *hold, struct spi_delay *inactive) { + size_t len; + if (spi->controller->set_cs_timing) return spi->controller->set_cs_timing(spi, setup, hold, inactive); - return -ENOTSUPP; + + if (_spi_delay_clock_cycles(setup) || + _spi_delay_clock_cycles(hold) || + _spi_delay_clock_cycles(inactive)) { + dev_err(&spi->dev, + "Clock-cycle delays for CS not supported in SW mode\n"); + return -ENOTSUPP; + } + + len = sizeof(struct spi_delay); + + /* copy delays to controller */ + if (setup) + memcpy(&spi->controller->cs_setup, setup, len); + else + memset(&spi->controller->cs_setup, 0, len); + + if (hold) + memcpy(&spi->controller->cs_hold, hold, len); + else + memset(&spi->controller->cs_hold, 0, len); + + if (inactive) + memcpy(&spi->controller->cs_inactive, inactive, len); + else + memset(&spi->controller->cs_inactive, 0, len); + + return 0; } EXPORT_SYMBOL_GPL(spi_set_cs_timing); diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 292e752ce34a..def49a76299f 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h @@ -602,6 +602,11 @@ struct spi_controller { /* Optimized handlers for SPI memory-like operations. */ const struct spi_controller_mem_ops *mem_ops; + /* CS delays */ + struct spi_delay cs_setup; + struct spi_delay cs_hold; + struct spi_delay cs_inactive; + /* gpio chip select */ int *cs_gpios; struct gpio_desc **cs_gpiods;