12783fe69SSylvain Lemieux /* 22783fe69SSylvain Lemieux * LPC32xx GPIO interface macro for pin mapping. 32783fe69SSylvain Lemieux * 42783fe69SSylvain Lemieux * (C) Copyright 2015 DENX Software Engineering GmbH 52783fe69SSylvain Lemieux * Written-by: Sylvain Lemieux <slemieux@@tycoint.com> 62783fe69SSylvain Lemieux * 72783fe69SSylvain Lemieux * SPDX-License-Identifier: GPL-2.0+ 82783fe69SSylvain Lemieux */ 92783fe69SSylvain Lemieux 102783fe69SSylvain Lemieux #ifndef _LPC32XX_GPIO_GRP_H 112783fe69SSylvain Lemieux #define _LPC32XX_GPIO_GRP_H 122783fe69SSylvain Lemieux 132783fe69SSylvain Lemieux /* 142783fe69SSylvain Lemieux * Macro to map the pin for the lpc32xx_gpio driver. 15*89983478SSylvain Lemieux * Note: - GPIOS are considered here as homogeneous and linear from 0 to 159; 162783fe69SSylvain Lemieux * mapping is done per register, as group of 32. 172783fe69SSylvain Lemieux * (see drivers/gpio/lpc32xx_gpio.c for details). 182783fe69SSylvain Lemieux * - macros can be use with the following pins: 192783fe69SSylvain Lemieux * P0.0 - P0.7 202783fe69SSylvain Lemieux * P1.0 - P1.23 212783fe69SSylvain Lemieux * P2.0 - P2.12 222783fe69SSylvain Lemieux * P3 GPI_0 - GPI_9 / GPI_15 - GPI_23 / GPI_25 / GPI_27 - GPI_28 232783fe69SSylvain Lemieux * P3 GPO_0 - GPO_23 242783fe69SSylvain Lemieux * P3 GPIO_0 - GPIO_5 (output register only) 252783fe69SSylvain Lemieux */ 262783fe69SSylvain Lemieux #define LPC32XX_GPIO_P0_GRP 0 272783fe69SSylvain Lemieux #define LPC32XX_GPIO_P1_GRP 32 282783fe69SSylvain Lemieux #define LPC32XX_GPIO_P2_GRP 64 292783fe69SSylvain Lemieux #define LPC32XX_GPO_P3_GRP 96 302783fe69SSylvain Lemieux #define LPC32XX_GPIO_P3_GRP (LPC32XX_GPO_P3_GRP + 25) 31*89983478SSylvain Lemieux #define LPC32XX_GPI_P3_GRP 128 322783fe69SSylvain Lemieux 332783fe69SSylvain Lemieux /* 342783fe69SSylvain Lemieux * A specific GPIO can be selected with this macro 352783fe69SSylvain Lemieux * ie, GPIO P0.1 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P0_GRP, 1) 362783fe69SSylvain Lemieux * See the LPC32x0 User's guide for GPIO group numbers 372783fe69SSylvain Lemieux */ 382783fe69SSylvain Lemieux #define LPC32XX_GPIO(x, y) ((x) + (y)) 392783fe69SSylvain Lemieux 402783fe69SSylvain Lemieux #endif /* _LPC32XX_GPIO_GRP_H */ 41