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, basicmark@yahoo.com
Subject: Re: SPI redux ... driver model support
Date: Wed, 31 Aug 2005 08:59:44 +0100 (BST)	[thread overview]
Message-ID: <20050831075944.35664.qmail@web30308.mail.mud.yahoo.com> (raw)
In-Reply-To: <20050830024216.9AFEDC10BE@adsl-69-107-32-110.dsl.pltn13.pacbell.net>


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

> The last couple times SPI frameworks came up here,
> some of the feedback
> included "make it use the driver model properly;
> don't be like I2C".
> 
> In hopes that it'll be useful, here's a small SPI
> core with driver model
> support driven from board-specific tables listing
> devices.  I expect the
> I/O call(s) could stand to change; but at least this
> one starts out right,
> based on async I/O.  (There's a synchronous call;
> it's a trivial wrapper.)
> 
>  arch/arm/Kconfig       |    2 
>  drivers/Kconfig        |    2 
>  drivers/Makefile       |    1 
>  drivers/spi/Kconfig    |  302
> +++++++++++++++++++++++++++++++++++++++++++++
>  drivers/spi/Makefile   |   32 ++++
>  drivers/spi/spi_init.c |  233
> ++++++++++++++++++++++++++++++++++
>  include/linux/spi.h    |  179
> ++++++++++++++++++++++++++
>  7 files changed, 751 insertions(+)
> 
> Here's one instance of the sysfs "spi_host" class:
> 
> 	[root@argon sys]# cd /sys/class
> 	[root@argon class]# ls
> 	i2c-adapter/   misc/          pcmcia_socket/
> spi_host/      usb_host/
> 	input/         mtd/           scsi_device/   tty/  
>         vc/
> 	mem/           net/           scsi_host/     usb/
> 	[root@argon class]# ls spi_host
> 	spi2/
> 	[root@argon class]# ls -l spi_host/spi2
> 	drwxr-xr-x    2 root     root            0 Aug 29
> 18:46 ./
> 	drwxr-xr-x    3 root     root            0 Dec 31 
> 1969 ../
> 	lrwxrwxrwx    1 root     root            0 Aug 29
> 18:46 device ->
> ../../../devices/platform/omap-uwire/
> 	[root@argon class]#
> 
> Here are the real sysfs objects for that host and
> its single child
> (on chipselect 0).  Notice that the device exists,
> but is waiting for
> driver-modelized ads7846 support (touchscreen and
> other sensors):
> 
> 	[root@argon class]# cd
> /sys/devices/platform/omap-uwire
> 	[root@argon omap-uwire]# ls
> 	bus@            driver@         power/         
> spi2.0-ads7846/
> 	[root@argon omap-uwire]# ls -l spi*
> 	lrwxrwxrwx    1 root     root            0 Aug 29
> 18:46 bus -> ../../../../bus/spi/
> 	-r--r--r--    1 root     root         4096 Aug 29
> 18:46 modalias
> 	drwxr-xr-x    2 root     root            0 Aug 29
> 18:46 power/
> 	[root@argon omap-uwire]# cat spi*/modalias
> 	ads7846
> 	[root@argon omap-uwire]#
> 
> For your viewing pleasure, and without the broadast
> flag that would
> prevent further redistribution, a patch is appended.
> 
> - Dave
> 
> 
> -----------------------------------------	SNIP!!
> This is the start of a small SPI framework that
> started fresh, so it
> doesn't continue the "i2c driver model mess".

-= snip =-

Well I guess great minds think alike ;-). After
looking though my SPI core layer I released that it in
no way reflected the new driver model (not surprising
as it was a copy of i2c-core.c) and I would probably
get laughed off the kernel mailing list if I sent it
as was ;-).  
I am now writing a new spi-core.c which uses the new
driver model.

For registering an adapter:
1) Register an adapter that has a cs table showing
where devices sit on the adapter.
2) This causes spi-core to enumerate the devices on
the cs table and register them.

For un-registering an adapter:
1) Unregister an adapter
2) This causes spi-core to remove all the children of
the adapter

I have a test adapter and a couple of test devices and
am currently debugging a usage count problem. I will
send a patch once I have a working system.

Mark




		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

  reply	other threads:[~2005-08-31  7:59 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 [this message]
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
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=20050831075944.35664.qmail@web30308.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®