Magnus Damm | 7fdda67 | 2010-02-10 20:10:55 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Generic GPIO API and pinmux table support |
| 3 | * |
| 4 | * Copyright (c) 2008 Magnus Damm |
| 5 | * |
| 6 | * This file is subject to the terms and conditions of the GNU General Public |
| 7 | * License. See the file "COPYING" in the main directory of this archive |
| 8 | * for more details. |
| 9 | */ |
| 10 | #ifndef __ASM_ARCH_GPIO_H |
| 11 | #define __ASM_ARCH_GPIO_H |
| 12 | |
| 13 | #include <linux/kernel.h> |
| 14 | #include <linux/errno.h> |
Kuninori Morimoto | 4f3d7f6 | 2012-06-25 03:41:09 -0700 | [diff] [blame] | 15 | #include <linux/io.h> |
Magnus Damm | 7fdda67 | 2010-02-10 20:10:55 +0900 | [diff] [blame] | 16 | |
Kuninori Morimoto | 4f3d7f6 | 2012-06-25 03:41:09 -0700 | [diff] [blame] | 17 | /* |
| 18 | * FIXME !! |
| 19 | * |
| 20 | * current gpio frame work doesn't have |
| 21 | * the method to control only pull up/down/free. |
| 22 | * this function should be replaced by correct gpio function |
| 23 | */ |
Arnd Bergmann | 0a4b04d | 2012-09-14 20:08:08 +0000 | [diff] [blame] | 24 | static inline void __init gpio_direction_none(void __iomem * addr) |
Kuninori Morimoto | 4f3d7f6 | 2012-06-25 03:41:09 -0700 | [diff] [blame] | 25 | { |
| 26 | __raw_writeb(0x00, addr); |
| 27 | } |
| 28 | |
Arnd Bergmann | 0a4b04d | 2012-09-14 20:08:08 +0000 | [diff] [blame] | 29 | static inline void __init gpio_request_pullup(void __iomem * addr) |
Kuninori Morimoto | 4f3d7f6 | 2012-06-25 03:41:09 -0700 | [diff] [blame] | 30 | { |
| 31 | u8 data = __raw_readb(addr); |
| 32 | |
| 33 | data &= 0x0F; |
| 34 | data |= 0xC0; |
| 35 | __raw_writeb(data, addr); |
| 36 | } |
| 37 | |
Arnd Bergmann | 0a4b04d | 2012-09-14 20:08:08 +0000 | [diff] [blame] | 38 | static inline void __init gpio_request_pulldown(void __iomem * addr) |
Kuninori Morimoto | 4f3d7f6 | 2012-06-25 03:41:09 -0700 | [diff] [blame] | 39 | { |
| 40 | u8 data = __raw_readb(addr); |
| 41 | |
| 42 | data &= 0x0F; |
| 43 | data |= 0xA0; |
| 44 | |
| 45 | __raw_writeb(data, addr); |
| 46 | } |
| 47 | |
Magnus Damm | 7fdda67 | 2010-02-10 20:10:55 +0900 | [diff] [blame] | 48 | #endif /* __ASM_ARCH_GPIO_H */ |