LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* RE: [PATCH v15 00/10] Add-Synopsys-DesignWare-HS-USB-OTG-driver
From: Geoff Levand @ 2011-10-27  3:52 UTC (permalink / raw)
  To: Tirumala Marri; +Cc: Olof Johansson, greg, linux-usb, linuxppc-dev
In-Reply-To: <d4b201db8e7510eeeca77dc26dab02c1@mail.gmail.com>

Hi Marri,

On Wed, 2011-10-26 at 09:06 -0700, Tirumala Marri wrote:
> <
> <No, just start over from scratch. Just leave the crap driver behind,
> <use it for reference but write the new one.
> <
> <It's obvious given that you are already at iteration v15 and it's
> <still looking this bad that this is not realistic to get reviewed and
> <accepted as-is. I don't think staging is a good target either -- what
> <the driver really needs is _functional_ cut-down to only cover the use
> <cases that your product uses, and staging cleanups are mostly around
> <style and refactoring, not changing, fixing or removing functionality.
> <
> [Tirumala Marri] I like to hear What maintainer GregKH thinks. We already
> spent lot
> Of time on it and passed multiple hands.

I don't think the amount of time spent should be given much
consideration.  What matters is whether or not the code is acceptable.
Maybe you can do some coding on a whiteboard to get it right -- hahaha.

-Geoff

^ permalink raw reply

* ps3-linux tree back at k.org
From: Geoff Levand @ 2011-10-27  4:02 UTC (permalink / raw)
  To: Linuxppc-dev; +Cc: cbe-oss-dev

Hi All,

Just for anyone interested, my ps3-linux kernel git repo is back
at kernel.org:

  http://git.kernel.org/?p=linux/kernel/git/geoff/ps3-linux.git

I haven't merged in mainline for a while because there is a bug
in the scheduler IPI code I want to get fix before I merge.

-Geoff

^ permalink raw reply

* Re: Kdump/kexec for mpc85xx
From: radha krishna @ 2011-10-27  4:57 UTC (permalink / raw)
  To: McClintock Matthew-B29882; +Cc: linuxppc-dev@lists.ozlabs.org

[-- Attachment #1: Type: text/plain, Size: 962 bytes --]

Hi ,

The subject is changed to "Kdump/kexec for mpc85xx", as i am going to use it
on P2010 and MPC8567 processors as will. So that it will not confuse others
and to continue as a separate topic. In fact, i have selected P2041 which is
e500mc core, for my next project.
Please provide more details on "how to Kdump/kexec for 85xx?". I mean open
source versions of kexec-tools, linux versions, etc....
At preset, i have been using linux-2.6.32 on P2010 based board and ELDK42 as
tool chain.



On Wed, Oct 26, 2011 at 6:27 AM, McClintock Matthew-B29882 <
B29882@freescale.com> wrote:

> On Mon, Oct 24, 2011 at 7:35 AM, radha krishna <ramamru@gmail.com> wrote:
> > Hi Team,
> >
> > I am using Linux-3.0 on mpc8379 RDB. I have downloaded kexec-tools-2.0.2
> > package from open source and cross compiled for ppc_6xx.
> > But, the kexec is not booting with kernel loaded with "kexec -l".
>
> I'm not sure who has tested on 83xx stuff, I've only done 85xx.
>
> -M
>

[-- Attachment #2: Type: text/html, Size: 1422 bytes --]

^ permalink raw reply

* Re: [PATCH v15 00/10] Add-Synopsys-DesignWare-HS-USB-OTG-driver
From: Greg KH @ 2011-10-27  4:51 UTC (permalink / raw)
  To: Tirumala Marri; +Cc: linux-usb, linuxppc-dev
In-Reply-To: <0a2f495d6415e9cad48ae2c75c582e0d@mail.gmail.com>

On Wed, Oct 26, 2011 at 10:17:19AM -0700, Tirumala Marri wrote:
> Greg,
> 
> <
> <No, just start over from scratch. Just leave the crap driver behind,
> <use it for reference but write the new one.

What email client are you using, I have never seen this type of
formatting, and it makes it impossible to read your replies.  Please
resolve this.

> <It's obvious given that you are already at iteration v15 and it's
> <still looking this bad that this is not realistic to get reviewed and
> <accepted as-is. I don't think staging is a good target either -- what
> <the driver really needs is _functional_ cut-down to only cover the use
> <cases that your product uses, and staging cleanups are mostly around
> <style and refactoring, not changing, fixing or removing functionality.
> <
> <> <Compare this to the dwc3 driver, which is much much cleaner.
> <> <
> Could you please comment on this. This has been reviewed so many times
> And we did the major changes. I think it is un-acceptable to say to
> re-write
> The driver now after 15 reviews? This should have happened in first 5
> reviews.

Sometimes people miss things on previous reviews, this is not a perfict
system, only the best that we currently know how to do, don't you agree?

If this driver contains lots of things that are not necessary for it to
work at this point in time, why wouldn't that be removed now?

Anyway, I think it would probably be best to get this into staging for
now, which will help you get a way to clean it up in an easier manner,
and still have users have access to it.  Is that acceptable?

thanks,

greg k-h

^ permalink raw reply

* Re: [PATCH v15 00/10] Add-Synopsys-DesignWare-HS-USB-OTG-driver
From: Pratyush Anand @ 2011-10-27  5:07 UTC (permalink / raw)
  To: Olof Johansson; +Cc: tmarri, greg, linux-usb, linuxppc-dev
In-Reply-To: <CAOesGMg_Q6M5fsN3BsROu3XpGZGiC1Wi+GD7ksOYFMNfn_wW0Q@mail.gmail.com>

On Sun, Oct 23, 2011 at 2:00 AM, Olof Johansson <olof@lixom.net> wrote:
>
> Hi,
>
> On Fri, Oct 21, 2011 at 10:33 AM, Olof Johansson <olof@lixom.net> wrote:
> > On Fri, Oct 14, 2011 at 03:08:34PM -0700, tmarri@apm.com wrote:
> >> From: Tirumala Marri <tmarri@apm.com>
> >
> > Overall this driver seems to be based on the IP vendor driver? It
> > looks like a completely flexible driver that implements all possible
> > combinations of everything.
>
> After looking a little closer at the patch set, it seems that number
> one thing you need to do is simplify the driver. A lot.
>
> I suggest starting from scratch with a clean implementation, only
> bringing in the pieces you need. Over time, if other vendors are using

Writing from scratch might take lot of time. I have used this driver
on a ARM based platform,
and found it stable after just  a bit modification , which I have
suggested in my earlier mails.
I have run all the test cases of standard testusb (except for
iscochronous), and have found
them working after the suggested modifications. So, I think that
driver is stable in a sense, and
can be included into mainline.

Regards
Pratyush


> other aspects of the same IP, they get to add those parts of the
> driver when they need it. =A0Look at the dwc3 driver for comparison on
> cleanliness, it's much cleaner than what you've posted.
>
>
> -Olof
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: Kdump/kexec for mpc85xx
From: McClintock Matthew-B29882 @ 2011-10-27  5:21 UTC (permalink / raw)
  To: radha krishna; +Cc: linuxppc-dev@lists.ozlabs.org
In-Reply-To: <CAJ4m0g6vDoT6wy3owmRpJowQrJqMyB0F80y=BBTcBZtzHJUd2A@mail.gmail.com>

On Wed, Oct 26, 2011 at 11:57 PM, radha krishna <ramamru@gmail.com> wrote:
> Hi ,
>
> The subject is changed to "Kdump/kexec for mpc85xx", as i am going to use=
 it
> on P2010 and MPC8567 processors as will. So that it will not confuse othe=
rs
> and to continue as a separate topic. In fact, i have selected P2041 which=
 is
> e500mc core, for my next project.
> Please provide more details on "how to Kdump/kexec for 85xx?". I mean ope=
n
> source versions of kexec-tools, linux versions, etc....
> At preset, i have been using linux-2.6.32 on P2010 based board and ELDK42=
 as
> tool chain.

You will need a newer kernel, I'm not precise of the exact release.
But kexec-tools project contains a HOWTO in the project under
'docs/mpc85xx.txt'. Please read that over and give it a shot. It
should work for the P2010 or the P2041 cores.

-M=

^ permalink raw reply

* Re: [PATCH 2/3] [44x] Enable CONFIG_RELOCATABLE for PPC44x
From: Suzuki Poulose @ 2011-10-27  8:43 UTC (permalink / raw)
  To: Scott Wood
  Cc: Michal Simek, tmarri, Mahesh Jagannath Salgaonkar, Dave Hansen,
	David Laight, Paul Mackerras, linux ppc dev, Vivek Goyal
In-Reply-To: <4EA85C85.7090404@freescale.com>

On 10/27/11 00:46, Scott Wood wrote:
> On 10/26/2011 02:12 PM, Suzuki Poulose wrote:
>> On 10/25/11 21:04, Scott Wood wrote:
>>> On 10/12/2011 09:15 AM, Dave Hansen wrote:
>>>> This is not the place to enforce that kind of thing.  If
>>>> CONFIG_RELOCATABLE is only supported on one platform, then do:
>>>>
>>>>      config RELOCATABLE
>>>>          depends on 44x
>>>>
>>>> and take the 44x reference out of the #ifdef.
>>>
>>> ...but please first rename the existing, different CONFIG_RELOCATABLE
>>> behavior that is currently supported on e500.
>>
>> Scott,
>>
>> I have renamed the new type of relocation to RELOCATABLE_PPC32_PIE. The
>> patches
>> were posted yesterday. Please let me know your thoughts.
>
> I think it would make more sense to rename the existing behavior (maybe
> something like DYNAMIC_MEMSTART -- if there's even enough overhead to
> make it worth being configurable at all), since it's not fully
> relocatable and since 64-bit already uses RELOCATABLE to mean PIE.

I think leaving the current behaviour as it is, and adding the PIE as an
additional configuration option would be safe and wouldn't disturb the
existing dependencies. ( CRASH_DUMP etc. depend on RELOCATABLE for archs
which work fine ).

For architectures with smaller TLB sizes, can afford to do the page aligned
old style mapping and not worry about PIE at all.

Thats just my view.

Disclaimer : I  am not an expert in the BookE land.  :-)

Thanks
Suzuki

^ permalink raw reply

* [PATCH] powerpc: add pgprot_cached_noncoherent()
From: Geoff Thorpe @ 2011-10-27 12:58 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Geoff Thorpe

This adds a pgprot combination required by some cache-enabled IO device
mappings, such as Freescale datapath (QMan and BMan) portals.

Signed-off-by: Geoff Thorpe <geoff@geoffthorpe.net>
---
 arch/powerpc/include/asm/pgtable.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 88b0bd9..2e0e411 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -170,6 +170,9 @@ extern int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long addre
 #define pgprot_cached_wthru(prot) (__pgprot((pgprot_val(prot) & ~_PAGE_CACHE_CTL) | \
 				            _PAGE_COHERENT | _PAGE_WRITETHRU))
 
+#define pgprot_cached_noncoherent(prot) \
+		(__pgprot(pgprot_val(prot) & ~_PAGE_CACHE_CTL))
+
 #define pgprot_writecombine pgprot_noncached_wc
 
 struct file;
-- 
1.7.3.4

^ permalink raw reply related

* [PATCH] asm-generic/gpio.h: merge basic gpiolib wrappers
From: Mike Frysinger @ 2011-10-27 13:01 UTC (permalink / raw)
  To: Grant Likely, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Haavard Skinnemoen, Hans-Christian Egtvedt, Tony Luck, Fenghua Yu,
	Michal Simek, Ralf Baechle, Paul Mundt, Jonas Bonn,
	Paul Mackerras, Benjamin Herrenschmidt, David S. Miller,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Chris Zankel,
	Russell King, Guan Xuetao, Mark Brown
  Cc: linux-arch, linux-mips, x86, linux-ia64, linux-sh,
	microblaze-uclinux, linux, linux-kernel, linux-m68k,
	Mike Frysinger, linux-alpha, sparclinux, uclinux-dist-devel,
	linuxppc-dev, linux-arm-kernel
In-Reply-To: <1319528012-19006-1-git-send-email-broonie@opensource.wolfsonmicro.com>

Rather than requiring architectures that use gpiolib but don't have
any need to define anything custom to copy an asm/gpio.h, merge this
code into the asm-generic/gpio.h.  We add ifdef checks so that arches
can still override things while using the asm-generic/gpio.h, but on
a more fine grained per-func approach.

I've compile tested these guys (with & without GPIOLIB), but don't
have the hardware to boot:
	- alpha defconfig
	- arm defconfig
	- blackfin defconfig
	- ia64 defconfig
	- mips: ar7 & ath79 & bcm47xx & bcm63xx & ip22 defconfig
	- powerpc: mpc85xx & ppc64 defconfig
	- sh: kfr2r09 defconfig
	- sparc defconfig
	- x86_64 defconfig

I don't have any toolchains for avr32, microblaze, openrisc, unicore32,
or xtensa.  So they lose :x.

