LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yuli Barcohen <yuli@arabellasw.com>
To: kate@katix.org
Cc: linuxppc-embedded@ozlabs.org
Subject: Re: [PATCH 0/3] Support for SPI busses and devices
Date: Mon, 25 Jul 2005 16:54:55 +0300	[thread overview]
Message-ID: <17124.61231.988084.399036@astp0002.localdomain> (raw)
In-Reply-To: <63137.192.100.124.219.1122287941.squirrel@www.iti.fi>

>>>>> Kate Alhola writes:

    Yuli> SPI is very similar to I2C IMHO. I'm not sure separate
    Yuli> infrastructure is needed. We support SPI on MPC8xx/82xx/85xx
    Yuli> using the standard I2C infrastructure. I only had to add a
    Yuli> couple of IOCTLs to control clock frequency and polarity. Due
    Yuli> to such an implementation, lm-sensors work OK with SPI
    Yuli> temperature sensors, for example.

    Kate> SPI IS wery similar than I2C and for this reason it looks a
    Kate> like that all SPI subsystems implementations are based on I2C
    Kate> code.

    Kate> The Clock frequency and polarity is not enough, as mentioned
    Kate> also then addressing target chip is completelly diferent. It
    Kate> is done with separate PIO lines instead address send in serial
    Kate> line.  The CS handling is also in HW level completelly
    Kate> independent to the srerial line driver but of cource need to
    Kate> me synchronized with it.  This means that there should be
    Kate> logic to handle this CS stuff as addition of serial code.

    Kate> I2C subsystem does not have any kind of support of CS
    Kate> handlinng and for this reason i chosen to make modified
    Kate> version of I2C subsystem with additions needed for SPI.

As you understand, CS is handled in our code: otherwise nothing would
work. Since CS handling is board-specific, only board-specific files
(platforms/xxx for PPC) can provide appropriate functions. I wanted to
preserve interfaces (otherwise I would have to rewrite all relevant
user-space applications, like lm-sensors), so SPI controllers drivers
(master_xfer method) simply call function

  int spi_cs(struct i2c_adapter *adap, u16 slave, int assert_cs)

before and after each transaction. The function is implemented for each
SPI-enabled board in that board's specific file. Slave address,
meaningless for SPI, is used to identify the peripheral. The function
asserts or negates the selected slave's chip select. Slave address is
just a unique ID, assigned by the programmer with the sole purpose of
telling the spi_cs function which peripheral is to be
selected/deselected. The function, since it's board-specific, "knows"
how to do this i.e. how to access parallel ports, FPGAs, or whatever is
necessary on that specific board to activate chip select.

-- 
========================================================================
 Yuli Barcohen       | Phone +972-9-765-1788 |  Software Project Leader
 yuli@arabellasw.com | Fax   +972-9-765-7494 | Arabella Software, Israel
========================================================================

  reply	other threads:[~2005-07-25 13:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-23 14:04 [PATCH 0/3] Support for SPI busses and devices Grant Likely
2005-07-23 14:30 ` Matt Porter
2005-07-25  9:48 ` Yuli Barcohen
2005-07-25 10:39   ` Kate Alhola
2005-07-25 13:54     ` Yuli Barcohen [this message]
2005-07-28 17:25       ` Grant Likely
2005-08-03 12:38         ` Yuli Barcohen
2005-08-04  8:07           ` Kate Alhola
2005-08-04 14:45             ` Yuli Barcohen

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=17124.61231.988084.399036@astp0002.localdomain \
    --to=yuli@arabellasw.com \
    --cc=kate@katix.org \
    --cc=linuxppc-embedded@ozlabs.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