Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp170205lqr; Wed, 5 Jun 2024 02:27:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU0Nu25F+M0ts8iKqOSPMG96uAtzfL2rbQzS8JN4370UfYrKv48lXvSOYm2jpNZEU3NKeVTTv0fSiypFJDYaG+t5R4zquXry8EC9EDAzg== X-Google-Smtp-Source: AGHT+IGz8w6X6/v1cQGqCHDdvF6P4xAr6Wid7uRjei2DxmM1YjKe12VDJquPJqzhD5r6MZ0L+7Ns X-Received: by 2002:a05:622a:11c2:b0:43a:dd5b:d306 with SMTP id d75a77b69052e-4402b69ee2fmr23630831cf.55.1717579623190; Wed, 05 Jun 2024 02:27:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717579623; cv=pass; d=google.com; s=arc-20160816; b=l/SDb6f3uxGwsrwnMR7u9ktWEqH83E3z02jDzg+RtnU1FGNR6UioN3GPIgobYhNyrM 8bcpSZPLrmqcsd90Nl9RUIFBWJ0YbhRKFAXflxti7ypQoIOJjE906EgxuGMVXzh9icro xg9ccLkiJJWorTOU6xdksWdX3Cm4m2E4tXODCJ+cO+aYOjlYgLZ1a9mKCaSPE/HllCfG aQjihBoom3c29CyV7qed0uC4EISlGdoscKORtSwKcn+L52goV7/m0R/EMc6BVKDTYS8A zlwpaTdUlBIXlrAXnlZkxyiiTvOPDpzXExUv9Qv7JA3SHD55iHoemmsSYBHw6Jq2MFUm f+PQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=1UmSXewXk4xoFkR0JLkcRp552PFqHFEUhSIEEN2KqQc=; fh=sWdyyv5hZwWYzCjMM40ovtwQmC+bbHYZcjxPn1uHS8w=; b=vvDmisQainh5ctqZtDTYng9v8EmxmKl2+0q5DbXrfEw1eC+flrX9ipwplFXYH0uF28 aWA+XJ50lUV7s4sxxgNj2F/22rc+mWWmLdYezVm1Gcv1UgvCexCEwjledfuQxmrSn6xN 1yhh0NlxqsWkpXYTRK7KUw/XNNJPp/3WO87S1g8spFc5wjBDVYImqB9T0GV1CYf7cjNW pYklQu52RrlbJYBTe2WPgkqTC/yCbsz3lpqpqhU98W6dTVVzRVZ4Hbvxhs5y8iKKhxaR r1O81KRexPxQidL1UtfIGDFNdmsSmgT4kBH7UTe6HA5a8I9scwYtiXhJCgFLhRHDe60U paHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fPSSQDl5; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-202092-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202092-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43ff257eb63si121654351cf.392.2024.06.05.02.27.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 02:27:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202092-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fPSSQDl5; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-202092-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202092-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 CF3181C2291E for ; Wed, 5 Jun 2024 09:27:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7BAB18FC7D; Wed, 5 Jun 2024 09:26:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fPSSQDl5" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 619D5200CD; Wed, 5 Jun 2024 09:26:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579613; cv=none; b=cWaJ4qhkaHEP9VWM7c3Va+KhjprwgFUbJTOcOIL0Dc2Cy1g5JQoKJ7dU+lhpGrUCp/fYJQ0uU8W5c+K9+gMZZWmICqEdU78n4stNuvEqbHhvItOV3P/KBTP5oGujI5N5hRbQ+pHJsUdn9r9L3qMqIEBkv1MhNYc3+duJUoxcKmg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717579613; c=relaxed/simple; bh=Y7dorVYxePR9VWygFujvcqMnB0Us5J/pvoyDgyJ/vhQ=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=gps3AOWJWNdOj56ndAbjsyQyNcu0nv5JxrDbOuayWefHLRFZ4ANLgqjH/Ha0RdODFHheYxR33dENIv42B2z++x3dCMSso6aPi9Gf1v37BherzCxdvlAw8026tFhvkZEtHcUlU4IqCYMlEL38XQwBq5g2jtGjzIFJMedfV65P31E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fPSSQDl5; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-42139c66027so19066805e9.3; Wed, 05 Jun 2024 02:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717579610; x=1718184410; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=1UmSXewXk4xoFkR0JLkcRp552PFqHFEUhSIEEN2KqQc=; b=fPSSQDl5gHxGN6DQi99Som9P/HOASwgUOkZeE1bJJ1RRVAtqtpycintEu8UXXOA/8e pGXK4BNJlXcHUno7jwBJxCKF5QXOdcUpjlQMVC3FwziRbfLEIHwFKYmjnxUCx5eca59s 8cxA09RQnEGB1aUMxrzYjX2DiSNI6JjnBIn/55NIArTvtjG0WPoPNUU3sYWpjbr7V3le tFVguuLc+bQ4tRaXSSpOd+39drjLEGz7Fqh5Hj3V3ZNQN6jgkGiXe2SuM2PUJgDqaTSv wr14iV4uIR98zEIEy47Fwa17i2cv6p7AOs9/MMpARKzlndWEfNs5oSZzALDCZZ/7j3xa nreA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717579610; x=1718184410; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=1UmSXewXk4xoFkR0JLkcRp552PFqHFEUhSIEEN2KqQc=; b=t8BYVZUBGKIqSViUaX0GEBYuiAh1LSN8/4AF1c1xPrLKKOwqNiS4Z2Az/YDoADXtBv 7ZN17y0X6CmNwbVMPw/srvddi9EM3SQPAXJNyT2N3e4a21CGXLkSeNrDxKoIwsuQuHSg uyw0oNfBH4kaJNHtd/UqlpZwtauIOr9aYRgHhAthVzCJmAO2FLBpjTy0fxudCrphYmcA ncqjOzM/H3tY3MlRAvMQruna72o2MivdFYErb6QM4sx8XDzuU0kbiJ3E1ob9my1TX2Di P8E6uyOGGXw5DjAe5aQrPTIHMMndUD4TchsfEJsaJHsacrvr43XSVcSTnBIjGN6joEFR vyRg== X-Forwarded-Encrypted: i=1; AJvYcCUrFdjIWOS72wmrT/UAVNX5bg3r7BdVXoOMal2f5YDgoq37Zjd0My9ickDx2RrEAHObREtW35qpv5Rc9LGfHyRsy2BmUMmwYi+N8DfMKgPaHHiLaJD5CiunM4y2v715NWjzOiotkA6Hsv7JaV5nmJ9PDFCxTq0BYDEPcez5BMPfyc/3KQ== X-Gm-Message-State: AOJu0YyDlN6c6UhnJFnamGbQpnFBbrpwO3HkRJ+3wWXD3PQWQR/7gryD F5EgqfTKRk3KiPjFj0PbeHcoIX+nwcBnwH6c5JgqIryKcBwwusxV X-Received: by 2002:a05:600c:4ed2:b0:421:565b:e71c with SMTP id 5b1f17b1804b1-421565be9ecmr14133675e9.14.1717579609319; Wed, 05 Jun 2024 02:26:49 -0700 (PDT) Received: from ?IPv6:2003:f6:ef1c:c500:ee59:d953:f148:40ba? (p200300f6ef1cc500ee59d953f14840ba.dip0.t-ipconnect.de. [2003:f6:ef1c:c500:ee59:d953:f148:40ba]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-421581490c2sm13780065e9.37.2024.06.05.02.26.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 02:26:49 -0700 (PDT) Message-ID: <0c0d1b2030960cdc2840d84645538fe3a9c8b9a6.camel@gmail.com> Subject: Re: [PATCH v3 2/6] spi: bitbang: Implement support for MOSI idle state configuration From: Nuno =?ISO-8859-1?Q?S=E1?= To: Marcelo Schmitt , broonie@kernel.org, lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, nuno.sa@analog.com, dlechner@baylibre.com, marcelo.schmitt1@gmail.com Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Date: Wed, 05 Jun 2024 11:30:35 +0200 In-Reply-To: <811a2771d93c16b48fb37286e648a03171c8d2bc.1717539384.git.marcelo.schmitt@analog.com> References: <811a2771d93c16b48fb37286e648a03171c8d2bc.1717539384.git.marcelo.schmitt@analog.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2024-06-04 at 19:42 -0300, Marcelo Schmitt wrote: > Some SPI peripherals may require strict MOSI line state when the controll= er > is not clocking out data. > Implement support for MOSI idle state configuration (low or high) by > setting the data output line level on controller setup and after transfer= s. > Bitbang operations now call controller specific set_mosi_idle() call back > to set MOSI to its idle state. > The MOSI line is kept at its idle state if no tx buffer is provided. >=20 > Signed-off-by: Marcelo Schmitt > --- Some minor nit below in case a re-spin is needed. Anyways, Acked-by: Nuno Sa > =C2=A0drivers/spi/spi-bitbang.c=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 | 24 = ++++++++++++++++++++++++ > =C2=A0include/linux/spi/spi_bitbang.h |=C2=A0 1 + > =C2=A02 files changed, 25 insertions(+) >=20 > diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c > index ca5cc67555c5..3dee085d3570 100644 > --- a/drivers/spi/spi-bitbang.c > +++ b/drivers/spi/spi-bitbang.c > @@ -63,21 +63,28 @@ static unsigned bitbang_txrx_8( > =C2=A0 unsigned flags > =C2=A0) > =C2=A0{ > + struct spi_bitbang *bitbang; > =C2=A0 unsigned bits =3D t->bits_per_word; > =C2=A0 unsigned count =3D t->len; > =C2=A0 const u8 *tx =3D t->tx_buf; > =C2=A0 u8 *rx =3D t->rx_buf; > =C2=A0 > + bitbang =3D spi_controller_get_devdata(spi->controller); > =C2=A0 while (likely(count > 0)) { > =C2=A0 u8 word =3D 0; > =C2=A0 > =C2=A0 if (tx) > =C2=A0 word =3D *tx++; > + else > + word =3D (spi->mode & SPI_MOSI_IDLE_HIGH) ? 0xFF : 0; no need for () > =C2=A0 word =3D txrx_word(spi, ns, word, bits, flags); > =C2=A0 if (rx) > =C2=A0 *rx++ =3D word; > =C2=A0 count -=3D 1; > =C2=A0 } > + if (bitbang->set_mosi_idle) > + bitbang->set_mosi_idle(spi); > + > =C2=A0 return t->len - count; > =C2=A0} > =C2=A0 > @@ -92,21 +99,28 @@ static unsigned bitbang_txrx_16( > =C2=A0 unsigned flags > =C2=A0) > =C2=A0{ > + struct spi_bitbang *bitbang; > =C2=A0 unsigned bits =3D t->bits_per_word; > =C2=A0 unsigned count =3D t->len; > =C2=A0 const u16 *tx =3D t->tx_buf; > =C2=A0 u16 *rx =3D t->rx_buf; > =C2=A0 > + bitbang =3D spi_controller_get_devdata(spi->controller); > =C2=A0 while (likely(count > 1)) { > =C2=A0 u16 word =3D 0; > =C2=A0 > =C2=A0 if (tx) > =C2=A0 word =3D *tx++; > + else > + word =3D (spi->mode & SPI_MOSI_IDLE_HIGH) ? 0xFFFF : 0; ditto (and for the txrx8 function) - Nuno S=C3=A1