aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-footbridge
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /arch/arm/mach-footbridge
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'arch/arm/mach-footbridge')
-rw-r--r--arch/arm/mach-footbridge/ebsa285-leds.c139
-rw-r--r--arch/arm/mach-footbridge/include/mach/system.h69
-rw-r--r--arch/arm/mach-footbridge/include/mach/vmalloc.h10
-rw-r--r--arch/arm/mach-footbridge/netwinder-leds.c139
4 files changed, 357 insertions, 0 deletions
diff --git a/arch/arm/mach-footbridge/ebsa285-leds.c b/arch/arm/mach-footbridge/ebsa285-leds.c
new file mode 100644
index 00000000000..4e10090cd87
--- /dev/null
+++ b/arch/arm/mach-footbridge/ebsa285-leds.c
@@ -0,0 +1,139 @@
1/*
2 * linux/arch/arm/mach-footbridge/ebsa285-leds.c
3 *
4 * Copyright (C) 1998-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 * EBSA-285 control routines.
10 *
11 * The EBSA-285 uses the leds as follows:
12 * - Green - toggles state every 50 timer interrupts
13 * - Amber - On if system is not idle
14 * - Red - currently unused
15 *
16 * Changelog:
17 * 02-05-1999 RMK Various cleanups
18 */
19#include <linux/module.h>
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/spinlock.h>
23
24#include <mach/hardware.h>
25#include <asm/leds.h>
26#include <asm/mach-types.h>
27#include <asm/system.h>
28
29#define LED_STATE_ENABLED 1
30#define LED_STATE_CLAIMED 2
31static char led_state;
32static char hw_led_state;
33
34static DEFINE_SPINLOCK(leds_lock);
35
36static void ebsa285_leds_event(led_event_t evt)
37{
38 unsigned long flags;
39
40 spin_lock_irqsave(&leds_lock, flags);
41
42 switch (evt) {
43 case led_start:
44 hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN;
45#ifndef CONFIG_LEDS_CPU
46 hw_led_state |= XBUS_LED_AMBER;
47#endif
48 led_state |= LED_STATE_ENABLED;
49 break;
50
51 case led_stop:
52 led_state &= ~LED_STATE_ENABLED;
53 break;
54
55 case led_claim:
56 led_state |= LED_STATE_CLAIMED;
57 hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN | XBUS_LED_AMBER;
58 break;
59
60 case led_release:
61 led_state &= ~LED_STATE_CLAIMED;
62 hw_led_state = XBUS_LED_RED | XBUS_LED_GREEN | XBUS_LED_AMBER;
63 break;
64
65#ifdef CONFIG_LEDS_TIMER
66 case led_timer:
67 if (!(led_state & LED_STATE_CLAIMED))
68 hw_led_state ^= XBUS_LED_GREEN;
69 break;
70#endif
71
72#ifdef CONFIG_LEDS_CPU
73 case led_idle_start:
74 if (!(led_state & LED_STATE_CLAIMED))
75 hw_led_state |= XBUS_LED_AMBER;
76 break;
77
78 case led_idle_end:
79 if (!(led_state & LED_STATE_CLAIMED))
80 hw_led_state &= ~XBUS_LED_AMBER;
81 break;
82#endif
83
84 case led_halted:
85 if (!(led_state & LED_STATE_CLAIMED))
86 hw_led_state &= ~XBUS_LED_RED;
87 break;
88
89 case led_green_on:
90 if (led_state & LED_STATE_CLAIMED)
91 hw_led_state &= ~XBUS_LED_GREEN;
92 break;
93
94 case led_green_off:
95 if (led_state & LED_STATE_CLAIMED)
96 hw_led_state |= XBUS_LED_GREEN;
97 break;
98
99 case led_amber_on:
100 if (led_state & LED_STATE_CLAIMED)
101 hw_led_state &= ~XBUS_LED_AMBER;
102 break;
103
104 case led_amber_off:
105 if (led_state & LED_STATE_CLAIMED)
106 hw_led_state |= XBUS_LED_AMBER;
107 break;
108
109 case led_red_on:
110 if (led_state & LED_STATE_CLAIMED)
111 hw_led_state &= ~XBUS_LED_RED;
112 break;
113
114 case led_red_off:
115 if (led_state & LED_STATE_CLAIMED)
116 hw_led_state |= XBUS_LED_RED;
117 break;
118
119 default:
120 break;
121 }
122
123 if (led_state & LED_STATE_ENABLED)
124 *XBUS_LEDS = hw_led_state;
125
126 spin_unlock_irqrestore(&leds_lock, flags);
127}
128
129static int __init leds_init(void)
130{
131 if (machine_is_ebsa285())
132 leds_event = ebsa285_leds_event;
133
134 leds_event(led_start);
135
136 return 0;
137}
138
139__initcall(leds_init);
diff --git a/arch/arm/mach-footbridge/include/mach/system.h b/arch/arm/mach-footbridge/include/mach/system.h
new file mode 100644
index 00000000000..0b293156620
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/system.h
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/system.h
3 *
4 * Copyright (C) 1996-1999 Russell King.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/io.h>
11#include <asm/hardware/dec21285.h>
12#include <mach/hardware.h>
13#include <asm/leds.h>
14#include <asm/mach-types.h>
15
16static inline void arch_idle(void)
17{
18 cpu_do_idle();
19}
20
21static inline void arch_reset(char mode, const char *cmd)
22{
23 if (mode == 's') {
24 /*
25 * Jump into the ROM
26 */
27 cpu_reset(0x41000000);
28 } else {
29 if (machine_is_netwinder()) {
30 /* open up the SuperIO chip
31 */
32 outb(0x87, 0x370);
33 outb(0x87, 0x370);
34
35 /* aux function group 1 (logical device 7)
36 */
37 outb(0x07, 0x370);
38 outb(0x07, 0x371);
39
40 /* set GP16 for WD-TIMER output
41 */
42 outb(0xe6, 0x370);
43 outb(0x00, 0x371);
44
45 /* set a RED LED and toggle WD_TIMER for rebooting
46 */
47 outb(0xc4, 0x338);
48 } else {
49 /*
50 * Force the watchdog to do a CPU reset.
51 *
52 * After making sure that the watchdog is disabled
53 * (so we can change the timer registers) we first
54 * enable the timer to autoreload itself. Next, the
55 * timer interval is set really short and any
56 * current interrupt request is cleared (so we can
57 * see an edge transition). Finally, TIMER4 is
58 * enabled as the watchdog.
59 */
60 *CSR_SA110_CNTL &= ~(1 << 13);
61 *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE |
62 TIMER_CNTL_AUTORELOAD |
63 TIMER_CNTL_DIV16;
64 *CSR_TIMER4_LOAD = 0x2;
65 *CSR_TIMER4_CLR = 0;
66 *CSR_SA110_CNTL |= (1 << 13);
67 }
68 }
69}
diff --git a/arch/arm/mach-footbridge/include/mach/vmalloc.h b/arch/arm/mach-footbridge/include/mach/vmalloc.h
new file mode 100644
index 00000000000..40ba78e5782
--- /dev/null
+++ b/arch/arm/mach-footbridge/include/mach/vmalloc.h
@@ -0,0 +1,10 @@
1/*
2 * arch/arm/mach-footbridge/include/mach/vmalloc.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9
10#define VMALLOC_END 0xf0000000UL
diff --git a/arch/arm/mach-footbridge/netwinder-leds.c b/arch/arm/mach-footbridge/netwinder-leds.c
new file mode 100644
index 00000000000..00269fe0be8
--- /dev/null
+++ b/arch/arm/mach-footbridge/netwinder-leds.c
@@ -0,0 +1,139 @@
1/*
2 * linux/arch/arm/mach-footbridge/netwinder-leds.c
3 *
4 * Copyright (C) 1998-1999 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * NetWinder LED control routines.
11 *
12 * The Netwinder uses the leds as follows:
13 * - Green - toggles state every 50 timer interrupts
14 * - Red - On if the system is not idle
15 *
16 * Changelog:
17 * 02-05-1999 RMK Various cleanups
18 */
19#include <linux/module.h>
20#include <linux/kernel.h>
21#include <linux/init.h>
22#include <linux/spinlock.h>
23
24#include <mach/hardware.h>
25#include <asm/leds.h>
26#include <asm/mach-types.h>
27#include <asm/system.h>
28
29#define LED_STATE_ENABLED 1
30#define LED_STATE_CLAIMED 2
31static char led_state;
32static char hw_led_state;
33
34static DEFINE_SPINLOCK(leds_lock);
35
36static void netwinder_leds_event(led_event_t evt)
37{
38 unsigned long flags;
39
40 spin_lock_irqsave(&leds_lock, flags);
41
42 switch (evt) {
43 case led_start:
44 led_state |= LED_STATE_ENABLED;
45 hw_led_state = GPIO_GREEN_LED;
46 break;
47
48 case led_stop:
49 led_state &= ~LED_STATE_ENABLED;
50 break;
51
52 case led_claim:
53 led_state |= LED_STATE_CLAIMED;
54 hw_led_state = 0;
55 break;
56
57 case led_release:
58 led_state &= ~LED_STATE_CLAIMED;
59 hw_led_state = 0;
60 break;
61
62#ifdef CONFIG_LEDS_TIMER
63 case led_timer:
64 if (!(led_state & LED_STATE_CLAIMED))
65 hw_led_state ^= GPIO_GREEN_LED;
66 break;
67#endif
68
69#ifdef CONFIG_LEDS_CPU
70 case led_idle_start:
71 if (!(led_state & LED_STATE_CLAIMED))
72 hw_led_state &= ~GPIO_RED_LED;
73 break;
74
75 case led_idle_end:
76 if (!(led_state & LED_STATE_CLAIMED))
77 hw_led_state |= GPIO_RED_LED;
78 break;
79#endif
80
81 case led_halted:
82 if (!(led_state & LED_STATE_CLAIMED))
83 hw_led_state |= GPIO_RED_LED;
84 break;
85
86 case led_green_on:
87 if (led_state & LED_STATE_CLAIMED)
88 hw_led_state |= GPIO_GREEN_LED;
89 break;
90
91 case led_green_off:
92 if (led_state & LED_STATE_CLAIMED)
93 hw_led_state &= ~GPIO_GREEN_LED;
94 break;
95
96 case led_amber_on:
97 if (led_state & LED_STATE_CLAIMED)
98 hw_led_state |= GPIO_GREEN_LED | GPIO_RED_LED;
99 break;
100
101 case led_amber_off:
102 if (led_state & LED_STATE_CLAIMED)
103 hw_led_state &= ~(GPIO_GREEN_LED | GPIO_RED_LED);
104 break;
105
106 case led_red_on:
107 if (led_state & LED_STATE_CLAIMED)
108 hw_led_state |= GPIO_RED_LED;
109 break;
110
111 case led_red_off:
112 if (led_state & LED_STATE_CLAIMED)
113 hw_led_state &= ~GPIO_RED_LED;
114 break;
115
116 default:
117 break;
118 }
119
120 spin_unlock_irqrestore(&leds_lock, flags);
121
122 if (led_state & LED_STATE_ENABLED) {
123 spin_lock_irqsave(&nw_gpio_lock, flags);
124 nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state);
125 spin_unlock_irqrestore(&nw_gpio_lock, flags);
126 }
127}
128
129static int __init leds_init(void)
130{
131 if (machine_is_netwinder())
132 leds_event = netwinder_leds_event;
133
134 leds_event(led_start);
135
136 return 0;
137}
138
139__initcall(leds_init);