| * Copyright (C) 2010 Thomas Chou <thomas@wytron.com.tw> |
| * Licensed under the GPL-2 or later. |
| #ifndef CONFIG_SYS_GPIO_BASE |
| #define ALTERA_PIO_BASE LED_PIO_BASE |
| #define ALTERA_PIO_DATA (ALTERA_PIO_BASE + 0) |
| #define ALTERA_PIO_DIR (ALTERA_PIO_BASE + 4) |
| int gpio_direction_input(unsigned gpio) |
| writel(pio_dir_reg &= ~mask, ALTERA_PIO_DIR); |
| int gpio_direction_output(unsigned gpio, int value) |
| writel(pio_data_reg, ALTERA_PIO_DATA); |
| writel(pio_dir_reg |= mask, ALTERA_PIO_DIR); |
| int gpio_get_value(unsigned gpio) |
| return (pio_data_reg & mask) ? 1 : 0; |
| return (readl(ALTERA_PIO_DATA) & mask) ? 1 : 0; |
| void gpio_set_value(unsigned gpio, int value) |
| writel(pio_data_reg, ALTERA_PIO_DATA); |