From e91d54535f8535c6de05044fa6f715a78f4320f8 Mon Sep 17 00:00:00 2001 From: Thomas Chou Date: Fri, 24 Dec 2010 15:19:44 +0800 Subject: nios2: add gpio_free Signed-off-by: Thomas Chou Signed-off-by: Scott McNutt --- arch/nios2/include/asm/gpio.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch') diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h index cff1dd9..36a7132 100644 --- a/arch/nios2/include/asm/gpio.h +++ b/arch/nios2/include/asm/gpio.h @@ -26,6 +26,11 @@ static inline int gpio_request(unsigned gpio, const char *label) return 0; } +static inline int gpio_free(unsigned gpio) +{ + return 0; +} + static inline int gpio_direction_input(unsigned gpio) { writel(1, CONFIG_SYS_GPIO_BASE + (gpio << 2)); @@ -49,6 +54,7 @@ static inline void gpio_set_value(unsigned gpio, int value) } #else extern int gpio_request(unsigned gpio, const char *label); +extern int gpio_free(unsigned gpio); extern int gpio_direction_input(unsigned gpio); extern int gpio_direction_output(unsigned gpio, int value); extern int gpio_get_value(unsigned gpio); -- cgit v1.1 From 85debefaf2d3d0dea800fa84bfe0e9823bc03d89 Mon Sep 17 00:00:00 2001 From: Thomas Chou Date: Mon, 27 Dec 2010 10:45:34 +0800 Subject: nios2: use long for ssize_t This is consistent with nios2-linux. And resolved the warning, cmd_nvedit.c: In function `do_env_export': cmd_nvedit.c:660: warning: size_t format, ssize_t arg (arg 3) Signed-off-by: Thomas Chou Signed-off-by: Scott McNutt --- arch/nios2/include/asm/posix_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/nios2/include/asm/posix_types.h b/arch/nios2/include/asm/posix_types.h index c2deea6..6733640 100644 --- a/arch/nios2/include/asm/posix_types.h +++ b/arch/nios2/include/asm/posix_types.h @@ -17,7 +17,7 @@ typedef unsigned short __kernel_ipc_pid_t; typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; typedef unsigned long __kernel_size_t; -typedef int __kernel_ssize_t; +typedef long __kernel_ssize_t; typedef int __kernel_ptrdiff_t; typedef long __kernel_time_t; typedef long __kernel_suseconds_t; -- cgit v1.1 From d8a593c68bac7b9d9b26af6fa8c392671213ce93 Mon Sep 17 00:00:00 2001 From: Thomas Chou Date: Mon, 27 Dec 2010 10:46:01 +0800 Subject: nios2: add gpio_is_valid Signed-off-by: Thomas Chou Signed-off-by: Scott McNutt --- arch/nios2/include/asm/gpio.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'arch') diff --git a/arch/nios2/include/asm/gpio.h b/arch/nios2/include/asm/gpio.h index 36a7132..4b21c8f 100644 --- a/arch/nios2/include/asm/gpio.h +++ b/arch/nios2/include/asm/gpio.h @@ -52,6 +52,11 @@ static inline void gpio_set_value(unsigned gpio, int value) { writel(value ? 3 : 2, CONFIG_SYS_GPIO_BASE + (gpio << 2)); } + +static inline int gpio_is_valid(int number) +{ + return ((unsigned)number) < CONFIG_SYS_GPIO_WIDTH; +} #else extern int gpio_request(unsigned gpio, const char *label); extern int gpio_free(unsigned gpio); @@ -59,6 +64,7 @@ extern int gpio_direction_input(unsigned gpio); extern int gpio_direction_output(unsigned gpio, int value); extern int gpio_get_value(unsigned gpio); extern void gpio_set_value(unsigned gpio, int value); +extern int gpio_is_valid(int number); #endif /* CONFIG_SYS_GPIO_BASE */ #endif /* _ASM_NIOS2_GPIO_H_ */ -- cgit v1.1