From dd37bf9a51e9a03799829bbe081dc45162ceb186 Mon Sep 17 00:00:00 2001 From: Yacine Belkadi Date: Thu, 8 Mar 2012 15:30:24 +0100 Subject: polux/{include,linux}/mse500: update gpio_init() and gpio_write(), refs #2965 Note: - GPIO 0 is no longer used, because the reset is done differently on MSE500. - GPIO 1 is no longer used, because the watchdog is internal on MSE500. --- polux/linux-2.6.10/arch/arm/mach-mse500/gpio.c | 27 +++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'polux/linux-2.6.10') diff --git a/polux/linux-2.6.10/arch/arm/mach-mse500/gpio.c b/polux/linux-2.6.10/arch/arm/mach-mse500/gpio.c index 80e6dbabe4..18a06721b1 100644 --- a/polux/linux-2.6.10/arch/arm/mach-mse500/gpio.c +++ b/polux/linux-2.6.10/arch/arm/mach-mse500/gpio.c @@ -20,6 +20,7 @@ */ #include +#include "asm/arch/gpio.h" #include "platform.h" #include "gpio_event.h" @@ -34,17 +35,15 @@ char gpio_map[GPIO_EVENT_MAX]; void mse500_init_gpio(void) { //Config GPIOs - CSP_PIO_SET_ECR((CSP_PIO_PTR)CSP_PIO_BASE, 0x01); // enable CLK - CSP_PIO_SET_PER((CSP_PIO_PTR)CSP_PIO_BASE, 0xFF); // driven by PIO - CSP_PIO_SET_MDDR((CSP_PIO_PTR)CSP_PIO_BASE, 0xFF); // not Open Drain - CSP_PIO_SET_SODR((CSP_PIO_PTR)CSP_PIO_BASE, (unsigned int)(1<<0)); //put to 1 the software reset - CSP_PIO_SET_OER((CSP_PIO_PTR)CSP_PIO_BASE, 0x83); // 0 = RESET (output) - // 1 = Watch-Dog (output) - // 7 = Plc-System LED (output) - CSP_PIO_SET_ODR((CSP_PIO_PTR)CSP_PIO_BASE, 0x7C); // 6 = Safe-return (input) - // others are in input - CSP_PIO_SET_IDR((CSP_PIO_PTR)CSP_PIO_BASE, 0xFF); // no interrupts + GPIO_SWPORTA_CTL_VA = 0; // driven by PIO + GPIO_SWPORTA_DR_VA = 0; // set all values to 0 + + GPIO_SWPORTA_DDR_VA = 0; // input by default + GPIO_SWPORTA_DDR_VA &= ~(1 << GPIO_IN_SAFE_RETURN); + GPIO_SWPORTA_DDR_VA |= (1 << GPIO_OUT_PLC_SYSTEM_LED); + + GPIO_INTEN_VA = 0; // no interrupts memset(gpio_map, GPIO_NOT_MAPPED, sizeof(gpio_map)); @@ -63,10 +62,10 @@ int gpio_write(int no, int value) if ((no > 7) || (value > 1)) return -1; - if(value) - CSP_PIO_SET_SODR((CSP_PIO_PTR)CSP_PIO_BASE, (unsigned int)(1<