diff options
Diffstat (limited to 'arch/arm/mach-ns9xxx')
-rw-r--r-- | arch/arm/mach-ns9xxx/Kconfig | 30 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/Makefile | 7 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/Makefile.boot | 2 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/board-a9m9750dev.c | 69 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/clock.c | 215 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/clock.h | 35 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/generic.c | 27 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/generic.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/gpio-ns9360.c | 118 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/gpio-ns9360.h | 13 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/gpio.c | 141 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/irq.c | 74 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/mach-cc9p9360dev.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/mach-cc9p9360js.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/plat-serial8250.c | 69 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/processor-ns9360.c | 54 | ||||
-rw-r--r-- | arch/arm/mach-ns9xxx/time-ns9360.c (renamed from arch/arm/mach-ns9xxx/time.c) | 75 |
17 files changed, 693 insertions, 257 deletions
diff --git a/arch/arm/mach-ns9xxx/Kconfig b/arch/arm/mach-ns9xxx/Kconfig index 8584ed107991..dd0cd5ac4b8b 100644 --- a/arch/arm/mach-ns9xxx/Kconfig +++ b/arch/arm/mach-ns9xxx/Kconfig | |||
@@ -2,9 +2,26 @@ if ARCH_NS9XXX | |||
2 | 2 | ||
3 | menu "NS9xxx Implementations" | 3 | menu "NS9xxx Implementations" |
4 | 4 | ||
5 | config NS9XXX_HAVE_SERIAL8250 | ||
6 | bool | ||
7 | |||
8 | config PROCESSOR_NS9360 | ||
9 | bool | ||
10 | |||
11 | config MODULE_CC9P9360 | ||
12 | bool | ||
13 | select PROCESSOR_NS9360 | ||
14 | |||
15 | config BOARD_A9M9750DEV | ||
16 | select NS9XXX_HAVE_SERIAL8250 | ||
17 | bool | ||
18 | |||
19 | config BOARD_JSCC9P9360 | ||
20 | bool | ||
21 | |||
5 | config MACH_CC9P9360DEV | 22 | config MACH_CC9P9360DEV |
6 | bool "ConnectCore 9P 9360 on an A9M9750 Devboard" | 23 | bool "ConnectCore 9P 9360 on an A9M9750 Devboard" |
7 | select PROCESSOR_NS9360 | 24 | select MODULE_CC9P9360 |
8 | select BOARD_A9M9750DEV | 25 | select BOARD_A9M9750DEV |
9 | help | 26 | help |
10 | Say Y here if you are using the Digi ConnectCore 9P 9360 | 27 | Say Y here if you are using the Digi ConnectCore 9P 9360 |
@@ -12,21 +29,12 @@ config MACH_CC9P9360DEV | |||
12 | 29 | ||
13 | config MACH_CC9P9360JS | 30 | config MACH_CC9P9360JS |
14 | bool "ConnectCore 9P 9360 on a JSCC9P9360 Devboard" | 31 | bool "ConnectCore 9P 9360 on a JSCC9P9360 Devboard" |
15 | select PROCESSOR_NS9360 | 32 | select MODULE_CC9P9360 |
16 | select BOARD_JSCC9P9360 | 33 | select BOARD_JSCC9P9360 |
17 | help | 34 | help |
18 | Say Y here if you are using the Digi ConnectCore 9P 9360 | 35 | Say Y here if you are using the Digi ConnectCore 9P 9360 |
19 | on an JSCC9P9360 Development Board. | 36 | on an JSCC9P9360 Development Board. |
20 | 37 | ||
21 | config PROCESSOR_NS9360 | ||
22 | bool | ||
23 | |||
24 | config BOARD_A9M9750DEV | ||
25 | bool | ||
26 | |||
27 | config BOARD_JSCC9P9360 | ||
28 | bool | ||
29 | |||
30 | endmenu | 38 | endmenu |
31 | 39 | ||
32 | endif | 40 | endif |
diff --git a/arch/arm/mach-ns9xxx/Makefile b/arch/arm/mach-ns9xxx/Makefile index 6fb82b855a55..41efaf9ad50b 100644 --- a/arch/arm/mach-ns9xxx/Makefile +++ b/arch/arm/mach-ns9xxx/Makefile | |||
@@ -1,7 +1,12 @@ | |||
1 | obj-y := irq.o time.o generic.o gpio.o | 1 | obj-y := clock.o generic.o gpio.o irq.o |
2 | 2 | ||
3 | obj-$(CONFIG_MACH_CC9P9360DEV) += mach-cc9p9360dev.o | 3 | obj-$(CONFIG_MACH_CC9P9360DEV) += mach-cc9p9360dev.o |
4 | obj-$(CONFIG_MACH_CC9P9360JS) += mach-cc9p9360js.o | 4 | obj-$(CONFIG_MACH_CC9P9360JS) += mach-cc9p9360js.o |
5 | 5 | ||
6 | obj-$(CONFIG_PROCESSOR_NS9360) += gpio-ns9360.o processor-ns9360.o time-ns9360.o | ||
7 | |||
6 | obj-$(CONFIG_BOARD_A9M9750DEV) += board-a9m9750dev.o | 8 | obj-$(CONFIG_BOARD_A9M9750DEV) += board-a9m9750dev.o |
7 | obj-$(CONFIG_BOARD_JSCC9P9360) += board-jscc9p9360.o | 9 | obj-$(CONFIG_BOARD_JSCC9P9360) += board-jscc9p9360.o |
10 | |||
11 | # platform devices | ||
12 | obj-$(CONFIG_NS9XXX_HAVE_SERIAL8250) += plat-serial8250.o | ||
diff --git a/arch/arm/mach-ns9xxx/Makefile.boot b/arch/arm/mach-ns9xxx/Makefile.boot index 75ed64e90fa4..54654919229b 100644 --- a/arch/arm/mach-ns9xxx/Makefile.boot +++ b/arch/arm/mach-ns9xxx/Makefile.boot | |||
@@ -1,2 +1,2 @@ | |||
1 | zreladdr-y := 0x108000 | 1 | zreladdr-y := 0x8000 |
2 | params_phys-y := 0x100 | 2 | params_phys-y := 0x100 |
diff --git a/arch/arm/mach-ns9xxx/board-a9m9750dev.c b/arch/arm/mach-ns9xxx/board-a9m9750dev.c index 0f65177f9e5f..a494b71c0195 100644 --- a/arch/arm/mach-ns9xxx/board-a9m9750dev.c +++ b/arch/arm/mach-ns9xxx/board-a9m9750dev.c | |||
@@ -8,15 +8,14 @@ | |||
8 | * under the terms of the GNU General Public License version 2 as published by | 8 | * under the terms of the GNU General Public License version 2 as published by |
9 | * the Free Software Foundation. | 9 | * the Free Software Foundation. |
10 | */ | 10 | */ |
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/serial_8250.h> | ||
13 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
14 | 12 | ||
15 | #include <asm/mach/map.h> | 13 | #include <asm/mach/map.h> |
16 | #include <asm/gpio.h> | 14 | #include <asm/gpio.h> |
17 | 15 | ||
18 | #include <asm/arch-ns9xxx/board.h> | 16 | #include <asm/arch-ns9xxx/board.h> |
19 | #include <asm/arch-ns9xxx/regs-sys.h> | 17 | #include <asm/arch-ns9xxx/processor-ns9360.h> |
18 | #include <asm/arch-ns9xxx/regs-sys-ns9360.h> | ||
20 | #include <asm/arch-ns9xxx/regs-mem.h> | 19 | #include <asm/arch-ns9xxx/regs-mem.h> |
21 | #include <asm/arch-ns9xxx/regs-bbu.h> | 20 | #include <asm/arch-ns9xxx/regs-bbu.h> |
22 | #include <asm/arch-ns9xxx/regs-board-a9m9750dev.h> | 21 | #include <asm/arch-ns9xxx/regs-board-a9m9750dev.h> |
@@ -105,9 +104,9 @@ void __init board_a9m9750dev_init_irq(void) | |||
105 | int i; | 104 | int i; |
106 | 105 | ||
107 | if (gpio_request(11, "board a9m9750dev extirq2") == 0) | 106 | if (gpio_request(11, "board a9m9750dev extirq2") == 0) |
108 | ns9xxx_gpio_configure(11, 0, 1); | 107 | ns9360_gpio_configure(11, 0, 1); |
109 | else | 108 | else |
110 | printk(KERN_ERR "%s: cannot get gpio 11 for IRQ_EXT2\n", | 109 | printk(KERN_ERR "%s: cannot get gpio 11 for IRQ_NS9XXX_EXT2\n", |
111 | __func__); | 110 | __func__); |
112 | 111 | ||
113 | for (i = FPGA_IRQ(0); i <= FPGA_IRQ(7); ++i) { | 112 | for (i = FPGA_IRQ(0); i <= FPGA_IRQ(7); ++i) { |
@@ -116,69 +115,16 @@ void __init board_a9m9750dev_init_irq(void) | |||
116 | set_irq_flags(i, IRQF_VALID); | 115 | set_irq_flags(i, IRQF_VALID); |
117 | } | 116 | } |
118 | 117 | ||
119 | /* IRQ_EXT2: level sensitive + active low */ | 118 | /* IRQ_NS9XXX_EXT2: level sensitive + active low */ |
120 | eic = __raw_readl(SYS_EIC(2)); | 119 | eic = __raw_readl(SYS_EIC(2)); |
121 | REGSET(eic, SYS_EIC, PLTY, AL); | 120 | REGSET(eic, SYS_EIC, PLTY, AL); |
122 | REGSET(eic, SYS_EIC, LVEDG, LEVEL); | 121 | REGSET(eic, SYS_EIC, LVEDG, LEVEL); |
123 | __raw_writel(eic, SYS_EIC(2)); | 122 | __raw_writel(eic, SYS_EIC(2)); |
124 | 123 | ||
125 | set_irq_chained_handler(IRQ_EXT2, | 124 | set_irq_chained_handler(IRQ_NS9XXX_EXT2, |
126 | a9m9750dev_fpga_demux_handler); | 125 | a9m9750dev_fpga_demux_handler); |
127 | } | 126 | } |
128 | 127 | ||
129 | static struct plat_serial8250_port board_a9m9750dev_serial8250_port[] = { | ||
130 | { | ||
131 | .iobase = FPGA_UARTA_BASE, | ||
132 | .membase = (unsigned char*)FPGA_UARTA_BASE, | ||
133 | .mapbase = FPGA_UARTA_BASE, | ||
134 | .irq = IRQ_FPGA_UARTA, | ||
135 | .iotype = UPIO_MEM, | ||
136 | .uartclk = 18432000, | ||
137 | .regshift = 0, | ||
138 | .flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ, | ||
139 | }, { | ||
140 | .iobase = FPGA_UARTB_BASE, | ||
141 | .membase = (unsigned char*)FPGA_UARTB_BASE, | ||
142 | .mapbase = FPGA_UARTB_BASE, | ||
143 | .irq = IRQ_FPGA_UARTB, | ||
144 | .iotype = UPIO_MEM, | ||
145 | .uartclk = 18432000, | ||
146 | .regshift = 0, | ||
147 | .flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ, | ||
148 | }, { | ||
149 | .iobase = FPGA_UARTC_BASE, | ||
150 | .membase = (unsigned char*)FPGA_UARTC_BASE, | ||
151 | .mapbase = FPGA_UARTC_BASE, | ||
152 | .irq = IRQ_FPGA_UARTC, | ||
153 | .iotype = UPIO_MEM, | ||
154 | .uartclk = 18432000, | ||
155 | .regshift = 0, | ||
156 | .flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ, | ||
157 | }, { | ||
158 | .iobase = FPGA_UARTD_BASE, | ||
159 | .membase = (unsigned char*)FPGA_UARTD_BASE, | ||
160 | .mapbase = FPGA_UARTD_BASE, | ||
161 | .irq = IRQ_FPGA_UARTD, | ||
162 | .iotype = UPIO_MEM, | ||
163 | .uartclk = 18432000, | ||
164 | .regshift = 0, | ||
165 | .flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ, | ||
166 | }, { | ||
167 | /* end marker */ | ||
168 | }, | ||
169 | }; | ||
170 | |||
171 | static struct platform_device board_a9m9750dev_serial_device = { | ||
172 | .name = "serial8250", | ||
173 | .dev = { | ||
174 | .platform_data = board_a9m9750dev_serial8250_port, | ||
175 | }, | ||
176 | }; | ||
177 | |||
178 | static struct platform_device *board_a9m9750dev_devices[] __initdata = { | ||
179 | &board_a9m9750dev_serial_device, | ||
180 | }; | ||
181 | |||
182 | void __init board_a9m9750dev_init_machine(void) | 128 | void __init board_a9m9750dev_init_machine(void) |
183 | { | 129 | { |
184 | u32 reg; | 130 | u32 reg; |
@@ -210,7 +156,4 @@ void __init board_a9m9750dev_init_machine(void) | |||
210 | __raw_writel(0x2, MEM_SMOED(0)); | 156 | __raw_writel(0x2, MEM_SMOED(0)); |
211 | __raw_writel(0x6, MEM_SMRD(0)); | 157 | __raw_writel(0x6, MEM_SMRD(0)); |
212 | __raw_writel(0x6, MEM_SMWD(0)); | 158 | __raw_writel(0x6, MEM_SMWD(0)); |
213 | |||
214 | platform_add_devices(board_a9m9750dev_devices, | ||
215 | ARRAY_SIZE(board_a9m9750dev_devices)); | ||
216 | } | 159 | } |
diff --git a/arch/arm/mach-ns9xxx/clock.c b/arch/arm/mach-ns9xxx/clock.c new file mode 100644 index 000000000000..f8639161068f --- /dev/null +++ b/arch/arm/mach-ns9xxx/clock.c | |||
@@ -0,0 +1,215 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ns9xxx/clock.c | ||
3 | * | ||
4 | * Copyright (C) 2007 by Digi International Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/err.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/list.h> | ||
14 | #include <linux/clk.h> | ||
15 | #include <linux/string.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #include <asm/semaphore.h> | ||
19 | #include "clock.h" | ||
20 | |||
21 | static LIST_HEAD(clocks); | ||
22 | static DEFINE_SPINLOCK(clk_lock); | ||
23 | |||
24 | struct clk *clk_get(struct device *dev, const char *id) | ||
25 | { | ||
26 | struct clk *p, *ret = NULL, *retgen = NULL; | ||
27 | unsigned long flags; | ||
28 | int idno; | ||
29 | |||
30 | if (dev == NULL || dev->bus != &platform_bus_type) | ||
31 | idno = -1; | ||
32 | else | ||
33 | idno = to_platform_device(dev)->id; | ||
34 | |||
35 | spin_lock_irqsave(&clk_lock, flags); | ||
36 | list_for_each_entry(p, &clocks, node) { | ||
37 | if (strcmp(id, p->name) == 0) { | ||
38 | if (p->id == idno) { | ||
39 | if (!try_module_get(p->owner)) | ||
40 | continue; | ||
41 | ret = p; | ||
42 | break; | ||
43 | } else if (p->id == -1) | ||
44 | /* remember match with id == -1 in case there is | ||
45 | * no clock for idno */ | ||
46 | retgen = p; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | if (!ret && retgen && try_module_get(retgen->owner)) | ||
51 | ret = retgen; | ||
52 | |||
53 | if (ret) | ||
54 | ++ret->refcount; | ||
55 | |||
56 | spin_unlock_irqrestore(&clk_lock, flags); | ||
57 | |||
58 | return ret ? ret : ERR_PTR(-ENOENT); | ||
59 | } | ||
60 | EXPORT_SYMBOL(clk_get); | ||
61 | |||
62 | void clk_put(struct clk *clk) | ||
63 | { | ||
64 | module_put(clk->owner); | ||
65 | --clk->refcount; | ||
66 | } | ||
67 | EXPORT_SYMBOL(clk_put); | ||
68 | |||
69 | static int clk_enable_unlocked(struct clk *clk) | ||
70 | { | ||
71 | int ret = 0; | ||
72 | if (clk->parent) { | ||
73 | ret = clk_enable_unlocked(clk->parent); | ||
74 | if (ret) | ||
75 | return ret; | ||
76 | } | ||
77 | |||
78 | if (clk->usage++ == 0 && clk->endisable) | ||
79 | ret = clk->endisable(clk, 1); | ||
80 | |||
81 | return ret; | ||
82 | } | ||
83 | |||
84 | int clk_enable(struct clk *clk) | ||
85 | { | ||
86 | int ret; | ||
87 | unsigned long flags; | ||
88 | |||
89 | spin_lock_irqsave(&clk_lock, flags); | ||
90 | |||
91 | ret = clk_enable_unlocked(clk); | ||
92 | |||
93 | spin_unlock_irqrestore(&clk_lock, flags); | ||
94 | |||
95 | return ret; | ||
96 | } | ||
97 | EXPORT_SYMBOL(clk_enable); | ||
98 | |||
99 | static void clk_disable_unlocked(struct clk *clk) | ||
100 | { | ||
101 | if (--clk->usage == 0 && clk->endisable) | ||
102 | clk->endisable(clk, 0); | ||
103 | |||
104 | if (clk->parent) | ||
105 | clk_disable_unlocked(clk->parent); | ||
106 | } | ||
107 | |||
108 | void clk_disable(struct clk *clk) | ||
109 | { | ||
110 | unsigned long flags; | ||
111 | |||
112 | spin_lock_irqsave(&clk_lock, flags); | ||
113 | |||
114 | clk_disable_unlocked(clk); | ||
115 | |||
116 | spin_unlock_irqrestore(&clk_lock, flags); | ||
117 | } | ||
118 | EXPORT_SYMBOL(clk_disable); | ||
119 | |||
120 | unsigned long clk_get_rate(struct clk *clk) | ||
121 | { | ||
122 | if (clk->get_rate) | ||
123 | return clk->get_rate(clk); | ||
124 | |||
125 | if (clk->rate) | ||
126 | return clk->rate; | ||
127 | |||
128 | if (clk->parent) | ||
129 | return clk_get_rate(clk->parent); | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | EXPORT_SYMBOL(clk_get_rate); | ||
134 | |||
135 | int clk_register(struct clk *clk) | ||
136 | { | ||
137 | unsigned long flags; | ||
138 | |||
139 | spin_lock_irqsave(&clk_lock, flags); | ||
140 | |||
141 | list_add(&clk->node, &clocks); | ||
142 | |||
143 | if (clk->parent) | ||
144 | ++clk->parent->refcount; | ||
145 | |||
146 | spin_unlock_irqrestore(&clk_lock, flags); | ||
147 | |||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | int clk_unregister(struct clk *clk) | ||
152 | { | ||
153 | int ret = 0; | ||
154 | unsigned long flags; | ||
155 | |||
156 | spin_lock_irqsave(&clk_lock, flags); | ||
157 | |||
158 | if (clk->usage || clk->refcount) | ||
159 | ret = -EBUSY; | ||
160 | else | ||
161 | list_del(&clk->node); | ||
162 | |||
163 | if (clk->parent) | ||
164 | --clk->parent->refcount; | ||
165 | |||
166 | spin_unlock_irqrestore(&clk_lock, flags); | ||
167 | |||
168 | return ret; | ||
169 | } | ||
170 | |||
171 | #if defined CONFIG_DEBUG_FS | ||
172 | |||
173 | #include <linux/debugfs.h> | ||
174 | #include <linux/seq_file.h> | ||
175 | |||
176 | static int clk_debugfs_show(struct seq_file *s, void *null) | ||
177 | { | ||
178 | unsigned long flags; | ||
179 | struct clk *p; | ||
180 | |||
181 | spin_lock_irqsave(&clk_lock, flags); | ||
182 | |||
183 | list_for_each_entry(p, &clocks, node) | ||
184 | seq_printf(s, "%s.%d: usage=%lu refcount=%lu rate=%lu\n", | ||
185 | p->name, p->id, p->usage, p->refcount, | ||
186 | p->usage ? clk_get_rate(p) : 0); | ||
187 | |||
188 | spin_unlock_irqrestore(&clk_lock, flags); | ||
189 | |||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | static int clk_debugfs_open(struct inode *inode, struct file *file) | ||
194 | { | ||
195 | return single_open(file, clk_debugfs_show, NULL); | ||
196 | } | ||
197 | |||
198 | static struct file_operations clk_debugfs_operations = { | ||
199 | .open = clk_debugfs_open, | ||
200 | .read = seq_read, | ||
201 | .llseek = seq_lseek, | ||
202 | .release = single_release, | ||
203 | }; | ||
204 | |||
205 | static int __init clk_debugfs_init(void) | ||
206 | { | ||
207 | struct dentry *dentry; | ||
208 | |||
209 | dentry = debugfs_create_file("clk", S_IFREG | S_IRUGO, NULL, NULL, | ||
210 | &clk_debugfs_operations); | ||
211 | return IS_ERR(dentry) ? PTR_ERR(dentry) : 0; | ||
212 | } | ||
213 | subsys_initcall(clk_debugfs_init); | ||
214 | |||
215 | #endif /* if defined CONFIG_DEBUG_FS */ | ||
diff --git a/arch/arm/mach-ns9xxx/clock.h b/arch/arm/mach-ns9xxx/clock.h new file mode 100644 index 000000000000..b86c30dd79eb --- /dev/null +++ b/arch/arm/mach-ns9xxx/clock.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ns9xxx/clock.h | ||
3 | * | ||
4 | * Copyright (C) 2007 by Digi International Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | #ifndef __NS9XXX_CLOCK_H | ||
12 | #define __NS9XXX_CLOCK_H | ||
13 | |||
14 | #include <linux/list.h> | ||
15 | |||
16 | struct clk { | ||
17 | struct module *owner; | ||
18 | const char *name; | ||
19 | int id; | ||
20 | |||
21 | struct clk *parent; | ||
22 | |||
23 | unsigned long rate; | ||
24 | int (*endisable)(struct clk *, int enable); | ||
25 | unsigned long (*get_rate)(struct clk *); | ||
26 | |||
27 | struct list_head node; | ||
28 | unsigned long refcount; | ||
29 | unsigned long usage; | ||
30 | }; | ||
31 | |||
32 | int clk_register(struct clk *clk); | ||
33 | int clk_unregister(struct clk *clk); | ||
34 | |||
35 | #endif /* ifndef __NS9XXX_CLOCK_H */ | ||
diff --git a/arch/arm/mach-ns9xxx/generic.c b/arch/arm/mach-ns9xxx/generic.c index d742c921e34d..1e0f467879cc 100644 --- a/arch/arm/mach-ns9xxx/generic.c +++ b/arch/arm/mach-ns9xxx/generic.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-ns9xxx/generic.c | 2 | * arch/arm/mach-ns9xxx/generic.c |
3 | * | 3 | * |
4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -11,34 +11,9 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/init.h> | 12 | #include <linux/init.h> |
13 | #include <asm/memory.h> | 13 | #include <asm/memory.h> |
14 | #include <asm/page.h> | ||
15 | #include <asm/mach-types.h> | ||
16 | #include <asm/mach/map.h> | ||
17 | #include <asm/arch-ns9xxx/regs-sys.h> | ||
18 | #include <asm/arch-ns9xxx/regs-mem.h> | ||
19 | #include <asm/arch-ns9xxx/board.h> | ||
20 | 14 | ||
21 | #include "generic.h" | 15 | #include "generic.h" |
22 | 16 | ||
23 | static struct map_desc standard_io_desc[] __initdata = { | ||
24 | { /* BBus */ | ||
25 | .virtual = io_p2v(0x90000000), | ||
26 | .pfn = __phys_to_pfn(0x90000000), | ||
27 | .length = 0x00700000, | ||
28 | .type = MT_DEVICE, | ||
29 | }, { /* AHB */ | ||
30 | .virtual = io_p2v(0xa0100000), | ||
31 | .pfn = __phys_to_pfn(0xa0100000), | ||
32 | .length = 0x00900000, | ||
33 | .type = MT_DEVICE, | ||
34 | }, | ||
35 | }; | ||
36 | |||
37 | void __init ns9xxx_map_io(void) | ||
38 | { | ||
39 | iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc)); | ||
40 | } | ||
41 | |||
42 | void __init ns9xxx_init_machine(void) | 17 | void __init ns9xxx_init_machine(void) |
43 | { | 18 | { |
44 | } | 19 | } |
diff --git a/arch/arm/mach-ns9xxx/generic.h b/arch/arm/mach-ns9xxx/generic.h index 687e291773f4..82493191aad6 100644 --- a/arch/arm/mach-ns9xxx/generic.h +++ b/arch/arm/mach-ns9xxx/generic.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-ns9xxx/generic.h | 2 | * arch/arm/mach-ns9xxx/generic.h |
3 | * | 3 | * |
4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -13,7 +13,4 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | 14 | ||
15 | void __init ns9xxx_init_irq(void); | 15 | void __init ns9xxx_init_irq(void); |
16 | void __init ns9xxx_map_io(void); | ||
17 | void __init ns9xxx_init_machine(void); | 16 | void __init ns9xxx_init_machine(void); |
18 | |||
19 | extern struct sys_timer ns9xxx_timer; | ||
diff --git a/arch/arm/mach-ns9xxx/gpio-ns9360.c b/arch/arm/mach-ns9xxx/gpio-ns9360.c new file mode 100644 index 000000000000..cabfb879dda9 --- /dev/null +++ b/arch/arm/mach-ns9xxx/gpio-ns9360.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ns9xxx/gpio-ns9360.c | ||
3 | * | ||
4 | * Copyright (C) 2006,2007 by Digi International Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/bug.h> | ||
12 | #include <linux/errno.h> | ||
13 | #include <linux/io.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/module.h> | ||
16 | |||
17 | #include <asm/arch-ns9xxx/regs-bbu.h> | ||
18 | #include <asm/arch-ns9xxx/processor-ns9360.h> | ||
19 | |||
20 | #include "gpio-ns9360.h" | ||
21 | |||
22 | static inline int ns9360_valid_gpio(unsigned gpio) | ||
23 | { | ||
24 | return gpio <= 72; | ||
25 | } | ||
26 | |||
27 | static inline void __iomem *ns9360_gpio_get_gconfaddr(unsigned gpio) | ||
28 | { | ||
29 | if (gpio < 56) | ||
30 | return BBU_GCONFb1(gpio / 8); | ||
31 | else | ||
32 | /* | ||
33 | * this could be optimised away on | ||
34 | * ns9750 only builds, but it isn't ... | ||
35 | */ | ||
36 | return BBU_GCONFb2((gpio - 56) / 8); | ||
37 | } | ||
38 | |||
39 | static inline void __iomem *ns9360_gpio_get_gctrladdr(unsigned gpio) | ||
40 | { | ||
41 | if (gpio < 32) | ||
42 | return BBU_GCTRL1; | ||
43 | else if (gpio < 64) | ||
44 | return BBU_GCTRL2; | ||
45 | else | ||
46 | /* this could be optimised away on ns9750 only builds */ | ||
47 | return BBU_GCTRL3; | ||
48 | } | ||
49 | |||
50 | static inline void __iomem *ns9360_gpio_get_gstataddr(unsigned gpio) | ||
51 | { | ||
52 | if (gpio < 32) | ||
53 | return BBU_GSTAT1; | ||
54 | else if (gpio < 64) | ||
55 | return BBU_GSTAT2; | ||
56 | else | ||
57 | /* this could be optimised away on ns9750 only builds */ | ||
58 | return BBU_GSTAT3; | ||
59 | } | ||
60 | |||
61 | /* | ||
62 | * each gpio can serve for 4 different purposes [0..3]. These are called | ||
63 | * "functions" and passed in the parameter func. Functions 0-2 are always some | ||
64 | * special things, function 3 is GPIO. If func == 3 dir specifies input or | ||
65 | * output, and with inv you can enable an inverter (independent of func). | ||
66 | */ | ||
67 | int __ns9360_gpio_configure(unsigned gpio, int dir, int inv, int func) | ||
68 | { | ||
69 | void __iomem *conf = ns9360_gpio_get_gconfaddr(gpio); | ||
70 | u32 confval; | ||
71 | |||
72 | confval = __raw_readl(conf); | ||
73 | REGSETIM_IDX(confval, BBU_GCONFx, DIR, gpio & 7, dir); | ||
74 | REGSETIM_IDX(confval, BBU_GCONFx, INV, gpio & 7, inv); | ||
75 | REGSETIM_IDX(confval, BBU_GCONFx, FUNC, gpio & 7, func); | ||
76 | __raw_writel(confval, conf); | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | int ns9360_gpio_configure(unsigned gpio, int inv, int func) | ||
82 | { | ||
83 | if (likely(ns9360_valid_gpio(gpio))) { | ||
84 | if (func == 3) { | ||
85 | printk(KERN_WARNING "use gpio_direction_input " | ||
86 | "or gpio_direction_output\n"); | ||
87 | return -EINVAL; | ||
88 | } else | ||
89 | return __ns9360_gpio_configure(gpio, 0, inv, func); | ||
90 | } else | ||
91 | return -EINVAL; | ||
92 | } | ||
93 | EXPORT_SYMBOL(ns9360_gpio_configure); | ||
94 | |||
95 | int ns9360_gpio_get_value(unsigned gpio) | ||
96 | { | ||
97 | void __iomem *stat = ns9360_gpio_get_gstataddr(gpio); | ||
98 | int ret; | ||
99 | |||
100 | ret = 1 & (__raw_readl(stat) >> (gpio & 31)); | ||
101 | |||
102 | return ret; | ||
103 | } | ||
104 | |||
105 | void ns9360_gpio_set_value(unsigned gpio, int value) | ||
106 | { | ||
107 | void __iomem *ctrl = ns9360_gpio_get_gctrladdr(gpio); | ||
108 | u32 ctrlval; | ||
109 | |||
110 | ctrlval = __raw_readl(ctrl); | ||
111 | |||
112 | if (value) | ||
113 | ctrlval |= 1 << (gpio & 31); | ||
114 | else | ||
115 | ctrlval &= ~(1 << (gpio & 31)); | ||
116 | |||
117 | __raw_writel(ctrlval, ctrl); | ||
118 | } | ||
diff --git a/arch/arm/mach-ns9xxx/gpio-ns9360.h b/arch/arm/mach-ns9xxx/gpio-ns9360.h new file mode 100644 index 000000000000..131cd1715caa --- /dev/null +++ b/arch/arm/mach-ns9xxx/gpio-ns9360.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ns9xxx/gpio-ns9360.h | ||
3 | * | ||
4 | * Copyright (C) 2006,2007 by Digi International Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | int __ns9360_gpio_configure(unsigned gpio, int dir, int inv, int func); | ||
12 | int ns9360_gpio_get_value(unsigned gpio); | ||
13 | void ns9360_gpio_set_value(unsigned gpio, int value); | ||
diff --git a/arch/arm/mach-ns9xxx/gpio.c b/arch/arm/mach-ns9xxx/gpio.c index 5286e9fc1d30..b3c963b0c8f5 100644 --- a/arch/arm/mach-ns9xxx/gpio.c +++ b/arch/arm/mach-ns9xxx/gpio.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-ns9xxx/gpio.c | 2 | * arch/arm/mach-ns9xxx/gpio.c |
3 | * | 3 | * |
4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -15,12 +15,13 @@ | |||
15 | 15 | ||
16 | #include <asm/arch-ns9xxx/gpio.h> | 16 | #include <asm/arch-ns9xxx/gpio.h> |
17 | #include <asm/arch-ns9xxx/processor.h> | 17 | #include <asm/arch-ns9xxx/processor.h> |
18 | #include <asm/arch-ns9xxx/regs-bbu.h> | 18 | #include <asm/arch-ns9xxx/processor-ns9360.h> |
19 | #include <asm/io.h> | ||
20 | #include <asm/bug.h> | 19 | #include <asm/bug.h> |
21 | #include <asm/types.h> | 20 | #include <asm/types.h> |
22 | #include <asm/bitops.h> | 21 | #include <asm/bitops.h> |
23 | 22 | ||
23 | #include "gpio-ns9360.h" | ||
24 | |||
24 | #if defined(CONFIG_PROCESSOR_NS9360) | 25 | #if defined(CONFIG_PROCESSOR_NS9360) |
25 | #define GPIO_MAX 72 | 26 | #define GPIO_MAX 72 |
26 | #elif defined(CONFIG_PROCESSOR_NS9750) | 27 | #elif defined(CONFIG_PROCESSOR_NS9750) |
@@ -45,41 +46,10 @@ static inline int ns9xxx_valid_gpio(unsigned gpio) | |||
45 | return gpio <= 49; | 46 | return gpio <= 49; |
46 | else | 47 | else |
47 | #endif | 48 | #endif |
49 | { | ||
48 | BUG(); | 50 | BUG(); |
49 | } | 51 | return 0; |
50 | 52 | } | |
51 | static inline void __iomem *ns9xxx_gpio_get_gconfaddr(unsigned gpio) | ||
52 | { | ||
53 | if (gpio < 56) | ||
54 | return BBU_GCONFb1(gpio / 8); | ||
55 | else | ||
56 | /* | ||
57 | * this could be optimised away on | ||
58 | * ns9750 only builds, but it isn't ... | ||
59 | */ | ||
60 | return BBU_GCONFb2((gpio - 56) / 8); | ||
61 | } | ||
62 | |||
63 | static inline void __iomem *ns9xxx_gpio_get_gctrladdr(unsigned gpio) | ||
64 | { | ||
65 | if (gpio < 32) | ||
66 | return BBU_GCTRL1; | ||
67 | else if (gpio < 64) | ||
68 | return BBU_GCTRL2; | ||
69 | else | ||
70 | /* this could be optimised away on ns9750 only builds */ | ||
71 | return BBU_GCTRL3; | ||
72 | } | ||
73 | |||
74 | static inline void __iomem *ns9xxx_gpio_get_gstataddr(unsigned gpio) | ||
75 | { | ||
76 | if (gpio < 32) | ||
77 | return BBU_GSTAT1; | ||
78 | else if (gpio < 64) | ||
79 | return BBU_GSTAT2; | ||
80 | else | ||
81 | /* this could be optimised away on ns9750 only builds */ | ||
82 | return BBU_GSTAT3; | ||
83 | } | 53 | } |
84 | 54 | ||
85 | int gpio_request(unsigned gpio, const char *label) | 55 | int gpio_request(unsigned gpio, const char *label) |
@@ -98,49 +68,24 @@ void gpio_free(unsigned gpio) | |||
98 | } | 68 | } |
99 | EXPORT_SYMBOL(gpio_free); | 69 | EXPORT_SYMBOL(gpio_free); |
100 | 70 | ||
101 | /* | 71 | int gpio_direction_input(unsigned gpio) |
102 | * each gpio can serve for 4 different purposes [0..3]. These are called | ||
103 | * "functions" and passed in the parameter func. Functions 0-2 are always some | ||
104 | * special things, function 3 is GPIO. If func == 3 dir specifies input or | ||
105 | * output, and with inv you can enable an inverter (independent of func). | ||
106 | */ | ||
107 | static int __ns9xxx_gpio_configure(unsigned gpio, int dir, int inv, int func) | ||
108 | { | 72 | { |
109 | void __iomem *conf = ns9xxx_gpio_get_gconfaddr(gpio); | 73 | if (likely(ns9xxx_valid_gpio(gpio))) { |
110 | u32 confval; | 74 | int ret = -EINVAL; |
111 | unsigned long flags; | 75 | unsigned long flags; |
112 | |||
113 | spin_lock_irqsave(&gpio_lock, flags); | ||
114 | |||
115 | confval = __raw_readl(conf); | ||
116 | REGSETIM_IDX(confval, BBU_GCONFx, DIR, gpio & 7, dir); | ||
117 | REGSETIM_IDX(confval, BBU_GCONFx, INV, gpio & 7, inv); | ||
118 | REGSETIM_IDX(confval, BBU_GCONFx, FUNC, gpio & 7, func); | ||
119 | __raw_writel(confval, conf); | ||
120 | 76 | ||
121 | spin_unlock_irqrestore(&gpio_lock, flags); | 77 | spin_lock_irqsave(&gpio_lock, flags); |
78 | #if defined(CONFIG_PROCESSOR_NS9360) | ||
79 | if (processor_is_ns9360()) | ||
80 | ret = __ns9360_gpio_configure(gpio, 0, 0, 3); | ||
81 | else | ||
82 | #endif | ||
83 | BUG(); | ||
122 | 84 | ||
123 | return 0; | 85 | spin_unlock_irqrestore(&gpio_lock, flags); |
124 | } | ||
125 | 86 | ||
126 | int ns9xxx_gpio_configure(unsigned gpio, int inv, int func) | 87 | return ret; |
127 | { | ||
128 | if (likely(ns9xxx_valid_gpio(gpio))) { | ||
129 | if (func == 3) { | ||
130 | printk(KERN_WARNING "use gpio_direction_input " | ||
131 | "or gpio_direction_output\n"); | ||
132 | return -EINVAL; | ||
133 | } else | ||
134 | return __ns9xxx_gpio_configure(gpio, 0, inv, func); | ||
135 | } else | ||
136 | return -EINVAL; | ||
137 | } | ||
138 | EXPORT_SYMBOL(ns9xxx_gpio_configure); | ||
139 | 88 | ||
140 | int gpio_direction_input(unsigned gpio) | ||
141 | { | ||
142 | if (likely(ns9xxx_valid_gpio(gpio))) { | ||
143 | return __ns9xxx_gpio_configure(gpio, 0, 0, 3); | ||
144 | } else | 89 | } else |
145 | return -EINVAL; | 90 | return -EINVAL; |
146 | } | 91 | } |
@@ -149,9 +94,22 @@ EXPORT_SYMBOL(gpio_direction_input); | |||
149 | int gpio_direction_output(unsigned gpio, int value) | 94 | int gpio_direction_output(unsigned gpio, int value) |
150 | { | 95 | { |
151 | if (likely(ns9xxx_valid_gpio(gpio))) { | 96 | if (likely(ns9xxx_valid_gpio(gpio))) { |
97 | int ret = -EINVAL; | ||
98 | unsigned long flags; | ||
99 | |||
152 | gpio_set_value(gpio, value); | 100 | gpio_set_value(gpio, value); |
153 | 101 | ||
154 | return __ns9xxx_gpio_configure(gpio, 1, 0, 3); | 102 | spin_lock_irqsave(&gpio_lock, flags); |
103 | #if defined(CONFIG_PROCESSOR_NS9360) | ||
104 | if (processor_is_ns9360()) | ||
105 | ret = __ns9360_gpio_configure(gpio, 1, 0, 3); | ||
106 | else | ||
107 | #endif | ||
108 | BUG(); | ||
109 | |||
110 | spin_unlock_irqrestore(&gpio_lock, flags); | ||
111 | |||
112 | return ret; | ||
155 | } else | 113 | } else |
156 | return -EINVAL; | 114 | return -EINVAL; |
157 | } | 115 | } |
@@ -159,31 +117,28 @@ EXPORT_SYMBOL(gpio_direction_output); | |||
159 | 117 | ||
160 | int gpio_get_value(unsigned gpio) | 118 | int gpio_get_value(unsigned gpio) |
161 | { | 119 | { |
162 | void __iomem *stat = ns9xxx_gpio_get_gstataddr(gpio); | 120 | #if defined(CONFIG_PROCESSOR_NS9360) |
163 | int ret; | 121 | if (processor_is_ns9360()) |
164 | 122 | return ns9360_gpio_get_value(gpio); | |
165 | ret = 1 & (__raw_readl(stat) >> (gpio & 31)); | 123 | else |
166 | 124 | #endif | |
167 | return ret; | 125 | { |
126 | BUG(); | ||
127 | return -EINVAL; | ||
128 | } | ||
168 | } | 129 | } |
169 | EXPORT_SYMBOL(gpio_get_value); | 130 | EXPORT_SYMBOL(gpio_get_value); |
170 | 131 | ||
171 | void gpio_set_value(unsigned gpio, int value) | 132 | void gpio_set_value(unsigned gpio, int value) |
172 | { | 133 | { |
173 | void __iomem *ctrl = ns9xxx_gpio_get_gctrladdr(gpio); | ||
174 | u32 ctrlval; | ||
175 | unsigned long flags; | 134 | unsigned long flags; |
176 | |||
177 | spin_lock_irqsave(&gpio_lock, flags); | 135 | spin_lock_irqsave(&gpio_lock, flags); |
178 | 136 | #if defined(CONFIG_PROCESSOR_NS9360) | |
179 | ctrlval = __raw_readl(ctrl); | 137 | if (processor_is_ns9360()) |
180 | 138 | ns9360_gpio_set_value(gpio, value); | |
181 | if (value) | ||
182 | ctrlval |= 1 << (gpio & 31); | ||
183 | else | 139 | else |
184 | ctrlval &= ~(1 << (gpio & 31)); | 140 | #endif |
185 | 141 | BUG(); | |
186 | __raw_writel(ctrlval, ctrl); | ||
187 | 142 | ||
188 | spin_unlock_irqrestore(&gpio_lock, flags); | 143 | spin_unlock_irqrestore(&gpio_lock, flags); |
189 | } | 144 | } |
diff --git a/arch/arm/mach-ns9xxx/irq.c b/arch/arm/mach-ns9xxx/irq.c index 00001b874e97..36e5835e6097 100644 --- a/arch/arm/mach-ns9xxx/irq.c +++ b/arch/arm/mach-ns9xxx/irq.c | |||
@@ -9,21 +9,27 @@ | |||
9 | * the Free Software Foundation. | 9 | * the Free Software Foundation. |
10 | */ | 10 | */ |
11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
12 | #include <linux/kernel_stat.h> | ||
12 | #include <asm/io.h> | 13 | #include <asm/io.h> |
13 | #include <asm/mach/irq.h> | 14 | #include <asm/mach/irq.h> |
14 | #include <asm/mach-types.h> | 15 | #include <asm/mach-types.h> |
15 | #include <asm/arch-ns9xxx/regs-sys.h> | 16 | #include <asm/arch-ns9xxx/regs-sys-common.h> |
16 | #include <asm/arch-ns9xxx/irqs.h> | 17 | #include <asm/arch-ns9xxx/irqs.h> |
17 | #include <asm/arch-ns9xxx/board.h> | 18 | #include <asm/arch-ns9xxx/board.h> |
18 | 19 | ||
19 | #include "generic.h" | 20 | #include "generic.h" |
20 | 21 | ||
22 | /* simple interrupt prio table: prio(x) < prio(y) <=> x < y */ | ||
23 | #define irq2prio(i) (i) | ||
24 | #define prio2irq(p) (p) | ||
25 | |||
21 | static void ns9xxx_mask_irq(unsigned int irq) | 26 | static void ns9xxx_mask_irq(unsigned int irq) |
22 | { | 27 | { |
23 | /* XXX: better use cpp symbols */ | 28 | /* XXX: better use cpp symbols */ |
24 | u32 ic = __raw_readl(SYS_IC(irq / 4)); | 29 | int prio = irq2prio(irq); |
25 | ic &= ~(1 << (7 + 8 * (3 - (irq & 3)))); | 30 | u32 ic = __raw_readl(SYS_IC(prio / 4)); |
26 | __raw_writel(ic, SYS_IC(irq / 4)); | 31 | ic &= ~(1 << (7 + 8 * (3 - (prio & 3)))); |
32 | __raw_writel(ic, SYS_IC(prio / 4)); | ||
27 | } | 33 | } |
28 | 34 | ||
29 | static void ns9xxx_ack_irq(unsigned int irq) | 35 | static void ns9xxx_ack_irq(unsigned int irq) |
@@ -40,9 +46,10 @@ static void ns9xxx_maskack_irq(unsigned int irq) | |||
40 | static void ns9xxx_unmask_irq(unsigned int irq) | 46 | static void ns9xxx_unmask_irq(unsigned int irq) |
41 | { | 47 | { |
42 | /* XXX: better use cpp symbols */ | 48 | /* XXX: better use cpp symbols */ |
43 | u32 ic = __raw_readl(SYS_IC(irq / 4)); | 49 | int prio = irq2prio(irq); |
44 | ic |= 1 << (7 + 8 * (3 - (irq & 3))); | 50 | u32 ic = __raw_readl(SYS_IC(prio / 4)); |
45 | __raw_writel(ic, SYS_IC(irq / 4)); | 51 | ic |= 1 << (7 + 8 * (3 - (prio & 3))); |
52 | __raw_writel(ic, SYS_IC(prio / 4)); | ||
46 | } | 53 | } |
47 | 54 | ||
48 | static struct irq_chip ns9xxx_chip = { | 55 | static struct irq_chip ns9xxx_chip = { |
@@ -52,24 +59,61 @@ static struct irq_chip ns9xxx_chip = { | |||
52 | .unmask = ns9xxx_unmask_irq, | 59 | .unmask = ns9xxx_unmask_irq, |
53 | }; | 60 | }; |
54 | 61 | ||
62 | #if 0 | ||
63 | #define handle_irq handle_level_irq | ||
64 | #else | ||
65 | void handle_prio_irq(unsigned int irq, struct irq_desc *desc) | ||
66 | { | ||
67 | unsigned int cpu = smp_processor_id(); | ||
68 | struct irqaction *action; | ||
69 | irqreturn_t action_ret; | ||
70 | |||
71 | spin_lock(&desc->lock); | ||
72 | |||
73 | if (unlikely(desc->status & IRQ_INPROGRESS)) | ||
74 | goto out_unlock; | ||
75 | |||
76 | desc->status &= ~(IRQ_REPLAY | IRQ_WAITING); | ||
77 | kstat_cpu(cpu).irqs[irq]++; | ||
78 | |||
79 | action = desc->action; | ||
80 | if (unlikely(!action || (desc->status & IRQ_DISABLED))) | ||
81 | goto out_unlock; | ||
82 | |||
83 | desc->status |= IRQ_INPROGRESS; | ||
84 | spin_unlock(&desc->lock); | ||
85 | |||
86 | action_ret = handle_IRQ_event(irq, action); | ||
87 | |||
88 | spin_lock(&desc->lock); | ||
89 | desc->status &= ~IRQ_INPROGRESS; | ||
90 | if (!(desc->status & IRQ_DISABLED) && desc->chip->ack) | ||
91 | desc->chip->ack(irq); | ||
92 | |||
93 | out_unlock: | ||
94 | spin_unlock(&desc->lock); | ||
95 | } | ||
96 | #define handle_irq handle_prio_irq | ||
97 | #endif | ||
98 | |||
55 | void __init ns9xxx_init_irq(void) | 99 | void __init ns9xxx_init_irq(void) |
56 | { | 100 | { |
57 | int i; | 101 | int i; |
58 | 102 | ||
59 | /* disable all IRQs */ | 103 | /* disable all IRQs */ |
60 | for (i = 0; i < 8; ++i) | 104 | for (i = 0; i < 8; ++i) |
61 | __raw_writel((4 * i) << 24 | (4 * i + 1) << 16 | | 105 | __raw_writel(prio2irq(4 * i) << 24 | |
62 | (4 * i + 2) << 8 | (4 * i + 3), SYS_IC(i)); | 106 | prio2irq(4 * i + 1) << 16 | |
107 | prio2irq(4 * i + 2) << 8 | | ||
108 | prio2irq(4 * i + 3), | ||
109 | SYS_IC(i)); | ||
63 | 110 | ||
64 | /* simple interrupt prio table: | ||
65 | * prio(x) < prio(y) <=> x < y | ||
66 | */ | ||
67 | for (i = 0; i < 32; ++i) | 111 | for (i = 0; i < 32; ++i) |
68 | __raw_writel(i, SYS_IVA(i)); | 112 | __raw_writel(prio2irq(i), SYS_IVA(i)); |
69 | 113 | ||
70 | for (i = IRQ_WATCHDOG; i <= IRQ_EXT3; ++i) { | 114 | for (i = 0; i <= 31; ++i) { |
71 | set_irq_chip(i, &ns9xxx_chip); | 115 | set_irq_chip(i, &ns9xxx_chip); |
72 | set_irq_handler(i, handle_level_irq); | 116 | set_irq_handler(i, handle_irq); |
73 | set_irq_flags(i, IRQF_VALID); | 117 | set_irq_flags(i, IRQF_VALID); |
74 | } | 118 | } |
75 | } | 119 | } |
diff --git a/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c b/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c index 760c9d0db7c3..9623fff6b3bc 100644 --- a/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c +++ b/arch/arm/mach-ns9xxx/mach-cc9p9360dev.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-ns9xxx/mach-cc9p9360dev.c | 2 | * arch/arm/mach-ns9xxx/mach-cc9p9360dev.c |
3 | * | 3 | * |
4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -11,12 +11,14 @@ | |||
11 | #include <asm/mach/arch.h> | 11 | #include <asm/mach/arch.h> |
12 | #include <asm/mach-types.h> | 12 | #include <asm/mach-types.h> |
13 | 13 | ||
14 | #include <asm/arch-ns9xxx/processor-ns9360.h> | ||
15 | |||
14 | #include "board-a9m9750dev.h" | 16 | #include "board-a9m9750dev.h" |
15 | #include "generic.h" | 17 | #include "generic.h" |
16 | 18 | ||
17 | static void __init mach_cc9p9360dev_map_io(void) | 19 | static void __init mach_cc9p9360dev_map_io(void) |
18 | { | 20 | { |
19 | ns9xxx_map_io(); | 21 | ns9360_map_io(); |
20 | board_a9m9750dev_map_io(); | 22 | board_a9m9750dev_map_io(); |
21 | } | 23 | } |
22 | 24 | ||
@@ -36,6 +38,6 @@ MACHINE_START(CC9P9360DEV, "Digi ConnectCore 9P 9360 on an A9M9750 Devboard") | |||
36 | .map_io = mach_cc9p9360dev_map_io, | 38 | .map_io = mach_cc9p9360dev_map_io, |
37 | .init_irq = mach_cc9p9360dev_init_irq, | 39 | .init_irq = mach_cc9p9360dev_init_irq, |
38 | .init_machine = mach_cc9p9360dev_init_machine, | 40 | .init_machine = mach_cc9p9360dev_init_machine, |
39 | .timer = &ns9xxx_timer, | 41 | .timer = &ns9360_timer, |
40 | .boot_params = 0x100, | 42 | .boot_params = 0x100, |
41 | MACHINE_END | 43 | MACHINE_END |
diff --git a/arch/arm/mach-ns9xxx/mach-cc9p9360js.c b/arch/arm/mach-ns9xxx/mach-cc9p9360js.c index 85c8b41105c9..fcc815bdd291 100644 --- a/arch/arm/mach-ns9xxx/mach-cc9p9360js.c +++ b/arch/arm/mach-ns9xxx/mach-cc9p9360js.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-ns9xxx/mach-cc9p9360js.c | 2 | * arch/arm/mach-ns9xxx/mach-cc9p9360js.c |
3 | * | 3 | * |
4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -11,6 +11,8 @@ | |||
11 | #include <asm/mach/arch.h> | 11 | #include <asm/mach/arch.h> |
12 | #include <asm/mach-types.h> | 12 | #include <asm/mach-types.h> |
13 | 13 | ||
14 | #include <asm/arch-ns9xxx/processor-ns9360.h> | ||
15 | |||
14 | #include "board-jscc9p9360.h" | 16 | #include "board-jscc9p9360.h" |
15 | #include "generic.h" | 17 | #include "generic.h" |
16 | 18 | ||
@@ -21,9 +23,9 @@ static void __init mach_cc9p9360js_init_machine(void) | |||
21 | } | 23 | } |
22 | 24 | ||
23 | MACHINE_START(CC9P9360JS, "Digi ConnectCore 9P 9360 on an JSCC9P9360 Devboard") | 25 | MACHINE_START(CC9P9360JS, "Digi ConnectCore 9P 9360 on an JSCC9P9360 Devboard") |
24 | .map_io = ns9xxx_map_io, | 26 | .map_io = ns9360_map_io, |
25 | .init_irq = ns9xxx_init_irq, | 27 | .init_irq = ns9xxx_init_irq, |
26 | .init_machine = mach_cc9p9360js_init_machine, | 28 | .init_machine = mach_cc9p9360js_init_machine, |
27 | .timer = &ns9xxx_timer, | 29 | .timer = &ns9360_timer, |
28 | .boot_params = 0x100, | 30 | .boot_params = 0x100, |
29 | MACHINE_END | 31 | MACHINE_END |
diff --git a/arch/arm/mach-ns9xxx/plat-serial8250.c b/arch/arm/mach-ns9xxx/plat-serial8250.c new file mode 100644 index 000000000000..5aa5d9baf8c8 --- /dev/null +++ b/arch/arm/mach-ns9xxx/plat-serial8250.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ns9xxx/plat-serial8250.c | ||
3 | * | ||
4 | * Copyright (C) 2008 by Digi International Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/serial_8250.h> | ||
13 | |||
14 | #include <asm/arch-ns9xxx/regs-board-a9m9750dev.h> | ||
15 | #include <asm/arch-ns9xxx/board.h> | ||
16 | |||
17 | #define DRIVER_NAME "serial8250" | ||
18 | |||
19 | static int __init ns9xxx_plat_serial8250_init(void) | ||
20 | { | ||
21 | struct plat_serial8250_port *pdata; | ||
22 | struct platform_device *pdev; | ||
23 | int ret = -ENOMEM; | ||
24 | int i; | ||
25 | |||
26 | if (!board_is_a9m9750dev()) | ||
27 | return -ENODEV; | ||
28 | |||
29 | pdev = platform_device_alloc(DRIVER_NAME, 0); | ||
30 | if (!pdev) | ||
31 | goto err; | ||
32 | |||
33 | pdata = kzalloc(5 * sizeof(*pdata), GFP_KERNEL); | ||
34 | if (!pdata) | ||
35 | goto err; | ||
36 | |||
37 | pdev->dev.platform_data = pdata; | ||
38 | |||
39 | pdata[0].iobase = FPGA_UARTA_BASE; | ||
40 | pdata[1].iobase = FPGA_UARTB_BASE; | ||
41 | pdata[2].iobase = FPGA_UARTC_BASE; | ||
42 | pdata[3].iobase = FPGA_UARTD_BASE; | ||
43 | |||
44 | for (i = 0; i < 4; ++i) { | ||
45 | pdata[i].membase = (void __iomem *)pdata[i].iobase; | ||
46 | pdata[i].mapbase = pdata[i].iobase; | ||
47 | pdata[i].iotype = UPIO_MEM; | ||
48 | pdata[i].uartclk = 18432000; | ||
49 | pdata[i].flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ; | ||
50 | } | ||
51 | |||
52 | pdata[0].irq = IRQ_FPGA_UARTA; | ||
53 | pdata[1].irq = IRQ_FPGA_UARTB; | ||
54 | pdata[2].irq = IRQ_FPGA_UARTC; | ||
55 | pdata[3].irq = IRQ_FPGA_UARTD; | ||
56 | |||
57 | ret = platform_device_add(pdev); | ||
58 | if (ret) { | ||
59 | err: | ||
60 | platform_device_put(pdev); | ||
61 | |||
62 | printk(KERN_WARNING "Could not add %s (errno=%d)\n", | ||
63 | DRIVER_NAME, ret); | ||
64 | } | ||
65 | |||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | arch_initcall(ns9xxx_plat_serial8250_init); | ||
diff --git a/arch/arm/mach-ns9xxx/processor-ns9360.c b/arch/arm/mach-ns9xxx/processor-ns9360.c new file mode 100644 index 000000000000..2bee0b7fccbb --- /dev/null +++ b/arch/arm/mach-ns9xxx/processor-ns9360.c | |||
@@ -0,0 +1,54 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-ns9xxx/processor-ns9360.c | ||
3 | * | ||
4 | * Copyright (C) 2007 by Digi International Inc. | ||
5 | * All rights reserved. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License version 2 as published by | ||
9 | * the Free Software Foundation. | ||
10 | */ | ||
11 | #include <linux/io.h> | ||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/slab.h> | ||
14 | |||
15 | #include <asm/page.h> | ||
16 | #include <asm/mach/map.h> | ||
17 | #include <asm/arch-ns9xxx/processor-ns9360.h> | ||
18 | #include <asm/arch-ns9xxx/regs-sys-ns9360.h> | ||
19 | |||
20 | void ns9360_reset(char mode) | ||
21 | { | ||
22 | u32 reg; | ||
23 | |||
24 | reg = __raw_readl(SYS_PLL) >> 16; | ||
25 | REGSET(reg, SYS_PLL, SWC, YES); | ||
26 | __raw_writel(reg, SYS_PLL); | ||
27 | } | ||
28 | |||
29 | #define CRYSTAL 29491200 /* Hz */ | ||
30 | unsigned long ns9360_systemclock(void) | ||
31 | { | ||
32 | u32 pll = __raw_readl(SYS_PLL); | ||
33 | return CRYSTAL * (REGGETIM(pll, SYS_PLL, ND) + 1) | ||
34 | >> REGGETIM(pll, SYS_PLL, FS); | ||
35 | } | ||
36 | |||
37 | static struct map_desc ns9360_io_desc[] __initdata = { | ||
38 | { /* BBus */ | ||
39 | .virtual = io_p2v(0x90000000), | ||
40 | .pfn = __phys_to_pfn(0x90000000), | ||
41 | .length = 0x00700000, | ||
42 | .type = MT_DEVICE, | ||
43 | }, { /* AHB */ | ||
44 | .virtual = io_p2v(0xa0100000), | ||
45 | .pfn = __phys_to_pfn(0xa0100000), | ||
46 | .length = 0x00900000, | ||
47 | .type = MT_DEVICE, | ||
48 | }, | ||
49 | }; | ||
50 | |||
51 | void __init ns9360_map_io(void) | ||
52 | { | ||
53 | iotable_init(ns9360_io_desc, ARRAY_SIZE(ns9360_io_desc)); | ||
54 | } | ||
diff --git a/arch/arm/mach-ns9xxx/time.c b/arch/arm/mach-ns9xxx/time-ns9360.c index c3dd1f4acb99..4d573c9793ed 100644 --- a/arch/arm/mach-ns9xxx/time.c +++ b/arch/arm/mach-ns9xxx/time-ns9360.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * arch/arm/mach-ns9xxx/time.c | 2 | * arch/arm/mach-ns9xxx/time-ns9360.c |
3 | * | 3 | * |
4 | * Copyright (C) 2006 by Digi International Inc. | 4 | * Copyright (C) 2006,2007 by Digi International Inc. |
5 | * All rights reserved. | 5 | * All rights reserved. |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -15,8 +15,8 @@ | |||
15 | #include <linux/clocksource.h> | 15 | #include <linux/clocksource.h> |
16 | #include <linux/clockchips.h> | 16 | #include <linux/clockchips.h> |
17 | 17 | ||
18 | #include <asm/arch-ns9xxx/regs-sys.h> | 18 | #include <asm/arch-ns9xxx/processor-ns9360.h> |
19 | #include <asm/arch-ns9xxx/clock.h> | 19 | #include <asm/arch-ns9xxx/regs-sys-ns9360.h> |
20 | #include <asm/arch-ns9xxx/irqs.h> | 20 | #include <asm/arch-ns9xxx/irqs.h> |
21 | #include <asm/arch/system.h> | 21 | #include <asm/arch/system.h> |
22 | #include "generic.h" | 22 | #include "generic.h" |
@@ -25,26 +25,26 @@ | |||
25 | #define TIMER_CLOCKEVENT 1 | 25 | #define TIMER_CLOCKEVENT 1 |
26 | static u32 latch; | 26 | static u32 latch; |
27 | 27 | ||
28 | static cycle_t ns9xxx_clocksource_read(void) | 28 | static cycle_t ns9360_clocksource_read(void) |
29 | { | 29 | { |
30 | return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE)); | 30 | return __raw_readl(SYS_TR(TIMER_CLOCKSOURCE)); |
31 | } | 31 | } |
32 | 32 | ||
33 | static struct clocksource ns9xxx_clocksource = { | 33 | static struct clocksource ns9360_clocksource = { |
34 | .name = "ns9xxx-timer" __stringify(TIMER_CLOCKSOURCE), | 34 | .name = "ns9360-timer" __stringify(TIMER_CLOCKSOURCE), |
35 | .rating = 300, | 35 | .rating = 300, |
36 | .read = ns9xxx_clocksource_read, | 36 | .read = ns9360_clocksource_read, |
37 | .mask = CLOCKSOURCE_MASK(32), | 37 | .mask = CLOCKSOURCE_MASK(32), |
38 | .shift = 20, | 38 | .shift = 20, |
39 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 39 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
40 | }; | 40 | }; |
41 | 41 | ||
42 | static void ns9xxx_clockevent_setmode(enum clock_event_mode mode, | 42 | static void ns9360_clockevent_setmode(enum clock_event_mode mode, |
43 | struct clock_event_device *clk) | 43 | struct clock_event_device *clk) |
44 | { | 44 | { |
45 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); | 45 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); |
46 | 46 | ||
47 | switch(mode) { | 47 | switch (mode) { |
48 | case CLOCK_EVT_MODE_PERIODIC: | 48 | case CLOCK_EVT_MODE_PERIODIC: |
49 | __raw_writel(latch, SYS_TRC(TIMER_CLOCKEVENT)); | 49 | __raw_writel(latch, SYS_TRC(TIMER_CLOCKEVENT)); |
50 | REGSET(tc, SYS_TCx, REN, EN); | 50 | REGSET(tc, SYS_TCx, REN, EN); |
@@ -69,7 +69,7 @@ static void ns9xxx_clockevent_setmode(enum clock_event_mode mode, | |||
69 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); | 69 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); |
70 | } | 70 | } |
71 | 71 | ||
72 | static int ns9xxx_clockevent_setnextevent(unsigned long evt, | 72 | static int ns9360_clockevent_setnextevent(unsigned long evt, |
73 | struct clock_event_device *clk) | 73 | struct clock_event_device *clk) |
74 | { | 74 | { |
75 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); | 75 | u32 tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); |
@@ -88,20 +88,20 @@ static int ns9xxx_clockevent_setnextevent(unsigned long evt, | |||
88 | return 0; | 88 | return 0; |
89 | } | 89 | } |
90 | 90 | ||
91 | static struct clock_event_device ns9xxx_clockevent_device = { | 91 | static struct clock_event_device ns9360_clockevent_device = { |
92 | .name = "ns9xxx-timer" __stringify(TIMER_CLOCKEVENT), | 92 | .name = "ns9360-timer" __stringify(TIMER_CLOCKEVENT), |
93 | .shift = 20, | 93 | .shift = 20, |
94 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 94 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
95 | .set_mode = ns9xxx_clockevent_setmode, | 95 | .set_mode = ns9360_clockevent_setmode, |
96 | .set_next_event = ns9xxx_clockevent_setnextevent, | 96 | .set_next_event = ns9360_clockevent_setnextevent, |
97 | }; | 97 | }; |
98 | 98 | ||
99 | static irqreturn_t ns9xxx_clockevent_handler(int irq, void *dev_id) | 99 | static irqreturn_t ns9360_clockevent_handler(int irq, void *dev_id) |
100 | { | 100 | { |
101 | int timerno = irq - IRQ_TIMER0; | 101 | int timerno = irq - IRQ_NS9360_TIMER0; |
102 | u32 tc; | 102 | u32 tc; |
103 | 103 | ||
104 | struct clock_event_device *evt = &ns9xxx_clockevent_device; | 104 | struct clock_event_device *evt = &ns9360_clockevent_device; |
105 | 105 | ||
106 | /* clear irq */ | 106 | /* clear irq */ |
107 | tc = __raw_readl(SYS_TC(timerno)); | 107 | tc = __raw_readl(SYS_TC(timerno)); |
@@ -119,13 +119,13 @@ static irqreturn_t ns9xxx_clockevent_handler(int irq, void *dev_id) | |||
119 | return IRQ_HANDLED; | 119 | return IRQ_HANDLED; |
120 | } | 120 | } |
121 | 121 | ||
122 | static struct irqaction ns9xxx_clockevent_action = { | 122 | static struct irqaction ns9360_clockevent_action = { |
123 | .name = "ns9xxx-timer" __stringify(TIMER_CLOCKEVENT), | 123 | .name = "ns9360-timer" __stringify(TIMER_CLOCKEVENT), |
124 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, | 124 | .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, |
125 | .handler = ns9xxx_clockevent_handler, | 125 | .handler = ns9360_clockevent_handler, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static void __init ns9xxx_timer_init(void) | 128 | static void __init ns9360_timer_init(void) |
129 | { | 129 | { |
130 | int tc; | 130 | int tc; |
131 | 131 | ||
@@ -148,12 +148,12 @@ static void __init ns9xxx_timer_init(void) | |||
148 | 148 | ||
149 | __raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE)); | 149 | __raw_writel(tc, SYS_TC(TIMER_CLOCKSOURCE)); |
150 | 150 | ||
151 | ns9xxx_clocksource.mult = clocksource_hz2mult(ns9xxx_cpuclock(), | 151 | ns9360_clocksource.mult = clocksource_hz2mult(ns9360_cpuclock(), |
152 | ns9xxx_clocksource.shift); | 152 | ns9360_clocksource.shift); |
153 | 153 | ||
154 | clocksource_register(&ns9xxx_clocksource); | 154 | clocksource_register(&ns9360_clocksource); |
155 | 155 | ||
156 | latch = SH_DIV(ns9xxx_cpuclock(), HZ, 0); | 156 | latch = SH_DIV(ns9360_cpuclock(), HZ, 0); |
157 | 157 | ||
158 | tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); | 158 | tc = __raw_readl(SYS_TC(TIMER_CLOCKEVENT)); |
159 | REGSET(tc, SYS_TCx, TEN, DIS); | 159 | REGSET(tc, SYS_TCx, TEN, DIS); |
@@ -166,19 +166,20 @@ static void __init ns9xxx_timer_init(void) | |||
166 | REGSET(tc, SYS_TCx, REN, EN); | 166 | REGSET(tc, SYS_TCx, REN, EN); |
167 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); | 167 | __raw_writel(tc, SYS_TC(TIMER_CLOCKEVENT)); |
168 | 168 | ||
169 | ns9xxx_clockevent_device.mult = div_sc(ns9xxx_cpuclock(), | 169 | ns9360_clockevent_device.mult = div_sc(ns9360_cpuclock(), |
170 | NSEC_PER_SEC, ns9xxx_clockevent_device.shift); | 170 | NSEC_PER_SEC, ns9360_clockevent_device.shift); |
171 | ns9xxx_clockevent_device.max_delta_ns = | 171 | ns9360_clockevent_device.max_delta_ns = |
172 | clockevent_delta2ns(-1, &ns9xxx_clockevent_device); | 172 | clockevent_delta2ns(-1, &ns9360_clockevent_device); |
173 | ns9xxx_clockevent_device.min_delta_ns = | 173 | ns9360_clockevent_device.min_delta_ns = |
174 | clockevent_delta2ns(1, &ns9xxx_clockevent_device); | 174 | clockevent_delta2ns(1, &ns9360_clockevent_device); |
175 | 175 | ||
176 | ns9xxx_clockevent_device.cpumask = cpumask_of_cpu(0); | 176 | ns9360_clockevent_device.cpumask = cpumask_of_cpu(0); |
177 | clockevents_register_device(&ns9xxx_clockevent_device); | 177 | clockevents_register_device(&ns9360_clockevent_device); |
178 | 178 | ||
179 | setup_irq(IRQ_TIMER0 + TIMER_CLOCKEVENT, &ns9xxx_clockevent_action); | 179 | setup_irq(IRQ_NS9360_TIMER0 + TIMER_CLOCKEVENT, |
180 | &ns9360_clockevent_action); | ||
180 | } | 181 | } |
181 | 182 | ||
182 | struct sys_timer ns9xxx_timer = { | 183 | struct sys_timer ns9360_timer = { |
183 | .init = ns9xxx_timer_init, | 184 | .init = ns9360_timer_init, |
184 | }; | 185 | }; |