Add support for one or more optional exclusive resets. These
simply need to be deasserted at probe time, and can remain that
way for the life of the device.
Signed-off-by: Alex Elder <elder@riscstar.com>
---
drivers/spi/spi-fsl-qspi.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
index c887abb028d77..1e27647dd2a09 100644
--- a/drivers/spi/spi-fsl-qspi.c
+++ b/drivers/spi/spi-fsl-qspi.c
@@ -36,6 +36,7 @@
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_qos.h>
+#include <linux/reset.h>
#include <linux/sizes.h>
#include <linux/spi/spi.h>
@@ -267,6 +268,7 @@ struct fsl_qspi {
const struct fsl_qspi_devtype_data *devtype_data;
struct mutex lock;
struct completion c;
+ struct reset_control *resets;
struct clk *clk, *clk_en;
struct pm_qos_request pm_qos_req;
struct device *dev;
@@ -857,6 +859,8 @@ static void fsl_qspi_cleanup(void *data)
{
struct fsl_qspi *q = data;
+ reset_control_assert(q->resets);
+
fsl_qspi_clk_disable_unprep(q);
mutex_destroy(&q->lock);
@@ -902,6 +906,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
if (!q->ahb_addr)
return -ENOMEM;
+ q->resets = devm_reset_control_array_get_optional_exclusive(dev);
+ if (IS_ERR(q->resets))
+ return PTR_ERR(q->resets);
+
/* find the clocks */
q->clk_en = devm_clk_get(dev, "qspi_en");
if (IS_ERR(q->clk_en))
@@ -923,6 +931,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
if (ret)
return ret;
+ ret = reset_control_deassert(q->resets);
+ if (ret)
+ return ret;
+
/* find the irq */
ret = platform_get_irq(pdev, 0);
if (ret < 0)
--
2.48.1
On Mon, Oct 20, 2025 at 11:51:46AM -0500, Alex Elder wrote:
> Add support for one or more optional exclusive resets. These
> simply need to be deasserted at probe time, and can remain that
> way for the life of the device.
Nit: please wrap at 75 chars
Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
> Signed-off-by: Alex Elder <elder@riscstar.com>
> ---
> drivers/spi/spi-fsl-qspi.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
> index c887abb028d77..1e27647dd2a09 100644
> --- a/drivers/spi/spi-fsl-qspi.c
> +++ b/drivers/spi/spi-fsl-qspi.c
> @@ -36,6 +36,7 @@
> #include <linux/of.h>
> #include <linux/platform_device.h>
> #include <linux/pm_qos.h>
> +#include <linux/reset.h>
> #include <linux/sizes.h>
>
> #include <linux/spi/spi.h>
> @@ -267,6 +268,7 @@ struct fsl_qspi {
> const struct fsl_qspi_devtype_data *devtype_data;
> struct mutex lock;
> struct completion c;
> + struct reset_control *resets;
> struct clk *clk, *clk_en;
> struct pm_qos_request pm_qos_req;
> struct device *dev;
> @@ -857,6 +859,8 @@ static void fsl_qspi_cleanup(void *data)
> {
> struct fsl_qspi *q = data;
>
> + reset_control_assert(q->resets);
> +
> fsl_qspi_clk_disable_unprep(q);
>
> mutex_destroy(&q->lock);
> @@ -902,6 +906,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
> if (!q->ahb_addr)
> return -ENOMEM;
>
> + q->resets = devm_reset_control_array_get_optional_exclusive(dev);
> + if (IS_ERR(q->resets))
> + return PTR_ERR(q->resets);
> +
> /* find the clocks */
> q->clk_en = devm_clk_get(dev, "qspi_en");
> if (IS_ERR(q->clk_en))
> @@ -923,6 +931,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
> if (ret)
> return ret;
>
> + ret = reset_control_deassert(q->resets);
> + if (ret)
> + return ret;
> +
> /* find the irq */
> ret = platform_get_irq(pdev, 0);
> if (ret < 0)
> --
> 2.48.1
>
On 10/20/25 2:07 PM, Frank Li wrote:
> On Mon, Oct 20, 2025 at 11:51:46AM -0500, Alex Elder wrote:
>> Add support for one or more optional exclusive resets. These
>> simply need to be deasserted at probe time, and can remain that
>> way for the life of the device.
>
> Nit: please wrap at 75 chars
You're saying wrap at *longer* lengths, right? If not, please
clarify. I'll update in v2.
Thanks for the review.
-Alex
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
>
>>
>> Signed-off-by: Alex Elder <elder@riscstar.com>
>> ---
>> drivers/spi/spi-fsl-qspi.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/drivers/spi/spi-fsl-qspi.c b/drivers/spi/spi-fsl-qspi.c
>> index c887abb028d77..1e27647dd2a09 100644
>> --- a/drivers/spi/spi-fsl-qspi.c
>> +++ b/drivers/spi/spi-fsl-qspi.c
>> @@ -36,6 +36,7 @@
>> #include <linux/of.h>
>> #include <linux/platform_device.h>
>> #include <linux/pm_qos.h>
>> +#include <linux/reset.h>
>> #include <linux/sizes.h>
>>
>> #include <linux/spi/spi.h>
>> @@ -267,6 +268,7 @@ struct fsl_qspi {
>> const struct fsl_qspi_devtype_data *devtype_data;
>> struct mutex lock;
>> struct completion c;
>> + struct reset_control *resets;
>> struct clk *clk, *clk_en;
>> struct pm_qos_request pm_qos_req;
>> struct device *dev;
>> @@ -857,6 +859,8 @@ static void fsl_qspi_cleanup(void *data)
>> {
>> struct fsl_qspi *q = data;
>>
>> + reset_control_assert(q->resets);
>> +
>> fsl_qspi_clk_disable_unprep(q);
>>
>> mutex_destroy(&q->lock);
>> @@ -902,6 +906,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
>> if (!q->ahb_addr)
>> return -ENOMEM;
>>
>> + q->resets = devm_reset_control_array_get_optional_exclusive(dev);
>> + if (IS_ERR(q->resets))
>> + return PTR_ERR(q->resets);
>> +
>> /* find the clocks */
>> q->clk_en = devm_clk_get(dev, "qspi_en");
>> if (IS_ERR(q->clk_en))
>> @@ -923,6 +931,10 @@ static int fsl_qspi_probe(struct platform_device *pdev)
>> if (ret)
>> return ret;
>>
>> + ret = reset_control_deassert(q->resets);
>> + if (ret)
>> + return ret;
>> +
>> /* find the irq */
>> ret = platform_get_irq(pdev, 0);
>> if (ret < 0)
>> --
>> 2.48.1
>>
© 2016 - 2026 Red Hat, Inc.