linux-mips
[Top] [All Lists]

[PATCH 4/5] Alchemy: xxs1500: use linux gpio api.

To: Linux-MIPS <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 4/5] Alchemy: xxs1500: use linux gpio api.
From: Manuel Lauss <manuel.lauss@googlemail.com>
Date: Sat, 6 Jun 2009 14:09:57 +0200
Cc: Manuel Lauss <manuel.lauss@gmail.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=GMbZlBqYnsxeIszQj9UKwbkVVg8r3DbgUHb0Zdh3VEo=; b=mTLqJ+whHREYdSdJTITsW5ofQuhhWUglUBbrH2vRM8zA5RIncX2cn+vY4furWYAoF1 kp5Ips8FM2zat8SATt47No19iR/iobnW/FHz4COVkXBNpatoDMbXjDu1k/2vD9QwrT21 jV57TKR4lGL/hs8GRpFW2vLL12iWeZ/HaCdFQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=gT/FBfSjmwuy6A/K6bFmx4/FaBUavgOxJChxSNtamuk+wZ9f/KBeUTmErtMh7+Zqyd NxhBZmWPlnwsszQPdT/xGi5Oo1V50iQEHm2KhiIL8GXPfOuz/nbNCTDI2v8GLzClJw2+ 3wyL1Z13sIAsaNl/IimVBTYKYDA9dHs/Br+mI=
In-reply-to: <1244290198-27162-4-git-send-email-manuel.lauss@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1244290198-27162-1-git-send-email-manuel.lauss@gmail.com> <1244290198-27162-2-git-send-email-manuel.lauss@gmail.com> <1244290198-27162-3-git-send-email-manuel.lauss@gmail.com> <1244290198-27162-4-git-send-email-manuel.lauss@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
Replace a few GPIO register accesses in the board init code with calls
to the gpio api.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
---
 arch/mips/alchemy/xxs1500/board_setup.c |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/arch/mips/alchemy/xxs1500/board_setup.c 
b/arch/mips/alchemy/xxs1500/board_setup.c
index a2634fa..4de2d48 100644
--- a/arch/mips/alchemy/xxs1500/board_setup.c
+++ b/arch/mips/alchemy/xxs1500/board_setup.c
@@ -23,6 +23,7 @@
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/delay.h>
 
@@ -50,6 +51,9 @@ void __init board_setup(void)
        }
 #endif
 
+       alchemy_gpio1_input_enable();
+       alchemy_gpio2_enable();
+
        /* Set multiple use pins (UART3/GPIO) to UART (it's used as UART too) */
        pin_func  = au_readl(SYS_PINFUNC) & ~SYS_PF_UR3;
        pin_func |= SYS_PF_UR3;
@@ -65,20 +69,19 @@ void __init board_setup(void)
        au_writel(0x01, UART3_ADDR + UART_MCR); /* UART_MCR_DTR is 0x01??? */
 
 #ifdef CONFIG_PCMCIA_XXS1500
-       /* Setup PCMCIA signals */
-       au_writel(0, SYS_PININPUTEN);
-
        /* GPIO 0, 1, and 4 are inputs */
-       au_writel(1 | (1 << 1) | (1 << 4), SYS_TRIOUTCLR);
+       alchemy_gpio_direction_input(0);
+       alchemy_gpio_direction_input(1);
+       alchemy_gpio_direction_input(4);
 
-       /* Enable GPIO2 if not already enabled */
-       au_writel(1, GPIO2_ENABLE);
        /* GPIO2 208/9/10/11 are inputs */
-       au_writel((1 << 8) | (1 << 9) | (1 << 10) | (1 << 11), GPIO2_DIR);
+       alchemy_gpio_direction_input(208);
+       alchemy_gpio_direction_input(209);
+       alchemy_gpio_direction_input(210);
+       alchemy_gpio_direction_input(211);
 
        /* Turn off power */
-       au_writel((au_readl(GPIO2_PINSTATE) & ~(1 << 14)) | (1 << 30),
-                 GPIO2_OUTPUT);
+       alchemy_gpio_direction_output(214, 0);
 #endif
 
 #ifdef CONFIG_PCI
-- 
1.6.3.1


<Prev in Thread] Current Thread [Next in Thread>