public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hinko Kocevar <hinko.kocevar@cetrtapot.si>
To: Greg KH <greg@kroah.com>
Cc: Rui Sousa <rui.sousa@laposte.net>,
	"Mark M. Hoffman" <mhoffman@lightlink.com>,
	dmitry pervushin <dpervushin@ru.mvista.com>,
	linux-kernel@vger.kernel.org,
	lm-sensors <lm-sensors@lm-sensors.org>
Subject: Re: [RFC] SPI core
Date: Thu, 09 Jun 2005 12:39:18 +0200	[thread overview]
Message-ID: <42A81C56.1070602@cetrtapot.si> (raw)
In-Reply-To: <20050609071523.GE22729@kroah.com>

Greg KH wrote:

> 
> The fact that the i2c drivers are not really true "drivers" in the
> driver model.  We bind them by hand to the device and then register the
> device with the core.  That isn't a nice thing to do...

And introduces alot of code do simple stuff that SPI is supposed to do. I also 
ported i2c-core,i2c-dev, i2c-bit-algo and parport bus to work with SPI device. 
Resulting SPI code base was huge and I was confused in the begining why, and 
later wondered if there is need for such a design.

I dumped evrything and created three functions : spi_access, spi_transfer and 
spi_release. First and last functions only assert/deassert CS line, 
respectevely. Spi_transfer is the core function and is more-or-less different 
on every CPU (if not using bit-banging). As every CPU has different approach in 
handling SPI interface is almost neccesary to write CPU dependent SPI part for 
each CPU out there (at least transfer function). Also you can use CPUs 
synchronous serial interface (if one supports it) or just use bit-bang algo to 
get bits in and out.

I have two devices on SPI and I drive them both by bit-banging bits in and out. 
While I was using I2C-like-SPI model I wanted to make it base for all other SPI 
devices my board would/could hold. Sad thing is that every manufacturer and/or 
device (let it be serial flash, audio codec, A/D converter, ...) has its own 
concept of accessing and transfering data to and from the SPI device. I 
experienced this a short while ago while trying to make tsc2301 audio codec and 
datakey spi serial flash to use common SPI code. I ended up duplicating the 
three aforementioned functions in the each driver and still SPI code is ~10-15 
times smaller than initial I2C-to-SPI port I did.

I would also like to see SPI core in linux driver model, but nothing like I2C 
stuff. SPI is far to simple (and yet so diverse) that much more simple concept 
could be used.

just my .2 €

regards,
hinko k

-- 
..because under Linux "if something is possible in principle,
then it is already implemented or somebody is working on it".

					--LKI

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

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-31 16:09 [RFC] SPI core dmitry pervushin
2005-05-31 18:33 ` randy_dunlap
2005-05-31 20:44 ` Alexey Dobriyan
2005-05-31 21:41   ` NZG
2005-05-31 23:20   ` Greg KH
2005-05-31 23:32 ` Greg KH
2005-06-02  4:06   ` Mark M. Hoffman
2005-06-02  4:51     ` Greg KH
2005-06-02 13:02       ` Rui Sousa
2005-06-09  7:15         ` Greg KH
2005-06-09 10:39           ` Hinko Kocevar [this message]
2005-06-09 15:41             ` Lee Revell
2005-06-02 10:09   ` dmitry pervushin
2005-06-09 12:33 ` Pekka Enberg
2005-06-09 16:19   ` Alexey Dobriyan
2005-06-09 17:41     ` Pekka Enberg
  -- strict thread matches above, loose matches on Subject: below --
2005-06-01  1:19 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=42A81C56.1070602@cetrtapot.si \
    --to=hinko.kocevar@cetrtapot.si \
    --cc=dpervushin@ru.mvista.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=mhoffman@lightlink.com \
    --cc=rui.sousa@laposte.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