FAILED: patch "[PATCH] spi: bcm63xx-hsspi: disable clocks on resume failure" failed to apply to 6.1-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 3b0cee02664041aea7e4f787c66cb86c82eb4e97
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090831-flashy-precook-e8f5@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 3b0cee02664041aea7e4f787c66cb86c82eb4e97 Mon Sep 17 00:00:00 2001
From: Can Peng <[email protected]>
Date: Tue, 4 Aug 2026 15:20:17 +0800
Subject: [PATCH] spi: bcm63xx-hsspi: disable clocks on resume failure
bcm63xx_hsspi_resume() enables the HSSPI clock, and optionally the PLL clock, before restarting the SPI controller queue.
If spi_controller_resume() fails, the function currently reports success and leaves those clocks enabled. Propagate the error and disable the clocks before returning.
drivers/spi/spi-bcm63xx-hsspi.c +7 -1
@@ -919,7 +919,13 @@ static int bcm63xx_hsspi_resume(struct device *dev) } } -spi_controller_resume (host); + ret =spi_controller_resume (host); +if (ret) { +if (bs->pll_clk) +clk_disable_unprepare (bs->pll_clk); +clk_disable_unprepare (bs->clk); +return ret; + }return 0 ; }
Sasha Levin
maintainerPATCH 1/4 spi: bcm63xx-hsspi: Disable spi mem dual io read op support
From: William Zhang <[email protected]>
[ Upstream commit c6182a187b33cd00a763ac2490c0f5210b2c4742 ]
In general the controller supports SPI dual mode operation but the particular SPI flash dual io read op switches from single mode in cmd phase to dual mode in address and data phase. This is not compatible with prepend operation where cmd and address are sent out through the prepend buffer and they must use same the number of io pins.
This patch disables these SPI flash dual io read ops through the mem_ops supports_op interface. This makes sure the SPI flash driver selects the compatible read ops at run time.
Stable-dep-of: 3b0cee026640 ("spi: bcm63xx-hsspi: disable clocks on resume failure")
--- drivers/spi/spi-bcm63xx-hsspi.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/spi/spi-bcm63xx-hsspi.c +23 -0
@@ -20,6 +20,8 @@#include <linux/spi/spi.h> #include <linux/mutex.h> #include <linux/of.h> +#include <linux/spi/spi-mem.h> +#include <linux/mtd/spi-nor.h> #include <linux/reset.h> #include <linux/pm_runtime.h>
@@ -318,6 +320,26 @@ static int bcm63xx_hsspi_transfer_one(struct spi_master *master,return 0 ; } +static bool bcm63xx_hsspi_mem_supports_op (struct spi_mem *mem, +const struct spi_mem_op *op) +{ +if (!spi_mem_default_supports_op (mem, op)) +return false; + +/* Controller doesn't support spi mem dual io mode */ +if ((op->cmd.opcode ==SPINOR_OP_READ_1_2_2 ) || + (op->cmd.opcode ==SPINOR_OP_READ_1_2_2_4B ) || + (op->cmd.opcode ==SPINOR_OP_READ_1_2_2_DTR ) || + (op->cmd.opcode ==SPINOR_OP_READ_1_2_2_DTR_4B )) +return false; + +return true; +} + +static const struct spi_controller_mem_ops bcm63xx_hsspi_mem_ops = { + .supports_op = bcm63xx_hsspi_mem_supports_op, +}; +static irqreturn_t bcm63xx_hsspi_interrupt (int irq,void *dev_id) {struct bcm63xx_hsspi *bs = (struct bcm63xx_hsspi *)dev_id;
@@ -408,6 +430,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)mutex_init (&bs->bus_mutex);init_completion (&bs->done); + master->mem_ops = &bcm63xx_hsspi_mem_ops; master->dev.of_node = dev->of_node;if (!dev->of_node) master->bus_num =HSSPI_BUS_NUM ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/4 spi: mpc5xxx-psc: Remove unused platform_data
From: Rob Herring <[email protected]>
[ Upstream commit 04725901d9933b3134e6dee6b5bc1efb67f8d43f ]
The platform_data for the MPC5xxx PSC SPI controllers is never used, so remove it and the resulting code which depends on it.
Stable-dep-of: 3b0cee026640 ("spi: bcm63xx-hsspi: disable clocks on resume failure")
--- drivers/spi/spi-mpc512x-psc.c | 28 ++++--------------------- drivers/spi/spi-mpc52xx-psc.c | 39 +++-------------------------------- 2 files changed, 7 insertions(+), 60 deletions(-)
drivers/spi/spi-mpc512x-psc.c +4 -24
@@ -22,7 +22,6 @@#include <linux/delay.h> #include <linux/clk.h> #include <linux/spi/spi.h> -#include <linux/fsl_devices.h> #include <asm/mpc52xx_psc.h> enum {
@@ -51,8 +50,6 @@ enum { __ret; })struct mpc512x_psc_spi { -void (*cs_control)(struct spi_device *spi,bool on); -/* driver internal data */ int type;void __iomem *psc;
@@ -128,26 +125,16 @@ static void mpc512x_psc_spi_activate_cs(struct spi_device *spi) mps->bits_per_word = cs->bits_per_word;if (spi->cs_gpiod) { -if (mps->cs_control) -/* boardfile override */ - mps->cs_control (spi, (spi->mode &SPI_CS_HIGH ) ?1 :0 ); -else -/* gpiolib will deal with the inversion */ -gpiod_set_value (spi->cs_gpiod,1 ); +/* gpiolib will deal with the inversion */ +gpiod_set_value (spi->cs_gpiod,1 ); } }static void mpc512x_psc_spi_deactivate_cs (struct spi_device *spi) { -struct mpc512x_psc_spi *mps =spi_master_get_devdata (spi->master); -if (spi->cs_gpiod) { -if (mps->cs_control) -/* boardfile override */ - mps->cs_control (spi, (spi->mode &SPI_CS_HIGH ) ?0 :1 ); -else -/* gpiolib will deal with the inversion */ -gpiod_set_value (spi->cs_gpiod,0 ); +/* gpiolib will deal with the inversion */ +gpiod_set_value (spi->cs_gpiod,0 ); } }
@@ -474,7 +461,6 @@ static irqreturn_t mpc512x_psc_spi_isr(int irq, void *dev_id)static int mpc512x_psc_spi_do_probe (struct device *dev,u32 regaddr,u32 size,unsigned int irq) { -struct fsl_spi_platform_data *pdata =dev_get_platdata (dev);struct mpc512x_psc_spi *mps;struct spi_master *master;int ret;
@@ -490,12 +476,6 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr, mps->type = (int )of_device_get_match_data (dev); mps->irq = irq; -if (pdata) { - mps->cs_control = pdata->cs_control; - master->bus_num = pdata->bus_num; - master->num_chipselect = pdata->max_chipselect; - } - master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST ; master->setup = mpc512x_psc_spi_setup; master->prepare_transfer_hardware = mpc512x_psc_spi_prep_xfer_hw;
drivers/spi/spi-mpc52xx-psc.c +3 -36
@@ -18,7 +18,6 @@#include <linux/io.h> #include <linux/delay.h> #include <linux/spi/spi.h> -#include <linux/fsl_devices.h> #include <linux/slab.h> #include <linux/of_irq.h>
@@ -28,10 +27,6 @@#define MCLK 20000000/* PSC port MClk in hz */ struct mpc52xx_psc_spi { -/* fsl_spi_platform data */ -void (*cs_control)(struct spi_device *spi,bool on); -u32 sysclk; -/* driver internal data */ struct mpc52xx_psc __iomem *psc;struct mpc52xx_psc_fifo __iomem *fifo;
@@ -101,17 +96,6 @@ static void mpc52xx_psc_spi_activate_cs(struct spi_device *spi) ccr |= (MCLK /1000000 -1 ) &0xFF ;out_be16 ((u16 __iomem *)&psc->ccr, ccr); mps->bits_per_word = cs->bits_per_word; - -if (mps->cs_control) - mps->cs_control (spi, (spi->mode &SPI_CS_HIGH ) ?1 :0 ); -} - -static void mpc52xx_psc_spi_deactivate_cs (struct spi_device *spi) -{ -struct mpc52xx_psc_spi *mps =spi_master_get_devdata (spi->master); - -if (mps->cs_control) - mps->cs_control (spi, (spi->mode &SPI_CS_HIGH ) ?0 :1 ); }#define MPC52xx_PSC_BUFSIZE (MPC52xx_PSC_RFNUM_MASK + 1)
@@ -220,14 +204,9 @@ int mpc52xx_psc_spi_transfer_one_message(struct spi_controller *ctlr, m->actual_length += t->len;spi_transfer_delay_exec (t); - -if (cs_change) -mpc52xx_psc_spi_deactivate_cs (spi); } m->status = status; -if (status || !cs_change) -mpc52xx_psc_spi_deactivate_cs (spi);mpc52xx_psc_spi_transfer_setup (spi,NULL );
@@ -269,7 +248,7 @@ static int mpc52xx_psc_spi_port_config(int psc_id, struct mpc52xx_psc_spi *mps)int ret;/* default sysclk is 512MHz */ - mclken_div = (mps->sysclk ? mps->sysclk :512000000 ) /MCLK ; + mclken_div =512000000 /MCLK ; ret =mpc52xx_set_psc_clkdiv (psc_id, mclken_div);if (ret)return ret;
@@ -317,7 +296,6 @@ static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id)static int mpc52xx_psc_spi_do_probe (struct device *dev,u32 regaddr,u32 size,unsigned int irq,s16 bus_num) { -struct fsl_spi_platform_data *pdata =dev_get_platdata (dev);struct mpc52xx_psc_spi *mps;struct spi_master *master;int ret;
@@ -333,19 +311,8 @@ static int mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_LSB_FIRST ; mps->irq = irq; -if (pdata ==NULL ) { -dev_warn (dev, -"probe called without platform data, no cs_control function will be called\n" ); - mps->cs_control =NULL ; - mps->sysclk =0 ; - master->bus_num = bus_num; - master->num_chipselect =255 ; - }else { - mps->cs_control = pdata->cs_control; - mps->sysclk = pdata->sysclk; - master->bus_num = pdata->bus_num; - master->num_chipselect = pdata->max_chipselect; - } + master->bus_num = bus_num; + master->num_chipselect =255 ; master->setup = mpc52xx_psc_spi_setup; master->transfer_one_message = mpc52xx_psc_spi_transfer_one_message; master->cleanup = mpc52xx_psc_spi_cleanup;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/4 spi: Replace all spi->chip_select and spi->cs_gpiod references with function call
In reply to Sasha LevinFrom: Amit Kumar Mahapatra via Alsa-devel <[email protected]>
[ Upstream commit 9e264f3f85a56cc109cc2d6010a48aa89d5c1ff1 ]
Supporting multi-cs in spi drivers would require the chip_select & cs_gpiod members of struct spi_device to be an array. But changing the type of these members to array would break the spi driver functionality. To make the transition smoother introduced four new APIs to get/set the spi->chip_select & spi->cs_gpiod and replaced all spi->chip_select and spi->cs_gpiod references with get or set API calls.
While adding multi-cs support in further patches the chip_select & cs_gpiod members of the spi_device structure would be converted to arrays & the "idx" parameter of the APIs would be used as array index i.e., spi->chip_select[idx] & spi->cs_gpiod[idx] respectively.
Stable backport notes:
Limit this dependency to spi-bcm63xx-hsspi.c, the driver affected by 3b0cee026640 ("spi: bcm63xx-hsspi: disable clocks on resume failure"). Convert its eleven existing chip-select accesses using the accessor already provided by this stable tree. Drop conversions in other drivers, SPI memory core and trace events, which are unrelated to the target.
Keep the stable driver's existing transfer implementation; do not import upstream prepend support, additional helpers or drivers absent from 6.1. In the existing resume function, use the spi_controller type/accessors and the local name host. The old spi_master names are compatibility aliases here, so this preserves behavior while allowing the target's spi_controller_resume(host) error-handling hunk to apply unchanged. No functions are added.
[ sashal: Reduced backport -- upstream 9e264f3f85a56 touches 92 file(s), this
backport carries 1. Not backported here:
drivers/spi/spi-altera-core.c
drivers/spi/spi-amd.c
drivers/spi/spi-ar934x.c
drivers/spi/spi-armada-3700.c
drivers/spi/spi-aspeed-smc.c
drivers/spi/spi-at91-usart.c
drivers/spi/spi-ath79.c
drivers/spi/spi-atmel.c
... and 83 more
This note is generated from the file lists only; see the resolution record for the reasoning. ]
Stable-dep-of: 3b0cee026640 ("spi: bcm63xx-hsspi: disable clocks on resume failure")
--- drivers/spi/spi-bcm63xx-hsspi.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/spi/spi-bcm63xx-hsspi.c +14 -14
@@ -132,7 +132,7 @@ static void bcm63xx_hsspi_set_cs(struct bcm63xx_hsspi *bs, unsigned int cs,static void bcm63xx_hsspi_set_clk (struct bcm63xx_hsspi *bs,struct spi_device *spi,int hz) { -unsigned int profile = spi->chip_select; +unsigned int profile =spi_get_chipselect (spi,0 );u32 reg; reg =DIV_ROUND_UP (2048 ,DIV_ROUND_UP (bs->speed_hz, hz));
@@ -159,7 +159,7 @@ static void bcm63xx_hsspi_set_clk(struct bcm63xx_hsspi *bs,static int bcm63xx_hsspi_do_txrx (struct spi_device *spi,struct spi_transfer *t) {struct bcm63xx_hsspi *bs =spi_master_get_devdata (spi->master); -unsigned int chip_select = spi->chip_select; +unsigned int chip_select =spi_get_chipselect (spi,0 );u16 opcode =0 ;int pending = t->len;int step_size =HSSPI_BUFFER_LEN ;
@@ -168,7 +168,7 @@ static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t)u32 val =0 ;bcm63xx_hsspi_set_clk (bs, spi, t->speed_hz); -bcm63xx_hsspi_set_cs (bs, spi->chip_select, true); +bcm63xx_hsspi_set_cs (bs,spi_get_chipselect (spi,0 ), true);if (tx && rx) opcode =HSSPI_OP_READ_WRITE ;
@@ -236,14 +236,14 @@ static int bcm63xx_hsspi_setup(struct spi_device *spi)u32 reg; reg =__raw_readl (bs->regs + -HSSPI_PROFILE_SIGNAL_CTRL_REG (spi->chip_select)); +HSSPI_PROFILE_SIGNAL_CTRL_REG (spi_get_chipselect (spi,0 ))); reg &= ~(SIGNAL_CTRL_LAUNCH_RISING |SIGNAL_CTRL_LATCH_RISING );if (spi->mode &SPI_CPHA ) reg |=SIGNAL_CTRL_LAUNCH_RISING ;else reg |=SIGNAL_CTRL_LATCH_RISING ;__raw_writel (reg, bs->regs + -HSSPI_PROFILE_SIGNAL_CTRL_REG (spi->chip_select)); +HSSPI_PROFILE_SIGNAL_CTRL_REG (spi_get_chipselect (spi,0 )));mutex_lock (&bs->bus_mutex); reg =__raw_readl (bs->regs +HSSPI_GLOBAL_CTRL_REG );
@@ -251,16 +251,16 @@ static int bcm63xx_hsspi_setup(struct spi_device *spi)/* only change actual polarities if there is no transfer */ if ((reg &GLOBAL_CTRL_CS_POLARITY_MASK ) == bs->cs_polarity) {if (spi->mode &SPI_CS_HIGH ) - reg |=BIT (spi->chip_select); + reg |=BIT (spi_get_chipselect (spi,0 ));else - reg &= ~BIT (spi->chip_select); + reg &= ~BIT (spi_get_chipselect (spi,0 ));__raw_writel (reg, bs->regs +HSSPI_GLOBAL_CTRL_REG ); }if (spi->mode &SPI_CS_HIGH ) - bs->cs_polarity |=BIT (spi->chip_select); + bs->cs_polarity |=BIT (spi_get_chipselect (spi,0 ));else - bs->cs_polarity &= ~BIT (spi->chip_select); + bs->cs_polarity &= ~BIT (spi_get_chipselect (spi,0 ));mutex_unlock (&bs->bus_mutex);
@@ -291,7 +291,7 @@ static int bcm63xx_hsspi_transfer_one(struct spi_master *master,* e. At the end restore the polarities again to their default values. */ - dummy_cs = !spi->chip_select; + dummy_cs = !spi_get_chipselect (spi,0 );bcm63xx_hsspi_set_cs (bs, dummy_cs, true);list_for_each_entry (t, &msg->transfers, transfer_list) {
@@ -304,7 +304,7 @@ static int bcm63xx_hsspi_transfer_one(struct spi_master *master,spi_transfer_delay_exec (t);if (t->cs_change) -bcm63xx_hsspi_set_cs (bs, spi->chip_select, false); +bcm63xx_hsspi_set_cs (bs,spi_get_chipselect (spi,0 ), false); }mutex_lock (&bs->bus_mutex);
@@ -518,8 +518,8 @@ static int bcm63xx_hsspi_suspend(struct device *dev)static int bcm63xx_hsspi_resume (struct device *dev) { -struct spi_master *master =dev_get_drvdata (dev); -struct bcm63xx_hsspi *bs =spi_master_get_devdata (master); +struct spi_controller *host =dev_get_drvdata (dev); +struct bcm63xx_hsspi *bs =spi_controller_get_devdata (host);int ret; ret =clk_prepare_enable (bs->clk);
@@ -534,7 +534,7 @@ static int bcm63xx_hsspi_resume(struct device *dev) } } -spi_master_resume (master); +spi_controller_resume (host);return 0 ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/4 spi: bcm63xx-hsspi: disable clocks on resume failure
In reply to Sasha LevinFrom: Can Peng <[email protected]>
[ Upstream commit 3b0cee02664041aea7e4f787c66cb86c82eb4e97 ]
bcm63xx_hsspi_resume() enables the HSSPI clock, and optionally the PLL clock, before restarting the SPI controller queue.
If spi_controller_resume() fails, the function currently reports success and leaves those clocks enabled. Propagate the error and disable the clocks before returning.
--- drivers/spi/spi-bcm63xx-hsspi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/spi/spi-bcm63xx-hsspi.c +7 -1
@@ -534,7 +534,13 @@ static int bcm63xx_hsspi_resume(struct device *dev) } } -spi_controller_resume (host); + ret =spi_controller_resume (host); +if (ret) { +if (bs->pll_clk) +clk_disable_unprepare (bs->pll_clk); +clk_disable_unprepare (bs->clk); +return ret; + }return 0 ; }
Signature · 1 line
2.53.0