Commit a484b00b86e72ac6da6ee4fce13dbc6b256672fe

Authored by Jean-Christophe PLAGNIOL-VILLARD
1 parent 7ebafb7ec1
Exists in master and in 57 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf-6.6.52-2.2.0, emb_lf_v2022.04, emb_lf_v2023.04, emb_lf_v2024.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

at91sam9/at91cap: move common led management to cpu

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Showing 12 changed files with 122 additions and 188 deletions Side-by-side Diff

board/atmel/at91cap9adk/led.c
... ... @@ -28,51 +28,17 @@
28 28 #include <asm/arch/gpio.h>
29 29 #include <asm/arch/io.h>
30 30  
31   -#define RED_LED AT91_PIN_PC29 /* this is the power led */
32   -#define GREEN_LED AT91_PIN_PA10 /* this is the user1 led */
33   -#define YELLOW_LED AT91_PIN_PA11 /* this is the user1 led */
34   -
35   -void red_LED_on(void)
36   -{
37   - at91_set_gpio_value(RED_LED, 1);
38   -}
39   -
40   -void red_LED_off(void)
41   -{
42   - at91_set_gpio_value(RED_LED, 0);
43   -}
44   -
45   -void green_LED_on(void)
46   -{
47   - at91_set_gpio_value(GREEN_LED, 0);
48   -}
49   -
50   -void green_LED_off(void)
51   -{
52   - at91_set_gpio_value(GREEN_LED, 1);
53   -}
54   -
55   -void yellow_LED_on(void)
56   -{
57   - at91_set_gpio_value(YELLOW_LED, 0);
58   -}
59   -
60   -void yellow_LED_off(void)
61   -{
62   - at91_set_gpio_value(YELLOW_LED, 1);
63   -}
64   -
65 31 void coloured_LED_init(void)
66 32 {
67 33 /* Enable clock */
68 34 at91_sys_write(AT91_PMC_PCER, 1 << AT91CAP9_ID_PIOABCD);
69 35  
70   - at91_set_gpio_output(RED_LED, 1);
71   - at91_set_gpio_output(GREEN_LED, 1);
72   - at91_set_gpio_output(YELLOW_LED, 1);
  36 + at91_set_gpio_output(CONFIG_RED_LED, 1);
  37 + at91_set_gpio_output(CONFIG_GREEN_LED, 1);
  38 + at91_set_gpio_output(CONFIG_YELLOW_LED, 1);
73 39  
74   - at91_set_gpio_output(RED_LED, 0);
75   - at91_set_gpio_output(GREEN_LED, 1);
76   - at91_set_gpio_output(YELLOW_LED, 1);
  40 + at91_set_gpio_output(CONFIG_RED_LED, 0);
  41 + at91_set_gpio_output(CONFIG_GREEN_LED, 1);
  42 + at91_set_gpio_output(CONFIG_YELLOW_LED, 1);
77 43 }
board/atmel/at91sam9260ek/led.c
... ... @@ -28,38 +28,15 @@
28 28 #include <asm/arch/gpio.h>
29 29 #include <asm/arch/io.h>
30 30  
31   -#define RED_LED AT91_PIN_PA9 /* this is the power led */
32   -#define GREEN_LED AT91_PIN_PA6 /* this is the user led */
33   -
34   -void red_LED_on(void)
35   -{
36   - at91_set_gpio_value(RED_LED, 1);
37   -}
38   -
39   -void red_LED_off(void)
40   -{
41   - at91_set_gpio_value(RED_LED, 0);
42   -}
43   -
44   -void green_LED_on(void)
45   -{
46   - at91_set_gpio_value(GREEN_LED, 0);
47   -}
48   -
49   -void green_LED_off(void)
50   -{
51   - at91_set_gpio_value(GREEN_LED, 1);
52   -}
53   -
54 31 void coloured_LED_init(void)
55 32 {
56 33 /* Enable clock */
57 34 at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_PIOA);
58 35  
59   - at91_set_gpio_output(RED_LED, 1);
60   - at91_set_gpio_output(GREEN_LED, 1);
  36 + at91_set_gpio_output(CONFIG_RED_LED, 1);
  37 + at91_set_gpio_output(CONFIG_GREEN_LED, 1);
61 38  
62   - at91_set_gpio_value(RED_LED, 0);
63   - at91_set_gpio_value(GREEN_LED, 1);
  39 + at91_set_gpio_value(CONFIG_RED_LED, 0);
  40 + at91_set_gpio_value(CONFIG_GREEN_LED, 1);
