diff options
Diffstat (limited to 'arch/arm/mach-footbridge')
-rw-r--r-- | arch/arm/mach-footbridge/common.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-footbridge/common.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-footbridge/dc21285-timer.c | 44 | ||||
-rw-r--r-- | arch/arm/mach-footbridge/dc21285.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-footbridge/ebsa285.c | 34 | ||||
-rw-r--r-- | arch/arm/mach-footbridge/include/mach/hardware.h | 6 |
6 files changed, 71 insertions, 25 deletions
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c index 2739ca2c1334..9e8220e38398 100644 --- a/arch/arm/mach-footbridge/common.c +++ b/arch/arm/mach-footbridge/common.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/spinlock.h> | 17 | #include <linux/spinlock.h> |
18 | #include <video/vga.h> | ||
18 | 19 | ||
19 | #include <asm/pgtable.h> | 20 | #include <asm/pgtable.h> |
20 | #include <asm/page.h> | 21 | #include <asm/page.h> |
@@ -142,11 +143,6 @@ static struct map_desc fb_common_io_desc[] __initdata = { | |||
142 | .pfn = __phys_to_pfn(DC21285_ARMCSR_BASE), | 143 | .pfn = __phys_to_pfn(DC21285_ARMCSR_BASE), |
143 | .length = ARMCSR_SIZE, | 144 | .length = ARMCSR_SIZE, |
144 | .type = MT_DEVICE, | 145 | .type = MT_DEVICE, |
145 | }, { | ||
146 | .virtual = XBUS_BASE, | ||
147 | .pfn = __phys_to_pfn(0x40000000), | ||
148 | .length = XBUS_SIZE, | ||
149 | .type = MT_DEVICE, | ||
150 | } | 146 | } |
151 | }; | 147 | }; |
152 | 148 | ||
@@ -196,6 +192,8 @@ void __init footbridge_map_io(void) | |||
196 | iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc)); | 192 | iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc)); |
197 | pci_map_io_early(__phys_to_pfn(DC21285_PCI_IO)); | 193 | pci_map_io_early(__phys_to_pfn(DC21285_PCI_IO)); |
198 | } | 194 | } |
195 | |||
196 | vga_base = PCIMEM_BASE; | ||
199 | } | 197 | } |
200 | 198 | ||
201 | void footbridge_restart(enum reboot_mode mode, const char *cmd) | 199 | void footbridge_restart(enum reboot_mode mode, const char *cmd) |
diff --git a/arch/arm/mach-footbridge/common.h b/arch/arm/mach-footbridge/common.h index 56607b3a773e..b911e5587ecf 100644 --- a/arch/arm/mach-footbridge/common.h +++ b/arch/arm/mach-footbridge/common.h | |||
@@ -10,3 +10,5 @@ extern void footbridge_init_irq(void); | |||
10 | 10 | ||
11 | extern void isa_init_irq(unsigned int irq); | 11 | extern void isa_init_irq(unsigned int irq); |
12 | extern void footbridge_restart(enum reboot_mode, const char *); | 12 | extern void footbridge_restart(enum reboot_mode, const char *); |
13 | |||
14 | extern void footbridge_sched_clock(void); | ||
diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c index 9ee78f7b4990..3971104d32d4 100644 --- a/arch/arm/mach-footbridge/dc21285-timer.c +++ b/arch/arm/mach-footbridge/dc21285-timer.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/interrupt.h> | 10 | #include <linux/interrupt.h> |
11 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
12 | #include <linux/sched_clock.h> | ||
12 | 13 | ||
13 | #include <asm/irq.h> | 14 | #include <asm/irq.h> |
14 | 15 | ||
@@ -46,6 +47,16 @@ static struct clocksource cksrc_dc21285 = { | |||
46 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 47 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
47 | }; | 48 | }; |
48 | 49 | ||
50 | static int ckevt_dc21285_set_next_event(unsigned long delta, | ||
51 | struct clock_event_device *c) | ||
52 | { | ||
53 | *CSR_TIMER1_CLR = 0; | ||
54 | *CSR_TIMER1_LOAD = delta; | ||
55 | *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_DIV16; | ||
56 | |||
57 | return 0; | ||
58 | } | ||
59 | |||
49 | static void ckevt_dc21285_set_mode(enum clock_event_mode mode, | 60 | static void ckevt_dc21285_set_mode(enum clock_event_mode mode, |
50 | struct clock_event_device *c) | 61 | struct clock_event_device *c) |
51 | { | 62 | { |
@@ -58,7 +69,9 @@ static void ckevt_dc21285_set_mode(enum clock_event_mode mode, | |||
58 | TIMER_CNTL_DIV16; | 69 | TIMER_CNTL_DIV16; |
59 | break; | 70 | break; |
60 | 71 | ||
61 | default: | 72 | case CLOCK_EVT_MODE_ONESHOT: |
73 | case CLOCK_EVT_MODE_UNUSED: | ||
74 | case CLOCK_EVT_MODE_SHUTDOWN: | ||
62 | *CSR_TIMER1_CNTL = 0; | 75 | *CSR_TIMER1_CNTL = 0; |
63 | break; | 76 | break; |
64 | } | 77 | } |
@@ -66,9 +79,11 @@ static void ckevt_dc21285_set_mode(enum clock_event_mode mode, | |||
66 | 79 | ||
67 | static struct clock_event_device ckevt_dc21285 = { | 80 | static struct clock_event_device ckevt_dc21285 = { |
68 | .name = "dc21285_timer1", | 81 | .name = "dc21285_timer1", |
69 | .features = CLOCK_EVT_FEAT_PERIODIC, | 82 | .features = CLOCK_EVT_FEAT_PERIODIC | |
83 | CLOCK_EVT_FEAT_ONESHOT, | ||
70 | .rating = 200, | 84 | .rating = 200, |
71 | .irq = IRQ_TIMER1, | 85 | .irq = IRQ_TIMER1, |
86 | .set_next_event = ckevt_dc21285_set_next_event, | ||
72 | .set_mode = ckevt_dc21285_set_mode, | 87 | .set_mode = ckevt_dc21285_set_mode, |
73 | }; | 88 | }; |
74 | 89 | ||
@@ -78,6 +93,10 @@ static irqreturn_t timer1_interrupt(int irq, void *dev_id) | |||
78 | 93 | ||
79 | *CSR_TIMER1_CLR = 0; | 94 | *CSR_TIMER1_CLR = 0; |
80 | 95 | ||
96 | /* Stop the timer if in one-shot mode */ | ||
97 | if (ce->mode == CLOCK_EVT_MODE_ONESHOT) | ||
98 | *CSR_TIMER1_CNTL = 0; | ||
99 | |||
81 | ce->event_handler(ce); | 100 | ce->event_handler(ce); |
82 | 101 | ||
83 | return IRQ_HANDLED; | 102 | return IRQ_HANDLED; |
@@ -96,11 +115,28 @@ static struct irqaction footbridge_timer_irq = { | |||
96 | void __init footbridge_timer_init(void) | 115 | void __init footbridge_timer_init(void) |
97 | { | 116 | { |
98 | struct clock_event_device *ce = &ckevt_dc21285; | 117 | struct clock_event_device *ce = &ckevt_dc21285; |
118 | unsigned rate = DIV_ROUND_CLOSEST(mem_fclk_21285, 16); | ||
99 | 119 | ||
100 | clocksource_register_hz(&cksrc_dc21285, (mem_fclk_21285 + 8) / 16); | 120 | clocksource_register_hz(&cksrc_dc21285, rate); |
101 | 121 | ||
102 | setup_irq(ce->irq, &footbridge_timer_irq); | 122 | setup_irq(ce->irq, &footbridge_timer_irq); |
103 | 123 | ||
104 | ce->cpumask = cpumask_of(smp_processor_id()); | 124 | ce->cpumask = cpumask_of(smp_processor_id()); |
105 | clockevents_config_and_register(ce, mem_fclk_21285, 0x4, 0xffffff); | 125 | clockevents_config_and_register(ce, rate, 0x4, 0xffffff); |
126 | } | ||
127 | |||
128 | static u32 notrace footbridge_read_sched_clock(void) | ||
129 | { | ||
130 | return ~*CSR_TIMER3_VALUE; | ||
131 | } | ||
132 | |||
133 | void __init footbridge_sched_clock(void) | ||
134 | { | ||
135 | unsigned rate = DIV_ROUND_CLOSEST(mem_fclk_21285, 16); | ||
136 | |||
137 | *CSR_TIMER3_LOAD = 0; | ||
138 | *CSR_TIMER3_CLR = 0; | ||
139 | *CSR_TIMER3_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_DIV16; | ||
140 | |||
141 | setup_sched_clock(footbridge_read_sched_clock, 24, rate); | ||
106 | } | 142 | } |
diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c index 3490a24f969e..7c2fdae9a38b 100644 --- a/arch/arm/mach-footbridge/dc21285.c +++ b/arch/arm/mach-footbridge/dc21285.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/irq.h> | 18 | #include <linux/irq.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | #include <video/vga.h> | ||
22 | 21 | ||
23 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
24 | #include <asm/mach/pci.h> | 23 | #include <asm/mach/pci.h> |
@@ -291,7 +290,6 @@ void __init dc21285_preinit(void) | |||
291 | int cfn_mode; | 290 | int cfn_mode; |
292 | 291 | ||
293 | pcibios_min_mem = 0x81000000; | 292 | pcibios_min_mem = 0x81000000; |
294 | vga_base = PCIMEM_BASE; | ||
295 | 293 | ||
296 | mem_size = (unsigned int)high_memory - PAGE_OFFSET; | 294 | mem_size = (unsigned int)high_memory - PAGE_OFFSET; |
297 | for (mem_mask = 0x00100000; mem_mask < 0x10000000; mem_mask <<= 1) | 295 | for (mem_mask = 0x00100000; mem_mask < 0x10000000; mem_mask <<= 1) |
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c index b08243500e2e..aee8300f3490 100644 --- a/arch/arm/mach-footbridge/ebsa285.c +++ b/arch/arm/mach-footbridge/ebsa285.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * EBSA285 machine fixup | 4 | * EBSA285 machine fixup |
5 | */ | 5 | */ |
6 | #include <linux/init.h> | 6 | #include <linux/init.h> |
7 | #include <linux/io.h> | ||
7 | #include <linux/spinlock.h> | 8 | #include <linux/spinlock.h> |
8 | #include <linux/slab.h> | 9 | #include <linux/slab.h> |
9 | #include <linux/leds.h> | 10 | #include <linux/leds.h> |
@@ -17,6 +18,11 @@ | |||
17 | 18 | ||
18 | /* LEDs */ | 19 | /* LEDs */ |
19 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) | 20 | #if defined(CONFIG_NEW_LEDS) && defined(CONFIG_LEDS_CLASS) |
21 | #define XBUS_AMBER_L BIT(0) | ||
22 | #define XBUS_GREEN_L BIT(1) | ||
23 | #define XBUS_RED_L BIT(2) | ||
24 | #define XBUS_TOGGLE BIT(7) | ||
25 | |||
20 | struct ebsa285_led { | 26 | struct ebsa285_led { |
21 | struct led_classdev cdev; | 27 | struct led_classdev cdev; |
22 | u8 mask; | 28 | u8 mask; |
@@ -30,21 +36,25 @@ static const struct { | |||
30 | const char *name; | 36 | const char *name; |
31 | const char *trigger; | 37 | const char *trigger; |
32 | } ebsa285_leds[] = { | 38 | } ebsa285_leds[] = { |
33 | { "ebsa285:amber", "heartbeat", }, | 39 | { "ebsa285:amber", "cpu0", }, |
34 | { "ebsa285:green", "cpu0", }, | 40 | { "ebsa285:green", "heartbeat", }, |
35 | { "ebsa285:red",}, | 41 | { "ebsa285:red",}, |
36 | }; | 42 | }; |
37 | 43 | ||
44 | static unsigned char hw_led_state; | ||
45 | static void __iomem *xbus; | ||
46 | |||
38 | static void ebsa285_led_set(struct led_classdev *cdev, | 47 | static void ebsa285_led_set(struct led_classdev *cdev, |
39 | enum led_brightness b) | 48 | enum led_brightness b) |
40 | { | 49 | { |
41 | struct ebsa285_led *led = container_of(cdev, | 50 | struct ebsa285_led *led = container_of(cdev, |
42 | struct ebsa285_led, cdev); | 51 | struct ebsa285_led, cdev); |
43 | 52 | ||
44 | if (b != LED_OFF) | 53 | if (b == LED_OFF) |
45 | *XBUS_LEDS |= led->mask; | 54 | hw_led_state |= led->mask; |
46 | else | 55 | else |
47 | *XBUS_LEDS &= ~led->mask; | 56 | hw_led_state &= ~led->mask; |
57 | writeb(hw_led_state, xbus); | ||
48 | } | 58 | } |
49 | 59 | ||
50 | static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) | 60 | static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) |
@@ -52,18 +62,23 @@ static enum led_brightness ebsa285_led_get(struct led_classdev *cdev) | |||
52 | struct ebsa285_led *led = container_of(cdev, | 62 | struct ebsa285_led *led = container_of(cdev, |
53 | struct ebsa285_led, cdev); | 63 | struct ebsa285_led, cdev); |
54 | 64 | ||
55 | return (*XBUS_LEDS & led->mask) ? LED_FULL : LED_OFF; | 65 | return hw_led_state & led->mask ? LED_OFF : LED_FULL; |
56 | } | 66 | } |
57 | 67 | ||
58 | static int __init ebsa285_leds_init(void) | 68 | static int __init ebsa285_leds_init(void) |
59 | { | 69 | { |
60 | int i; | 70 | int i; |
61 | 71 | ||
62 | if (machine_is_ebsa285()) | 72 | if (!machine_is_ebsa285()) |
63 | return -ENODEV; | 73 | return -ENODEV; |
64 | 74 | ||
65 | /* 3 LEDS All ON */ | 75 | xbus = ioremap(XBUS_CS2, SZ_4K); |
66 | *XBUS_LEDS |= XBUS_LED_AMBER | XBUS_LED_GREEN | XBUS_LED_RED; | 76 | if (!xbus) |
77 | return -ENOMEM; | ||
78 | |||
79 | /* 3 LEDS all off */ | ||
80 | hw_led_state = XBUS_AMBER_L | XBUS_GREEN_L | XBUS_RED_L; | ||
81 | writeb(hw_led_state, xbus); | ||
67 | 82 | ||
68 | for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) { | 83 | for (i = 0; i < ARRAY_SIZE(ebsa285_leds); i++) { |
69 | struct ebsa285_led *led; | 84 | struct ebsa285_led *led; |
@@ -100,6 +115,7 @@ MACHINE_START(EBSA285, "EBSA285") | |||
100 | .video_start = 0x000a0000, | 115 | .video_start = 0x000a0000, |
101 | .video_end = 0x000bffff, | 116 | .video_end = 0x000bffff, |
102 | .map_io = footbridge_map_io, | 117 | .map_io = footbridge_map_io, |
118 | .init_early = footbridge_sched_clock, | ||
103 | .init_irq = footbridge_init_irq, | 119 | .init_irq = footbridge_init_irq, |
104 | .init_time = footbridge_timer_init, | 120 | .init_time = footbridge_timer_init, |
105 | .restart = footbridge_restart, | 121 | .restart = footbridge_restart, |
diff --git a/arch/arm/mach-footbridge/include/mach/hardware.h b/arch/arm/mach-footbridge/include/mach/hardware.h index e3d6ccac2162..02f6d7a706b1 100644 --- a/arch/arm/mach-footbridge/include/mach/hardware.h +++ b/arch/arm/mach-footbridge/include/mach/hardware.h | |||
@@ -51,11 +51,7 @@ | |||
51 | #define PCIMEM_SIZE 0x01000000 | 51 | #define PCIMEM_SIZE 0x01000000 |
52 | #define PCIMEM_BASE MMU_IO(0xf0000000, 0x80000000) | 52 | #define PCIMEM_BASE MMU_IO(0xf0000000, 0x80000000) |
53 | 53 | ||
54 | #define XBUS_LEDS ((volatile unsigned char *)(XBUS_BASE + 0x12000)) | 54 | #define XBUS_CS2 0x40012000 |
55 | #define XBUS_LED_AMBER (1 << 0) | ||
56 | #define XBUS_LED_GREEN (1 << 1) | ||
57 | #define XBUS_LED_RED (1 << 2) | ||
58 | #define XBUS_LED_TOGGLE (1 << 8) | ||
59 | 55 | ||
60 | #define XBUS_SWITCH ((volatile unsigned char *)(XBUS_BASE + 0x12000)) | 56 | #define XBUS_SWITCH ((volatile unsigned char *)(XBUS_BASE + 0x12000)) |
61 | #define XBUS_SWITCH_SWITCH ((*XBUS_SWITCH) & 15) | 57 | #define XBUS_SWITCH_SWITCH ((*XBUS_SWITCH) & 15) |