public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Huang Shijie <shijie.huang@intel.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: "Marek Vasut" <marex@denx.de>,
	"Kuninori Morimoto" <kuninori.morimoto.gx@renesas.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Ben Hutchings" <ben@decadent.org.uk>,
	"Rafał Miłecki" <zajec5@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org,
	"David Woodhouse" <dwmw2@infradead.org>
Subject: Re: [PATCH 1/2] m25p80, spi-nor: Update id list of Macronix chips
Date: Tue, 10 Feb 2015 11:58:33 +0800	[thread overview]
Message-ID: <20150210035833.GA19195@hsj.sh.intel.com> (raw)
In-Reply-To: <20150206190950.GN18140@ld-irv-0074>

On Fri, Feb 06, 2015 at 11:09:50AM -0800, Brian Norris wrote:
> (fixed Huang's current email)
> 
> Hi,
> 
> On Fri, Feb 06, 2015 at 10:33:29PM +0800, Jim-Ting Kuo wrote:
> > On Fri, Feb 6, 2015 at 9:18 AM, Brian Norris
> > <computersforpeace@gmail.com> wrote:
> > > On Fri, Feb 06, 2015 at 02:44:04AM +0800, Jim Kuo wrote:
> > >> --- a/drivers/mtd/devices/m25p80.c
> > >> +++ b/drivers/mtd/devices/m25p80.c
> > >> @@ -170,6 +170,74 @@ static int m25p80_erase(struct spi_nor *nor, loff_t offset)
> > >>       return 0;
> > >>  }
> > >>
> > >> +static int m25p80_write_xfer(struct spi_nor *nor,
> > >> +             struct spi_nor_xfer_cfg *cfg, u8 *buf, size_t len)
> > >> +{
> ...
> > >> +}
> > >> +
> > >> +static int m25p80_read_xfer(struct spi_nor *nor,
> > >> +             struct spi_nor_xfer_cfg *cfg, u8 *buf, size_t len)
> > >> +{
> ...
> > >> +}
> > >> +
> > >
> > > All of the above is pointless. The write_xfer/read_xfer functions are
> > > not even used. (They should probably just be dropped, since they're
> > > doing nothing as-is.)
> > >
> > >>  /*
> > >>   * board specific setup should have ensured the SPI clock used here
> > >>   * matches what the READ command supports, at least until this driver
> > >> @@ -199,6 +267,8 @@ static int m25p_probe(struct spi_device *spi)
> > >>       nor->erase = m25p80_erase;
> > >>       nor->write_reg = m25p80_write_reg;
> > >>       nor->read_reg = m25p80_read_reg;
> > >> +     nor->write_xfer = m25p80_write_xfer;
> > >> +     nor->read_xfer = m25p80_read_xfer;
> > >>
> > >>       nor->dev = &spi->dev;
> > >>       nor->mtd = &flash->mtd;
> > >> @@ -261,10 +331,15 @@ static const struct spi_device_id m25p_ids[] = {
> > >>       {"mr25h256"},   {"mr25h10"},
> > >>       {"gd25q32"},    {"gd25q64"},
> > >>       {"160s33b"},    {"320s33b"},    {"640s33b"},
> > >> -     {"mx25l2005a"}, {"mx25l4005a"}, {"mx25l8005"},  {"mx25l1606e"},
> > >> -     {"mx25l3205d"}, {"mx25l3255e"}, {"mx25l6405d"}, {"mx25l12805d"},
> > >> -     {"mx25l12855e"},{"mx25l25635e"},{"mx25l25655e"},{"mx66l51235l"},
> > >> -     {"mx66l1g55g"},
> > >> +     {"mx25l512e"},  {"mx25l5121e"}, {"mx25l1006e"}, {"mx25l1021e"},
> > >> +     {"mx25l2006e"}, {"mx25l4006e"}, {"mx25u4035"},  {"mx25v4035"},
> > >> +     {"mx25l8006e"}, {"mx25u8035"},  {"mx25v8035"},  {"mx25l1606e"},
> > >> +     {"mx25l1633e"}, {"mx25l1635e"}, {"mx25u1635e"}, {"mx25l3206e"},
> > >> +     {"mx25l3239e"}, {"mx25l3225d"}, {"mx25l3255e"}, {"mx25l6406e"},
> > >> +     {"mx25l6439e"}, {"mx25l12839f"},        {"mx25l12855e"},
> > >> +     {"mx25u12835f"},        {"mx25l25635e"},        {"mx25l25655e"},
> > >> +     {"mx25u25635f"},        {"mx66l51235f"},        {"mx66u51235f"},
> > >> +     {"mx66l1g45g"}, {"mx66l1g55g"},
> > >>       {"n25q064"},    {"n25q128a11"}, {"n25q128a13"}, {"n25q256a"},
> > >>       {"n25q512a"},   {"n25q512ax3"}, {"n25q00"},
> > >>       {"pm25lv512"},  {"pm25lv010"},  {"pm25lq032"},
> > >> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> > >> index 0f8ec3c..a6c7337 100644
> > >> --- a/drivers/mtd/spi-nor/spi-nor.c
> > >> +++ b/drivers/mtd/spi-nor/spi-nor.c
> > >> @@ -545,19 +545,37 @@ static const struct spi_device_id spi_nor_ids[] = {
> > >>       { "640s33b",  INFO(0x898913, 0, 64 * 1024, 128, 0) },
> > >>
> > >>       /* Macronix */
> > >> -     { "mx25l2005a",  INFO(0xc22012, 0, 64 * 1024,   4, SECT_4K) },
> > >
> > > Nak.
> > >
> > >> -     { "mx25l4005a",  INFO(0xc22013, 0, 64 * 1024,   8, SECT_4K) },
> > >
> > > Nak.
> > >
> > >> -     { "mx25l8005",   INFO(0xc22014, 0, 64 * 1024,  16, 0) },
> > >
> > > Nak.
> > >
> > > (you get the picture)
> > >
> [...]
> > >
> > > You need to do a lot better job of documenting your patches (i.e.,
> > > describe why you're doing these things) if you want me to take them.
> > >
> > > What's more, the SFDP support you're trying to add should be done in a
> > > way where you *don't* need to muck with the ID table every time. With
> > > SFDP you can get most/all this information anyway, and devices should
> > > just be able to bind to this driver using a generic name like
> > > "spi-nor,sfdp" or something like that, instead of having to expand this
> > > table.
> > 
> > The write_xfer/read_xfer functions actually are used in patch 2.
> >  - read_xfer:  for macronix_block_lock function.
> >  - write_xfer:  for sfdp_read, macronix_read_lock_status function.
> > Original read/write fcuntions can only support one type transfer I/O (such as
> > FAST_READ, DUAL_READ or QUAD_READ which was detected at begin),
> > and they also only support fixed cycle of dummy (bind with transfer command).
> > So the commands not related to data transfer, such as sfdp read, lock/unlock
> > are hard to use original read/write. That's why I built these two of functions.
> > I thought they are suitable for this condition.
> 
> OK, I suppose that's a little more reasonable. But I want to make sure
> this is actually necessary. I suppose we can't get this functionality
> with the existing read_reg()/write_reg() ops, can we?
> 
> I'm not actually sure the exact purpose of the read_xfer()/write_xfer()
> functions as originally defined. They obviously weren't used yet.
> Perhaps Huang can comment here?
The read_xfer()/write_xfer() are designed for the strange spi-nor
controllers which has special optimizations for some operations, such as
combine several operations into one operation.

I am not familiar with SFDP, but I think it will be okay if the SFDP implements the
read_xfer()/write_xfer() if it really can not be implemented by the
read/write/read_reg/write_reg.


please see:
http://lists.infradead.org/pipermail/linux-mtd/2013-November/050492.html

Please split these patch into small patches, and document it well. :)

thanks
Huang Shijie

  reply	other threads:[~2015-02-10  4:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05 18:44 [PATCH 0/2] m25p80, spi-nor: Add SFDP detect method for Macronix chips Jim Kuo
2015-02-05 18:44 ` [PATCH 1/2] m25p80, spi-nor: Update id list of " Jim Kuo
2015-02-06  1:18   ` Brian Norris
2015-02-06 14:33     ` Jim-Ting Kuo
2015-02-06 19:09       ` Brian Norris
2015-02-10  3:58         ` Huang Shijie [this message]
2015-02-05 18:44 ` [PATCH 2/2] spi-nor: Add SFDP detect method Jim Kuo

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=20150210035833.GA19195@hsj.sh.intel.com \
    --to=shijie.huang@intel.com \
    --cc=ben@decadent.org.uk \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=geert+renesas@glider.be \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marex@denx.de \
    --cc=zajec5@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