aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Lauss <manuel.lauss@googlemail.com>2009-06-06 08:09:58 -0400
committerRalf Baechle <ralf@linux-mips.org>2009-06-17 06:06:29 -0400
commitce65cc8fe22a572ea9ec88e203388558b6b863af (patch)
tree26cafa2f81be0f44fac4142e40bb1596c58040cd
parentb6c9f10517e99d806bebd04555801c787b9a3a23 (diff)
MIPS: Alchemy: devboards: Convert to gpio calls.
Replace a few open-coded GPIO register accesses with gpio calls. Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/alchemy/common/reset.c5
-rw-r--r--arch/mips/alchemy/devboards/db1x00/board_setup.c12
-rw-r--r--arch/mips/alchemy/devboards/pb1000/board_setup.c10
-rw-r--r--arch/mips/alchemy/devboards/pb1100/board_setup.c3
-rw-r--r--arch/mips/alchemy/devboards/pb1500/board_setup.c10
-rw-r--r--arch/mips/alchemy/devboards/pm.c3
6 files changed, 26 insertions, 17 deletions
diff --git a/arch/mips/alchemy/common/reset.c b/arch/mips/alchemy/common/reset.c
index 0191c936cb5e..4791011e8f92 100644
--- a/arch/mips/alchemy/common/reset.c
+++ b/arch/mips/alchemy/common/reset.c
@@ -27,8 +27,9 @@
27 * 675 Mass Ave, Cambridge, MA 02139, USA. 27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */ 28 */
29 29
30#include <asm/cacheflush.h> 30#include <linux/gpio.h>
31 31
32#include <asm/cacheflush.h>
32#include <asm/mach-au1x00/au1000.h> 33#include <asm/mach-au1x00/au1000.h>
33 34
34void au1000_restart(char *command) 35void au1000_restart(char *command)
@@ -161,7 +162,7 @@ void au1000_halt(void)
161#else 162#else
162 printk(KERN_NOTICE "\n** You can safely turn off the power\n"); 163 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
163#ifdef CONFIG_MIPS_MIRAGE 164#ifdef CONFIG_MIPS_MIRAGE
164 au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT); 165 gpio_direction_output(210, 1);
165#endif 166#endif
166#ifdef CONFIG_MIPS_DB1200 167#ifdef CONFIG_MIPS_DB1200
167 au_writew(au_readw(0xB980001C) | (1 << 14), 0xB980001C); 168 au_writew(au_readw(0xB980001C) | (1 << 14), 0xB980001C);
diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c
index a75ffbf99f25..de30d8ea7176 100644
--- a/arch/mips/alchemy/devboards/db1x00/board_setup.c
+++ b/arch/mips/alchemy/devboards/db1x00/board_setup.c
@@ -27,6 +27,7 @@
27 * 675 Mass Ave, Cambridge, MA 02139, USA. 27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */ 28 */
29 29
30#include <linux/gpio.h>
30#include <linux/init.h> 31#include <linux/init.h>
31 32
32#include <asm/mach-au1x00/au1000.h> 33#include <asm/mach-au1x00/au1000.h>
@@ -94,12 +95,12 @@ void __init board_setup(void)
94#endif 95#endif
95 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */ 96 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
96 97
97#ifdef CONFIG_MIPS_MIRAGE
98 /* Enable GPIO[31:0] inputs */ 98 /* Enable GPIO[31:0] inputs */
99 au_writel(0, SYS_PININPUTEN); 99 alchemy_gpio1_input_enable();
100 100
101 /* GPIO[20] is output, tristate the other input primary GPIOs */ 101#ifdef CONFIG_MIPS_MIRAGE
102 au_writel(~(1 << 20), SYS_TRIOUTCLR); 102 /* GPIO[20] is output */
103 alchemy_gpio_direction_output(20, 0);
103 104
104 /* Set GPIO[210:208] instead of SSI_0 */ 105 /* Set GPIO[210:208] instead of SSI_0 */
105 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0; 106 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0;
@@ -118,8 +119,7 @@ void __init board_setup(void)
118 * Enable speaker amplifier. This should 119 * Enable speaker amplifier. This should
119 * be part of the audio driver. 120 * be part of the audio driver.
120 */ 121 */
121 au_writel(au_readl(GPIO2_DIR) | 0x200, GPIO2_DIR); 122 alchemy_gpio_direction_output(209, 1);
122 au_writel(0x02000200, GPIO2_OUTPUT);
123#endif 123#endif
124 124
125 au_sync(); 125 au_sync();
diff --git a/arch/mips/alchemy/devboards/pb1000/board_setup.c b/arch/mips/alchemy/devboards/pb1000/board_setup.c
index aed2fdecc709..cd273545e810 100644
--- a/arch/mips/alchemy/devboards/pb1000/board_setup.c
+++ b/arch/mips/alchemy/devboards/pb1000/board_setup.c
@@ -24,6 +24,7 @@
24 */ 24 */
25 25
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/gpio.h>
27#include <linux/init.h> 28#include <linux/init.h>
28#include <linux/interrupt.h> 29#include <linux/interrupt.h>
29#include <asm/mach-au1x00/au1000.h> 30#include <asm/mach-au1x00/au1000.h>
@@ -130,8 +131,11 @@ void __init board_setup(void)
130 pin_func |= SYS_PF_USB; 131 pin_func |= SYS_PF_USB;
131 132
132 au_writel(pin_func, SYS_PINFUNC); 133 au_writel(pin_func, SYS_PINFUNC);
133 au_writel(0x2800, SYS_TRIOUTCLR); 134
134 au_writel(0x0030, SYS_OUTPUTCLR); 135 alchemy_gpio_direction_input(11);
136 alchemy_gpio_direction_input(13);
137 alchemy_gpio_direction_output(4, 0);
138 alchemy_gpio_direction_output(5, 0);
135#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */ 139#endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
136 140
137 /* Make GPIO 15 an input (for interrupt line) */ 141 /* Make GPIO 15 an input (for interrupt line) */
@@ -140,7 +144,7 @@ void __init board_setup(void)
140 pin_func |= SYS_PF_I2S; 144 pin_func |= SYS_PF_I2S;
141 au_writel(pin_func, SYS_PINFUNC); 145 au_writel(pin_func, SYS_PINFUNC);
142 146
143 au_writel(0x8000, SYS_TRIOUTCLR); 147 alchemy_gpio_direction_input(15);
144 148
145 static_cfg0 = au_readl(MEM_STCFG0) & ~0xc00; 149 static_cfg0 = au_readl(MEM_STCFG0) & ~0xc00;
146 au_writel(static_cfg0, MEM_STCFG0); 150 au_writel(static_cfg0, MEM_STCFG0);
diff --git a/arch/mips/alchemy/devboards/pb1100/board_setup.c b/arch/mips/alchemy/devboards/pb1100/board_setup.c
index 4df57fae15d4..61263081ef58 100644
--- a/arch/mips/alchemy/devboards/pb1100/board_setup.c
+++ b/arch/mips/alchemy/devboards/pb1100/board_setup.c
@@ -23,6 +23,7 @@
23 * 675 Mass Ave, Cambridge, MA 02139, USA. 23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */ 24 */
25 25
26#include <linux/gpio.h>
26#include <linux/init.h> 27#include <linux/init.h>
27#include <linux/delay.h> 28#include <linux/delay.h>
28#include <linux/interrupt.h> 29#include <linux/interrupt.h>
@@ -88,7 +89,7 @@ void __init board_setup(void)
88 89
89 /* Set AUX clock to 12 MHz * 8 = 96 MHz */ 90 /* Set AUX clock to 12 MHz * 8 = 96 MHz */
90 au_writel(8, SYS_AUXPLL); 91 au_writel(8, SYS_AUXPLL);
91 au_writel(0, SYS_PININPUTEN); 92 alchemy_gpio1_input_enable();
92 udelay(100); 93 udelay(100);
93 94
94#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 95#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
diff --git a/arch/mips/alchemy/devboards/pb1500/board_setup.c b/arch/mips/alchemy/devboards/pb1500/board_setup.c
index fed3b093156a..d7a56569e7ed 100644
--- a/arch/mips/alchemy/devboards/pb1500/board_setup.c
+++ b/arch/mips/alchemy/devboards/pb1500/board_setup.c
@@ -23,8 +23,9 @@
23 * 675 Mass Ave, Cambridge, MA 02139, USA. 23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */ 24 */
25 25
26#include <linux/init.h>
27#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/gpio.h>
28#include <linux/init.h>
28#include <linux/interrupt.h> 29#include <linux/interrupt.h>
29 30
30#include <asm/mach-au1x00/au1000.h> 31#include <asm/mach-au1x00/au1000.h>
@@ -90,11 +91,12 @@ void __init board_setup(void)
90 au_writel(0, SYS_PINSTATERD); 91 au_writel(0, SYS_PINSTATERD);
91 udelay(100); 92 udelay(100);
92 93
93#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
94
95 /* GPIO201 is input for PCMCIA card detect */ 94 /* GPIO201 is input for PCMCIA card detect */
96 /* GPIO203 is input for PCMCIA interrupt request */ 95 /* GPIO203 is input for PCMCIA interrupt request */
97 au_writel(au_readl(GPIO2_DIR) & ~((1 << 1) | (1 << 3)), GPIO2_DIR); 96 alchemy_gpio_direction_input(201);
97 alchemy_gpio_direction_input(203);
98
99#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
98 100
99 /* Zero and disable FREQ2 */ 101 /* Zero and disable FREQ2 */
100 sys_freqctrl = au_readl(SYS_FREQCTRL0); 102 sys_freqctrl = au_readl(SYS_FREQCTRL0);
diff --git a/arch/mips/alchemy/devboards/pm.c b/arch/mips/alchemy/devboards/pm.c
index d5eb9c325ed0..632f9862a0fb 100644
--- a/arch/mips/alchemy/devboards/pm.c
+++ b/arch/mips/alchemy/devboards/pm.c
@@ -9,6 +9,7 @@
9#include <linux/suspend.h> 9#include <linux/suspend.h>
10#include <linux/sysfs.h> 10#include <linux/sysfs.h>
11#include <asm/mach-au1x00/au1000.h> 11#include <asm/mach-au1x00/au1000.h>
12#include <asm/mach-au1x00/gpio.h>
12 13
13/* 14/*
14 * Generic suspend userspace interface for Alchemy development boards. 15 * Generic suspend userspace interface for Alchemy development boards.
@@ -26,7 +27,7 @@ static unsigned long db1x_pm_last_wakesrc;
26static int db1x_pm_enter(suspend_state_t state) 27static int db1x_pm_enter(suspend_state_t state)
27{ 28{
28 /* enable GPIO based wakeup */ 29 /* enable GPIO based wakeup */
29 au_writel(1, SYS_PININPUTEN); 30 alchemy_gpio1_input_enable();
30 31
31 /* clear and setup wake cause and source */ 32 /* clear and setup wake cause and source */
32 au_writel(0, SYS_WAKEMSK); 33 au_writel(0, SYS_WAKEMSK);