Re: [PATCH] MIPS: Remove most of the custom gpio.h

2015-07-27 Thread Linus Walleij
On Thu, Jul 23, 2015 at 8:25 PM, Lars-Peter Clausen  wrote:
> On 07/22/2015 07:33 PM, Alban Bedel wrote:
>>
>> diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c
>> index 54c80d4..3dc500c 100644
>> --- a/arch/mips/jz4740/gpio.c
>> +++ b/arch/mips/jz4740/gpio.c
>> @@ -262,18 +262,6 @@ uint32_t jz_gpio_port_get_value(int port, uint32_t
>> mask)
>>   }
>>   EXPORT_SYMBOL(jz_gpio_port_get_value);
>>
>> -int gpio_to_irq(unsigned gpio)
>> -{
>> -   return JZ4740_IRQ_GPIO(0) + gpio;
>> -}
>> -EXPORT_SYMBOL_GPL(gpio_to_irq);
>
>
> This need to be hooked up the gpio_to_irq() callback of the gpio_chip struct
> of this driver rather than completely removing it. Otherwise this
> functionality will be broken.
>
> Similar for other platforms which implement the function.

Even better is to see if we can convert the driver to
GPIOLIB_IRQCHIP which moves the handling of IRQ mapping
to the gpiolib core. This works for all simple cascading GPIO-with-IRQ
controllers with a local mask register. (Not when the system intcon
and GPIO is mashed up though.)

But no hurry with that.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MIPS: Remove most of the custom gpio.h

2015-07-23 Thread Lars-Peter Clausen

On 07/22/2015 07:33 PM, Alban Bedel wrote:

diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c
index 54c80d4..3dc500c 100644
--- a/arch/mips/jz4740/gpio.c
+++ b/arch/mips/jz4740/gpio.c
@@ -262,18 +262,6 @@ uint32_t jz_gpio_port_get_value(int port, uint32_t mask)
  }
  EXPORT_SYMBOL(jz_gpio_port_get_value);

-int gpio_to_irq(unsigned gpio)
-{
-   return JZ4740_IRQ_GPIO(0) + gpio;
-}
-EXPORT_SYMBOL_GPL(gpio_to_irq);


This need to be hooked up the gpio_to_irq() callback of the gpio_chip struct 
of this driver rather than completely removing it. Otherwise this 
functionality will be broken.


Similar for other platforms which implement the function.

- Lars

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MIPS: Remove most of the custom gpio.h

2015-07-23 Thread Linus Walleij
On Wed, Jul 22, 2015 at 7:33 PM, Alban Bedel  wrote:

> Currently CONFIG_ARCH_HAVE_CUSTOM_GPIO_H is defined for all MIPS
> machines, and each machine type provides its own gpio.h. However only
> the Alchemy machine really use the feature, all other machines only
> use the default wrappers.
>
> For most machine types we can just remove the custom gpio.h, as well
> as the custom wrappers if some exists. A few more fixes are need in
> a few drivers as they rely on linux/gpio.h to provides some machine
> specific definitions, or used asm/gpio.h instead of linux/gpio.h for
> the gpio API.
>
> Signed-off-by: Alban Bedel 

This is exactly what the kernel needs. Enjoy my:
Reviewed-by: Linus Walleij 

And feel free to merge this through the MIPS tree.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MIPS: Remove most of the custom gpio.h

2015-07-23 Thread Alban
On Wed, 22 Jul 2015 19:47:18 +0200
Manuel Lauss  wrote:

> On Wed, Jul 22, 2015 at 7:33 PM, Alban Bedel  wrote:
> > Currently CONFIG_ARCH_HAVE_CUSTOM_GPIO_H is defined for all MIPS
> > machines, and each machine type provides its own gpio.h. However
> > only the Alchemy machine really use the feature, all other machines
> > only use the default wrappers.
> >
> > For most machine types we can just remove the custom gpio.h, as well
> > as the custom wrappers if some exists. A few more fixes are need in
> > a few drivers as they rely on linux/gpio.h to provides some machine
> > specific definitions, or used asm/gpio.h instead of linux/gpio.h for
> > the gpio API.
> >
> > Signed-off-by: Alban Bedel 
> > ---
> >
> > This patch is based on my previous serie:
> > "MIPS: ath79: Move the GPIO driver to drivers/gpio".
> >
> > For testing I tried to build all mips defconfig, however my
> > toolchain couldn't handle a few configs: ip28 malta_qemu_32r6
> > maltasmvp_eva sead3micro. If somebody can test these that would be
> > more than welcome.
> >
> > It might well be that some more drivers for MIPS devices that are
> > not enabled in the defconfig will break because of this change, so
> > more testing would be nice :)
> >
> > Regarding Alchemy I'm not sure what to do. It use a little more
> > complex setup, quoting arch/mips/include/asm/mach-au1x00/gpio.h:
> >
> > /* Linux gpio framework integration.
> > *
> > * 4 use cases of Alchemy GPIOS:
> > *(1) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=y:
> > *   Board must register gpiochips.
> > *(2) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=n:
> > *   A gpiochip for the 75 GPIOs is registered.
> > *
> > *(3) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=y:
> > *   the boards' gpio.h must provide the linux gpio wrapper
> > functions,
> > *
> > *(4) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=n:
> > *   inlinable gpio functions are provided which enable access
> > to the
> > *   Au1300 gpios only by using the numbers straight out of the
> > data-
> > *   sheets.
> >
> > * Cases 1 and 3 are intended for boards which want to provide their
> > own
> > * GPIO namespace and -operations (i.e. for example you have 8 GPIOs
> > * which are in part provided by spare Au1300 GPIO pins and in part
> > by
> > * an external FPGA but you still want them to be accssible in linux
> > * as gpio0-7. The board can of course use the alchemy_gpioX_*
> > functions
> > * as required).
> > */
> >
> > This sound to me like this is really not needed anymore. Is there
> > any users of this left, or can it just go?
> 
> There are no in-tree users of this, but a few out-of-tree ones (all
> made by me) Does it have to be removed?  Is it blocking anything?

It is not blocking anything, but I see little gain in it. Cases 1 and 3
should nowadays be handled using normal GPIO drivers, and not with such
platform specific constructs.

Alban
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MIPS: Remove most of the custom gpio.h

2015-07-22 Thread Manuel Lauss
On Wed, Jul 22, 2015 at 7:33 PM, Alban Bedel  wrote:
> Currently CONFIG_ARCH_HAVE_CUSTOM_GPIO_H is defined for all MIPS
> machines, and each machine type provides its own gpio.h. However only
> the Alchemy machine really use the feature, all other machines only
> use the default wrappers.
>
> For most machine types we can just remove the custom gpio.h, as well
> as the custom wrappers if some exists. A few more fixes are need in
> a few drivers as they rely on linux/gpio.h to provides some machine
> specific definitions, or used asm/gpio.h instead of linux/gpio.h for
> the gpio API.
>
> Signed-off-by: Alban Bedel 
> ---
>
> This patch is based on my previous serie:
> "MIPS: ath79: Move the GPIO driver to drivers/gpio".
>
> For testing I tried to build all mips defconfig, however my toolchain
> couldn't handle a few configs: ip28 malta_qemu_32r6 maltasmvp_eva
> sead3micro. If somebody can test these that would be more than welcome.
>
> It might well be that some more drivers for MIPS devices that are not
> enabled in the defconfig will break because of this change, so more
> testing would be nice :)
>
> Regarding Alchemy I'm not sure what to do. It use a little more
> complex setup, quoting arch/mips/include/asm/mach-au1x00/gpio.h:
>
> /* Linux gpio framework integration.
> *
> * 4 use cases of Alchemy GPIOS:
> *(1) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=y:
> *   Board must register gpiochips.
> *(2) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=n:
> *   A gpiochip for the 75 GPIOs is registered.
> *
> *(3) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=y:
> *   the boards' gpio.h must provide the linux gpio wrapper
> functions,
> *
> *(4) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=n:
> *   inlinable gpio functions are provided which enable access to the
> *   Au1300 gpios only by using the numbers straight out of the data-
> *   sheets.
>
> * Cases 1 and 3 are intended for boards which want to provide their own
> * GPIO namespace and -operations (i.e. for example you have 8 GPIOs
> * which are in part provided by spare Au1300 GPIO pins and in part by
> * an external FPGA but you still want them to be accssible in linux
> * as gpio0-7. The board can of course use the alchemy_gpioX_* functions
> * as required).
> */
>
> This sound to me like this is really not needed anymore. Is there any
> users of this left, or can it just go?

There are no in-tree users of this, but a few out-of-tree ones (all made by me)
Does it have to be removed?  Is it blocking anything?

Manuel
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] MIPS: Remove most of the custom gpio.h

2015-07-22 Thread Alban Bedel
Currently CONFIG_ARCH_HAVE_CUSTOM_GPIO_H is defined for all MIPS
machines, and each machine type provides its own gpio.h. However only
the Alchemy machine really use the feature, all other machines only
use the default wrappers.

For most machine types we can just remove the custom gpio.h, as well
as the custom wrappers if some exists. A few more fixes are need in
a few drivers as they rely on linux/gpio.h to provides some machine
specific definitions, or used asm/gpio.h instead of linux/gpio.h for
the gpio API.

Signed-off-by: Alban Bedel 
---

This patch is based on my previous serie:
"MIPS: ath79: Move the GPIO driver to drivers/gpio".