I don't see m68k supporting gpoilib, so I've just ignored it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 arch/alpha/include/asm/Kbuild                   |    2 +
 arch/alpha/include/asm/gpio.h                   |   55 -------------------
 arch/arm/include/asm/gpio.h                     |   13 +++--
 arch/avr32/mach-at32ap/include/mach/gpio.h      |   19 +------
 arch/blackfin/include/asm/gpio.h                |   16 ++----
 arch/ia64/include/asm/Kbuild                    |    2 +
 arch/ia64/include/asm/gpio.h                    |   55 -------------------
 arch/microblaze/include/asm/Kbuild              |    2 +
 arch/microblaze/include/asm/gpio.h              |   53 ------------------
 arch/mips/include/asm/mach-ar7/gpio.h           |    5 --
 arch/mips/include/asm/mach-ath79/gpio.h         |    8 ++-
 arch/mips/include/asm/mach-bcm47xx/gpio.h       |    3 +
 arch/mips/include/asm/mach-bcm63xx/gpio.h       |    5 --
 arch/mips/include/asm/mach-generic/gpio.h       |    8 +--
 arch/mips/include/asm/mach-loongson/gpio.h      |    7 +--
 arch/mips/include/asm/mach-rc32434/gpio.h       |   10 +---
 arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h |   12 +---
 arch/openrisc/include/asm/Kbuild                |    1 +
 arch/openrisc/include/asm/gpio.h                |   65 -----------------------
 arch/powerpc/include/asm/Kbuild                 |    2 +
 arch/powerpc/include/asm/gpio.h                 |   53 ------------------
 arch/sh/include/asm/gpio.h                      |   32 +-----------
 arch/sparc/include/asm/Kbuild                   |    1 +
 arch/sparc/include/asm/gpio.h                   |   36 -------------
 arch/unicore32/include/asm/gpio.h               |    8 ++-
 arch/x86/include/asm/Kbuild                     |    2 +
 arch/x86/include/asm/gpio.h                     |   53 ------------------
 arch/xtensa/include/asm/Kbuild                  |    2 +
 arch/xtensa/include/asm/gpio.h                  |   56 -------------------
 include/asm-generic/gpio.h                      |   23 ++++++++
 30 files changed, 81 insertions(+), 528 deletions(-)
 delete mode 100644 arch/alpha/include/asm/gpio.h
 delete mode 100644 arch/ia64/include/asm/gpio.h
 delete mode 100644 arch/microblaze/include/asm/gpio.h
 delete mode 100644 arch/openrisc/include/asm/gpio.h
 delete mode 100644 arch/powerpc/include/asm/gpio.h
 delete mode 100644 arch/sparc/include/asm/gpio.h
 delete mode 100644 arch/x86/include/asm/gpio.h
 delete mode 100644 arch/xtensa/include/asm/gpio.h

diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index e423def..0bcff1a 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += compiler.h
 header-y += console.h
 header-y += fpu.h
diff --git a/arch/alpha/include/asm/gpio.h b/arch/alpha/include/asm/gpio.h
deleted file mode 100644
index 7dc6a63..0000000
--- a/arch/alpha/include/asm/gpio.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Generic GPIO API implementation for Alpha.
- *
- * A stright copy of that for PowerPC which was:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_ALPHA_GPIO_H
-#define _ASM_ALPHA_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_ALPHA_GPIO_H */
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 11ad0bf..741efb2 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -5,14 +5,15 @@
 #include <mach/gpio.h>
 
 #ifndef __ARM_GPIOLIB_COMPLEX
+/* assume the mach has defined this */
+#ifndef irq_to_gpio
+#define irq_to_gpio irq_to_gpio
+#endif
+
 /* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
 #include <asm-generic/gpio.h>
 
-/* The trivial gpiolib dispatchers */
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-#endif
+#else
 
 /*
  * Provide a default gpio_to_irq() which should satisfy every case.
@@ -23,4 +24,6 @@
 #define gpio_to_irq	__gpio_to_irq
 #endif
 
+#endif
+
 #endif /* _ARCH_ARM_GPIO_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/gpio.h b/arch/avr32/mach-at32ap/include/mach/gpio.h
index 0180f58..f2ff962 100644
--- a/arch/avr32/mach-at32ap/include/mach/gpio.h
+++ b/arch/avr32/mach-at32ap/include/mach/gpio.h
@@ -10,26 +10,13 @@
  */
 #define ARCH_NR_GPIOS	(NR_GPIO_IRQS + 2 * 32)
 
+/* We implement a few ourself */
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
 
 /* Arch-neutral GPIO API, supporting both "native" and external GPIOs. */
 #include <asm-generic/gpio.h>
 
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-
 static inline int gpio_to_irq(unsigned int gpio)
 {
 	if (gpio < NR_GPIO_IRQS)
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 5a25856..6e25dcc 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -189,6 +189,12 @@ void bfin_gpio_set_value(unsigned gpio, int value);
 #include <asm/errno.h>
 
 #ifdef CONFIG_GPIOLIB
+
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define irq_to_gpio irq_to_gpio
+
 #include <asm-generic/gpio.h>		/* cansleep wrappers */
 
 static inline int gpio_get_value(unsigned int gpio)
@@ -207,16 +213,6 @@ static inline void gpio_set_value(unsigned int gpio, int value)
 		__gpio_set_value(gpio, value);
 }
 
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
 #else /* !CONFIG_GPIOLIB */
 
 static inline int gpio_request(unsigned gpio, const char *label)
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 241d1c5..d0fdd2d 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += break.h
 header-y += fpu.h
 header-y += gcc_intrin.h
diff --git a/arch/ia64/include/asm/gpio.h b/arch/ia64/include/asm/gpio.h
deleted file mode 100644
index 590a20d..0000000
--- a/arch/ia64/include/asm/gpio.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Generic GPIO API implementation for IA-64.
- *
- * A stright copy of that for PowerPC which was:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_IA64_GPIO_H
-#define _ASM_IA64_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_IA64_GPIO_H */
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index db5294c..5bf1ca7 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -1,3 +1,5 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y  += elf.h
diff --git a/arch/microblaze/include/asm/gpio.h b/arch/microblaze/include/asm/gpio.h
deleted file mode 100644
index 2b2c18b..0000000
--- a/arch/microblaze/include/asm/gpio.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generic GPIO API implementation for PowerPC.
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_MICROBLAZE_GPIO_H
-#define _ASM_MICROBLAZE_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_MICROBLAZE_GPIO_H */
diff --git a/arch/mips/include/asm/mach-ar7/gpio.h b/arch/mips/include/asm/mach-ar7/gpio.h
index c177cd1..78f40c2 100644
--- a/arch/mips/include/asm/mach-ar7/gpio.h
+++ b/arch/mips/include/asm/mach-ar7/gpio.h
@@ -27,11 +27,6 @@
 
 #define gpio_to_irq(gpio)	-1
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-
-#define gpio_cansleep __gpio_cansleep
-
 /* Board specific GPIO functions */
 int ar7_gpio_enable(unsigned gpio);
 int ar7_gpio_disable(unsigned gpio);
diff --git a/arch/mips/include/asm/mach-ath79/gpio.h b/arch/mips/include/asm/mach-ath79/gpio.h
index 60dcb62..2c570a0 100644
--- a/arch/mips/include/asm/mach-ath79/gpio.h
+++ b/arch/mips/include/asm/mach-ath79/gpio.h
@@ -13,6 +13,12 @@
 #ifndef __ASM_MACH_ATH79_GPIO_H
 #define __ASM_MACH_ATH79_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
+
 #define ARCH_NR_GPIOS	64
 #include <asm-generic/gpio.h>
 
@@ -21,6 +27,4 @@ int irq_to_gpio(unsigned irq);
 int gpio_get_value(unsigned gpio);
 void gpio_set_value(unsigned gpio, int value);
 
-#define gpio_cansleep	__gpio_cansleep
-
 #endif /* __ASM_MACH_ATH79_GPIO_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h
index 76961ca..d678316 100644
--- a/arch/mips/include/asm/mach-bcm47xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h
@@ -19,6 +19,7 @@
 extern int gpio_request(unsigned gpio, const char *label);
 extern void gpio_free(unsigned gpio);
 extern int gpio_to_irq(unsigned gpio);
+#define gpio_to_irq gpio_to_irq
 
 static inline int gpio_get_value(unsigned gpio)
 {
@@ -35,6 +36,7 @@ static inline int gpio_get_value(unsigned gpio)
 	}
 	return -EINVAL;
 }
+#define gpio_get_value gpio_get_value
 
 static inline void gpio_set_value(unsigned gpio, int value)
 {
@@ -53,6 +55,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
 #endif
 	}
 }
+#define gpio_set_value gpio_set_value
 
 static inline int gpio_direction_input(unsigned gpio)
 {
diff --git a/arch/mips/include/asm/mach-bcm63xx/gpio.h b/arch/mips/include/asm/mach-bcm63xx/gpio.h
index 1eb534d..c71bf66 100644
--- a/arch/mips/include/asm/mach-bcm63xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm63xx/gpio.h
@@ -5,11 +5,6 @@
 
 #define gpio_to_irq(gpio)	-1
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-
-#define gpio_cansleep __gpio_cansleep
-
 #include <asm-generic/gpio.h>
 
 #endif /* __ASM_MIPS_MACH_BCM63XX_GPIO_H */
diff --git a/arch/mips/include/asm/mach-generic/gpio.h b/arch/mips/include/asm/mach-generic/gpio.h
index b4e7020..e8a89c5 100644
--- a/arch/mips/include/asm/mach-generic/gpio.h
+++ b/arch/mips/include/asm/mach-generic/gpio.h
@@ -1,11 +1,7 @@
 #ifndef __ASM_MACH_GENERIC_GPIO_H
 #define __ASM_MACH_GENERIC_GPIO_H
 
-#ifdef CONFIG_GPIOLIB
-#define gpio_get_value	__gpio_get_value
-#define gpio_set_value	__gpio_set_value
-#define gpio_cansleep	__gpio_cansleep
-#else
+#ifndef CONFIG_GPIOLIB
 int gpio_request(unsigned gpio, const char *label);
 void gpio_free(unsigned gpio);
 int gpio_direction_input(unsigned gpio);
@@ -14,7 +10,9 @@ int gpio_get_value(unsigned gpio);
 void gpio_set_value(unsigned gpio, int value);
 #endif
 int gpio_to_irq(unsigned gpio);
+#define gpio_to_irq gpio_to_irq
 int irq_to_gpio(unsigned irq);
+#define irq_to_gpio irq_to_gpio
 
 #include <asm-generic/gpio.h>		/* cansleep wrappers */
 
diff --git a/arch/mips/include/asm/mach-loongson/gpio.h b/arch/mips/include/asm/mach-loongson/gpio.h
index e30e73d..df6efc0 100644
--- a/arch/mips/include/asm/mach-loongson/gpio.h
+++ b/arch/mips/include/asm/mach-loongson/gpio.h
@@ -13,6 +13,8 @@
 #ifndef	__STLS2F_GPIO_H
 #define	__STLS2F_GPIO_H
 
+#define gpio_to_irq gpio_to_irq
+
 #include <asm-generic/gpio.h>
 
 extern void gpio_set_value(unsigned gpio, int value);
@@ -27,9 +29,4 @@ static inline int gpio_to_irq(int gpio)
 	return -EINVAL;
 }
 
-static inline int irq_to_gpio(int gpio)
-{
-	return -EINVAL;
-}
-
 #endif				/* __STLS2F_GPIO_H */
diff --git a/arch/mips/include/asm/mach-rc32434/gpio.h b/arch/mips/include/asm/mach-rc32434/gpio.h
index 12ee8d5..8b0815b 100644
--- a/arch/mips/include/asm/mach-rc32434/gpio.h
+++ b/arch/mips/include/asm/mach-rc32434/gpio.h
@@ -13,18 +13,14 @@
 #ifndef _RC32434_GPIO_H_
 #define _RC32434_GPIO_H_
 
+#define gpio_to_irq(gpio)	(8 + 4 * 32 + gpio)
+#define irq_to_gpio(irq)	(irq - (8 + 4 * 32))
+
 #include <linux/types.h>
 #include <asm-generic/gpio.h>
 
 #define NR_BUILTIN_GPIO		32
 
-#define gpio_get_value	__gpio_get_value
-#define gpio_set_value	__gpio_set_value
-#define gpio_cansleep	__gpio_cansleep
-
-#define gpio_to_irq(gpio)	(8 + 4 * 32 + gpio)
-#define irq_to_gpio(irq)	(irq - (8 + 4 * 32))
-
 struct rb532_gpio_reg {
 	u32   gpiofunc;   /* GPIO Function Register
 			   * gpiofunc[x]==0 bit = gpio
diff --git a/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h b/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h
index ebdbab9..8356a8e 100644
--- a/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h
+++ b/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h
@@ -11,16 +11,15 @@
 #ifndef __PMC_MSP71XX_GPIO_H
 #define __PMC_MSP71XX_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_to_irq gpio_to_irq
+
 /* Max number of gpio's is 28 on chip plus 3 banks of I2C IO Expanders */
 #define ARCH_NR_GPIOS (28 + (3 * 8))
 
 /* new generic GPIO API - see Documentation/gpio.txt */
 #include <asm-generic/gpio.h>
 
-#define gpio_get_value	__gpio_get_value
-#define gpio_set_value	__gpio_set_value
-#define gpio_cansleep	__gpio_cansleep
-
 /* Setup calls for the gpio and gpio extended */
 extern void msp71xx_init_gpio(void);
 extern void msp71xx_init_gpio_extended(void);
@@ -38,9 +37,4 @@ static inline int gpio_to_irq(unsigned gpio)
 	return -EINVAL;
 }
 
-static inline int irq_to_gpio(unsigned irq)
-{
-	return -EINVAL;
-}
-
 #endif /* __PMC_MSP71XX_GPIO_H */
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 11162e6..03f0823 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -23,6 +23,7 @@ generic-y += fb.h
 generic-y += fcntl.h
 generic-y += ftrace.h
 generic-y += futex.h
