All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manuel Lauss <manuel.lauss@googlemail.com>
To: Linux-MIPS <linux-mips@linux-mips.org>,
	Ralf Baechle <ralf@linux-mips.org>
Cc: Manuel Lauss <manuel.lauss@gmail.com>
Subject: [PATCH 3/5] Alchemy: mtx-1: use linux gpio api.
Date: Wed,  3 Jun 2009 18:18:06 +0200	[thread overview]
Message-ID: <1244045888-16259-4-git-send-email-manuel.lauss@gmail.com> (raw)
In-Reply-To: <1244045888-16259-3-git-send-email-manuel.lauss@gmail.com>

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/mtx-1/board_setup.c |   24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/arch/mips/alchemy/mtx-1/board_setup.c b/arch/mips/alchemy/mtx-1/board_setup.c
index 8ed1ae1..3356a0d 100644
--- a/arch/mips/alchemy/mtx-1/board_setup.c
+++ b/arch/mips/alchemy/mtx-1/board_setup.c
@@ -28,6 +28,7 @@
  *  675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <linux/gpio.h>
 #include <linux/init.h>
 
 #include <asm/mach-au1x00/au1000.h>
@@ -55,10 +56,11 @@ void __init board_setup(void)
 	}
 #endif
 
+	alchemy_gpio2_enable();
+
 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
 	/* Enable USB power switch */
-	au_writel(au_readl(GPIO2_DIR) | 0x10, GPIO2_DIR);
-	au_writel(0x100000, GPIO2_OUTPUT);
+	alchemy_gpio_direction_output(4, 0);
 #endif /* defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) */
 
 #ifdef CONFIG_PCI
@@ -74,14 +76,14 @@ void __init board_setup(void)
 
 	/* Initialize GPIO */
 	au_writel(0xFFFFFFFF, SYS_TRIOUTCLR);
-	au_writel(0x00000001, SYS_OUTPUTCLR); /* set M66EN (PCI 66MHz) to OFF */
-	au_writel(0x00000008, SYS_OUTPUTSET); /* set PCI CLKRUN# to OFF */
-	au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
-	au_writel(0x00000020, SYS_OUTPUTCLR); /* set eth PHY TX_ER to OFF */
+	alchemy_gpio_direction_output(0, 0);	/* set M66EN (PCI 66MHz) to OFF */
+	alchemy_gpio_direction_output(3, 1);	/* set PCI CLKRUN# to OFF */
+	alchemy_gpio_direction_output(1, 1);	/* set EXT_IO3 ON */
+	alchemy_gpio_direction_output(5, 0);	/* set eth PHY TX_ER to OFF */
 
 	/* Enable LED and set it to green */
-	au_writel(au_readl(GPIO2_DIR) | 0x1800, GPIO2_DIR);
-	au_writel(0x18000800, GPIO2_OUTPUT);
+	alchemy_gpio_direction_output(211, 1);	/* green on */
+	alchemy_gpio_direction_output(212, 0);	/* red off */
 
 	board_pci_idsel = mtx1_pci_idsel;
 
@@ -101,10 +103,10 @@ mtx1_pci_idsel(unsigned int devsel, int assert)
 
 	if (assert && devsel != 0)
 		/* Suppress signal to Cardbus */
-		au_writel(0x00000002, SYS_OUTPUTCLR); /* set EXT_IO3 OFF */
+		gpio_set_value(1, 0);	/* set EXT_IO3 OFF */
 	else
-		au_writel(0x00000002, SYS_OUTPUTSET); /* set EXT_IO3 ON */
+		gpio_set_value(1, 1);	/* set EXT_IO3 ON */
+
 	au_sync_udelay(1);
 	return 1;
 }
-
-- 
1.6.3.1

  reply	other threads:[~2009-06-03 16:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-03 16:18 [PATCH 0/5] Alchemy GPIO rewrite v6 Manuel Lauss
2009-06-03 16:18 ` [PATCH 1/5] Alchemy: remove unused au1000_gpio.h header Manuel Lauss
2009-06-03 16:18   ` [PATCH 2/5] Alchemy: rewrite GPIO support Manuel Lauss
2009-06-03 16:18     ` Manuel Lauss [this message]
2009-06-03 16:18       ` [PATCH 4/5] Alchemy: xxs1500: use linux gpio api Manuel Lauss
2009-06-03 16:18         ` [PATCH 5/5] Alchemy: devboards: convert to gpio calls Manuel Lauss
2009-06-04  9:26 ` [PATCH 0/5] Alchemy GPIO rewrite v6 Florian Fainelli
  -- strict thread matches above, loose matches on Subject: below --
2009-06-06 12:09 [PATCH 0/5] Alchemy GPIO rewrite v7 Manuel Lauss
2009-06-06 12:09 ` [PATCH 1/5] Alchemy: remove unused au1000_gpio.h header Manuel Lauss
2009-06-06 12:09   ` [PATCH 2/5] Alchemy: rewrite GPIO support Manuel Lauss
2009-06-06 12:09     ` [PATCH 3/5] Alchemy: mtx-1: use linux gpio api Manuel Lauss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1244045888-16259-4-git-send-email-manuel.lauss@gmail.com \
    --to=manuel.lauss@googlemail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=manuel.lauss@gmail.com \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.