For testing I tried to build all mips defconfig, however my toolchain
couldn't handle a few configs: ip28 malta_qemu_32r6 maltasmvp_eva
sead3micro. If somebody can test these that would be more than welcome.

It might well be that some more drivers for MIPS devices that are not
enabled in the defconfig will break because of this change, so more
testing would be nice :)

Regarding Alchemy I'm not sure what to do. It use a little more
complex setup, quoting arch/mips/include/asm/mach-au1x00/gpio.h:

/* Linux gpio framework integration.
*
* 4 use cases of Alchemy GPIOS:
*(1) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=y:
*   Board must register gpiochips.
*(2) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=n:
*   A gpiochip for the 75 GPIOs is registered.
*
*(3) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=y:
*   the boards' gpio.h must provide the linux gpio wrapper
functions,
*
*(4) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=n:
*   inlinable gpio functions are provided which enable access to the
*   Au1300 gpios only by using the numbers straight out of the data-
*   sheets.

* Cases 1 and 3 are intended for boards which want to provide their own
* GPIO namespace and -operations (i.e. for example you have 8 GPIOs
* which are in part provided by spare Au1300 GPIO pins and in part by
* an external FPGA but you still want them to be accssible in linux
* as gpio0-7. The board can of course use the alchemy_gpioX_* functions
* as required).
*/

This sound to me like this is really not needed anymore. Is there any
users of this left, or can it just go?

Alban
---
 arch/mips/Kconfig   |  2 +-
 arch/mips/ar7/gpio.c| 12 ++--
 arch/mips/ar7/platform.c|  1 -
 arch/mips/ar7/setup.c   |  1 -
 arch/mips/include/asm/mach-ar7/ar7.h|  4 +++
 arch/mips/include/asm/mach-ar7/gpio.h   | 41 -
 arch/mips/include/asm/mach-ath25/gpio.h | 16 --
 arch/mips/include/asm/mach-ath79/gpio.h | 26 
 arch/mips/include/asm/mach-bcm47xx/gpio.h   | 17 --
 arch/mips/include/asm/mach-bcm63xx/gpio.h   | 15 -
 arch/mips/include/asm/mach-cavium-octeon/gpio.h | 21 -
 arch/mips/include/asm/mach-generic/gpio.h   | 21 -
 arch/mips/include/asm/mach-jz4740/gpio.h|  2 --
 arch/mips/include/asm/mach-lantiq/gpio.h| 13 
 arch/mips/include/asm/mach-loongson64/gpio.h| 36 --
 arch/mips/include/asm/mach-pistachio/gpio.h | 21 -
 arch/mips/include/asm/mach-rc32434/gpio.h   | 12 
 arch/mips/jz4740/gpio.c | 12 
 arch/mips/rb532/devices.c   |  1 +
 arch/mips/txx9/generic/setup.c  | 16 --
 drivers/ata/pata_rb532_cf.c |  3 +-
 drivers/gpio/gpio-ath79.c   | 32 ---
 drivers/input/misc/rb532_button.c   |  1 +
 drivers/net/ethernet/ti/cpmac.c |  2 ++
 24 files changed, 13 insertions(+), 315 deletions(-)
 delete mode 100644 arch/mips/include/asm/mach-ar7/gpio.h
 delete mode 100644 arch/mips/include/asm/mach-ath25/gpio.h
 delete mode 100644 arch/mips/include/asm/mach-ath79/gpio.h
 delete mode 100644 arch/mips/include/asm/mach-bcm47xx/gpio.h
 delete mode 100644 arch/mips/include/asm/mach-bcm63xx/gpio.h
 delete mode 100644 arch/mips/include/asm/mach-cavium-octeon/gpio.h
 delete mode 100644 arch/mips/include/asm/mach-generic/gpio.h
 delete mode 100644 arch/mips/include/asm/mach-lantiq/gpio.h
 delete mode 100644 arch/mips/include/asm/mach-loongson64/gpio.h
 delete mode 100644 arch/mips/include/asm/mach-pistachio/gpio.h

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index d896ffb..c3b2f38 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -13,7 +13,6 @@ config MIPS
select HAVE_ARCH_SECCOMP_FILTER
select HAVE_ARCH_TRACEHOOK
select HAVE_BPF_JIT if !CPU_MICROMIPS
-   select ARCH_HAVE_CUSTOM_GPIO_H
select HAVE_FUNCTION_TRACER
select HAVE_DYNAMIC_FTRACE
select HAVE_FTRACE_MCOUNT_RECORD
@@ -77,6 +76,7 @@ config MIPS_ALCHEMY
select SYS_SUPPORTS_32BIT_KERNEL
select SYS_SUPPORTS_APM_EMULATION
select ARCH_REQUIRE_GPIOLIB