+generic-y += gpio.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
 generic-y += ioctl.h
diff --git a/arch/openrisc/include/asm/gpio.h b/arch/openrisc/include/asm/gpio.h
deleted file mode 100644
index 0b0d174..0000000
--- a/arch/openrisc/include/asm/gpio.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- * et al.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_GPIO_H
-#define __ASM_OPENRISC_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * OpenRISC (or1k) does not have on-chip GPIO's so there is not really
- * any standardized implementation that makes sense here.  If passing
- * through gpiolib becomes a bottleneck then it may make sense, on a
- * case-by-case basis, to implement these inlined/rapid versions.
- *
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-/*
- * Not implemented, yet.
- */
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return -ENOSYS;
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* __ASM_OPENRISC_GPIO_H */
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index d51df17..9cf0632 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += auxvec.h
 header-y += bootx.h
 header-y += byteorder.h
diff --git a/arch/powerpc/include/asm/gpio.h b/arch/powerpc/include/asm/gpio.h
deleted file mode 100644
index 38762ed..0000000
--- a/arch/powerpc/include/asm/gpio.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generic GPIO API implementation for PowerPC.
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_POWERPC_GPIO_H
-#define __ASM_POWERPC_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* __ASM_POWERPC_GPIO_H */
diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h
index 04f53d3..44fee05 100644
--- a/arch/sh/include/asm/gpio.h
+++ b/arch/sh/include/asm/gpio.h
@@ -12,9 +12,6 @@
 #ifndef __ASM_SH_GPIO_H
 #define __ASM_SH_GPIO_H
 
-#include <linux/kernel.h>
-#include <linux/errno.h>
-
 #if defined(CONFIG_CPU_SH3)
 #include <cpu/gpio.h>
 #endif
@@ -22,33 +19,6 @@
 #define ARCH_NR_GPIOS 512
 #include <linux/sh_pfc.h>
 
-#ifdef CONFIG_GPIOLIB
-
-static inline int gpio_get_value(unsigned gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -ENOSYS;
-}
-
-#endif /* CONFIG_GPIOLIB */
+#include <asm-generic/gpio.h>
 
 #endif /* __ASM_SH_GPIO_H */
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 2c2e388..6d27595 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -18,6 +18,7 @@ header-y += utrap.h
 header-y += watchdog.h
 
 generic-y += div64.h
+generic-y += gpio.h
 generic-y += local64.h
 generic-y += irq_regs.h
 generic-y += local.h
diff --git a/arch/sparc/include/asm/gpio.h b/arch/sparc/include/asm/gpio.h
deleted file mode 100644
index a0e3ac0..0000000
--- a/arch/sparc/include/asm/gpio.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef __ASM_SPARC_GPIO_H
-#define __ASM_SPARC_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return -ENOSYS;
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* __ASM_SPARC_GPIO_H */
diff --git a/arch/unicore32/include/asm/gpio.h b/arch/unicore32/include/asm/gpio.h
index 2716f14..437f4e8 100644
--- a/arch/unicore32/include/asm/gpio.h
+++ b/arch/unicore32/include/asm/gpio.h
@@ -13,6 +13,12 @@
 #ifndef __UNICORE_GPIO_H__
 #define __UNICORE_GPIO_H__
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
+
 #include <linux/io.h>
 #include <asm/irq.h>
 #include <mach/hardware.h>
@@ -83,8 +89,6 @@ static inline void gpio_set_value(unsigned gpio, int value)
 		__gpio_set_value(gpio, value);
 }
 
