[PATCH v8 1/3] mtd: spi-nor: spansion: Add support for Read Any Register
Pratyush Yadav
p.yadav at ti.com
Thu Feb 24 11:58:36 PST 2022
On 21/02/22 04:14PM, tkuw584924 at gmail.com wrote:
> From: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
>
> The Read Any Register instruction (65h) is followed by register address
> and dummy cycles, then the selected register byte is returned. This patch
> adds a spi_mem_op template for that. The spi_mem_op is passed to
> spi_nor_read_reg() introduced by:
> https://lore.kernel.org/linux-mtd/20220210023334.408926-1-tudor.ambarus@microchip.com/T/#m05d56c77f8d55eb6f3dee4cb138bde4ff390d6c1
Hmm, I don't think you should put patch links in the commit message.
Better to put them below the "---" line.
>
> Signed-off-by: Takahiro Kuwano <Takahiro.Kuwano at infineon.com>
> ---
> Changes in v8:
> - Remove controller_ops
> - Remove spansion_read/write_any_reg()
> - Add spi_mem_op macro for Read Any Register
>
> Changes in v7:
> - No change
>
> Changes in v6:
> - Add helper functions for controller_ops
> - Add 'reg_addr_width' parameter to spansion_read/write_any_reg()
> - Remove spi_nor_write_enable() from spansion_write_any_reg() and modified
> function header comment
>
> Changes in v5:
> - Fix 'if (ret == 1)' to 'if (ret < 0)' in spansion_read_any_reg()
>
> Changes in v4:
> - Fix dummy cycle calculation in spansion_read_any_reg()
> - Modify comment for spansion_write_any_reg()
>
> Changes in v3:
> - Cleanup implementation
>
> drivers/mtd/spi-nor/spansion.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
> index 9bb239f1e142..9040edf7359f 100644
> --- a/drivers/mtd/spi-nor/spansion.c
> +++ b/drivers/mtd/spi-nor/spansion.c
> @@ -20,6 +20,11 @@
> #define SPINOR_OP_CYPRESS_RD_FAST 0xee
>
> /* Spansion/Cypress SPI NOR flash operations. */
> +#define SPI_NOR_SPANSION_RD_ANY_REG_OP(naddr, addr, ndummy, ndata, buf) \
> + SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RD_ANY_REG, 0), \
> + SPI_MEM_OP_ADDR(naddr, addr, 0), \
> + SPI_MEM_OP_DUMMY(ndummy, 0), \
> + SPI_MEM_OP_DATA_IN(ndata, buf, 0))
With the commit message fixed,
Reviewed-by: Pratyush Yadav <p.yadav at ti.com>
> #define SPI_NOR_SPANSION_WR_ANY_REG_OP(naddr, addr, ndata, buf) \
> SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_WR_ANY_REG, 0), \
> SPI_MEM_OP_ADDR(naddr, addr, 0), \
> --
> 2.25.1
>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
More information about the linux-mtd
mailing list