Path: blob/master/arch/arm/mach-ixp2000/include/mach/gpio.h
10820 views
/*1* arch/arm/mach-ixp2000/include/mach/gpio.h2*3* Copyright (C) 2002 Intel Corporation.4*5* This program is free software, you can redistribute it and/or modify6* it under the terms of the GNU General Public License version 2 as7* published by the Free Software Foundation.8*/910/*11* IXP2000 GPIO in/out, edge/level detection for IRQs:12* IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High13* or both Falling-edge and Rising-edge.14* This must be called *before* the corresponding IRQ is registerd.15* Use this instead of directly setting the GPIO registers.16* GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb)17*/18#ifndef __ASM_ARCH_GPIO_H19#define __ASM_ARCH_GPIO_H2021#ifndef __ASSEMBLY__2223#define GPIO_IN 024#define GPIO_OUT 12526#define IXP2000_GPIO_LOW 027#define IXP2000_GPIO_HIGH 12829extern void gpio_line_config(int line, int direction);3031static inline int gpio_line_get(int line)32{33return (((*IXP2000_GPIO_PLR) >> line) & 1);34}3536static inline void gpio_line_set(int line, int value)37{38if (value == IXP2000_GPIO_HIGH) {39ixp2000_reg_write(IXP2000_GPIO_POSR, 1 << line);40} else if (value == IXP2000_GPIO_LOW) {41ixp2000_reg_write(IXP2000_GPIO_POCR, 1 << line);42}43}4445#endif /* !__ASSEMBLY__ */4647#endif /* ASM_ARCH_IXP2000_GPIO_H_ */484950