-#define gpio_cansleep	__gpio_cansleep
-
 static inline unsigned gpio_to_irq(unsigned gpio)
 {
 	if ((gpio < IRQ_GPIOHIGH) && (FIELD(1, 1, gpio) & readl(GPIO_GPIR)))
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 6fa90a8..99d44ce 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += boot.h
 header-y += bootparam.h
 header-y += debugreg.h
diff --git a/arch/x86/include/asm/gpio.h b/arch/x86/include/asm/gpio.h
deleted file mode 100644
index 91d915a..0000000
--- a/arch/x86/include/asm/gpio.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generic GPIO API implementation for x86.
- *
- * Derived from the generic GPIO API for powerpc:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_X86_GPIO_H
-#define _ASM_X86_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_X86_GPIO_H */
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index c68e168..7d52c50 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1 +1,3 @@
 include include/asm-generic/Kbuild.asm
+
+generic-y += gpio.h
diff --git a/arch/xtensa/include/asm/gpio.h b/arch/xtensa/include/asm/gpio.h
deleted file mode 100644
index a8c9fc4..0000000
--- a/arch/xtensa/include/asm/gpio.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Generic GPIO API implementation for xtensa.
- *
- * Stolen from x86, which is derived from the generic GPIO API for powerpc:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_XTENSA_GPIO_H
-#define _ASM_XTENSA_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-/*
- * Not implemented, yet.
- */
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_XTENSA_GPIO_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index d494001..622851c 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -170,6 +170,29 @@ extern int __gpio_cansleep(unsigned gpio);
 
 extern int __gpio_to_irq(unsigned gpio);
 
+#ifndef gpio_get_value
+#define gpio_get_value(gpio) __gpio_get_value(gpio)
+#endif
+
+#ifndef gpio_set_value
+#define gpio_set_value(gpio, value) __gpio_set_value(gpio, value)
+#endif
+
+#ifndef gpio_cansleep
+#define gpio_cansleep(gpio) __gpio_cansleep(gpio)
+#endif
+
+#ifndef gpio_to_irq
+#define gpio_to_irq(gpio) __gpio_to_irq(gpio)
+#endif
+
+#ifndef irq_to_gpio
+static inline int irq_to_gpio(unsigned int irq)
+{
+	return -EINVAL;
+}
+#endif
+
 /**
  * struct gpio - a structure describing a GPIO with configuration
  * @gpio:	the GPIO number
-- 
1.7.6.1

^ permalink raw reply related

* Re: [PATCH] asm-generic/gpio.h: merge basic gpiolib wrappers
From: Mike Frysinger @ 2011-10-27 13:29 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: linux-mips, linux-ia64, linux-sh, linux, Paul Mackerras,
	H. Peter Anvin, sparclinux, Guan Xuetao, Hans-Christian Egtvedt,
	Jonas Bonn, x86, Ingo Molnar, linux-arch, Matt Turner,
	Haavard Skinnemoen, Fenghua Yu, microblaze-uclinux, linux-m68k,
	Ivan Kokshaysky, Thomas Gleixner, linux-arm-kernel,
	Richard Henderson, Chris Zankel, Michal Simek, Tony Luck,
	Mark Brown, linux-kernel, Ralf Baechle, Paul Mundt, linux-alpha,
	uclinux-dist-devel, linuxppc-dev, David S. Miller
In-Reply-To: <20111027131124.GK19187@n2100.arm.linux.org.uk>

On Thu, Oct 27, 2011 at 15:11, Russell King - ARM Linux wrote:
> On Thu, Oct 27, 2011 at 09:01:43AM -0400, Mike Frysinger wrote:
>> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
>> index d494001..622851c 100644
>> --- a/include/asm-generic/gpio.h
>> +++ b/include/asm-generic/gpio.h
>> @@ -170,6 +170,29 @@ extern int __gpio_cansleep(unsigned gpio);
>>
>> =A0extern int __gpio_to_irq(unsigned gpio);
>>
>> +#ifndef gpio_get_value
>> +#define gpio_get_value(gpio) __gpio_get_value(gpio)
>> +#endif
>> +
>> +#ifndef gpio_set_value
>> +#define gpio_set_value(gpio, value) __gpio_set_value(gpio, value)
>> +#endif
>> +
>> +#ifndef gpio_cansleep
>> +#define gpio_cansleep(gpio) __gpio_cansleep(gpio)
>> +#endif
>> +
>> +#ifndef gpio_to_irq
>> +#define gpio_to_irq(gpio) __gpio_to_irq(gpio)
>> +#endif
>> +
>> +#ifndef irq_to_gpio
>> +static inline int irq_to_gpio(unsigned int irq)
>> +{
>> + =A0 =A0 return -EINVAL;
>> +}
>> +#endif
>> +
>
> This is extremely dangerous. =A0Consider for example this code
> (see ARM mach-davinci's gpio.h):
> ...
> This is why I didn't solve this using the preprocessor method in ARM, but
> instead used __ARM_GPIOLIB_COMPLEX to control whether these definitions
> are required.

i thought the arm mach were defining things already, but i guess i
missed some in my review

easy enough to glue the arm-specific world to the asm-generic world
... a bit ugly, but should work i think:
#ifndef __ARM_GPIOLIB_COMPLEX
/* assume the mach has defined this */
#ifndef gpio_get_value
#define gpio_get_value gpio_get_value
#endif
#ifndef gpio_set_value
#define gpio_set_value gpio_set_value
#endif
#ifndef gpio_cansleep
#define gpio_cansleep gpio_cansleep
#endif
#ifndef gpio_to_irq
#define gpio_to_irq gpio_to_irq
#endif
#ifndef irq_to_gpio
#define irq_to_gpio irq_to_gpio
#endif
...

the next step might be to drill down into the arm mach's and sprinkle
the defines into the parts that need it ...
-mike

^ permalink raw reply

* Re: [PATCH] asm-generic/gpio.h: merge basic gpiolib wrappers
From: Russell King - ARM Linux @ 2011-10-27 13:11 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: linux-mips, linux-ia64, linux-sh, linux, Paul Mackerras,
	H. Peter Anvin, sparclinux, Guan Xuetao, Hans-Christian Egtvedt,
	Jonas Bonn, x86, Ingo Molnar, linux-arch, Matt Turner,
	Haavard Skinnemoen, Fenghua Yu, microblaze-uclinux, linux-m68k,
	Ivan Kokshaysky, Thomas Gleixner, linux-arm-kernel,
	Richard Henderson, Chris Zankel, Michal Simek, Tony Luck,
	Mark Brown, linux-kernel, Ralf Baechle, Paul Mundt, linux-alpha,
	uclinux-dist-devel, linuxppc-dev, David S. Miller
In-Reply-To: <1319720503-3183-1-git-send-email-vapier@gentoo.org>

On Thu, Oct 27, 2011 at 09:01:43AM -0400, Mike Frysinger wrote:
> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> index d494001..622851c 100644
> --- a/include/asm-generic/gpio.h
> +++ b/include/asm-generic/gpio.h
> @@ -170,6 +170,29 @@ extern int __gpio_cansleep(unsigned gpio);
>  
>  extern int __gpio_to_irq(unsigned gpio);
>  
> +#ifndef gpio_get_value
> +#define gpio_get_value(gpio) __gpio_get_value(gpio)
> +#endif
> +
> +#ifndef gpio_set_value
> +#define gpio_set_value(gpio, value) __gpio_set_value(gpio, value)
> +#endif
> +
> +#ifndef gpio_cansleep
> +#define gpio_cansleep(gpio) __gpio_cansleep(gpio)
> +#endif
> +
> +#ifndef gpio_to_irq
> +#define gpio_to_irq(gpio) __gpio_to_irq(gpio)
> +#endif
> +
> +#ifndef irq_to_gpio
> +static inline int irq_to_gpio(unsigned int irq)
> +{
> +	return -EINVAL;
> +}
> +#endif
> +

This is extremely dangerous.  Consider for example this code
(see ARM mach-davinci's gpio.h):

#include <asm-generic/gpio.h>

static inline int gpio_get_value(unsigned gpio)
{
        struct davinci_gpio_controller *ctlr;

        if (!__builtin_constant_p(gpio) || gpio >= davinci_soc_info.gpio_num)
                return __gpio_get_value(gpio);

        ctlr = __gpio_to_controller(gpio);
        return __gpio_mask(gpio) & __raw_readl(ctlr->in_data);
}

The result with your changes above will be:

static inline int __gpio_get_value(unsigned gpio)
{
        struct davinci_gpio_controller *ctlr;

        if (!__builtin_constant_p(gpio) || gpio >= davinci_soc_info.gpio_num)
                return __gpio_get_value(gpio);

        ctlr = __gpio_to_controller(gpio);
        return __gpio_mask(gpio) & __raw_readl(ctlr->in_data);
}

and notice the recursive call there.

This is why I didn't solve this using the preprocessor method in ARM, but
instead used __ARM_GPIOLIB_COMPLEX to control whether these definitions
are required.

^ permalink raw reply

* Re: [PATCH] asm-generic/gpio.h: merge basic gpiolib wrappers
From: Russell King - ARM Linux @ 2011-10-27 13:43 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: linux-mips, linux-ia64, linux-sh, linux, Paul Mackerras,
	H. Peter Anvin, sparclinux, Guan Xuetao, Hans-Christian Egtvedt,
	Jonas Bonn, x86, Ingo Molnar, linux-arch, Matt Turner,
	Haavard Skinnemoen, Fenghua Yu, microblaze-uclinux, linux-m68k,
	Ivan Kokshaysky, Thomas Gleixner, linux-arm-kernel,
	Richard Henderson, Chris Zankel, Michal Simek, Tony Luck,
	Mark Brown, linux-kernel, Ralf Baechle, Paul Mundt, linux-alpha,
	uclinux-dist-devel, linuxppc-dev, David S. Miller
In-Reply-To: <CAJaTeTp_jv-b1GUEswfFzn=joj=jkMHE91zK1wnDksH60GT6Dg@mail.gmail.com>

On Thu, Oct 27, 2011 at 03:29:40PM +0200, Mike Frysinger wrote:
> On Thu, Oct 27, 2011 at 15:11, Russell King - ARM Linux wrote:
> > On Thu, Oct 27, 2011 at 09:01:43AM -0400, Mike Frysinger wrote:
> >> diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
> >> index d494001..622851c 100644
> >> --- a/include/asm-generic/gpio.h
> >> +++ b/include/asm-generic/gpio.h
> >> @@ -170,6 +170,29 @@ extern int __gpio_cansleep(unsigned gpio);
> >>
> >>  extern int __gpio_to_irq(unsigned gpio);
> >>
> >> +#ifndef gpio_get_value
> >> +#define gpio_get_value(gpio) __gpio_get_value(gpio)
> >> +#endif
> >> +
> >> +#ifndef gpio_set_value
> >> +#define gpio_set_value(gpio, value) __gpio_set_value(gpio, value)
> >> +#endif
> >> +
> >> +#ifndef gpio_cansleep
> >> +#define gpio_cansleep(gpio) __gpio_cansleep(gpio)
> >> +#endif
> >> +
> >> +#ifndef gpio_to_irq
> >> +#define gpio_to_irq(gpio) __gpio_to_irq(gpio)
> >> +#endif
> >> +
> >> +#ifndef irq_to_gpio
> >> +static inline int irq_to_gpio(unsigned int irq)
> >> +{
> >> +     return -EINVAL;
> >> +}
> >> +#endif
> >> +
> >
> > This is extremely dangerous.  Consider for example this code
> > (see ARM mach-davinci's gpio.h):
> > ...
> > This is why I didn't solve this using the preprocessor method in ARM, but
> > instead used __ARM_GPIOLIB_COMPLEX to control whether these definitions
> > are required.
> 
> i thought the arm mach were defining things already, but i guess i
> missed some in my review
> 
> easy enough to glue the arm-specific world to the asm-generic world
> ... a bit ugly, but should work i think:
> #ifndef __ARM_GPIOLIB_COMPLEX
> /* assume the mach has defined this */
> #ifndef gpio_get_value
> #define gpio_get_value gpio_get_value
> #endif
> #ifndef gpio_set_value
> #define gpio_set_value gpio_set_value
> #endif
> #ifndef gpio_cansleep
> #define gpio_cansleep gpio_cansleep
> #endif
> #ifndef gpio_to_irq
> #define gpio_to_irq gpio_to_irq
> #endif
> #ifndef irq_to_gpio
> #define irq_to_gpio irq_to_gpio
> #endif
> ...
> 
> the next step might be to drill down into the arm mach's and sprinkle
> the defines into the parts that need it ...

You don't illustrate how it would work with what's there in current
kernels, so I'm having to guess.

With the above coming before the asm-generic/gpio.h include, and this
following the include:

/* The trivial gpiolib dispatchers */
#define gpio_get_value  __gpio_get_value
#define gpio_set_value  __gpio_set_value
#define gpio_cansleep   __gpio_cansleep

this is asking for multiple definition warnings from the preprocessor -
and wrapping these with yet more ifdefs doesn't solve the problem.

Also bear in mind that we're trying to reduce the amount of code in the
mach/gpio.h header files at the moment, so I'd want to avoid adding stuff
to them.

^ permalink raw reply

* Re: [PATCH] asm-generic/gpio.h: merge basic gpiolib wrappers
From: Russell King - ARM Linux @ 2011-10-27 13:53 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: linux-mips, linux-ia64, linux-sh, linux, Paul Mackerras,
	H. Peter Anvin, sparclinux, Guan Xuetao, Hans-Christian Egtvedt,
	Jonas Bonn, x86, Ingo Molnar, linux-arch, Matt Turner,
	Haavard Skinnemoen, Fenghua Yu, microblaze-uclinux, linux-m68k,
	Ivan Kokshaysky, Thomas Gleixner, linux-arm-kernel,
	Richard Henderson, Chris Zankel, Michal Simek, Tony Luck,
	Mark Brown, linux-kernel, Ralf Baechle, Paul Mundt, linux-alpha,
	uclinux-dist-devel, linuxppc-dev, David S. Miller
In-Reply-To: <1319720503-3183-1-git-send-email-vapier@gentoo.org>

On Thu, Oct 27, 2011 at 09:01:43AM -0400, Mike Frysinger wrote:
> diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
> index 11ad0bf..741efb2 100644
> --- a/arch/arm/include/asm/gpio.h
> +++ b/arch/arm/include/asm/gpio.h
> @@ -5,14 +5,15 @@
>  #include <mach/gpio.h>
>  
>  #ifndef __ARM_GPIOLIB_COMPLEX
> +/* assume the mach has defined this */
> +#ifndef irq_to_gpio
> +#define irq_to_gpio irq_to_gpio
> +#endif

Oh, this isn't a valid assumption either - it's far from valid.  Those
sub-architectures which don't define __ARM_GPIOLIB_COMPLEX probably don't
define any kind of irq_to_gpio function by any means.  Some of our
mach/gpio.h header files for sub-architectures using entirely gpiolib
are entirely empty - and we want them to stay that way.

^ permalink raw reply

* Fix for fsl_upm
From: Rusev @ 2011-10-27 14:18 UTC (permalink / raw)
  To: benh, paulus, galak, Shengzhou.Liu, Shaohui.Xie, linuxppc-dev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 46 bytes --]

patch is vs. 2.6.39, yet it applied to 3.1




[-- Attachment #2: fsl_lbc.c.patch --]
[-- Type: text/x-patch, Size: 694 bytes --]

Fix of UPM driver for Freescale PowerPC processors

If Freescale LBC driver fails to initialise itself from device tree,
then internal structure is freed only but not NULL-fied.
As result functions fsl_lbc_find() after checking the structure is not NULL are
trying to access device registers.

Signed-off-by: Alexandre Rusev <arusev@dev.rtsoft.ru> 
--- linux-2.6.39.old/arch/powerpc/sysdev/fsl_lbc.c	2011-10-27 03:17:28.000000000 +0400
+++ linux-2.6.39/arch/powerpc/sysdev/fsl_lbc.c	2011-10-27 05:06:44.000000000 +0400
@@ -322,6 +322,7 @@ static int __devinit fsl_lbc_ctrl_probe(
 err:
 	iounmap(fsl_lbc_ctrl_dev->regs);
 	kfree(fsl_lbc_ctrl_dev);
+	fsl_lbc_ctrl_dev = NULL;
 	return ret;
 }
 

^ permalink raw reply

* RE: [PATCH 3/5][v2] fsl-rio: Add two ports and rapidio message units support
From: Bounine, Alexandre @ 2011-10-27 15:26 UTC (permalink / raw)
  To: Liu Gang-B34182, Kumar Gala, linuxppc-dev, Zang Roy-R61911
  Cc: Andrew Morton, linux-kernel
In-Reply-To: <9A1C2A9ACC704641BC472A1588CE164713112C@039-SN1MPN1-005.039d.mgd.msft.net>

On Tue, Oct 25, 2011 at 6:40 AM, Liu Gang-B34182 <B34182@freescale.com>
wrote:
> > ... skip ...
> > > +
> > > +      DBELL_TID(dmsg),
> > > +      DBELL_INF(dmsg));
> > > +     break;
> > > +    }
> > >     }
> > >    }
> >
> > Do we need to check for matching DBELL_TID and mport destID here and
> > scan only doorbell list attached to the right port? Otherwise this
> may
> > call service routine associated with doorbell on a wrong port.
> > [Liu Gang-B34182] Do you mean to match DBELL_TID and mport DevID?
>=20
> Yes.
>=20
> > Usually this is a reliable method, but for the rapidio module of
> > powerpc, will encounter some problem. We set the port's DevID by the
> > register "Base Device ID CSR" defined in Rapidio Specification.
> The
> > rapidio module of powerpc can support two ports but have only one
the
> > Base Device ID CSR. So these two ports will have the same DevID.
> > Although there are two registers "Alternate Device ID CSR" to
> separate
> > deviceIDs for each port, they are specific registers of the
freescale
> > rapidio and can't be accessed by getting the extended
> feature
> > space block offset. For this doobell issue, in order to call a right
> > service routine, perhaps we should ensure that different ports in
> > different "res->start and res->end" configurations.
>=20
> This gives us an issue that has to be solved at some point.
> Splitting doorbell resources may be a way in this case but should be
> considered in context of RIO network with different endpoints and
> therefore it will be some device-specific quirk.
>=20
> Probably the best approach in this case is to keep doorbell handler as
> it is now (for purpose of this patchset) and address doorbell resource
> assignment during enumeration/discovery. At least this has to be well
> commented.
> [Liu Gang-B34182] I think this is a very complex issue, and could be
> very difficult to be resolved if we can't separate DevIDs for each
> port.
> Based on the current architecture of the RIO driver, the doorbell
> resource will be assigned by the application. For example, RIONET will
> assign the doorbell resource like this:
> 	if ((rc =3D rio_request_inb_dbell(rnet->mport,
> 					(void *)ndev,
> 					RIONET_DOORBELL_JOIN,
> 					RIONET_DOORBELL_LEAVE,
> 					rionet_dbell_event)) < 0)
> 		goto out;
> The res->start and res->end were defined by RIONET to
> RIONET_DOORBELL_JOIN (0x1000) and RIONET_DOORBELL_LEAVE (0x1001). And
> RIONET will send a doorbell
> package like this:
> 	rio_send_doorbell(peer->rdev, RIONET_DOORBELL_JOIN);
> When the destination port of this doorbell package has been assigned
> the same res->start and res->end, it can work well. But when we try to
> address doorbell resource assignment during enumeration/discovery, and
> give the different doorbell resource to different port, how an
endpoint
> to get the destination port resource it wants to send to a doorbell
> package?
>=20
> In fact, I also encountered some other issues due to the two ports
> sharing one CSR. For example the "Host base device ID lock command and
> status register" and "Port General control command and status
> register", these caused some issues when enumeration/discovery, and
> very difficult to be resolved
> based on current RIO architecture.

We need to adjust enumeration/discovery to deal with multi-port
endpoints.
As per RIO spec multi-port device has only one Base Device ID CSR but at
least offers a way to properly identify such capability.
Unfortunately p4080 controller follows older RIO 1.2 spec and does not
implement the multiport bit and CSR 0x14. This will force us to have a
quirk for devices with specific Device Identity CAR values.

One of possible ways for discovery may be ignoring value in reg.0x60 and
use destID set in the routing table of the attached switch (assuming
that
endpoint is capable to accept packets with destIDs other than one
in reg.0x60). But this alone does not guarantee that destIDs assigned to
two different ports will not match. This may force us to consider
additional measures of identification (which may be easier to implement
if 16-bit destIDs are used).

Anyway, we are not in position to resolve this immediately and probably
the best what we can do now is to keep multi-port endpoint specifics
in mind for future extensions.=20

