Skip to content

Commit 832f5da

Browse files
AlbanBedelralfbaechle
authored andcommitted
MIPS: Remove all the uses of custom gpio.h
Currently CONFIG_ARCH_HAVE_CUSTOM_GPIO_H is defined for all MIPS machines, and each machine type provides its own gpio.h. However only a handful really implement the GPIO API, most just forward everythings to gpiolib. The Alchemy machine is notable as it provides a system to allow implementing the GPIO API at the board level. But it is not used by any board currently supported, so it can also be removed. For most machine types we can just remove the custom gpio.h, as well as the custom wrappers if some exists. Some of the code found in the wrappers must be moved to the respective GPIO driver. A few more fixes are need in some 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 <albeu@free.fr> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Cc: linux-mips@linux-mips.org Cc: Hauke Mehrtens <hauke@hauke-m.de> Cc: Rafał Miłecki <zajec5@gmail.com> Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Tejun Heo <tj@kernel.org> Cc: Alexandre Courbot <gnurou@gmail.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Florian Fainelli <florian@openwrt.org> Cc: Manuel Lauss <manuel.lauss@gmail.com> Cc: Joe Perches <joe@perches.com> Cc: Daniel Walter <dwalter@google.com> Cc: Sergey Ryazanov <ryazanov.s.a@gmail.com> Cc: Huacai Chen <chenhc@lemote.com> Cc: James Hartley <james.hartley@imgtec.com> Cc: Andrew Bresticker <abrestic@chromium.org> Cc: Paul Burton <paul.burton@imgtec.com> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: Wolfram Sang <wsa@the-dreams.de> Cc: Randy Dunlap <rdunlap@infradead.org> Cc: Varka Bhadram <varkabhadram@gmail.com> Cc: Masanari Iida <standby24x7@gmail.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Michael Buesch <m@bues.ch> Cc: abdoulaye berthe <berthe.ab@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: linux-ide@vger.kernel.org Cc: linux-gpio@vger.kernel.org Cc: linux-input@vger.kernel.org Cc: netdev@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/10828/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 1d473c2 commit 832f5da

File tree

37 files changed

+45
-551
lines changed

37 files changed

+45
-551
lines changed

arch/mips/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ config MIPS
1414
select HAVE_ARCH_SECCOMP_FILTER
1515
select HAVE_ARCH_TRACEHOOK
1616
select HAVE_BPF_JIT if !CPU_MICROMIPS
17-
select ARCH_HAVE_CUSTOM_GPIO_H
1817
select HAVE_FUNCTION_TRACER
1918
select HAVE_DYNAMIC_FTRACE
2019
select HAVE_FTRACE_MCOUNT_RECORD

arch/mips/alchemy/Kconfig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,6 @@ config ALCHEMY_GPIOINT_AU1000
66
config ALCHEMY_GPIOINT_AU1300
77
bool
88

9-
# select this in your board config if you don't want to use the gpio
10-
# namespace as documented in the manuals. In this case however you need
11-
# to create the necessary gpio_* functions in your board code/headers!
12-
# see arch/mips/include/asm/mach-au1x00/gpio.h for more information.
13-
config ALCHEMY_GPIO_INDIRECT
14-
def_bool n
15-
169
choice
1710
prompt "Machine type"
1811
depends on MIPS_ALCHEMY

arch/mips/alchemy/board-gpr.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <asm/idle.h>
3535
#include <asm/reboot.h>
3636
#include <asm/mach-au1x00/au1000.h>
37+
#include <asm/mach-au1x00/gpio-au1000.h>
3738
#include <prom.h>
3839

3940
const char *get_system_type(void)

arch/mips/alchemy/board-mtx1.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <asm/bootinfo.h>
3333
#include <asm/reboot.h>
3434
#include <asm/mach-au1x00/au1000.h>
35+
#include <asm/mach-au1x00/gpio-au1000.h>
3536
#include <asm/mach-au1x00/au1xxx_eth.h>
3637
#include <prom.h>
3738

arch/mips/alchemy/common/Makefile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,5 @@
55
# Makefile for the Alchemy Au1xx0 CPUs, generic files.
66
#
77

8-
obj-y += prom.o time.o clock.o platform.o power.o \
8+
obj-y += prom.o time.o clock.o platform.o power.o gpiolib.o \
99
setup.o sleeper.o dma.o dbdma.o vss.o irq.o usb.o
10-
11-
# optional gpiolib support
12-
ifeq ($(CONFIG_ALCHEMY_GPIO_INDIRECT),)
13-
obj-$(CONFIG_GPIOLIB) += gpiolib.o
14-
endif

