From 7b20b7ec5d97ec454f55d457d2043502e2a5bc3d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 7 Mar 2016 17:44:55 -0600 Subject: [PATCH] Sabre-6Quad: Add LED GPIO/IOMUX definitions --- configs/sabre-6quad/README.txt | 4 +++- configs/sabre-6quad/include/board.h | 8 +++++--- configs/sabre-6quad/src/imx_autoleds.c | 6 +++--- configs/sabre-6quad/src/imx_userleds.c | 8 ++++---- configs/sabre-6quad/src/sabre-6quad.h | 14 +++++++++++++- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/configs/sabre-6quad/README.txt b/configs/sabre-6quad/README.txt index 094743db7a..3c5c93b2a4 100644 --- a/configs/sabre-6quad/README.txt +++ b/configs/sabre-6quad/README.txt @@ -142,7 +142,9 @@ LEDs and Buttons LEDs ---- -A single LED is available driven by USR_DEF_RED_LED. +A single LED is available driven GPIO1_IO02. On the schematic this is +USR_DEF_RED_LED signal to pin T1 (GPIO_2). This signal is shared with +KEY_ROW6 (ALT2). A low value illuminates the LED. This LED is not used by the board port unless CONFIG_ARCH_LEDS is defined. In that case, the usage by the board port is defined in diff --git a/configs/sabre-6quad/include/board.h b/configs/sabre-6quad/include/board.h index 5cd8b14af7..68b0d116b0 100644 --- a/configs/sabre-6quad/include/board.h +++ b/configs/sabre-6quad/include/board.h @@ -50,17 +50,19 @@ /* LED definitions ******************************************************************/ /* LEDs * - * A single LED is available driven by USR_DEF_RED_LED. + * A single LED is available driven GPIO1_IO02. On the schematic this is + * USR_DEF_RED_LED signal to pin T1 (GPIO_2). This signal is shared with KEY_ROW6 + * (ALT2). A low value illuminates the LED. */ /* LED index values for use with board_userled() */ -#define BOARD_LED0 0 +#define BOARD_LED 0 #define BOARD_NLEDS 1 /* LED bits for use with board_userled_all() */ -#define BOARD_LED0_BIT (1 << BOARD_LED0) +#define BOARD_LED_BIT (1 << BOARD_LED) /* These LEDs are not used by the board port unless CONFIG_ARCH_LEDS is * defined. In that case, the usage by the board port is defined in diff --git a/configs/sabre-6quad/src/imx_autoleds.c b/configs/sabre-6quad/src/imx_autoleds.c index 5b6a4c9e6c..ce31d0a93e 100644 --- a/configs/sabre-6quad/src/imx_autoleds.c +++ b/configs/sabre-6quad/src/imx_autoleds.c @@ -106,7 +106,7 @@ void board_autoled_initialize(void) { /* Configure LED PIOs for output */ - imx_config_gpio(GPIO_LED0); + imx_config_gpio(GPIO_LED); } /**************************************************************************** @@ -117,7 +117,7 @@ void board_autoled_on(int led) { if (led == 1 || led == 3) { - imx_gpio_write(GPIO_LED0, false); /* Low illuminates */ + imx_gpio_write(GPIO_LED, false); /* Low illuminates */ } } @@ -129,7 +129,7 @@ void board_autoled_off(int led) { if (led == 3) { - imx_gpio_write(GPIO_LED0, true); /* High extinguishes */ + imx_gpio_write(GPIO_LED, true); /* High extinguishes */ } } diff --git a/configs/sabre-6quad/src/imx_userleds.c b/configs/sabre-6quad/src/imx_userleds.c index 4a2e7f3f56..9b977d3d1a 100644 --- a/configs/sabre-6quad/src/imx_userleds.c +++ b/configs/sabre-6quad/src/imx_userleds.c @@ -59,7 +59,7 @@ void board_userled_initialize(void) { /* Configure LED PIOs for output */ - imx_config_gpio(GPIO_LED0); + imx_config_gpio(GPIO_LED); } /**************************************************************************** @@ -68,9 +68,9 @@ void board_userled_initialize(void) void board_userled(int led, bool ledon) { - if (led == BOARD_LED0) + if (led == BOARD_LED) { - imx_gpio_write(GPIO_LED0, !ledon); /* Low illuminates */ + imx_gpio_write(GPIO_LED, !ledon); /* Low illuminates */ } } @@ -82,5 +82,5 @@ void board_userled_all(uint8_t ledset) { /* Low illuminates */ - imx_gpio_write(GPIO_LED0, (ledset & BOARD_LED0_BIT) == 0)); + imx_gpio_write(GPIO_LED, (ledset & BOARD_LED_BIT) == 0)); } diff --git a/configs/sabre-6quad/src/sabre-6quad.h b/configs/sabre-6quad/src/sabre-6quad.h index 776f237691..5ae480d637 100644 --- a/configs/sabre-6quad/src/sabre-6quad.h +++ b/configs/sabre-6quad/src/sabre-6quad.h @@ -44,14 +44,26 @@ #include +#include "imx_gpio.h" +#include "imx_iomuxc.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ /* Configuration ********************************************************************/ /* SABRE-6QUAD GPIO Pin Definitions *************************************************/ +/* LED + * + * A single LED is available driven GPIO1_IO02. On the schematic this is + * USR_DEF_RED_LED signal to pin T1 (GPIO_2). This signal is shared with KEY_ROW6 + * (ALT2). A low value illuminates the LED. + */ -#define GPIO_LED0 0 /* To be provided */ +#define IOMUX_LED (IOMUX_PULL_NONE | IOMUX_CMOS_OUTPUT | IOMUX_DRIVE_40OHM | \ + IOMUX_SPEED_MEDIUM | IOMUX_SLEW_SLOW) +#define GPIO_LED (GPIO_OUTPUT | GPIO_OUTPUT_ONE | GPIO_PORT1 | GPIO_PIN2 | \ + IOMUX_LED) /************************************************************************************ * Public Types