linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Ben Gamari <bgamari.foss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: spi-devel-general-TtF/mJH4Jtrk1uMJSBkQmQ@public.gmane.org,
	linux-omap <linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: GPIO chip select support in McSPI
Date: Mon, 14 Mar 2011 13:25:36 -0600	[thread overview]
Message-ID: <20110314192536.GF16096__19645.9974664778$1300132479$gmane$org@angua.secretlab.ca> (raw)
In-Reply-To: <87ipvmx2ok.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

On Sun, Mar 13, 2011 at 03:04:11PM -0400, Ben Gamari wrote:
> 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-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> 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.

I see two solutions:
1) platform code registers a bus notifier so that it gets called back
before the device gets bound to a driver.  Then it can augment the
platform data.
2) add an api to arch/arm/mach-omap2/devices.c for providing a cs
table before the device gets registered (must be called before
arch_initcall() time).

g.

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d

  parent reply	other threads:[~2011-03-14 19:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <c0ffcf4415b8edbf55d653a620b92fbbbcd8fed7>
2011-02-13 22:10 ` [PATCH 1/2] mcspi: Add support for GPIO chip select lines Ben Gamari
     [not found]   ` <1297635034-24504-1-git-send-email-bgamari.foss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-02 21:50     ` Grant Likely
     [not found]       ` <20110302215026.GA22854-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-02 22:19         ` Ben Gamari
     [not found]           ` <87sjv517yd.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-03 21:42             ` Grant Likely
     [not found]               ` <f7a269db-3bcf-4bac-8c38-b363e5c7bd0b-2ueSQiBKiTY7tOexoI0I+QC/G2K4zDHf@public.gmane.org>
2011-03-13 19:04                 ` GPIO chip select support in McSPI Ben Gamari
     [not found]               ` <87ipvmx2ok.fsf@gmail.com>
     [not found]                 ` <87ipvmx2ok.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-14 19:25                   ` Grant Likely [this message]
     [not found]                 ` <20110314192536.GF16096@angua.secretlab.ca>
     [not found]                   ` <20110314192536.GF16096-MrY2KI0G/OVr83L8+7iqerDks+cytr/Z@public.gmane.org>
2011-03-15  2:22                     ` Ben Gamari
     [not found]                   ` <877hc1t95k.fsf@gmail.com>
     [not found]                     ` <877hc1t95k.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-03-15  3:29                       ` Grant Likely
2011-02-13 22:10 ` [PATCH 2/2] beagle-daq: Initial commit of board devices setup Ben Gamari

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='20110314192536.GF16096__19645.9974664778$1300132479$gmane$org@angua.secretlab.ca' \
    --to=grant.likely-s3s/wqlpoipyb63q8fvjnq@public.gmane.org \
    --cc=bgamari.foss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=spi-devel-general-TtF/mJH4Jtrk1uMJSBkQmQ@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).