All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: BCM47XX: fix compile error in wgt634u.c
@ 2012-12-12  1:10 Hauke Mehrtens
  2012-12-12  9:13 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Hauke Mehrtens @ 2012-12-12  1:10 UTC (permalink / raw)
  To: john, ralf; +Cc: linux-mips, Hauke Mehrtens

After the new GPIO handling for the bcm47xx target was introduced
wgt634u.c was not changed.
This patch fixes the following compile error:

arch/mips/bcm47xx/wgt634u.c: In function ‘gpio_interrupt’:
arch/mips/bcm47xx/wgt634u.c:119:2: error: implicit declaration of function ‘gpio_polarity’ [-Werror=implicit-function-declaration]
arch/mips/bcm47xx/wgt634u.c: In function ‘wgt634u_init’:
arch/mips/bcm47xx/wgt634u.c:153:4: error: implicit declaration of function ‘gpio_intmask’ [-Werror=implicit-function-declaration]

Reported-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 arch/mips/bcm47xx/wgt634u.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

I am planing to remove this entire file, but I haven't come up with 
code adding support for most of the boards found in the wild.

diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index e9f9ec8..6c28f6d 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -11,6 +11,7 @@
 #include <linux/leds.h>
 #include <linux/mtd/physmap.h>
 #include <linux/ssb/ssb.h>
+#include <linux/ssb/ssb_embedded.h>
 #include <linux/interrupt.h>
 #include <linux/reboot.h>
 #include <linux/gpio.h>
@@ -116,7 +117,8 @@ static irqreturn_t gpio_interrupt(int irq, void *ignored)
 
 	/* Interrupt are level triggered, revert the interrupt polarity
 	   to clear the interrupt. */
-	gpio_polarity(WGT634U_GPIO_RESET, state);
+	ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << WGT634U_GPIO_RESET,
+			  state ? 1 << WGT634U_GPIO_RESET : 0);
 
 	if (!state) {
 		printk(KERN_INFO "Reset button pressed");
@@ -150,7 +152,9 @@ static int __init wgt634u_init(void)
 				 gpio_interrupt, IRQF_SHARED,
 				 "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
 			gpio_direction_input(WGT634U_GPIO_RESET);
-			gpio_intmask(WGT634U_GPIO_RESET, 1);
+			ssb_gpio_intmask(&bcm47xx_bus.ssb,
+					 1 << WGT634U_GPIO_RESET,
+					 1 << WGT634U_GPIO_RESET);
 			ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
 					    SSB_CHIPCO_IRQ_GPIO,
 					    SSB_CHIPCO_IRQ_GPIO);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: BCM47XX: fix compile error in wgt634u.c
  2012-12-12  1:10 [PATCH] MIPS: BCM47XX: fix compile error in wgt634u.c Hauke Mehrtens
@ 2012-12-12  9:13 ` Florian Fainelli
  2012-12-12 14:46   ` Hauke Mehrtens
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2012-12-12  9:13 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: john, ralf, linux-mips

Hello Hauke,

Le 12/12/12 02:10, Hauke Mehrtens a écrit :
> After the new GPIO handling for the bcm47xx target was introduced
> wgt634u.c was not changed.
> This patch fixes the following compile error:
>
> arch/mips/bcm47xx/wgt634u.c: In function ‘gpio_interrupt’:
> arch/mips/bcm47xx/wgt634u.c:119:2: error: implicit declaration of function ‘gpio_polarity’ [-Werror=implicit-function-declaration]
> arch/mips/bcm47xx/wgt634u.c: In function ‘wgt634u_init’:
> arch/mips/bcm47xx/wgt634u.c:153:4: error: implicit declaration of function ‘gpio_intmask’ [-Werror=implicit-function-declaration]

Thanks for fixing this. We should probably remove this wgt634u file some 
day or the other as it was an ad-hoc hack for this single device while 
we actually need a general solution for all BCM47xx boards out there.

