From: Felipe Balbi <balbi@ti.com>
To: Sourav Poddar <sourav.poddar@ti.com>
Cc: <broonie@kernel.org>, <spi-devel-general@lists.sourceforge.net>,
<grant.likely@linaro.org>, <balbi@ti.com>, <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 18:58:27 +0300 [thread overview]
Message-ID: <20130702155827.GA7626@arwen.pp.htv.fi> (raw)
In-Reply-To: <1372755399-21769-1-git-send-email-sourav.poddar@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1563 bytes --]
Hi,
Alright, so I spent some time looking at the SPI framework and :
On Tue, Jul 02, 2013 at 02:26:39PM +0530, Sourav Poddar wrote:
> +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);
this m->spi->bits_per_word;
> + qspi->cmd |= QSPI_EN_CS(0);
this should be m->spi->chip_select;
> + qspi->cmd |= 0xfff;
this will be a little tricky to count... because, I believe it should be
something like:
int count = 0;
list_for_each_entry(t, &m->transfers, transfer_list)
count += t->len;
frame_length = DIV_ROUND_UP(count, m->spi->bits_per_word);
/* up to 4096 words */
frame_length = clamp(frame_length, 4096);
qspi->cmd |= QSPI_FRAME_LENGTH(DIV_ROUND_UP(count,
frame_length));
Now, it would've been better if SPI framework would already give us
some sort of total_length field in struct spi_message which would be the
sum of all spi_transfers.
> + /* setup device control reg */
> + qspi->dc = 0;
> +
> + if (spi->mode & SPI_CPHA)
> + qspi->dc |= QSPI_CKPHA(0);
> + if (spi->mode & SPI_CPOL)
> + qspi->dc |= QSPI_CKPOL(0);
> + if (spi->mode & SPI_CS_HIGH)
> + qspi->dc |= QSPI_CSPOL(0);
all of these zeroes being passed to these macros should be
m->spi->chip_select
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2013-07-02 15:58 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
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 [this message]
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=20130702155827.GA7626@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®