I am slowly addressing multiple port support issues in
enumeration/discovery prompted by introduction of tsi721 PCIe-to-SRIO
bridge
and will keep multi-port endpoints in mind (this is different from
multiple
tsi721's on single board).=20

Regards,
=20
Alex.

^ permalink raw reply

* Re: [PATCH 2/3] [44x] Enable CONFIG_RELOCATABLE for PPC44x
From: Scott Wood @ 2011-10-27 15:41 UTC (permalink / raw)
  To: Suzuki Poulose
  Cc: Michal Simek, tmarri, Mahesh Jagannath Salgaonkar, Dave Hansen,
	David Laight, Paul Mackerras, linux ppc dev, Vivek Goyal
In-Reply-To: <4EA919AE.4020508@in.ibm.com>

On 10/27/2011 03:43 AM, Suzuki Poulose wrote:
> On 10/27/11 00:46, Scott Wood wrote:
>> On 10/26/2011 02:12 PM, Suzuki Poulose wrote:
>>> I have renamed the new type of relocation to RELOCATABLE_PPC32_PIE. The
>>> patches
>>> were posted yesterday. Please let me know your thoughts.
>>
>> I think it would make more sense to rename the existing behavior (maybe
>> something like DYNAMIC_MEMSTART -- if there's even enough overhead to
>> make it worth being configurable at all), since it's not fully
>> relocatable and since 64-bit already uses RELOCATABLE to mean PIE.
> 
> I think leaving the current behaviour as it is, and adding the PIE as an
> additional configuration option would be safe and wouldn't disturb the
> existing dependencies.

That's how things grow to be an unmaintainable mess.  AFAICT, what
you're doing is the same as what 64-bit does for RELOCATABLE.  If
they're doing the same thing, they should be called the same thing.
Whereas 64-bit and e500 are currently doing different things for
RELOCATABLE -- so they should be called different things.

> ( CRASH_DUMP etc. depend on RELOCATABLE for archs which work fine ).

A simple grep should be able to sort out such dependencies on the name.

-Scott

^ permalink raw reply

* Re: Fix for fsl_upm
From: Kumar Gala @ 2011-10-27 18:28 UTC (permalink / raw)
  To: Rusev; +Cc: Shaohui.Xie, linux-kernel, Shengzhou.Liu, paulus, linuxppc-dev
In-Reply-To: <4EA9683D.8030100@dev.rtsoft.ru>


On Oct 27, 2011, at 9:18 AM, Rusev wrote:

> patch is vs. 2.6.39, yet it applied to 3.1
>=20
>=20
>=20
> Fix of UPM driver for Freescale PowerPC processors
>=20
> If Freescale LBC driver fails to initialise itself from device tree,
> then internal structure is freed only but not NULL-fied.
> As result functions fsl_lbc_find() after checking the structure is not =
NULL are
> trying to access device registers.
>=20
> Signed-off-by: Alexandre Rusev <arusev@dev.rtsoft.ru>=20
> --- linux-2.6.39.old/arch/powerpc/sysdev/fsl_lbc.c	2011-10-27 =
03:17:28.000000000 +0400
> +++ linux-2.6.39/arch/powerpc/sysdev/fsl_lbc.c	2011-10-27 =
05:06:44.000000000 +0400
> @@ -322,6 +322,7 @@ static int __devinit fsl_lbc_ctrl_probe(
> err:
> 	iounmap(fsl_lbc_ctrl_dev->regs);
> 	kfree(fsl_lbc_ctrl_dev);
> +	fsl_lbc_ctrl_dev =3D NULL;
> 	return ret;
> }
>=20

Can you send this as a proper patch.

- k

^ permalink raw reply

* Re: [PATCH v2] powerpc: book3e: WSP: Add Chroma as a new WSP/PowerEN platform.
From: Scott Wood @ 2011-10-27 20:48 UTC (permalink / raw)
  To: Jimi Xenidis; +Cc: linuxppc-dev
In-Reply-To: <DD04A5E8-2850-4DDC-9E7A-B899B0EEEF11@pobox.com>

On 10/11/2011 09:47 AM, Jimi Xenidis wrote:
> On Tue Oct 4 05:02:41 EST 2011, Scott Wood wrote:
> 
> Looking at your comments below, will the following be acceptable
> 
>> On 09/29/2011 09:27 PM, Jimi Xenidis wrote:
>>> diff --git a/arch/powerpc/platforms/wsp/Kconfig b/arch/powerpc/platforms/wsp/Kconfig
>>> index ea2811c..a3eef8e 100644
>>> --- a/arch/powerpc/platforms/wsp/Kconfig
>>> +++ b/arch/powerpc/platforms/wsp/Kconfig
>>> @@ -1,6 +1,7 @@
>>>  config PPC_WSP
>>>  	bool
>>>  	select PPC_A2
>>> +	select GENERIC_TBSYNC
>>>  	select PPC_ICSWX
>>>  	select PPC_SCOM
>>>  	select PPC_XICS
>>> @@ -8,14 +9,20 @@ config PPC_WSP
>>>  	select PCI
>>>  	select PPC_IO_WORKAROUNDS if PCI
>>>  	select PPC_INDIRECT_PIO if PCI
>>> +	select PPC_WSP_COPRO
>>>  	default n
>>>  
>>>  menu "WSP platform selection"
>>>  	depends on PPC_BOOK3E_64
> 
> add "&& SMP"
> 
>>>  
>>>  config PPC_PSR2
>>> -	bool "PSR-2 platform"
>>> -	select GENERIC_TBSYNC
>>> +	bool "PowerEN System Reference Platform 2"
>>> +	select EPAPR_BOOT
>>> +	select PPC_WSP
>>> +	default y
> 
> Make these "default n"
> 
> Will that address everything?

It should address the issues I've seen, though someone (IIRC Timur) said
that he saw a dependency on some PCI error detection code as well.

-Scott

^ permalink raw reply

* Re: [PATCH 1/3 v2] mmc: Move mmc_delay() to include/linux/mmc/core.h
From: Kumar Gala @ 2011-10-27 21:19 UTC (permalink / raw)
  To: Chunhe Lan; +Cc: linuxppc-dev, Chris Ball, linux-mmc
In-Reply-To: <1314345150-1803-1-git-send-email-Chunhe.Lan@freescale.com>


On Aug 26, 2011, at 2:52 AM, Chunhe Lan wrote:

> Move mmc_delay() from drivers/mmc/core/core.h to
> include/linux/mmc/core.h. So when other functions
> call it with include syntax using <linux/mmc/core.h>
> of absolute path rather than "../core/core.h" of
> relative path.
>=20
> Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> Cc: Chris Ball <cjb@laptop.org>
> ---
> drivers/mmc/core/core.h  |   12 ------------
> include/linux/mmc/core.h |   11 +++++++++++
> 2 files changed, 11 insertions(+), 12 deletions(-)

Chris,

Any comments on these patches or acceptance?

- k

>=20
> diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h
> index d9411ed..58c3f10 100644
> --- a/drivers/mmc/core/core.h
> +++ b/drivers/mmc/core/core.h
> @@ -11,8 +11,6 @@
> #ifndef _MMC_CORE_CORE_H
> #define _MMC_CORE_CORE_H
>=20
> -#include <linux/delay.h>
> -
> #define MMC_CMD_RETRIES        3
>=20
> struct mmc_bus_ops {
> @@ -44,16 +42,6 @@ int mmc_set_signal_voltage(struct mmc_host *host, =
int signal_voltage,
> void mmc_set_timing(struct mmc_host *host, unsigned int timing);
> void mmc_set_driver_type(struct mmc_host *host, unsigned int =
drv_type);
>=20
> -static inline void mmc_delay(unsigned int ms)
> -{
> -	if (ms < 1000 / HZ) {
> -		cond_resched();
> -		mdelay(ms);
> -	} else {
> -		msleep(ms);
> -	}
> -}
> -
> void mmc_rescan(struct work_struct *work);
> void mmc_start_host(struct mmc_host *host);
> void mmc_stop_host(struct mmc_host *host);
> diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
> index b8b1b7a..7bc2798 100644
> --- a/include/linux/mmc/core.h
> +++ b/include/linux/mmc/core.h
> @@ -10,6 +10,7 @@
>=20
> #include <linux/interrupt.h>
> #include <linux/device.h>
> +#include <linux/delay.h>
>=20
> struct request;
> struct mmc_data;
> @@ -182,6 +183,16 @@ static inline void mmc_claim_host(struct mmc_host =
*host)
> 	__mmc_claim_host(host, NULL);
> }
>=20
> +static inline void mmc_delay(unsigned int ms)
> +{
> +	if (ms < 1000 / HZ) {
> +		cond_resched();
> +		mdelay(ms);
> +	} else {
> +		msleep(ms);
> +	}
> +}
> +
> extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max);
>=20
> #endif /* LINUX_MMC_CORE_H */
> --=20
> 1.7.5.1
>=20
>=20
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* [PATCH v2] asm-generic/gpio.h: merge basic gpiolib wrappers
From: Mike Frysinger @ 2011-10-27 22:52 UTC (permalink / raw)
  To: Grant Likely, Richard Henderson, Ivan Kokshaysky, Matt Turner,
	Haavard Skinnemoen, Hans-Christian Egtvedt, Tony Luck, Fenghua Yu,
	Michal Simek, Ralf Baechle, Paul Mundt, Jonas Bonn,
	Paul Mackerras, Benjamin Herrenschmidt, David S. Miller,
	Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Chris Zankel,
	Russell King, Guan Xuetao, Mark Brown
  Cc: linux-arch, linux-mips, x86, linux-ia64, linux-sh,
	microblaze-uclinux, linux, linux-kernel, linux-m68k,
	Mike Frysinger, linux-alpha, sparclinux, uclinux-dist-devel,
	linuxppc-dev, linux-arm-kernel
In-Reply-To: <1319720503-3183-1-git-send-email-vapier@gentoo.org>

Rather than requiring architectures that use gpiolib but don't have
any need to define anything custom to copy an asm/gpio.h, merge this
code into the asm-generic/gpio.h.  We add ifdef checks so that arches
can still override things while using the asm-generic/gpio.h, but on
a more fine grained per-func approach.

I've compile tested these guys (with & without GPIOLIB), but don't
have the hardware to boot:
	- alpha defconfig
	- arm: every defconfig
	- blackfin defconfig
	- ia64 defconfig
	- m68k: multi & m5208evb defconfig
	- mips: ar7 & ath79 & bcm47xx & bcm63xx & ip22 defconfig
	- powerpc: mpc85xx & ppc64 defconfig
	- sh: kfr2r09 defconfig
	- sparc defconfig
	- x86_64 defconfig

There is concern for adding code to the arm gpio headers, but since my
diffstat removes more than it adds, and it only adds when there are funcs
which need to be customized in the first place, I think this holds to the
desire to ultimately kill off (when possible) the misc sub gpio headers.
After all, if you can kill the overridden function, my additional lines
shouldn't be needed either.

I don't have any toolchains for avr32, microblaze, openrisc, unicore32,
or xtensa.  So they lose :x.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
	- grub through arm gpio.h headers
	- add m68k support

note: i've done a full build of all arm defconfigs, and any warnings
	or build failures appear to be unrelated to my change (sadly, there
	seem to be way more than there should be ...).  i'll start a 2nd
	build which compares the binary output to make sure they're the
	same, but if people see something that needs more attention before
	that, feel free to highlight it.

 arch/alpha/include/asm/Kbuild                   |    2 +
 arch/alpha/include/asm/gpio.h                   |   55 -------------------
 arch/arm/include/asm/gpio.h                     |   16 ------
 arch/arm/include/asm/hardware/iop3xx-gpio.h     |   21 ++------
 arch/arm/mach-davinci/include/mach/gpio.h       |   11 ++--
 arch/arm/mach-ixp4xx/include/mach/gpio.h        |    8 +--
 arch/arm/mach-ks8695/include/mach/gpio.h        |    1 +
 arch/arm/mach-mmp/include/mach/gpio.h           |    2 -
 arch/arm/mach-pxa/include/mach/gpio.h           |    2 +-
 arch/arm/mach-sa1100/include/mach/gpio.h        |   13 ++---
 arch/arm/mach-shmobile/include/mach/gpio.h      |   16 ------
 arch/arm/mach-w90x900/include/mach/gpio.h       |    1 +
 arch/arm/plat-mxc/include/mach/irqs.h           |    2 -
 arch/arm/plat-omap/include/plat/gpio.h          |    4 +-
 arch/arm/plat-pxa/include/plat/gpio.h           |    6 +--
 arch/avr32/mach-at32ap/include/mach/gpio.h      |   19 +------
 arch/blackfin/include/asm/gpio.h                |   16 ++----
 arch/ia64/include/asm/Kbuild                    |    2 +
 arch/ia64/include/asm/gpio.h                    |   55 -------------------
 arch/m68k/include/asm/gpio.h                    |    7 +++
 arch/microblaze/include/asm/Kbuild              |    2 +
 arch/microblaze/include/asm/gpio.h              |   53 ------------------
 arch/mips/include/asm/mach-ar7/gpio.h           |    5 --
 arch/mips/include/asm/mach-ath79/gpio.h         |    8 ++-
 arch/mips/include/asm/mach-bcm47xx/gpio.h       |    3 +
 arch/mips/include/asm/mach-bcm63xx/gpio.h       |    5 --
 arch/mips/include/asm/mach-generic/gpio.h       |    8 +--
 arch/mips/include/asm/mach-loongson/gpio.h      |    7 +--
 arch/mips/include/asm/mach-rc32434/gpio.h       |   10 +---
 arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h |   12 +---
 arch/openrisc/include/asm/Kbuild                |    1 +
 arch/openrisc/include/asm/gpio.h                |   65 -----------------------
 arch/powerpc/include/asm/Kbuild                 |    2 +
 arch/powerpc/include/asm/gpio.h                 |   53 ------------------
 arch/sh/include/asm/gpio.h                      |   32 +-----------
 arch/sparc/include/asm/Kbuild                   |    1 +
 arch/sparc/include/asm/gpio.h                   |   36 -------------
 arch/unicore32/include/asm/gpio.h               |    8 ++-
 arch/x86/include/asm/Kbuild                     |    2 +
 arch/x86/include/asm/gpio.h                     |   53 ------------------
 arch/xtensa/include/asm/Kbuild                  |    2 +
 arch/xtensa/include/asm/gpio.h                  |   56 -------------------
 include/asm-generic/gpio.h                      |   23 ++++++++
 43 files changed, 105 insertions(+), 601 deletions(-)
 delete mode 100644 arch/alpha/include/asm/gpio.h
 delete mode 100644 arch/ia64/include/asm/gpio.h
 delete mode 100644 arch/microblaze/include/asm/gpio.h
 delete mode 100644 arch/openrisc/include/asm/gpio.h
 delete mode 100644 arch/powerpc/include/asm/gpio.h
 delete mode 100644 arch/sparc/include/asm/gpio.h
 delete mode 100644 arch/x86/include/asm/gpio.h
 delete mode 100644 arch/xtensa/include/asm/gpio.h

diff --git a/arch/alpha/include/asm/Kbuild b/arch/alpha/include/asm/Kbuild
index e423def..0bcff1a 100644
--- a/arch/alpha/include/asm/Kbuild
+++ b/arch/alpha/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += compiler.h
 header-y += console.h
 header-y += fpu.h
diff --git a/arch/alpha/include/asm/gpio.h b/arch/alpha/include/asm/gpio.h
deleted file mode 100644
index 7dc6a63..0000000
--- a/arch/alpha/include/asm/gpio.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Generic GPIO API implementation for Alpha.
- *
- * A stright copy of that for PowerPC which was:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_ALPHA_GPIO_H
-#define _ASM_ALPHA_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_ALPHA_GPIO_H */
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 11ad0bf..9818329 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -4,23 +4,7 @@
 /* not all ARM platforms necessarily support this API ... */
 #include <mach/gpio.h>
 
-#ifndef __ARM_GPIOLIB_COMPLEX
 /* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
 #include <asm-generic/gpio.h>
 
-/* The trivial gpiolib dispatchers */
-#define gpio_get_value  __gpio_get_value
-#define gpio_set_value  __gpio_set_value
-#define gpio_cansleep   __gpio_cansleep
-#endif
-
-/*
- * Provide a default gpio_to_irq() which should satisfy every case.
- * However, some platforms want to do this differently, so allow them
- * to override it.
- */
-#ifndef gpio_to_irq
-#define gpio_to_irq	__gpio_to_irq
-#endif
-
 #endif /* _ARCH_ARM_GPIO_H */
diff --git a/arch/arm/include/asm/hardware/iop3xx-gpio.h b/arch/arm/include/asm/hardware/iop3xx-gpio.h
index 9eda7dc..4033b81 100644
--- a/arch/arm/include/asm/hardware/iop3xx-gpio.h
+++ b/arch/arm/include/asm/hardware/iop3xx-gpio.h
@@ -25,11 +25,14 @@
 #ifndef __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
 #define __ASM_ARM_HARDWARE_IOP3XX_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_cansleep gpio_cansleep
+
 #include <mach/hardware.h>
 #include <asm-generic/gpio.h>
 
-#define __ARM_GPIOLIB_COMPLEX
-
 #define IOP3XX_N_GPIOS	8
 
 static inline int gpio_get_value(unsigned gpio)
@@ -57,19 +60,5 @@ static inline int gpio_cansleep(unsigned gpio)
 		return __gpio_cansleep(gpio);
 }
 
