[PATCH RFC 06/16] spi: amlogic: spifc-a4: Consume dummy cycles directly

From: Miquel Raynal

Date: Wed Nov 25 2026 - 12:52:44 EST


The spi-mem layer is now capable of providing the dummy phase in cycle
units rather than bytes, provided that drivers advertize the dummy_cycle
capability. Since this controller is consuming cycles and currently
converts bytes into cycles, flag it capable to consume cycles directly
and drop the extra conversions.

Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx>
---
drivers/spi/spi-amlogic-spifc-a4.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-amlogic-spifc-a4.c b/drivers/spi/spi-amlogic-spifc-a4.c
index 16346f50c7d9..ac06ea735133 100644
--- a/drivers/spi/spi-amlogic-spifc-a4.c
+++ b/drivers/spi/spi-amlogic-spifc-a4.c
@@ -361,13 +361,8 @@ static int aml_sfc_send_cmd_addr_dummy(struct aml_sfc *sfc, const struct spi_mem
if (ret)
return ret;

- if (op->dummy.nbytes) {
- /* Dummy buswidth configuration is not supported */
- if (aml_sfc_is_xio_op(op))
- dummy_cycle = op->dummy.nbytes * 8 / op->data.buswidth;
- else
- dummy_cycle = op->dummy.nbytes * 8;
- cmd = CMD_DUMMY(sfc->cs_sel, dummy_cycle - 1);
+ if (op->dummy.ncycles) {
+ cmd = CMD_DUMMY(sfc->cs_sel, op->dummy.ncycles - 1);
return regmap_write(sfc->regmap_base, SFC_CMD, cmd);
}

@@ -803,7 +798,7 @@ static int aml_sfc_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)

dev_dbg(sfc->dev, "cmd:0x%02x - addr:%08llX@%d:%u - dummy:%d:%u - data:%d:%u",
op->cmd.opcode, op->addr.val, op->addr.buswidth, op->addr.nbytes,
- op->dummy.buswidth, op->dummy.nbytes, op->data.buswidth, op->data.nbytes);
+ op->dummy.buswidth, op->dummy.ncycles, op->data.buswidth, op->data.nbytes);

ret = aml_sfc_pre_transfer(sfc, DEFAULT_PULLUP_CYCLE, CS_SETUP_CYCLE);
if (ret)
@@ -1057,6 +1052,7 @@ static int aml_sfc_ecc_finish_io_req(struct nand_device *nand,

static const struct spi_controller_mem_caps aml_sfc_mem_caps = {
.ecc = true,
+ .dummy_cycles = true,
};

static const struct nand_ecc_engine_ops aml_sfc_ecc_engine_ops = {

--
2.56.0