From: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
To: Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Michal Simek <michal.simek@amd.com>,
Lars-Peter Clausen <lars@metafoo.de>
Cc: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>,
Ley Foon Tan <leyfoon.tan@starfivetech.com>,
linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Eng Lee Teh <englee.teh@starfivetech.com>
Subject: [PATCH v2 1/2] spi: spi-cadence: Add optional reset control support
Date: Thu, 2 May 2024 18:47:59 +0800 [thread overview]
Message-ID: <20240502104800.3030486-2-jisheng.teoh@starfivetech.com> (raw)
In-Reply-To: <20240502104800.3030486-1-jisheng.teoh@starfivetech.com>
Add optional reset control support for spi-cadence to properly bring
the SPI device into an operating condition.
Signed-off-by: Eng Lee Teh <englee.teh@starfivetech.com>
Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
Signed-off-by: Ji Sheng Teoh <jisheng.teoh@starfivetech.com>
---
drivers/spi/spi-cadence.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/spi/spi-cadence.c b/drivers/spi/spi-cadence.c
index e5140532071d..11530a531673 100644
--- a/drivers/spi/spi-cadence.c
+++ b/drivers/spi/spi-cadence.c
@@ -18,6 +18,7 @@
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/reset.h>
#include <linux/spi/spi.h>
/* Name of this driver */
@@ -111,6 +112,7 @@
* @dev_busy: Device busy flag
* @is_decoded_cs: Flag for decoder property set or not
* @tx_fifo_depth: Depth of the TX FIFO
+ * @rstc: Optional reset control for SPI controller
*/
struct cdns_spi {
void __iomem *regs;
@@ -125,6 +127,7 @@ struct cdns_spi {
u8 dev_busy;
u32 is_decoded_cs;
unsigned int tx_fifo_depth;
+ struct reset_control *rstc;
};
/* Macros for the SPI controller read/write */
@@ -588,6 +591,16 @@ static int cdns_spi_probe(struct platform_device *pdev)
goto remove_ctlr;
}
+ xspi->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, "spi");
+ if (IS_ERR(xspi->rstc)) {
+ ret = PTR_ERR(xspi->rstc);
+ dev_err(&pdev->dev, "Cannot get SPI reset.\n");
+ goto remove_ctlr;
+ }
+
+ reset_control_assert(xspi->rstc);
+ reset_control_deassert(xspi->rstc);
+
if (!spi_controller_is_target(ctlr)) {
xspi->ref_clk = devm_clk_get_enabled(&pdev->dev, "ref_clk");
if (IS_ERR(xspi->ref_clk)) {
--
2.43.2
next prev parent reply other threads:[~2024-05-02 13:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 10:47 [PATCH v2 0/2] Add optional reset control for Cadence SPI Ji Sheng Teoh
2024-05-02 10:47 ` Ji Sheng Teoh [this message]
2024-05-02 14:16 ` [PATCH v2 1/2] spi: spi-cadence: Add optional reset control support Krzysztof Kozlowski
2024-05-03 1:20 ` JiSheng Teoh
2024-05-02 10:48 ` [PATCH v2 2/2] dt-bindings: spi: spi-cadence: Add optional reset control Ji Sheng Teoh
2024-05-02 12:21 ` Krzysztof Kozlowski
2024-05-02 12:45 ` JiSheng Teoh
2024-05-02 12:48 ` Krzysztof Kozlowski
2024-05-02 12:58 ` JiSheng Teoh
2024-05-02 13:53 ` Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240502104800.3030486-2-jisheng.teoh@starfivetech.com \
--to=jisheng.teoh@starfivetech.com \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=englee.teh@starfivetech.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=leyfoon.tan@starfivetech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®