linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sourav Poddar <sourav.poddar@ti.com>
To: Huang Shijie <shijie8@gmail.com>
Cc: marex@denx.de, devicetree@vger.kernel.org,
	linux-omap@vger.kernel.org, balbi@ti.com,
	linux-spi@vger.kernel.org, broonie@kernel.org,
	linux-mtd@lists.infradead.org, bcousson@baylibre.com,
	computersforpeace@gmail.com, dwmw2@infradead.org
Subject: Re: [PATCHv2 07/10] drivers: mtd: m25p80: Adapt driver to support memory mapped read.
Date: Thu, 12 Dec 2013 13:45:24 +0530	[thread overview]
Message-ID: <52A9709C.4010606@ti.com> (raw)
In-Reply-To: <20131212075536.GA1596@gmail.com>

On Thursday 12 December 2013 01:25 PM, Huang Shijie wrote:
> On Fri, Dec 06, 2013 at 07:54:48PM +0530, Sourav Poddar wrote:
>> Adapt driver to do a memory mapped read.
>> @@ -109,6 +109,7 @@ struct m25p {
>>   	u8			program_opcode;
>>   	u8			*command;
>>   	enum read_type		flash_read;
>> +	void __iomem *mem_addr;
> I think we can remove this field.
> You can use a local variable in the m25p80_read.
>
>>   };
>>
>>   static inline struct m25p *mtd_to_m25p(struct mtd_info *mtd)
>> @@ -515,6 +516,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
>>   	size_t *retlen, u_char *buf)
>>   {
>>   	struct m25p *flash = mtd_to_m25p(mtd);
>> +	struct spi_master *master = flash->spi->master;
>>   	struct spi_transfer t[2];
>>   	struct spi_message m;
>>   	uint8_t opcode;
>> @@ -523,6 +525,20 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
>>   	pr_debug("%s: %s from 0x%08x, len %zd\n", dev_name(&flash->spi->dev),
>>   			__func__, (u32)from, len);
>>
>> +	if (master->mmap) {
>> +		mutex_lock(&flash->lock);
>> +		/* Wait till previous write/erase is done. */
>> +		if (wait_till_ready(flash)) {
>> +			mutex_unlock(&flash->lock);
>> +			return 1;
>> +		}
>> +		flash->mem_addr = master->get_buf(master);
>> +		memcpy(buf, flash->mem_addr + from, len);
>> +		master->put_buf(master);
>> +		*retlen = len;
>> +		goto out;
>> +	}
>> +
>>   	spi_message_init(&m);
>>   	memset(t, 0, (sizeof t));
>>
>> @@ -558,6 +574,7 @@ static int m25p80_read(struct mtd_info *mtd, loff_t from, size_t len,
>>
>>   	*retlen = m.actual_length - m25p_cmdsz(flash) - dummy;
>>
>> +out:
>>   	mutex_unlock(&flash->lock);
>>
>>   	return 0;
>> @@ -1286,6 +1303,9 @@ static int m25p_probe(struct spi_device *spi)
>>   		flash->addr_width = 3;
>>   	}
>>
>> +	if (spi->master->configure_from_slave)
>> +		m25p80_fill_flash_information(flash);
>> +
> You have add a configure_from_slave hook in the SPI, why you also need
> a same hook in the SPI-NOR framework?
>
We need a way to provoke this, currently it is placed in m25p80. If m25p80
is removed, for where should I handle these in nor framework?
> And i think the enable_mmap/disable_mmap is not needed too.
>
> All the three hooks are used to set the SPI bus controller.

> And the SPI-NOR framework only handles the issues between the
> SPI bus controller and the SPI-NOR, or the SPI-NOR controller and the
> SPI-NOR.
My controller can be used as spi flash controller as well as a spi
controller.
> thanks
> Huang Shijie
>
>

  reply	other threads:[~2013-12-12  8:15 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06 14:24 [PATCHv2 00/10] Add memory mapped support for ti qspi, m25p80 serial flash Sourav Poddar
2013-12-06 14:24 ` [PATCHv2 01/10] spi/spi.h: Add get_buf/put_buf support in spi master Sourav Poddar
2013-12-19 13:31   ` Mark Brown
2013-12-06 14:24 ` [PATCHv2 02/10] spi/qspi: parse register by name Sourav Poddar
2013-12-19 13:34   ` Mark Brown
2013-12-06 14:24 ` [PATCHv2 03/10] spi/qspi: Add support to switc to memory mapped operation Sourav Poddar
2013-12-10 12:54   ` Marek Vasut
2013-12-06 14:24 ` [PATCHv2 04/10] spi/qspi: configure set up register for memory map Sourav Poddar
2013-12-10 12:57   ` Marek Vasut
2013-12-10 17:13     ` Sourav Poddar
2013-12-06 14:24 ` [PATCHv2 05/10] spi/qspi: Add api for get_buf/put_buf Sourav Poddar
2013-12-10 12:58   ` Marek Vasut
2013-12-10 17:10     ` Sourav Poddar
2013-12-06 14:24 ` [PATCHv2 06/10] drivers: mtd: m25p80: Add api to configure master register Sourav Poddar
2013-12-06 14:24 ` [PATCHv2 07/10] drivers: mtd: m25p80: Adapt driver to support memory mapped read Sourav Poddar
2013-12-12  7:55   ` Huang Shijie
2013-12-12  8:15     ` Sourav Poddar [this message]
2013-12-12  8:31       ` Huang Shijie
2013-12-06 14:24 ` [PATCHv2 08/10] Documentation: bindings: ti-qspi: update binding information Sourav Poddar
2013-12-19 13:34   ` Mark Brown
2013-12-06 14:24 ` [PATCHv2 09/10] arm: dts: dra7: Add qspi device Sourav Poddar
2013-12-09 17:42   ` Tony Lindgren
2013-12-10  4:25     ` Sourav Poddar
2013-12-10 10:31       ` Mark Brown
2013-12-10 10:45         ` Sourav Poddar
2013-12-12  4:20         ` Sourav Poddar
2013-12-06 14:24 ` [PATCHv2 10/10] arm: dts: am43x-epos: " Sourav Poddar
2013-12-10 12:49 ` [PATCHv2 00/10] Add memory mapped support for ti qspi, m25p80 serial flash Marek Vasut
2013-12-10 16:11   ` Mark Brown
2013-12-10 18:22     ` Marek Vasut
2013-12-10 18:29       ` Mark Brown
2013-12-10 18:34         ` Marek Vasut
2013-12-11  4:37         ` Sourav Poddar
2013-12-11  4:19       ` Sourav Poddar
2013-12-11  4:18   ` Sourav Poddar
2013-12-11 10:44     ` Marek Vasut
2013-12-11 12:01       ` Mark Brown

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=52A9709C.4010606@ti.com \
    --to=sourav.poddar@ti.com \
    --cc=balbi@ti.com \
    --cc=bcousson@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=marex@denx.de \
    --cc=shijie8@gmail.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).