All of lore.kernel.org
 help / color / mirror / Atom feed
From: bgat@billgatliff.com (Bill Gatliff)
To: linux-arm-kernel@lists.infradead.org
Subject: QUERY: How to handle SOC Configuration (Peripheral Multiplexing) in linux
Date: Mon, 15 Mar 2010 11:53:15 -0500	[thread overview]
Message-ID: <4B9E65FB.1070501@billgatliff.com> (raw)
In-Reply-To: <4B9E5A29.1090407@st.com>

Armando VISCONTI wrote:
>
> Now you both are saying that compile time options are better, correct?

That's what I'm saying, yes.  Rmk will have to speak for himself. :)

>
> So, we have two choices:
>
> 1. Stay as it is, which means to use menuconfig options.
> 2. Provide board-specific code in the mach-spear directory.
>
> You are suggesting 2, which also seems to be the pin_config stuff
> inside mach-pxa. Am I aligned?

Yes, though the mach-pxa guys aren't the only ones handling pin muxes---
see also at91 and omap2.  There are lots of different ways to set up the
API for this functionality.  I have no idea which one is better, I just
take what I'm given.  :)


>> If you assume that the driver "just knows" what the multiplexer settings
>> need to be, then sooner or later that same peripheral gets used in a
>> different SoC and that assumption has to get tossed out.  That's
>> happening some with the AT91 drivers that can also be used on AVR32
>> chips.  Best to avoid that extra work by putting the platform-specific
>> knowledge where it belongs: in the platform-specific code.
>>   
> Correct.
>
> I think this has never been our intention anyway.
> The drivers shouldn't know anything about platform-specific stuff, as
> they are expected to work across multiple platform.

Keep in mind that to the driver, anything non-driver is
"platform-specific".  For a driver to be truly reusable, then, it can't
assume anything about where its pins are, what interrupt channel it's
tied to, or anything else like that.  All those things are subject to
change as the peripheral gets re-used across SoCs.  Don't let them sneak
into the driver code.

It's true that for a specific SoC, you *do* know such things.  So you
handle that the way the at91 guys have done: you provide a
at91sam9263_devices.c:at91_add_device_usbh(struct at91_usbh_data *data),
and _that_ function sets up pins, etc. before it registers the generic
platform device.  The driver is always a generic platform one, and gets
its information only from ordinary resource specifications.  It can
assume that SoC-specific stuff like pin mux setup, etc. has been taken
care of already--- it's completely platform-agnostic.

Later on, a module can do all the pin mux stuff itself and then register
the "at91_ohci" platform device if for some reason it doesn't like the
way existing code does things.  There's no specific need to modify
kernel code just because you've provided an SoC-specific "wrapper"
around the platform device registration, it's just a convenience
function that you can choose to use, or not.



HTH,


b.g.

-- 
Bill Gatliff
Embedded systems training and consulting
http://billgatliff.com
bgat at billgatliff.com

  parent reply	other threads:[~2010-03-15 16:53 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-15  4:31 QUERY: How to handle SOC Configuration (Peripheral Multiplexing) in linux Viresh KUMAR
2010-03-15  4:47 ` jassi brar
2010-03-15  5:14   ` Shiraz HASHIM
2010-03-15  5:41     ` jassi brar
2010-03-15  6:32       ` Viresh KUMAR
2010-03-15  6:46         ` jassi brar
2010-03-15 12:55         ` Bill Gatliff
2010-03-15 13:15         ` Russell King - ARM Linux
2010-03-15 13:22           ` Bill Gatliff
2010-03-16  2:01           ` jassi brar
2010-03-15 12:52     ` Bill Gatliff
2010-03-15 16:02       ` Armando VISCONTI
2010-03-15 16:53         ` Nicolas Pitre
2010-03-15 16:53         ` Bill Gatliff [this message]
2010-03-15 17:09           ` Mark Brown
2010-03-15 18:57             ` Tony Lindgren
2010-03-15 18:58               ` Bill Gatliff
2010-03-15 16:58         ` Russell King - ARM Linux
2010-03-15  4:57 ` Shilimkar, Santosh
2010-03-15  5:15   ` Shiraz HASHIM
2010-03-15  5:28     ` Shilimkar, Santosh
2010-03-15  6:34       ` Viresh KUMAR
2010-03-15  6:20 ` Ben Dooks
2010-03-15  6:28   ` Viresh KUMAR
2010-03-15  8:42     ` Armando VISCONTI
2010-03-15  9:09       ` Shiraz HASHIM
2010-03-15  9:37         ` jassi brar
2010-03-15 10:22           ` Shiraz HASHIM
2010-03-15 10:34             ` jassi brar
2010-03-15 10:55               ` Russell King - ARM Linux
2010-03-15 10:37             ` Russell King - ARM Linux
2010-03-15 10:10         ` Armando VISCONTI
2010-03-15 10:27           ` Shiraz HASHIM
2010-03-15  7:06   ` Viresh KUMAR
2010-03-17 16:30     ` Ben Dooks
2010-03-19  4:45       ` Viresh KUMAR
2010-03-15 17:55 ` Linus Walleij
2010-03-16 13:39   ` Shiraz HASHIM
2010-03-16 21:55     ` Linus Walleij

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=4B9E65FB.1070501@billgatliff.com \
    --to=bgat@billgatliff.com \
    --cc=linux-arm-kernel@lists.infradead.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.