diff options
Diffstat (limited to 'arch/arm/mach-omap1/leds-h2p2-debug.c')
-rw-r--r-- | arch/arm/mach-omap1/leds-h2p2-debug.c | 166 |
1 files changed, 0 insertions, 166 deletions
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c deleted file mode 100644 index f6b14a14a957..000000000000 --- a/arch/arm/mach-omap1/leds-h2p2-debug.c +++ /dev/null | |||
@@ -1,166 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-omap1/leds-h2p2-debug.c | ||
3 | * | ||
4 | * Copyright 2003 by Texas Instruments Incorporated | ||
5 | * | ||
6 | * There are 16 LEDs on the debug board (all green); four may be used | ||
7 | * for logical 'green', 'amber', 'red', and 'blue' (after "claiming"). | ||
8 | * | ||
9 | * The "surfer" expansion board and H2 sample board also have two-color | ||
10 | * green+red LEDs (in parallel), used here for timer and idle indicators. | ||
11 | */ | ||
12 | #include <linux/gpio.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/kernel_stat.h> | ||
15 | #include <linux/sched.h> | ||
16 | #include <linux/io.h> | ||
17 | |||
18 | #include <mach/hardware.h> | ||
19 | #include <asm/leds.h> | ||
20 | #include <asm/mach-types.h> | ||
21 | |||
22 | #include <plat/fpga.h> | ||
23 | |||
24 | #include "leds.h" | ||
25 | |||
26 | |||
27 | #define GPIO_LED_RED 3 | ||
28 | #define GPIO_LED_GREEN OMAP_MPUIO(4) | ||
29 | |||
30 | |||
31 | #define LED_STATE_ENABLED 0x01 | ||
32 | #define LED_STATE_CLAIMED 0x02 | ||
33 | #define LED_TIMER_ON 0x04 | ||
34 | |||
35 | #define GPIO_IDLE GPIO_LED_GREEN | ||
36 | #define GPIO_TIMER GPIO_LED_RED | ||
37 | |||
38 | |||
39 | void h2p2_dbg_leds_event(led_event_t evt) | ||
40 | { | ||
41 | unsigned long flags; | ||
42 | |||
43 | static struct h2p2_dbg_fpga __iomem *fpga; | ||
44 | static u16 led_state, hw_led_state; | ||
45 | |||
46 | local_irq_save(flags); | ||
47 | |||
48 | if (!(led_state & LED_STATE_ENABLED) && evt != led_start) | ||
49 | goto done; | ||
50 | |||
51 | switch (evt) { | ||
52 | case led_start: | ||
53 | if (!fpga) | ||
54 | fpga = ioremap(H2P2_DBG_FPGA_START, | ||
55 | H2P2_DBG_FPGA_SIZE); | ||
56 | if (fpga) { | ||
57 | led_state |= LED_STATE_ENABLED; | ||
58 | __raw_writew(~0, &fpga->leds); | ||
59 | } | ||
60 | break; | ||
61 | |||
62 | case led_stop: | ||
63 | case led_halted: | ||
64 | /* all leds off during suspend or shutdown */ | ||
65 | |||
66 | if (! machine_is_omap_perseus2()) { | ||
67 | gpio_set_value(GPIO_TIMER, 0); | ||
68 | gpio_set_value(GPIO_IDLE, 0); | ||
69 | } | ||
70 | |||
71 | __raw_writew(~0, &fpga->leds); | ||
72 | led_state &= ~LED_STATE_ENABLED; | ||
73 | if (evt == led_halted) { | ||
74 | iounmap(fpga); | ||
75 | fpga = NULL; | ||
76 | } | ||
77 | |||
78 | goto done; | ||
79 | |||
80 | case led_claim: | ||
81 | led_state |= LED_STATE_CLAIMED; | ||
82 | hw_led_state = 0; | ||
83 | break; | ||
84 | |||
85 | case led_release: | ||
86 | led_state &= ~LED_STATE_CLAIMED; | ||
87 | break; | ||
88 | |||
89 | #ifdef CONFIG_LEDS_TIMER | ||
90 | case led_timer: | ||
91 | led_state ^= LED_TIMER_ON; | ||
92 | |||
93 | if (machine_is_omap_perseus2()) | ||
94 | hw_led_state ^= H2P2_DBG_FPGA_P2_LED_TIMER; | ||
95 | else { | ||
96 | gpio_set_value(GPIO_TIMER, led_state & LED_TIMER_ON); | ||
97 | goto done; | ||
98 | } | ||
99 | |||
100 | break; | ||
101 | #endif | ||
102 | |||
103 | #ifdef CONFIG_LEDS_CPU | ||
104 | case led_idle_start: | ||
105 | if (machine_is_omap_perseus2()) | ||
106 | hw_led_state |= H2P2_DBG_FPGA_P2_LED_IDLE; | ||
107 | else { | ||
108 | gpio_set_value(GPIO_IDLE, 1); | ||
109 | goto done; | ||
110 | } | ||
111 | |||
112 | break; | ||
113 | |||
114 | case led_idle_end: | ||
115 | if (machine_is_omap_perseus2()) | ||
116 | hw_led_state &= ~H2P2_DBG_FPGA_P2_LED_IDLE; | ||
117 | else { | ||
118 | gpio_set_value(GPIO_IDLE, 0); | ||
119 | goto done; | ||
120 | } | ||
121 | |||
122 | break; | ||
123 | #endif | ||
124 | |||
125 | case led_green_on: | ||
126 | hw_led_state |= H2P2_DBG_FPGA_LED_GREEN; | ||
127 | break; | ||
128 | case led_green_off: | ||
129 | hw_led_state &= ~H2P2_DBG_FPGA_LED_GREEN; | ||
130 | break; | ||
131 | |||
132 | case led_amber_on: | ||
133 | hw_led_state |= H2P2_DBG_FPGA_LED_AMBER; | ||
134 | break; | ||
135 | case led_amber_off: | ||
136 | hw_led_state &= ~H2P2_DBG_FPGA_LED_AMBER; | ||
137 | break; | ||
138 | |||
139 | case led_red_on: | ||
140 | hw_led_state |= H2P2_DBG_FPGA_LED_RED; | ||
141 | break; | ||
142 | case led_red_off: | ||
143 | hw_led_state &= ~H2P2_DBG_FPGA_LED_RED; | ||
144 | break; | ||
145 | |||
146 | case led_blue_on: | ||
147 | hw_led_state |= H2P2_DBG_FPGA_LED_BLUE; | ||
148 | break; | ||
149 | case led_blue_off: | ||
150 | hw_led_state &= ~H2P2_DBG_FPGA_LED_BLUE; | ||
151 | break; | ||
152 | |||
153 | default: | ||
154 | break; | ||
155 | } | ||
156 | |||
157 | |||
158 | /* | ||
159 | * Actually burn the LEDs | ||
160 | */ | ||
161 | if (led_state & LED_STATE_ENABLED) | ||
162 | __raw_writew(~hw_led_state, &fpga->leds); | ||
163 | |||
164 | done: | ||
165 | local_irq_restore(flags); | ||
166 | } | ||