arch/mips/alchemy/devboards/db1000.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/spi/spi_gpio.h>
3434
#include <linux/spi/ads7846.h>
3535
#include <asm/mach-au1x00/au1000.h>
36+
#include <asm/mach-au1x00/gpio-au1000.h>
3637
#include <asm/mach-au1x00/au1000_dma.h>
3738
#include <asm/mach-au1x00/au1100_mmc.h>
3839
#include <asm/mach-db1x00/bcsr.h>

arch/mips/alchemy/devboards/db1300.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <linux/wm97xx.h>
2525

2626
#include <asm/mach-au1x00/au1000.h>
27+
#include <asm/mach-au1x00/gpio-au1300.h>
2728
#include <asm/mach-au1x00/au1100_mmc.h>
2829
#include <asm/mach-au1x00/au1200fb.h>
2930
#include <asm/mach-au1x00/au1xxx_dbdma.h>

arch/mips/alchemy/devboards/db1550.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/spi/flash.h>
2121
#include <asm/bootinfo.h>
2222
#include <asm/mach-au1x00/au1000.h>
23+
#include <asm/mach-au1x00/gpio-au1000.h>
2324
#include <asm/mach-au1x00/au1xxx_eth.h>
2425
#include <asm/mach-au1x00/au1xxx_dbdma.h>
2526
#include <asm/mach-au1x00/au1xxx_psc.h>

arch/mips/alchemy/devboards/pm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <linux/suspend.h>
1010
#include <linux/sysfs.h>
1111
#include <asm/mach-au1x00/au1000.h>
12-
#include <asm/mach-au1x00/gpio.h>
12+
#include <asm/mach-au1x00/gpio-au1000.h>
1313
#include <asm/mach-db1x00/bcsr.h>
1414

1515
/*

arch/mips/ar7/gpio.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
#include <linux/module.h>
2222
#include <linux/gpio.h>
2323

24-
#include <asm/mach-ar7/gpio.h>
24+
#include <asm/mach-ar7/ar7.h>
25+
26+
#define AR7_GPIO_MAX 32
27+
#define TITAN_GPIO_MAX 51
2528

2629
struct ar7_gpio_chip {
2730
void __iomem *regs;

arch/mips/ar7/platform.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939

4040
#include <asm/addrspace.h>
4141
#include <asm/mach-ar7/ar7.h>
42-
#include <asm/mach-ar7/gpio.h>
4342
#include <asm/mach-ar7/prom.h>
4443

4544
/*****************************************************************************

arch/mips/ar7/setup.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <asm/reboot.h>
2424
#include <asm/mach-ar7/ar7.h>
2525
#include <asm/mach-ar7/prom.h>
26-
#include <asm/mach-ar7/gpio.h>
2726

2827
static void ar7_machine_restart(char *command)
2928
{

arch/mips/include/asm/gpio.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

arch/mips/include/asm/mach-ar7/ar7.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,8 @@ static inline void ar7_device_off(u32 bit)
203203
int __init ar7_gpio_init(void);
204204
void __init ar7_init_clocks(void);
205205

206+
/* Board specific GPIO functions */
207+
int ar7_gpio_enable(unsigned gpio);
208+
int ar7_gpio_disable(unsigned gpio);
209+
206210
#endif /* __AR7_H__ */

arch/mips/include/asm/mach-ar7/gpio.h

Lines changed: 0 additions & 41 deletions
This file was deleted.

arch/mips/include/asm/mach-ath25/gpio.h

Lines changed: 0 additions & 16 deletions
This file was deleted.

arch/mips/include/asm/mach-ath79/gpio.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

arch/mips/include/asm/mach-au1x00/gpio-au1000.h

Lines changed: 11 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,17 @@ static inline int alchemy_gpio1_to_irq(int gpio)
266266
return -ENXIO;
267267
}
268268