64 41 }
board/atmel/at91sam9261ek/led.c
... ... @@ -28,52 +28,17 @@
28 28 #include <asm/arch/gpio.h>
29 29 #include <asm/arch/io.h>
30 30  
31   -#define RED_LED AT91_PIN_PA23 /* this is the power led */
32   -#define GREEN_LED AT91_PIN_PA13 /* this is the user1 led */
33   -#define YELLOW_LED AT91_PIN_PA14 /* this is the user2 led */
34   -
35   -void red_LED_on(void)
36   -{
37   - at91_set_gpio_value(RED_LED, 1);
38   -}
39   -
40   -void red_LED_off(void)
41   -{
42   - at91_set_gpio_value(RED_LED, 0);
43   -}
44   -
45   -void green_LED_on(void)
46   -{
47   - at91_set_gpio_value(GREEN_LED, 0);
48   -}
49   -
50   -void green_LED_off(void)
51   -{
52   - at91_set_gpio_value(GREEN_LED, 1);
53   -}
54   -
55   -void yellow_LED_on(void)
56   -{
57   - at91_set_gpio_value(YELLOW_LED, 0);
58   -}
59   -
60   -void yellow_LED_off(void)
61   -{
62   - at91_set_gpio_value(YELLOW_LED, 1);
63   -}
64   -
65   -
66 31 void coloured_LED_init(void)
67 32 {
68 33 /* Enable clock */
69 34 at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9261_ID_PIOA);
70 35  
71   - at91_set_gpio_output(RED_LED, 1);
72   - at91_set_gpio_output(GREEN_LED, 1);
73   - at91_set_gpio_output(YELLOW_LED, 1);
  36 + at91_set_gpio_output(CONFIG_RED_LED, 1);
  37 + at91_set_gpio_output(CONFIG_GREEN_LED, 1);
  38 + at91_set_gpio_output(CONFIG_YELLOW_LED, 1);
74 39  
75   - at91_set_gpio_value(RED_LED, 0);
76   - at91_set_gpio_value(GREEN_LED, 1);
77   - at91_set_gpio_value(YELLOW_LED, 1);
  40 + at91_set_gpio_value(CONFIG_RED_LED, 0);
  41 + at91_set_gpio_value(CONFIG_GREEN_LED, 1);
  42 + at91_set_gpio_value(CONFIG_YELLOW_LED, 1);
78 43 }
board/atmel/at91sam9263ek/led.c
... ... @@ -28,52 +28,18 @@
28 28 #include <asm/arch/gpio.h>
29 29 #include <asm/arch/io.h>
30 30  
31   -#define RED_LED AT91_PIN_PB7 /* this is the power led */
32   -#define GREEN_LED AT91_PIN_PB8 /* this is the user1 led */
33   -#define YELLOW_LED AT91_PIN_PC29 /* this is the user2 led */
34   -
35   -void red_LED_on(void)
36   -{
37   - at91_set_gpio_value(RED_LED, 1);
38   -}
39   -
40   -void red_LED_off(void)
41   -{
42   - at91_set_gpio_value(RED_LED, 0);
43   -}
44   -
45   -void green_LED_on(void)
46   -{
47   - at91_set_gpio_value(GREEN_LED, 0);
48   -}
49   -
50   -void green_LED_off(void)
51   -{
52   - at91_set_gpio_value(GREEN_LED, 1);
53   -}
54   -
55   -void yellow_LED_on(void)
56   -{
57   - at91_set_gpio_value(YELLOW_LED, 0);
58   -}
59   -
60   -void yellow_LED_off(void)
61   -{
62   - at91_set_gpio_value(YELLOW_LED, 1);
63   -}
64   -
65 31 void coloured_LED_init(void)
66 32 {
67 33 /* Enable clock */
68 34 at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_PIOB |
69 35 1 << AT91SAM9263_ID_PIOCDE);
70 36  
71   - at91_set_gpio_output(RED_LED, 1);
72   - at91_set_gpio_output(GREEN_LED, 1);
73   - at91_set_gpio_output(YELLOW_LED, 1);
  37 + at91_set_gpio_output(CONFIG_RED_LED, 1);
  38 + at91_set_gpio_output(CONFIG_GREEN_LED, 1);
  39 + at91_set_gpio_output(CONFIG_YELLOW_LED, 1);
