From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 906012561A8 for ; Mon, 5 May 2025 13:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746450779; cv=none; b=qon/kxzJ9QZPrZQH3qcx0veY3Cdxersf7Wjr/dyzOi3JmxqcmTxZ0enILfyPnDwtEPsaouMwt2q+JpssXtTqk7xGEJieDTG0K7FRbCWF6qMeg1sKFY+53f7b0Kkl0tWiFEYgHw1w2/tTmbVAZrU5dP2JUcbJas4ffdQAWDCqme0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746450779; c=relaxed/simple; bh=a47lUOyTilUaWEtfz6Pw6vX43fkt2saGX2+NfHjH/kA=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=HnANrHQ2a8OLFWIl5X0tT4xI9Dr4IpQsZXcXjCNCGAcJxrR316IzLpB34IujjXrw/MUfQlh/ERsgZgLFvMV076VxXO6GIcdc3fAWu8IxahJhYl9mDIXkHkgjvYTLIFCe7fn6WvWGgfm/l9GAMMRTqsRpzdV+U3VJJeQ1r4+mcxA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1uBvcr-0006PX-1O; Mon, 05 May 2025 15:12:53 +0200 Received: from lupine.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::4e] helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uBvcq-001EYf-0D; Mon, 05 May 2025 15:12:52 +0200 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1uBvcp-000Jxu-3C; Mon, 05 May 2025 15:12:52 +0200 Message-ID: <3685c6351d8b940abe70ccf22d783e71ced6f6da.camel@pengutronix.de> Subject: Re: [PATCH v2 2/2] spi: stm32-ospi: Make usage of reset_control_acquire/release() API From: Philipp Zabel To: Patrice Chotard , Mark Brown , Maxime Coquelin , Alexandre Torgue Cc: linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Date: Mon, 05 May 2025 15:12:51 +0200 In-Reply-To: <20250411-b4-upstream_ospi_reset_update-v2-2-4de7f5dd2a91@foss.st.com> References: <20250411-b4-upstream_ospi_reset_update-v2-0-4de7f5dd2a91@foss.st.com> <20250411-b4-upstream_ospi_reset_update-v2-2-4de7f5dd2a91@foss.st.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Hi Patrice, On Fr, 2025-04-11 at 14:41 +0200, Patrice Chotard wrote: > As ospi reset is consumed by both OMM and OSPI drivers, use the reset > acquire/release mechanism which ensure exclusive reset usage. >=20 > This avoid to call reset_control_get/put() in OMM driver each time > we need to reset OSPI children and guarantee the reset line stays > deasserted. >=20 > Signed-off-by: Patrice Chotard > --- > drivers/spi/spi-stm32-ospi.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c > index d002b9c16714684e4e4623f9255a7f2660c46fd1..ef840f377459891b559be6d6c= 0435408fb58a1e9 100644 > --- a/drivers/spi/spi-stm32-ospi.c > +++ b/drivers/spi/spi-stm32-ospi.c > @@ -804,7 +804,7 @@ static int stm32_ospi_get_resources(struct platform_d= evice *pdev) > return ret; > } > =20 > - ospi->rstc =3D devm_reset_control_array_get_exclusive(dev); > + ospi->rstc =3D devm_reset_control_array_get_exclusive_released(dev); > if (IS_ERR(ospi->rstc)) > return dev_err_probe(dev, PTR_ERR(ospi->rstc), > "Can't get reset\n"); > @@ -936,11 +936,14 @@ static int stm32_ospi_probe(struct platform_device = *pdev) > if (ret < 0) > goto err_pm_enable; > =20 > - if (ospi->rstc) { > - reset_control_assert(ospi->rstc); > - udelay(2); > - reset_control_deassert(ospi->rstc); > - } > + ret =3D reset_control_acquire(ospi->rstc); > + if (ret) > + return dev_err_probe(dev, ret, "Can not acquire reset %d\n", ret); > + > + reset_control_assert(ospi->rstc); > + udelay(2); > + reset_control_deassert(ospi->rstc); > + reset_control_release(ospi->rstc); Could you keep the reset control (mostly) acquired from probe() to remove()? The reset control would have to be released/acquired in OSPI suspend/resume so that OMM can temporarily acquire control during OMM resume. regards Philipp