aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shark
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm/mach-shark
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/arm/mach-shark')
-rw-r--r--arch/arm/mach-shark/Makefile12
-rw-r--r--arch/arm/mach-shark/Makefile.boot2
-rw-r--r--arch/arm/mach-shark/core.c114
-rw-r--r--arch/arm/mach-shark/dma.c22
-rw-r--r--arch/arm/mach-shark/irq.c109
-rw-r--r--arch/arm/mach-shark/leds.c163
-rw-r--r--arch/arm/mach-shark/pci.c42
7 files changed, 464 insertions, 0 deletions
diff --git a/arch/arm/mach-shark/Makefile b/arch/arm/mach-shark/Makefile
new file mode 100644
index 000000000000..45be9b04e7ba
--- /dev/null
+++ b/arch/arm/mach-shark/Makefile
@@ -0,0 +1,12 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y := core.o dma.o irq.o pci.o
8obj-m :=
9obj-n :=
10obj- :=
11
12obj-$(CONFIG_LEDS) += leds.o
diff --git a/arch/arm/mach-shark/Makefile.boot b/arch/arm/mach-shark/Makefile.boot
new file mode 100644
index 000000000000..4320f8b92771
--- /dev/null
+++ b/arch/arm/mach-shark/Makefile.boot
@@ -0,0 +1,2 @@
1 zreladdr-y := 0x08008000
2
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
new file mode 100644
index 000000000000..a9bc5d0dbd85
--- /dev/null
+++ b/arch/arm/mach-shark/core.c
@@ -0,0 +1,114 @@
1/*
2 * linux/arch/arm/mach-shark/arch.c
3 *
4 * Architecture specific stuff.
5 */
6#include <linux/kernel.h>
7#include <linux/init.h>
8#include <linux/interrupt.h>
9#include <linux/sched.h>
10#include <linux/serial_8250.h>
11
12#include <asm/setup.h>
13#include <asm/mach-types.h>
14#include <asm/io.h>
15#include <asm/leds.h>
16#include <asm/param.h>
17
18#include <asm/mach/map.h>
19#include <asm/mach/arch.h>
20#include <asm/mach/time.h>
21
22static struct plat_serial8250_port serial_platform_data[] = {
23 {
24 .iobase = 0x3f8,
25 .irq = 4,
26 .uartclk = 1843200,
27 .regshift = 2,
28 .iotype = UPIO_PORT,
29 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
30 },
31 {
32 .iobase = 0x2f8,
33 .irq = 3,
34 .uartclk = 1843200,
35 .regshift = 2,
36 .iotype = UPIO_PORT,
37 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
38 },
39 { },
40};
41
42static struct platform_device serial_device = {
43 .name = "serial8250",
44 .id = 0,
45 .dev = {
46 .platform_data = serial_platform_data,
47 },
48};
49
50static int __init shark_init(void)
51{
52 int ret;
53
54 if (machine_is_shark())
55 ret = platform_device_register(&serial_device);
56
57 return ret;
58}
59
60arch_initcall(shark_init);
61
62extern void shark_init_irq(void);
63
64static struct map_desc shark_io_desc[] __initdata = {
65 { IO_BASE , IO_START , IO_SIZE , MT_DEVICE }
66};
67
68static void __init shark_map_io(void)
69{
70 iotable_init(shark_io_desc, ARRAY_SIZE(shark_io_desc));
71}
72
73#define IRQ_TIMER 0
74#define HZ_TIME ((1193180 + HZ/2) / HZ)
75
76static irqreturn_t
77shark_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
78{
79 write_seqlock(&xtime_lock);
80 timer_tick(regs);
81 write_sequnlock(&xtime_lock);
82 return IRQ_HANDLED;
83}
84
85static struct irqaction shark_timer_irq = {
86 .name = "Shark Timer Tick",
87 .flags = SA_INTERRUPT,
88 .handler = shark_timer_interrupt
89};
90
91/*
92 * Set up timer interrupt, and return the current time in seconds.
93 */
94static void __init shark_timer_init(void)
95{
96 outb(0x34, 0x43); /* binary, mode 0, LSB/MSB, Ch 0 */
97 outb(HZ_TIME & 0xff, 0x40); /* LSB of count */
98 outb(HZ_TIME >> 8, 0x40);
99
100 setup_irq(IRQ_TIMER, &shark_timer_irq);
101}
102
103static struct sys_timer shark_timer = {
104 .init = shark_timer_init,
105};
106
107MACHINE_START(SHARK, "Shark")
108 MAINTAINER("Alexander Schulz")
109 BOOT_MEM(0x08000000, 0x40000000, 0xe0000000)
110 BOOT_PARAMS(0x08003000)
111 MAPIO(shark_map_io)
112 INITIRQ(shark_init_irq)
113 .timer = &shark_timer,
114MACHINE_END
diff --git a/arch/arm/mach-shark/dma.c b/arch/arm/mach-shark/dma.c
new file mode 100644
index 000000000000..835989a02918
--- /dev/null
+++ b/arch/arm/mach-shark/dma.c
@@ -0,0 +1,22 @@
1/*
2 * linux/arch/arm/mach-shark/dma.c
3 *
4 * by Alexander Schulz
5 *
6 * derived from:
7 * arch/arm/kernel/dma-ebsa285.c
8 * Copyright (C) 1998 Phil Blundell
9 */
10
11#include <linux/config.h>
12#include <linux/init.h>
13
14#include <asm/dma.h>
15#include <asm/mach/dma.h>
16
17void __init arch_dma_init(dma_t *dma)
18{
19#ifdef CONFIG_ISA_DMA
20 isa_init_dma(dma);
21#endif
22}
diff --git a/arch/arm/mach-shark/irq.c b/arch/arm/mach-shark/irq.c
new file mode 100644
index 000000000000..6cb67bd3dfd3
--- /dev/null
+++ b/arch/arm/mach-shark/irq.c
@@ -0,0 +1,109 @@
1/*
2 * linux/arch/arm/mach-shark/irq.c
3 *
4 * by Alexander Schulz
5 *
6 * derived from linux/arch/ppc/kernel/i8259.c and:
7 * include/asm-arm/arch-ebsa110/irq.h
8 * Copyright (C) 1996-1998 Russell King
9 */
10
11#include <linux/init.h>
12#include <linux/fs.h>
13#include <linux/ptrace.h>
14#include <linux/interrupt.h>
15
16#include <asm/irq.h>
17#include <asm/io.h>
18#include <asm/mach/irq.h>
19
20/*
21 * 8259A PIC functions to handle ISA devices:
22 */
23
24/*
25 * This contains the irq mask for both 8259A irq controllers,
26 * Let through the cascade-interrupt no. 2 (ff-(1<<2)==fb)
27 */
28static unsigned char cached_irq_mask[2] = { 0xfb, 0xff };
29
30/*
31 * These have to be protected by the irq controller spinlock
32 * before being called.
33 */
34static void shark_disable_8259A_irq(unsigned int irq)
35{
36 unsigned int mask;
37 if (irq<8) {
38 mask = 1 << irq;
39 cached_irq_mask[0] |= mask;
40 outb(cached_irq_mask[1],0xA1);
41 } else {
42 mask = 1 << (irq-8);
43 cached_irq_mask[1] |= mask;
44 outb(cached_irq_mask[0],0x21);
45 }
46}
47
48static void shark_enable_8259A_irq(unsigned int irq)
49{
50 unsigned int mask;
51 if (irq<8) {
52 mask = ~(1 << irq);
53 cached_irq_mask[0] &= mask;
54 outb(cached_irq_mask[0],0x21);
55 } else {
56 mask = ~(1 << (irq-8));
57 cached_irq_mask[1] &= mask;
58 outb(cached_irq_mask[1],0xA1);
59 }
60}
61
62static void shark_ack_8259A_irq(unsigned int irq){}
63
64static irqreturn_t bogus_int(int irq, void *dev_id, struct pt_regs *regs)
65{
66 printk("Got interrupt %i!\n",irq);
67 return IRQ_NONE;
68}
69
70static struct irqaction cascade;
71
72static struct irqchip fb_chip = {
73 .ack = shark_ack_8259A_irq,
74 .mask = shark_disable_8259A_irq,
75 .unmask = shark_enable_8259A_irq,
76};
77
78void __init shark_init_irq(void)
79{
80 int irq;
81
82 for (irq = 0; irq < NR_IRQS; irq++) {
83 set_irq_chip(irq, &fb_chip);
84 set_irq_handler(irq, do_edge_IRQ);
85 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
86 }
87
88 /* init master interrupt controller */
89 outb(0x11, 0x20); /* Start init sequence, edge triggered (level: 0x19)*/
90 outb(0x00, 0x21); /* Vector base */
91 outb(0x04, 0x21); /* Cascade (slave) on IRQ2 */
92 outb(0x03, 0x21); /* Select 8086 mode , auto eoi*/
93 outb(0x0A, 0x20);
94 /* init slave interrupt controller */
95 outb(0x11, 0xA0); /* Start init sequence, edge triggered */
96 outb(0x08, 0xA1); /* Vector base */
97 outb(0x02, 0xA1); /* Cascade (slave) on IRQ2 */
98 outb(0x03, 0xA1); /* Select 8086 mode, auto eoi */
99 outb(0x0A, 0xA0);
100 outb(cached_irq_mask[1],0xA1);
101 outb(cached_irq_mask[0],0x21);
102 //request_region(0x20,0x2,"pic1");
103 //request_region(0xA0,0x2,"pic2");
104
105 cascade.handler = bogus_int;
106 cascade.name = "cascade";
107 setup_irq(2,&cascade);
108}
109
diff --git a/arch/arm/mach-shark/leds.c b/arch/arm/mach-shark/leds.c
new file mode 100644
index 000000000000..7bdeb70a0c10
--- /dev/null
+++ b/arch/arm/mach-shark/leds.c
@@ -0,0 +1,163 @@
1/*
2 * arch/arm/kernel/leds-shark.c
3 * by Alexander Schulz
4 *
5 * derived from:
6 * arch/arm/kernel/leds-footbridge.c
7 * Copyright (C) 1998-1999 Russell King
8 *
9 * DIGITAL Shark LED control routines.
10 *
11 * The leds use is as follows:
12 * - Green front - toggles state every 50 timer interrupts
13 * - Amber front - Unused, this is a dual color led (Amber/Green)
14 * - Amber back - On if system is not idle
15 *
16 * Changelog:
17 */
18#include <linux/config.h>
19#include <linux/kernel.h>
20#include <linux/module.h>
21#include <linux/init.h>
22#include <linux/spinlock.h>
23#include <linux/ioport.h>
24
25#include <asm/hardware.h>
26#include <asm/leds.h>
27#include <asm/io.h>
28#include <asm/system.h>
29
30#define LED_STATE_ENABLED 1
31#define LED_STATE_CLAIMED 2
32static char led_state;
33static short hw_led_state;
34static short saved_state;
35
36static DEFINE_SPINLOCK(leds_lock);
37
38short sequoia_read(int addr) {
39 outw(addr,0x24);
40 return inw(0x26);
41}
42
43void sequoia_write(short value,short addr) {
44 outw(addr,0x24);
45 outw(value,0x26);
46}
47
48static void sequoia_leds_event(led_event_t evt)
49{
50 unsigned long flags;
51
52 spin_lock_irqsave(&leds_lock, flags);
53
54 hw_led_state = sequoia_read(0x09);
55
56 switch (evt) {
57 case led_start:
58 hw_led_state |= SEQUOIA_LED_GREEN;
59 hw_led_state |= SEQUOIA_LED_AMBER;
60#ifdef CONFIG_LEDS_CPU
61 hw_led_state |= SEQUOIA_LED_BACK;
62#else
63 hw_led_state &= ~SEQUOIA_LED_BACK;
64#endif
65 led_state |= LED_STATE_ENABLED;
66 break;
67
68 case led_stop:
69 hw_led_state &= ~SEQUOIA_LED_BACK;
70 hw_led_state |= SEQUOIA_LED_GREEN;
71 hw_led_state |= SEQUOIA_LED_AMBER;
72 led_state &= ~LED_STATE_ENABLED;
73 break;
74
75 case led_claim:
76 led_state |= LED_STATE_CLAIMED;
77 saved_state = hw_led_state;
78 hw_led_state &= ~SEQUOIA_LED_BACK;
79 hw_led_state |= SEQUOIA_LED_GREEN;
80 hw_led_state |= SEQUOIA_LED_AMBER;
81 break;
82
83 case led_release:
84 led_state &= ~LED_STATE_CLAIMED;
85 hw_led_state = saved_state;
86 break;
87
88#ifdef CONFIG_LEDS_TIMER
89 case led_timer:
90 if (!(led_state & LED_STATE_CLAIMED))
91 hw_led_state ^= SEQUOIA_LED_GREEN;
92 break;
93#endif
94
95#ifdef CONFIG_LEDS_CPU
96 case led_idle_start:
97 if (!(led_state & LED_STATE_CLAIMED))
98 hw_led_state &= ~SEQUOIA_LED_BACK;
99 break;
100
101 case led_idle_end:
102 if (!(led_state & LED_STATE_CLAIMED))
103 hw_led_state |= SEQUOIA_LED_BACK;
104 break;
105#endif
106
107 case led_green_on:
108 if (led_state & LED_STATE_CLAIMED)
109 hw_led_state &= ~SEQUOIA_LED_GREEN;
110 break;
111
112 case led_green_off:
113 if (led_state & LED_STATE_CLAIMED)
114 hw_led_state |= SEQUOIA_LED_GREEN;
115 break;
116
117 case led_amber_on:
118 if (led_state & LED_STATE_CLAIMED)
119 hw_led_state &= ~SEQUOIA_LED_AMBER;
120 break;
121
122 case led_amber_off:
123 if (led_state & LED_STATE_CLAIMED)
124 hw_led_state |= SEQUOIA_LED_AMBER;
125 break;
126
127 case led_red_on:
128 if (led_state & LED_STATE_CLAIMED)
129 hw_led_state |= SEQUOIA_LED_BACK;
130 break;
131
132 case led_red_off:
133 if (led_state & LED_STATE_CLAIMED)
134 hw_led_state &= ~SEQUOIA_LED_BACK;
135 break;
136
137 default:
138 break;
139 }
140
141 if (led_state & LED_STATE_ENABLED)
142 sequoia_write(hw_led_state,0x09);
143
144 spin_unlock_irqrestore(&leds_lock, flags);
145}
146
147static int __init leds_init(void)
148{
149 extern void (*leds_event)(led_event_t);
150 short temp;
151
152 leds_event = sequoia_leds_event;
153
154 /* Make LEDs independent of power-state */
155 request_region(0x24,4,"sequoia");
156 temp = sequoia_read(0x09);
157 temp |= 1<<10;
158 sequoia_write(temp,0x09);
159 leds_event(led_start);
160 return 0;
161}
162
163__initcall(leds_init);
diff --git a/arch/arm/mach-shark/pci.c b/arch/arm/mach-shark/pci.c
new file mode 100644
index 000000000000..37a7112d4117
--- /dev/null
+++ b/arch/arm/mach-shark/pci.c
@@ -0,0 +1,42 @@
1/*
2 * linux/arch/arm/mach-shark/pci.c
3 *
4 * PCI bios-type initialisation for PCI machines
5 *
6 * Bits taken from various places.
7 */
8#include <linux/kernel.h>
9#include <linux/pci.h>
10#include <linux/init.h>
11
12#include <asm/irq.h>
13#include <asm/mach/pci.h>
14#include <asm/mach-types.h>
15
16static int __init shark_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
17{
18 if (dev->bus->number == 0)
19 if (dev->devfn == 0) return 255;
20 else return 11;
21 else return 255;
22}
23
24extern void __init via82c505_preinit(void);
25
26static struct hw_pci shark_pci __initdata = {
27 .setup = via82c505_setup,
28 .swizzle = pci_std_swizzle,
29 .map_irq = shark_map_irq,
30 .nr_controllers = 1,
31 .scan = via82c505_scan_bus,
32 .preinit = via82c505_preinit,
33};
34
35static int __init shark_pci_init(void)
36{
37 if (machine_is_shark())
38 pci_common_init(&shark_pci);
39 return 0;
40}
41
42subsys_initcall(shark_pci_init);