74 40  
75   - at91_set_gpio_value(RED_LED, 0);
76   - at91_set_gpio_value(GREEN_LED, 1);
77   - at91_set_gpio_value(YELLOW_LED, 1);
  41 + at91_set_gpio_value(CONFIG_RED_LED, 0);
  42 + at91_set_gpio_value(CONFIG_GREEN_LED, 1);
  43 + at91_set_gpio_value(CONFIG_YELLOW_LED, 1);
78 44 }
board/atmel/at91sam9rlek/led.c
... ... @@ -28,51 +28,17 @@
28 28 #include <asm/arch/gpio.h>
29 29 #include <asm/arch/io.h>
30 30  
31   -#define RED_LED AT91_PIN_PD14 /* this is the power led */
32   -#define GREEN_LED AT91_PIN_PD15 /* this is the user1 led */
33   -#define YELLOW_LED AT91_PIN_PD16 /* this is the user2 led */
34   -
35   -void red_LED_on(void)
36   -{
37   - at91_set_gpio_value(RED_LED, 1);
38   -}
39   -
40   -void red_LED_off(void)
41   -{
42   - at91_set_gpio_value(RED_LED, 0);
43   -}
44   -
45   -void green_LED_on(void)
46   -{
47   - at91_set_gpio_value(GREEN_LED, 0);
48   -}
49   -
50   -void green_LED_off(void)
51   -{
52   - at91_set_gpio_value(GREEN_LED, 1);
53   -}
54   -
55   -void yellow_LED_on(void)
56   -{
57   - at91_set_gpio_value(YELLOW_LED, 0);
58   -}
59   -
60   -void yellow_LED_off(void)
61   -{
62   - at91_set_gpio_value(YELLOW_LED, 1);
63   -}
64   -
65 31 void coloured_LED_init(void)
66 32 {
67 33 /* Enable clock */
68 34 at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9RL_ID_PIOD);
69 35  
70   - at91_set_gpio_output(RED_LED, 1);
71   - at91_set_gpio_output(GREEN_LED, 1);
72   - at91_set_gpio_output(YELLOW_LED, 1);
  36 + at91_set_gpio_output(CONFIG_RED_LED, 1);
  37 + at91_set_gpio_output(CONFIG_GREEN_LED, 1);
  38 + at91_set_gpio_output(CONFIG_YELLOW_LED, 1);
73 39  
74   - at91_set_gpio_value(RED_LED, 0);
75   - at91_set_gpio_value(GREEN_LED, 1);
76   - at91_set_gpio_value(YELLOW_LED, 1);
  40 + at91_set_gpio_value(CONFIG_RED_LED, 0);
  41 + at91_set_gpio_value(CONFIG_GREEN_LED, 1);
  42 + at91_set_gpio_value(CONFIG_YELLOW_LED, 1);
77 43 }
cpu/arm926ejs/at91/Makefile
... ... @@ -45,6 +45,7 @@
45 45 COBJS-y += at91sam9rl_serial.o
46 46 COBJS-$(CONFIG_HAS_DATAFLASH) += at91sam9rl_spi.o
47 47 endif
  48 +COBJS-$(CONFIG_AT91_LED) += led.o
48 49 COBJS-$(CONFIG_HAS_DATAFLASH) += spi.o
49 50 COBJS-y += timer.o
50 51 COBJS-y += usb.o
cpu/arm926ejs/at91/led.c
  1 +/*
  2 + * (C) Copyright 2007-2008
  3 + * Stelian Pop <stelian.pop@leadtechdesign.com>
  4 + * Lead Tech Design <www.leadtechdesign.com>
  5 + *
  6 + * See file CREDITS for list of people who contributed to this
  7 + * project.
  8 + *
  9 + * This program is free software; you can redistribute it and/or
  10 + * modify it under the terms of the GNU General Public License as
  11 + * published by the Free Software Foundation; either version 2 of
  12 + * the License, or (at your option) any later version.
  13 + *
  14 + * This program is distributed in the hope that it will be useful,
  15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17 + * GNU General Public License for more details.
  18 + *
  19 + * You should have received a copy of the GNU General Public License
  20 + * along with this program; if not, write to the Free Software
  21 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22 + * MA 02111-1307 USA
  23 + */
  24 +
  25 +#include <common.h>
  26 +#include <asm/arch/at91_pmc.h>
  27 +#include <asm/arch/gpio.h>
  28 +#include <asm/arch/io.h>
  29 +
  30 +#ifdef CONFIG_RED_LED
  31 +void red_LED_on(void)
  32 +{
  33 + at91_set_gpio_value(CONFIG_RED_LED, 1);
  34 +}
  35 +
  36 +void red_LED_off(void)
  37 +{
  38 + at91_set_gpio_value(CONFIG_RED_LED, 0);
  39 +}
  40 +#endif
  41 +
  42 +#ifdef CONFIG_GREEN_LED
  43 +void green_LED_on(void)
  44 +{
  45 + at91_set_gpio_value(CONFIG_GREEN_LED, 0);
  46 +}
  47 +
  48 +void green_LED_off(void)
  49 +{
  50 + at91_set_gpio_value(CONFIG_GREEN_LED, 1);
  51 +}
  52 +#endif
  53 +
  54 +#ifdef CONFIG_YELLOW_LED
  55 +void yellow_LED_on(void)
  56 +{
  57 + at91_set_gpio_value(CONFIG_YELLOW_LED, 0);
  58 +}
  59 +
  60 +void yellow_LED_off(void)
  61 +{
  62 + at91_set_gpio_value(CONFIG_YELLOW_LED, 1);
  63 +}
  64 +#endif
