From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 52E65340DA0 for ; Mon, 18 Aug 2025 13:21:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755523292; cv=none; b=giIOsCZvCzHLPEQTTxUH+0HZaL7amMIcn1xCJaJjm/7Gy89wlX9ur9r8S+MzGN+h0Q94ZSsCAkDDR7q84EH8WhVYAL9HmpZ+NJOUAqd3+F+5mD2ac8xmuIwdKyBujoNnscqIzv8c4DdqaTsXNFq2P8Rwl6LBq7ae9YiuMtW+Tyk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755523292; c=relaxed/simple; bh=+cKh+v4Cm+T1peei9b5ebp+8tJt6yVUSf7x8iARtLHk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=D0Oi96oNDREeMddlZ76N5jcr8BJsCrO+V6QbwKltdR1kewDcRdG7lmhC366YJAyFmCQ36iut0B1Shacf8UH9M0qhCgkbxOgg+SCo+Jz2JpDl8NQ+imf7ZGrszUW71ZheZqOjRL+/agZAkhlgKjKnPijXDG07hbFSJ0TBgC0k4Vk= 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=YHJOmxQo; arc=none smtp.client-ip=209.85.128.41 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YHJOmxQo" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-45a1b00f187so17790055e9.0 for ; Mon, 18 Aug 2025 06:21:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1755523289; x=1756128089; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qHosbQ56I8nDu/Jz/4UBzucrPmhDO2H2KjGIBtWOyX8=; b=YHJOmxQo8LX3DQ6QZRMnXdmET2P1eqxPpqY5zoTtkzboIfm2XFXgWJcOkliK37ylib 2qATDs7I5RWTciAELc323nPk3HJ1VNYvnyDHFtFhoIzADZcqJtidKPJSmENuRm0qL2Wz 5X8MTXp3AuYg0xRGF0KydoEaLLCN5GEMm11mo1gLbxF0Y4romjlaWi9oBgCBTkmFUe2r 8Ex7vvChkJFUcEwBBaOY9lUKwxjd5ZhudC2QH3fPfQLLzRYzbhCJ9jfV/bTGI+FlSmIf krmh7nAdxizJD+xcuIYlu6Fi9aL/aMqgmS2/E4Ye/fpIquSULJcWlYmQ5H6V5EKaCf/l KOLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755523289; x=1756128089; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qHosbQ56I8nDu/Jz/4UBzucrPmhDO2H2KjGIBtWOyX8=; b=QTHUzhWJsVJGqU6hpbhUoQ/ppMu/qavMFkRj5uyP+wMXtHfrRr1OQyvd56tqflKEj4 PNkhlEVFZjX/J9LnveDCmUsnqNbhqFvUwKcTBE3PLAWANjfIy87IHnfFRCTjK/yDNbDi +cUgHteZuwv9TbYIWsXIJhAq/8qvnmB+HyFaeH0+LwGs4ShcpcvYpVAKpCXlCt/wBgPG Q+pJpkgOW2iIJ5f0fZaaWrg7xprKQV6Iq00y9bVZ2YHxiVwG4S3GVoY3ty+wYoXTBAKV D+CvMkBziy6azUfELmcivdlsKqDmXZ0rg4fvkb7pEx3xOeQuKfg5jseNhgTdOPiO5QIs tfBA== X-Forwarded-Encrypted: i=1; AJvYcCXKB6U/HaV1Wgxh27VAwud41keYAKXzXR9ZG+/lnOrZoBhMZZlUla/dxsHxstlq9WaUYe+hMRvFzTpO@vger.kernel.org X-Gm-Message-State: AOJu0YyuSxQ8DDDsZXUx5WRuf/Pu/YWVj8GLvAaZ33+PbLZgGj58LVuO tRKSKoWDf2PkOZxKWu0uBptLEktdixCdtO/TJJy1cGebzHQV2OKmat2clezpuNjojj4= X-Gm-Gg: ASbGnctRXW5jLJxIKeWCgmwkYghYdNoS2P+7sfSMv9DhljQtcSLjZp5b2xIVRZdSFGW BVNOpQ49PEhDAgbM1rqFDnoPsjFJJv1A+sH2KrvgClqgHWe2CF0M5WQXCkNz8I6vzQ9sKgVWe8t we4LEPF6GnbgxG2aoafUPwqkTodW9cZTBCl3v0vXaMnlBp/+As06O1b39Av37ewos1ZdTxbv0pE FD/dzBfBJa7OUvYsLtGt51/z1LNVtMMhJrdc/nKoTQj7dM4LCUFKLEu0GiIWe01vdvVOccrlVis i643Anp3NoDdtj3cndmgCuXq11neSIckD19UjLnXk/bz4t4Refb84/DNoBkh2KW1tJmbBqYSpBb OkaIK6zl7bn0V62o5BSUvKgCwv7o= X-Google-Smtp-Source: AGHT+IHmQYSiITA4A2f3X+nYYnR5TguRUDLdC1f6m0CIICjfTIGcLFHLP+kZ1Fsg3j7tteqznpBIhw== X-Received: by 2002:a05:600c:a43:b0:459:db69:56bd with SMTP id 5b1f17b1804b1-45a21839e02mr89031265e9.20.1755523288609; Mon, 18 Aug 2025 06:21:28 -0700 (PDT) Received: from [192.168.1.3] ([185.48.76.109]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45a1b1db885sm108362605e9.0.2025.08.18.06.21.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Aug 2025 06:21:28 -0700 (PDT) Message-ID: <40b29323-66db-492c-be00-71ff87f48d77@linaro.org> Date: Mon, 18 Aug 2025 14:21:26 +0100 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 04/13] spi: spi-fsl-lpspi: Clear status register after disabling the module To: Frank Li Cc: Mark Brown , Clark Wang , Fugang Duan , Gao Pan , Fugang Duan , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Fabio Estevam , Larisa Grigore , Larisa Grigore , Ghennadi Procopciuc , Ciprianmarian Costea , s32@nxp.com, linux-spi@vger.kernel.org, imx@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20250814-james-nxp-lpspi-v1-0-9586d7815d14@linaro.org> <20250814-james-nxp-lpspi-v1-4-9586d7815d14@linaro.org> Content-Language: en-US From: James Clark In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 14/08/2025 5:58 pm, Frank Li wrote: > On Thu, Aug 14, 2025 at 05:06:44PM +0100, James Clark wrote: >> From: Larisa Grigore >> >> Clear the error flags after disabling the module to avoid the case when >> a flag is set between when the flags were just cleared, and when the >> module is disabled. > > between flags clear and module disable > > And use SR_CLEAR_MASK to replace hardcoded value for improved readability > Ack > > Reviewed-by: Frank Li > >> >> Although fsl_lpspi_reset() was only introduced in commit a15dc3d657fa >> ("spi: lpspi: Fix CLK pin becomes low before one transfer"), the >> original driver only reset SR in the interrupt handler, making it >> vulnerable to the same issue. Therefore the fixes commit is set at the >> introduction of the driver. >> >> Fixes: 5314987de5e5 ("spi: imx: add lpspi bus driver") >> Signed-off-by: Larisa Grigore >> Signed-off-by: Ciprian Marian Costea >> Signed-off-by: James Clark >> --- >> drivers/spi/spi-fsl-lpspi.c | 9 +++++---- >> 1 file changed, 5 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c >> index aab92ee7eb94..79b170426bee 100644 >> --- a/drivers/spi/spi-fsl-lpspi.c >> +++ b/drivers/spi/spi-fsl-lpspi.c >> @@ -82,6 +82,8 @@ >> #define TCR_RXMSK BIT(19) >> #define TCR_TXMSK BIT(18) >> >> +#define SR_CLEAR_MASK GENMASK(13, 8) >> + >> struct fsl_lpspi_devtype_data { >> u8 prescale_max; >> }; >> @@ -536,14 +538,13 @@ static int fsl_lpspi_reset(struct fsl_lpspi_data *fsl_lpspi) >> fsl_lpspi_intctrl(fsl_lpspi, 0); >> } >> >> - /* W1C for all flags in SR */ >> - temp = 0x3F << 8; >> - writel(temp, fsl_lpspi->base + IMX7ULP_SR); >> - >> /* Clear FIFO and disable module */ >> temp = CR_RRF | CR_RTF; >> writel(temp, fsl_lpspi->base + IMX7ULP_CR); >> >> + /* W1C for all flags in SR */ >> + writel(SR_CLEAR_MASK, fsl_lpspi->base + IMX7ULP_SR); >> + >> return 0; >> } >> >> >> -- >> 2.34.1 >>