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