diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sparc/include/asm/leon_amba.h | 6 | ||||
-rw-r--r-- | arch/sparc/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/sparc/kernel/leon_kernel.c | 9 | ||||
-rw-r--r-- | arch/sparc/kernel/leon_pmc.c | 82 | ||||
-rw-r--r-- | arch/sparc/kernel/leon_smp.c | 16 |
5 files changed, 97 insertions, 17 deletions
diff --git a/arch/sparc/include/asm/leon_amba.h b/arch/sparc/include/asm/leon_amba.h index 263c719e96f5..e50f326e71bd 100644 --- a/arch/sparc/include/asm/leon_amba.h +++ b/arch/sparc/include/asm/leon_amba.h | |||
@@ -180,6 +180,7 @@ struct amba_ahb_device { | |||
180 | struct device_node; | 180 | struct device_node; |
181 | void _amba_init(struct device_node *dp, struct device_node ***nextp); | 181 | void _amba_init(struct device_node *dp, struct device_node ***nextp); |
182 | 182 | ||
183 | extern unsigned long amba_system_id; | ||
183 | extern struct leon3_irqctrl_regs_map *leon3_irqctrl_regs; | 184 | extern struct leon3_irqctrl_regs_map *leon3_irqctrl_regs; |
184 | extern struct leon3_gptimer_regs_map *leon3_gptimer_regs; | 185 | extern struct leon3_gptimer_regs_map *leon3_gptimer_regs; |
185 | extern struct amba_apb_device leon_percpu_timer_dev[16]; | 186 | extern struct amba_apb_device leon_percpu_timer_dev[16]; |
@@ -254,6 +255,11 @@ extern unsigned int sparc_leon_eirq; | |||
254 | #define GAISLER_L2C 0xffe /* internal device: leon2compat */ | 255 | #define GAISLER_L2C 0xffe /* internal device: leon2compat */ |
255 | #define GAISLER_PLUGPLAY 0xfff /* internal device: plug & play configarea */ | 256 | #define GAISLER_PLUGPLAY 0xfff /* internal device: plug & play configarea */ |
256 | 257 | ||
258 | /* Chip IDs */ | ||
259 | #define AEROFLEX_UT699 0x0699 | ||
260 | #define LEON4_NEXTREME1 0x0102 | ||
261 | #define GAISLER_GR712RC 0x0712 | ||
262 | |||
257 | #define amba_vendor(x) (((x) >> 24) & 0xff) | 263 | #define amba_vendor(x) (((x) >> 24) & 0xff) |
258 | 264 | ||
259 | #define amba_device(x) (((x) >> 12) & 0xfff) | 265 | #define amba_device(x) (((x) >> 12) & 0xfff) |
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile index 599398fbbc7c..27e7f2542b1c 100644 --- a/arch/sparc/kernel/Makefile +++ b/arch/sparc/kernel/Makefile | |||
@@ -54,6 +54,7 @@ obj-y += of_device_$(BITS).o | |||
54 | obj-$(CONFIG_SPARC64) += prom_irqtrans.o | 54 | obj-$(CONFIG_SPARC64) += prom_irqtrans.o |
55 | 55 | ||
56 | obj-$(CONFIG_SPARC_LEON)+= leon_kernel.o | 56 | obj-$(CONFIG_SPARC_LEON)+= leon_kernel.o |
57 | obj-$(CONFIG_SPARC_LEON)+= leon_pmc.o | ||
57 | 58 | ||
58 | obj-$(CONFIG_SPARC64) += reboot.o | 59 | obj-$(CONFIG_SPARC64) += reboot.o |
59 | obj-$(CONFIG_SPARC64) += sysfs.o | 60 | obj-$(CONFIG_SPARC64) += sysfs.o |
diff --git a/arch/sparc/kernel/leon_kernel.c b/arch/sparc/kernel/leon_kernel.c index fdab7f854f80..2f8a9a25d10d 100644 --- a/arch/sparc/kernel/leon_kernel.c +++ b/arch/sparc/kernel/leon_kernel.c | |||
@@ -30,6 +30,7 @@ struct amba_apb_device leon_percpu_timer_dev[16]; | |||
30 | int leondebug_irq_disable; | 30 | int leondebug_irq_disable; |
31 | int leon_debug_irqout; | 31 | int leon_debug_irqout; |
32 | static int dummy_master_l10_counter; | 32 | static int dummy_master_l10_counter; |
33 | unsigned long amba_system_id; | ||
33 | 34 | ||
34 | unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ | 35 | unsigned long leon3_gptimer_irq; /* interrupt controller irq number */ |
35 | unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ | 36 | unsigned long leon3_gptimer_idx; /* Timer Index (0..6) within Timer Core */ |
@@ -117,10 +118,16 @@ void __init leon_init_timers(irq_handler_t counter_fn) | |||
117 | master_l10_counter = (unsigned int *)&dummy_master_l10_counter; | 118 | master_l10_counter = (unsigned int *)&dummy_master_l10_counter; |
118 | dummy_master_l10_counter = 0; | 119 | dummy_master_l10_counter = 0; |
119 | 120 | ||
120 | /*Find IRQMP IRQ Controller Registers base address otherwise bail out.*/ | ||
121 | rootnp = of_find_node_by_path("/ambapp0"); | 121 | rootnp = of_find_node_by_path("/ambapp0"); |
122 | if (!rootnp) | 122 | if (!rootnp) |
123 | goto bad; | 123 | goto bad; |
124 | |||
125 | /* Find System ID: GRLIB build ID and optional CHIP ID */ | ||
126 | pp = of_find_property(rootnp, "systemid", &len); | ||
127 | if (pp) | ||
128 | amba_system_id = *(unsigned long *)pp->value; | ||
129 | |||
130 | /* Find IRQMP IRQ Controller Registers base adr otherwise bail out */ | ||
124 | np = of_find_node_by_name(rootnp, "GAISLER_IRQMP"); | 131 | np = of_find_node_by_name(rootnp, "GAISLER_IRQMP"); |
125 | if (!np) { | 132 | if (!np) { |
126 | np = of_find_node_by_name(rootnp, "01_00d"); | 133 | np = of_find_node_by_name(rootnp, "01_00d"); |
diff --git a/arch/sparc/kernel/leon_pmc.c b/arch/sparc/kernel/leon_pmc.c new file mode 100644 index 000000000000..519ca923f59f --- /dev/null +++ b/arch/sparc/kernel/leon_pmc.c | |||
@@ -0,0 +1,82 @@ | |||
1 | /* leon_pmc.c: LEON Power-down cpu_idle() handler | ||
2 | * | ||
3 | * Copyright (C) 2011 Daniel Hellstrom (daniel@gaisler.com) Aeroflex Gaisler AB | ||
4 | */ | ||
5 | |||
6 | #include <linux/init.h> | ||
7 | #include <linux/pm.h> | ||
8 | |||
9 | #include <asm/leon_amba.h> | ||
10 | #include <asm/leon.h> | ||
11 | |||
12 | /* List of Systems that need fixup instructions around power-down instruction */ | ||
13 | unsigned int pmc_leon_fixup_ids[] = { | ||
14 | AEROFLEX_UT699, | ||
15 | GAISLER_GR712RC, | ||
16 | LEON4_NEXTREME1, | ||
17 | 0 | ||
18 | }; | ||
19 | |||
20 | int pmc_leon_need_fixup(void) | ||
21 | { | ||
22 | unsigned int systemid = amba_system_id >> 16; | ||
23 | unsigned int *id; | ||
24 | |||
25 | id = &pmc_leon_fixup_ids[0]; | ||
26 | while (*id != 0) { | ||
27 | if (*id == systemid) | ||
28 | return 1; | ||
29 | id++; | ||
30 | } | ||
31 | |||
32 | return 0; | ||
33 | } | ||
34 | |||
35 | /* | ||
36 | * CPU idle callback function for systems that need some extra handling | ||
37 | * See .../arch/sparc/kernel/process.c | ||
38 | */ | ||
39 | void pmc_leon_idle_fixup(void) | ||
40 | { | ||
41 | /* Prepare an address to a non-cachable region. APB is always | ||
42 | * none-cachable. One instruction is executed after the Sleep | ||
43 | * instruction, we make sure to read the bus and throw away the | ||
44 | * value by accessing a non-cachable area, also we make sure the | ||
45 | * MMU does not get a TLB miss here by using the MMU BYPASS ASI. | ||
46 | */ | ||
47 | register unsigned int address = (unsigned int)leon3_irqctrl_regs; | ||
48 | __asm__ __volatile__ ( | ||
49 | "mov %%g0, %%asr19\n" | ||
50 | "lda [%0] %1, %%g0\n" | ||
51 | : | ||
52 | : "r"(address), "i"(ASI_LEON_BYPASS)); | ||
53 | } | ||
54 | |||
55 | /* | ||
56 | * CPU idle callback function | ||
57 | * See .../arch/sparc/kernel/process.c | ||
58 | */ | ||
59 | void pmc_leon_idle(void) | ||
60 | { | ||
61 | /* For systems without power-down, this will be no-op */ | ||
62 | __asm__ __volatile__ ("mov %g0, %asr19\n\t"); | ||
63 | } | ||
64 | |||
65 | /* Install LEON Power Down function */ | ||
66 | static int __init leon_pmc_install(void) | ||
67 | { | ||
68 | /* Assign power management IDLE handler */ | ||
69 | if (pmc_leon_need_fixup()) | ||
70 | pm_idle = pmc_leon_idle_fixup; | ||
71 | else | ||
72 | pm_idle = pmc_leon_idle; | ||
73 | |||
74 | printk(KERN_INFO "leon: power management initialized\n"); | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | /* This driver is not critical to the boot process, don't care | ||
80 | * if initialized late. | ||
81 | */ | ||
82 | late_initcall(leon_pmc_install); | ||
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c index 16582d85368a..e9df87f4447f 100644 --- a/arch/sparc/kernel/leon_smp.c +++ b/arch/sparc/kernel/leon_smp.c | |||
@@ -437,15 +437,6 @@ void __init leon_blackbox_current(unsigned *addr) | |||
437 | 437 | ||
438 | } | 438 | } |
439 | 439 | ||
440 | /* | ||
441 | * CPU idle callback function | ||
442 | * See .../arch/sparc/kernel/process.c | ||
443 | */ | ||
444 | void pmc_leon_idle(void) | ||
445 | { | ||
446 | __asm__ volatile ("mov %g0, %asr19"); | ||
447 | } | ||
448 | |||
449 | void __init leon_init_smp(void) | 440 | void __init leon_init_smp(void) |
450 | { | 441 | { |
451 | /* Patch ipi15 trap table */ | 442 | /* Patch ipi15 trap table */ |
@@ -456,13 +447,6 @@ void __init leon_init_smp(void) | |||
456 | BTFIXUPSET_CALL(smp_cross_call, leon_cross_call, BTFIXUPCALL_NORM); | 447 | BTFIXUPSET_CALL(smp_cross_call, leon_cross_call, BTFIXUPCALL_NORM); |
457 | BTFIXUPSET_CALL(__hard_smp_processor_id, __leon_processor_id, | 448 | BTFIXUPSET_CALL(__hard_smp_processor_id, __leon_processor_id, |
458 | BTFIXUPCALL_NORM); | 449 | BTFIXUPCALL_NORM); |
459 | |||
460 | #ifndef PMC_NO_IDLE | ||
461 | /* Assign power management IDLE handler */ | ||
462 | pm_idle = pmc_leon_idle; | ||
463 | printk(KERN_INFO "leon: power management initialized\n"); | ||
464 | #endif | ||
465 | |||
466 | } | 450 | } |
467 | 451 | ||
468 | #endif /* CONFIG_SPARC_LEON */ | 452 | #endif /* CONFIG_SPARC_LEON */ |