From patchwork Fri Sep 13 11:55: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: 11144203 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 CEE4914DB for ; Fri, 13 Sep 2019 08:56:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A43EE208C0 for ; Fri, 13 Sep 2019 08:56:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="ZfpR/e5V" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387646AbfIMI4E (ORCPT ); Fri, 13 Sep 2019 04:56:04 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:40966 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387402AbfIMI4D (ORCPT ); Fri, 13 Sep 2019 04:56:03 -0400 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 x8D8qnXp010601; Fri, 13 Sep 2019 04:56:01 -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 2uytdfsakv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:56:01 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DUQE28TR35Wf4eB3EdfDCAgNWwcn+m92xe+s8ow4RExmFxhoaMV4pZqzWZWYz+ob6+AS8tteiO5dTpG0Q8UI41u4MgtY7GV+77njJpX2hOOfUWGKrl+pG6/vRtkFwsDMNEw50imV7n1b/rHenvKRbseb10bkgandft84hiwdshyplxAAhbdxGdUFajyoiFWMnIA0TKs4fj+DElnxUwgyv1D5YUPKZybu9oF5U7KVlIiWAfUHoRk99SpINCKNeJASxeQGfRIiAywVIj3W4KvV0Vcy+Am60VrEX5lMOn840DraU06m1eWr3MG5/qtWMTiHE8U8vBpoubis7nBEPpL69A== 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=kP3qHsGbePZBUUvR4h3gxHtoDMRZqfR32UG3xQsB3Z0mZNUMcdh0wZW51JW+/Opg9DCJPW1e097E2PNHEPxOeLjkCNt4mGcLRLZUk0g+ETAVSyBlInmpU0XeCiU8N3aaNYcCz/HUEhEm7WuQEwn/lIi7RaYXwYR8ly5vApY7rmGFkO1rwQyFHYmLz9O/7OJPQMbWD/auPP3c/0/1IE6no/EAGUdZf/nD9bXrqme1DGHjHMWbH/sSgJy/Cr9VuLTnQaW0ZyAT+/DTNT2M5hK7kL+W0tsBCSqAr+qm1KdXsoriBDOeqFo7YmUqTOGVSWOSLZLDpsCo/sH1YGBXKouXvw== 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=ZfpR/e5VcDgezYPZE6d5YzELQxnZgoIhz/1vhoaT8IPKzbQWI93gf35q1WMB18LEwN2mJhemCOz4Vcz4xwb/HidunkakMuxI+oNdMTl/nKc6LhdjQ8WGP3dlmQFHQVVd9g1cgd65PQgIxK+JeEHQ4NUBKXWdpxJdWk+H9EvVc3A= Received: from DM6PR03CA0062.namprd03.prod.outlook.com (2603:10b6:5:100::39) by DM6PR03MB4618.namprd03.prod.outlook.com (2603:10b6:5:15d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2241.19; Fri, 13 Sep 2019 08:56:00 +0000 Received: from CY1NAM02FT053.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::203) by DM6PR03CA0062.outlook.office365.com (2603:10b6:5:100::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.19 via Frontend Transport; Fri, 13 Sep 2019 08:55:59 +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 CY1NAM02FT053.mail.protection.outlook.com (10.152.74.165) 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:55:59 +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 x8D8tsOX000404 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:55:54 -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:55:58 -0400 From: Alexandru Ardelean To: , , CC: , , Alexandru Ardelean Subject: [PATCH v2 1/4] spi: move `cs_change_delay` backwards compat logic outside switch Date: Fri, 13 Sep 2019 14:55:46 +0300 Message-ID: <20190913115549.3823-2-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913115549.3823-1-alexandru.ardelean@analog.com> References: <20190913115549.3823-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)(346002)(39860400002)(396003)(136003)(189003)(199004)(316002)(1076003)(8676002)(76176011)(336012)(26005)(186003)(48376002)(51416003)(36756003)(54906003)(426003)(305945005)(7636002)(7696005)(110136005)(2906002)(4744005)(2616005)(107886003)(2870700001)(106002)(70586007)(70206006)(8936002)(50466002)(126002)(446003)(5660300002)(478600001)(486006)(44832011)(2201001)(476003)(50226002)(4326008)(246002)(11346002)(6666004)(356004)(47776003)(86362001)(81973001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR03MB4618;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: 23f2435c-47d2-4943-bf18-08d7382832d0 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:DM6PR03MB4618; X-MS-TrafficTypeDiagnostic: DM6PR03MB4618: 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: IWp8zEdHnrDQcUzGp5yGsuSRvejnVNtg2uUpaSYpSoQjqEGOHfC2wITSS14tB05k8tAqzWhrF9nDV5lyLjZr7WLEj7ifFOTqbQjJIHig4bo4aHDRJ0zL1GTINgrxM4L2pzZuBKuMZZ+ZbnBLGbvUxTUPkEKpo5/A9z7pxCHz8woOyDm8PMbqyOCZvnzc0LRAsMNFSTSDZ2CLLD+isompC1mu1/A41nskiYIqUv2uJnH+7AwoSLemf7XpZFzF+9a7ImqnlSr2dqWvTo+cxIXUCeLRMDJnPDRhxlwEHI7Mmozd6VglIsHUX9/dXKNY9s22QSQjeN1BB12SdMw974OR5w8JDVbd+3b7wjv/rWn9HuYdqanPLaXO50vuACMpJUmz21r/7dSIj5glwmv4Qc6LBshKiFIxf72+BrQHH7RfuU0= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:55:59.7372 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23f2435c-47d2-4943-bf18-08d7382832d0 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: DM6PR03MB4618 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-1909130085 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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:55: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: 11144215 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 B09E314DB for ; Fri, 13 Sep 2019 08:56:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 85250208C0 for ; Fri, 13 Sep 2019 08:56:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="ZzpI4IqE" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387752AbfIMI4H (ORCPT ); Fri, 13 Sep 2019 04:56:07 -0400 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]:12902 "EHLO mx0b-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387615AbfIMI4H (ORCPT ); Fri, 13 Sep 2019 04:56:07 -0400 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 x8D8qtmL003288; Fri, 13 Sep 2019 04:56:04 -0400 Received: from nam05-dm3-obe.outbound.protection.outlook.com (mail-dm3nam05lp2058.outbound.protection.outlook.com [104.47.49.58]) by mx0b-00128a01.pphosted.com with ESMTP id 2uytcwh9kr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:56:04 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fX/MVgk7J6xWsH15MqMNkx+iCXhBnk2OvuH1k+mdoQL6k/D6njyAKROMYDc5jV+7MtKHAmU8RYBJRpilrlvx4/k9HBjE1/V5hluyYcfPRHKCEJI4BmcZkRmvw6FEFAQiWVHJFxBFtG7mAUfuOkNISswX1RcZpE9zTlm1RL07CLvYjR9rM8OHGlLnbE/6RLQnggp0pw4AJ/mrJ577XTJmnaPnSK4bnC7F+mNEod+QwQ0y6wIAherzEfJ9vRzwPKjmnnNvSyq16atnG+mO1zYBzevr53QK3Num+h2qcwexDvoLyBQDA+uu6VIx3wNnZTthtELzz8TXFMSEHh3AqhLvUw== 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=kD/PNz1e3SCceFtCA376oYHiV5yJjM+WH61znI/92YCYnd9Mujr8Wf3qAvpLpBb10NgSVUMxC/ZM7ToXbnfHUkeYl7xg+q19aaDOxuNTENFDmYlkFfEAp8rWijIMcRIMghbf8bzxNgQPNAaIUQuse7iRP68hHMoaTx9j3vvifqREEs5B7zMSe8iA3uMRGy0sJy9iOnfyE1uWKDdPwUaDoC4zXIKkgM79+nwIOtiKFzRWXo5rT/LsogrHNSAJqzedfjzf2HebxPI3nG6jAPp684CmKN/nUDS98Sn5aF6AxRMdrXQu2SfUNJsj1u6Y81tbVPRYR6nWYi1gWPYzj0Pzww== 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=ZzpI4IqEnhd6cVBN2RDQlwz5vDC9rUzLqU37WUNI3sUyIzFg/Vp7EUMA4t+Uc5kLQm1ePCWlHsj1NDIpDucV1Rz+JLkZcgmXB9UCnZ75rRnJPlf1w9z4SXQaVJ+t6luuBp3JhTPg1yxMTASHrYu8uJ+0BV8XGNxBMUPF1arkojI= Received: from MWHPR03CA0060.namprd03.prod.outlook.com (2603:10b6:301:3b::49) by BYAPR03MB4856.namprd03.prod.outlook.com (2603:10b6:a03:138::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.13; Fri, 13 Sep 2019 08:56:01 +0000 Received: from CY1NAM02FT035.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::205) by MWHPR03CA0060.outlook.office365.com (2603:10b6:301:3b::49) 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:56:01 +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 CY1NAM02FT035.mail.protection.outlook.com (10.152.75.186) 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:56:01 +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 x8D8ttQG000407 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:55:56 -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:56:00 -0400 From: Alexandru Ardelean To: , , CC: , , Alexandru Ardelean Subject: [PATCH v2 2/4] spi: introduce spi_delay struct as "value + unit" & spi_delay_exec() Date: Fri, 13 Sep 2019 14:55:47 +0300 Message-ID: <20190913115549.3823-3-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913115549.3823-1-alexandru.ardelean@analog.com> References: <20190913115549.3823-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)(346002)(376002)(39860400002)(189003)(199004)(8676002)(2906002)(50466002)(6666004)(356004)(14444005)(5660300002)(106002)(47776003)(50226002)(2870700001)(107886003)(2201001)(36756003)(8936002)(48376002)(86362001)(478600001)(486006)(316002)(186003)(126002)(26005)(44832011)(336012)(11346002)(476003)(76176011)(305945005)(70206006)(446003)(7636002)(70586007)(2616005)(426003)(7696005)(110136005)(54906003)(4326008)(246002)(51416003)(1076003);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR03MB4856;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: 0b624ec9-e465-4e28-436f-08d7382833d3 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:BYAPR03MB4856; X-MS-TrafficTypeDiagnostic: BYAPR03MB4856: 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: 5XZYe7t6MXOao0NzsCJbe+gqVKCrJL4JkXvG4yHZ09usUM12iZw7qLpoZf7eYzLpWncNHd5qVqBzaZe5pfgfUgGhHDNuVNzvrkUww4hKPc3kkjWIBev692SlfaMYU9D67EodLlyBF/unEFM2/+KETY2w8halNNjT7v7YCqTXpQGhla0K8Vr86yQkj38e8SrzYFrZ7Y/9gqGizNMVze3zhm3BpkuRkWu0I85lWpc9kRCIfy5AnyEEudXnr0czSA3sOzCywiFx4HS3K5xfb/01Q9IGaN8L5wLY46mD8e8OuicC0oA84XmunxpxbN25VmNupyBP3BHlDHJwUDq9UpX/KlI4VApSVkPH0fqmE0JHFQejjaZxYr1l/pF7IQXUJ9OTa9gmPpZQenMBdHvYjZoMDARUsUbJASkYzMyuCR19y5E= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:56:01.4294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b624ec9-e465-4e28-436f-08d7382833d3 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: BYAPR03MB4856 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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1908290000 definitions=main-1909130085 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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:55: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: 11144213 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 ACDE118A6 for ; Fri, 13 Sep 2019 08:56:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B584208C2 for ; Fri, 13 Sep 2019 08:56:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="Nj85MhK5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387621AbfIMI4I (ORCPT ); Fri, 13 Sep 2019 04:56:08 -0400 Received: from mx0b-00128a01.pphosted.com ([148.163.139.77]:13206 "EHLO mx0b-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387751AbfIMI4I (ORCPT ); Fri, 13 Sep 2019 04:56:08 -0400 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 x8D8rTTV004334; Fri, 13 Sep 2019 04:56:05 -0400 Received: from nam03-by2-obe.outbound.protection.outlook.com (mail-by2nam03lp2056.outbound.protection.outlook.com [104.47.42.56]) by mx0b-00128a01.pphosted.com with ESMTP id 2uytd1h9q9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:56:05 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GgtLSUsYMFTCxC5emv74DNFCMLaewZQT6TojjbMEjpZDFeVdq5tEGmnrrC214NRb/xF12MZZpFqI5IDxyIr+6QJbOCxALXcZp43eaXRg09K6D7tM73VT3gNmP5A96z/Jll5tBHBGOgjAbr/EBaqkR9yqR2uXO2kGAO95VGrLLnoIW1h3NIjr8HSWR+BMYK56RbJO/rg2QCGIGWa2bzxfTe++IklmN94HfZZBdHWMhEIqWxpVzpqPe3YM/UcegdpaXKdAXKX/YHZ6JstGdwAR0Y/W1tSGicJlIZDN+6SzKuEFoN3g6TxPc/yncGxf3TjnTmDi3KjjT+zMKqqMUHELlg== 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=KbsSVUgvWbCVFy0H1BITVbXbvF8uX/c+bbxF55CwEhj8qoviivk8Ma6CCB/P2q27xqw71Dk5qKHLzH2QgPu/9024AdLryCC6VfuVi/YF8SGme8WUfkN3bHvPAXJoksjNil0shdSHuSU8wSJtvlGM5xSwi+2no5QyymjEyBapzFzc0EGwC/nNq5MRHnX/0+KRLqOwHFaMc31oCoy3E96WnIImtAi7KvXzYJ8a32Q6t+UGAEshIT97TcJyZc4bA1ipsD/iUUejEEQZ1Mo23Z/jXH9vqLhaaQbFepHpPwRCkaFQZPX2TY47FNsH1znoqSx6N0fSlWnXX/jQWsf6bzZk7A== 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=Nj85MhK5JEZ+RTRS5dDPQekEeAADWZGXeee+aLkvSbE7HJLa2UBTtuKhUF8detmjQKlu2cWYTwn2n4KB24itdtbKLAAwn8DDTQxmzKtwz2AaeT/3kioinXM8VdNBmwS+t6r4i/Xym3h676Pw9Dko9C9DSe7Zdn5k+8rS0i0akyM= Received: from DM3PR03CA0018.namprd03.prod.outlook.com (2603:10b6:0:50::28) by BL0PR03MB4033.namprd03.prod.outlook.com (2603:10b6:208:61::32) 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:56:03 +0000 Received: from CY1NAM02FT017.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::201) by DM3PR03CA0018.outlook.office365.com (2603:10b6:0:50::28) 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:56:03 +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 CY1NAM02FT017.mail.protection.outlook.com (10.152.75.181) 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:56:03 +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 x8D8tvnU000413 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:55:57 -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:56:01 -0400 From: Alexandru Ardelean To: , , CC: , , Alexandru Ardelean Subject: [PATCH v2 3/4] spi: make `cs_change_delay` the first user of the `spi_delay` logic Date: Fri, 13 Sep 2019 14:55:48 +0300 Message-ID: <20190913115549.3823-4-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913115549.3823-1-alexandru.ardelean@analog.com> References: <20190913115549.3823-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)(376002)(346002)(39860400002)(199004)(189003)(50226002)(6666004)(356004)(2906002)(478600001)(7636002)(70206006)(426003)(5660300002)(2201001)(1076003)(446003)(48376002)(2616005)(126002)(50466002)(476003)(70586007)(44832011)(11346002)(86362001)(47776003)(2870700001)(51416003)(7696005)(110136005)(26005)(54906003)(76176011)(336012)(36756003)(486006)(107886003)(106002)(316002)(4326008)(8676002)(8936002)(305945005)(186003)(246002)(81973001);DIR:OUT;SFP:1101;SCL:1;SRVR:BL0PR03MB4033;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: f37ace9e-843f-4660-d276-08d7382834d1 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:BL0PR03MB4033; X-MS-TrafficTypeDiagnostic: BL0PR03MB4033: 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: W9xLfVXyZRRfb87bz4azRK122lhnLjgjB0oMO1E6bITrtGvrxUU/V5pab9nswXadt1e4gFdTZTpc29pxEOkpFK9OqDV6zfL8TPsWQ7R2mMwTXX5YVaqCTyalnYRFpqNjpv0EhTEM3o6PdHe2k8kZgcaGqp/nN3YUYDq3/fHONe0F9wTIjNGYdscAoK02AhkGnVZ3B3GshJ9UdMFN5VqBrjceq1BG8pZdy6E4u8fgloemWm3tGNUEJ7mFBztpmdu9UABcz+FP/geJnDlPQOlPp+PHxZbRqZGTtILGI5d4QNftvhPMRAxHSJMmMpQwOr+BxwMas3rSFzq1bOU9NdxOe40Hrp7tftcOiBG7wXLjFV24ku3nE6S2tavK7If0tIgFr1zRnBKiz37m89EnE6juUI/OT4EltrU6oVfPghJWnck= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:56:03.0986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f37ace9e-843f-4660-d276-08d7382834d1 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: BL0PR03MB4033 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-1909130085 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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:55: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: 11144209 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 54E9614DB for ; Fri, 13 Sep 2019 08:56:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F9B5208C2 for ; Fri, 13 Sep 2019 08:56:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=analog.onmicrosoft.com header.i=@analog.onmicrosoft.com header.b="N7u+eY4o" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387751AbfIMI4L (ORCPT ); Fri, 13 Sep 2019 04:56:11 -0400 Received: from mx0a-00128a01.pphosted.com ([148.163.135.77]:43636 "EHLO mx0a-00128a01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387765AbfIMI4I (ORCPT ); Fri, 13 Sep 2019 04:56:08 -0400 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 x8D8qmLk021615; Fri, 13 Sep 2019 04:56:07 -0400 Received: from nam05-by2-obe.outbound.protection.outlook.com (mail-by2nam05lp2059.outbound.protection.outlook.com [104.47.50.59]) by mx0a-00128a01.pphosted.com with ESMTP id 2uytdksakr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Sep 2019 04:56:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IaRlKdaT2KAyabtMGAZL5q1K6V7NOxOKB7qs2wE2Mrhmc4s4NyYsMZ+cA8JaDG2YH7hYXVPM3jYC8/bMV3o/wRBSZWMq7FEKIZp0QzIp/1e5PcytksYndP5WcARL0F4BiuKzL+/fQ7efDP8Hp4JAdiSyN7Y+Yh/o2JfStI4pE3IWRwReRRbsHby+ZNbnwVLEZM0dJYc8bGfDMF7/E2pRv1MaoRbIsokGTIwT6FayApk17GH8rntMUkJz8GE4db+fSR9ZyPovYxs8vnm4+y7FQ/LJKwlRiPJa9v6GEk9/UdhjDGw1/VOLOhWu6GUSdAjQJNNgDGXjcidL9WtfeE8LEA== 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=HmSG6PnPWpbNSJNlRM7qv6c3N6I48lWqx4FZw/8zgfPuIFSJEV8VWy+eOJySqHQFrZVDqFNGy+tUjGW0496SKGrkSBZSXPP5Utgr+80O537Ctm6ib4BYQQ7N7ennhgJicRXN8DXPs+7fJIhgXvSrNipM/iTxjU5Di983or/GbjxUKXht80N1CHo1+EmuXq4gLSi4N6JxnpgqkiGezroyk0WNemSP6qypedhEJ+peqgiPQ9gUYgnfQmDvKew6z0v55BM8ypbSOQRHgYGv4DGDmxFs/2vyQgv3oA+hSJsoLjcIPX0s80ieR0/61A8LWSrzDLnCI95A+oMgFFhPzwpjVg== 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=N7u+eY4o6JA8pSFgDx6CCSE3RtzodgE+JM33OTxF+CDFn6dpCShzWr1ZApyBrJS2DwuqKtyRr+hbkhRWuCw/isA7i9WrfqEgJ+5ySu+ku35wBJyqq8nLhbasTvTLQ8rpbBGvK850w6TL8TjklO8kO+tKFf92urUS0etubxsc/Ho= Received: from BY5PR03CA0001.namprd03.prod.outlook.com (2603:10b6:a03:1e0::11) by DM6PR03MB3721.namprd03.prod.outlook.com (2603:10b6:5:af::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Fri, 13 Sep 2019 08:56:05 +0000 Received: from CY1NAM02FT006.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::205) by BY5PR03CA0001.outlook.office365.com (2603:10b6:a03:1e0::11) 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:56:05 +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 CY1NAM02FT006.mail.protection.outlook.com (10.152.74.104) 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:56:04 +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 x8D8txpi000419 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=OK); Fri, 13 Sep 2019 01:55:59 -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:56:03 -0400 From: Alexandru Ardelean To: , , CC: , , Alexandru Ardelean Subject: [PATCH v2 4/4] iio: imu: adis: convert cs_change_delay to spi_delay struct Date: Fri, 13 Sep 2019 14:55:49 +0300 Message-ID: <20190913115549.3823-5-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190913115549.3823-1-alexandru.ardelean@analog.com> References: <20190913115549.3823-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)(199004)(189003)(356004)(2906002)(2201001)(50466002)(4326008)(76176011)(70586007)(1076003)(54906003)(478600001)(48376002)(476003)(336012)(26005)(246002)(86362001)(107886003)(186003)(50226002)(5660300002)(126002)(2870700001)(8676002)(6666004)(14444005)(2616005)(486006)(36756003)(106002)(70206006)(7636002)(47776003)(51416003)(44832011)(426003)(316002)(305945005)(446003)(7696005)(8936002)(110136005)(11346002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR03MB3721;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: 293636f8-4e58-49b2-292c-08d7382835c2 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:DM6PR03MB3721; X-MS-TrafficTypeDiagnostic: DM6PR03MB3721: 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: 64/3SaMkj6MtWmQ03k+0WZGWrDuWMnOrX3y3Ei/N4dcsXeqb6XCD3pU6eT3X82GONyeVoVlq9WFFnIkNqkl5+AnqGJug0/KHdTjUBx9As8WmBO3TfpGqQNNI1nIiwpEzgqqTsuFwtS3UhA8XybW062eH/8osr8lhATMhd8TUX0clL3G1bT5egRf9cTyH78vAb6A7LM2p1w1286adVaQRXAOcNC//rFwSHV0pD2ADWkiVeaoYS9h6sB/rMCiWx05LU09MruqOkTRqwQMi7RxkrD+8MLKvUtHADegshJJUed/ZeFK0gqFLP9oPloVi1oM5dp9cU3ntz2a133XzLXMaweg/ZRgroHI1+14Wh7oMb1k6CAM0MegvKCzlutTVjJNwNOls7sLmpZ9gzcVqRv7xYPs7z+bKWhNZaSwoGRD/gXU= X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2019 08:56:04.6607 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 293636f8-4e58-49b2-292c-08d7382835c2 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: DM6PR03MB3721 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=945 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-1909130085 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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,