From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Barry Song <Barry.Song-kQvG35nSl+M@public.gmane.org>
Cc: "spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org"
<spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
Barry Song <21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
DL-SHA-WorkGroupLinux
<Workgroup.Linux-kQvG35nSl+M@public.gmane.org>,
Zhiwu Song <Zhiwu.Song-kQvG35nSl+M@public.gmane.org>
Subject: Re: [PATCH v3] SPI: add CSR SiRFprimaII SPI controller driver
Date: Mon, 13 Feb 2012 12:40:14 -0700 [thread overview]
Message-ID: <20120213194014.GG11077@ponder.secretlab.ca> (raw)
In-Reply-To: <5EB3BFCD089AD643B9BB63439F5FD5E99CB93BC5-W2enlP78h2wYZnBWG7VmBdnKn0HB1kRyVQQcQy+6Uvc@public.gmane.org>
On Fri, Feb 10, 2012 at 05:06:15AM +0000, Barry Song wrote:
> Hi Grant,
> > > +
> > > +struct sirfsoc_spi {
> > > + struct spi_bitbang bitbang;
> > > + struct completion done;
> > > +
> > > + u32 irq;
> >
> > irq is set once and never used outside the probe function. Doesn't need
> > to be here.
>
> ok
> >
> > > + void __iomem *base;
> > > + u32 ctrl_freq; /* SPI controller clock speed */
> > > + struct clk *clk;
> > > + int bus_num;
> >
> > bus_num is unused
>
> Ok.
>
> > > +
> > > +static void spi_sirfsoc_tasklet_tx(unsigned long arg)
> > > +{
> > > + struct sirfsoc_spi *sspi = (struct sirfsoc_spi *)arg;
> > > +
> > > + /* Fill Tx FIFO while there are left words to be transmitted */
> > > + while (!((readl(sspi->base + SIRFSOC_SPI_TXFIFO_STATUS) &
> > > + SIRFSOC_SPI_FIFO_FULL)) &&
> > > + sspi->left_tx_cnt)
> > > + sspi->tx_word(sspi);
> >
> > Potential problem: if for any reason the device stalls and the FULL bit
> > doesn't get cleared, then this function will be stuck in a tight loop. This
> > may not be an issue, but it should be considered.
>
> Might timeout check.
>
> > > +
> > > +static void spi_sirfsoc_chipselect(struct spi_device *spi, int value)
> > > +{
> > > + struct sirfsoc_spi *sspi = spi_master_get_devdata(spi->master);
> > > + struct sirfsoc_spi_ctrldata *ctl_data = spi->controller_data;
> >
> > Where does controller_data come from? It is not set in the driver, and it is
> > *not* something that the spi_device driver or the board code is allowed to set.
> >
> > If the driver needs controller_data, then it needs to be added to each spi
> > device by the spi controller driver when the slave device is registered.
> >
> The controller_data is mainly for various kinds of chip selection. We might have a CS pin, a GPIO from prima2, or a GPIO from an extended MCU side by side with prima2.
> It seems like you think this driver should handle all different kinds of chip selection support and implement those callbacks in it? And every spi client use DT to describe the CS pin?
What I am saying is that controller_data should not be prepopulated at
spi_device registration time. That pointer is 'owned' by the spi controller
and if it is used, should be set by the spi_master.
If the spi_master needs a controller_data pointer, then that data should
either be passed to the spi_master via the spi_master's platform_data, or it
should be decoded from the device tree. In either case, it is the
responsibility of the spi_master driver to set the value of controller_data
for each of its spi_device children.
Does that make sense?
g.
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
next prev parent reply other threads:[~2012-02-13 19:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 16:10 [PATCH v3] SPI: add CSR SiRFprimaII SPI controller driver Barry Song
2012-02-08 16:26 ` Jean-Christophe PLAGNIOL-VILLARD
2012-02-09 3:38 ` Barry Song
[not found] ` <1328717446-4526-1-git-send-email-21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-02-09 15:23 ` Grant Likely
[not found] ` <20120209152340.GB11249-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2012-02-10 5:06 ` Barry Song
[not found] ` <5EB3BFCD089AD643B9BB63439F5FD5E99CB93BC5-W2enlP78h2wYZnBWG7VmBdnKn0HB1kRyVQQcQy+6Uvc@public.gmane.org>
2012-02-13 3:32 ` Barry Song
2012-02-13 19:40 ` Grant Likely [this message]
[not found] ` <20120213194014.GG11077-e0URQFbLeQY2iJbIjFUEsiwD8/FfD2ys@public.gmane.org>
2012-02-14 1:58 ` Barry Song
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=20120213194014.GG11077@ponder.secretlab.ca \
--to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
--cc=21cnbao-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=Barry.Song-kQvG35nSl+M@public.gmane.org \
--cc=Workgroup.Linux-kQvG35nSl+M@public.gmane.org \
--cc=Zhiwu.Song-kQvG35nSl+M@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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;
as well as URLs for NNTP newsgroup(s).