All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sourav Poddar <sourav.poddar@ti.com>
To: Trent Piepho <tpiepho@gmail.com>
Cc: <broonie@kernel.org>, <spi-devel-general@lists.sourceforge.net>,
	<grant.likely@linaro.org>, <linux-omap@vger.kernel.org>,
	<rnayak@ti.com>, <linux-kernel@vger.kernel.org>, <balbi@ti.com>
Subject: Re: [PATCHv4 2/3] drivers: spi: Add qspi flash controller
Date: Fri, 19 Jul 2013 10:32:50 +0530	[thread overview]
Message-ID: <51E8C87A.3030007@ti.com> (raw)
In-Reply-To: <CA+7tXij7W_F0ZTQZ=YvK+qOLO+O-6WpTKxLerv8NXyrdydt7FA@mail.gmail.com>

On Friday 19 July 2013 12:38 AM, Trent Piepho wrote:
> On Thu, Jul 18, 2013 at 3:01 AM, Sourav Poddar<sourav.poddar@ti.com>  wrote:
>> +Required properties:
>> +- compatible : should be "ti,dra7xxx-qspi".
>> +- reg: Should contain QSPI registers location and length.
>> +- #address-cells, #size-cells : Must be present if the device has sub-nodes
>> +- ti,hwmods: Name of the hwmod associated to the QSPI
> What is ti,hwmods?  It's not clear from the description.  It also
> doesn't appear to be used in the driver.  At least, I did not find any
> occurrence of "hwmods" in the driver code.
>
>> +static inline unsigned long ti_qspi_readl_data(struct ti_qspi *qspi,
>> +               unsigned long reg, int wlen)
> "readl" means read LONG.  That's what the L is for.  But this does
> different widths.
>
>> +{
>> +       switch (wlen) {
>> +       case 8:
>> +               return readw(qspi->base + reg);
>> +               break;
> wlen == 8, but readw == 16 bit read?
Yes, I need to change this. should be readb.
> The break after the return isn't necessary.
>
>> +       case 16:
>> +               return readb(qspi->base + reg);
>> +               break;
> wlen == 16, but readb == 8 bit read?
>
same here.
>> +       case 32:
>> +               return readl(qspi->base + reg);
> wlen == 32, readl == 32, this one makes sense, but....
>
>> +static inline void ti_qspi_writel_data(struct ti_qspi *qspi,
>> +               unsigned long val, unsigned long reg, int wlen)
>> +       case 32:
>> +               writeb(val, qspi->base + reg);
>> +               break;
> A 32 bit write uses an 8 bit write command, while read is 32 bits??
>
> This doesn't make a lot of sense.  If it's actually correct, there
> should be come kind of comment about it.
>
Yes, I will change this in the next version.
>> +
>> +static int ti_qspi_setup(struct spi_device *spi)
>> +{
>> +
>> +       clk_ctrl_reg = ti_qspi_readl(qspi, QSPI_SPI_CLOCK_CNTRL_REG);
>> +
>> +       clk_ctrl_reg&= ~QSPI_CLK_EN;
>> +
>> +       /* disable SCLK */
>> +       ti_qspi_writel(qspi, clk_ctrl_reg, QSPI_SPI_CLOCK_CNTRL_REG);
> Did you read this from Documentation/spi/spi-summary?
>                  ** BUG ALERT:  for some reason the first version of
>                  ** many spi_master drivers seems to get this wrong.
>                  ** When you code setup(), ASSUME that the controller
>                  ** is actively processing transfers for another device.
>
But I see in this documentation, that setup is usually used for setting up
device clock rate, modes etc.
So, what do you recommend here, should we move clk settings to prepare
hardware ?
>> +static int ti_qspi_probe(struct platform_device *pdev)
>> +{
>> +
>> +       master->mode_bits = SPI_CPOL | SPI_CPHA;
> Does your device support full duplex?  It doesn't look like it does.
> You should set the SPI_MASER_HALF_DUPLEX flag in master->flags.
>
hmm. Ok, will add.
>> +
>> +       if (!of_property_read_u32(np, "ti,spi-num-cs",&num_cs))
>> +               master->num_chipselect = num_cs;
> You didn't document this property.  How is this different than the
> "num-cs" property already documented in spi-bus bindings?
>
Actually, it is no different. This also means the total number of 
chipselects.
I used it from omap mcspi. I will make this property in accordance with the
generic binding.
Will also send a seperate patch for omap mcspi.
>> +       qspi->base = devm_ioremap_resource(&pdev->dev, r);
>> +       if (IS_ERR(qspi->base)) {
>> +               ret = -ENOMEM;
> Shouldn't that be ret = PTR_ERR(qspi->base)
hmm.will change.


WARNING: multiple messages have this Message-ID (diff)
From: Sourav Poddar <sourav.poddar@ti.com>
To: Trent Piepho <tpiepho@gmail.com>
Cc: broonie@kernel.org, spi-devel-general@lists.sourceforge.net,
	grant.likely@linaro.org, linux-omap@vger.kernel.org,
	rnayak@ti.com, linux-kernel@vger.kernel.org, balbi@ti.com
Subject: Re: [PATCHv4 2/3] drivers: spi: Add qspi flash controller
Date: Fri, 19 Jul 2013 10:32:50 +0530	[thread overview]
Message-ID: <51E8C87A.3030007@ti.com> (raw)
In-Reply-To: <CA+7tXij7W_F0ZTQZ=YvK+qOLO+O-6WpTKxLerv8NXyrdydt7FA@mail.gmail.com>

On Friday 19 July 2013 12:38 AM, Trent Piepho wrote:
> On Thu, Jul 18, 2013 at 3:01 AM, Sourav Poddar<sourav.poddar@ti.com>  wrote:
>> +Required properties:
>> +- compatible : should be "ti,dra7xxx-qspi".
>> +- reg: Should contain QSPI registers location and length.
>> +- #address-cells, #size-cells : Must be present if the device has sub-nodes
>> +- ti,hwmods: Name of the hwmod associated to the QSPI
> What is ti,hwmods?  It's not clear from the description.  It also
> doesn't appear to be used in the driver.  At least, I did not find any
> occurrence of "hwmods" in the driver code.
>
>> +static inline unsigned long ti_qspi_readl_data(struct ti_qspi *qspi,
>> +               unsigned long reg, int wlen)
> "readl" means read LONG.  That's what the L is for.  But this does
> different widths.
>
>> +{
>> +       switch (wlen) {
>> +       case 8:
>> +               return readw(qspi->base + reg);
>> +               break;
> wlen == 8, but readw == 16 bit read?
Yes, I need to change this. should be readb.
> The break after the return isn't necessary.
>
>> +       case 16:
>> +               return readb(qspi->base + reg);
>> +               break;
> wlen == 16, but readb == 8 bit read?
>
same here.
>> +       case 32:
>> +               return readl(qspi->base + reg);
> wlen == 32, readl == 32, this one makes sense, but....
>
>> +static inline void ti_qspi_writel_data(struct ti_qspi *qspi,
>> +               unsigned long val, unsigned long reg, int wlen)
>> +       case 32:
>> +               writeb(val, qspi->base + reg);
>> +               break;
> A 32 bit write uses an 8 bit write command, while read is 32 bits??
>
> This doesn't make a lot of sense.  If it's actually correct, there
> should be come kind of comment about it.
>
Yes, I will change this in the next version.
>> +
>> +static int ti_qspi_setup(struct spi_device *spi)
>> +{
>> +
>> +       clk_ctrl_reg = ti_qspi_readl(qspi, QSPI_SPI_CLOCK_CNTRL_REG);
>> +
>> +       clk_ctrl_reg&= ~QSPI_CLK_EN;
>> +
>> +       /* disable SCLK */
>> +       ti_qspi_writel(qspi, clk_ctrl_reg, QSPI_SPI_CLOCK_CNTRL_REG);
> Did you read this from Documentation/spi/spi-summary?
>                  ** BUG ALERT:  for some reason the first version of
>                  ** many spi_master drivers seems to get this wrong.
>                  ** When you code setup(), ASSUME that the controller
>                  ** is actively processing transfers for another device.
>
But I see in this documentation, that setup is usually used for setting up
device clock rate, modes etc.
So, what do you recommend here, should we move clk settings to prepare
hardware ?
>> +static int ti_qspi_probe(struct platform_device *pdev)
>> +{
>> +
>> +       master->mode_bits = SPI_CPOL | SPI_CPHA;
> Does your device support full duplex?  It doesn't look like it does.
> You should set the SPI_MASER_HALF_DUPLEX flag in master->flags.
>
hmm. Ok, will add.
>> +
>> +       if (!of_property_read_u32(np, "ti,spi-num-cs",&num_cs))
>> +               master->num_chipselect = num_cs;
> You didn't document this property.  How is this different than the
> "num-cs" property already documented in spi-bus bindings?
>
Actually, it is no different. This also means the total number of 
chipselects.
I used it from omap mcspi. I will make this property in accordance with the
generic binding.
Will also send a seperate patch for omap mcspi.
>> +       qspi->base = devm_ioremap_resource(&pdev->dev, r);
>> +       if (IS_ERR(qspi->base)) {
>> +               ret = -ENOMEM;
> Shouldn't that be ret = PTR_ERR(qspi->base)
hmm.will change.


  parent reply	other threads:[~2013-07-19  5:03 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-18 10:01 [PATCH 0/3] spi changes and ti quad spi controller Sourav Poddar
2013-07-18 10:01 ` Sourav Poddar
2013-07-18 10:01 ` Sourav Poddar
2013-07-18 10:01 ` [RFC/PATCHv2 1/3] driver: spi: Modify core to compute the message length Sourav Poddar
2013-07-18 10:01   ` Sourav Poddar
2013-07-18 10:01   ` Sourav Poddar
2013-07-18 15:22   ` Mark Brown
2013-07-18 10:01 ` [PATCHv4 2/3] drivers: spi: Add qspi flash controller Sourav Poddar
2013-07-18 10:01   ` Sourav Poddar
2013-07-18 10:01   ` Sourav Poddar
2013-07-18 10:24   ` Felipe Balbi
2013-07-18 10:24     ` Felipe Balbi
2013-07-18 11:18     ` Sourav Poddar
2013-07-18 11:18       ` Sourav Poddar
2013-07-18 11:18       ` Sourav Poddar
2013-07-18 11:24       ` Felipe Balbi
2013-07-18 11:24         ` Felipe Balbi
2013-07-18 12:24         ` Sourav Poddar
2013-07-18 12:24           ` Sourav Poddar
2013-07-18 12:24           ` Sourav Poddar
2013-07-19 11:48         ` Sourav Poddar
2013-07-19 11:48           ` Sourav Poddar
2013-07-19 12:20           ` Felipe Balbi
2013-07-19 12:20             ` Felipe Balbi
2013-07-18 10:42   ` Mark Brown
2013-07-18 11:45     ` Sourav Poddar
2013-07-18 11:45       ` Sourav Poddar
2013-07-18 11:56       ` Felipe Balbi
2013-07-18 11:56         ` Felipe Balbi
2013-07-18 13:18       ` Mark Brown
2013-07-18 13:31         ` Felipe Balbi
2013-07-18 13:31           ` Felipe Balbi
2013-07-18 14:42           ` Mark Brown
2013-07-18 14:55             ` Sourav Poddar
2013-07-18 14:55               ` Sourav Poddar
2013-07-18 15:28               ` Mark Brown
2013-07-19 11:55     ` Sourav Poddar
2013-07-19 11:55       ` Sourav Poddar
2013-07-18 19:08   ` Trent Piepho
2013-07-18 19:08     ` Trent Piepho
2013-07-18 20:39     ` Mark Brown
2013-07-18 20:59       ` Nishanth Menon
2013-07-18 20:59         ` Nishanth Menon
2013-07-19  5:02     ` Sourav Poddar [this message]
2013-07-19  5:02       ` Sourav Poddar
2013-07-18 10:01 ` [RFC/PATCHv2 3/3] driver: spi: Add quad spi read support Sourav Poddar
2013-07-18 10:01   ` Sourav Poddar
2013-07-18 10:01   ` Sourav Poddar
2013-07-18 10:44   ` Mark Brown
2013-07-18 11:52     ` Sourav Poddar
2013-07-18 11:52       ` Sourav Poddar

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=51E8C87A.3030007@ti.com \
    --to=sourav.poddar@ti.com \
    --cc=balbi@ti.com \
    --cc=broonie@kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=rnayak@ti.com \
    --cc=spi-devel-general@lists.sourceforge.net \
    --cc=tpiepho@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.