aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <sascha@saschahauer.de>2006-06-19 10:27:53 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-06-19 10:27:53 -0400
commitbb6d8c8828123e01e2ae6c9d9c4870477889fd94 (patch)
tree43d7a6ec2cc15f1bf8810a65aa38d508c7fa955a /arch
parent3095faf5295f2da9118469c925d2cfb7775ad287 (diff)
[ARM] 3567/2: arm: base support for Hilscher netX
Patch from Sascha Hauer This patch adds the base support for Hilscher's netX network processors. Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig8
-rw-r--r--arch/arm/Makefile1
-rw-r--r--arch/arm/mach-netx/Makefile11
-rw-r--r--arch/arm/mach-netx/Makefile.boot2
-rw-r--r--arch/arm/mach-netx/generic.c193
-rw-r--r--arch/arm/mach-netx/generic.h24
-rw-r--r--arch/arm/mach-netx/time.c88
-rw-r--r--arch/arm/mm/Kconfig4
8 files changed, 329 insertions, 2 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f47cf9af3bc8..dfb97fe045d0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -275,6 +275,12 @@ config ARCH_PNX4008
275 help 275 help
276 This enables support for Philips PNX4008 mobile platform. 276 This enables support for Philips PNX4008 mobile platform.
277 277
278config ARCH_NETX
279 bool "Hilscher NetX based"
280 select ARM_VIC
281 help
282 This enables support for systems based on the Hilscher NetX Soc
283
278endchoice 284endchoice
279 285
280source "arch/arm/mach-clps711x/Kconfig" 286source "arch/arm/mach-clps711x/Kconfig"
@@ -319,6 +325,8 @@ source "arch/arm/mach-realview/Kconfig"
319 325
320source "arch/arm/mach-at91rm9200/Kconfig" 326source "arch/arm/mach-at91rm9200/Kconfig"
321 327
328source "arch/arm/mach-netx/Kconfig"
329
322# Definitions to make life easier 330# Definitions to make life easier
323config ARCH_ACORN 331config ARCH_ACORN
324 bool 332 bool
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 6c97aa70d3bc..282b14e2f464 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -117,6 +117,7 @@ endif
117 machine-$(CONFIG_ARCH_AT91RM9200) := at91rm9200 117 machine-$(CONFIG_ARCH_AT91RM9200) := at91rm9200
118 machine-$(CONFIG_ARCH_EP93XX) := ep93xx 118 machine-$(CONFIG_ARCH_EP93XX) := ep93xx
119 machine-$(CONFIG_ARCH_PNX4008) := pnx4008 119 machine-$(CONFIG_ARCH_PNX4008) := pnx4008
120 machine-$(CONFIG_ARCH_NETX) := netx
120 121
121ifeq ($(CONFIG_ARCH_EBSA110),y) 122ifeq ($(CONFIG_ARCH_EBSA110),y)
122# This is what happens if you forget the IOCS16 line. 123# This is what happens if you forget the IOCS16 line.
diff --git a/arch/arm/mach-netx/Makefile b/arch/arm/mach-netx/Makefile
new file mode 100644
index 000000000000..257d02ef66d8
--- /dev/null
+++ b/arch/arm/mach-netx/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the linux kernel.
3#
4# Note! Dependencies are done automagically by 'make dep', which also
5# removes any old dependencies. DON'T put your own dependencies here
6# unless it's something special (ie not a .c file).
7
8# Object file lists.
9
10obj-y += time.o generic.o
11
diff --git a/arch/arm/mach-netx/Makefile.boot b/arch/arm/mach-netx/Makefile.boot
new file mode 100644
index 000000000000..b81cf6aff0ac
--- /dev/null
+++ b/arch/arm/mach-netx/Makefile.boot
@@ -0,0 +1,2 @@
1 zreladdr-y := 0x80008000
2
diff --git a/arch/arm/mach-netx/generic.c b/arch/arm/mach-netx/generic.c
new file mode 100644
index 000000000000..af0b13534cfd
--- /dev/null
+++ b/arch/arm/mach-netx/generic.c
@@ -0,0 +1,193 @@
1/*
2 * arch/arm/mach-netx/generic.c
3 *
4 * Copyright (C) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/device.h>
21#include <linux/init.h>
22#include <linux/kernel.h>
23#include <linux/module.h>
24#include <linux/platform_device.h>
25#include <asm/hardware.h>
26#include <asm/mach/map.h>
27#include <asm/hardware/vic.h>
28#include <asm/io.h>
29#include <asm/arch/netx-regs.h>
30#include <asm/mach/irq.h>
31
32static struct map_desc netx_io_desc[] __initdata = {
33 {
34 .virtual = NETX_IO_VIRT,
35 .pfn = __phys_to_pfn(NETX_IO_PHYS),
36 .length = NETX_IO_SIZE,
37 .type = MT_DEVICE
38 }
39};
40
41void __init netx_map_io(void)
42{
43 iotable_init(netx_io_desc, ARRAY_SIZE(netx_io_desc));
44}
45
46static struct resource netx_rtc_resources[] = {
47 [0] = {
48 .start = 0x00101200,
49 .end = 0x00101220,
50 .flags = IORESOURCE_MEM,
51 },
52};
53
54static struct platform_device netx_rtc_device = {
55 .name = "netx-rtc",
56 .id = 0,
57 .num_resources = ARRAY_SIZE(netx_rtc_resources),
58 .resource = netx_rtc_resources,
59};
60
61static struct platform_device *devices[] __initdata = {
62 &netx_rtc_device,
63};
64
65#if 0
66#define DEBUG_IRQ(fmt...) printk(fmt)
67#else
68#define DEBUG_IRQ(fmt...) while (0) {}
69#endif
70
71static void
72netx_hif_demux_handler(unsigned int irq_unused, struct irqdesc *desc,
73 struct pt_regs *regs)
74{
75 unsigned int irq = NETX_IRQ_HIF_CHAINED(0);
76 unsigned int stat;
77
78 stat = ((readl(NETX_DPMAS_INT_EN) &
79 readl(NETX_DPMAS_INT_STAT)) >> 24) & 0x1f;
80
81 desc = irq_desc + NETX_IRQ_HIF_CHAINED(0);
82
83 while (stat) {
84 if (stat & 1) {
85 DEBUG_IRQ("handling irq %d\n", irq);
86 desc_handle_irq(irq, desc, regs);
87 }
88 irq++;
89 desc++;
90 stat >>= 1;
91 }
92}
93
94static int
95netx_hif_irq_type(unsigned int _irq, unsigned int type)
96{
97 unsigned int val, irq;
98
99 val = readl(NETX_DPMAS_IF_CONF1);
100
101 irq = _irq - NETX_IRQ_HIF_CHAINED(0);
102
103 if (type & __IRQT_RISEDGE) {
104 DEBUG_IRQ("rising edges\n");
105 val |= (1 << 26) << irq;
106 }
107 if (type & __IRQT_FALEDGE) {
108 DEBUG_IRQ("falling edges\n");
109 val &= ~((1 << 26) << irq);
110 }
111 if (type & __IRQT_LOWLVL) {
112 DEBUG_IRQ("low level\n");
113 val &= ~((1 << 26) << irq);
114 }
115 if (type & __IRQT_HIGHLVL) {
116 DEBUG_IRQ("high level\n");
117 val |= (1 << 26) << irq;
118 }
119
120 writel(val, NETX_DPMAS_IF_CONF1);
121
122 return 0;
123}
124
125static void
126netx_hif_ack_irq(unsigned int _irq)
127{
128 unsigned int val, irq;
129
130 irq = _irq - NETX_IRQ_HIF_CHAINED(0);
131 writel((1 << 24) << irq, NETX_DPMAS_INT_STAT);
132
133 val = readl(NETX_DPMAS_INT_EN);
134 val &= ~((1 << 24) << irq);
135 writel(val, NETX_DPMAS_INT_EN);
136
137 DEBUG_IRQ("%s: irq %d\n", __FUNCTION__, _irq);
138}
139
140static void
141netx_hif_mask_irq(unsigned int _irq)
142{
143 unsigned int val, irq;
144
145 irq = _irq - NETX_IRQ_HIF_CHAINED(0);
146 val = readl(NETX_DPMAS_INT_EN);
147 val &= ~((1 << 24) << irq);
148 writel(val, NETX_DPMAS_INT_EN);
149 DEBUG_IRQ("%s: irq %d\n", __FUNCTION__, _irq);
150}
151
152static void
153netx_hif_unmask_irq(unsigned int _irq)
154{
155 unsigned int val, irq;
156
157 irq = _irq - NETX_IRQ_HIF_CHAINED(0);
158 val = readl(NETX_DPMAS_INT_EN);
159 val |= (1 << 24) << irq;
160 writel(val, NETX_DPMAS_INT_EN);
161 DEBUG_IRQ("%s: irq %d\n", __FUNCTION__, _irq);
162}
163
164static struct irqchip netx_hif_chip = {
165 .ack = netx_hif_ack_irq,
166 .mask = netx_hif_mask_irq,
167 .unmask = netx_hif_unmask_irq,
168 .set_type = netx_hif_irq_type,
169};
170
171void __init netx_init_irq(void)
172{
173 int irq;
174
175 vic_init(__io(io_p2v(NETX_PA_VIC)), 0, ~0);
176
177 for (irq = NETX_IRQ_HIF_CHAINED(0); irq <= NETX_IRQ_HIF_LAST; irq++) {
178 set_irq_chip(irq, &netx_hif_chip);
179 set_irq_handler(irq, do_level_IRQ);
180 set_irq_flags(irq, IRQF_VALID);
181 }
182
183 writel(NETX_DPMAS_INT_EN_GLB_EN, NETX_DPMAS_INT_EN);
184 set_irq_chained_handler(NETX_IRQ_HIF, netx_hif_demux_handler);
185}
186
187static int __init netx_init(void)
188{
189 return platform_add_devices(devices, ARRAY_SIZE(devices));
190}
191
192subsys_initcall(netx_init);
193
diff --git a/arch/arm/mach-netx/generic.h b/arch/arm/mach-netx/generic.h
new file mode 100644
index 000000000000..ede2d35341c3
--- /dev/null
+++ b/arch/arm/mach-netx/generic.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-netx/generic.h
3 *
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20extern void __init netx_map_io(void);
21extern void __init netx_init_irq(void);
22
23struct sys_timer;
24extern struct sys_timer netx_timer;
diff --git a/arch/arm/mach-netx/time.c b/arch/arm/mach-netx/time.c
new file mode 100644
index 000000000000..edfbdf40c600
--- /dev/null
+++ b/arch/arm/mach-netx/time.c
@@ -0,0 +1,88 @@
1/*
2 * arch/arm/mach-netx/time.c
3 *
4 * Copyright (c) 2005 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/init.h>
21#include <linux/interrupt.h>
22
23#include <asm/hardware.h>
24#include <asm/io.h>
25#include <asm/mach/time.h>
26#include <asm/arch/netx-regs.h>
27
28/*
29 * Returns number of us since last clock interrupt. Note that interrupts
30 * will have been disabled by do_gettimeoffset()
31 */
32static unsigned long netx_gettimeoffset(void)
33{
34 return readl(NETX_GPIO_COUNTER_CURRENT(0)) / 100;
35}
36
37/*
38 * IRQ handler for the timer
39 */
40static irqreturn_t
41netx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
42{
43 write_seqlock(&xtime_lock);
44
45 timer_tick(regs);
46 write_sequnlock(&xtime_lock);
47
48 /* acknowledge interrupt */
49 writel(COUNTER_BIT(0), NETX_GPIO_IRQ);
50
51 return IRQ_HANDLED;
52}
53
54
55static struct irqaction netx_timer_irq = {
56 .name = "NetX Timer Tick",
57 .flags = SA_INTERRUPT | SA_TIMER,
58 .handler = netx_timer_interrupt,
59};
60
61/*
62 * Set up timer interrupt
63 */
64static void __init netx_timer_init(void)
65{
66 /* disable timer initially */
67 writel(0, NETX_GPIO_COUNTER_CTRL(0));
68
69 /* Reset the timer value to zero */
70 writel(0, NETX_GPIO_COUNTER_CURRENT(0));
71
72 writel(LATCH, NETX_GPIO_COUNTER_MAX(0));
73
74 /* acknowledge interrupt */
75 writel(COUNTER_BIT(0), NETX_GPIO_IRQ);
76
77 /* Enable the interrupt in the specific timer register and start timer */
78 writel(COUNTER_BIT(0), NETX_GPIO_IRQ_ENABLE);
79 writel(NETX_GPIO_COUNTER_CTRL_IRQ_EN | NETX_GPIO_COUNTER_CTRL_RUN,
80 NETX_GPIO_COUNTER_CTRL(0));
81
82 setup_irq(NETX_IRQ_TIMER0, &netx_timer_irq);
83}
84
85struct sys_timer netx_timer = {
86 .init = netx_timer_init,
87 .offset = netx_gettimeoffset,
88};
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 1ff2f073a55d..4221d054a1e9 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -121,8 +121,8 @@ config CPU_ARM925T
121# ARM926T 121# ARM926T
122config CPU_ARM926T 122config CPU_ARM926T
123 bool "Support ARM926T processor" 123 bool "Support ARM926T processor"
124 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || MACH_REALVIEW_EB || ARCH_PNX4008 124 depends on ARCH_INTEGRATOR || ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || MACH_REALVIEW_EB || ARCH_PNX4008 || ARCH_NETX
125 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || ARCH_PNX4008 125 default y if ARCH_VERSATILE_PB || MACH_VERSATILE_AB || ARCH_OMAP730 || ARCH_OMAP16XX || ARCH_PNX4008 || ARCH_NETX
126 select CPU_32v5 126 select CPU_32v5
127 select CPU_ABRT_EV5TJ 127 select CPU_ABRT_EV5TJ
128 select CPU_CACHE_VIVT 128 select CPU_CACHE_VIVT