public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>, linux-mtd@lists.infradead.org
Cc: boris.brezillon@free-electrons.com, cyrille.pitchen@wedev4u.fr,
	computersforpeace@gmail.com, han.xu@nxp.com, festevam@gmail.com,
	frieder.schrempf@exceet.de, prabhakar.kushwaha@nxp.com,
	suresh.gupta@nxp.com
Subject: Re: [PATCH v10 1/2] mtd: fsl-quadspi: add support to create dynamic LUT entry
Date: Tue, 10 Apr 2018 11:23:18 +0200	[thread overview]
Message-ID: <27c7d206-e33b-746a-81e4-d01826eb8e67@gmail.com> (raw)
In-Reply-To: <1523349348-20778-2-git-send-email-yogeshnarayan.gaur@nxp.com>

On 04/10/2018 10:35 AM, Yogesh Gaur wrote:
> Add support to create dynamic LUT entry.
> 
> Current approach of creating LUT entries for various cmds like read, write,
> erase, readid, readsr, we, wd etc is that when QSPI controller gets
> initialized at that time static LUT entries for these cmds get created.
> 
> Patch add support to create the LUT at run time based on the operation
> being performed.
> 
> Added API fsl_qspi_prepare_lut(), this API would going to be called from
> fsl_qspi_read_reg, fsl_qspi_write_reg, fsl_qspi_write, fsl_qspi_read and
> fsl_qspi_erase APIs.
> Added new struct fsl_qspi_mem_op having fields required to fill in LUT
> register for requested command.
> Required values for every CMD like opcode, addrlen, dummy_cycles, data_size
> and pad bytes being filled in respective calling function and then API
> fsl_qspi_prepare_lut fill LUT register for requested command.
> Required values are fetched from instance of 'struct spi_nor'.
> 
> AHB Read, memory mapped, can be triggered using driver interface as well
> from 'devmem' interface.
> For AHB read, LUT seq programmed in QUADSPI_BFGENCR register used for
> Read operation. Thus, for Read initiated from 'devmem' requires to have
> dedicated LUT seq and programmed in probe routine for AHB read.
> 
> Signed-off-by: Suresh Gupta <suresh.gupta@nxp.com>
> Signed-off-by: Yogesh Gaur <yogeshnarayan.gaur@nxp.com>
[...]

> +/* Prepare LUT for AHB read - required for read from devmem interface */
> +static void fsl_qspi_prep_ahb_read(struct fsl_qspi *q)
> +{
> +	struct fsl_qspi_mem_op op;
> +	struct spi_nor *nor = q->nor;
> +	enum spi_nor_protocol protocol = nor->read_proto;
> +
> +	fsl_clr_qspi_mem_data(&op);
> +	op.cmd.opcode = nor->read_opcode;
> +	op.cmd.pad = spi_nor_get_protocol_inst_nbits(protocol);
> +
> +	op.addr.addrlen = (nor->addr_width == 3) ? ADDR24BIT : ADDR32BIT;
> +	op.addr.pad = spi_nor_get_protocol_addr_nbits(protocol);
> +
> +	op.dummy.ncycles = nor->read_dummy;
> +	op.dummy.pad = spi_nor_get_protocol_data_nbits(protocol);
> +
> +	op.data.dir = QSPI_MEM_DATA_IN;
> +	op.data.pad = spi_nor_get_protocol_data_nbits(protocol);
> +	/* Data size ignored for AHB Read. */
> +	op.data.nbytes = 0;
> +
> +	op.mode = QSPI_CMD_MODE_AHB;

This or similar code seems present below about 5 more times, factor it out.

Also, this patch needs splitting into more smaller patches.

[...]
-- 
Best regards,
Marek Vasut

  reply	other threads:[~2018-04-10  9:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10  8:35 [PATCH v10 0/2] mtd: fsl-quadspi: add support to create dynamic LUT entry Yogesh Gaur
2018-04-10  8:35 ` [PATCH v10 1/2] " Yogesh Gaur
2018-04-10  9:23   ` Marek Vasut [this message]
2018-04-10  8:35 ` [PATCH v10 2/2] mtd: fsl-quadspi: fix init AHB read in fsl_qspi_nor_setup() Yogesh Gaur
2018-04-10  9:25   ` Marek Vasut
2018-04-10  8:44 ` [PATCH v10 0/2] mtd: fsl-quadspi: add support to create dynamic LUT entry Boris Brezillon

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=27c7d206-e33b-746a-81e4-d01826eb8e67@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=festevam@gmail.com \
    --cc=frieder.schrempf@exceet.de \
    --cc=han.xu@nxp.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=prabhakar.kushwaha@nxp.com \
    --cc=suresh.gupta@nxp.com \
    --cc=yogeshnarayan.gaur@nxp.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