From patchwork Tue Aug 30 19:52:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjeev Premi X-Patchwork-Id: 112380 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id DF6C6B6F7D for ; Wed, 31 Aug 2011 05:54:15 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F1C85280AD; Tue, 30 Aug 2011 21:54:07 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id b5br06g0vZNn; Tue, 30 Aug 2011 21:54:07 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4A240280AE; Tue, 30 Aug 2011 21:53:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9B7D028093 for ; Tue, 30 Aug 2011 21:53:53 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sDOTvgw95INN for ; Tue, 30 Aug 2011 21:53:51 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by theia.denx.de (Postfix) with ESMTPS id 4335F2808A for ; Tue, 30 Aug 2011 21:53:41 +0200 (CEST) Received: from dbdp20.itg.ti.com ([172.24.170.38]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id p7UJrDwG012513 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Aug 2011 14:53:15 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p7UJrD42027271; Wed, 31 Aug 2011 01:23:13 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 8.3.106.1; Wed, 31 Aug 2011 01:23:13 +0530 Received: from psplinux050.india.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p7UJqsol028753; Wed, 31 Aug 2011 01:23:12 +0530 (IST) From: Sanjeev Premi To: Date: Wed, 31 Aug 2011 01:22:34 +0530 Message-ID: <1314733954-29576-4-git-send-email-premi@ti.com> X-Mailer: git-send-email 1.7.2.2 In-Reply-To: <1314733954-29576-1-git-send-email-premi@ti.com> References: <1314733954-29576-1-git-send-email-premi@ti.com> MIME-Version: 1.0 Cc: Nishanth Menon , Igor@theia.denx.de, Steve Sakoman , Shashi Ranjan , Sunil Kumar , Luca Ceresoli Subject: [U-Boot] [PATCH 3/3] omap: gpio: Adapt board files to use generic API X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch contains updates the sources in the board files to use the generic API. Signed-off-by: Sanjeev Premi Cc: Sandeep Paulraj Cc: Igor Grinberg Cc: Luca Ceresoli Cc: Enric Balletbo i Serra Cc: Sunil Kumar Cc: Shashi Ranjan Cc: Nishanth Menon Cc: Steve Sakoman --- All changes in this patch were done vis script contained in 0/0 of this RFC. Have been able to build for OMAP3EVM so far. Will have to wait until FRI to test. board/cm_t35/leds.c | 4 +- board/comelit/dig297/dig297.c | 10 +++--- board/isee/igep0020/igep0020.c | 10 +++--- board/logicpd/zoom2/debug_board.c | 8 +++--- board/logicpd/zoom2/led.c | 36 +++++++++++++------------- board/logicpd/zoom2/zoom2.c | 8 +++--- board/overo/overo.c | 52 ++++++++++++++++++------------------ board/ti/beagle/beagle.c | 34 ++++++++++++------------ board/ti/beagle/led.c | 12 ++++---- board/ti/evm/evm.c | 12 ++++---- 10 files changed, 93 insertions(+), 93 deletions(-) diff --git a/board/cm_t35/leds.c b/board/cm_t35/leds.c index 71c5b0d..ae76d09 100644 --- a/board/cm_t35/leds.c +++ b/board/cm_t35/leds.c @@ -36,10 +36,10 @@ void __led_init(led_id_t mask, int state) void __led_set(led_id_t mask, int state) { - omap_set_gpio_dataout(leds[mask], state == STATUS_LED_ON); + gpio_set_value(leds[mask], state == STATUS_LED_ON); } void __led_toggle(led_id_t mask) { - omap_set_gpio_dataout(leds[mask], !omap_get_gpio_datain(leds[mask])); + gpio_set_value(leds[mask], !gpio_get_value(leds[mask])); } diff --git a/board/comelit/dig297/dig297.c b/board/comelit/dig297/dig297.c index 0062f12..4628554 100644 --- a/board/comelit/dig297/dig297.c +++ b/board/comelit/dig297/dig297.c @@ -168,13 +168,13 @@ static void setup_net_chip(void) &ctrl_base->gpmc_nadv_ale); /* Make GPIO 12 as output pin and send a magic pulse through it */ - if (!omap_request_gpio(NET_LAN9221_RESET_GPIO)) { - omap_set_gpio_direction(NET_LAN9221_RESET_GPIO, 0); - omap_set_gpio_dataout(NET_LAN9221_RESET_GPIO, 1); + if (!gpio_request(NET_LAN9221_RESET_GPIO, "")) { + gpio_direction_output(NET_LAN9221_RESET_GPIO); + gpio_set_value(NET_LAN9221_RESET_GPIO, 1); udelay(1); - omap_set_gpio_dataout(NET_LAN9221_RESET_GPIO, 0); + gpio_set_value(NET_LAN9221_RESET_GPIO, 0); udelay(31000); /* Should be >= 30ms according to datasheet */ - omap_set_gpio_dataout(NET_LAN9221_RESET_GPIO, 1); + gpio_set_value(NET_LAN9221_RESET_GPIO, 1); } } #endif /* CONFIG_CMD_NET */ diff --git a/board/isee/igep0020/igep0020.c b/board/isee/igep0020/igep0020.c index 36cc924..52008d1 100644 --- a/board/isee/igep0020/igep0020.c +++ b/board/isee/igep0020/igep0020.c @@ -81,13 +81,13 @@ static void setup_net_chip(void) &ctrl_base->gpmc_nadv_ale); /* Make GPIO 64 as output pin and send a magic pulse through it */ - if (!omap_request_gpio(64)) { - omap_set_gpio_direction(64, 0); - omap_set_gpio_dataout(64, 1); + if (!gpio_request(64, "")) { + gpio_direction_output(64); + gpio_set_value(64, 1); udelay(1); - omap_set_gpio_dataout(64, 0); + gpio_set_value(64, 0); udelay(1); - omap_set_gpio_dataout(64, 1); + gpio_set_value(64, 1); } } #endif diff --git a/board/logicpd/zoom2/debug_board.c b/board/logicpd/zoom2/debug_board.c index a4ddf29..0bb6576 100644 --- a/board/logicpd/zoom2/debug_board.c +++ b/board/logicpd/zoom2/debug_board.c @@ -33,14 +33,14 @@ static void zoom2_debug_board_detect (void) { int val = 0; - if (!omap_request_gpio(158)) { + if (!gpio_request(158, "")) { /* * GPIO to query for debug board * 158 db board query */ - omap_set_gpio_direction(158, 1); - val = omap_get_gpio_datain(158); - omap_free_gpio(158); + gpio_direction_input(158); + val = gpio_get_value(158); + gpio_free(158); } if (!val) diff --git a/board/logicpd/zoom2/led.c b/board/logicpd/zoom2/led.c index 4e14c58..6704152 100644 --- a/board/logicpd/zoom2/led.c +++ b/board/logicpd/zoom2/led.c @@ -39,9 +39,9 @@ static unsigned int saved_state[2] = {STATUS_LED_OFF, STATUS_LED_OFF}; void red_LED_off (void) { /* red */ - if (!omap_request_gpio(ZOOM2_LED_RED)) { - omap_set_gpio_direction(ZOOM2_LED_RED, 0); - omap_set_gpio_dataout(ZOOM2_LED_RED, 0); + if (!gpio_request(ZOOM2_LED_RED, "")) { + gpio_direction_output(ZOOM2_LED_RED); + gpio_set_value(ZOOM2_LED_RED, 0); } saved_state[STATUS_LED_RED] = STATUS_LED_OFF; } @@ -49,15 +49,15 @@ void red_LED_off (void) void blue_LED_off (void) { /* blue */ - if (!omap_request_gpio(ZOOM2_LED_BLUE)) { - omap_set_gpio_direction(ZOOM2_LED_BLUE, 0); - omap_set_gpio_dataout(ZOOM2_LED_BLUE, 0); + if (!gpio_request(ZOOM2_LED_BLUE, "")) { + gpio_direction_output(ZOOM2_LED_BLUE); + gpio_set_value(ZOOM2_LED_BLUE, 0); } /* blue 2 */ - if (!omap_request_gpio(ZOOM2_LED_BLUE2)) { - omap_set_gpio_direction(ZOOM2_LED_BLUE2, 0); - omap_set_gpio_dataout(ZOOM2_LED_BLUE2, 0); + if (!gpio_request(ZOOM2_LED_BLUE2, "")) { + gpio_direction_output(ZOOM2_LED_BLUE2); + gpio_set_value(ZOOM2_LED_BLUE2, 0); } saved_state[STATUS_LED_BLUE] = STATUS_LED_OFF; } @@ -67,9 +67,9 @@ void red_LED_on (void) blue_LED_off (); /* red */ - if (!omap_request_gpio(ZOOM2_LED_RED)) { - omap_set_gpio_direction(ZOOM2_LED_RED, 0); - omap_set_gpio_dataout(ZOOM2_LED_RED, 1); + if (!gpio_request(ZOOM2_LED_RED, "")) { + gpio_direction_output(ZOOM2_LED_RED); + gpio_set_value(ZOOM2_LED_RED, 1); } saved_state[STATUS_LED_RED] = STATUS_LED_ON; } @@ -79,15 +79,15 @@ void blue_LED_on (void) red_LED_off (); /* blue */ - if (!omap_request_gpio(ZOOM2_LED_BLUE)) { - omap_set_gpio_direction(ZOOM2_LED_BLUE, 0); - omap_set_gpio_dataout(ZOOM2_LED_BLUE, 1); + if (!gpio_request(ZOOM2_LED_BLUE, "")) { + gpio_direction_output(ZOOM2_LED_BLUE); + gpio_set_value(ZOOM2_LED_BLUE, 1); } /* blue 2 */ - if (!omap_request_gpio(ZOOM2_LED_BLUE2)) { - omap_set_gpio_direction(ZOOM2_LED_BLUE2, 0); - omap_set_gpio_dataout(ZOOM2_LED_BLUE2, 1); + if (!gpio_request(ZOOM2_LED_BLUE2, "")) { + gpio_direction_output(ZOOM2_LED_BLUE2); + gpio_set_value(ZOOM2_LED_BLUE2, 1); } saved_state[STATUS_LED_BLUE] = STATUS_LED_ON; diff --git a/board/logicpd/zoom2/zoom2.c b/board/logicpd/zoom2/zoom2.c index 76793e4..6cb240b 100644 --- a/board/logicpd/zoom2/zoom2.c +++ b/board/logicpd/zoom2/zoom2.c @@ -89,12 +89,12 @@ void zoom2_identify(void) * and they are not commonly used. They are mentioned here * only for completeness. */ - if (!omap_request_gpio(94)) { + if (!gpio_request(94, "")) { unsigned int val; - omap_set_gpio_direction(94, 1); - val = omap_get_gpio_datain(94); - omap_free_gpio(94); + gpio_direction_input(94); + val = gpio_get_value(94); + gpio_free(94); if (val) revision = ZOOM2_REVISION_BETA; diff --git a/board/overo/overo.c b/board/overo/overo.c index 4eafdb1..8481791 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -106,21 +106,21 @@ int get_board_revision(void) { int revision; - if (!omap_request_gpio(112) && - !omap_request_gpio(113) && - !omap_request_gpio(115)) { + if (!gpio_request(112, "") && + !gpio_request(113, "") && + !gpio_request(115, "")) { - omap_set_gpio_direction(112, 1); - omap_set_gpio_direction(113, 1); - omap_set_gpio_direction(115, 1); + gpio_direction_input(112); + gpio_direction_input(113); + gpio_direction_input(115); - revision = omap_get_gpio_datain(115) << 2 | - omap_get_gpio_datain(113) << 1 | - omap_get_gpio_datain(112); + revision = gpio_get_value(115) << 2 | + gpio_get_value(113) << 1 | + gpio_get_value(112); - omap_free_gpio(112); - omap_free_gpio(113); - omap_free_gpio(115); + gpio_free(112); + gpio_free(113); + gpio_free(115); } else { printf("Error: unable to acquire board revision GPIOs\n"); revision = -1; @@ -139,21 +139,21 @@ int get_sdio2_config(void) { int sdio_direct; - if (!omap_request_gpio(130) && !omap_request_gpio(139)) { + if (!gpio_request(130, "") && !gpio_request(139, "")) { - omap_set_gpio_direction(130, 0); - omap_set_gpio_direction(139, 1); + gpio_direction_output(130); + gpio_direction_input(139); sdio_direct = 1; - omap_set_gpio_dataout(130, 0); - if (omap_get_gpio_datain(139) == 0) { - omap_set_gpio_dataout(130, 1); - if (omap_get_gpio_datain(139) == 1) + gpio_set_value(130, 0); + if (gpio_get_value(139) == 0) { + gpio_set_value(130, 1); + if (gpio_get_value(139) == 1) sdio_direct = 0; } - omap_free_gpio(130); - omap_free_gpio(139); + gpio_free(130); + gpio_free(139); } else { printf("Error: unable to acquire sdio2 clk GPIOs\n"); sdio_direct = -1; @@ -322,13 +322,13 @@ static void setup_net_chip(void) &ctrl_base->gpmc_nadv_ale); /* Make GPIO 64 as output pin and send a magic pulse through it */ - if (!omap_request_gpio(64)) { - omap_set_gpio_direction(64, 0); - omap_set_gpio_dataout(64, 1); + if (!gpio_request(64, "")) { + gpio_direction_output(64); + gpio_set_value(64, 1); udelay(1); - omap_set_gpio_dataout(64, 0); + gpio_set_value(64, 0); udelay(1); - omap_set_gpio_dataout(64, 1); + gpio_set_value(64, 1); } } #endif diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c index ab50514..3cf0920 100644 --- a/board/ti/beagle/beagle.c +++ b/board/ti/beagle/beagle.c @@ -115,21 +115,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; @@ -344,7 +344,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); return 0; } @@ -366,9 +366,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); + gpio_set_value(GPIO_PHY_RESET, 0); /* Hold the PHY in RESET for enough time till DIR is high */ /* Refer: ISSUE1 */ @@ -420,7 +420,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); diff --git a/board/ti/beagle/led.c b/board/ti/beagle/led.c index 08f95a0..4b24b73 100644 --- a/board/ti/beagle/led.c +++ b/board/ti/beagle/led.c @@ -71,18 +71,18 @@ 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); + gpio_set_value(BEAGLE_LED_USR0, state); } saved_state[0] = 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); + gpio_set_value(BEAGLE_LED_USR1, state); } saved_state[1] = state; } diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c index 30c1c57..bb50c10 100644 --- a/board/ti/evm/evm.c +++ b/board/ti/evm/evm.c @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include #include #include "evm.h" @@ -195,21 +195,21 @@ static void reset_net_chip(void) rst_gpio = OMAP3EVM_GPIO_ETH_RST_GEN2; } - ret = omap_request_gpio(rst_gpio); + ret = gpio_request(rst_gpio, ""); if (ret < 0) { printf("Unable to get GPIO %d\n", rst_gpio); return ; } /* Configure as output */ - omap_set_gpio_direction(rst_gpio, 0); + gpio_direction_output(rst_gpio, 0); /* Send a pulse on the GPIO pin */ - omap_set_gpio_dataout(rst_gpio, 1); + gpio_set_value(rst_gpio, 1); udelay(1); - omap_set_gpio_dataout(rst_gpio, 0); + gpio_set_value(rst_gpio, 0); udelay(1); - omap_set_gpio_dataout(rst_gpio, 1); + gpio_set_value(rst_gpio, 1); } int board_eth_init(bd_t *bis)