Skip to content

Commit

Permalink
[ARM] Orion: share GPIO handling code
Browse files Browse the repository at this point in the history
Split off Orion GPIO handling code into plat-orion/, and add
support for multiple sets of (32) GPIO pins.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
  • Loading branch information
Lennert Buytenhek authored and Nicolas Pitre committed Dec 20, 2008
1 parent 6fd7c7f commit 9569dae
Show file tree
Hide file tree
Showing 11 changed files with 308 additions and 271 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-orion5x/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
obj-y += common.o addr-map.o pci.o gpio.o irq.o mpp.o
obj-y += common.o addr-map.o pci.o irq.o mpp.o
obj-$(CONFIG_MACH_DB88F5281) += db88f5281-setup.o
obj-$(CONFIG_MACH_RD88F5182) += rd88f5182-setup.o
obj-$(CONFIG_MACH_KUROBOX_PRO) += kurobox_pro-setup.o
Expand Down
7 changes: 0 additions & 7 deletions arch/arm/mach-orion5x/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys);
int orion5x_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin);

/*
* Valid GPIO pins according to MPP setup, used by machine-setup.
* (/mach-orion/gpio.c).
*/
void orion5x_gpio_set_valid(unsigned pin, int valid);
void gpio_display(void); /* debug */

struct machine_desc;
struct meminfo;
struct tag;
Expand Down
231 changes: 0 additions & 231 deletions arch/arm/mach-orion5x/gpio.c

This file was deleted.

26 changes: 16 additions & 10 deletions arch/arm/mach-orion5x/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
* arch/arm/mach-orion5x/include/mach/gpio.h
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/

extern int gpio_request(unsigned pin, const char *label);
extern void gpio_free(unsigned pin);
extern int gpio_direction_input(unsigned pin);
extern int gpio_direction_output(unsigned pin, int value);
extern int gpio_get_value(unsigned pin);
extern void gpio_set_value(unsigned pin, int value);
extern void orion5x_gpio_set_blink(unsigned pin, int blink);
extern void gpio_display(void); /* debug */
#ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H

#include <mach/irqs.h>
#include <plat/gpio.h>
#include <asm-generic/gpio.h> /* cansleep wrappers */

#define GPIO_MAX 32
#define GPIO_OUT(pin) ORION5X_DEV_BUS_REG(0x100)
#define GPIO_IO_CONF(pin) ORION5X_DEV_BUS_REG(0x104)
#define GPIO_BLINK_EN(pin) ORION5X_DEV_BUS_REG(0x108)
#define GPIO_IN_POL(pin) ORION5X_DEV_BUS_REG(0x10c)
#define GPIO_DATA_IN(pin) ORION5X_DEV_BUS_REG(0x110)

static inline int gpio_to_irq(int pin)
{
Expand All @@ -25,4 +30,5 @@ static inline int irq_to_gpio(int irq)
return irq - IRQ_ORION5X_GPIO_START;
}

#include <asm-generic/gpio.h> /* cansleep wrappers */

#endif
4 changes: 1 addition & 3 deletions arch/arm/mach-orion5x/include/mach/irqs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#ifndef __ASM_ARCH_IRQS_H
#define __ASM_ARCH_IRQS_H

#include "orion5x.h" /* need GPIO_MAX */

/*
* Orion Main Interrupt Controller
*/
Expand Down Expand Up @@ -54,7 +52,7 @@
* Orion General Purpose Pins
*/
#define IRQ_ORION5X_GPIO_START 32
#define NR_GPIO_IRQS GPIO_MAX
#define NR_GPIO_IRQS 32

#define NR_IRQS (IRQ_ORION5X_GPIO_START + NR_GPIO_IRQS)

Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-orion5x/include/mach/orion5x.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@
#define MPP_16_19_CTRL ORION5X_DEV_BUS_REG(0x050)
#define MPP_DEV_CTRL ORION5X_DEV_BUS_REG(0x008)
#define MPP_RESET_SAMPLE ORION5X_DEV_BUS_REG(0x010)
#define GPIO_OUT ORION5X_DEV_BUS_REG(0x100)
#define GPIO_IO_CONF ORION5X_DEV_BUS_REG(0x104)
#define GPIO_BLINK_EN ORION5X_DEV_BUS_REG(0x108)
#define GPIO_IN_POL ORION5X_DEV_BUS_REG(0x10c)
#define GPIO_DATA_IN ORION5X_DEV_BUS_REG(0x110)
#define GPIO_EDGE_CAUSE ORION5X_DEV_BUS_REG(0x114)
#define GPIO_EDGE_MASK ORION5X_DEV_BUS_REG(0x118)
#define GPIO_LEVEL_MASK ORION5X_DEV_BUS_REG(0x11c)
Expand All @@ -149,7 +144,6 @@
#define DEV_BUS_CTRL ORION5X_DEV_BUS_REG(0x4c0)
#define DEV_BUS_INT_CAUSE ORION5X_DEV_BUS_REG(0x4d0)
#define DEV_BUS_INT_MASK ORION5X_DEV_BUS_REG(0x4d4)
#define GPIO_MAX 32

/***************************************************************************
* Orion CPU Bridge Registers
Expand Down
Loading

0 comments on commit 9569dae

Please sign in to comment.