From: William Zhang <william.zhang@broadcom.com>
To: Linux SPI List <linux-spi@vger.kernel.org>,
Broadcom Kernel List <bcm-kernel-feedback-list@broadcom.com>
Cc: f.fainelli@gmail.com, dregan@mail.com, joel.peshkin@broadcom.com,
dan.beygelman@broadcom.com, anand.gore@broadcom.com,
kursad.oney@broadcom.com, tomer.yacoby@broadcom.com,
jonas.gorski@gmail.com,
William Zhang <william.zhang@broadcom.com>,
Mark Brown <broonie@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH v4 13/15] spi: bcm63xx-hsspi: Disable spi mem dual io read op support
Date: Thu, 9 Feb 2023 12:02:44 -0800 [thread overview]
Message-ID: <20230209200246.141520-14-william.zhang@broadcom.com> (raw)
In-Reply-To: <20230209200246.141520-1-william.zhang@broadcom.com>
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 <william.zhang@broadcom.com>
---
(no changes since v3)
Changes in v3:
- Replace hard-coded opcode with SPINOR_OP definition
Changes in v2:
- Remove the code that uses the deprecated flag use_cs_workaround
- Always disable dual io read ops as prepend is the default mode
drivers/spi/spi-bcm63xx-hsspi.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/drivers/spi/spi-bcm63xx-hsspi.c b/drivers/spi/spi-bcm63xx-hsspi.c
index 6a289deb5848..1e9e906d297c 100644
--- a/drivers/spi/spi-bcm63xx-hsspi.c
+++ b/drivers/spi/spi-bcm63xx-hsspi.c
@@ -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>
@@ -682,6 +684,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;
@@ -779,6 +801,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
mutex_init(&bs->msg_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;
--
2.37.3
next prev parent reply other threads:[~2023-02-09 20:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-09 20:02 [PATCH v4 00/15] spi: bcm63xx-hsspi: driver and doc updates William Zhang
2023-02-09 20:02 ` [PATCH v4 01/15] dt-bindings: spi: Convert bcm63xx-hsspi bindings to json-schema William Zhang
2023-02-09 20:02 ` [PATCH v4 02/15] dt-bindings: spi: Add bcmbca-hsspi controller support William Zhang
2023-02-09 20:02 ` [PATCH v4 03/15] ARM: dts: broadcom: bcmbca: Add spi controller node William Zhang
2023-02-09 20:02 ` [PATCH v4 04/15] arm64: " William Zhang
2023-02-09 20:02 ` [PATCH v4 05/15] spi: bcm63xx-hsspi: Add new compatible string support William Zhang
2023-02-09 20:02 ` [PATCH v4 06/15] spi: bcm63xx-hsspi: Endianness fix for ARM based SoC William Zhang
2023-02-09 20:02 ` [PATCH v4 07/15] spi: bcm63xx-hsspi: Add polling mode support William Zhang
2023-02-09 20:02 ` [PATCH v4 08/15] spi: export spi_transfer_cs_change_delay_exec function William Zhang
2023-02-09 20:02 ` [PATCH v4 09/15] spi: bcm63xx-hsspi: Handle cs_change correctly William Zhang
2023-02-09 20:02 ` [PATCH v4 10/15] spi: bcm63xx-hsspi: Fix multi-bit mode setting William Zhang
2023-02-09 20:02 ` [PATCH v4 11/15] spi: bcm63xx-hsspi: Add prepend mode support William Zhang
2023-02-09 20:02 ` [PATCH v4 12/15] spi: spi-mem: Allow controller supporting mem_ops without exec_op William Zhang
2023-02-09 20:02 ` William Zhang [this message]
2023-02-09 20:02 ` [PATCH v4 14/15] spi: bcmbca-hsspi: Add driver for newer HSSPI controller William Zhang
2023-02-09 20:02 ` [PATCH v4 15/15] MAINTAINERS: Add entry for Broadcom Broadband SoC HS SPI drivers William Zhang
2023-02-10 12:53 ` [PATCH v4 00/15] spi: bcm63xx-hsspi: driver and doc updates Mark Brown
2023-02-11 0:54 ` (subset) " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230209200246.141520-14-william.zhang@broadcom.com \
--to=william.zhang@broadcom.com \
--cc=anand.gore@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=broonie@kernel.org \
--cc=dan.beygelman@broadcom.com \
--cc=dregan@mail.com \
--cc=f.fainelli@gmail.com \
--cc=joel.peshkin@broadcom.com \
--cc=jonas.gorski@gmail.com \
--cc=kursad.oney@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=tomer.yacoby@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).