linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: "Mandal, Purna Chandra" <purna.chandra.mandal@intel.com>
To: Tudor.Ambarus@microchip.com, f.blogs@napier.co.nz,
	boris.brezillon@bootlin.com
Cc: vigneshr@ti.com, richard@nod.at, linux-kernel@vger.kernel.org,
	marek.vasut@gmail.com, linux-mtd@lists.infradead.org,
	computersforpeace@gmail.com, dwmw2@infradead.org
Subject: Re: [PATCH] mtd: spi-nor: cadence-quadspi: write upto 8-bytes data in STIG mode
Date: Mon, 28 Jan 2019 10:27:20 +0530	[thread overview]
Message-ID: <76066a83-1cd2-5baf-1930-c290f66e73ba@intel.com> (raw)
In-Reply-To: <c627314d-fdf6-7e69-7c54-03a513f563fc@microchip.com>


On 21-Jan-19 3:07 PM, Tudor.Ambarus@microchip.com wrote:
> Hi, Purna,
> 
> On 12/14/2018 04:15 AM, Purna Chandra Mandal wrote:
>> cadence-quadspi controller allows upto eight bytes of data to be transferred
>> in software Triggered Instruction generator (STIG) mode of operation. Lower
>> 4 bytes are written through writedatalower and upper 4 bytes by
>> writedataupper register.
> 
> Is this supported by all versions of the IP?
> 
Yes, it is supported on all versions of IP.
>>
>> This patch allows all the 8 bytes to be written.
>>
>> Signed-off-by: Purna Chandra Mandal <purna.chandra.mandal@intel.com>
>> ---
>>
>>   drivers/mtd/spi-nor/cadence-quadspi.c | 9 +++++++--
>>   1 file changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
>> index 04cedd3a2bf6..990934387fea 100644
>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c
>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c
>> @@ -420,7 +420,7 @@ static int cqspi_command_write(struct spi_nor *nor, const u8 opcode,
>>   	unsigned int data;
> 
> I know that this is not your change, but data should be u32 and not unsigned
> int. reg too ... probably one should submit a patch to change this, I see that
> the same error is done in cqspi_command_read().
ack. will be done in separate patch.
> 
>>   	int ret;
>>   
>> -	if (n_tx > 4 || (n_tx && !txbuf)) {
>> +	if (n_tx > CQSPI_STIG_DATA_LEN_MAX || (n_tx && !txbuf)) {
>>   		dev_err(nor->dev,
>>   			"Invalid input argument, cmdlen %d txbuf 0x%p\n",
>>   			n_tx, txbuf);
>> @@ -435,8 +435,13 @@ static int cqspi_command_write(struct spi_nor *nor, const u8 opcode,
>>   		data = 0;>  		memcpy(&data, txbuf, n_tx);
> 
> You should limit what is copied in data, similar to what is done in
> cqspi_command_read():
> 
> write_len = (n_tx > 4) ? 4 : n_tx;
> memcpy(&data, txbuf, write_len);
> txbuf += write_len;
ack.
> 
> 
> 
>>   		writel(data, reg_base + CQSPI_REG_CMDWRITEDATALOWER);
>> -	}
>>   
>> +		if (n_tx > 4) {
>> +			data = 0;
> and then:
> write_len = n_tx - 4;
> memcpy(&data, txbuf, write_len);
> 
ack.
> Cheers,
> ta
> 
>> +			memcpy(&data, txbuf + 4, n_tx - 4);
>> +			writel(data, reg_base + CQSPI_REG_CMDWRITEDATAUPPER);
>> +		}
>> +	}
>>   	ret = cqspi_exec_flash_cmd(cqspi, reg);
>>   	return ret;
>>   }
>>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2019-01-28  4:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  2:15 [PATCH] mtd: spi-nor: cadence-quadspi: write upto 8-bytes data in STIG mode Purna Chandra Mandal
2019-01-21  9:37 ` Tudor.Ambarus
2019-01-28  4:57   ` Mandal, Purna Chandra [this message]
2019-01-28  5:02 Purna Chandra Mandal
2019-02-03 12:20 ` Tudor.Ambarus
2019-02-04 13:37   ` Vignesh R
2019-02-05  7:00     ` Mandal, Purna Chandra
2019-02-05 10:00       ` Vignesh R

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=76066a83-1cd2-5baf-1930-c290f66e73ba@intel.com \
    --to=purna.chandra.mandal@intel.com \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=f.blogs@napier.co.nz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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).