All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ned Forrester <nforrester-/d+BM93fTQY@public.gmane.org>
To: Mark Bishop <mark-Wri040CV1BU@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: Freescale MPC8313 & SPI
Date: Tue, 03 Mar 2009 15:58:02 -0500	[thread overview]
Message-ID: <49AD99DA.60407@whoi.edu> (raw)
In-Reply-To: <20090303150112.7t6tpqkw0wsgoc4s-2+Z7l/WXEz7k1uMJSBkQmQ@public.gmane.org>

Mark Bishop wrote:
> I am trying to understand more about how to talk to different spi  
> chips using the MPC8313.  The documentation that comes with the  
> development board is really lacking and I am relying on the  
> /usr/src/linux/Documentaion/spi.  However, I still can't seem to  
> answer my questions.
> 
> 1) Which device do I open up to talk to the bus.  I would use  
> something like /dev/ttyS0 for a serial port, and I assume it would be  
> /dev/spidev.0 and I would have to make it manually using mknod - but  
> what ties the /dev/spidev.0 to the actual chip driver?  Is there  
> something I have to do in addition to mknod?

There are two kernel drivers associated with SPI operations:

The controller driver (sometimes or previously called the master driver)
manipulates the physical pins of the SPI bus, controlling the clock,
data and chip selects for various devices attached to the bus.  It knows
how to send and receive variable length words, groups of those words
(transfers), and groups of transfers (messages).  It does not know much
about the actual chips attached to the bus (except what it may be told),
nor what sequence of messages/transfers have meaning to the attached chips.

The protocol driver knows what messages/transfers are useful for any
chip that might be connected.  Furthermore, it is the controller driver
that makes the link between the kernel side of libc, and the controller
driver.  Specifically, the protocol driver has implementations of read
write, seek, open, close, ioctl, etc.  It is normally the loading of a
protocol driver (usually a module) that generates the appropriate /dev
entry for the corresponding chip; I suppose /dev entries can be created
other ways.

There is normally a protocol driver for each (type of) device attached
to the bus, and only one controller driver per bus.  The controller
driver acts like a traffic cop directing the communications between
multiple protocol drivers and their respective chips.

> 2) I would be looking for a few examples on how to talk to a SPI bus  
> as well.  I've looked at spidev_test.c and I would like to see another  
> example or two.

Can't really help with an example.  I don't use the platform you have.

-- 
Ned Forrester                                       nforrester-/d+BM93fTQY@public.gmane.org
Oceanographic Systems Lab                                  508-289-2226
Applied Ocean Physics and Engineering Dept.
Woods Hole Oceanographic Institution          Woods Hole, MA 02543, USA
http://www.whoi.edu/sbl/liteSite.do?litesiteid=7212
http://www.whoi.edu/hpb/Site.do?id=1532
http://www.whoi.edu/page.do?pid=10079


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H

  parent reply	other threads:[~2009-03-03 20:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03 20:01 Freescale MPC8313 & SPI Mark Bishop
     [not found] ` <20090303150112.7t6tpqkw0wsgoc4s-2+Z7l/WXEz7k1uMJSBkQmQ@public.gmane.org>
2009-03-03 20:58   ` Ned Forrester [this message]
2009-03-11 21:20   ` Mark Bishop
2009-03-11 21:21   ` Mark Bishop
  -- strict thread matches above, loose matches on Subject: below --
2009-02-25  1:19 Mark Bishop
2009-02-25 14:22 ` Kumar Gala

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=49AD99DA.60407@whoi.edu \
    --to=nforrester-/d+bm93ftqy@public.gmane.org \
    --cc=mark-Wri040CV1BU@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.