|
20 | 20 | #include <linux/spi/spi.h>
|
21 | 21 | #include <linux/mutex.h>
|
22 | 22 | #include <linux/of.h>
|
| 23 | +#include <linux/spi/spi-mem.h> |
| 24 | +#include <linux/mtd/spi-nor.h> |
23 | 25 | #include <linux/reset.h>
|
24 | 26 | #include <linux/pm_runtime.h>
|
25 | 27 |
|
@@ -682,6 +684,26 @@ static int bcm63xx_hsspi_transfer_one(struct spi_master *master,
|
682 | 684 | return 0;
|
683 | 685 | }
|
684 | 686 |
|
| 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 | + |
685 | 707 | static irqreturn_t bcm63xx_hsspi_interrupt(int irq, void *dev_id)
|
686 | 708 | {
|
687 | 709 | struct bcm63xx_hsspi *bs = (struct bcm63xx_hsspi *)dev_id;
|
@@ -779,6 +801,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
|
779 | 801 | mutex_init(&bs->msg_mutex);
|
780 | 802 | init_completion(&bs->done);
|
781 | 803 |
|
| 804 | + master->mem_ops = &bcm63xx_hsspi_mem_ops; |
782 | 805 | master->dev.of_node = dev->of_node;
|
783 | 806 | if (!dev->of_node)
|
784 | 807 | master->bus_num = HSSPI_BUS_NUM;
|
|
0 commit comments