From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 590E51FBC90; Mon, 2 Jun 2025 15:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748876527; cv=none; b=KGgQvvqErfSpC4elIxMagepvMcM07G7WmVUCu3XSfekTGiXa4jVdAGop2mCZ8u4Sle26AdXEd+/kCbwsHIhMWOGpKDvIfhkCulT/xoRk6fYypTJpbvc3j9+6/hghHj3v5FQL/CIneuZlNJCVfQhPH7X7tgYf5R60LhOT5W8uQjE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748876527; c=relaxed/simple; bh=96IVA21NgXiWLFLvqNL2vs8XHQ4Cgez0lqQbJua2zOo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=puMa3pb7QS8AJDxnxDdK0N7ZqWFnvBHBIrgUrF/ZjnshkAAn9EACOGfR/eomI+WAF2Duy7/H7V6Vllhdx7mhOewYp5t25PcYML1/Ss2mw4MEakhlRTS+YqdxBrQAlHS8TJhyW2Fwz/6JHgKBdOybpERWHtDO30dpUwk3DYbPb/0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=AR0KYSE7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="AR0KYSE7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D711C4CEEE; Mon, 2 Jun 2025 15:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748876526; bh=96IVA21NgXiWLFLvqNL2vs8XHQ4Cgez0lqQbJua2zOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AR0KYSE71VfN0XMwMqBfgPZ3mozsgkGbxwLV5ffLmR70EJ/QgyYQVeqBOfcTCN03y RVdd1GrfTnQDCqEnjbWIgDoVCyYAgC3lwXQ2/v+dWIZ+2xMCNJgNhVU5Z4Bx+2Ig7i UUZx8O9Dti/bLjWH4Z5dlvVRovYKqNUgo4Gt7wl4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alessandro Grassi , Mark Brown , Sasha Levin Subject: [PATCH 5.15 202/207] spi: spi-sun4i: fix early activation Date: Mon, 2 Jun 2025 15:49:34 +0200 Message-ID: <20250602134306.694781218@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250602134258.769974467@linuxfoundation.org> References: <20250602134258.769974467@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alessandro Grassi [ Upstream commit fb98bd0a13de2c9d96cb5c00c81b5ca118ac9d71 ] The SPI interface is activated before the CPOL setting is applied. In that moment, the clock idles high and CS goes low. After a short delay, CPOL and other settings are applied, which may cause the clock to change state and idle low. This transition is not part of a clock cycle, and it can confuse the receiving device. To prevent this unexpected transition, activate the interface while CPOL and the other settings are being applied. Signed-off-by: Alessandro Grassi Link: https://patch.msgid.link/20250502095520.13825-1-alessandro.grassi@mailbox.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-sun4i.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c index 1fdfc6e6691d2..a8fba310d7004 100644 --- a/drivers/spi/spi-sun4i.c +++ b/drivers/spi/spi-sun4i.c @@ -263,6 +263,9 @@ static int sun4i_spi_transfer_one(struct spi_master *master, else reg |= SUN4I_CTL_DHB; + /* Now that the settings are correct, enable the interface */ + reg |= SUN4I_CTL_ENABLE; + sun4i_spi_write(sspi, SUN4I_CTL_REG, reg); /* Ensure that we have a parent clock fast enough */ @@ -403,7 +406,7 @@ static int sun4i_spi_runtime_resume(struct device *dev) } sun4i_spi_write(sspi, SUN4I_CTL_REG, - SUN4I_CTL_ENABLE | SUN4I_CTL_MASTER | SUN4I_CTL_TP); + SUN4I_CTL_MASTER | SUN4I_CTL_TP); return 0; -- 2.39.5