Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp481440rdb; Fri, 26 Jan 2024 01:14:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IFC6KZYMA9APkHt7k0kRD/k65IXaKnPo5ZhREMleetpSrDZF8MU0N5I/v8mCbr4DUltf9ic X-Received: by 2002:a17:906:515:b0:a30:e1b7:91e with SMTP id j21-20020a170906051500b00a30e1b7091emr283447eja.33.1706260446307; Fri, 26 Jan 2024 01:14:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706260446; cv=pass; d=google.com; s=arc-20160816; b=nWsfXVbBcnSBJrlShwqRgXOV8d3mihai/5JYOxSL4FnsCzzJkOHAusSjfCr40rgo6N 1Avgd3b/rwcYsFLOmS7wVfuBV+rVG7c/CWyNXHH8REJY2K+jFmF2dGUdUrCUwt77RjED Ijj5mLQ9LODw5xSfDv45IMYsPKYSrAN7akuCPYAmKZ8NQT0KMg4X8Lw2Duub19klKQee b/FiQ6hbV3oyMCxHkYyfqusQBY1zAc2drMVVYvllI/nZi362jQ/uVk/jtKyt1+xw/OWV 0OhFMxHALZsHz6YbNst4wLxtmZ5QgTGHuI6FDclKEH37ZOsbrvXTfb+5VKLlr27JBE/w MsFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=7rrGeLbPaiEO5WdfZAroSibRcJzRjQTQSH2UK6pfWWU=; fh=vtZDkA5fMeyCqvqTCvwSwrx5GuW0ZT717AFl2MlaMV8=; b=qO8mp6lm0ZlPEMLJzS6RJ4gUkJjiEEhUaKFrpwbJwJRwA/Kwmz2s2lSd1ZzpKPvs3A PRlBOLoGv3fLq9Qg253Vp2DPEaDJA9iKjaikTCveAj/G1UeM6bgEuYj1IHqIGcdJc5EI dkYU/8wXy4iQn/5Ryo8+BHQDj+I7qeSkkkZg2kmmJo+pMZAhTVKlCwPqde5UDfw5N4nu wXDNHJun9+UHE1gOmTGu39q6JwNrUO7RTcY/IyAxaH/S2+5c3FZpbjrY14kHWfJC1Hmd NJzfbTwgb+A4BPXW178BOmyirnHSYYffzJR3V4xOrocY7ZL2LGekB540vsIXKWL/EYp9 yz9Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cGhbUI0d; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-39752-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39752-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u9-20020a170906068900b00a2ed1db3626si394604ejb.570.2024.01.26.01.14.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 01:14:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39752-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cGhbUI0d; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-39752-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39752-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 am.mirrors.kernel.org (Postfix) with ESMTPS id DE9AB1F2805F for ; Fri, 26 Jan 2024 09:14:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0302C6D1D3; Fri, 26 Jan 2024 08:13:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cGhbUI0d" Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 64F906D1A8 for ; Fri, 26 Jan 2024 08:12:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706256780; cv=none; b=V+RWtHNI+mZqPhiG3VeOxy1P/i3EfuTPSXoFrrO4Qgvr1dRaaUJvMcvwGqXJ8+wqcQ0RcIUfSWgFNuPVlR2YaWQb30btHOJfPMK32enKDkYekm8IUjg1BicEs1jty8JCxA//a8Un8PfqkwK8meb8dQAv9FWBos60SBNiLe+Hvg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706256780; c=relaxed/simple; bh=j0KyPZxIPo0uWsEdhfU4pbbVE5DXmn5Ni8Prmsb0wmQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kNZNwfhFuioastfD/IlfFOAzNoHjX366wsdjXovxrow7mx2/xI5QjEcFyTuBsfiTn88rnkN88a+Yqa07HCVExUHjZdYYzidXogqzAiRdRGXI44vRKysFEChxNjCfJKjsFf1Ze/b7+kKUFOod5sA9Ea3e9NAt/QnZOI/ygpq1vpY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=cGhbUI0d; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-338aca547d9so127856f8f.0 for ; Fri, 26 Jan 2024 00:12:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706256776; x=1706861576; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=7rrGeLbPaiEO5WdfZAroSibRcJzRjQTQSH2UK6pfWWU=; b=cGhbUI0ddbkg1yqHF5QGLw29FKlMaq4LhI9mCSEsD25FDzarB3MzZo1b6djaDYcGq7 6SiuoRJhq2FIqcceuV2QYjChtdXsEdTiKoQZxO7oUcyTa/E/xVwPuzSIQSHqyiK+YgKI zVd5jiO81CqXTk9MGNEsnmnoUGln34XDCNBnbdDKibWahhFE2eH3mi9jK4GyeBcOfw3L 11HljxmiW6DkX1Xi+udVapg9OiqVCSlnxtuIcglkbZQaRrzdQvqTiTSswB0l4+VbeFRV Srq9JGt0dPXFznN+pu78EuT7iCtW7E8R1q3t6yRBC3vUOcrBz/vPCrG4xtYaql/YqfJI Q0aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706256776; x=1706861576; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7rrGeLbPaiEO5WdfZAroSibRcJzRjQTQSH2UK6pfWWU=; b=hMghj4YSdJ2PAIbRbKDrSABD4iriDUBXHh6wTWl40Lsahecaqd3AfG/j1SHrQIkLRE hIgnWVsFRblD72FiH9lWpBAQZkmlhvYnfegx43u3pLor1oLgTAz+J/hoDmpnulK1m+gt CNgHLPvakNMd5q2GOJdCQnXqHUFw1gAqG/bIsjdmssd8UOqjyjX2LNLrj2C8lclfOClM KYkko48Fk5vu2p/Ovt36vcu84KIP43FmRRK4X/ckLSmLG43QSIWNdEsZS7BxUvarNIjK 24w0OlUADwk0j4dU66pALTH2GFNP7E5LLADKNtlPyXyA6M+mJTTy8Sz/DaeyaMRF3Gm2 Bqvw== X-Gm-Message-State: AOJu0YxtXIQj0oOoNOyKIX8RPTj1Nc2imPMNesdvYA0FOySKcIAizvgf veEKuMFGQH8Fc1eRNOnPhmauXY+By8ED7O1aUaWbz/fjRmtUZxHACKbEjG6dn+8= X-Received: by 2002:adf:a485:0:b0:337:bdff:bfc0 with SMTP id g5-20020adfa485000000b00337bdffbfc0mr296142wrb.99.1706256776614; Fri, 26 Jan 2024 00:12:56 -0800 (PST) Received: from [192.168.2.107] ([79.115.63.202]) by smtp.gmail.com with ESMTPSA id s18-20020a5d69d2000000b003393457afc2sm694393wrw.95.2024.01.26.00.12.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Jan 2024 00:12:56 -0800 (PST) Message-ID: <6cedad43-766c-4b3d-81d2-957b9e88f471@linaro.org> Date: Fri, 26 Jan 2024 08:12:53 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 10/28] spi: s3c64xx: use full mask for {RX, TX}_FIFO_LVL Content-Language: en-US To: Sam Protsenko Cc: broonie@kernel.org, andi.shyti@kernel.org, arnd@arndb.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, alim.akhtar@samsung.com, linux-spi@vger.kernel.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, andre.draszik@linaro.org, peter.griffin@linaro.org, kernel-team@android.com, willmcvicker@google.com References: <20240125145007.748295-1-tudor.ambarus@linaro.org> <20240125145007.748295-11-tudor.ambarus@linaro.org> From: Tudor Ambarus In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 1/25/24 20:03, Sam Protsenko wrote: > On Thu, Jan 25, 2024 at 8:50 AM Tudor Ambarus wrote: >> >> SPI_STATUSn.{RX, TX}_FIFO_LVL fields show the data level in the RX and >> TX FIFOs. The IP supports FIFOs from 8 to 256 bytes, but apart from the >> MODE_CFG.{RX, TX}_RDY_LVL fields that configure the {RX, TX} FIFO >> trigger level in the interrupt mode, there's nothing in the registers >> that configure the FIFOs depth. Is the responsibility of the SoC that >> integrates the IP to dictate the FIFO depth and of the SPI driver to >> make sure it doesn't bypass the FIFO length. >> >> {RX, TX}_FIFO_LVL was used to pass the FIFO length information based on >> the IP configuration in the SoC. Its value was defined so that it >> includes the entire FIFO length. For example, if one wanted to specify a >> 64 FIFO length (0x40), it wold configure the FIFO level to 127 (0x7f). > > s/wodl/would/ oh, yes, thanks > >> This is not only wrong, because it doesn't respect the IP's register >> fields, it's also misleading. Use the full mask for the >> SPI_STATUSn.{RX, TX}_FIFO_LVL fields. No change in functionality is >> expected. >> >> Signed-off-by: Tudor Ambarus >> --- >> drivers/spi/spi-s3c64xx.c | 21 +++++++++++---------- >> 1 file changed, 11 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c >> index d046810da51f..b048e81e6207 100644 >> --- a/drivers/spi/spi-s3c64xx.c >> +++ b/drivers/spi/spi-s3c64xx.c >> @@ -78,6 +78,8 @@ >> #define S3C64XX_SPI_INT_RX_FIFORDY_EN BIT(1) >> #define S3C64XX_SPI_INT_TX_FIFORDY_EN BIT(0) >> >> +#define S3C64XX_SPI_ST_RX_FIFO_LVL GENMASK(23, 15) > > What about s3c* architectures, where RX_LVL starts with bit #13, as > can be seen from .rx_lvl_offset values in corresponding port_configs? > Wouldn't this change break those? ah, wonderful catch, Sam. I break those indeed. > > More generally, I don't understand why this patch is needed. Looks I said in the commit message and subject that I'd like to use the full FIFO level mask rather than just a partial mask. On gs101 at least, that register field is on 9 bits, but as the code is now, we consider that register on 7 bits. For gs101 the FIFO size is always 64 bytes, thus indirectly the fifo_lvl_mask is always 0x7f. Unfortunately I'll drop this patch because I don't have access to all the SoC datasheets, thus I can't tell for sure if that register is always 9 bits wide. s3c2443 and s3c6410, which have the rx-lvl-offset set to 13, use just 0x7f masks. That's a pitty.