Re: [PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-23 Thread Linus Walleij
On Mon, Sep 23, 2013 at 10:17 AM, Sonic Zhang  wrote:
> On Mon, Sep 23, 2013 at 3:48 PM, Linus Walleij  
> wrote:

>> Hi Sonic, I tried to apply this but it doesn't apply cleanly on
>> my pinctrl "devel" branch based off v3.12-rc1.
>>
>> Can you rebase patch 2+3 and resend?
>
> The patch 2 is already in your "devel" branch of kernel v3.12-rc1.
> Please apply patch 3 only.

Yes sorry I was confusing myself by missing to check my own trees,
what a mess. Applied #3 now.

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


Re: [PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-23 Thread Sonic Zhang
Hi Linus,

On Mon, Sep 23, 2013 at 3:48 PM, Linus Walleij  wrote:
> On Tue, Sep 3, 2013 at 10:29 AM, Sonic Zhang  wrote:
>
>> From: Sonic Zhang 
>>
>> - Remove non gpio lib code from blackfin architecture.
>> - Limit the lagecy blackfin gpio driver to bf5xx processors only.
>> - Remove unused definition of the pint power functions.
>>
>> Signed-off-by: Sonic Zhang 
>> Acked-by: Linus Walleij 
>
> Hi Sonic, I tried to apply this but it doesn't apply cleanly on
> my pinctrl "devel" branch based off v3.12-rc1.
>
> Can you rebase patch 2+3 and resend?

The patch 2 is already in your "devel" branch of kernel v3.12-rc1.
Please apply patch 3 only.

Thanks

Sonic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-23 Thread Linus Walleij
On Tue, Sep 3, 2013 at 10:29 AM, Sonic Zhang  wrote:

> From: Sonic Zhang 
>
> - Remove non gpio lib code from blackfin architecture.
> - Limit the lagecy blackfin gpio driver to bf5xx processors only.
> - Remove unused definition of the pint power functions.
>
> Signed-off-by: Sonic Zhang 
> Acked-by: Linus Walleij 

Hi Sonic, I tried to apply this but it doesn't apply cleanly on
my pinctrl "devel" branch based off v3.12-rc1.

Can you rebase patch 2+3 and resend?

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


Re: [PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-23 Thread Linus Walleij
On Tue, Sep 3, 2013 at 10:29 AM, Sonic Zhang sonic@gmail.com wrote:

 From: Sonic Zhang sonic.zh...@analog.com

 - Remove non gpio lib code from blackfin architecture.
 - Limit the lagecy blackfin gpio driver to bf5xx processors only.
 - Remove unused definition of the pint power functions.

 Signed-off-by: Sonic Zhang sonic.zh...@analog.com
 Acked-by: Linus Walleij linus.wall...@linaro.org

Hi Sonic, I tried to apply this but it doesn't apply cleanly on
my pinctrl devel branch based off v3.12-rc1.

Can you rebase patch 2+3 and resend?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-23 Thread Sonic Zhang
Hi Linus,

On Mon, Sep 23, 2013 at 3:48 PM, Linus Walleij linus.wall...@linaro.org wrote:
 On Tue, Sep 3, 2013 at 10:29 AM, Sonic Zhang sonic@gmail.com wrote:

 From: Sonic Zhang sonic.zh...@analog.com

 - Remove non gpio lib code from blackfin architecture.
 - Limit the lagecy blackfin gpio driver to bf5xx processors only.
 - Remove unused definition of the pint power functions.

 Signed-off-by: Sonic Zhang sonic.zh...@analog.com
 Acked-by: Linus Walleij linus.wall...@linaro.org

 Hi Sonic, I tried to apply this but it doesn't apply cleanly on
 my pinctrl devel branch based off v3.12-rc1.

 Can you rebase patch 2+3 and resend?

The patch 2 is already in your devel branch of kernel v3.12-rc1.
Please apply patch 3 only.

Thanks

Sonic
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-23 Thread Linus Walleij
On Mon, Sep 23, 2013 at 10:17 AM, Sonic Zhang sonic@gmail.com wrote:
 On Mon, Sep 23, 2013 at 3:48 PM, Linus Walleij linus.wall...@linaro.org 
 wrote:

 Hi Sonic, I tried to apply this but it doesn't apply cleanly on
 my pinctrl devel branch based off v3.12-rc1.

 Can you rebase patch 2+3 and resend?

 The patch 2 is already in your devel branch of kernel v3.12-rc1.
 Please apply patch 3 only.

Yes sorry I was confusing myself by missing to check my own trees,
what a mess. Applied #3 now.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-22 Thread Steven Miao
Acked-by: Steven Miao 

On Tue, Sep 3, 2013 at 4:29 PM, Sonic Zhang  wrote:
> From: Sonic Zhang 
>
> - Remove non gpio lib code from blackfin architecture.
> - Limit the lagecy blackfin gpio driver to bf5xx processors only.
> - Remove unused definition of the pint power functions.
>
> Signed-off-by: Sonic Zhang 
> Acked-by: Linus Walleij 
> ---
>  arch/blackfin/Kconfig|   7 ++
>  arch/blackfin/include/asm/gpio.h | 157 
> +--
>  arch/blackfin/kernel/Makefile|   3 +-
>  3 files changed, 29 insertions(+), 138 deletions(-)
>
> diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
> index a117652..9eff25b 100644
> --- a/arch/blackfin/Kconfig
> +++ b/arch/blackfin/Kconfig
> @@ -52,6 +52,9 @@ config GENERIC_BUG
>  config ZONE_DMA
> def_bool y
>
> +config GENERIC_GPIO
> +   def_bool y
> +
>  config FORCE_MAX_ZONEORDER
> int
> default "14"
> @@ -317,6 +320,10 @@ config BF53x
> depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537)
> default y
>
> +config GPIO_ADI
> +   def_bool y
> +   depends on (BF51x || BF52x || BF53x || BF538 || BF539 || BF561)
> +
>  config MEM_MT48LC64M4A2FB_7E
> bool
> depends on (BFIN533_STAMP)
> diff --git a/arch/blackfin/include/asm/gpio.h 
> b/arch/blackfin/include/asm/gpio.h
> index 98d0133..99d338c 100644
> --- a/arch/blackfin/include/asm/gpio.h
> +++ b/arch/blackfin/include/asm/gpio.h
> @@ -25,8 +25,12 @@
>
>  #ifndef __ASSEMBLY__
>
> +#ifndef CONFIG_PINCTRL
> +
>  #include 
> -#include 
> +#include 
> +#include 
> +#include 
>
>  /***
>  *
> @@ -45,7 +49,6 @@
>  * MODIFICATION HISTORY :
>  **/
>
> -#if !BFIN_GPIO_PINT
>  void set_gpio_dir(unsigned, unsigned short);
>  void set_gpio_inen(unsigned, unsigned short);
>  void set_gpio_polar(unsigned, unsigned short);
> @@ -115,7 +118,6 @@ struct gpio_port_t {
> unsigned short dummy16;
> unsigned short inen;
>  };
> -#endif
>
>  #ifdef BFIN_SPECIAL_GPIO_BANKS
>  void bfin_special_gpio_free(unsigned gpio);
> @@ -127,25 +129,21 @@ void bfin_special_gpio_pm_hibernate_suspend(void);
>  #endif
>
>  #ifdef CONFIG_PM
> -int bfin_pm_standby_ctrl(unsigned ctrl);
> +void bfin_gpio_pm_hibernate_restore(void);
> +void bfin_gpio_pm_hibernate_suspend(void);
> +int bfin_gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
> +int bfin_gpio_pm_standby_ctrl(unsigned ctrl);
>
>  static inline int bfin_pm_standby_setup(void)
>  {
> -   return bfin_pm_standby_ctrl(1);
> +   return bfin_gpio_pm_standby_ctrl(1);
>  }
>
>  static inline void bfin_pm_standby_restore(void)
>  {
> -   bfin_pm_standby_ctrl(0);
> +   bfin_gpio_pm_standby_ctrl(0);
>  }
>
> -void bfin_gpio_pm_hibernate_restore(void);
> -void bfin_gpio_pm_hibernate_suspend(void);
> -void bfin_pint_suspend(void);
> -void bfin_pint_resume(void);
> -
> -# if !BFIN_GPIO_PINT
> -int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
>
>  struct gpio_port_s {
> unsigned short data;
> @@ -161,7 +159,6 @@ struct gpio_port_s {
> unsigned short reserved;
> unsigned short mux;
>  };
> -# endif
>  #endif /*CONFIG_PM*/
>
>  /***
> @@ -178,36 +175,29 @@ struct gpio_port_s {
>  *
>  * MODIFICATION HISTORY :
>  **/
> -
> -int bfin_gpio_request(unsigned gpio, const char *label);
> -void bfin_gpio_free(unsigned gpio);
>  int bfin_gpio_irq_request(unsigned gpio, const char *label);
>  void bfin_gpio_irq_free(unsigned gpio);
> -int bfin_gpio_direction_input(unsigned gpio);
> -int bfin_gpio_direction_output(unsigned gpio, int value);
> -int bfin_gpio_get_value(unsigned gpio);
> -void bfin_gpio_set_value(unsigned gpio, int value);
> +void bfin_gpio_irq_prepare(unsigned gpio);
> +
> +static inline int irq_to_gpio(unsigned irq)
> +{
> +   return irq - GPIO_IRQ_BASE;
> +}
> +#endif /* CONFIG_PINCTRL */
>
>  #include 
>  #include 
>
> -#ifdef CONFIG_GPIOLIB
>  #include   /* cansleep wrappers */
>
>  static inline int gpio_get_value(unsigned int gpio)
>  {
> -   if (gpio < MAX_BLACKFIN_GPIOS)
> -   return bfin_gpio_get_value(gpio);
> -   else
> -   return __gpio_get_value(gpio);
> +   return __gpio_get_value(gpio);
>  }
>
>  static inline void gpio_set_value(unsigned int gpio, int value)
>  {
> -   if (gpio < MAX_BLACKFIN_GPIOS)
> -   bfin_gpio_set_value(gpio, value);
> -   else
> -   __gpio_set_value(gpio, value);
> +   __gpio_set_value(gpio, value);
>  }
>
>  static inline int gpio_cansleep(unsigned int gpio)
> @@ -219,113 +209,6 @@ static inline int gpio_to_irq(unsigned gpio)
>  {
> return __gpio_to_irq(gpio);
>  }
> -
> -#else /* !CONFIG_GPIOLIB */
> -
> -static 

Re: [PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-22 Thread Steven Miao
Acked-by: Steven Miao real...@gmail.com

On Tue, Sep 3, 2013 at 4:29 PM, Sonic Zhang sonic@gmail.com wrote:
 From: Sonic Zhang sonic.zh...@analog.com

 - Remove non gpio lib code from blackfin architecture.
 - Limit the lagecy blackfin gpio driver to bf5xx processors only.
 - Remove unused definition of the pint power functions.

 Signed-off-by: Sonic Zhang sonic.zh...@analog.com
 Acked-by: Linus Walleij linus.wall...@linaro.org
 ---
  arch/blackfin/Kconfig|   7 ++
  arch/blackfin/include/asm/gpio.h | 157 
 +--
  arch/blackfin/kernel/Makefile|   3 +-
  3 files changed, 29 insertions(+), 138 deletions(-)

 diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
 index a117652..9eff25b 100644
 --- a/arch/blackfin/Kconfig
 +++ b/arch/blackfin/Kconfig
 @@ -52,6 +52,9 @@ config GENERIC_BUG
  config ZONE_DMA
 def_bool y

 +config GENERIC_GPIO
 +   def_bool y
 +
  config FORCE_MAX_ZONEORDER
 int
 default 14
 @@ -317,6 +320,10 @@ config BF53x
 depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537)
 default y

 +config GPIO_ADI
 +   def_bool y
 +   depends on (BF51x || BF52x || BF53x || BF538 || BF539 || BF561)
 +
  config MEM_MT48LC64M4A2FB_7E
 bool
 depends on (BFIN533_STAMP)
 diff --git a/arch/blackfin/include/asm/gpio.h 
 b/arch/blackfin/include/asm/gpio.h
 index 98d0133..99d338c 100644
 --- a/arch/blackfin/include/asm/gpio.h
 +++ b/arch/blackfin/include/asm/gpio.h
 @@ -25,8 +25,12 @@

  #ifndef __ASSEMBLY__

 +#ifndef CONFIG_PINCTRL
 +
  #include linux/compiler.h
 -#include linux/gpio.h
 +#include asm/blackfin.h
 +#include asm/portmux.h
 +#include asm/irq_handler.h

  /***
  *
 @@ -45,7 +49,6 @@
  * MODIFICATION HISTORY :
  **/

 -#if !BFIN_GPIO_PINT
  void set_gpio_dir(unsigned, unsigned short);
  void set_gpio_inen(unsigned, unsigned short);
  void set_gpio_polar(unsigned, unsigned short);
 @@ -115,7 +118,6 @@ struct gpio_port_t {
 unsigned short dummy16;
 unsigned short inen;
  };
 -#endif

  #ifdef BFIN_SPECIAL_GPIO_BANKS
  void bfin_special_gpio_free(unsigned gpio);
 @@ -127,25 +129,21 @@ void bfin_special_gpio_pm_hibernate_suspend(void);
  #endif

  #ifdef CONFIG_PM
 -int bfin_pm_standby_ctrl(unsigned ctrl);
 +void bfin_gpio_pm_hibernate_restore(void);
 +void bfin_gpio_pm_hibernate_suspend(void);
 +int bfin_gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
 +int bfin_gpio_pm_standby_ctrl(unsigned ctrl);

  static inline int bfin_pm_standby_setup(void)
  {
 -   return bfin_pm_standby_ctrl(1);
 +   return bfin_gpio_pm_standby_ctrl(1);
  }

  static inline void bfin_pm_standby_restore(void)
  {
 -   bfin_pm_standby_ctrl(0);
 +   bfin_gpio_pm_standby_ctrl(0);
  }

 -void bfin_gpio_pm_hibernate_restore(void);
 -void bfin_gpio_pm_hibernate_suspend(void);
 -void bfin_pint_suspend(void);
 -void bfin_pint_resume(void);
 -
 -# if !BFIN_GPIO_PINT
 -int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);

  struct gpio_port_s {
 unsigned short data;
 @@ -161,7 +159,6 @@ struct gpio_port_s {
 unsigned short reserved;
 unsigned short mux;
  };
 -# endif
  #endif /*CONFIG_PM*/

  /***
 @@ -178,36 +175,29 @@ struct gpio_port_s {
  *
  * MODIFICATION HISTORY :
  **/
 -
 -int bfin_gpio_request(unsigned gpio, const char *label);
 -void bfin_gpio_free(unsigned gpio);
  int bfin_gpio_irq_request(unsigned gpio, const char *label);
  void bfin_gpio_irq_free(unsigned gpio);
 -int bfin_gpio_direction_input(unsigned gpio);
 -int bfin_gpio_direction_output(unsigned gpio, int value);
 -int bfin_gpio_get_value(unsigned gpio);
 -void bfin_gpio_set_value(unsigned gpio, int value);
 +void bfin_gpio_irq_prepare(unsigned gpio);
 +
 +static inline int irq_to_gpio(unsigned irq)
 +{
 +   return irq - GPIO_IRQ_BASE;
 +}
 +#endif /* CONFIG_PINCTRL */

  #include asm/irq.h
  #include asm/errno.h

 -#ifdef CONFIG_GPIOLIB
  #include asm-generic/gpio.h  /* cansleep wrappers */

  static inline int gpio_get_value(unsigned int gpio)
  {
 -   if (gpio  MAX_BLACKFIN_GPIOS)
 -   return bfin_gpio_get_value(gpio);
 -   else
 -   return __gpio_get_value(gpio);
 +   return __gpio_get_value(gpio);
  }

  static inline void gpio_set_value(unsigned int gpio, int value)
  {
 -   if (gpio  MAX_BLACKFIN_GPIOS)
 -   bfin_gpio_set_value(gpio, value);
 -   else
 -   __gpio_set_value(gpio, value);
 +   __gpio_set_value(gpio, value);
  }

  static inline int gpio_cansleep(unsigned int gpio)
 @@ -219,113 +209,6 @@ static inline int gpio_to_irq(unsigned gpio)
  {
 return __gpio_to_irq(gpio);
  }
 -
 

[PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-03 Thread Sonic Zhang
From: Sonic Zhang 

- Remove non gpio lib code from blackfin architecture.
- Limit the lagecy blackfin gpio driver to bf5xx processors only.
- Remove unused definition of the pint power functions.

Signed-off-by: Sonic Zhang 
Acked-by: Linus Walleij 
---
 arch/blackfin/Kconfig|   7 ++
 arch/blackfin/include/asm/gpio.h | 157 +--
 arch/blackfin/kernel/Makefile|   3 +-
 3 files changed, 29 insertions(+), 138 deletions(-)

diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index a117652..9eff25b 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -52,6 +52,9 @@ config GENERIC_BUG
 config ZONE_DMA
def_bool y
 
+config GENERIC_GPIO
+   def_bool y
+
 config FORCE_MAX_ZONEORDER
int
default "14"
@@ -317,6 +320,10 @@ config BF53x
depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537)
default y
 
+config GPIO_ADI
+   def_bool y
+   depends on (BF51x || BF52x || BF53x || BF538 || BF539 || BF561)
+
 config MEM_MT48LC64M4A2FB_7E
bool
depends on (BFIN533_STAMP)
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 98d0133..99d338c 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -25,8 +25,12 @@
 
 #ifndef __ASSEMBLY__
 
+#ifndef CONFIG_PINCTRL
+
 #include 
-#include 
+#include 
+#include 
+#include 
 
 /***
 *
@@ -45,7 +49,6 @@
 * MODIFICATION HISTORY :
 **/
 
-#if !BFIN_GPIO_PINT
 void set_gpio_dir(unsigned, unsigned short);
 void set_gpio_inen(unsigned, unsigned short);
 void set_gpio_polar(unsigned, unsigned short);
@@ -115,7 +118,6 @@ struct gpio_port_t {
unsigned short dummy16;
unsigned short inen;
 };
-#endif
 
 #ifdef BFIN_SPECIAL_GPIO_BANKS
 void bfin_special_gpio_free(unsigned gpio);
@@ -127,25 +129,21 @@ void bfin_special_gpio_pm_hibernate_suspend(void);
 #endif
 
 #ifdef CONFIG_PM
-int bfin_pm_standby_ctrl(unsigned ctrl);
+void bfin_gpio_pm_hibernate_restore(void);
+void bfin_gpio_pm_hibernate_suspend(void);
+int bfin_gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
+int bfin_gpio_pm_standby_ctrl(unsigned ctrl);
 
 static inline int bfin_pm_standby_setup(void)
 {
-   return bfin_pm_standby_ctrl(1);
+   return bfin_gpio_pm_standby_ctrl(1);
 }
 
 static inline void bfin_pm_standby_restore(void)
 {
-   bfin_pm_standby_ctrl(0);
+   bfin_gpio_pm_standby_ctrl(0);
 }
 
-void bfin_gpio_pm_hibernate_restore(void);
-void bfin_gpio_pm_hibernate_suspend(void);
-void bfin_pint_suspend(void);
-void bfin_pint_resume(void);
-
-# if !BFIN_GPIO_PINT
-int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
 
 struct gpio_port_s {
unsigned short data;
@@ -161,7 +159,6 @@ struct gpio_port_s {
unsigned short reserved;
unsigned short mux;
 };
-# endif
 #endif /*CONFIG_PM*/
 
 /***
@@ -178,36 +175,29 @@ struct gpio_port_s {
 *
 * MODIFICATION HISTORY :
 **/
-
-int bfin_gpio_request(unsigned gpio, const char *label);
-void bfin_gpio_free(unsigned gpio);
 int bfin_gpio_irq_request(unsigned gpio, const char *label);
 void bfin_gpio_irq_free(unsigned gpio);
-int bfin_gpio_direction_input(unsigned gpio);
-int bfin_gpio_direction_output(unsigned gpio, int value);
-int bfin_gpio_get_value(unsigned gpio);
-void bfin_gpio_set_value(unsigned gpio, int value);
+void bfin_gpio_irq_prepare(unsigned gpio);
+
+static inline int irq_to_gpio(unsigned irq)
+{
+   return irq - GPIO_IRQ_BASE;
+}
+#endif /* CONFIG_PINCTRL */
 
 #include 
 #include 
 
-#ifdef CONFIG_GPIOLIB
 #include   /* cansleep wrappers */
 
 static inline int gpio_get_value(unsigned int gpio)
 {
-   if (gpio < MAX_BLACKFIN_GPIOS)
-   return bfin_gpio_get_value(gpio);
-   else
-   return __gpio_get_value(gpio);
+   return __gpio_get_value(gpio);
 }
 
 static inline void gpio_set_value(unsigned int gpio, int value)
 {
-   if (gpio < MAX_BLACKFIN_GPIOS)
-   bfin_gpio_set_value(gpio, value);
-   else
-   __gpio_set_value(gpio, value);
+   __gpio_set_value(gpio, value);
 }
 
 static inline int gpio_cansleep(unsigned int gpio)
@@ -219,113 +209,6 @@ 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)
-{
-   return bfin_gpio_request(gpio, label);
-}
-
-static inline void gpio_free(unsigned gpio)
-{
-   return bfin_gpio_free(gpio);
-}
-
-static inline int gpio_direction_input(unsigned gpio)
-{
-   return bfin_gpio_direction_input(gpio);
-}
-
-static inline int gpio_direction_output(unsigned gpio, int 

[PATCH 2/3 v4] blackfin: gpio: Remove none gpio lib code.

2013-09-03 Thread Sonic Zhang
From: Sonic Zhang sonic.zh...@analog.com

- Remove non gpio lib code from blackfin architecture.
- Limit the lagecy blackfin gpio driver to bf5xx processors only.
- Remove unused definition of the pint power functions.

Signed-off-by: Sonic Zhang sonic.zh...@analog.com
Acked-by: Linus Walleij linus.wall...@linaro.org
---
 arch/blackfin/Kconfig|   7 ++
 arch/blackfin/include/asm/gpio.h | 157 +--
 arch/blackfin/kernel/Makefile|   3 +-
 3 files changed, 29 insertions(+), 138 deletions(-)

diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index a117652..9eff25b 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -52,6 +52,9 @@ config GENERIC_BUG
 config ZONE_DMA
def_bool y
 
+config GENERIC_GPIO
+   def_bool y
+
 config FORCE_MAX_ZONEORDER
int
default 14
@@ -317,6 +320,10 @@ config BF53x
depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537)
default y
 
+config GPIO_ADI
+   def_bool y
+   depends on (BF51x || BF52x || BF53x || BF538 || BF539 || BF561)
+
 config MEM_MT48LC64M4A2FB_7E
bool
depends on (BFIN533_STAMP)
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h
index 98d0133..99d338c 100644
--- a/arch/blackfin/include/asm/gpio.h
+++ b/arch/blackfin/include/asm/gpio.h
@@ -25,8 +25,12 @@
 
 #ifndef __ASSEMBLY__
 
+#ifndef CONFIG_PINCTRL
+
 #include linux/compiler.h
-#include linux/gpio.h
+#include asm/blackfin.h
+#include asm/portmux.h
+#include asm/irq_handler.h
 
 /***
 *
@@ -45,7 +49,6 @@
 * MODIFICATION HISTORY :
 **/
 
-#if !BFIN_GPIO_PINT
 void set_gpio_dir(unsigned, unsigned short);
 void set_gpio_inen(unsigned, unsigned short);
 void set_gpio_polar(unsigned, unsigned short);
@@ -115,7 +118,6 @@ struct gpio_port_t {
unsigned short dummy16;
unsigned short inen;
 };
-#endif
 
 #ifdef BFIN_SPECIAL_GPIO_BANKS
 void bfin_special_gpio_free(unsigned gpio);
@@ -127,25 +129,21 @@ void bfin_special_gpio_pm_hibernate_suspend(void);
 #endif
 
 #ifdef CONFIG_PM
-int bfin_pm_standby_ctrl(unsigned ctrl);
+void bfin_gpio_pm_hibernate_restore(void);
+void bfin_gpio_pm_hibernate_suspend(void);
+int bfin_gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
+int bfin_gpio_pm_standby_ctrl(unsigned ctrl);
 
 static inline int bfin_pm_standby_setup(void)
 {
-   return bfin_pm_standby_ctrl(1);
+   return bfin_gpio_pm_standby_ctrl(1);
 }
 
 static inline void bfin_pm_standby_restore(void)
 {
-   bfin_pm_standby_ctrl(0);
+   bfin_gpio_pm_standby_ctrl(0);
 }
 
-void bfin_gpio_pm_hibernate_restore(void);
-void bfin_gpio_pm_hibernate_suspend(void);
-void bfin_pint_suspend(void);
-void bfin_pint_resume(void);
-
-# if !BFIN_GPIO_PINT
-int gpio_pm_wakeup_ctrl(unsigned gpio, unsigned ctrl);
 
 struct gpio_port_s {
unsigned short data;
@@ -161,7 +159,6 @@ struct gpio_port_s {
unsigned short reserved;
unsigned short mux;
 };
-# endif
 #endif /*CONFIG_PM*/
 
 /***
@@ -178,36 +175,29 @@ struct gpio_port_s {
 *
 * MODIFICATION HISTORY :
 **/
-
-int bfin_gpio_request(unsigned gpio, const char *label);
-void bfin_gpio_free(unsigned gpio);
 int bfin_gpio_irq_request(unsigned gpio, const char *label);
 void bfin_gpio_irq_free(unsigned gpio);
-int bfin_gpio_direction_input(unsigned gpio);
-int bfin_gpio_direction_output(unsigned gpio, int value);
-int bfin_gpio_get_value(unsigned gpio);
-void bfin_gpio_set_value(unsigned gpio, int value);
+void bfin_gpio_irq_prepare(unsigned gpio);
+
+static inline int irq_to_gpio(unsigned irq)
+{
+   return irq - GPIO_IRQ_BASE;
+}
+#endif /* CONFIG_PINCTRL */
 
 #include asm/irq.h
 #include asm/errno.h
 
-#ifdef CONFIG_GPIOLIB
 #include asm-generic/gpio.h  /* cansleep wrappers */
 
 static inline int gpio_get_value(unsigned int gpio)
 {
-   if (gpio  MAX_BLACKFIN_GPIOS)
-   return bfin_gpio_get_value(gpio);
-   else
-   return __gpio_get_value(gpio);
+   return __gpio_get_value(gpio);
 }
 
 static inline void gpio_set_value(unsigned int gpio, int value)
 {
-   if (gpio  MAX_BLACKFIN_GPIOS)
-   bfin_gpio_set_value(gpio, value);
-   else
-   __gpio_set_value(gpio, value);
+   __gpio_set_value(gpio, value);
 }
 
 static inline int gpio_cansleep(unsigned int gpio)
@@ -219,113 +209,6 @@ 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)
-{
-   return bfin_gpio_request(gpio, label);
-}
-
-static inline void gpio_free(unsigned gpio)
-{
-   return bfin_gpio_free(gpio);
-}
-