-/*
- * The GPIOs are not generating any interrupt
- * Note : manuals are not clear about this
- */
-static inline int gpio_to_irq(int gpio)
-{
-	return -EINVAL;
-}
-
-static inline int irq_to_gpio(int gpio)
-{
-	return -EINVAL;
-}
-
 #endif
 
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
index fbaae47..1604005 100644
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ b/arch/arm/mach-davinci/include/mach/gpio.h
@@ -13,6 +13,11 @@
 #ifndef	__DAVINCI_GPIO_H
 #define	__DAVINCI_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_set_value gpio_set_value
+#define gpio_get_value gpio_get_value
+#define gpio_cansleep gpio_cansleep
+
 #include <asm-generic/gpio.h>
 
 /* The inline versions use the static inlines in the driver header */
@@ -77,10 +82,4 @@ static inline int gpio_cansleep(unsigned gpio)
 		return __gpio_cansleep(gpio);
 }
 
-static inline int irq_to_gpio(unsigned irq)
-{
-	/* don't support the reverse mapping */
-	return -ENOSYS;
-}
-
 #endif				/* __DAVINCI_GPIO_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h
index 83d6b4e..7835e31 100644
--- a/arch/arm/mach-ixp4xx/include/mach/gpio.h
+++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
@@ -28,8 +28,6 @@
 #include <linux/kernel.h>
 #include <mach/hardware.h>
 
-#define __ARM_GPIOLIB_COMPLEX
-
 static inline int gpio_request(unsigned gpio, const char *label)
 {
 	return 0;
@@ -63,17 +61,17 @@ static inline int gpio_get_value(unsigned gpio)
 
 	return value;
 }
+#define gpio_get_value gpio_get_value
 
 static inline void gpio_set_value(unsigned gpio, int value)
 {
 	gpio_line_set(gpio, value);
 }
-
-#include <asm-generic/gpio.h>			/* cansleep wrappers */
+#define gpio_set_value gpio_set_value
 
 extern int gpio_to_irq(int gpio);
 #define gpio_to_irq gpio_to_irq
 extern int irq_to_gpio(unsigned int irq);
+#define irq_to_gpio irq_to_gpio
 
 #endif
-
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h
index f5fda36..d81c6f8 100644
--- a/arch/arm/mach-ks8695/include/mach/gpio.h
+++ b/arch/arm/mach-ks8695/include/mach/gpio.h
@@ -15,5 +15,6 @@
  * Map IRQ number to GPIO line.
  */
 extern int irq_to_gpio(unsigned int irq);
+#define irq_to_gpio irq_to_gpio
 
 #endif
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
index 6812623..871b4c8 100644
--- a/arch/arm/mach-mmp/include/mach/gpio.h
+++ b/arch/arm/mach-mmp/include/mach/gpio.h
@@ -1,8 +1,6 @@
 #ifndef __ASM_MACH_GPIO_H
 #define __ASM_MACH_GPIO_H
 
-#include <asm-generic/gpio.h>
-
 #define gpio_to_irq(gpio)	(IRQ_GPIO_START + (gpio))
 #define irq_to_gpio(irq)	((irq) - IRQ_GPIO_START)
 
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
index 004cade..a28277c 100644
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -24,7 +24,6 @@
 #ifndef __ASM_ARCH_PXA_GPIO_H
 #define __ASM_ARCH_PXA_GPIO_H
 
-#include <asm-generic/gpio.h>
 /* The defines for the driver are needed for the accelerated accessors */
 #include "gpio-pxa.h"
 
@@ -43,6 +42,7 @@ static inline int irq_to_gpio(unsigned int irq)
 
 	return -1;
 }
+#define irq_to_gpio irq_to_gpio
 
 #include <plat/gpio.h>
 #endif
diff --git a/arch/arm/mach-sa1100/include/mach/gpio.h b/arch/arm/mach-sa1100/include/mach/gpio.h
index 7036318..6198f7a 100644
--- a/arch/arm/mach-sa1100/include/mach/gpio.h
+++ b/arch/arm/mach-sa1100/include/mach/gpio.h
@@ -24,12 +24,16 @@
 #ifndef __ASM_ARCH_SA1100_GPIO_H
 #define __ASM_ARCH_SA1100_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_to_irq(gpio)	((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
+					(IRQ_GPIO11 - 11 + gpio))
+
 #include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm-generic/gpio.h>
 
-#define __ARM_GPIOLIB_COMPLEX
-
 static inline int gpio_get_value(unsigned gpio)
 {
 	if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
@@ -49,9 +53,4 @@ static inline void gpio_set_value(unsigned gpio, int value)
 		__gpio_set_value(gpio, value);
 }
 
-#define gpio_cansleep	__gpio_cansleep
-
-#define gpio_to_irq(gpio)	((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
-					(IRQ_GPIO11 - 11 + gpio))
-
 #endif
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
index 7bf0890..f8a5637 100644
--- a/arch/arm/mach-shmobile/include/mach/gpio.h
+++ b/arch/arm/mach-shmobile/include/mach/gpio.h
@@ -10,23 +10,7 @@
 #ifndef __ASM_ARCH_GPIO_H
 #define __ASM_ARCH_GPIO_H
 
-#include <linux/kernel.h>
-#include <linux/errno.h>
-
 #define ARCH_NR_GPIOS 1024
 #include <linux/sh_pfc.h>
 
-#ifdef CONFIG_GPIOLIB
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -ENOSYS;
-}
-
-#else
-
-#define __ARM_GPIOLIB_COMPLEX
-
-#endif /* CONFIG_GPIOLIB */
-
 #endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-w90x900/include/mach/gpio.h b/arch/arm/mach-w90x900/include/mach/gpio.h
index 5385a42..c905219 100644
--- a/arch/arm/mach-w90x900/include/mach/gpio.h
+++ b/arch/arm/mach-w90x900/include/mach/gpio.h
@@ -26,5 +26,6 @@ static inline int irq_to_gpio(unsigned irq)
 {
 	return irq;
 }
+#define irq_to_gpio irq_to_gpio
 
 #endif
diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
index 00e812b..4589307 100644
--- a/arch/arm/plat-mxc/include/mach/irqs.h
+++ b/arch/arm/plat-mxc/include/mach/irqs.h
@@ -11,8 +11,6 @@
 #ifndef __ASM_ARCH_MXC_IRQS_H__
 #define __ASM_ARCH_MXC_IRQS_H__
 
-#include <asm-generic/gpio.h>
-
 /*
  * SoCs with TZIC interrupt controller have 128 IRQs, those with AVIC have 64
  */
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 9e86ee0..1fd4986 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -219,9 +219,6 @@ extern void omap_gpio_restore_context(void);
  * The original OMAP-specific calls should eventually be removed.
  */
 
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
 static inline int irq_to_gpio(unsigned irq)
 {
 	int tmp;
@@ -238,5 +235,6 @@ static inline int irq_to_gpio(unsigned irq)
 	/* we don't supply reverse mappings for non-SOC gpios */
 	return -EIO;
 }
+#define irq_to_gpio irq_to_gpio
 
 #endif
diff --git a/arch/arm/plat-pxa/include/plat/gpio.h b/arch/arm/plat-pxa/include/plat/gpio.h
index 258f772..4ee329c 100644
--- a/arch/arm/plat-pxa/include/plat/gpio.h
+++ b/arch/arm/plat-pxa/include/plat/gpio.h
@@ -1,8 +1,6 @@
 #ifndef __PLAT_GPIO_H
 #define __PLAT_GPIO_H
 
-#define __ARM_GPIOLIB_COMPLEX
-
 /* The individual machine provides register offsets and NR_BUILTIN_GPIO */
 #include <mach/gpio-pxa.h>
 
@@ -13,6 +11,7 @@ static inline int gpio_get_value(unsigned gpio)
 	else
 		return __gpio_get_value(gpio);
 }
+#define gpio_get_value gpio_get_value
 
 static inline void gpio_set_value(unsigned gpio, int value)
 {
@@ -24,7 +23,6 @@ static inline void gpio_set_value(unsigned gpio, int value)
 	} else
 		__gpio_set_value(gpio, value);
 }
-
-#define gpio_cansleep		__gpio_cansleep
+#define gpio_set_value gpio_set_value
 
 #endif /* __PLAT_GPIO_H */
diff --git a/arch/avr32/mach-at32ap/include/mach/gpio.h b/arch/avr32/mach-at32ap/include/mach/gpio.h
index 0180f58..f2ff962 100644
--- a/arch/avr32/mach-at32ap/include/mach/gpio.h
+++ b/arch/avr32/mach-at32ap/include/mach/gpio.h
@@ -10,26 +10,13 @@
  */
 #define ARCH_NR_GPIOS	(NR_GPIO_IRQS + 2 * 32)
 
+/* We implement a few ourself */
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
 
 /* Arch-neutral GPIO API, supporting both "native" and external GPIOs. */
 #include <asm-generic/gpio.h>
 
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-
 static inline int gpio_to_irq(unsigned int gpio)
 {
 	if (gpio < NR_GPIO_IRQS)
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 5a25856..6e25dcc 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -189,6 +189,12 @@ void bfin_gpio_set_value(unsigned gpio, int value);
 #include <asm/errno.h>
 
 #ifdef CONFIG_GPIOLIB
+
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define irq_to_gpio irq_to_gpio
+
 #include <asm-generic/gpio.h>		/* cansleep wrappers */
 
 static inline int gpio_get_value(unsigned int gpio)
@@ -207,16 +213,6 @@ static inline void gpio_set_value(unsigned int gpio, int value)
 		__gpio_set_value(gpio, value);
 }
 
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
 #else /* !CONFIG_GPIOLIB */
 
 static inline int gpio_request(unsigned gpio, const char *label)
diff --git a/arch/ia64/include/asm/Kbuild b/arch/ia64/include/asm/Kbuild
index 241d1c5..d0fdd2d 100644
--- a/arch/ia64/include/asm/Kbuild
+++ b/arch/ia64/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += break.h
 header-y += fpu.h
 header-y += gcc_intrin.h
diff --git a/arch/ia64/include/asm/gpio.h b/arch/ia64/include/asm/gpio.h
deleted file mode 100644
index 590a20d..0000000
--- a/arch/ia64/include/asm/gpio.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Generic GPIO API implementation for IA-64.
- *
- * A stright copy of that for PowerPC which was:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_IA64_GPIO_H
-#define _ASM_IA64_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_IA64_GPIO_H */
diff --git a/arch/m68k/include/asm/gpio.h b/arch/m68k/include/asm/gpio.h
index b204683..4544b6a 100644
--- a/arch/m68k/include/asm/gpio.h
+++ b/arch/m68k/include/asm/gpio.h
@@ -16,6 +16,13 @@
 #ifndef coldfire_gpio_h
 #define coldfire_gpio_h
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_cansleep gpio_cansleep
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
+
 #include <linux/io.h>
 #include <asm-generic/gpio.h>
 #include <asm/coldfire.h>
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index db5294c..5bf1ca7 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -1,3 +1,5 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y  += elf.h
diff --git a/arch/microblaze/include/asm/gpio.h b/arch/microblaze/include/asm/gpio.h
deleted file mode 100644
index 2b2c18b..0000000
--- a/arch/microblaze/include/asm/gpio.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generic GPIO API implementation for PowerPC.
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_MICROBLAZE_GPIO_H
-#define _ASM_MICROBLAZE_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_MICROBLAZE_GPIO_H */
diff --git a/arch/mips/include/asm/mach-ar7/gpio.h b/arch/mips/include/asm/mach-ar7/gpio.h
index c177cd1..78f40c2 100644
--- a/arch/mips/include/asm/mach-ar7/gpio.h
+++ b/arch/mips/include/asm/mach-ar7/gpio.h
@@ -27,11 +27,6 @@
 
 #define gpio_to_irq(gpio)	-1
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-
-#define gpio_cansleep __gpio_cansleep
-
 /* Board specific GPIO functions */
 int ar7_gpio_enable(unsigned gpio);
 int ar7_gpio_disable(unsigned gpio);
