[PATCH v1 04/14] mtd: spi-nor: move all xilinx specifics into xilinx.c
Pratyush Yadav
p.yadav at ti.com
Tue Feb 15 10:57:16 PST 2022
On 02/02/22 03:58PM, Michael Walle wrote:
> Mechanically move all the xilinx functions to its own module.
If you do some code changes mechanically you should also paste the
semantic patch for future reference.
>
> Then register the new flash specific ready() function.
>
> Signed-off-by: Michael Walle <michael at walle.cc>
> ---
> drivers/mtd/spi-nor/core.c | 64 +------------------------------
> drivers/mtd/spi-nor/core.h | 18 ---------
> drivers/mtd/spi-nor/xilinx.c | 73 ++++++++++++++++++++++++++++++++++++
> include/linux/mtd/spi-nor.h | 9 -----
> 4 files changed, 74 insertions(+), 90 deletions(-)
>
[...]
>
> +/**
> + * spi_nor_xread_sr() - Read the Status Register on S3AN flashes.
> + * @nor: pointer to 'struct spi_nor'.
> + * @sr: pointer to a DMA-able buffer where the value of the
> + * Status Register will be written.
> + *
> + * Return: 0 on success, -errno otherwise.
> + */
> +static int spi_nor_xread_sr(struct spi_nor *nor, u8 *sr)
Nitpick: rename to xilinx_read_sr()?
> +{
> + int ret;
> +
> + if (nor->spimem) {
> + struct spi_mem_op op =
> + SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_XRDSR, 0),
> + SPI_MEM_OP_NO_ADDR,
> + SPI_MEM_OP_NO_DUMMY,
> + SPI_MEM_OP_DATA_IN(1, sr, 0));
> +
> + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto);
> +
> + ret = spi_mem_exec_op(nor->spimem, &op);
> + } else {
> + ret = spi_nor_controller_ops_read_reg(nor, SPINOR_OP_XRDSR, sr,
> + 1);
> + }
> +
> + if (ret)
> + dev_dbg(nor->dev, "error %d reading XRDSR\n", ret);
> +
> + return ret;
> +}
> +
> +/**
> + * spi_nor_xsr_ready() - Query the Status Register of the S3AN flash to see if
> + * the flash is ready for new commands.
> + * @nor: pointer to 'struct spi_nor'.
> + *
> + * Return: 1 if ready, 0 if not ready, -errno on errors.
> + */
> +static int spi_nor_xsr_ready(struct spi_nor *nor)
Nitpick: rename to xilinx_sr_ready()?
Either way,
Reviewed-by: Pratyush Yadav <p.yadav at ti.com>
--
Regards,
Pratyush Yadav
Texas Instruments Inc.
More information about the linux-mtd
mailing list