FAILED: patch "[PATCH] spi: bcm63xx-hsspi: disable clocks on resume failure" failed to apply to 5.15-stable tree
[email protected]
maintainerThe patch below does not apply to the 5.15-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-5.15.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 '2026090832-duration-catering-fe4f@gregkh' --subject-prefix 'PATCH 5.15.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/3 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/3 spi: bcm63xx-hsspi: switch to use modern name
From: Yang Yingliang <[email protected]>
[ Upstream commit 2c40be6bc95bd2b9681b4acc434feda05b16eb00 ]
Change legacy name master to modern name host or controller.
No functional changed.
Backport notes for 5.15:
Apply the host/controller renaming only to functions present in this tree. Drop hunks for the absent polling/sysfs and prepend-transfer support, and preserve the existing transfer, chip-select, interrupt and remove behavior. Retain spi_alloc_master(), since spi_alloc_host() is unavailable in 5.15; no new helpers or functions are needed.
The renamed controller and host in bcm63xx_hsspi_resume() provide the context required by 3b0cee026640 ("spi: bcm63xx-hsspi: disable clocks on resume failure").
Stable-dep-of: 3b0cee026640 ("spi: bcm63xx-hsspi: disable clocks on resume failure")
--- drivers/spi/spi-bcm63xx-hsspi.c | 62 ++++++++++++++++----------------- 1 file changed, 31 insertions(+), 31 deletions(-)
drivers/spi/spi-bcm63xx-hsspi.c +31 -31
@@ -158,7 +158,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); +struct bcm63xx_hsspi *bs =spi_controller_get_devdata (spi->controller);unsigned int chip_select = spi->chip_select;u16 opcode =0 ;int pending = t->len;
@@ -232,7 +232,7 @@ static int bcm63xx_hsspi_do_txrx(struct spi_device *spi, struct spi_transfer *t)static int bcm63xx_hsspi_setup (struct spi_device *spi) { -struct bcm63xx_hsspi *bs =spi_master_get_devdata (spi->master); +struct bcm63xx_hsspi *bs =spi_controller_get_devdata (spi->controller);u32 reg; reg = __raw_readl(bs->regs +
@@ -267,10 +267,10 @@ static int bcm63xx_hsspi_setup(struct spi_device *spi)return 0 ; } -static int bcm63xx_hsspi_transfer_one (struct spi_master *master, +static int bcm63xx_hsspi_transfer_one (struct spi_controller *host,struct spi_message *msg) { -struct bcm63xx_hsspi *bs =spi_master_get_devdata (master); +struct bcm63xx_hsspi *bs =spi_controller_get_devdata (host);struct spi_transfer *t;struct spi_device *spi = msg->spi;int status = -EINVAL ;
@@ -315,7 +315,7 @@ static int bcm63xx_hsspi_transfer_one(struct spi_master *master,mutex_unlock (&bs->bus_mutex); msg->status = status; -spi_finalize_current_message (master); +spi_finalize_current_message (host);return 0 ; }
@@ -357,7 +357,7 @@ static irqreturn_t bcm63xx_hsspi_interrupt(int irq, void *dev_id)static int bcm63xx_hsspi_probe (struct platform_device *pdev) { -struct spi_master *master; +struct spi_controller *host;struct bcm63xx_hsspi *bs;void __iomem *regs;struct device *dev = &pdev->dev;
@@ -413,13 +413,13 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) } } - master =spi_alloc_master (&pdev->dev,sizeof (*bs)); -if (!master) { + host =spi_alloc_master (&pdev->dev,sizeof (*bs)); +if (!host) { ret = -ENOMEM ; goto out_disable_pll_clk; } - bs =spi_master_get_devdata (master); + bs =spi_controller_get_devdata (host); bs->pdev = pdev; bs->clk = clk; bs->pll_clk = pll_clk;
@@ -430,10 +430,10 @@ 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; + host->mem_ops = &bcm63xx_hsspi_mem_ops; + host->dev.of_node = dev->of_node;if (!dev->of_node) - master->bus_num =HSSPI_BUS_NUM ; + host->bus_num =HSSPI_BUS_NUM ;of_property_read_u32 (dev->of_node,"num-cs" , &num_cs);if (num_cs >8 ) {
@@ -441,15 +441,15 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) num_cs); num_cs =HSSPI_SPI_MAX_CS ; } - master->num_chipselect = num_cs; - master->setup = bcm63xx_hsspi_setup; - master->transfer_one_message = bcm63xx_hsspi_transfer_one; - master->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH | + host->num_chipselect = num_cs; + host->setup = bcm63xx_hsspi_setup; + host->transfer_one_message = bcm63xx_hsspi_transfer_one; + host->mode_bits =SPI_CPOL |SPI_CPHA |SPI_CS_HIGH |SPI_RX_DUAL |SPI_TX_DUAL ; - master->bits_per_word_mask =SPI_BPW_MASK (8 ); - master->auto_runtime_pm = true; + host->bits_per_word_mask =SPI_BPW_MASK (8 ); + host->auto_runtime_pm = true; -platform_set_drvdata (pdev, master); +platform_set_drvdata (pdev, host);/* Initialize the hardware */ __raw_writel (0 , bs->regs +HSSPI_INT_MASK_REG );
@@ -467,12 +467,12 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) pdev->name, bs);if (ret) - goto out_put_master; + goto out_put_host;pm_runtime_enable (&pdev->dev);/* register and we are done */ - ret =devm_spi_register_master (dev, master); + ret =devm_spi_register_controller (dev, host);if (ret) goto out_pm_disable;
@@ -480,8 +480,8 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) out_pm_disable:pm_runtime_disable (&pdev->dev); -out_put_master: -spi_master_put (master); +out_put_host: +spi_controller_put (host); out_disable_pll_clk:clk_disable_unprepare (pll_clk); out_disable_clk:
@@ -492,8 +492,8 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)static int bcm63xx_hsspi_remove (struct platform_device *pdev) { -struct spi_master *master =platform_get_drvdata (pdev); -struct bcm63xx_hsspi *bs =spi_master_get_devdata (master); +struct spi_controller *host =platform_get_drvdata (pdev); +struct bcm63xx_hsspi *bs =spi_controller_get_devdata (host);/* reset the hardware and block queue progress */ __raw_writel (0 , bs->regs +HSSPI_INT_MASK_REG );
@@ -506,10 +506,10 @@ static int bcm63xx_hsspi_remove(struct platform_device *pdev)#ifdef CONFIG_PM_SLEEP static int bcm63xx_hsspi_suspend (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); -spi_master_suspend (master); +spi_controller_suspend (host);clk_disable_unprepare (bs->pll_clk);clk_disable_unprepare (bs->clk);
@@ -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 3/3 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