This patch contains updates the sources in the board files
to use the generic API.
Signed-off-by: Sanjeev Premi <premi@ti.com>
*/
#include <common.h>
#include <status_led.h>
*/
#include <common.h>
#include <status_led.h>
-#include <asm/arch/gpio.h>
static unsigned int leds[] = { GREEN_LED_GPIO };
void __led_init(led_id_t mask, int state)
{
static unsigned int leds[] = { GREEN_LED_GPIO };
void __led_init(led_id_t mask, int state)
{
- if (omap_request_gpio(leds[mask]) != 0) {
+ if (gpio_request(leds[mask], "") != 0) {
printf("%s: failed requesting GPIO%u\n", __func__, leds[mask]);
return;
}
printf("%s: failed requesting GPIO%u\n", __func__, leds[mask]);
return;
}
- omap_set_gpio_direction(leds[mask], 0);
+ gpio_direction_output(leds[mask], 0);
}
void __led_set(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)
{
}
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]));
#include <asm/arch/mux.h>
#include <asm/arch/mem.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/mux.h>
#include <asm/arch/mem.h>
#include <asm/arch/sys_proto.h>
-#include <asm/arch/gpio.h>
#include <asm/mach-types.h>
#include "dig297.h"
#include <asm/mach-types.h>
#include "dig297.h"
&ctrl_base->gpmc_nadv_ale);
/* Make GPIO 12 as output pin and send a magic pulse through it */
&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, 0);
+ gpio_set_value(NET_LAN9221_RESET_GPIO, 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 */
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 */
}
}
#endif /* CONFIG_CMD_NET */
#include <netdev.h>
#include <twl4030.h>
#include <asm/io.h>
#include <netdev.h>
#include <twl4030.h>
#include <asm/io.h>
-#include <asm/arch/gpio.h>
#include <asm/arch/mem.h>
#include <asm/arch/mmc_host_def.h>
#include <asm/arch/mux.h>
#include <asm/arch/mem.h>
#include <asm/arch/mmc_host_def.h>
#include <asm/arch/mux.h>
&ctrl_base->gpmc_nadv_ale);
/* Make GPIO 64 as output pin and send a magic pulse through it */
&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, 0);
+ gpio_set_value(64, 1);
- omap_set_gpio_dataout(64, 0);
- omap_set_gpio_dataout(64, 1);
#include <asm/arch/cpu.h>
#include <asm/io.h>
#include <asm/arch/mux.h>
#include <asm/arch/cpu.h>
#include <asm/io.h>
#include <asm/arch/mux.h>
-#include <asm/arch/gpio.h>
#define DEBUG_BOARD_CONNECTED 1
#define DEBUG_BOARD_NOT_CONNECTED 0
#define DEBUG_BOARD_CONNECTED 1
#define DEBUG_BOARD_NOT_CONNECTED 0
- if (!omap_request_gpio(158)) {
+ if (!gpio_request(158, "")) {
/*
* GPIO to query for debug board
* 158 db board query
*/
/*
* 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);
#include <asm/arch/cpu.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/cpu.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
-#include <asm/arch/gpio.h>
static unsigned int saved_state[2] = {STATUS_LED_OFF, STATUS_LED_OFF};
static unsigned int saved_state[2] = {STATUS_LED_OFF, STATUS_LED_OFF};
void red_LED_off (void)
{
/* red */
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, 0);
+ gpio_set_value(ZOOM2_LED_RED, 0);
}
saved_state[STATUS_LED_RED] = STATUS_LED_OFF;
}
}
saved_state[STATUS_LED_RED] = STATUS_LED_OFF;
}
void blue_LED_off (void)
{
/* blue */
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, 0);
+ gpio_set_value(ZOOM2_LED_BLUE, 0);
- 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, 0);
+ gpio_set_value(ZOOM2_LED_BLUE2, 0);
}
saved_state[STATUS_LED_BLUE] = STATUS_LED_OFF;
}
}
saved_state[STATUS_LED_BLUE] = STATUS_LED_OFF;
}
blue_LED_off ();
/* red */
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, 0);
+ gpio_set_value(ZOOM2_LED_RED, 1);
}
saved_state[STATUS_LED_RED] = STATUS_LED_ON;
}
}
saved_state[STATUS_LED_RED] = STATUS_LED_ON;
}
red_LED_off ();
/* blue */
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, 0);
+ gpio_set_value(ZOOM2_LED_BLUE, 1);
- 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, 0);
+ gpio_set_value(ZOOM2_LED_BLUE2, 1);
}
saved_state[STATUS_LED_BLUE] = STATUS_LED_ON;
}
saved_state[STATUS_LED_BLUE] = STATUS_LED_ON;
#include <twl4030.h>
#include <asm/io.h>
#include <asm/arch/mmc_host_def.h>
#include <twl4030.h>
#include <asm/io.h>
#include <asm/arch/mmc_host_def.h>
-#include <asm/arch/gpio.h>
#include <asm/arch/mem.h>
#include <asm/arch/mux.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/mem.h>
#include <asm/arch/mux.h>
#include <asm/arch/sys_proto.h>
* and they are not commonly used. They are mentioned here
* only for completeness.
*/
* and they are not commonly used. They are mentioned here
* only for completeness.
*/
- if (!omap_request_gpio(94)) {
+ if (!gpio_request(94, "")) {
- 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;
if (val)
revision = ZOOM2_REVISION_BETA;
#include <asm/arch/mux.h>
#include <asm/arch/mem.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/mux.h>
#include <asm/arch/mem.h>
#include <asm/arch/sys_proto.h>
-#include <asm/arch/gpio.h>
#include <asm/mach-types.h>
#include "overo.h"
#include <asm/mach-types.h>
#include "overo.h"
- 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;
} else {
printf("Error: unable to acquire board revision GPIOs\n");
revision = -1;
- 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, 0);
+ gpio_direction_input(139);
- 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)
- 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;
} else {
printf("Error: unable to acquire sdio2 clk GPIOs\n");
sdio_direct = -1;
&ctrl_base->gpmc_nadv_ale);
/* Make GPIO 64 as output pin and send a magic pulse through it */
&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, 0);
+ gpio_set_value(64, 1);
- omap_set_gpio_dataout(64, 0);
- omap_set_gpio_dataout(64, 1);
#include <asm/arch/mmc_host_def.h>
#include <asm/arch/mux.h>
#include <asm/arch/sys_proto.h>
#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/mach-types.h>
#ifdef CONFIG_USB_EHCI
#include <usb.h>
#include <asm/mach-types.h>
#ifdef CONFIG_USB_EHCI
#include <usb.h>
- 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;
} else {
printf("Error: unable to acquire board revision GPIOs\n");
revision = -1;
int ehci_hcd_stop(void)
{
pr_debug("Resetting OMAP3 EHCI\n");
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;
writel(OMAP_UHH_SYSCONFIG_SOFTRESET, OMAP3_UHH_BASE + OMAP_UHH_SYSCONFIG);
/* disable USB clocks */
struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
pr_debug("Initializing OMAP3 ECHI\n");
/* Put the PHY in RESET */
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 */
/* Hold the PHY in RESET for enough time till DIR is high */
/* Refer: ISSUE1 */
* PHY is settled and ready
*/
udelay(10);
* 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);
hccr = (struct ehci_hccr *)(OMAP3_EHCI_BASE);
hcor = (struct ehci_hcor *)(OMAP3_EHCI_BASE + 0x10);
- omap_request_gpio(gpio);
- omap_set_gpio_direction(gpio, 1);
+ gpio_request(gpio, "");
+ gpio_direction_input(gpio);
printf("The user button is currently ");
printf("The user button is currently ");
- if(omap_get_gpio_datain(gpio))
+ if (gpio_get_value(gpio))
{
button = 1;
printf("PRESSED.\n");
{
button = 1;
printf("PRESSED.\n");
printf("NOT pressed.\n");
}
printf("NOT pressed.\n");
}
#include <asm/arch/cpu.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/cpu.h>
#include <asm/io.h>
#include <asm/arch/sys_proto.h>
-#include <asm/arch/gpio.h>
/* GPIO pins for the LEDs */
#define BEAGLE_LED_USR0 150
/* GPIO pins for the LEDs */
#define BEAGLE_LED_USR0 150
toggle_gpio = BEAGLE_LED_USR1;
#endif
if (toggle_gpio) {
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);
{
#ifdef STATUS_LED_BIT
if (STATUS_LED_BIT & mask) {
{
#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) {
}
}
#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);
#include <asm/arch/mux.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/mmc_host_def.h>
#include <asm/arch/mux.h>
#include <asm/arch/sys_proto.h>
#include <asm/arch/mmc_host_def.h>
-#include <asm/arch/gpio.h>
#include <i2c.h>
#include <asm/mach-types.h>
#include "evm.h"
#include <i2c.h>
#include <asm/mach-types.h>
#include "evm.h"
rst_gpio = OMAP3EVM_GPIO_ETH_RST_GEN2;
}
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 */
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 */
/* Send a pulse on the GPIO pin */
- omap_set_gpio_dataout(rst_gpio, 1);
+ gpio_set_value(rst_gpio, 1);
- omap_set_gpio_dataout(rst_gpio, 0);
+ gpio_set_value(rst_gpio, 0);
- omap_set_gpio_dataout(rst_gpio, 1);
+ gpio_set_value(rst_gpio, 1);
}
int board_eth_init(bd_t *bis)
}
int board_eth_init(bd_t *bis)