From patchwork Fri Feb 23 09:32:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 205244 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp475029dyb; Fri, 23 Feb 2024 01:33:44 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUqKD8SOkLGNjG/DtmuCbB3TpkDMBBf4q0KzUdsK5JSaI+Wvy0DRd6UE5CiOv99XOdCihy0auVF9nkr+zLeRptNPKJHAg== X-Google-Smtp-Source: AGHT+IElVYYAlvRDsvAxyqqMzB0oh617tlxZOaqY+klOmXGiJAqcKL+WxeC7KfZix+YuZt/yZVDC X-Received: by 2002:a05:6871:202:b0:21e:6a0b:70dd with SMTP id t2-20020a056871020200b0021e6a0b70ddmr1463934oad.44.1708680824681; Fri, 23 Feb 2024 01:33:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708680824; cv=pass; d=google.com; s=arc-20160816; b=kz4VshrH76dgl5strNE8ZFXOeYNvUuZ+p62xRSU1cIJ2LJjjfDe8SNS+WNf3OXODKb bhX1KSuUaQdb+aEGq5pi9raZEQ6OZIwFR/3x35ehssz5lF1CK+30LK/TS5KXqvDmLwK3 eoWugsT/RQSY+ny8PyI1kk/K+vX4f9UlNezjNO4HsQtyCmiQXHvF/fyctvwcr1oE2Hn1 x5fFK5PVus3CeZA9mjIEOAUgscVCPjSKLbgWjqxoFfzi8VqUKdYigi6x4LgZiiglRvzV yM5kkePiaVexqJ/1jo+hKnVkw/rGNgwY/lYiSDtSdTYKW+xSwcIN4oDdSd+s4shxOZ0V 8ypg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=F3/kBXysZgOqeHBBvDliJdBFjiOsLlLOqL3slXKauXw=; fh=eI8HjExr0WsH9IWVPxvbaDTOw70phhIumkj8bsjnk/U=; b=QrZ3qOReR8R1vpY0do77ddp/J7MwVTs3bus7kbW3sSpSr1/YhekrBQi7rMi00wYvjy WmaJhHNraR1fqj5tDLT7DJOM/ti9VnV9JSvEis43eMP8e7Z5XcJCn0oAZjcvk05bIcut Tc+KPjkv+eGJznSTxTeBy9NjaMZiCypndfp6JYQsITxMaFBm+T2G1XEJmEZ7GmrmWqq7 kM1fJ07QBPIp7/pyO81ArZfE/bUnRWaHo2MMtigR4A4oDNVrs2KuWaLk+D57Nk22BzsZ imMdEotB9aLXweU0ZT08PCP5Pb4PolaWWqVZYCqxCw3hZZNJ5MZi3Nmnva8Ej1T22v75 XEoQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Cu6x2zgd; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-78018-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78018-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m27-20020a63711b000000b005dc210489fdsi12004430pgc.63.2024.02.23.01.33.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 01:33:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78018-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Cu6x2zgd; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-78018-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78018-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 79D22286A0A for ; Fri, 23 Feb 2024 09:33:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6363F5D475; Fri, 23 Feb 2024 09:33:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Cu6x2zgd" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0A9B5C902; Fri, 23 Feb 2024 09:32:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708680777; cv=none; b=o3krzgNyOwQFeVjAoLlTkYvbmKmg1Qh9xb9UnCxOS+TlDXknLrK5t+tx+WEkQRdhDC6hupdbiJuXEwQe/QVacyVjsakCM92hOJiPK77r7ZpUgnS928BRNIKPbj3iFo5Nmqmd3pJdA/CU4Xr672jJ1t/Kc+WfOSADascyUhG8UQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708680777; c=relaxed/simple; bh=GCDrJjUFp3RJ0Y/5AvQUzZXLTy9PY6XVQC2ttAy8RRA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KmXOuFvKWtjyDfZiMj/PqYcbVMkYxN8ZPDBviA7wMRNSJX36sswplWiJZ/8U9Y1aI/RsmaDPf0Kd/MezG5v+RAhVF4RTPeGO9AivPWwFb1BPkWZRb5qc0ygX34UwsGyD+ZJ1wg6/MocA+IfKHjC45YmMAE36B4SCiKInpTwRwe0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Cu6x2zgd; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 417F520012; Fri, 23 Feb 2024 09:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708680767; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F3/kBXysZgOqeHBBvDliJdBFjiOsLlLOqL3slXKauXw=; b=Cu6x2zgdlJVsgmram6kHkZzFg9KruMBorCAQTGyChFv2lcm2YMWujh4BzkGqPiSDqbnk5y 3wmKJDEKpyTygm57d2Brvkuj/E50uHO81Q3HFyAVOmChTuuecHvkkXVzSdXLo5voh4VwOI kAQHpkX0CEmhlHt1jeSEPUbiLs96cz3WV4tVN/fcC14frIrbZa0jDtqEDpbAgAbKf7LLdE /PaEW9aAaE70OdDS5udSXly/rRMxidtnBQX77nVM2ddpLCGufQauSkmYa3UerPIwaD1DEJ 7pnJfqhHeEDHADaS7XdTnqtu731RtOY9wCk6ojaqpSITZeHvxAJF6y+gRGkTeQ== From: Louis Chauvet Date: Fri, 23 Feb 2024 10:32:11 +0100 Subject: [PATCH v2 1/3] spi: spi-omap2-mcspi.c: revert "Toggle CS after each word" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-spi-omap2-mcspi-multi-mode-v2-1-afe94476b9c3@bootlin.com> References: <20240223-spi-omap2-mcspi-multi-mode-v2-0-afe94476b9c3@bootlin.com> In-Reply-To: <20240223-spi-omap2-mcspi-multi-mode-v2-0-afe94476b9c3@bootlin.com> To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Miquel Raynal , yen-mei.goh@keysight.com, koon-kee.lie@keysight.com, jeremie.dautheribes@bootlin.com, Louis Chauvet X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2319; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=GCDrJjUFp3RJ0Y/5AvQUzZXLTy9PY6XVQC2ttAy8RRA=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBl2GY3x6HHDnThiMCS4K03QmQtC9VdTVM5i+wAYJwJ QZpgr2aJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZdhmNwAKCRAgrS7GWxAs4jz6D/ 9BDF/OlkikEstcIpzjUoZ2kJBk+g5qf4uU6kl9f4EOZPrBznv61eL3j3Rpq7ysgs5OAn2B1pp+i+wV YZf1HtLY3z9hQZUJT6NUKqJJHWuYifGAZSaj0Do1WB6RThXQa/1P4LUmCkTa55bfcTM5qtA/OvhW/O X/OuyLNGEyX4i5DhH3kEXsZyfuXCIXrFV0an/P6akDtcn9b0RbxLsm4ns6Ppm0oFgksa7JAS8Ol+Wn lNJ4em1jWz9gXTMqjgCFY02YEgJhlQ/u+jfXHNHC69OZLZfZtkwTYW69XcmzmIBvsXUoE8DhX6cqxs QiV+uJ70nniaft1VE3+p7JVDSfYmJY7e8uFtO17+KyaT8d2MQobyWV1E5HAl7PhenrXtMMhwmNxIEK IbZpbfMFojwZsz7Bvfo8d4T6wfinDj2TQIqUf1xZff2BC2vMkrN6YFH4DyiF7CQSQNszorMOCv5UlS iOLriagDx/rsGvhhEsiBv31Q3H5p6z/UUWzv3poiAkKUfqDp9gU6booTwVRIQd6y8fPWJCiPtTgyYi Z9v5Xn9bapOXNahOahDrUHicPuVG1HCt8aW8Tga3klA/KsUorpiBPIcLEvrfRqbAAijffFi6JixCbp isFoWIpNoICplphNXOy+K1uH6rYdt1ZP4IcaOiL7OijPFx0s/GWCHtWsbcVg== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791681704089742509 X-GMAIL-MSGID: 1791681704089742509 Commit 5cbc7ca987fb ("spi: spi-omap2-mcspi.c: Toggle CS after each word") introduced the toggling of CS after each word for the omap2-mcspi controller. The implementation is not respectful of the actual spi_message content, so the CS can be raised after each word even if the transfer structure asks to keep the CS active for the whole operation. As it is not used anyway in the current Linux tree, it can be safely removed. Signed-off-by: Louis Chauvet --- drivers/spi/spi-omap2-mcspi.c | 15 --------------- include/linux/platform_data/spi-omap2-mcspi.h | 3 --- 2 files changed, 18 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index a0c9fea908f5..fc7f69973334 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1292,13 +1292,6 @@ static int omap2_mcspi_transfer_one(struct spi_controller *ctlr, t->bits_per_word == spi->bits_per_word) par_override = 0; } - if (cd && cd->cs_per_word) { - chconf = mcspi->ctx.modulctrl; - chconf &= ~OMAP2_MCSPI_MODULCTRL_SINGLE; - mcspi_write_reg(ctlr, OMAP2_MCSPI_MODULCTRL, chconf); - mcspi->ctx.modulctrl = - mcspi_read_cs_reg(spi, OMAP2_MCSPI_MODULCTRL); - } chconf = mcspi_cached_chconf0(spi); chconf &= ~OMAP2_MCSPI_CHCONF_TRM_MASK; @@ -1361,14 +1354,6 @@ static int omap2_mcspi_transfer_one(struct spi_controller *ctlr, status = omap2_mcspi_setup_transfer(spi, NULL); } - if (cd && cd->cs_per_word) { - chconf = mcspi->ctx.modulctrl; - chconf |= OMAP2_MCSPI_MODULCTRL_SINGLE; - mcspi_write_reg(ctlr, OMAP2_MCSPI_MODULCTRL, chconf); - mcspi->ctx.modulctrl = - mcspi_read_cs_reg(spi, OMAP2_MCSPI_MODULCTRL); - } - omap2_mcspi_set_enable(spi, 0); if (spi_get_csgpiod(spi, 0)) diff --git a/include/linux/platform_data/spi-omap2-mcspi.h b/include/linux/platform_data/spi-omap2-mcspi.h index 3b400b1919a9..9e3c15b4ac91 100644 --- a/include/linux/platform_data/spi-omap2-mcspi.h +++ b/include/linux/platform_data/spi-omap2-mcspi.h @@ -16,9 +16,6 @@ struct omap2_mcspi_platform_config { struct omap2_mcspi_device_config { unsigned turbo_mode:1; - - /* toggle chip select after every word */ - unsigned cs_per_word:1; }; #endif From patchwork Fri Feb 23 09:32:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 205245 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp475094dyb; Fri, 23 Feb 2024 01:33:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX4e+AL0mc/x3+A1dcQs0xBGksKlmh6/hqadNC4REFj9nkEfq21RgX3fEct2cL+IHpKkhJO+qrPclzeyr8q7OQ57XpJ2Q== X-Google-Smtp-Source: AGHT+IF7Z5JkVZ0O/UVIHvkw5LWNUUCkW2F/x4oeLPxa91eaRMWOKtFUWKUjZeUSvc1YYZr8mKip X-Received: by 2002:a62:cd09:0:b0:6e3:5bfb:dc55 with SMTP id o9-20020a62cd09000000b006e35bfbdc55mr1220603pfg.28.1708680834353; Fri, 23 Feb 2024 01:33:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708680834; cv=pass; d=google.com; s=arc-20160816; b=zBY4JcO1uNsaiybeWEOWgn5PE0bkN+/P3ZSoxyLwUfdULs84K1aq+eQxpJOWD8ljH1 S8CtTr+RT30LZ95WTX0qLjhCfwYKidN+TsZ6dC1NCCFwDR8DSib9YyBwih8uPLuJ6Zj/ 8VentIrfN3grd5dwc6iS5xCJHIg7HsEqyeSsbZ4zGQCuGEauvBRP4ECwCIhyC/zjuGkS 8XR0taOUeVX4ecYCvTkD/5nQb2amTVf6thqGjf+ZURPFX0e9Xb6AY8FRp9umzDdIYjho YCOYC6UgqKZV1c8cUVNlu/w4sVN8zrv0cLFa6mOEwdPMubFxwhCBFO/4ynfME1Gmz/rq 4SnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=18CMWR936xnkrAvlSXRbSNlRO5ba3pEra3S0AcHTwKg=; fh=eI8HjExr0WsH9IWVPxvbaDTOw70phhIumkj8bsjnk/U=; b=CJT3AhyWG1nQ+0NMzEucE4t6/Dveqn6x+ohcVbxCakdPjfp9rWBUD+w9sBy/7w6SKP nwajSKYWnAUnk6mia4YogbK7521eLzGKxNdIP9pIvTUivdKDkPH0IUCnSNXxtaAqLJ38 7hchiBGiqaQj7wHRApFpySM2BHkmqySQvvLQdEM54/guQP7RTnhnYAq4N4eJR9RaaPI3 d6t2coJBe4G1ent+e2PKmrj9VBVTo1pfyRLPkYR1ImYdjxGk30gqKnyBlFIhrvv5lfdM d3gfAkxWeXRmC+gsRayVtS7EmyQ+A66Y4rfuuwrN6yoC7mQD42n2GY9t4SVZj1idzGj8 ty/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Sa9FhaQb; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-78019-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78019-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m27-20020a63711b000000b005dc210489fdsi12004430pgc.63.2024.02.23.01.33.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 01:33:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78019-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Sa9FhaQb; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-78019-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78019-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 29FE4286925 for ; Fri, 23 Feb 2024 09:33:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0AAC05D48E; Fri, 23 Feb 2024 09:33:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Sa9FhaQb" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0A6D5C8FE; Fri, 23 Feb 2024 09:32:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708680777; cv=none; b=GeJwK+syPlwB7o/VDGpHui9jbX9ItvazbBuHyMa2226vW2Lg6/+Acer0U/0HFd7I9lDa9RgbZQlRp4vJ/ATV+sXS5sMVTovYBFCZ4amfaFoaekTMaKisza0u336a2M0jFLgzwqk/VbUrQx/CcPYlYMGDDjJ3Gr8BTlx2Ukm8+eA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708680777; c=relaxed/simple; bh=REkJW6D+RJj2jvyMJPDaFLG/dTj5svrfGt9foiTBjY8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=b50VGpie0QdV98iUMmh2Gn1Mhou7vz2v8hT928RWFTCkBN8dDjuvPtEwZ1OEistrduNuviEpoL1mlZuau8eKHnqQ6SVwamoeGvdyfrjxRyxaPpkWBMuXjDlsyLOodJ05OtawSkb+6s7NLrg6deVC3WtfKBvwoglTGYMztgunQ8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=Sa9FhaQb; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id C576720007; Fri, 23 Feb 2024 09:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708680768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=18CMWR936xnkrAvlSXRbSNlRO5ba3pEra3S0AcHTwKg=; b=Sa9FhaQbqqqrmjHHaac/7v6EuFYGJ+hgOm/wYhunzDVXtP446su8rwD0jG64kpSji8fstq WVNgvxXmp5aiSLCpktDgXcosvgYfIqt059Nsu227QlJawU/mboKTWaF1WmcH77ESpUKVAX 3mTuBkjrAvuzrHKn770M2Ejw+xz834iQNt8YM05vaZpVMdMFsf0uplTACAwgPH4pDE1HbC AgrkU6GtGfa0NM8OOOSyNLDKlorbn+4XB+koCoIybL5ZDjQC1Itle+Euu4mw+5c9DwSdzq sl34i61DkZ76pbmNSyh4MFLaCnnl1LahhdzdowJgPAPw867+7EGJFHKmVCc8kQ== From: Louis Chauvet Date: Fri, 23 Feb 2024 10:32:12 +0100 Subject: [PATCH v2 2/3] spi: omap2-mcspi: Add support for MULTI-mode Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-spi-omap2-mcspi-multi-mode-v2-2-afe94476b9c3@bootlin.com> References: <20240223-spi-omap2-mcspi-multi-mode-v2-0-afe94476b9c3@bootlin.com> In-Reply-To: <20240223-spi-omap2-mcspi-multi-mode-v2-0-afe94476b9c3@bootlin.com> To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Miquel Raynal , yen-mei.goh@keysight.com, koon-kee.lie@keysight.com, jeremie.dautheribes@bootlin.com, Louis Chauvet X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4770; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=REkJW6D+RJj2jvyMJPDaFLG/dTj5svrfGt9foiTBjY8=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBl2GY3p7zkPy+VwQpD9XFH8rnxtAdeFSf8ySDohptW w4uVlYSJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZdhmNwAKCRAgrS7GWxAs4k50EA Ce0IEV895NOdDJXW+ddeg26Z9nT6amZJM74O/1Bq+bRck82AaZRcqiPWn5Rp+fVWAI1NVZdPoG0m6j nqzzvhB6aSxonbFKRRZye7Aj0qTTW9vSPsu3xg02o/p48QrKKvFpRfdTZPYI3jMpaBuhcohA3yKhp2 IyoV3Prgjj3GD2KL5BnddbjqWJc+M6ShWICTQSQiTUHjbXSXz42SykIrGLAdoEp32D/BAi9/epA6T/ 52/mo9J2mkZDqNiaYhxEJlxFWe/wPk7oaSerzhYDm2lQV37WuXDeWBPKvBB5VyKR2hqvTcDRWOA7R+ OfV+gGXG5JgTXgH2oS+08ySxPqDqIZV8uludN32aqsIL7ufdlhXofUHkjBhjn7xNZjkN1TEgNWVn42 VWzIhEBt+dUDZfsQIWYpsSI2vrgKqvdHHqgxhNcPmHkH9IupgW+Esh/skE5lb9uRf4tObVhRTvY8kk 9CGa3/37jWtBc7cmasfErDHDDG5nyC9KMbK9SQHf5yJoFxk0+6u+A3yYXUHG/CpRxE3hFdDSqholtQ pvXyjzxCeGBwQIA4aF7p1pEMgM7FV7EfLImyFWxznSYLyBhDhldl0gZDLfNnUk+eYj/4z3p1k/hd+i TrSJ1YTLxB7jwI7hMuQRus+oIosgR/gkkPNWr7XuROpeZ/aVjxTvEiTP+5qg== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791681714625513759 X-GMAIL-MSGID: 1791681714625513759 Introduce support for MULTI-mode in the OMAP2 MCSPI driver. Currently, the driver always uses SINGLE mode to handle the chip select (CS). With this enhancement, MULTI-mode is enabled for specific messages, allowing for a shorter delay between CS enable and the message (some FPGA devices are sensitive to this delay). The OMAP2 MCSPI device can use two different mode to send messages, SINGLE and MULTI: In SINGLE mode, the controller only leverages one single FIFO, and the host system has to manually select the CS it wants to enable. In MULTI mode, each CS is bound to a FIFO, the host system then writes the data to the relevant FIFO, as the hardware will take care of the CS The drawback of multi-mode is that it's not possible to keep the CS enabled between each words. Therefore, this patch enables multi-mode only for specific messages: the spi_message must contain only spi_transfer of 1 word (of any size) with cs_change enabled. A new member is introduced in the omap2_mcspi structure to keep track of the current used mode. Signed-off-by: Louis Chauvet --- drivers/spi/spi-omap2-mcspi.c | 67 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index fc7f69973334..36075c4416d5 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -133,6 +133,7 @@ struct omap2_mcspi { unsigned int pin_dir:1; size_t max_xfer_len; u32 ref_clk_hz; + bool use_multi_mode; }; struct omap2_mcspi_cs { @@ -258,10 +259,15 @@ static void omap2_mcspi_set_cs(struct spi_device *spi, bool enable) l = mcspi_cached_chconf0(spi); - if (enable) + /* Only enable chip select manually if single mode is used */ + if (mcspi->use_multi_mode) { l &= ~OMAP2_MCSPI_CHCONF_FORCE; - else - l |= OMAP2_MCSPI_CHCONF_FORCE; + } else { + if (enable) + l &= ~OMAP2_MCSPI_CHCONF_FORCE; + else + l |= OMAP2_MCSPI_CHCONF_FORCE; + } mcspi_write_chconf0(spi, l); @@ -285,7 +291,12 @@ static void omap2_mcspi_set_mode(struct spi_controller *ctlr) l |= (OMAP2_MCSPI_MODULCTRL_MS); } else { l &= ~(OMAP2_MCSPI_MODULCTRL_MS); - l |= OMAP2_MCSPI_MODULCTRL_SINGLE; + + /* Enable single mode if needed */ + if (mcspi->use_multi_mode) + l &= ~OMAP2_MCSPI_MODULCTRL_SINGLE; + else + l |= OMAP2_MCSPI_MODULCTRL_SINGLE; } mcspi_write_reg(ctlr, OMAP2_MCSPI_MODULCTRL, l); @@ -1371,15 +1382,61 @@ static int omap2_mcspi_prepare_message(struct spi_controller *ctlr, struct omap2_mcspi *mcspi = spi_controller_get_devdata(ctlr); struct omap2_mcspi_regs *ctx = &mcspi->ctx; struct omap2_mcspi_cs *cs; + struct spi_transfer *tr; + bool word_delay_is_zero; + u8 bits_per_word; + + /* + * The conditions are strict, it is mandatory to check each transfer of the list to see if + * multi-mode is applicable. + */ + mcspi->use_multi_mode = true; + list_for_each_entry(tr, &msg->transfers, transfer_list) { + if (!tr->bits_per_word) + bits_per_word = msg->spi->bits_per_word; + else + bits_per_word = tr->bits_per_word; /* Only a single channel can have the FORCE bit enabled + /* + * Check if this transfer contains only one word; + */ + if (bits_per_word < 8 && tr->len == 1) { + /* multi-mode is applicable, only one word (1..7 bits) */ + } else if (bits_per_word >= 8 && tr->len == bits_per_word / 8) { + /* multi-mode is applicable, only one word (8..32 bits) */ + } else { + /* multi-mode is not applicable: more than one word in the transfer */ + mcspi->use_multi_mode = false; + } + + /* Check if transfer asks to change the CS status after the transfer */ + if (!tr->cs_change) + mcspi->use_multi_mode = false; + + /* + * If at least one message is not compatible, switch back to single mode + * + * The bits_per_word of certain transfer can be different, but it will have no + * impact on the signal itself. + */ + if (!mcspi->use_multi_mode) + break; + } + + omap2_mcspi_set_mode(ctlr); + + /* In single mode only a single channel can have the FORCE bit enabled * in its chconf0 register. * Scan all channels and disable them except the current one. * A FORCE can remain from a last transfer having cs_change enabled + * + * In multi mode all FORCE bits must be disabled. */ list_for_each_entry(cs, &ctx->cs, node) { - if (msg->spi->controller_state == cs) + if (msg->spi->controller_state == cs && !mcspi->use_multi_mode) { continue; + } if ((cs->chconf0 & OMAP2_MCSPI_CHCONF_FORCE)) { cs->chconf0 &= ~OMAP2_MCSPI_CHCONF_FORCE; From patchwork Fri Feb 23 09:32:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Chauvet X-Patchwork-Id: 205246 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp475134dyb; Fri, 23 Feb 2024 01:33:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVubetjjOfTcIKv7yz7HFZYHQG6eK/iZDjVckZLEz6pWU5bql9cfj8dMecAyaoWHAue2gxnnCz44H7+rmTIyfZY43UbSg== X-Google-Smtp-Source: AGHT+IFT6DqTg1JQnqG/pLQJ5u1tOdyveG8ghU0RWszn+vPEisXPjbZ3rH1lSN/djr5EZCxP2Qa0 X-Received: by 2002:a05:622a:1814:b0:42e:3b7c:4ec0 with SMTP id t20-20020a05622a181400b0042e3b7c4ec0mr2011655qtc.15.1708680839713; Fri, 23 Feb 2024 01:33:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708680839; cv=pass; d=google.com; s=arc-20160816; b=M8iYGeusGx8ICouW/iyAG+qjQZGSOr3dgXQgqqIc39LP4vZksdvLLA/giRu7EH6X7h xp4cWxWG+dTk71zL3XMSY/+nntPyBV6Hvo8YiGvr9HXFYukL7bOsmNRFvekAEa4WAknv kzNCoj5FgMJeFqBH+URplyY0x21mNyo19Ak1zAZ42DwSnx7XgIQtpEZiGEg9l6mJBTrn cb+6LSh0xy5kLtKgAdIv023kC+e4mLNk/NsQDeu3rsjFv4/c4iYWWHSsPde0wzI9LyzT w5SwkmM/XdJW1tf36oRryxDxvkj0/AfyRDQ73BqroSxsDDa43aRbQ6qtH83tF4ggBWbO mDHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=x2oRLe0RRlPq8BsMAid2UDLfRRqpSJFqF07a/MXQocI=; fh=eI8HjExr0WsH9IWVPxvbaDTOw70phhIumkj8bsjnk/U=; b=rOLZJEzpsHXjo76l7HRHNEZTI+zs3rEXJVJ2KuHHk8aQj6AaWPzaMSXol8mT438a/5 gUBMoNXQ4dH2H8rXw/K9/cRV8q3zcIEVqn5Fv9NAvgMxpI2PH9XkqlsfPrNzIoVPRrBz UEwvOAcJyKHzGN4WJoa8+zu3xwinkeqPWIrAB7cAsX4TeFajss/HKTABx3srpYTbwGih X7KAMhWKaCnh99IAP1NP/NRQ0VtXVjUNQ2g20EFjacs0MV5Z2fbR8t/fh5jGwGaasXsY 677FGtcECSZaZie7VPLHvxtVCUADue8PR2IyaUs8JbCuCIlYdkAqntgoSfDZ3cRGfcnd 8eLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=e5FkuvEU; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-78020-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78020-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d1-20020a05622a100100b0042e64596572si481947qte.583.2024.02.23.01.33.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 01:33:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-78020-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=e5FkuvEU; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-78020-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-78020-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 77AE21C2374E for ; Fri, 23 Feb 2024 09:33:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9909D5D499; Fri, 23 Feb 2024 09:33:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="e5FkuvEU" Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E43A21A731; Fri, 23 Feb 2024 09:32:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708680779; cv=none; b=fuwxbviTqkX1LRWh7N4uf2dk56dSicgXS4gFR5M0aw4cCv9e/cXUmq5DM/eljcRgf6U2xEGyx7zpLA3LTUTKlrMJ6GzXTNkMq7c3GUFp0+0KNGZj4D4xrSjKRo8CObAkwglVh2CZC6eFHgFbQCUvrzwJeBnRrD2cd4jbRJ3JV80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708680779; c=relaxed/simple; bh=e4RXBe7SdrRLGGStxY/kvqt/kAPWHBSBirHEGGNnVHY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rYwY9dipaFyv1OgyVklSj+uHjdvMdScWkejES8R29gd6+z/QykzG4vy4CWRFUeztGh6ekGhiq2hcMwgHdE98LEE2MRvk658EEGIlxu0FGa+I4xYV5b/csZ+7HGSyaT+Q6QXc9PBzo+d1tp/uzufXb2QcagiaPYChC9peIwRmo3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=e5FkuvEU; arc=none smtp.client-ip=217.70.183.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 5792D20013; Fri, 23 Feb 2024 09:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708680768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=x2oRLe0RRlPq8BsMAid2UDLfRRqpSJFqF07a/MXQocI=; b=e5FkuvEU2Mtn0cO+/Pa1PC8U8ugIYJVnlW4u1isMnfRprKNsfXGnJv0iLEelAWSBkPl1tH 6B0/VxrzJaFqOYsWkxXb+itolf3E4GBHd8De+VJHYTFVe7W5lz+ZjJYyWd7shkQSQxO1H5 v9GX8t6lPIvjgjoeWbNr5tU8SyXmZDP1EBO828Ks0U7oBxUacIDgoljkHKg+AcjzPdBwaQ sD3IFPuSOI2/T1JIuIonLCdH6b4SFvzaYrLoZco63ffJwl88Pv9WdZ9PKAl5D7RgHt0y4q Eqv9VIy+ZOIeMMEIfmLHehO9FidUyC+yM6dw6lPs1MQvNPS5KlAXIcM6Qv3KaA== From: Louis Chauvet Date: Fri, 23 Feb 2024 10:32:13 +0100 Subject: [PATCH v2 3/3] spi: omap2-mcpsi: Enable MULTI-mode in more situations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240223-spi-omap2-mcspi-multi-mode-v2-3-afe94476b9c3@bootlin.com> References: <20240223-spi-omap2-mcspi-multi-mode-v2-0-afe94476b9c3@bootlin.com> In-Reply-To: <20240223-spi-omap2-mcspi-multi-mode-v2-0-afe94476b9c3@bootlin.com> To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Miquel Raynal , yen-mei.goh@keysight.com, koon-kee.lie@keysight.com, jeremie.dautheribes@bootlin.com, Louis Chauvet X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2499; i=louis.chauvet@bootlin.com; h=from:subject:message-id; bh=e4RXBe7SdrRLGGStxY/kvqt/kAPWHBSBirHEGGNnVHY=; b=owEBbQKS/ZANAwAIASCtLsZbECziAcsmYgBl2GY3HapgT8vFrAzfkho/rXRT8omzMteYRE6HA4M9 wXk7xeeJAjMEAAEIAB0WIQRPj7g/vng8MQxQWQQgrS7GWxAs4gUCZdhmNwAKCRAgrS7GWxAs4mxzD/ 0debrX/LIA5gA7Z8tqa7TLIMcoQ0g8WrhuUEvSDtPE+T97+U0bdmBZoTTWtDv517MiqFcjO8JUjKJo 7rVm1WjO4FKfAZX3MV0vXWPsPqQsmSTsCNEofs1AYGhJV67el0jM+NCfWnZcRX3sxEhGbvgmGUVmx0 3CitqWMhGGCVsz8H3UncBec47ut7lHvmNpQ1oY41KyLbwmizqCoIwxJYMimwa6rTRAgu4+CWIkwdt1 ZytzZMlcxrz8p4pb62qv3ei7KE/o7pU3RMNTe39LoAiReSyjhSXlMgDgFXVWhlgZUYgxLdTxKa70Lw Av41sUyxGTFN/HMMFoQFdQ04/5L5WmohvgwjC00VLPaMa+itxmxlOYOcxRWqu+/09NimNImd3GhRf4 hso9WljUe9vPBxl6qhfax3iZ4lZH1KcP9jgmHPpzD05cohjIGXBn8gks6WJuS8MP7UtJFJFtQPCk+v PQbTqcz6135eTKjdL1XyoApJzYHYuUoqNEr0QV1G/kzleFVBH+y+PZeC0YETr3J6o9hFeGX1rObvvP 52fGXdSmGd7fWwi4QnR1faq2TnnBtxLtw015zUhcWJbiNSRLNyTwICzzzxTkx6aUgeEu2OzJtLVq2d +GqOShz/Yve+48NUEGNi010THIKw3+e/j84uC8+8YeK9PXJc1IJnEdFpP+Rg== X-Developer-Key: i=louis.chauvet@bootlin.com; a=openpgp; fpr=8B7104AE9A272D6693F527F2EC1883F55E0B40A5 X-GND-Sasl: louis.chauvet@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791681720578727650 X-GMAIL-MSGID: 1791681720578727650 Enable multimode when a transfer of multiple small words can be transformed in a transfer with a single bigger word. This is allowed as long as the result on the cable is the same, so word_delay must be zero. Signed-off-by: Louis Chauvet --- I am not sure if this is the best place to put such "optimization". I think this improvment should be in the core, as it is not depending on the driver itself, but I think Mark suggested something like this so if that fits to what was expected, I am happy to share this small improvement. --- drivers/spi/spi-omap2-mcspi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 36075c4416d5..f64cc8cc7587 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1397,14 +1397,26 @@ static int omap2_mcspi_prepare_message(struct spi_controller *ctlr, else bits_per_word = tr->bits_per_word; - /* Only a single channel can have the FORCE bit enabled /* * Check if this transfer contains only one word; + * OR contains 1 to 4 words, with bits_per_word == 8 and no delay between each word + * OR contains 1 to 2 words, with bits_per_word == 16 and no delay between each word + * + * If one of the two last case is true, this also change the bits_per_word of this + * transfer to make it a bit faster. + * It's not an issue to change the bits_per_word here even if the multi-mode is not + * applicable for this message, the signal on the wire will be the same. */ if (bits_per_word < 8 && tr->len == 1) { /* multi-mode is applicable, only one word (1..7 bits) */ + } else if (tr->word_delay.value == 0 && bits_per_word == 8 && tr->len <= 4) { + /* multi-mode is applicable, only one "bigger" word (8,16,24,32 bits) */ + tr->bits_per_word = tr->len * bits_per_word; + } else if (tr->word_delay.value == 0 && bits_per_word == 16 && tr->len <= 2) { + /* multi-mode is applicable, only one "bigger" word (16,32 bits) */ + tr->bits_per_word = tr->len * bits_per_word / 2; } else if (bits_per_word >= 8 && tr->len == bits_per_word / 8) { - /* multi-mode is applicable, only one word (8..32 bits) */ + /* multi-mode is applicable, only one word (9..15,17..32 bits) */ } else { /* multi-mode is not applicable: more than one word in the transfer */ mcspi->use_multi_mode = false;