devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Daniel Kurtz <djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	"linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Guenter Roeck
	<guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org>,
	Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Ben Dooks <ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>,
	u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	Chris Ball <cjb-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org>,
	Grant Grundler <grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
	Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	Alexandre Courbot
	<acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	"Ben Dooks (embedded platforms)"
	<ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	Girish Shivananjappa
	<girish.shivananjappa-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"bhushan.r" <bhushan.r-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Naveen Krishna Chatradhi
	<ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	"sreekumar.c"
	<sreekumar.c-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	linux-kernel-u79uwXL29Tb/PtFMR13I2A@public.gmane.org
Subject: Re: Active low GPIOs (was [PATCH v1 1/4] i2c: mux: Add i2c-arbitrator 'mux' driver)
Date: Fri, 15 Feb 2013 13:42:16 -0700	[thread overview]
Message-ID: <511E9DA8.70207@wwwdotorg.org> (raw)
In-Reply-To: <CACRpkdZETV1DRkGryOMJo=g=eCzO9sd7VovN5V5yGib+QVwYVQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 02/15/2013 01:34 PM, Linus Walleij wrote:
> On Fri, Feb 15, 2013 at 1:19 AM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
>> On 02/14/2013 05:02 PM, Linus Walleij wrote:
>>> On Thu, Feb 14, 2013 at 6:05 PM, Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> wrote:
>> ...
>>>>  One argument for keeping "cd-inverted" too is
>>>> for controllers that don't use a GPIO for card detect.
>>>>  In this case
>>>> you could imagine a MMC controller that has a "card detect" on
>>>> special-purpose pin and accessible via a status register.
>>>
>>> This is actually the case with Integrator/CP and Versatile/AB.
>>
>> In this case, I assume that the driver for the HW has custom code to
>> read the MMC controller's CD register bit, and hence it knows whether
>> the HW inverts it, and hence we don't need a property in DT to say so;
>> the driver will simply read the bit, invert it, and return it all
>> transparently? After all, the inversion isn't board-specific but IP
>> block specific.
> 
> No that's not how it works ... heh.
> 
> It calls back to the platform:
> 
> include/linux/amba/mmci.h
>  * @status: if no GPIO read function was given to the block in
>  * gpio_wp (below) this function will be called to determine
>  * whether a card is present in the MMC slot or not
> (...)
> struct mmci_platform_data {
> (...)
>         unsigned int (*status)(struct device *);
> (...)
>         bool    cd_invert;
> 
> So the flag tells whether that signal should be interpreted
> as inverted or not. The same flag is used for GPIO
> insertion detection.
> 
> The code reading the status will read a certain register
> like this (arch/arm/mach-integrator_cp.c):
> 
> static unsigned int mmc_status(struct device *dev)
> {
>         unsigned int status = readl(__io_address(0xca000000 + 4));
>         writel(8, intcp_con_base + 8);
> 
>         return status & 8;
> }
> 
> 0xca000000 + 4 is just the second 32bit word in the system
> controller. This address range and that very word is used
> for various stuff, so it's not like a general-purpose GPIO
> or anything, it's just that one pin being readable throgh that
> very bit.

Surely a GPIO is exactly what that is...

It might be annoying to create a GPIO controller driver for just that,
but that seems like the simplest way to implement that HW from a device
tree perspective. With DT, it'd be painful to plug in that board
callback into the platform data there.

  parent reply	other threads:[~2013-02-15 20:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14 17:05 Active low GPIOs (was [PATCH v1 1/4] i2c: mux: Add i2c-arbitrator 'mux' driver) Doug Anderson
     [not found] ` <CAD=FV=W7tBOHzwayT5kgtCGmvvGs8RoX7J3rTf2vHT69b4aj6g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-14 17:48   ` Stephen Warren
     [not found]     ` <511D237D.9000306-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-14 18:07       ` Mark Brown
2013-02-15  0:08       ` Linus Walleij
2013-02-15  0:02   ` Linus Walleij
     [not found]     ` <CACRpkdY5dK==DEZjWvxVFLrP0Q8iOk-8RqozD3BA9cybxr2YLA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-15  0:19       ` Stephen Warren
     [not found]         ` <511D7EF7.9000803-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-15 20:34           ` Linus Walleij
     [not found]             ` <CACRpkdZETV1DRkGryOMJo=g=eCzO9sd7VovN5V5yGib+QVwYVQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-15 20:42               ` Stephen Warren [this message]
     [not found]                 ` <511E9DA8.70207-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-02-15 20:58                   ` Linus Walleij
2013-02-15  7:21   ` Alex Courbot

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=511E9DA8.70207@wwwdotorg.org \
    --to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
    --cc=acourbot-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=ben.dooks-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org \
    --cc=bhushan.r-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=ch.naveen-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=cjb-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=djkurtz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=girish.shivananjappa-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=grundler-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=guenter.roeck-IzeFyvvaP7pWk0Htik3J/w@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29Tb/PtFMR13I2A@public.gmane.org \
    --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
    --cc=sreekumar.c-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@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).