]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/atmel/at91rm9200ek/led.c
3 * Atmel Nordic AB <www.atmel.com>
4 * Ulf Samuelsson <ulf@atmel.com>
7 * Andreas Bießmann <andreas@biessmann.org>
9 * SPDX-License-Identifier: GPL-2.0+
14 #include <asm/arch/hardware.h>
15 #include <asm/arch/clk.h>
16 #include <asm/arch/at91_pio.h>
17 #include <status_led.h>
19 /* bit mask in PIO port B */
20 #define GREEN_LED (1<<0)
21 #define YELLOW_LED (1<<1)
22 #define RED_LED (1<<2)
24 void green_led_on(void)
26 at91_pio_t
*pio
= (at91_pio_t
*)ATMEL_BASE_PIO
;
27 writel(GREEN_LED
, &pio
->piob
.codr
);
30 void yellow_led_on(void)
32 at91_pio_t
*pio
= (at91_pio_t
*)ATMEL_BASE_PIO
;
33 writel(YELLOW_LED
, &pio
->piob
.codr
);
38 at91_pio_t
*pio
= (at91_pio_t
*)ATMEL_BASE_PIO
;
39 writel(RED_LED
, &pio
->piob
.codr
);
42 void green_led_off(void)
44 at91_pio_t
*pio
= (at91_pio_t
*)ATMEL_BASE_PIO
;
45 writel(GREEN_LED
, &pio
->piob
.sodr
);
48 void yellow_led_off(void)
50 at91_pio_t
*pio
= (at91_pio_t
*)ATMEL_BASE_PIO
;
51 writel(YELLOW_LED
, &pio
->piob
.sodr
);
54 void red_led_off(void)
56 at91_pio_t
*pio
= (at91_pio_t
*)ATMEL_BASE_PIO
;
57 writel(RED_LED
, &pio
->piob
.sodr
);
60 void coloured_LED_init (void)
62 at91_pio_t
*pio
= (at91_pio_t
*)ATMEL_BASE_PIO
;
64 at91_periph_clk_enable(ATMEL_ID_PIOB
);
66 /* Disable peripherals on LEDs */
67 writel(GREEN_LED
| YELLOW_LED
| RED_LED
, &pio
->piob
.per
);
68 /* Enable pins as outputs */
69 writel(GREEN_LED
| YELLOW_LED
| RED_LED
, &pio
->piob
.oer
);
70 /* Turn all LEDs OFF */
71 writel(GREEN_LED
| YELLOW_LED
| RED_LED
, &pio
->piob
.sodr
);