Path: blob/master/arch/arm/mach-lpc32xx/include/mach/gpio.h
10820 views
/*1* arch/arm/mach-lpc32xx/include/mach/gpio.h2*3* Author: Kevin Wells <[email protected]>4*5* Copyright (C) 2010 NXP Semiconductors6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License as published by9* the Free Software Foundation; either version 2 of the License, or10* (at your option) any later version.11*12* This program is distributed in the hope that it will be useful,13* but WITHOUT ANY WARRANTY; without even the implied warranty of14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15* GNU General Public License for more details.16*/1718#ifndef __ASM_ARCH_GPIO_H19#define __ASM_ARCH_GPIO_H2021#include <asm-generic/gpio.h>2223/*24* Note!25* Muxed GP pins need to be setup to the GP state in the board level26* code prior to using this driver.27* GPI pins : 28xP3 group28* GPO pins : 24xP3 group29* GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group30*/3132#define LPC32XX_GPIO_P0_MAX 833#define LPC32XX_GPIO_P1_MAX 2434#define LPC32XX_GPIO_P2_MAX 1335#define LPC32XX_GPIO_P3_MAX 636#define LPC32XX_GPI_P3_MAX 2837#define LPC32XX_GPO_P3_MAX 243839#define LPC32XX_GPIO_P0_GRP 040#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)41#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)42#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)43#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)44#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)4546/*47* A specific GPIO can be selected with this macro48* ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)49* See the LPC32x0 User's guide for GPIO group numbers50*/51#define LPC32XX_GPIO(x, y) ((x) + (y))5253static inline int gpio_get_value(unsigned gpio)54{55return __gpio_get_value(gpio);56}5758static inline void gpio_set_value(unsigned gpio, int value)59{60__gpio_set_value(gpio, value);61}6263static inline int gpio_cansleep(unsigned gpio)64{65return __gpio_cansleep(gpio);66}6768static inline int gpio_to_irq(unsigned gpio)69{70return __gpio_to_irq(gpio);71}7273#endif747576