]> git.sur5r.net Git - u-boot/blob - board/atmel/at91rm9200ek/led.c
led: remove camel casing of led identifiers globally
[u-boot] / board / atmel / at91rm9200ek / led.c
1 /*
2  * (C) Copyright 2006
3  * Atmel Nordic AB <www.atmel.com>
4  * Ulf Samuelsson <ulf@atmel.com>
5  *
6  * (C) Copyright 2010
7  * Andreas Bießmann <andreas.devel@gmail.com>
8  *
9  * See file CREDITS for list of people who contributed to this
10  * project.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License as
14  * published by the Free Software Foundation; either version 2 of
15  * the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25  * MA 02111-1307 USA
26  */
27
28 #include <common.h>
29 #include <asm/io.h>
30 #include <asm/arch/hardware.h>
31 #include <asm/arch/at91_pmc.h>
32 #include <asm/arch/at91_pio.h>
33
34 /* bit mask in PIO port B */
35 #define GREEN_LED       (1<<0)
36 #define YELLOW_LED      (1<<1)
37 #define RED_LED         (1<<2)
38
39 void    green_led_on(void)
40 {
41         at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
42         writel(GREEN_LED, &pio->piob.codr);
43 }
44
45 void     yellow_led_on(void)
46 {
47         at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
48         writel(YELLOW_LED, &pio->piob.codr);
49 }
50
51 void     red_led_on(void)
52 {
53         at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
54         writel(RED_LED, &pio->piob.codr);
55 }
56
57 void    green_led_off(void)
58 {
59         at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
60         writel(GREEN_LED, &pio->piob.sodr);
61 }
62
63 void    yellow_led_off(void)
64 {
65         at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
66         writel(YELLOW_LED, &pio->piob.sodr);
67 }
68
69 void    red_led_off(void)
70 {
71         at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
72         writel(RED_LED, &pio->piob.sodr);
73 }
74
75 void coloured_LED_init (void)
76 {
77         at91_pmc_t *pmc = (at91_pmc_t *)ATMEL_BASE_PMC;
78         at91_pio_t *pio = (at91_pio_t *)ATMEL_BASE_PIO;
79
80         /* Enable PIOB clock */
81         writel(1 << ATMEL_ID_PIOB, &pmc->pcer);
82
83         /* Disable peripherals on LEDs */
84         writel(GREEN_LED | YELLOW_LED | RED_LED, &pio->piob.per);
85         /* Enable pins as outputs */
86         writel(GREEN_LED | YELLOW_LED | RED_LED, &pio->piob.oer);
87         /* Turn all LEDs OFF */
88         writel(GREEN_LED | YELLOW_LED | RED_LED, &pio->piob.sodr);
89 }