>
> Reported-by: Ralf Baechle <ralf@linux-mips.org>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>   arch/mips/bcm47xx/wgt634u.c |    8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> I am planing to remove this entire file, but I haven't come up with
> code adding support for most of the boards found in the wild.
>
> diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
> index e9f9ec8..6c28f6d 100644
> --- a/arch/mips/bcm47xx/wgt634u.c
> +++ b/arch/mips/bcm47xx/wgt634u.c
> @@ -11,6 +11,7 @@
>   #include <linux/leds.h>
>   #include <linux/mtd/physmap.h>
>   #include <linux/ssb/ssb.h>
> +#include <linux/ssb/ssb_embedded.h>
>   #include <linux/interrupt.h>
>   #include <linux/reboot.h>
>   #include <linux/gpio.h>
> @@ -116,7 +117,8 @@ static irqreturn_t gpio_interrupt(int irq, void *ignored)
>
>   	/* Interrupt are level triggered, revert the interrupt polarity
>   	   to clear the interrupt. */
> -	gpio_polarity(WGT634U_GPIO_RESET, state);
> +	ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << WGT634U_GPIO_RESET,
> +			  state ? 1 << WGT634U_GPIO_RESET : 0);
>
>   	if (!state) {
>   		printk(KERN_INFO "Reset button pressed");
> @@ -150,7 +152,9 @@ static int __init wgt634u_init(void)
>   				 gpio_interrupt, IRQF_SHARED,
>   				 "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
>   			gpio_direction_input(WGT634U_GPIO_RESET);
> -			gpio_intmask(WGT634U_GPIO_RESET, 1);
> +			ssb_gpio_intmask(&bcm47xx_bus.ssb,
> +					 1 << WGT634U_GPIO_RESET,
> +					 1 << WGT634U_GPIO_RESET);
>   			ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
>   					    SSB_CHIPCO_IRQ_GPIO,
>   					    SSB_CHIPCO_IRQ_GPIO);
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: BCM47XX: fix compile error in wgt634u.c
  2012-12-12  9:13 ` Florian Fainelli
@ 2012-12-12 14:46   ` Hauke Mehrtens
  0 siblings, 0 replies; 3+ messages in thread
From: Hauke Mehrtens @ 2012-12-12 14:46 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: john, ralf, linux-mips

On 12/12/2012 10:13 AM, Florian Fainelli wrote:
> Hello Hauke,
> 
> Le 12/12/12 02:10, Hauke Mehrtens a écrit :
>> After the new GPIO handling for the bcm47xx target was introduced
>> wgt634u.c was not changed.
>> This patch fixes the following compile error:
>>
>> arch/mips/bcm47xx/wgt634u.c: In function ‘gpio_interrupt’:
>> arch/mips/bcm47xx/wgt634u.c:119:2: error: implicit declaration of
>> function ‘gpio_polarity’ [-Werror=implicit-function-declaration]
>> arch/mips/bcm47xx/wgt634u.c: In function ‘wgt634u_init’:
>> arch/mips/bcm47xx/wgt634u.c:153:4: error: implicit declaration of
>> function ‘gpio_intmask’ [-Werror=implicit-function-declaration]
> 
> Thanks for fixing this. We should probably remove this wgt634u file some
> day or the other as it was an ad-hoc hack for this single device while
> we actually need a general solution for all BCM47xx boards out there.
> 

Yes I also want to get rid of this file.

Currently OpenWrt uses its own detection and gpio/led/button configure
code [0], but this doe not look nice to me. I saw Jonas RFC patch for
device tree integration into bcm63xx [1] and thought about doing
something similar for bcm47xx. Initially device tree would be used for
mapping gpios to leds and buttons.

I haven't read much about DT, but it looks nice. Is it possible to
detect devices by some arbitrary nvram settings like it is done in diag.c?

Hauke

[0]: https://dev.openwrt.org/browser/trunk/package/broadcom-diag/src/diag.c
[1]: http://www.linux-mips.org/archives/linux-mips/2012-11/msg00092.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-12 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-12  1:10 [PATCH] MIPS: BCM47XX: fix compile error in wgt634u.c Hauke Mehrtens
2012-12-12  9:13 ` Florian Fainelli
2012-12-12 14:46   ` Hauke Mehrtens

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.