From: Felipe Balbi <balbi@ti.com>
To: Sourav Poddar <sourav.poddar@ti.com>
Cc: <balbi@ti.com>, <broonie@kernel.org>,
<spi-devel-general@lists.sourceforge.net>,
<grant.likely@linaro.org>, <rnayak@ti.com>,
<linux-omap@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCHv2] drivers: spi: Add qspi flash controller
Date: Tue, 2 Jul 2013 13:16:08 +0300 [thread overview]
Message-ID: <20130702101608.GO3352@arwen.pp.htv.fi> (raw)
In-Reply-To: <51D2A4CA.5030804@ti.com>
[-- Attachment #1: Type: text/plain, Size: 2174 bytes --]
Hi,
On Tue, Jul 02, 2013 at 03:30:42PM +0530, Sourav Poddar wrote:
> >>+static int dra7xxx_qspi_setup(struct spi_device *spi)
> >>+{
> >>+ struct dra7xxx_qspi *qspi =
> >>+ spi_master_get_devdata(spi->master);
> >>+
> >>+ int clk_div;
> >>+
> >>+ if (!qspi->spi_max_frequency)
> >>+ clk_div = 0;
> >won't this generate division by zero ?
> >
> Yes, Probably only an error should be thrown here. ?
> since min clk_div should be kept at 1.
right, if spi_max_frequency isn't passed, this is a broken DT binding.
Bail out.
> >>+ pm_runtime_get_sync(qspi->dev);
> >>+
> >>+ /* disable SCLK */
> >>+ dra7xxx_writel(qspi, dra7xxx_readl(qspi, QSPI_SPI_CLOCK_CNTRL_REG)
> >>+ & ~QSPI_CLK_EN, QSPI_SPI_CLOCK_CNTRL_REG);
> >>+
> >>+ if (clk_div< 0) {
btw, add a space between clk_div and <
> >>+ dra7xxx_writel(qspi, *txbuf++, QSPI_SPI_DATA_REG);
> >>+ dra7xxx_writel(qspi, qspi->dc, QSPI_SPI_DC_REG);
> >>+ dra7xxx_writel(qspi, qspi->cmd | QSPI_WR_SNGL,
> >>+ QSPI_SPI_CMD_REG);
> >>+ status = dra7xxx_readl(qspi, QSPI_SPI_STATUS_REG);
> >>+ timeout = QSPI_TIMEOUT;
> >>+ while ((status& QSPI_WC_BUSY) != QSPI_XFER_DONE) {
> >do you really need to poll ? No IRQ available ?
> >
> There is an interrupt available, I will try using that.
look at how i2c-omap.c synchronizes interrupt with the transfer_msg
code. It just uses a wait_for_completion().
> >>+static int dra7xxx_qspi_start_transfer_one(struct spi_master *master,
> >>+ struct spi_message *m)
> >>+{
> >>+ struct dra7xxx_qspi *qspi = spi_master_get_devdata(master);
> >>+ struct spi_device *spi = m->spi;
> >>+ struct spi_transfer *t;
> >>+ int status = 0;
> >>+ int flags = 0;
> >>+
> >>+ /* setup command reg */
> >>+ qspi->cmd = 0;
> >>+ qspi->cmd |= QSPI_WLEN(8);
> >>+ qspi->cmd |= QSPI_EN_CS(0);
> >>+ qspi->cmd |= 0xfff;
> Since, we dont know the number of frame lenght that need to be
> transferred and it comes from the spi framework, we keep the frame
> lenght to maximum.
> Then depending on the count value above in while loop, we terminate
> our trasnfer.
what ? seriously didn't get what you meant.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-07-02 10:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-02 8:56 Sourav Poddar
2013-07-02 9:24 ` Felipe Balbi
2013-07-02 10:00 ` Sourav Poddar
2013-07-02 10:16 ` Felipe Balbi [this message]
2013-07-02 10:23 ` Sourav Poddar
2013-07-02 10:31 ` Felipe Balbi
2013-07-02 10:39 ` Sourav Poddar
2013-07-02 9:32 ` Mark Brown
2013-07-02 9:44 ` Felipe Balbi
2013-07-02 10:17 ` Mark Brown
2013-07-02 10:26 ` Sourav Poddar
2013-07-02 10:43 ` Felipe Balbi
2013-07-02 11:04 ` Mark Brown
2013-07-02 15:19 ` Felipe Balbi
2013-07-02 15:49 ` Mark Brown
2013-07-02 10:57 ` Sekhar Nori
2013-07-02 10:59 ` Sourav Poddar
2013-07-02 15:58 ` Felipe Balbi
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=20130702101608.GO3352@arwen.pp.htv.fi \
--to=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=sourav.poddar@ti.com \
--cc=spi-devel-general@lists.sourceforge.net \
/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
all inboxes | Powered by JetHome®