All of lore.kernel.org
 help / color / mirror / Atom feed
* (no subject)
@ 2010-01-20 19:47 Ben Gamari
  2010-01-21  0:04 ` Ben Dooks
                   ` (5 more replies)
  0 siblings, 6 replies; 36+ messages in thread
From: Ben Gamari @ 2010-01-20 19:47 UTC (permalink / raw)
  To: Ben Dooks
  Cc: David Brownell, Michael Hennerich, beagleboard, Eric Miao,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, linux-omap

Bcc: 
Subject: GPIO chip select support in omap2_mcspi driver

Hey,

Recently I have been looking to use a BeagleBoard to drive several
serial ADCs and DACs in a data acquisition and analysis setup. Unfortunately, the
BeagleBoard is severely limited by the number of SPI controllers it
exposes on the expansion connector (McSPI3 with 2 CS lines and McSPI4
with one). This is insufficient for our application and thus I have been
investigating adding support to the mcspi driver for using GPIO lines as
chip select lines, as is done in the pxa2xx, bfin5xx, and s3c24xx drivers.

To this end, I have a few questions about how this support was
implemented. First, it seems that the s3c24xx driver is built on the
spi_bitbang driver, despite interfacing with a dedicated hardware SPI
controller.  What is the reason for this? Was this done specifically for
the purpose of incorporating support for GPIO CS pins?

It seems like the rough idea is to add a cs_gpio field to the device
struct (omap2_mcspi) and add the appropriate code to the
omap2_mcspi_force_cs() to bring cs_gpio high or low if it is valid. The
potential problem I can see with this is that omap2_mcspi_set_enable()
is called to enable the channel before the force_cs() is called (in
omap2_mcspi_work()). If I'm interpreting the documentation correctly,
the enable bit starts the clocks, meaning that the chip will begin
clocking out data before CS is brought high. I must be missing something
here, no?

For reference, I included a short list of relevant commits below, largely for
my own benefit. I would greatly appreciate any feedback you might have.

Thanks,
- Ben


pxa2xx_spi: a7bb3909b3293d503211d7f6af8ed62c1644b686
bfin_spi: 42c78b2bf51bafb4cfa98dfecc28dd9b8bcd04b0

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev

^ permalink raw reply	[flat|nested] 36+ messages in thread
* GPIO chip select support in McSPI
@ 2011-03-13 19:04 Ben Gamari
  2011-03-13 19:05 ` [PATCH] mcspi: Add support for GPIO chip select lines Ben Gamari
  0 siblings, 1 reply; 36+ messages in thread
From: Ben Gamari @ 2011-03-13 19:04 UTC (permalink / raw)
  To: Grant Likely, linux-omap; +Cc: spi-devel-general

I've included the OMAP list so that I can hopefully get some feedback
from folks more familiar with this code.

Background:

I've been working on adding support for GPIO chip select lines to the
McSPI driver. Grant has been working with me to try getting the
in-kernel interface right and we have finally converged on a solution
whereby a table of GPIO lines will be passed to the McSPI driver through
platform_device.device.platform_data. Unfortunately, as explained below,
there is no clear path to support this in the current McSPI
initialization code.


On Thu, 03 Mar 2011 14:42:07 -0700, Grant Likely <grant.likely@secretlab.ca> wrote:
> The spi_master platform device is registered somewhere in the
> inappropriate support code. You need to arrange to make sure the
> correct pdata is attached to it when it gets registered. There
> /should/ be a mechanism for doing so.
> 
> All spi devices already specify a cs number anyway. What you can do is
> use the cs number as the lookup index into the gpio table, and
> remember to reserve a cs# for the 'native' cs line.
> 
I've done as you suggested and added support to the McSPI driver by
passing a GPIO table through platform_data. A patch will be coming
shortly.

Unfortunately, I'm really not sure how to restructure the OMAP code to
pass this information along. Currently the McSPI devices are registered
in arch/arm/mach-omap2/devices.c (omap_init_mcspi). In order to make the
GPIO CS support configurable by board code, we need some way to change
the (currently static) platform_devices prior to registration. Does
anyone have any suggestions on how this code could be refactored to
allow for this with minimal code duplication? Obviously we could just
move the platform_devices into the board files but this seems like a lot
of code duplication to support functionality that few boards will use.

Thoughts?

- Ben

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2011-09-05 12:42 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-20 19:47 (no subject) Ben Gamari
2010-01-21  0:04 ` Ben Dooks
2010-01-21  0:04 ` (no subject) Ben Dooks
2010-01-21  0:04 ` Ben Dooks
2010-01-22 15:53 ` Re: Ben Gamari
2010-01-28  4:10 ` McSPI questions pertaining to GPIO chip select support Ben Gamari
2010-01-28  4:15   ` Bill Gatliff
2010-01-28  4:25     ` Ben Gamari
2010-01-28  4:27       ` Bill Gatliff
2010-01-28  4:33   ` jassi brar
2010-12-21 17:56     ` [RFC PATCH] GPIO chip select support for McSPI Ben Gamari
     [not found]     ` <1b68c6791001272033q60dd31dbif4de285cd9bac83d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-29  0:32       ` McSPI questions pertaining to GPIO chip select support Ben Gamari
2010-01-29  1:09         ` jassi brar
     [not found]           ` <1b68c6791001281709l7d11da30lee486632e85b99cb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-01-29  1:58             ` Ben Gamari
2010-12-21 17:56       ` [RFC PATCH] GPIO chip select support for McSPI Ben Gamari
2010-12-21 17:56       ` [PATCH] mcspi: Add support for GPIO chip select lines Ben Gamari
2010-12-21 17:56     ` Ben Gamari
2010-12-23 19:59       ` Tony Lindgren
2010-12-23 21:38       ` Grant Likely
2010-12-23 23:09         ` Ben Gamari
2010-12-24  0:37           ` Grant Likely
2010-12-24  2:27             ` Ben Gamari
2010-12-24  3:28               ` Grant Likely
2010-12-24  6:05                 ` Ben Gamari
2011-02-12  8:33                   ` Grant Likely
2011-02-13 22:07                     ` Ben Gamari
2011-08-30 10:14   ` McSPI questions pertaining to GPIO chip select support Raju Sana
2011-08-30 13:50     ` Ben Gamari
2011-08-30 13:50       ` [PATCH] mcspi: Add support for GPIO chip select lines Ben Gamari
2011-08-30 13:52       ` [PATCH] beagledaq: Hack in cs_gpios Ben Gamari
     [not found]         ` <1314712343-27367-1-git-send-email-bgamari.foss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-09-05 12:42           ` Raju Sana
2010-01-28  4:10 ` McSPI questions pertaining to GPIO chip select support Ben Gamari
2011-03-13 19:04 GPIO chip select support in McSPI Ben Gamari
2011-03-13 19:05 ` [PATCH] mcspi: Add support for GPIO chip select lines Ben Gamari
2011-03-14 19:27   ` Grant Likely
2011-03-15  2:06     ` Ben Gamari
2011-03-15  2:10       ` Grant Likely

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.