269+
/* On Au1000, Au1500 and Au1100 GPIOs won't work as inputs before
270+
* SYS_PININPUTEN is written to at least once. On Au1550/Au1200/Au1300 this
271+
* register enables use of GPIOs as wake source.
272+
*/
273+
static inline void alchemy_gpio1_input_enable(void)
274+
{
275+
void __iomem *base = (void __iomem *)KSEG1ADDR(AU1000_SYS_PHYS_ADDR);
276+
__raw_writel(0, base + 0x110); /* the write op is key */
277+
wmb();
278+
}
279+
269280
/*
270281
* GPIO2 block macros for common linux GPIO functions. The 'gpio'
271282
* parameter must be in range of ALCHEMY_GPIO2_BASE..ALCHEMY_GPIO2_MAX.
@@ -518,141 +529,4 @@ static inline int alchemy_irq_to_gpio(int irq)
518529
return -ENXIO;
519530
}
520531

521-
/**********************************************************************/
522-
523-
/* Linux gpio framework integration.
524-
*
525-
* 4 use cases of Au1000-Au1200 GPIOS:
526-
*(1) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=y:
527-
* Board must register gpiochips.
528-
*(2) GPIOLIB=y, ALCHEMY_GPIO_INDIRECT=n:
529-
* 2 (1 for Au1000) gpio_chips are registered.
530-
*
531-
*(3) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=y:
532-
* the boards' gpio.h must provide the linux gpio wrapper functions,
533-
*
534-
*(4) GPIOLIB=n, ALCHEMY_GPIO_INDIRECT=n:
535-
* inlinable gpio functions are provided which enable access to the
536-
* Au1000 gpios only by using the numbers straight out of the data-
537-
* sheets.
538-
539-
* Cases 1 and 3 are intended for boards which want to provide their own
540-
* GPIO namespace and -operations (i.e. for example you have 8 GPIOs
541-
* which are in part provided by spare Au1000 GPIO pins and in part by
542-
* an external FPGA but you still want them to be accssible in linux
543-
* as gpio0-7. The board can of course use the alchemy_gpioX_* functions
544-
* as required).
545-
*/
546-
547-
#ifndef CONFIG_GPIOLIB
548-
549-
#ifdef CONFIG_ALCHEMY_GPIOINT_AU1000
550-
551-
#ifndef CONFIG_ALCHEMY_GPIO_INDIRECT /* case (4) */
552-
553-
static inline int gpio_direction_input(int gpio)
554-
{
555-
return alchemy_gpio_direction_input(gpio);
556-
}
557-
558-
static inline int gpio_direction_output(int gpio, int v)
559-
{
560-
return alchemy_gpio_direction_output(gpio, v);
561-
}
562-
563-
static inline int gpio_get_value(int gpio)
564-
{
565-
return alchemy_gpio_get_value(gpio);
566-
}
567-
568-
static inline void gpio_set_value(int gpio, int v)
569-
{
570-
alchemy_gpio_set_value(gpio, v);
571-
}
572-
573-
static inline int gpio_get_value_cansleep(unsigned gpio)
574-
{
575-
return gpio_get_value(gpio);
576-
}
577-
578-
static inline void gpio_set_value_cansleep(unsigned gpio, int value)
579-
{
580-
gpio_set_value(gpio, value);
581-
}
582-
583-
static inline int gpio_is_valid(int gpio)
584-
{
585-
return alchemy_gpio_is_valid(gpio);
586-
}
587-
588-
static inline int gpio_cansleep(int gpio)
589-
{
590-
return alchemy_gpio_cansleep(gpio);
591-
}
592-
593-
static inline int gpio_to_irq(int gpio)
594-
{
595-
return alchemy_gpio_to_irq(gpio);
596-
}
597-
598-
static inline int irq_to_gpio(int irq)
599-
{
600-
return alchemy_irq_to_gpio(irq);
601-
}
602-
603-
static inline int gpio_request(unsigned gpio, const char *label)
604-
{
605-
return 0;
606-
}
607-
608-
static inline int gpio_request_one(unsigned gpio,
609-
unsigned long flags, const char *label)
610-
{
611-
return 0;
612-
}
613-
614-
static inline int gpio_request_array(struct gpio *array, size_t num)
615-
{
616-
return 0;
617-
}
618-
619-
static inline void gpio_free(unsigned gpio)
620-
{
621-
}
622-
623-
static inline void gpio_free_array(struct gpio *array, size_t num)
624-
{
625-
}
626-
627-
static inline int gpio_set_debounce(unsigned gpio, unsigned debounce)
628-
{
629-
return -ENOSYS;
630-
}
631-
632-
static inline int gpio_export(unsigned gpio, bool direction_may_change)
633-
{
634-
return -ENOSYS;
635-
}
636-
637-
static inline int gpio_export_link(struct device *dev, const char *name,
638-
unsigned gpio)
639-
{
640-
return -ENOSYS;
641-
}
642-
643-
static inline int gpio_sysfs_set_active_low(unsigned gpio, int value)
644-
{
645-
return -ENOSYS;
646-
}
647-
648-
static inline void gpio_unexport(unsigned gpio)
649-
{
650-
}
651-
652-
#endif /* !CONFIG_ALCHEMY_GPIO_INDIRECT */
653-
654-
#endif /* CONFIG_ALCHEMY_GPIOINT_AU1000 */
655-
656-
#endif /* !CONFIG_GPIOLIB */
657-
658532
#endif /* _ALCHEMY_GPIO_AU1000_H_ */

0 commit comments

Comments
 (0)