[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130702155827.GA7626@arwen.pp.htv.fi>
Date: Tue, 2 Jul 2013 18:58:27 +0300
From: Felipe Balbi <balbi@...com>
To: Sourav Poddar <sourav.poddar@...com>
CC: <broonie@...nel.org>, <spi-devel-general@...ts.sourceforge.net>,
<grant.likely@...aro.org>, <balbi@...com>, <rnayak@...com>,
<linux-omap@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv2] drivers: spi: Add qspi flash controller
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
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists