aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-nuc93x
diff options
context:
space:
mode:
authorwanzongshun <mcuos.com@gmail.com>2009-12-31 09:06:05 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-01-27 17:03:00 -0500
commita62e90308f7b6965310cf4ec61393aef6861f50d (patch)
tree3370d9bdd43f2f75607ad59f921adafbecf537a7 /arch/arm/mach-nuc93x
parent74d2e4f8d79ae0c4b6ec027958d5b18058662eea (diff)
ARM: 5859/1: Add nuc93x platform support
The previous nuc932 support patches have been discarded by me and because it belongs to another SoCs series named nuc93x,at present, which included nuc931 and nuc932, I think it is better to create a new mach-nuc93x,So I made the patch,and request your advice.Thanks! Signed-off-by: Wan ZongShun <mcuos.com@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-nuc93x')
-rw-r--r--arch/arm/mach-nuc93x/Kconfig19
-rw-r--r--arch/arm/mach-nuc93x/Makefile14
-rw-r--r--arch/arm/mach-nuc93x/Makefile.boot3
-rw-r--r--arch/arm/mach-nuc93x/clock.c83
-rw-r--r--arch/arm/mach-nuc93x/clock.h36
-rw-r--r--arch/arm/mach-nuc93x/cpu.c135
-rw-r--r--arch/arm/mach-nuc93x/cpu.h48
-rw-r--r--arch/arm/mach-nuc93x/dev.c42
-rw-r--r--arch/arm/mach-nuc93x/include/mach/clkdev.h7
-rw-r--r--arch/arm/mach-nuc93x/include/mach/entry-macro.S32
-rw-r--r--arch/arm/mach-nuc93x/include/mach/hardware.h22
-rw-r--r--arch/arm/mach-nuc93x/include/mach/io.h28
-rw-r--r--arch/arm/mach-nuc93x/include/mach/irqs.h59
-rw-r--r--arch/arm/mach-nuc93x/include/mach/map.h139
-rw-r--r--arch/arm/mach-nuc93x/include/mach/memory.h21
-rw-r--r--arch/arm/mach-nuc93x/include/mach/regs-clock.h53
-rw-r--r--arch/arm/mach-nuc93x/include/mach/regs-ebi.h33
-rw-r--r--arch/arm/mach-nuc93x/include/mach/regs-irq.h42
-rw-r--r--arch/arm/mach-nuc93x/include/mach/regs-serial.h52
-rw-r--r--arch/arm/mach-nuc93x/include/mach/regs-timer.h28
-rw-r--r--arch/arm/mach-nuc93x/include/mach/system.h28
-rw-r--r--arch/arm/mach-nuc93x/include/mach/timex.h25
-rw-r--r--arch/arm/mach-nuc93x/include/mach/uncompress.h50
-rw-r--r--arch/arm/mach-nuc93x/include/mach/vmalloc.h23
-rw-r--r--arch/arm/mach-nuc93x/irq.c66
-rw-r--r--arch/arm/mach-nuc93x/mach-nuc932evb.c45
-rw-r--r--arch/arm/mach-nuc93x/nuc932.c65
-rw-r--r--arch/arm/mach-nuc93x/nuc932.h29
-rw-r--r--arch/arm/mach-nuc93x/time.c100
29 files changed, 1327 insertions, 0 deletions
diff --git a/arch/arm/mach-nuc93x/Kconfig b/arch/arm/mach-nuc93x/Kconfig
new file mode 100644
index 000000000000..2bc40a280fad
--- /dev/null
+++ b/arch/arm/mach-nuc93x/Kconfig
@@ -0,0 +1,19 @@
1if ARCH_NUC93X
2
3config CPU_NUC932
4 bool
5 help
6 Support for NUC932 of Nuvoton NUC93X CPUs.
7
8menu "NUC932 Machines"
9
10config MACH_NUC932EVB
11 bool "Nuvoton NUC932 Evaluation Board"
12 default y
13 select CPU_NUC932
14 help
15 Say Y here if you are using the Nuvoton NUC932EVB
16
17endmenu
18
19endif
diff --git a/arch/arm/mach-nuc93x/Makefile b/arch/arm/mach-nuc93x/Makefile
new file mode 100644
index 000000000000..440e2dec6c8a
--- /dev/null
+++ b/arch/arm/mach-nuc93x/Makefile
@@ -0,0 +1,14 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y := irq.o time.o dev.o cpu.o clock.o
8# NUC932 CPU support files
9
10obj-$(CONFIG_CPU_NUC932) += nuc932.o
11
12# machine support
13
14obj-$(CONFIG_MACH_NUC932EVB) += mach-nuc932evb.o
diff --git a/arch/arm/mach-nuc93x/Makefile.boot b/arch/arm/mach-nuc93x/Makefile.boot
new file mode 100644
index 000000000000..a057b546b6e5
--- /dev/null
+++ b/arch/arm/mach-nuc93x/Makefile.boot
@@ -0,0 +1,3 @@
1zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
3
diff --git a/arch/arm/mach-nuc93x/clock.c b/arch/arm/mach-nuc93x/clock.c
new file mode 100644
index 000000000000..0521efbc48c9
--- /dev/null
+++ b/arch/arm/mach-nuc93x/clock.c
@@ -0,0 +1,83 @@
1/*
2 * linux/arch/arm/mach-nuc93x/clock.c
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License.
11 */
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/list.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/string.h>
19#include <linux/clk.h>
20#include <linux/spinlock.h>
21#include <linux/platform_device.h>
22#include <linux/io.h>
23
24#include <mach/hardware.h>
25
26#include "clock.h"
27
28static DEFINE_SPINLOCK(clocks_lock);
29
30int clk_enable(struct clk *clk)
31{
32 unsigned long flags;
33
34 spin_lock_irqsave(&clocks_lock, flags);
35 if (clk->enabled++ == 0)
36 (clk->enable)(clk, 1);
37 spin_unlock_irqrestore(&clocks_lock, flags);
38
39 return 0;
40}
41EXPORT_SYMBOL(clk_enable);
42
43void clk_disable(struct clk *clk)
44{
45 unsigned long flags;
46
47 WARN_ON(clk->enabled == 0);
48
49 spin_lock_irqsave(&clocks_lock, flags);
50 if (--clk->enabled == 0)
51 (clk->enable)(clk, 0);
52 spin_unlock_irqrestore(&clocks_lock, flags);
53}
54EXPORT_SYMBOL(clk_disable);
55
56unsigned long clk_get_rate(struct clk *clk)
57{
58 return 27000000;
59}
60EXPORT_SYMBOL(clk_get_rate);
61
62void nuc93x_clk_enable(struct clk *clk, int enable)
63{
64 unsigned int clocks = clk->cken;
65 unsigned long clken;
66
67 clken = __raw_readl(NUC93X_VA_CLKPWR);
68
69 if (enable)
70 clken |= clocks;
71 else
72 clken &= ~clocks;
73
74 __raw_writel(clken, NUC93X_VA_CLKPWR);
75}
76
77void clks_register(struct clk_lookup *clks, size_t num)
78{
79 int i;
80
81 for (i = 0; i < num; i++)
82 clkdev_add(&clks[i]);
83}
diff --git a/arch/arm/mach-nuc93x/clock.h b/arch/arm/mach-nuc93x/clock.h
new file mode 100644
index 000000000000..18e51be4816f
--- /dev/null
+++ b/arch/arm/mach-nuc93x/clock.h
@@ -0,0 +1,36 @@
1/*
2 * linux/arch/arm/mach-nuc93x/clock.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License.
11 */
12
13#include <asm/clkdev.h>
14
15void nuc93x_clk_enable(struct clk *clk, int enable);
16void clks_register(struct clk_lookup *clks, size_t num);
17
18struct clk {
19 unsigned long cken;
20 unsigned int enabled;
21 void (*enable)(struct clk *, int enable);
22};
23
24#define DEFINE_CLK(_name, _ctrlbit) \
25struct clk clk_##_name = { \
26 .enable = nuc93x_clk_enable, \
27 .cken = (1 << _ctrlbit), \
28 }
29
30#define DEF_CLKLOOK(_clk, _devname, _conname) \
31 { \
32 .clk = _clk, \
33 .dev_id = _devname, \
34 .con_id = _conname, \
35 }
36
diff --git a/arch/arm/mach-nuc93x/cpu.c b/arch/arm/mach-nuc93x/cpu.c
new file mode 100644
index 000000000000..f6ff5d87354c
--- /dev/null
+++ b/arch/arm/mach-nuc93x/cpu.c
@@ -0,0 +1,135 @@
1/*
2 * linux/arch/arm/mach-nuc93x/cpu.c
3 *
4 * Copyright (c) 2009 Nuvoton corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * NUC93x series cpu common support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation;version 2 of the License.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/types.h>
18#include <linux/interrupt.h>
19#include <linux/list.h>
20#include <linux/timer.h>
21#include <linux/init.h>
22#include <linux/platform_device.h>
23#include <linux/io.h>
24#include <linux/serial_8250.h>
25#include <linux/delay.h>
26
27#include <asm/mach/arch.h>
28#include <asm/mach/map.h>
29#include <asm/mach/irq.h>
30#include <asm/irq.h>
31
32#include <mach/hardware.h>
33#include <mach/regs-serial.h>
34#include <mach/regs-clock.h>
35#include <mach/regs-ebi.h>
36
37#include "cpu.h"
38#include "clock.h"
39
40/* Initial IO mappings */
41
42static struct map_desc nuc93x_iodesc[] __initdata = {
43 IODESC_ENT(IRQ),
44 IODESC_ENT(GCR),
45 IODESC_ENT(UART),
46 IODESC_ENT(TIMER),
47 IODESC_ENT(EBI),
48};
49
50/* Initial nuc932 clock declarations. */
51static DEFINE_CLK(audio, 2);
52static DEFINE_CLK(sd, 3);
53static DEFINE_CLK(jpg, 4);
54static DEFINE_CLK(video, 5);
55static DEFINE_CLK(vpost, 6);
56static DEFINE_CLK(2d, 7);
57static DEFINE_CLK(gpu, 8);
58static DEFINE_CLK(gdma, 9);
59static DEFINE_CLK(adc, 10);
60static DEFINE_CLK(uart, 11);
61static DEFINE_CLK(spi, 12);
62static DEFINE_CLK(pwm, 13);
63static DEFINE_CLK(timer, 14);
64static DEFINE_CLK(wdt, 15);
65static DEFINE_CLK(ac97, 16);
66static DEFINE_CLK(i2s, 16);
67static DEFINE_CLK(usbck, 17);
68static DEFINE_CLK(usb48, 18);
69static DEFINE_CLK(usbh, 19);
70static DEFINE_CLK(i2c, 20);
71static DEFINE_CLK(ext, 0);
72
73static struct clk_lookup nuc932_clkregs[] = {
74 DEF_CLKLOOK(&clk_audio, "nuc932-audio", NULL),
75 DEF_CLKLOOK(&clk_sd, "nuc932-sd", NULL),
76 DEF_CLKLOOK(&clk_jpg, "nuc932-jpg", "NULL"),
77 DEF_CLKLOOK(&clk_video, "nuc932-video", "NULL"),
78 DEF_CLKLOOK(&clk_vpost, "nuc932-vpost", NULL),
79 DEF_CLKLOOK(&clk_2d, "nuc932-2d", NULL),
80 DEF_CLKLOOK(&clk_gpu, "nuc932-gpu", NULL),
81 DEF_CLKLOOK(&clk_gdma, "nuc932-gdma", "NULL"),
82 DEF_CLKLOOK(&clk_adc, "nuc932-adc", NULL),
83 DEF_CLKLOOK(&clk_uart, NULL, "uart"),
84 DEF_CLKLOOK(&clk_spi, "nuc932-spi", NULL),
85 DEF_CLKLOOK(&clk_pwm, "nuc932-pwm", NULL),
86 DEF_CLKLOOK(&clk_timer, NULL, "timer"),
87 DEF_CLKLOOK(&clk_wdt, "nuc932-wdt", NULL),
88 DEF_CLKLOOK(&clk_ac97, "nuc932-ac97", NULL),
89 DEF_CLKLOOK(&clk_i2s, "nuc932-i2s", NULL),
90 DEF_CLKLOOK(&clk_usbck, "nuc932-usbck", NULL),
91 DEF_CLKLOOK(&clk_usb48, "nuc932-usb48", NULL),
92 DEF_CLKLOOK(&clk_usbh, "nuc932-usbh", NULL),
93 DEF_CLKLOOK(&clk_i2c, "nuc932-i2c", NULL),
94 DEF_CLKLOOK(&clk_ext, NULL, "ext"),
95};
96
97/* Initial serial platform data */
98
99struct plat_serial8250_port nuc93x_uart_data[] = {
100 NUC93X_8250PORT(UART0),
101 {},
102};
103
104struct platform_device nuc93x_serial_device = {
105 .name = "serial8250",
106 .id = PLAT8250_DEV_PLATFORM,
107 .dev = {
108 .platform_data = nuc93x_uart_data,
109 },
110};
111
112/*Init NUC93x evb io*/
113
114void __init nuc93x_map_io(struct map_desc *mach_desc, int mach_size)
115{
116 unsigned long idcode = 0x0;
117
118 iotable_init(mach_desc, mach_size);
119 iotable_init(nuc93x_iodesc, ARRAY_SIZE(nuc93x_iodesc));
120
121 idcode = __raw_readl(NUC93XPDID);
122 if (idcode == NUC932_CPUID)
123 printk(KERN_INFO "CPU type 0x%08lx is NUC910\n", idcode);
124 else
125 printk(KERN_ERR "CPU type detect error!\n");
126
127}
128
129/*Init NUC93x clock*/
130
131void __init nuc93x_init_clocks(void)
132{
133 clks_register(nuc932_clkregs, ARRAY_SIZE(nuc932_clkregs));
134}
135
diff --git a/arch/arm/mach-nuc93x/cpu.h b/arch/arm/mach-nuc93x/cpu.h
new file mode 100644
index 000000000000..9def28197bc9
--- /dev/null
+++ b/arch/arm/mach-nuc93x/cpu.h
@@ -0,0 +1,48 @@
1/*
2 * arch/arm/mach-nuc93x/cpu.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Header file for NUC93X CPU support
8 *
9 * Wan ZongShun <mcuos.com@gmail.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 */
16
17#define IODESC_ENT(y) \
18{ \
19 .virtual = (unsigned long)NUC93X_VA_##y, \
20 .pfn = __phys_to_pfn(NUC93X_PA_##y), \
21 .length = NUC93X_SZ_##y, \
22 .type = MT_DEVICE, \
23}
24
25#define NUC93X_8250PORT(name) \
26{ \
27 .membase = name##_BA, \
28 .mapbase = name##_PA, \
29 .irq = IRQ_##name, \
30 .uartclk = 57139200, \
31 .regshift = 2, \
32 .iotype = UPIO_MEM, \
33 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, \
34}
35
36/*Cpu identifier register*/
37
38#define NUC93XPDID NUC93X_VA_GCR
39#define NUC932_CPUID 0x29550091
40
41/* extern file from cpu.c */
42
43extern void nuc93x_clock_source(struct device *dev, unsigned char *src);
44extern void nuc93x_init_clocks(void);
45extern void nuc93x_map_io(struct map_desc *mach_desc, int mach_size);
46extern void nuc93x_board_init(struct platform_device **device, int size);
47extern struct platform_device nuc93x_serial_device;
48
diff --git a/arch/arm/mach-nuc93x/dev.c b/arch/arm/mach-nuc93x/dev.c
new file mode 100644
index 000000000000..a962ae9578d6
--- /dev/null
+++ b/arch/arm/mach-nuc93x/dev.c
@@ -0,0 +1,42 @@
1/*
2 * linux/arch/arm/mach-nuc93x/dev.c
3 *
4 * Copyright (C) 2009 Nuvoton corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation;version 2 of the License.
11 *
12 */
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/interrupt.h>
17#include <linux/list.h>
18#include <linux/timer.h>
19#include <linux/init.h>
20#include <linux/platform_device.h>
21
22#include <asm/mach/arch.h>
23#include <asm/mach/map.h>
24#include <asm/mach/irq.h>
25#include <asm/mach-types.h>
26
27#include "cpu.h"
28
29/*Here should be your evb resourse,such as LCD*/
30
31static struct platform_device *nuc93x_public_dev[] __initdata = {
32 &nuc93x_serial_device,
33};
34
35/* Provide adding specific CPU platform devices API */
36
37void __init nuc93x_board_init(struct platform_device **device, int size)
38{
39 platform_add_devices(device, size);
40 platform_add_devices(nuc93x_public_dev, ARRAY_SIZE(nuc93x_public_dev));
41}
42
diff --git a/arch/arm/mach-nuc93x/include/mach/clkdev.h b/arch/arm/mach-nuc93x/include/mach/clkdev.h
new file mode 100644
index 000000000000..04b37a89801c
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/clkdev.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_MACH_CLKDEV_H
2#define __ASM_MACH_CLKDEV_H
3
4#define __clk_get(clk) ({ 1; })
5#define __clk_put(clk) do { } while (0)
6
7#endif
diff --git a/arch/arm/mach-nuc93x/include/mach/entry-macro.S b/arch/arm/mach-nuc93x/include/mach/entry-macro.S
new file mode 100644
index 000000000000..1352cbda3797
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/entry-macro.S
@@ -0,0 +1,32 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/entry-macro.S
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 *
8 */
9
10#include <mach/hardware.h>
11#include <mach/regs-irq.h>
12
13 .macro get_irqnr_preamble, base, tmp
14 .endm
15
16 .macro arch_ret_to_user, tmp1, tmp2
17 .endm
18
19 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
20
21 mov \base, #AIC_BA
22
23 ldr \irqnr, [ \base, #AIC_IPER]
24 ldr \irqnr, [ \base, #AIC_ISNR]
25 cmp \irqnr, #0
26
27 .endm
28
29 /* currently don't need an disable_fiq macro */
30
31 .macro disable_fiq
32 .endm
diff --git a/arch/arm/mach-nuc93x/include/mach/hardware.h b/arch/arm/mach-nuc93x/include/mach/hardware.h
new file mode 100644
index 000000000000..fb5c6fcb142e
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/hardware.h
@@ -0,0 +1,22 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/hardware.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#ifndef __ASM_ARCH_HARDWARE_H
17#define __ASM_ARCH_HARDWARE_H
18
19#include <asm/sizes.h>
20#include <mach/map.h>
21
22#endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-nuc93x/include/mach/io.h b/arch/arm/mach-nuc93x/include/mach/io.h
new file mode 100644
index 000000000000..72e5051c7534
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/io.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/io.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#ifndef __ASM_ARM_ARCH_IO_H
17#define __ASM_ARM_ARCH_IO_H
18
19#define IO_SPACE_LIMIT 0xffffffff
20
21/*
22 * 1:1 mapping for ioremapped regions.
23 */
24
25#define __mem_pci(a) (a)
26#define __io(a) __typesafe_io(a)
27
28#endif
diff --git a/arch/arm/mach-nuc93x/include/mach/irqs.h b/arch/arm/mach-nuc93x/include/mach/irqs.h
new file mode 100644
index 000000000000..7c4aa71edb44
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/irqs.h
@@ -0,0 +1,59 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/irqs.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation;version 2 of the License.
11 *
12 */
13
14#ifndef __ASM_ARCH_IRQS_H
15#define __ASM_ARCH_IRQS_H
16
17#define NUC93X_IRQ(x) (x)
18
19/* Main cpu interrupts */
20
21#define IRQ_WDT NUC93X_IRQ(1)
22#define IRQ_IRQ0 NUC93X_IRQ(2)
23#define IRQ_IRQ1 NUC93X_IRQ(3)
24#define IRQ_IRQ2 NUC93X_IRQ(4)
25#define IRQ_IRQ3 NUC93X_IRQ(5)
26#define IRQ_USBH NUC93X_IRQ(6)
27#define IRQ_APU NUC93X_IRQ(7)
28#define IRQ_VPOST NUC93X_IRQ(8)
29#define IRQ_ADC NUC93X_IRQ(9)
30#define IRQ_UART0 NUC93X_IRQ(10)
31#define IRQ_TIMER0 NUC93X_IRQ(11)
32#define IRQ_GPU0 NUC93X_IRQ(12)
33#define IRQ_GPU1 NUC93X_IRQ(13)
34#define IRQ_GPU2 NUC93X_IRQ(14)
35#define IRQ_GPU3 NUC93X_IRQ(15)
36#define IRQ_GPU4 NUC93X_IRQ(16)
37#define IRQ_VIN NUC93X_IRQ(17)
38#define IRQ_USBD NUC93X_IRQ(18)
39#define IRQ_VRAMLD NUC93X_IRQ(19)
40#define IRQ_GDMA0 NUC93X_IRQ(20)
41#define IRQ_GDMA1 NUC93X_IRQ(21)
42#define IRQ_SDIO NUC93X_IRQ(22)
43#define IRQ_FMI NUC93X_IRQ(22)
44#define IRQ_JPEG NUC93X_IRQ(23)
45#define IRQ_SPI0 NUC93X_IRQ(24)
46#define IRQ_SPI1 NUC93X_IRQ(25)
47#define IRQ_RTC NUC93X_IRQ(26)
48#define IRQ_PWM0 NUC93X_IRQ(27)
49#define IRQ_PWM1 NUC93X_IRQ(28)
50#define IRQ_PWM2 NUC93X_IRQ(29)
51#define IRQ_PWM3 NUC93X_IRQ(30)
52#define IRQ_I2SAC97 NUC93X_IRQ(31)
53#define IRQ_CAP0 IRQ_PWM0
54#define IRQ_CAP1 IRQ_PWM1
55#define IRQ_CAP2 IRQ_PWM2
56#define IRQ_CAP3 IRQ_PWM3
57#define NR_IRQS (IRQ_I2SAC97 + 1)
58
59#endif /* __ASM_ARCH_IRQ_H */
diff --git a/arch/arm/mach-nuc93x/include/mach/map.h b/arch/arm/mach-nuc93x/include/mach/map.h
new file mode 100644
index 000000000000..fd0b5e89f0e7
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/map.h
@@ -0,0 +1,139 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/map.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation;version 2 of the License.
11 *
12 */
13
14#ifndef __ASM_ARCH_MAP_H
15#define __ASM_ARCH_MAP_H
16
17#define MAP_OFFSET (0xfff00000)
18#define CLK_OFFSET (0x10)
19
20#ifndef __ASSEMBLY__
21#define NUC93X_ADDR(x) ((void __iomem *)(0xF0000000 + ((x)&(~MAP_OFFSET))))
22#else
23#define NUC93X_ADDR(x) (0xF0000000 + ((x)&(~MAP_OFFSET)))
24#endif
25
26 /*
27 * nuc932 hardware register definition
28 */
29
30#define NUC93X_PA_IRQ (0xFFF83000)
31#define NUC93X_PA_GCR (0xFFF00000)
32#define NUC93X_PA_EBI (0xFFF01000)
33#define NUC93X_PA_UART (0xFFF80000)
34#define NUC93X_PA_TIMER (0xFFF81000)
35#define NUC93X_PA_GPIO (0xFFF84000)
36#define NUC93X_PA_GDMA (0xFFF03000)
37#define NUC93X_PA_USBHOST (0xFFF0d000)
38#define NUC93X_PA_I2C (0xFFF89000)
39#define NUC93X_PA_LCD (0xFFF06000)
40#define NUC93X_PA_GE (0xFFF05000)
41#define NUC93X_PA_ADC (0xFFF85000)
42#define NUC93X_PA_RTC (0xFFF87000)
43#define NUC93X_PA_PWM (0xFFF82000)
44#define NUC93X_PA_ACTL (0xFFF0a000)
45#define NUC93X_PA_USBDEV (0xFFF0C000)
46#define NUC93X_PA_JEPEG (0xFFF0e000)
47#define NUC93X_PA_CACHE_T (0xFFF60000)
48#define NUC93X_PA_VRAM (0xFFF0b000)
49#define NUC93X_PA_DMAC (0xFFF09000)
50#define NUC93X_PA_I2SM (0xFFF08000)
51#define NUC93X_PA_CACHE (0xFFF02000)
52#define NUC93X_PA_GPU (0xFFF04000)
53#define NUC93X_PA_VIDEOIN (0xFFF07000)
54#define NUC93X_PA_SPI0 (0xFFF86000)
55#define NUC93X_PA_SPI1 (0xFFF88000)
56
57 /*
58 * nuc932 virtual address mapping.
59 * interrupt controller is the first thing we put in, to make
60 * the assembly code for the irq detection easier
61 */
62
63#define NUC93X_VA_IRQ NUC93X_ADDR(0x00000000)
64#define NUC93X_SZ_IRQ SZ_4K
65
66#define NUC93X_VA_GCR NUC93X_ADDR(NUC93X_PA_IRQ)
67#define NUC93X_VA_CLKPWR (NUC93X_VA_GCR+CLK_OFFSET)
68#define NUC93X_SZ_GCR SZ_4K
69
70/* EBI management */
71
72#define NUC93X_VA_EBI NUC93X_ADDR(NUC93X_PA_EBI)
73#define NUC93X_SZ_EBI SZ_4K
74
75/* UARTs */
76
77#define NUC93X_VA_UART NUC93X_ADDR(NUC93X_PA_UART)
78#define NUC93X_SZ_UART SZ_4K
79
80/* Timers */
81
82#define NUC93X_VA_TIMER NUC93X_ADDR(NUC93X_PA_TIMER)
83#define NUC93X_SZ_TIMER SZ_4K
84
85/* GPIO ports */
86
87#define NUC93X_VA_GPIO NUC93X_ADDR(NUC93X_PA_GPIO)
88#define NUC93X_SZ_GPIO SZ_4K
89
90/* GDMA control */
91
92#define NUC93X_VA_GDMA NUC93X_ADDR(NUC93X_PA_GDMA)
93#define NUC93X_SZ_GDMA SZ_4K
94
95/* I2C hardware controller */
96
97#define NUC93X_VA_I2C NUC93X_ADDR(NUC93X_PA_I2C)
98#define NUC93X_SZ_I2C SZ_4K
99
100/* LCD controller*/
101
102#define NUC93X_VA_LCD NUC93X_ADDR(NUC93X_PA_LCD)
103#define NUC93X_SZ_LCD SZ_4K
104
105/* 2D controller*/
106
107#define NUC93X_VA_GE NUC93X_ADDR(NUC93X_PA_GE)
108#define NUC93X_SZ_GE SZ_4K
109
110/* ADC */
111
112#define NUC93X_VA_ADC NUC93X_ADDR(NUC93X_PA_ADC)
113#define NUC93X_SZ_ADC SZ_4K
114
115/* RTC */
116
117#define NUC93X_VA_RTC NUC93X_ADDR(NUC93X_PA_RTC)
118#define NUC93X_SZ_RTC SZ_4K
119
120/* Pulse Width Modulation(PWM) Registers */
121
122#define NUC93X_VA_PWM NUC93X_ADDR(NUC93X_PA_PWM)
123#define NUC93X_SZ_PWM SZ_4K
124
125/* Audio Controller controller */
126
127#define NUC93X_VA_ACTL NUC93X_ADDR(NUC93X_PA_ACTL)
128#define NUC93X_SZ_ACTL SZ_4K
129
130/* USB Device port */
131
132#define NUC93X_VA_USBDEV NUC93X_ADDR(NUC93X_PA_USBDEV)
133#define NUC93X_SZ_USBDEV SZ_4K
134
135/* USB host controller*/
136#define NUC93X_VA_USBHOST NUC93X_ADDR(NUC93X_PA_USBHOST)
137#define NUC93X_SZ_USBHOST SZ_4K
138
139#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-nuc93x/include/mach/memory.h b/arch/arm/mach-nuc93x/include/mach/memory.h
new file mode 100644
index 000000000000..323ab0db3f7d
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/memory.h
@@ -0,0 +1,21 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/memory.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#ifndef __ASM_ARCH_MEMORY_H
17#define __ASM_ARCH_MEMORY_H
18
19#define PHYS_OFFSET UL(0x00000000)
20
21#endif
diff --git a/arch/arm/mach-nuc93x/include/mach/regs-clock.h b/arch/arm/mach-nuc93x/include/mach/regs-clock.h
new file mode 100644
index 000000000000..5cb2954fbec2
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/regs-clock.h
@@ -0,0 +1,53 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/regs-clock.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation;version 2 of the License.
11 *
12 */
13
14#ifndef __ASM_ARCH_REGS_CLOCK_H
15#define __ASM_ARCH_REGS_CLOCK_H
16
17/* Clock Control Registers */
18#define CLK_BA NUC93X_VA_CLKPWR
19#define REG_CLKEN (CLK_BA + 0x00)
20#define REG_CLKSEL (CLK_BA + 0x04)
21#define REG_CLKDIV (CLK_BA + 0x08)
22#define REG_PLLCON0 (CLK_BA + 0x0C)
23#define REG_PLLCON1 (CLK_BA + 0x10)
24#define REG_PMCON (CLK_BA + 0x14)
25#define REG_IRQWAKECON (CLK_BA + 0x18)
26#define REG_IRQWAKEFLAG (CLK_BA + 0x1C)
27#define REG_IPSRST (CLK_BA + 0x20)
28#define REG_CLKEN1 (CLK_BA + 0x24)
29#define REG_CLKDIV1 (CLK_BA + 0x28)
30
31/* Define PLL freq setting */
32#define PLL_DISABLE 0x12B63
33#define PLL_66MHZ 0x2B63
34#define PLL_100MHZ 0x4F64
35#define PLL_120MHZ 0x4F63
36#define PLL_166MHZ 0x4124
37#define PLL_200MHZ 0x4F24
38
39/* Define AHB:CPUFREQ ratio */
40#define AHB_CPUCLK_1_1 0x00
41#define AHB_CPUCLK_1_2 0x01
42#define AHB_CPUCLK_1_4 0x02
43#define AHB_CPUCLK_1_8 0x03
44
45/* Define APB:AHB ratio */
46#define APB_AHB_1_2 0x01
47#define APB_AHB_1_4 0x02
48#define APB_AHB_1_8 0x03
49
50/* Define clock skew */
51#define DEFAULTSKEW 0x48
52
53#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-nuc93x/include/mach/regs-ebi.h b/arch/arm/mach-nuc93x/include/mach/regs-ebi.h
new file mode 100644
index 000000000000..3c72550e28e4
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/regs-ebi.h
@@ -0,0 +1,33 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/regs-ebi.h
3 *
4 * Copyright (c) 2009 Nuvoton technology corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation;version 2 of the License.
11 *
12 */
13
14#ifndef __ASM_ARCH_REGS_EBI_H
15#define __ASM_ARCH_REGS_EBI_H
16
17/* EBI Control Registers */
18
19#define EBI_BA NUC93X_VA_EBI
20#define REG_EBICON (EBI_BA + 0x00)
21#define REG_ROMCON (EBI_BA + 0x04)
22#define REG_SDCONF0 (EBI_BA + 0x08)
23#define REG_SDCONF1 (EBI_BA + 0x0C)
24#define REG_SDTIME0 (EBI_BA + 0x10)
25#define REG_SDTIME1 (EBI_BA + 0x14)
26#define REG_EXT0CON (EBI_BA + 0x18)
27#define REG_EXT1CON (EBI_BA + 0x1C)
28#define REG_EXT2CON (EBI_BA + 0x20)
29#define REG_EXT3CON (EBI_BA + 0x24)
30#define REG_EXT4CON (EBI_BA + 0x28)
31#define REG_CKSKEW (EBI_BA + 0x2C)
32
33#endif /* __ASM_ARCH_REGS_EBI_H */
diff --git a/arch/arm/mach-nuc93x/include/mach/regs-irq.h b/arch/arm/mach-nuc93x/include/mach/regs-irq.h
new file mode 100644
index 000000000000..23021592de51
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/regs-irq.h
@@ -0,0 +1,42 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/regs-irq.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#ifndef ___ASM_ARCH_REGS_IRQ_H
17#define ___ASM_ARCH_REGS_IRQ_H
18
19/* Advance Interrupt Controller (AIC) Registers */
20
21#define AIC_BA NUC93X_VA_IRQ
22
23#define REG_AIC_IRQSC (AIC_BA+0x80)
24#define REG_AIC_GEN (AIC_BA+0x84)
25#define REG_AIC_GASR (AIC_BA+0x88)
26#define REG_AIC_GSCR (AIC_BA+0x8C)
27#define REG_AIC_IRSR (AIC_BA+0x100)
28#define REG_AIC_IASR (AIC_BA+0x104)
29#define REG_AIC_ISR (AIC_BA+0x108)
30#define REG_AIC_IPER (AIC_BA+0x10C)
31#define REG_AIC_ISNR (AIC_BA+0x110)
32#define REG_AIC_IMR (AIC_BA+0x114)
33#define REG_AIC_OISR (AIC_BA+0x118)
34#define REG_AIC_MECR (AIC_BA+0x120)
35#define REG_AIC_MDCR (AIC_BA+0x124)
36#define REG_AIC_SSCR (AIC_BA+0x128)
37#define REG_AIC_SCCR (AIC_BA+0x12C)
38#define REG_AIC_EOSCR (AIC_BA+0x130)
39#define AIC_IPER (0x10C)
40#define AIC_ISNR (0x110)
41
42#endif /* ___ASM_ARCH_REGS_IRQ_H */
diff --git a/arch/arm/mach-nuc93x/include/mach/regs-serial.h b/arch/arm/mach-nuc93x/include/mach/regs-serial.h
new file mode 100644
index 000000000000..767a047a8bc2
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/regs-serial.h
@@ -0,0 +1,52 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/regs-serial.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#ifndef __ASM_ARM_REGS_SERIAL_H
17#define __ASM_ARM_REGS_SERIAL_H
18
19#define UART0_BA NUC93X_VA_UART
20#define UART1_BA (NUC93X_VA_UART+0x100)
21
22#define UART0_PA NUC93X_PA_UART
23#define UART1_PA (NUC93X_PA_UART+0x100)
24
25
26#ifndef __ASSEMBLY__
27
28struct nuc93x_uart_clksrc {
29 const char *name;
30 unsigned int divisor;
31 unsigned int min_baud;
32 unsigned int max_baud;
33};
34
35struct nuc93x_uartcfg {
36 unsigned char hwport;
37 unsigned char unused;
38 unsigned short flags;
39 unsigned long uart_flags;
40
41 unsigned long ucon;
42 unsigned long ulcon;
43 unsigned long ufcon;
44
45 struct nuc93x_uart_clksrc *clocks;
46 unsigned int clocks_size;
47};
48
49#endif /* __ASSEMBLY__ */
50
51#endif /* __ASM_ARM_REGS_SERIAL_H */
52
diff --git a/arch/arm/mach-nuc93x/include/mach/regs-timer.h b/arch/arm/mach-nuc93x/include/mach/regs-timer.h
new file mode 100644
index 000000000000..394be9614d36
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/regs-timer.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/regs-timer.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#ifndef __ASM_ARCH_REGS_TIMER_H
17#define __ASM_ARCH_REGS_TIMER_H
18
19/* Timer Registers */
20
21#define TMR_BA NUC93X_VA_TIMER
22#define REG_TCSR0 (TMR_BA+0x00)
23#define REG_TICR0 (TMR_BA+0x08)
24#define REG_TDR0 (TMR_BA+0x10)
25#define REG_TISR (TMR_BA+0x18)
26#define REG_WTCR (TMR_BA+0x1C)
27
28#endif /* __ASM_ARCH_REGS_TIMER_H */
diff --git a/arch/arm/mach-nuc93x/include/mach/system.h b/arch/arm/mach-nuc93x/include/mach/system.h
new file mode 100644
index 000000000000..d26bd9a52844
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/system.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/machnuc93x/include/mach/system.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/system.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#include <asm/proc-fns.h>
19
20static void arch_idle(void)
21{
22}
23
24static void arch_reset(char mode, const char *cmd)
25{
26 cpu_reset(0);
27}
28
diff --git a/arch/arm/mach-nuc93x/include/mach/timex.h b/arch/arm/mach-nuc93x/include/mach/timex.h
new file mode 100644
index 000000000000..0c719cc91aa9
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/timex.h
@@ -0,0 +1,25 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/timex.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/timex.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_TIMEX_H
19#define __ASM_ARCH_TIMEX_H
20
21/* CLOCK_TICK_RATE Now, I don't use it. */
22
23#define CLOCK_TICK_RATE 27000000
24
25#endif /* __ASM_ARCH_TIMEX_H */
diff --git a/arch/arm/mach-nuc93x/include/mach/uncompress.h b/arch/arm/mach-nuc93x/include/mach/uncompress.h
new file mode 100644
index 000000000000..73082cd61e84
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/uncompress.h
@@ -0,0 +1,50 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/uncompress.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/uncompress.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_UNCOMPRESS_H
19#define __ASM_ARCH_UNCOMPRESS_H
20
21/* Defines for UART registers */
22
23#include <mach/regs-serial.h>
24#include <mach/map.h>
25#include <linux/serial_reg.h>
26
27#define arch_decomp_wdog()
28
29#define TX_DONE (UART_LSR_TEMT | UART_LSR_THRE)
30static u32 * uart_base = (u32 *)UART0_PA;
31
32static void putc(int ch)
33{
34 /* Check THRE and TEMT bits before we transmit the character.
35 */
36 while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
37 barrier();
38
39 *uart_base = ch;
40}
41
42static inline void flush(void)
43{
44}
45
46static void arch_decomp_setup(void)
47{
48}
49
50#endif/* __ASM_NUC93X_UNCOMPRESS_H */
diff --git a/arch/arm/mach-nuc93x/include/mach/vmalloc.h b/arch/arm/mach-nuc93x/include/mach/vmalloc.h
new file mode 100644
index 000000000000..98a21b81dec0
--- /dev/null
+++ b/arch/arm/mach-nuc93x/include/mach/vmalloc.h
@@ -0,0 +1,23 @@
1/*
2 * arch/arm/mach-nuc93x/include/mach/vmalloc.h
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * Based on arch/arm/mach-s3c2410/include/mach/vmalloc.h
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 */
17
18#ifndef __ASM_ARCH_VMALLOC_H
19#define __ASM_ARCH_VMALLOC_H
20
21#define VMALLOC_END (0xE0000000)
22
23#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-nuc93x/irq.c b/arch/arm/mach-nuc93x/irq.c
new file mode 100644
index 000000000000..a7a88ea4ec31
--- /dev/null
+++ b/arch/arm/mach-nuc93x/irq.c
@@ -0,0 +1,66 @@
1/*
2 * linux/arch/arm/mach-nuc93x/irq.c
3 *
4 * Copyright (c) 2008 Nuvoton technology corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation;version 2 of the License.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/interrupt.h>
17#include <linux/ioport.h>
18#include <linux/ptrace.h>
19#include <linux/sysdev.h>
20#include <linux/io.h>
21
22#include <asm/irq.h>
23#include <asm/mach/irq.h>
24
25#include <mach/hardware.h>
26#include <mach/regs-irq.h>
27
28static void nuc93x_irq_mask(unsigned int irq)
29{
30 __raw_writel(1 << irq, REG_AIC_MDCR);
31}
32
33/*
34 * By the w90p910 spec,any irq,only write 1
35 * to REG_AIC_EOSCR for ACK
36 */
37
38static void nuc93x_irq_ack(unsigned int irq)
39{
40 __raw_writel(0x01, REG_AIC_EOSCR);
41}
42
43static void nuc93x_irq_unmask(unsigned int irq)
44{
45 __raw_writel(1 << irq, REG_AIC_MECR);
46
47}
48
49static struct irq_chip nuc93x_irq_chip = {
50 .ack = nuc93x_irq_ack,
51 .mask = nuc93x_irq_mask,
52 .unmask = nuc93x_irq_unmask,
53};
54
55void __init nuc93x_init_irq(void)
56{
57 int irqno;
58
59 __raw_writel(0xFFFFFFFE, REG_AIC_MDCR);
60
61 for (irqno = IRQ_WDT; irqno <= NR_IRQS; irqno++) {
62 set_irq_chip(irqno, &nuc93x_irq_chip);
63 set_irq_handler(irqno, handle_level_irq);
64 set_irq_flags(irqno, IRQF_VALID);
65 }
66}
diff --git a/arch/arm/mach-nuc93x/mach-nuc932evb.c b/arch/arm/mach-nuc93x/mach-nuc932evb.c
new file mode 100644
index 000000000000..9f79266f08e2
--- /dev/null
+++ b/arch/arm/mach-nuc93x/mach-nuc932evb.c
@@ -0,0 +1,45 @@
1/*
2 * linux/arch/arm/mach-w90x900/mach-nuc910evb.c
3 *
4 * Based on mach-s3c2410/mach-smdk2410.c by Jonas Dietsche
5 *
6 * Copyright (C) 2008 Nuvoton technology corporation.
7 *
8 * Wan ZongShun <mcuos.com@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation;version 2 of the License.
13 *
14 */
15
16#include <linux/platform_device.h>
17#include <asm/mach/arch.h>
18#include <asm/mach/map.h>
19#include <asm/mach-types.h>
20#include <mach/map.h>
21
22#include "nuc932.h"
23
24static void __init nuc932evb_map_io(void)
25{
26 nuc932_map_io();
27 nuc932_init_clocks();
28 nuc932_init_uartclk();
29}
30
31static void __init nuc932evb_init(void)
32{
33 nuc932_board_init();
34}
35
36MACHINE_START(NUC932EVB, "NUC932EVB")
37 /* Maintainer: Wan ZongShun */
38 .phys_io = NUC93X_PA_UART,
39 .io_pg_offst = (((u32)NUC93X_VA_UART) >> 18) & 0xfffc,
40 .boot_params = 0,
41 .map_io = nuc932evb_map_io,
42 .init_irq = nuc93x_init_irq,
43 .init_machine = nuc932evb_init,
44 .timer = &nuc93x_timer,
45MACHINE_END
diff --git a/arch/arm/mach-nuc93x/nuc932.c b/arch/arm/mach-nuc93x/nuc932.c
new file mode 100644
index 000000000000..3966ead686fc
--- /dev/null
+++ b/arch/arm/mach-nuc93x/nuc932.c
@@ -0,0 +1,65 @@
1/*
2 * linux/arch/arm/mach-nuc93x/nuc932.c
3 *
4 * Copyright (c) 2009 Nuvoton corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * NUC932 cpu support
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation;version 2 of the License.
13 *
14 */
15
16#include <linux/platform_device.h>
17#include <linux/clk.h>
18#include <linux/err.h>
19
20#include <asm/mach/map.h>
21#include <mach/hardware.h>
22
23#include "cpu.h"
24#include "clock.h"
25
26/* define specific CPU platform device */
27
28static struct platform_device *nuc932_dev[] __initdata = {
29};
30
31/* define specific CPU platform io map */
32
33static struct map_desc nuc932evb_iodesc[] __initdata = {
34};
35
36/*Init NUC932 evb io*/
37
38void __init nuc932_map_io(void)
39{
40 nuc93x_map_io(nuc932evb_iodesc, ARRAY_SIZE(nuc932evb_iodesc));
41}
42
43/*Init NUC932 clock*/
44
45void __init nuc932_init_clocks(void)
46{
47 nuc93x_init_clocks();
48}
49
50/*enable NUC932 uart clock*/
51
52void __init nuc932_init_uartclk(void)
53{
54 struct clk *ck_uart = clk_get(NULL, "uart");
55 BUG_ON(IS_ERR(ck_uart));
56
57 clk_enable(ck_uart);
58}
59
60/*Init NUC932 board info*/
61
62void __init nuc932_board_init(void)
63{
64 nuc93x_board_init(nuc932_dev, ARRAY_SIZE(nuc932_dev));
65}
diff --git a/arch/arm/mach-nuc93x/nuc932.h b/arch/arm/mach-nuc93x/nuc932.h
new file mode 100644
index 000000000000..9a66edd5338f
--- /dev/null
+++ b/arch/arm/mach-nuc93x/nuc932.h
@@ -0,0 +1,29 @@
1/*
2 * arch/arm/mach-nuc93x/nuc932.h
3 *
4 * Copyright (c) 2008 Nuvoton corporation
5 *
6 * Header file for NUC93x CPU support
7 *
8 * Wan ZongShun <mcuos.com@gmail.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 */
15
16struct map_desc;
17struct sys_timer;
18
19/* core initialisation functions */
20
21extern void nuc93x_init_irq(void);
22extern struct sys_timer nuc93x_timer;
23
24/* extern file from nuc932.c */
25
26extern void nuc932_board_init(void);
27extern void nuc932_init_clocks(void);
28extern void nuc932_map_io(void);
29extern void nuc932_init_uartclk(void);
diff --git a/arch/arm/mach-nuc93x/time.c b/arch/arm/mach-nuc93x/time.c
new file mode 100644
index 000000000000..2f90f9dc6e30
--- /dev/null
+++ b/arch/arm/mach-nuc93x/time.c
@@ -0,0 +1,100 @@
1/*
2 * linux/arch/arm/mach-nuc93x/time.c
3 *
4 * Copyright (c) 2009 Nuvoton technology corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/sched.h>
17#include <linux/init.h>
18#include <linux/interrupt.h>
19#include <linux/err.h>
20#include <linux/clk.h>
21#include <linux/io.h>
22#include <linux/leds.h>
23
24#include <asm/mach-types.h>
25#include <asm/mach/irq.h>
26#include <asm/mach/time.h>
27
28#include <mach/system.h>
29#include <mach/map.h>
30#include <mach/regs-timer.h>
31
32#define RESETINT 0x01
33#define PERIOD (0x01 << 27)
34#define ONESHOT (0x00 << 27)
35#define COUNTEN (0x01 << 30)
36#define INTEN (0x01 << 29)
37
38#define TICKS_PER_SEC 100
39#define PRESCALE 0x63 /* Divider = prescale + 1 */
40
41unsigned int timer0_load;
42
43static unsigned long nuc93x_gettimeoffset(void)
44{
45 return 0;
46}
47
48/*IRQ handler for the timer*/
49
50static irqreturn_t nuc93x_timer_interrupt(int irq, void *dev_id)
51{
52 timer_tick();
53 __raw_writel(0x01, REG_TISR); /* clear TIF0 */
54 return IRQ_HANDLED;
55}
56
57static struct irqaction nuc93x_timer_irq = {
58 .name = "nuc93x Timer Tick",
59 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
60 .handler = nuc93x_timer_interrupt,
61};
62
63/*Set up timer reg.*/
64
65static void nuc93x_timer_setup(void)
66{
67 struct clk *ck_ext = clk_get(NULL, "ext");
68 struct clk *ck_timer = clk_get(NULL, "timer");
69 unsigned int rate, val = 0;
70
71 BUG_ON(IS_ERR(ck_ext) || IS_ERR(ck_timer));
72
73 clk_enable(ck_timer);
74 rate = clk_get_rate(ck_ext);
75 clk_put(ck_ext);
76 rate = rate / (PRESCALE + 0x01);
77
78 /* set a known state */
79 __raw_writel(0x00, REG_TCSR0);
80 __raw_writel(RESETINT, REG_TISR);
81
82 timer0_load = (rate / TICKS_PER_SEC);
83 __raw_writel(timer0_load, REG_TICR0);
84
85 val |= (PERIOD | COUNTEN | INTEN | PRESCALE);;
86 __raw_writel(val, REG_TCSR0);
87
88}
89
90static void __init nuc93x_timer_init(void)
91{
92 nuc93x_timer_setup();
93 setup_irq(IRQ_TIMER0, &nuc93x_timer_irq);
94}
95
96struct sys_timer nuc93x_timer = {
97 .init = nuc93x_timer_init,
98 .offset = nuc93x_gettimeoffset,
99 .resume = nuc93x_timer_setup
100};