diff --git a/arch/mips/include/asm/mach-ath79/gpio.h b/arch/mips/include/asm/mach-ath79/gpio.h
index 60dcb62..2c570a0 100644
--- a/arch/mips/include/asm/mach-ath79/gpio.h
+++ b/arch/mips/include/asm/mach-ath79/gpio.h
@@ -13,6 +13,12 @@
 #ifndef __ASM_MACH_ATH79_GPIO_H
 #define __ASM_MACH_ATH79_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
+
 #define ARCH_NR_GPIOS	64
 #include <asm-generic/gpio.h>
 
@@ -21,6 +27,4 @@ int irq_to_gpio(unsigned irq);
 int gpio_get_value(unsigned gpio);
 void gpio_set_value(unsigned gpio, int value);
 
-#define gpio_cansleep	__gpio_cansleep
-
 #endif /* __ASM_MACH_ATH79_GPIO_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h
index 76961ca..d678316 100644
--- a/arch/mips/include/asm/mach-bcm47xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h
@@ -19,6 +19,7 @@
 extern int gpio_request(unsigned gpio, const char *label);
 extern void gpio_free(unsigned gpio);
 extern int gpio_to_irq(unsigned gpio);
+#define gpio_to_irq gpio_to_irq
 
 static inline int gpio_get_value(unsigned gpio)
 {
@@ -35,6 +36,7 @@ static inline int gpio_get_value(unsigned gpio)
 	}
 	return -EINVAL;
 }
+#define gpio_get_value gpio_get_value
 
 static inline void gpio_set_value(unsigned gpio, int value)
 {
@@ -53,6 +55,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
 #endif
 	}
 }
+#define gpio_set_value gpio_set_value
 
 static inline int gpio_direction_input(unsigned gpio)
 {
diff --git a/arch/mips/include/asm/mach-bcm63xx/gpio.h b/arch/mips/include/asm/mach-bcm63xx/gpio.h
index 1eb534d..c71bf66 100644
--- a/arch/mips/include/asm/mach-bcm63xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm63xx/gpio.h
@@ -5,11 +5,6 @@
 
 #define gpio_to_irq(gpio)	-1
 
-#define gpio_get_value __gpio_get_value
-#define gpio_set_value __gpio_set_value
-
-#define gpio_cansleep __gpio_cansleep
-
 #include <asm-generic/gpio.h>
 
 #endif /* __ASM_MIPS_MACH_BCM63XX_GPIO_H */
diff --git a/arch/mips/include/asm/mach-generic/gpio.h b/arch/mips/include/asm/mach-generic/gpio.h
index b4e7020..e8a89c5 100644
--- a/arch/mips/include/asm/mach-generic/gpio.h
+++ b/arch/mips/include/asm/mach-generic/gpio.h
@@ -1,11 +1,7 @@
 #ifndef __ASM_MACH_GENERIC_GPIO_H
 #define __ASM_MACH_GENERIC_GPIO_H
 
-#ifdef CONFIG_GPIOLIB
-#define gpio_get_value	__gpio_get_value
-#define gpio_set_value	__gpio_set_value
-#define gpio_cansleep	__gpio_cansleep
-#else
+#ifndef CONFIG_GPIOLIB
 int gpio_request(unsigned gpio, const char *label);
 void gpio_free(unsigned gpio);
 int gpio_direction_input(unsigned gpio);
@@ -14,7 +10,9 @@ int gpio_get_value(unsigned gpio);
 void gpio_set_value(unsigned gpio, int value);
 #endif
 int gpio_to_irq(unsigned gpio);
+#define gpio_to_irq gpio_to_irq
 int irq_to_gpio(unsigned irq);
+#define irq_to_gpio irq_to_gpio
 
 #include <asm-generic/gpio.h>		/* cansleep wrappers */
 
diff --git a/arch/mips/include/asm/mach-loongson/gpio.h b/arch/mips/include/asm/mach-loongson/gpio.h
index e30e73d..df6efc0 100644
--- a/arch/mips/include/asm/mach-loongson/gpio.h
+++ b/arch/mips/include/asm/mach-loongson/gpio.h
@@ -13,6 +13,8 @@
 #ifndef	__STLS2F_GPIO_H
 #define	__STLS2F_GPIO_H
 
+#define gpio_to_irq gpio_to_irq
+
 #include <asm-generic/gpio.h>
 
 extern void gpio_set_value(unsigned gpio, int value);
@@ -27,9 +29,4 @@ static inline int gpio_to_irq(int gpio)
 	return -EINVAL;
 }
 
-static inline int irq_to_gpio(int gpio)
-{
-	return -EINVAL;
-}
-
 #endif				/* __STLS2F_GPIO_H */
diff --git a/arch/mips/include/asm/mach-rc32434/gpio.h b/arch/mips/include/asm/mach-rc32434/gpio.h
index 12ee8d5..8b0815b 100644
--- a/arch/mips/include/asm/mach-rc32434/gpio.h
+++ b/arch/mips/include/asm/mach-rc32434/gpio.h
@@ -13,18 +13,14 @@
 #ifndef _RC32434_GPIO_H_
 #define _RC32434_GPIO_H_
 
+#define gpio_to_irq(gpio)	(8 + 4 * 32 + gpio)
+#define irq_to_gpio(irq)	(irq - (8 + 4 * 32))
+
 #include <linux/types.h>
 #include <asm-generic/gpio.h>
 
 #define NR_BUILTIN_GPIO		32
 
-#define gpio_get_value	__gpio_get_value
-#define gpio_set_value	__gpio_set_value
-#define gpio_cansleep	__gpio_cansleep
-
-#define gpio_to_irq(gpio)	(8 + 4 * 32 + gpio)
-#define irq_to_gpio(irq)	(irq - (8 + 4 * 32))
-
 struct rb532_gpio_reg {
 	u32   gpiofunc;   /* GPIO Function Register
 			   * gpiofunc[x]==0 bit = gpio
diff --git a/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h b/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h
index ebdbab9..8356a8e 100644
--- a/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h
+++ b/arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h
@@ -11,16 +11,15 @@
 #ifndef __PMC_MSP71XX_GPIO_H
 #define __PMC_MSP71XX_GPIO_H
 
+/* We implement a few ourself */
+#define gpio_to_irq gpio_to_irq
+
 /* Max number of gpio's is 28 on chip plus 3 banks of I2C IO Expanders */
 #define ARCH_NR_GPIOS (28 + (3 * 8))
 
 /* new generic GPIO API - see Documentation/gpio.txt */
 #include <asm-generic/gpio.h>
 
-#define gpio_get_value	__gpio_get_value
-#define gpio_set_value	__gpio_set_value
-#define gpio_cansleep	__gpio_cansleep
-
 /* Setup calls for the gpio and gpio extended */
 extern void msp71xx_init_gpio(void);
 extern void msp71xx_init_gpio_extended(void);
@@ -38,9 +37,4 @@ static inline int gpio_to_irq(unsigned gpio)
 	return -EINVAL;
 }
 
-static inline int irq_to_gpio(unsigned irq)
-{
-	return -EINVAL;
-}
-
 #endif /* __PMC_MSP71XX_GPIO_H */
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index 11162e6..03f0823 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -23,6 +23,7 @@ generic-y += fb.h
 generic-y += fcntl.h
 generic-y += ftrace.h
 generic-y += futex.h
+generic-y += gpio.h
 generic-y += hardirq.h
 generic-y += hw_irq.h
 generic-y += ioctl.h
diff --git a/arch/openrisc/include/asm/gpio.h b/arch/openrisc/include/asm/gpio.h
deleted file mode 100644
index 0b0d174..0000000
--- a/arch/openrisc/include/asm/gpio.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- * et al.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_GPIO_H
-#define __ASM_OPENRISC_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * OpenRISC (or1k) does not have on-chip GPIO's so there is not really
- * any standardized implementation that makes sense here.  If passing
- * through gpiolib becomes a bottleneck then it may make sense, on a
- * case-by-case basis, to implement these inlined/rapid versions.
- *
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-/*
- * Not implemented, yet.
- */
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return -ENOSYS;
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* __ASM_OPENRISC_GPIO_H */
diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index d51df17..9cf0632 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += auxvec.h
 header-y += bootx.h
 header-y += byteorder.h
diff --git a/arch/powerpc/include/asm/gpio.h b/arch/powerpc/include/asm/gpio.h
deleted file mode 100644
index 38762ed..0000000
--- a/arch/powerpc/include/asm/gpio.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generic GPIO API implementation for PowerPC.
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_POWERPC_GPIO_H
-#define __ASM_POWERPC_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * We don't (yet) implement inlined/rapid versions for on-chip gpios.
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* __ASM_POWERPC_GPIO_H */
diff --git a/arch/sh/include/asm/gpio.h b/arch/sh/include/asm/gpio.h
index 04f53d3..44fee05 100644
--- a/arch/sh/include/asm/gpio.h
+++ b/arch/sh/include/asm/gpio.h
@@ -12,9 +12,6 @@
 #ifndef __ASM_SH_GPIO_H
 #define __ASM_SH_GPIO_H
 
-#include <linux/kernel.h>
-#include <linux/errno.h>
-
 #if defined(CONFIG_CPU_SH3)
 #include <cpu/gpio.h>
 #endif
@@ -22,33 +19,6 @@
 #define ARCH_NR_GPIOS 512
 #include <linux/sh_pfc.h>
 
-#ifdef CONFIG_GPIOLIB
-
-static inline int gpio_get_value(unsigned gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -ENOSYS;
-}
-
-#endif /* CONFIG_GPIOLIB */
+#include <asm-generic/gpio.h>
 
 #endif /* __ASM_SH_GPIO_H */
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 2c2e388..6d27595 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -18,6 +18,7 @@ header-y += utrap.h
 header-y += watchdog.h
 
 generic-y += div64.h
+generic-y += gpio.h
 generic-y += local64.h
 generic-y += irq_regs.h
 generic-y += local.h
diff --git a/arch/sparc/include/asm/gpio.h b/arch/sparc/include/asm/gpio.h
deleted file mode 100644
index a0e3ac0..0000000
--- a/arch/sparc/include/asm/gpio.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef __ASM_SPARC_GPIO_H
-#define __ASM_SPARC_GPIO_H
-
-#include <linux/errno.h>
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return -ENOSYS;
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* __ASM_SPARC_GPIO_H */
diff --git a/arch/unicore32/include/asm/gpio.h b/arch/unicore32/include/asm/gpio.h
index 2716f14..437f4e8 100644
--- a/arch/unicore32/include/asm/gpio.h
+++ b/arch/unicore32/include/asm/gpio.h
@@ -13,6 +13,12 @@
 #ifndef __UNICORE_GPIO_H__
 #define __UNICORE_GPIO_H__
 
+/* We implement a few ourself */
+#define gpio_get_value gpio_get_value
+#define gpio_set_value gpio_set_value
+#define gpio_to_irq gpio_to_irq
+#define irq_to_gpio irq_to_gpio
+
 #include <linux/io.h>
 #include <asm/irq.h>
 #include <mach/hardware.h>
@@ -83,8 +89,6 @@ static inline void gpio_set_value(unsigned gpio, int value)
 		__gpio_set_value(gpio, value);
 }
 
