mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Underwood <basicmark@yahoo.com>
To: David Brownell <david-b@pacbell.net>, linux-kernel@vger.kernel.org
Cc: dpervushin@ru.mvista.com
Subject: Re: SPI redux ... driver model support
Date: Tue, 6 Sep 2005 21:10:01 +0100 (BST)	[thread overview]
Message-ID: <20050906201001.68988.qmail@web30312.mail.mud.yahoo.com> (raw)
In-Reply-To: <20050906160043.9BDFAD480C@adsl-69-107-32-110.dsl.pltn13.pacbell.net>


--- David Brownell <david-b@pacbell.net> wrote:

> > > > I did think about doing this but the problem
> is how do
> > > > you know bus 2 is the bus you think it is?
> > > 
> > > The numbering is board-specific, but in most
> cases
> > > that can be simplified to being SOC-specific. 
> ...
> > > 
> > > Hotpluggable SPI controllers are not common, but
> > > that's where that sysfs API to define new
> devices
> > > would really hit the spot. ...
> > > 
> > > (What I've seen a bit more often is that
> expansion
> > > cards will be wired for SPI, so the thing that's
> > > vaguely hotplug-ish is that once you know what
> > > card's hooked up, you'll know the SPI devices it
> > > has.  Then the question is how to tell the
> kernel
> > > about them ...  same solution, which again must
> work
> > > without hardware probing.)
> >
> > This is why I decided to pass the cs table as
> platform
> > data when an adapter is registered. This way you
> don't
> > have to try to find out an adapters bus number as
> the
> > adapter has the cs table in it, but because it was
> > passed in as platform data it still abstracts that
> > from the adapter driver. Simple, yet effective :)
> 
> Except that it doesn't work in that primary case,
> where the SPI devices
> are physically decoupled from any given SPI (master)
> controller.
> One expansion card uses CS1 for a touchscreen;
> another uses CS3 for
> SPI flash ... the same "cs table" can't handle both
> configurations.
> It's got to be segmented, with devices separated
> from controllers.

With my subsystem that would look like:

static const struct spi_cs_table
platform_spi1_cs_table[] = {
 {
  .name  = "touchscreen",
  .cs_no  = 1,
  .platform_data = NULL,
  .flags  = SPI_CS_IDLE_HIGH,
  .cs_data = 0,
 },
 {
  .name  = "flash",
  .cs_no  = 3,
  .platform_data = NULL,
  .flags  = SPI_CS_IDLE_HIGH,
  .cs_data = 0,
 },
};

As far as I can see most SPI devices have fixed
wirering to an adapter as SPI is not really a hotplug
bus.
The subsystem does allow you to add extra devices that
aren't in the cs table if you want by calling
spi_device_register in which case you have to setup
the spi_device with the correct information.

> 
> Plus, that depends on standardizing platform_data
> between platforms.
> That's really not the model for platform_data!  And
> "struct clk" is
> ARM-only for now, too ... 

The struct clk should have been removed, I missed it
on that tidy up.
Why not pass platform data through the platform_data
pointer? I have now provided an extra field now which
lets you pass in any other platform data. 

> 
> 
> > Have you looked at the patch which I sent?
> >
>
http://www.ussg.iu.edu/hypermail/linux/kernel/0509.0/0817.html
> >
> > I would appreciate any comments on this approach.
> 
> Yes, I plan to follow up to that with comments.  As
> with Dmitry's
> proposal, it's modeled closely on I2C, and is in
> consequence larger
> than needed for what it does.

I hope not, I spent a long time learning about the
features of the 2.6 driver model. I'm happy to trim
down any fat.

> 
> One reason I posted this driver-model-only patch was
> to highlight how
> minimal an SPI core can be if it reuses the driver
> model core.  I'm
> not a fan of much "mid-layer" infrastructure in
> driver stacks.
> 

This is what my SPI core tries to do. I would like to
make at 'as small as possible and no smaller'

Mark

> - Dave
> 
> -
> To unsubscribe from this list: send the line
> "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at 
> http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


Send instant messages to your online friends http://uk.messenger.yahoo.com 

  reply	other threads:[~2005-09-06 20:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-30  2:42 David Brownell
2005-08-31  7:59 ` Mark Underwood
2005-09-01 19:17   ` David Brownell
2005-09-02  7:21     ` Mark Underwood
2005-09-02  8:00       ` Leeds United Fan
2005-09-06  2:09       ` David Brownell
2005-09-06 10:05         ` Mark Underwood
2005-09-06 16:00           ` David Brownell
2005-09-06 20:10             ` Mark Underwood [this message]
2005-09-06 21:53               ` David Brownell
2005-09-07 18:38                 ` Mark Underwood
2005-09-09  3:09                   ` David Brownell
2005-09-09 10:33                     ` Mark Underwood
2005-09-10  1:48                       ` David Brownell
2005-09-11  9:02                         ` Mark Underwood
2005-09-15  1:20                           ` David Brownell
2005-09-09 17:40                     ` Grant Likely
2005-09-09 19:23                       ` Mark Underwood
2005-09-09 20:48                       ` David Brownell

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=20050906201001.68988.qmail@web30312.mail.mud.yahoo.com \
    --to=basicmark@yahoo.com \
    --cc=david-b@pacbell.net \
    --cc=dpervushin@ru.mvista.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®