Skip to content

Commit c6182a1

Browse files
William Zhangbroonie
authored andcommitted
spi: bcm63xx-hsspi: Disable spi mem dual io read op support
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. Signed-off-by: William Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 76a8570 commit c6182a1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/spi/spi-bcm63xx-hsspi.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <linux/spi/spi.h>
2121
#include <linux/mutex.h>
2222
#include <linux/of.h>
23+
#include <linux/spi/spi-mem.h>
24+
#include <linux/mtd/spi-nor.h>
2325
#include <linux/reset.h>
2426
#include <linux/pm_runtime.h>
2527

@@ -682,6 +684,26 @@ static int bcm63xx_hsspi_transfer_one(struct spi_master *master,
682684
return 0;
683685
}
684686

687+
static bool bcm63xx_hsspi_mem_supports_op(struct spi_mem *mem,
688+
const struct spi_mem_op *op)
689+
{
690+
if (!spi_mem_default_supports_op(mem, op))
691+
return false;
692+
693+
/* Controller doesn't support spi mem dual io mode */
694+
if ((op->cmd.opcode == SPINOR_OP_READ_1_2_2) ||
695+
(op->cmd.opcode == SPINOR_OP_READ_1_2_2_4B) ||
696+
(op->cmd.opcode == SPINOR_OP_READ_1_2_2_DTR) ||
697+
(op->cmd.opcode == SPINOR_OP_READ_1_2_2_DTR_4B))
698+
return false;
699+
700+
return true;
701+
}
702+
703+
static const struct spi_controller_mem_ops bcm63xx_hsspi_mem_ops = {
704+
.supports_op = bcm63xx_hsspi_mem_supports_op,
705+
};
706+
685707
static irqreturn_t bcm63xx_hsspi_interrupt(int irq, void *dev_id)
686708
{
687709
struct bcm63xx_hsspi *bs = (struct bcm63xx_hsspi *)dev_id;
@@ -779,6 +801,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
779801
mutex_init(&bs->msg_mutex);
780802
init_completion(&bs->done);
781803

804+
master->mem_ops = &bcm63xx_hsspi_mem_ops;
782805
master->dev.of_node = dev->of_node;
783806
if (!dev->of_node)
784807
master->bus_num = HSSPI_BUS_NUM;

0 commit comments

Comments
 (0)