Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp422001rdb; Thu, 1 Feb 2024 12:21:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0FgUddtvwUn8waDypqDYGvPlb5IykY6owP/VLFXnbWVUwDghIiip3xgbtEdH5Ud1MifVK X-Received: by 2002:a05:620a:2908:b0:784:15d:dfab with SMTP id m8-20020a05620a290800b00784015ddfabmr266000qkp.34.1706818906697; Thu, 01 Feb 2024 12:21:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706818906; cv=pass; d=google.com; s=arc-20160816; b=dYUm/vuLJPhBdSbkz4gEavSxIxw/bsBGTQM56K+aRPz9llSfXYea6UU/ME1WaCzE/b GDX8XkcCXfEqVjEd+/iTw+l4FSH6Iovt1VlqXGfnW6VWBWtekpjRj0PaDiDNGzgZyAu+ RPxsQD+COXOG0rTrJBDUtFHseJ5e6yOL61e52M4kDlTfoaxwsK7sc5ZYVHyJ3qfvxB5+ +Bw3UkVTewjCBk4+XDmY488tKp2iWlMLPciRVwRCObvtMnJozr7p15jjtOZK0y7qCw+p DnlH6mihbIecYzNO8OsamzYvLbKrfVZhgKce2NxnJ7XvINmuh95l6Rs1ebzzm/cwEOrp Vzdg== 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=v3exutaOvYPgTe3cEEJyTBh83JGpxgaVCiB0NjI5/qY=; fh=qrqwHYVecMmsu0HmkCQSCpa0xSHghqk5o9P2yr3Ao1I=; b=gG1j/2lsYrXE85FTv7sW5bNPl103H7MpPKz30Rf8vLjdLBOXOUTGeJZb+K/UgKGH/S XHMUjaY/csdcnaB/uh2SXT6WTGiWroaVVCXSLwZWE773CGfUDIGEKgRSjfDbDUpI3+kk Tjp6VxqwGHE01+UCe0XduuOYvlXXAfQeYKnxP4uQEWkUtp8pQ8RfW56uwAwT26cF/5xM 8m79I6wWpB4tTpD2n9sek4mMsIq0l5AkgTo9365cwQrevncuKg6Rxbsjyyo57L2EoxMT luMtysEG9MgAs8BR5e2quh+G79ih6coTFDgtbsJ6mvgycENISqT+PBSudyiy2Er0xbUa DRCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bigler.one header.s=key2 header.b=UppCvTfc; arc=pass (i=1 spf=pass spfdomain=bigler.one dkim=pass dkdomain=bigler.one); spf=pass (google.com: domain of linux-kernel+bounces-48808-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48808-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCU87cA9L4A0NwhYqdgoluREk3VVt9FyVFgamlkn9/mZXtV8gekmsS2KfEC1tTS4EZ7rR9BKrmSkgZED9Tjv15aX2cnM694kgD2INfit2g== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id qs22-20020a05620a395600b007833b7a1170si361407qkn.588.2024.02.01.12.21.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 12:21:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48808-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=@bigler.one header.s=key2 header.b=UppCvTfc; arc=pass (i=1 spf=pass spfdomain=bigler.one dkim=pass dkdomain=bigler.one); spf=pass (google.com: domain of linux-kernel+bounces-48808-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48808-linux.lists.archive=gmail.com@vger.kernel.org" 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 5FA041C22DE8 for ; Thu, 1 Feb 2024 20:21:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACFE98563D; Thu, 1 Feb 2024 20:21:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bigler.one header.i=@bigler.one header.b="UppCvTfc" Received: from relay.yourmailgateway.de (relay.yourmailgateway.de [188.68.63.162]) (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 AF71B84FDC; Thu, 1 Feb 2024 20:21:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.68.63.162 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706818899; cv=none; b=gFHXTin7XEHm3tms7lPyv6aYWbuauW9D9/O7Wurnc/E5ql2G062rT29CxQq/KeWdLMpYXZpl0cSklidkIUgWRHZ5LYob/xFCbeZytMLYMtNUdgEMF/a93r1EQFx6hDrnYZBAPkJb2DtUKfu+7SOaJlRpzsduV2UL9l0vG9V/0ME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706818899; c=relaxed/simple; bh=uWRxYj8XRltiAC9tPZ020F7sdwr+RbT8boPBU4qJhlc=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=XI84YpqgGjOCRLam7NGE3Mq0Ie7/ZSygVka7LVgDYxDbSEF2sEuyawfrPJXH0gMgSzI1xzIMHYhmqas98mv4pysM25Ef4vjmXN4mwb92u/6Y0+duBBE4wUpS12MBOP5gCTpPnzKn0KRgHLMWAHhuq8k8K0u/SvMh0SFYw2DSK84= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bigler.one; spf=pass smtp.mailfrom=bigler.one; dkim=pass (2048-bit key) header.d=bigler.one header.i=@bigler.one header.b=UppCvTfc; arc=none smtp.client-ip=188.68.63.162 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bigler.one Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bigler.one Received: from mors-relay-8201.netcup.net (localhost [127.0.0.1]) by mors-relay-8201.netcup.net (Postfix) with ESMTPS id 4TQqrP5j1Rz3tJR; Thu, 1 Feb 2024 21:14:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bigler.one; s=key2; t=1706818485; bh=uWRxYj8XRltiAC9tPZ020F7sdwr+RbT8boPBU4qJhlc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=UppCvTfcA2RgJNoXTU8qeaJLLREcPUA5V4YDOcX9qhBOpLF+nEvRMg6QQ0OrBlIRR FrozWJ4XYhHiWdLL3w194THXHU4KTgeoGr5yuZcFXrDaerMMFASp1yBcIQkwnsRLFq qydIcRb+1quMzVjs6Y3h49dpjtyV8+X0ogoplcW6uHOZOuHC6MWWMeU1A/IHON6vja XcZiqix0WMDcWBH9HrWqH6RGG0tHqGCz9Vu4ukNc0nKkKdTtny1rvC4H13THZiARh+ lJ3mO3/X0S2Vcxh/ptbw+p47R7Or1ljYOeszbFrUZLw0upohr5y3uwzx+43mVH4LIV LMWuxBGyBwz8g== Received: from policy02-mors.netcup.net (unknown [46.38.225.35]) by mors-relay-8201.netcup.net (Postfix) with ESMTPS id 4TQqrP4xJdz3t7W; Thu, 1 Feb 2024 21:14:45 +0100 (CET) Received: from mx2fc6.netcup.net (unknown [10.243.12.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by policy02-mors.netcup.net (Postfix) with ESMTPS id 4TQqrN3DZNz8svC; Thu, 1 Feb 2024 21:14:44 +0100 (CET) Received: from [192.168.1.24] (adsl-84-227-96-175.adslplus.ch [84.227.96.175]) by mx2fc6.netcup.net (Postfix) with ESMTPSA id A6C7048EEA; Thu, 1 Feb 2024 21:14:39 +0100 (CET) Authentication-Results: mx2fc6; spf=pass (sender IP is 84.227.96.175) smtp.mailfrom=benjamin@bigler.one smtp.helo=[192.168.1.24] Received-SPF: pass (mx2fc6: connection is authenticated) Message-ID: Subject: Re: [PATCH v4] spi: imx: fix the burst length at DMA mode and CPU mode From: Benjamin Bigler To: carlos.song@nxp.com, broonie@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, linux-imx@nxp.com, stefanmoring@gmail.com Cc: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Thu, 01 Feb 2024 21:14:39 +0100 In-Reply-To: <20240201105451.507005-1-carlos.song@nxp.com> References: <20240201105451.507005-1-carlos.song@nxp.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-PPP-Message-ID: <170681848016.16773.8628634408198911382@mx2fc6.netcup.net> X-Rspamd-Queue-Id: A6C7048EEA X-Rspamd-Server: rspamd-worker-8404 X-NC-CID: eOEbwlsnu2A8UH1oqf6GVIXsysxMrcadamR+vO9LU4MI+So= On Thu, 2024-02-01 at 18:54 +0800, carlos.song@nxp.com wrote: > From: Carlos Song >=20 > For DMA mode, the bus width of the DMA is equal to the size of data > word, so burst length should be configured as bits per word. >=20 > For CPU mode, because of the spi transfer len is in byte, so burst > length should be configured as bits per byte * spi_imx->count. >=20 > Signed-off-by: Carlos Song > Reviewed-by: Clark Wang > Fixes: e9b220aeacf1 ("spi: spi-imx: correctly configure burst length when= using dma") > Fixes: 5f66db08cbd3 ("spi: imx: Take in account bits per word instead of = assuming 8-bits") > --- > Changes for V3: > - include > Changes for V4: > - keep the includes sorted alphabetically. > --- > drivers/spi/spi-imx.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c > index 546cdce525fc..f7990ac2c654 100644 > --- a/drivers/spi/spi-imx.c > +++ b/drivers/spi/spi-imx.c > @@ -2,6 +2,7 @@ > // Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved= . > // Copyright (C) 2008 Juergen Beisert > =20 > +#include > #include > #include > #include > @@ -660,15 +661,14 @@ static int mx51_ecspi_prepare_transfer(struct spi_i= mx_data *spi_imx, > << MX51_ECSPI_CTRL_BL_OFFSET; > else { > if (spi_imx->usedma) { > - ctrl |=3D (spi_imx->bits_per_word * > - spi_imx_bytes_per_word(spi_imx->bits_per_word) - 1) > + ctrl |=3D (spi_imx->bits_per_word - 1) > << MX51_ECSPI_CTRL_BL_OFFSET; > } else { > if (spi_imx->count >=3D MX51_ECSPI_CTRL_MAX_BURST) > - ctrl |=3D (MX51_ECSPI_CTRL_MAX_BURST - 1) > + ctrl |=3D (MX51_ECSPI_CTRL_MAX_BURST * BITS_PER_BYTE - 1) > << MX51_ECSPI_CTRL_BL_OFFSET; > else > - ctrl |=3D (spi_imx->count * spi_imx->bits_per_word - 1) > + ctrl |=3D (spi_imx->count * BITS_PER_BYTE - 1) I think that will not work for drivers which dont use bits_per_word=3D8.=C2= =A0 https://lore.kernel.org/all/20230917164037.29284-1-stefanmoring@gmail.com/ > << MX51_ECSPI_CTRL_BL_OFFSET; > } > } Best regards, Benjamin Bigler