summaryrefslogtreecommitdiff
path: root/board/ti/beagle
diff options
context:
space:
mode:
authorSanjeev Premi <premi@ti.com>2011-09-08 10:51:01 -0400
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2011-09-13 08:25:15 +0200
commit84c3b6312997de6f98114263159c8b9824f3d33d (patch)
tree943f816f64d66cd956b5ece9b6198b78b7c2c5e9 /board/ti/beagle
parent3b690ebbbf21303a3bac1f62d967c36cd8655ce0 (diff)
downloadu-boot-imx-84c3b6312997de6f98114263159c8b9824f3d33d.zip
u-boot-imx-84c3b6312997de6f98114263159c8b9824f3d33d.tar.gz
u-boot-imx-84c3b6312997de6f98114263159c8b9824f3d33d.tar.bz2
omap: gpio: Adapt board files to use generic API
This patch contains updates the sources in the board files to use the generic API. Signed-off-by: Sanjeev Premi <premi@ti.com>
Diffstat (limited to 'board/ti/beagle')
-rw-r--r--board/ti/beagle/beagle.c44
-rw-r--r--board/ti/beagle/led.c22
2 files changed, 33 insertions, 33 deletions
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index e07f1b8..8cdceaf 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -38,7 +38,7 @@
#include <asm/arch/mmc_host_def.h>
#include <asm/arch/mux.h>
#include <asm/arch/sys_proto.h>
-#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
#include <asm/mach-types.h>
#ifdef CONFIG_USB_EHCI
#include <usb.h>
@@ -116,21 +116,21 @@ int get_board_revision(void)
{
int revision;
- if (!omap_request_gpio(171) &&
- !omap_request_gpio(172) &&
- !omap_request_gpio(173)) {
+ if (!gpio_request(171, "") &&
+ !gpio_request(172, "") &&
+ !gpio_request(173, "")) {
- omap_set_gpio_direction(171, 1);
- omap_set_gpio_direction(172, 1);
- omap_set_gpio_direction(173, 1);
+ gpio_direction_input(171);
+ gpio_direction_input(172);
+ gpio_direction_input(173);
- revision = omap_get_gpio_datain(173) << 2 |
- omap_get_gpio_datain(172) << 1 |
- omap_get_gpio_datain(171);
+ revision = gpio_get_value(173) << 2 |
+ gpio_get_value(172) << 1 |
+ gpio_get_value(171);
- omap_free_gpio(171);
- omap_free_gpio(172);
- omap_free_gpio(173);
+ gpio_free(171);
+ gpio_free(172);
+ gpio_free(173);
} else {
printf("Error: unable to acquire board revision GPIOs\n");
revision = -1;
@@ -387,7 +387,7 @@ int board_mmc_init(bd_t *bis)
int ehci_hcd_stop(void)
{
pr_debug("Resetting OMAP3 EHCI\n");
- omap_set_gpio_dataout(GPIO_PHY_RESET, 0);
+ gpio_set_value(GPIO_PHY_RESET, 0);
writel(OMAP_UHH_SYSCONFIG_SOFTRESET, OMAP3_UHH_BASE + OMAP_UHH_SYSCONFIG);
/* disable USB clocks */
struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
@@ -415,9 +415,9 @@ int ehci_hcd_init(void)
pr_debug("Initializing OMAP3 ECHI\n");
/* Put the PHY in RESET */
- omap_request_gpio(GPIO_PHY_RESET);
- omap_set_gpio_direction(GPIO_PHY_RESET, 0);
- omap_set_gpio_dataout(GPIO_PHY_RESET, 0);
+ gpio_request(GPIO_PHY_RESET, "");
+ gpio_direction_output(GPIO_PHY_RESET, 0);
+ gpio_set_value(GPIO_PHY_RESET, 0);
/* Hold the PHY in RESET for enough time till DIR is high */
/* Refer: ISSUE1 */
@@ -469,7 +469,7 @@ int ehci_hcd_init(void)
* PHY is settled and ready
*/
udelay(10);
- omap_set_gpio_dataout(GPIO_PHY_RESET, 1);
+ gpio_set_value(GPIO_PHY_RESET, 1);
hccr = (struct ehci_hccr *)(OMAP3_EHCI_BASE);
hcor = (struct ehci_hcor *)(OMAP3_EHCI_BASE + 0x10);
@@ -508,10 +508,10 @@ int do_userbutton (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
gpio = 4;
break;
}
- omap_request_gpio(gpio);
- omap_set_gpio_direction(gpio, 1);
+ gpio_request(gpio, "");
+ gpio_direction_input(gpio);
printf("The user button is currently ");
- if(omap_get_gpio_datain(gpio))
+ if (gpio_get_value(gpio))
{
button = 1;
printf("PRESSED.\n");
@@ -522,7 +522,7 @@ int do_userbutton (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf("NOT pressed.\n");
}
- omap_free_gpio(gpio);
+ gpio_free(gpio);
return !button;
}
diff --git a/board/ti/beagle/led.c b/board/ti/beagle/led.c
index f08c08a..1779242 100644
--- a/board/ti/beagle/led.c
+++ b/board/ti/beagle/led.c
@@ -22,7 +22,7 @@
#include <asm/arch/cpu.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
-#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
/* GPIO pins for the LEDs */
#define BEAGLE_LED_USR0 150
@@ -57,10 +57,10 @@ void __led_toggle (led_id_t mask)
toggle_gpio = BEAGLE_LED_USR1;
#endif
if (toggle_gpio) {
- if (!omap_request_gpio(toggle_gpio)) {
- omap_set_gpio_direction(toggle_gpio, 0);
- state = omap_get_gpio_dataout(toggle_gpio);
- omap_set_gpio_dataout(toggle_gpio, !state);
+ if (!gpio_request(toggle_gpio, "")) {
+ gpio_direction_output(toggle_gpio, 0);
+ state = gpio_get_value(toggle_gpio);
+ gpio_set_value(toggle_gpio, !state);
}
}
}
@@ -69,17 +69,17 @@ void __led_set (led_id_t mask, int state)
{
#ifdef STATUS_LED_BIT
if (STATUS_LED_BIT & mask) {
- if (!omap_request_gpio(BEAGLE_LED_USR0)) {
- omap_set_gpio_direction(BEAGLE_LED_USR0, 0);
- omap_set_gpio_dataout(BEAGLE_LED_USR0, state);
+ if (!gpio_request(BEAGLE_LED_USR0, "")) {
+ gpio_direction_output(BEAGLE_LED_USR0, 0);
+ gpio_set_value(BEAGLE_LED_USR0, state);
}
}
#endif
#ifdef STATUS_LED_BIT1
if (STATUS_LED_BIT1 & mask) {
- if (!omap_request_gpio(BEAGLE_LED_USR1)) {
- omap_set_gpio_direction(BEAGLE_LED_USR1, 0);
- omap_set_gpio_dataout(BEAGLE_LED_USR1, state);
+ if (!gpio_request(BEAGLE_LED_USR1, "")) {
+ gpio_direction_output(BEAGLE_LED_USR1, 0);
+ gpio_set_value(BEAGLE_LED_USR1, state);
}
}
#endif