include/configs/at91cap9adk.h
... ... @@ -70,6 +70,12 @@
70 70 #define CONFIG_ATMEL_LCD_BGR555 1
71 71 #define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
72 72  
  73 +/* LED */
  74 +#define CONFIG_AT91_LED
  75 +#define CONFIG_RED_LED AT91_PIN_PC29 /* this is the power led */
  76 +#define CONFIG_GREEN_LED AT91_PIN_PA10 /* this is the user1 led */
  77 +#define CONFIG_YELLOW_LED AT91_PIN_PA11 /* this is the user1 led */
  78 +
73 79 #define CONFIG_BOOTDELAY 3
74 80  
75 81 /*
include/configs/at91sam9260ek.h
... ... @@ -58,6 +58,11 @@
58 58 #undef CONFIG_USART2
59 59 #define CONFIG_USART3 1 /* USART 3 is DBGU */
60 60  
  61 +/* LED */
  62 +#define CONFIG_AT91_LED
  63 +#define CONFIG_RED_LED AT91_PIN_PA9 /* this is the power led */
  64 +#define CONFIG_GREEN_LED AT91_PIN_PA6 /* this is the user led */
  65 +
61 66 #define CONFIG_BOOTDELAY 3
62 67  
63 68 /*
include/configs/at91sam9261ek.h
... ... @@ -69,6 +69,12 @@
69 69 #define CONFIG_ATMEL_LCD_BGR555 1
70 70 #define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
71 71  
  72 +/* LED */
  73 +#define CONFIG_AT91_LED
  74 +#define CONFIG_RED_LED AT91_PIN_PA23 /* this is the power led */
  75 +#define CONFIG_GREEN_LED AT91_PIN_PA13 /* this is the user1 led */
  76 +#define CONFIG_YELLOW_LED AT91_PIN_PA14 /* this is the user2 led */
  77 +
72 78 #define CONFIG_BOOTDELAY 3
73 79  
74 80 /*
include/configs/at91sam9263ek.h
... ... @@ -70,6 +70,12 @@
70 70 #define CONFIG_ATMEL_LCD_BGR555 1
71 71 #define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
72 72  
  73 +/* LED */
  74 +#define CONFIG_AT91_LED
  75 +#define CONFIG_RED_LED AT91_PIN_PB7 /* this is the power led */
  76 +#define CONFIG_GREEN_LED AT91_PIN_PB8 /* this is the user1 led */
  77 +#define CONFIG_YELLOW_LED AT91_PIN_PC29 /* this is the user2 led */
  78 +
73 79 #define CONFIG_BOOTDELAY 3
74 80  
75 81 /*
include/configs/at91sam9rlek.h
... ... @@ -69,6 +69,12 @@
69 69 #define CONFIG_ATMEL_LCD_RGB565 1
70 70 #define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
71 71  
  72 +/* LED */
  73 +#define CONFIG_AT91_LED
  74 +#define CONFIG_RED_LED AT91_PIN_PD14 /* this is the power led */
  75 +#define CONFIG_GREEN_LED AT91_PIN_PD15 /* this is the user1 led */
  76 +#define CONFIG_YELLOW_LED AT91_PIN_PD16 /* this is the user2 led */
  77 +
72 78 #define CONFIG_BOOTDELAY 3
73 79  
74 80 /*