linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J.I. Cameron" <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: drivers-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org,
	David Brownell
	<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Spi slave devices with two chip selects, how best to handle?
Date: 25 Nov 2010 22:08:21 +0000	[thread overview]
Message-ID: <Prayer.1.3.3.1011252208210.17045@hermes-2.csi.cam.ac.uk> (raw)

Hi,

I've just been looking through some recent drivers from Analog Devices that 
are in staging-next (and hence linux-next 
http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=drivers/staging/iio/gyro/adis16060_core.c;h=fc48aca04bd3420b705b79d3cbb5c0117e187568;hb=HEAD 
) and ran into something I haven't seen before.

The adis16060
http://www.analog.com/static/imported-files/data_sheets/ADIS16060.pdf
uses two chip selects. One is for writing to the device and one
is for reading.

At the moment, the adis16060 driver registers a pair of spi drivers, 
adis16060_r and adis16060_w. The problem comes in how these two get 
information about each other. Currently there is a global pointer in that 
file. Obviously this means that we can only have one of these devices 
running at a time and should be removed. So what I'm basically asking is if 
anyone else has run into a similar situation and what their solution was. 
We could put a magic code in the platform data for the two devices and use 
that to link them together but that's ugly and would mean having the driver 
handle lists of the drivers that are currently registered but not paired so 
as to be able to pair them up. Anyone have a better idea or an example of 
what someone else has done in similar circumstances?

Thanks,

Jonathan 

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

             reply	other threads:[~2010-11-25 22:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25 22:08 J.I. Cameron [this message]
     [not found] ` <Prayer.1.3.3.1011252208210.17045-rNEEB5iaIwQgWVoWv9+vLtDNj2e20MGE@public.gmane.org>
2010-11-26  4:02   ` Spi slave devices with two chip selects, how best to handle? Grant Likely
     [not found]     ` <AANLkTi=0tP4phH2=iZf7=R7iqazC2Vru+EB3B2M=sQN2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-26  4:19       ` David Brownell
     [not found]         ` <301691.11173.qm-4JhmkcZgSkkHBU+L9ui1Svu2YVrzzGjVVpNB7YpNyf8@public.gmane.org>
2010-11-26 14:39           ` Jonathan Cameron
     [not found]             ` <4CEFC686.30603-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
2010-11-29 12:16               ` Hennerich, Michael

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=Prayer.1.3.3.1011252208210.17045@hermes-2.csi.cam.ac.uk \
    --to=jic23-kwpb1pkirijaa/9udqfwiw@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=drivers-OyLXuOCK7orQT0dZR+AlfA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).