diff options
Diffstat (limited to 'arch/arm/mach-picoxcell')
-rw-r--r-- | arch/arm/mach-picoxcell/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-picoxcell/common.c | 52 | ||||
-rw-r--r-- | arch/arm/mach-picoxcell/common.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-picoxcell/include/mach/irqs.h | 9 | ||||
-rw-r--r-- | arch/arm/mach-picoxcell/include/mach/memory.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-picoxcell/include/mach/system.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-picoxcell/io.c | 32 |
7 files changed, 53 insertions, 48 deletions
diff --git a/arch/arm/mach-picoxcell/Makefile b/arch/arm/mach-picoxcell/Makefile index c550b6363488..e5ec4a8d9bcb 100644 --- a/arch/arm/mach-picoxcell/Makefile +++ b/arch/arm/mach-picoxcell/Makefile | |||
@@ -1,3 +1,2 @@ | |||
1 | obj-y := common.o | 1 | obj-y := common.o |
2 | obj-y += time.o | 2 | obj-y += time.o |
3 | obj-y += io.o | ||
diff --git a/arch/arm/mach-picoxcell/common.c b/arch/arm/mach-picoxcell/common.c index ad871bd7b1ab..a2e8ae8b5821 100644 --- a/arch/arm/mach-picoxcell/common.c +++ b/arch/arm/mach-picoxcell/common.c | |||
@@ -7,6 +7,7 @@ | |||
7 | * | 7 | * |
8 | * All enquiries to support@picochip.com | 8 | * All enquiries to support@picochip.com |
9 | */ | 9 | */ |
10 | #include <linux/delay.h> | ||
10 | #include <linux/irq.h> | 11 | #include <linux/irq.h> |
11 | #include <linux/irqdomain.h> | 12 | #include <linux/irqdomain.h> |
12 | #include <linux/of.h> | 13 | #include <linux/of.h> |
@@ -16,15 +17,49 @@ | |||
16 | 17 | ||
17 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
18 | #include <asm/hardware/vic.h> | 19 | #include <asm/hardware/vic.h> |
20 | #include <asm/mach/map.h> | ||
19 | 21 | ||
20 | #include <mach/map.h> | 22 | #include <mach/map.h> |
21 | #include <mach/picoxcell_soc.h> | 23 | #include <mach/picoxcell_soc.h> |
22 | 24 | ||
23 | #include "common.h" | 25 | #include "common.h" |
24 | 26 | ||
27 | #define WDT_CTRL_REG_EN_MASK (1 << 0) | ||
28 | #define WDT_CTRL_REG_OFFS (0x00) | ||
29 | #define WDT_TIMEOUT_REG_OFFS (0x04) | ||
30 | static void __iomem *wdt_regs; | ||
31 | |||
32 | /* | ||
33 | * The machine restart method can be called from an atomic context so we won't | ||
34 | * be able to ioremap the regs then. | ||
35 | */ | ||
36 | static void picoxcell_setup_restart(void) | ||
37 | { | ||
38 | struct device_node *np = of_find_compatible_node(NULL, NULL, | ||
39 | "snps,dw-apb-wdg"); | ||
40 | if (WARN(!np, "unable to setup watchdog restart")) | ||
41 | return; | ||
42 | |||
43 | wdt_regs = of_iomap(np, 0); | ||
44 | WARN(!wdt_regs, "failed to remap watchdog regs"); | ||
45 | } | ||
46 | |||
47 | static struct map_desc io_map __initdata = { | ||
48 | .virtual = PHYS_TO_IO(PICOXCELL_PERIPH_BASE), | ||
49 | .pfn = __phys_to_pfn(PICOXCELL_PERIPH_BASE), | ||
50 | .length = PICOXCELL_PERIPH_LENGTH, | ||
51 | .type = MT_DEVICE, | ||
52 | }; | ||
53 | |||
54 | static void __init picoxcell_map_io(void) | ||
55 | { | ||
56 | iotable_init(&io_map, 1); | ||
57 | } | ||
58 | |||
25 | static void __init picoxcell_init_machine(void) | 59 | static void __init picoxcell_init_machine(void) |
26 | { | 60 | { |
27 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); | 61 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
62 | picoxcell_setup_restart(); | ||
28 | } | 63 | } |
29 | 64 | ||
30 | static const char *picoxcell_dt_match[] = { | 65 | static const char *picoxcell_dt_match[] = { |
@@ -43,12 +78,27 @@ static void __init picoxcell_init_irq(void) | |||
43 | of_irq_init(vic_of_match); | 78 | of_irq_init(vic_of_match); |
44 | } | 79 | } |
45 | 80 | ||
81 | static void picoxcell_wdt_restart(char mode, const char *cmd) | ||
82 | { | ||
83 | /* | ||
84 | * Configure the watchdog to reset with the shortest possible timeout | ||
85 | * and give it chance to do the reset. | ||
86 | */ | ||
87 | if (wdt_regs) { | ||
88 | writel_relaxed(WDT_CTRL_REG_EN_MASK, wdt_regs + WDT_CTRL_REG_OFFS); | ||
89 | writel_relaxed(0, wdt_regs + WDT_TIMEOUT_REG_OFFS); | ||
90 | /* No sleeping, possibly atomic. */ | ||
91 | mdelay(500); | ||
92 | } | ||
93 | } | ||
94 | |||
46 | DT_MACHINE_START(PICOXCELL, "Picochip picoXcell") | 95 | DT_MACHINE_START(PICOXCELL, "Picochip picoXcell") |
47 | .map_io = picoxcell_map_io, | 96 | .map_io = picoxcell_map_io, |
48 | .nr_irqs = ARCH_NR_IRQS, | 97 | .nr_irqs = NR_IRQS_LEGACY, |
49 | .init_irq = picoxcell_init_irq, | 98 | .init_irq = picoxcell_init_irq, |
50 | .handle_irq = vic_handle_irq, | 99 | .handle_irq = vic_handle_irq, |
51 | .timer = &picoxcell_timer, | 100 | .timer = &picoxcell_timer, |
52 | .init_machine = picoxcell_init_machine, | 101 | .init_machine = picoxcell_init_machine, |
53 | .dt_compat = picoxcell_dt_match, | 102 | .dt_compat = picoxcell_dt_match, |
103 | .restart = picoxcell_wdt_restart, | ||
54 | MACHINE_END | 104 | MACHINE_END |
diff --git a/arch/arm/mach-picoxcell/common.h b/arch/arm/mach-picoxcell/common.h index 5263f0fa095c..83d55ab956a4 100644 --- a/arch/arm/mach-picoxcell/common.h +++ b/arch/arm/mach-picoxcell/common.h | |||
@@ -13,6 +13,5 @@ | |||
13 | #include <asm/mach/time.h> | 13 | #include <asm/mach/time.h> |
14 | 14 | ||
15 | extern struct sys_timer picoxcell_timer; | 15 | extern struct sys_timer picoxcell_timer; |
16 | extern void picoxcell_map_io(void); | ||
17 | 16 | ||
18 | #endif /* __PICOXCELL_COMMON_H__ */ | 17 | #endif /* __PICOXCELL_COMMON_H__ */ |
diff --git a/arch/arm/mach-picoxcell/include/mach/irqs.h b/arch/arm/mach-picoxcell/include/mach/irqs.h index 4d13ed970919..59eac1ee2820 100644 --- a/arch/arm/mach-picoxcell/include/mach/irqs.h +++ b/arch/arm/mach-picoxcell/include/mach/irqs.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2011 Picochip Ltd., Jamie Iles | 2 | * Copyright (c) 2011 Picochip Ltd., Jamie Iles |
3 | * | 3 | * |
4 | * This file contains the hardware definitions of the picoXcell SoC devices. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | 4 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 5 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 6 | * the Free Software Foundation; either version 2 of the License, or |
@@ -16,10 +14,7 @@ | |||
16 | #ifndef __MACH_IRQS_H | 14 | #ifndef __MACH_IRQS_H |
17 | #define __MACH_IRQS_H | 15 | #define __MACH_IRQS_H |
18 | 16 | ||
19 | #define ARCH_NR_IRQS 64 | 17 | /* We dynamically allocate our irq_desc's. */ |
20 | #define NR_IRQS (128 + ARCH_NR_IRQS) | 18 | #define NR_IRQS 0 |
21 | |||
22 | #define IRQ_VIC0_BASE 0 | ||
23 | #define IRQ_VIC1_BASE 32 | ||
24 | 19 | ||
25 | #endif /* __MACH_IRQS_H */ | 20 | #endif /* __MACH_IRQS_H */ |
diff --git a/arch/arm/mach-picoxcell/include/mach/memory.h b/arch/arm/mach-picoxcell/include/mach/memory.h deleted file mode 100644 index 40a8c178f10d..000000000000 --- a/arch/arm/mach-picoxcell/include/mach/memory.h +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | /* empty */ | ||
diff --git a/arch/arm/mach-picoxcell/include/mach/system.h b/arch/arm/mach-picoxcell/include/mach/system.h index 67c589b0c1bc..1a5d8cb57df4 100644 --- a/arch/arm/mach-picoxcell/include/mach/system.h +++ b/arch/arm/mach-picoxcell/include/mach/system.h | |||
@@ -23,9 +23,4 @@ static inline void arch_idle(void) | |||
23 | cpu_do_idle(); | 23 | cpu_do_idle(); |
24 | } | 24 | } |
25 | 25 | ||
26 | static inline void arch_reset(int mode, const char *cmd) | ||
27 | { | ||
28 | /* Watchdog reset to go here. */ | ||
29 | } | ||
30 | |||
31 | #endif /* __ASM_ARCH_SYSTEM_H */ | 26 | #endif /* __ASM_ARCH_SYSTEM_H */ |
diff --git a/arch/arm/mach-picoxcell/io.c b/arch/arm/mach-picoxcell/io.c deleted file mode 100644 index 39e9b9e8cc37..000000000000 --- a/arch/arm/mach-picoxcell/io.c +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Picochip Ltd., Jamie Iles | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * All enquiries to support@picochip.com | ||
9 | */ | ||
10 | #include <linux/io.h> | ||
11 | #include <linux/mm.h> | ||
12 | #include <linux/module.h> | ||
13 | #include <linux/of.h> | ||
14 | |||
15 | #include <asm/mach/map.h> | ||
16 | |||
17 | #include <mach/map.h> | ||
18 | #include <mach/picoxcell_soc.h> | ||
19 | |||
20 | #include "common.h" | ||
21 | |||
22 | void __init picoxcell_map_io(void) | ||
23 | { | ||
24 | struct map_desc io_map = { | ||
25 | .virtual = PHYS_TO_IO(PICOXCELL_PERIPH_BASE), | ||
26 | .pfn = __phys_to_pfn(PICOXCELL_PERIPH_BASE), | ||
27 | .length = PICOXCELL_PERIPH_LENGTH, | ||
28 | .type = MT_DEVICE, | ||
29 | }; | ||
30 | |||
31 | iotable_init(&io_map, 1); | ||
32 | } | ||