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>
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <asm/cacheflush.h>
+#include <linux/gpio.h>
 
+#include <asm/cacheflush.h>
 #include <asm/mach-au1x00/au1000.h>
 
 void au1000_restart(char *command)
 #else
        printk(KERN_NOTICE "\n** You can safely turn off the power\n");
 #ifdef CONFIG_MIPS_MIRAGE
-       au_writel((1 << 26) | (1 << 10), GPIO2_OUTPUT);
+       gpio_direction_output(210, 1);
 #endif
 #ifdef CONFIG_MIPS_DB1200
        au_writew(au_readw(0xB980001C) | (1 << 14), 0xB980001C);
 
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/gpio.h>
 #include <linux/init.h>
 
 #include <asm/mach-au1x00/au1000.h>
 #endif
        bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
 
-#ifdef CONFIG_MIPS_MIRAGE
        /* Enable GPIO[31:0] inputs */
-       au_writel(0, SYS_PININPUTEN);
+       alchemy_gpio1_input_enable();
 
-       /* GPIO[20] is output, tristate the other input primary GPIOs */
-       au_writel(~(1 << 20), SYS_TRIOUTCLR);
+#ifdef CONFIG_MIPS_MIRAGE
+       /* GPIO[20] is output */
+       alchemy_gpio_direction_output(20, 0);
 
        /* Set GPIO[210:208] instead of SSI_0 */
        pin_func = au_readl(SYS_PINFUNC) | SYS_PF_S0;
         * Enable speaker amplifier.  This should
         * be part of the audio driver.
         */
-       au_writel(au_readl(GPIO2_DIR) | 0x200, GPIO2_DIR);
-       au_writel(0x02000200, GPIO2_OUTPUT);
+       alchemy_gpio_direction_output(209, 1);
 #endif
 
        au_sync();
 
  */
 
 #include <linux/delay.h>
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <asm/mach-au1x00/au1000.h>
        pin_func |= SYS_PF_USB;
 
        au_writel(pin_func, SYS_PINFUNC);
-       au_writel(0x2800, SYS_TRIOUTCLR);
-       au_writel(0x0030, SYS_OUTPUTCLR);
+
+       alchemy_gpio_direction_input(11);
+       alchemy_gpio_direction_input(13);
+       alchemy_gpio_direction_output(4, 0);
+       alchemy_gpio_direction_output(5, 0);
 #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
 
        /* Make GPIO 15 an input (for interrupt line) */
        pin_func |= SYS_PF_I2S;
        au_writel(pin_func, SYS_PINFUNC);
 
-       au_writel(0x8000, SYS_TRIOUTCLR);
+       alchemy_gpio_direction_input(15);
 
        static_cfg0 = au_readl(MEM_STCFG0) & ~0xc00;
        au_writel(static_cfg0, MEM_STCFG0);
 
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 
        /* Set AUX clock to 12 MHz * 8 = 96 MHz */
        au_writel(8, SYS_AUXPLL);
-       au_writel(0, SYS_PININPUTEN);
+       alchemy_gpio1_input_enable();
        udelay(100);
 
 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
 
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/init.h>
 #include <linux/interrupt.h>
 
 #include <asm/mach-au1x00/au1000.h>
        au_writel(0, SYS_PINSTATERD);
        udelay(100);
 
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-
        /* GPIO201 is input for PCMCIA card detect */
        /* GPIO203 is input for PCMCIA interrupt request */
-       au_writel(au_readl(GPIO2_DIR) & ~((1 << 1) | (1 << 3)), GPIO2_DIR);
+       alchemy_gpio_direction_input(201);
+       alchemy_gpio_direction_input(203);
+
+#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
 
        /* Zero and disable FREQ2 */
        sys_freqctrl = au_readl(SYS_FREQCTRL0);
 
 #include <linux/suspend.h>
 #include <linux/sysfs.h>
 #include <asm/mach-au1x00/au1000.h>
+#include <asm/mach-au1x00/gpio.h>
 
 /*
  * Generic suspend userspace interface for Alchemy development boards.
 static int db1x_pm_enter(suspend_state_t state)
 {
        /* enable GPIO based wakeup */
-       au_writel(1, SYS_PININPUTEN);
+       alchemy_gpio1_input_enable();
 
        /* clear and setup wake cause and source */
        au_writel(0, SYS_WAKEMSK);