-#define gpio_cansleep	__gpio_cansleep
-
 static inline unsigned gpio_to_irq(unsigned gpio)
 {
 	if ((gpio < IRQ_GPIOHIGH) && (FIELD(1, 1, gpio) & readl(GPIO_GPIR)))
diff --git a/arch/x86/include/asm/Kbuild b/arch/x86/include/asm/Kbuild
index 6fa90a8..99d44ce 100644
--- a/arch/x86/include/asm/Kbuild
+++ b/arch/x86/include/asm/Kbuild
@@ -1,5 +1,7 @@
 include include/asm-generic/Kbuild.asm
 
+generic-y += gpio.h
+
 header-y += boot.h
 header-y += bootparam.h
 header-y += debugreg.h
diff --git a/arch/x86/include/asm/gpio.h b/arch/x86/include/asm/gpio.h
deleted file mode 100644
index 91d915a..0000000
--- a/arch/x86/include/asm/gpio.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Generic GPIO API implementation for x86.
- *
- * Derived from the generic GPIO API for powerpc:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_X86_GPIO_H
-#define _ASM_X86_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_X86_GPIO_H */
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index c68e168..7d52c50 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -1 +1,3 @@
 include include/asm-generic/Kbuild.asm
+
+generic-y += gpio.h
diff --git a/arch/xtensa/include/asm/gpio.h b/arch/xtensa/include/asm/gpio.h
deleted file mode 100644
index a8c9fc4..0000000
--- a/arch/xtensa/include/asm/gpio.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Generic GPIO API implementation for xtensa.
- *
- * Stolen from x86, which is derived from the generic GPIO API for powerpc:
- *
- * Copyright (c) 2007-2008  MontaVista Software, Inc.
- *
- * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef _ASM_XTENSA_GPIO_H
-#define _ASM_XTENSA_GPIO_H
-
-#include <asm-generic/gpio.h>
-
-#ifdef CONFIG_GPIOLIB
-
-/*
- * Just call gpiolib.
- */
-static inline int gpio_get_value(unsigned int gpio)
-{
-	return __gpio_get_value(gpio);
-}
-
-static inline void gpio_set_value(unsigned int gpio, int value)
-{
-	__gpio_set_value(gpio, value);
-}
-
-static inline int gpio_cansleep(unsigned int gpio)
-{
-	return __gpio_cansleep(gpio);
-}
-
-static inline int gpio_to_irq(unsigned int gpio)
-{
-	return __gpio_to_irq(gpio);
-}
-
-/*
- * Not implemented, yet.
- */
-static inline int irq_to_gpio(unsigned int irq)
-{
-	return -EINVAL;
-}
-
-#endif /* CONFIG_GPIOLIB */
-
-#endif /* _ASM_XTENSA_GPIO_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index d494001..622851c 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -170,6 +170,29 @@ extern int __gpio_cansleep(unsigned gpio);
 
 extern int __gpio_to_irq(unsigned gpio);
 
+#ifndef gpio_get_value
+#define gpio_get_value(gpio) __gpio_get_value(gpio)
+#endif
+
+#ifndef gpio_set_value
+#define gpio_set_value(gpio, value) __gpio_set_value(gpio, value)
+#endif
+
+#ifndef gpio_cansleep
+#define gpio_cansleep(gpio) __gpio_cansleep(gpio)
+#endif
+
+#ifndef gpio_to_irq
+#define gpio_to_irq(gpio) __gpio_to_irq(gpio)
+#endif
+
+#ifndef irq_to_gpio
+static inline int irq_to_gpio(unsigned int irq)
+{
+	return -EINVAL;
+}
+#endif
+
 /**
  * struct gpio - a structure describing a GPIO with configuration
  * @gpio:	the GPIO number
-- 
1.7.6.1

^ permalink raw reply related

* RE: [PATCH v15 00/10] Add-Synopsys-DesignWare-HS-USB-OTG-driver
From: Tirumala Marri @ 2011-10-28  0:25 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-usb, linuxppc-dev
In-Reply-To: <20111027045103.GA609@kroah.com>

>
>What email client are you using, I have never seen this type of
>formatting, and it makes it impossible to read your replies.  Please
>resolve this.
Wrong prefix setting. Should be fixed now.

>Sometimes people miss things on previous reviews, this is not a perfict
>system, only the best that we currently know how to do, don't you agree?
>
>If this driver contains lots of things that are not necessary for it to
>work at this point in time, why wouldn't that be removed now?
>
>Anyway, I think it would probably be best to get this into staging for
>now, which will help you get a way to clean it up in an easier manner,
>and still have users have access to it.  Is that acceptable?
>
Yes it would be great if it can make it to staging. I will try remove
The un used code and re-send the patch.

Thx,
Marri

^ permalink raw reply

* Re: Kernel hang on PS3 with SMP
From: Geoff Levand @ 2011-10-28  1:17 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: cbe-oss-dev, Andre Heider, linuxppc-dev, Frank Rowand
In-Reply-To: <1310808863.13765.3.camel@twins>

Hi,

On 07/16/2011 02:34 AM, Peter Zijlstra wrote:
> On Sat, 2011-07-16 at 09:38 +0200, Andre Heider wrote:
>> Hi,
>> 
>> when I boot a recent kernel I'm getting hangs early in the boot process.
>> 
>> The kernel boots most of the time, but when /sbin/init kicks in it
>> waits forever for something. I only get a few lines of output, mostly
>> udev related.
>> When the kernel does not boot, it seems to hang somewhere when mapping
>> the irqs (at least that's what the last lines of ps3fb output
>> suggest).
>> I can run into both situation with the same kernel binary. It's also
>> consistent with two userlands, I tried debian stable and testing.
>> 
>> When this happens, I can't interact with the system, so I don't have
>> much more info.
>> 
>> I bisected this to:
>> 
>> commit 317f394160e9beb97d19a84c39b7e5eb3d7815a8
>> Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
>> Date:   Tue Apr 5 17:23:58 2011 +0200
>> 
>>     sched: Move the second half of ttwu() to the remote cpu
>> 
>> All kernels including this patch only work for me when booted with 'nosmp'.

I verified that indeed 317f394160e9beb97d19a84c39b7e5eb3d7815a8
'sched: Move the second half of ttwu() to the remote cpu' introduces
the hang.

>> Any ideas?
> 
> Verify 184748cc50b2dceb8287f9fb657eda48ff8fcfe7 does indeed cover your
> PPC flavour. It has some ppc changes, but I could have missed PS3 if its
> 'special'.

I don't think PS3 is special.  The IPI code is here:

  http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=arch/powerpc/platforms/ps3/smp.c;hb=HEAD

> Another thing to check is if your sched IPI handler calls
> irq_enter()/irq_exit(), if not try that.

I tried adding some these, but no change.

I tried to figure out what is happening, but I can't seem to.  It seems
when ttwu_queue_remote() is used the pending scheduling is not performed.

I can't say for sure what is happening.  With the test patch below the
system boots OK.

Also, if I add a udbg_printf(".") statement in the body of ps3's do_message_pass()
the system boots OK.

Any help would be greatly appreciated.

-Geoff

diff --git a/kernel/sched.c b/kernel/sched.c
index 9e3ede1..c16a35a 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2561,21 +2561,21 @@ static void ttwu_queue_remote(struct task_struct *p, int cpu)
 
 	if (!next)
 		smp_send_reschedule(cpu);
 }
 #endif
 
 static void ttwu_queue(struct task_struct *p, int cpu)
 {
 	struct rq *rq = cpu_rq(cpu);
 
-#if defined(CONFIG_SMP) && defined(CONFIG_SCHED_TTWU_QUEUE)
+#if 0 //defined(CONFIG_SMP) && defined(CONFIG_SCHED_TTWU_QUEUE)
 	if (sched_feat(TTWU_QUEUE) && cpu != smp_processor_id()) {
 		ttwu_queue_remote(p, cpu);
 		return;
 	}
 #endif
 
 	raw_spin_lock(&rq->lock);
 	ttwu_do_activate(rq, p, 0);
 	raw_spin_unlock(&rq->lock);
 }

^ permalink raw reply related

* Re: [PATCH 2/3] [44x] Enable CONFIG_RELOCATABLE for PPC44x
From: Suzuki Poulose @ 2011-10-28  5:03 UTC (permalink / raw)
  To: Scott Wood
  Cc: Michal Simek, tmarri, Mahesh Jagannath Salgaonkar, Dave Hansen,
	David Laight, Paul Mackerras, linux ppc dev, Vivek Goyal
In-Reply-To: <4EA97BB1.8020009@freescale.com>

On 10/27/11 21:11, Scott Wood wrote:
> On 10/27/2011 03:43 AM, Suzuki Poulose wrote:
>> On 10/27/11 00:46, Scott Wood wrote:
>>> On 10/26/2011 02:12 PM, Suzuki Poulose wrote:
>>>> I have renamed the new type of relocation to RELOCATABLE_PPC32_PIE. The
>>>> patches
>>>> were posted yesterday. Please let me know your thoughts.
>>>
>>> I think it would make more sense to rename the existing behavior (maybe
>>> something like DYNAMIC_MEMSTART -- if there's even enough overhead to
>>> make it worth being configurable at all), since it's not fully
>>> relocatable and since 64-bit already uses RELOCATABLE to mean PIE.
>>
>> I think leaving the current behaviour as it is, and adding the PIE as an
>> additional configuration option would be safe and wouldn't disturb the
>> existing dependencies.
>
> That's how things grow to be an unmaintainable mess.  AFAICT, what
> you're doing is the same as what 64-bit does for RELOCATABLE.  If
> they're doing the same thing, they should be called the same thing.
> Whereas 64-bit and e500 are currently doing different things for
> RELOCATABLE -- so they should be called different things.

OK. Agreed. I will resend the patches with the change.

Thanks
Suzuki

^ permalink raw reply

* [PATCH SDK1.1 ] Do not hide resource for pci/pcie when configured as Agent/EP
From: Jia Hongtao @ 2011-10-28  5:52 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: B11780, b38951

From: Jason Jin <Jason.jin@freescale.com>

Current pci/pcie init code will hide the pci/pcie host resource.
But did not judge it is host/RC or agent/EP. If configured as
agent/EP, we should avoid hiding its resource in the host side.

In PCI system, the Programing Interface can be used to judge the
host/agent status:
Programing Interface = 0: host
Programing Interface = 1: Agent

In PCIE system, both the Programing Interface and Header type can
be used to judge the RC/EP status.
Header Type = 0: EP
Header Type = 1: RC

Signed-off-by: Jason Jin <Jason.jin@freescale.com>
Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/kernel/pci-common.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 4f134132c..bc61a69 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -1732,10 +1732,13 @@ void __devinit pcibios_scan_phb(struct pci_controller *hose)
 static void fixup_hide_host_resource_fsl(struct pci_dev *dev)
 {
 	int i, class = dev->class >> 8;
+	/* When configured as agent, programing interface = 1 */
+	int prog_if = dev->class & 0xf;
 
 	if ((class == PCI_CLASS_PROCESSOR_POWERPC ||
 	     class == PCI_CLASS_BRIDGE_OTHER) &&
 		(dev->hdr_type == PCI_HEADER_TYPE_NORMAL) &&
+		(prog_if == 0) &&
 		(dev->bus->parent == NULL)) {
 		for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
 			dev->resource[i].start = 0;
-- 
1.7.5.1

^ permalink raw reply related

* [PATCH 1/2] Unify pci/pcie initialization code
From: Jia Hongtao @ 2011-10-28  8:03 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: B11780, b38951

In previous version pci/pcie initialization is in platform code which
Initialize PCI bridge base on EP/RC or host/agent settings.
We unified pci/pcie initialization as common APIs named fsl_pci_setup
which can be called by platform code.

Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
We only changed MPC85xxDS board as an example.
If no problem in the review we will change other boards also.

 arch/powerpc/platforms/85xx/mpc85xx_ds.c |   30 ++-----------------
 arch/powerpc/sysdev/fsl_pci.c            |   48 ++++++++++++++++++++++++++++++
 arch/powerpc/sysdev/fsl_pci.h            |    5 +++
 3 files changed, 56 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 10e7db0..7188c0b 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -157,33 +157,12 @@ extern void __init mpc85xx_smp_init(void);
 #endif
 static void __init mpc85xx_ds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-	struct pci_controller *hose;
-#endif
-	dma_addr_t max = 0xffffffff;
-
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
-#ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
-		    of_device_is_compatible(np, "fsl,p2020-pcie")) {
-			struct resource rsrc;
-			of_address_to_resource(np, 0, &rsrc);
-			if ((rsrc.start & 0xfffff) == primary_phb_addr)
-				fsl_add_bridge(np, 1);
-			else
-				fsl_add_bridge(np, 0);
-
-			hose = pci_find_hose_for_OF_device(np);
-			max = min(max, hose->dma_window_base_cur +
-					hose->dma_window_size);
-		}
-	}
+	fsl_pci_setup(primary_phb_addr);
 
+#ifdef CONFIG_PCI
 	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 
@@ -192,11 +171,8 @@ static void __init mpc85xx_ds_setup_arch(void)
 #endif
 
 #ifdef CONFIG_SWIOTLB
-	if (memblock_end_of_DRAM() > max) {
+	if (memblock_end_of_DRAM() > 0xffffffff)
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
 #endif
 
 	printk("MPC85xx DS board from Freescale Semiconductor\n");
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 80b8b7a..4d4536f 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -402,6 +402,54 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
 }
 #endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */
 
+static struct of_device_id pci_ids[] = {
+	{ .compatible = "fsl,mpc8540-pci", },
+	{ .compatible = "fsl,mpc8548-pcie", },
+	{},
+};
+
+/**
+ * fsl_pci_setup - Initialization for PCI
+ * @primary_phb_addr: primary bus address
+ *
+ * Add bridge if pci controller is a host
+ */
+void fsl_pci_setup(int primary_phb_addr)
+{
+	struct device_node *np;
+	struct pci_controller *hose;
+	dma_addr_t min_dma_addr = 0xffffffff;
+
+	for_each_node_by_type(np, "pci") {
+		if (of_match_node(pci_ids, np)) {
+			struct resource rsrc;
+			of_address_to_resource(np, 0, &rsrc);
+			if ((rsrc.start & 0xfffff) == primary_phb_addr)
+				fsl_add_bridge(np, 1);
+			else
+				fsl_add_bridge(np, 0);
+
+			hose = pci_find_hose_for_OF_device(np);
+			min_dma_addr = min(min_dma_addr,
+					hose->dma_window_base_cur
+					+ hose->dma_window_size);
+
+		}
+	}
+
+#ifdef CONFIG_SWIOTLB
+	/*
+	 * if we couldn't map all of DRAM via the dma windows we need SWIOTLB
+	 * to handle buffers located outside of dma capable memory region
+	 */
+	if (memblock_end_of_DRAM() > min_dma_addr) {
+		ppc_swiotlb_enable = 1;
+		set_pci_dma_ops(&swiotlb_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
+	}
+#endif
+}
+
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, quirk_fsl_pcie_header);
 
 #if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x)
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index a39ed5c..775ea21 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -89,6 +89,11 @@ struct ccsr_pci {
 };
 
 extern int fsl_add_bridge(struct device_node *dev, int is_primary);
+#ifndef CONFIG_PCI
+#define fsl_pci_setup(p)
+#else
+extern void fsl_pci_setup(int primary_phb_addr);
+#endif
 extern void fsl_pcibios_fixup_bus(struct pci_bus *bus);
 extern int mpc83xx_add_bridge(struct device_node *dev);
 u64 fsl_pci_immrbar_base(struct pci_controller *hose);
-- 
1.7.5.1

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox