Skip to contentSkip to conversation

SPARC/LEON: power down instruction different of different LEONs

PATCH Applied Daniel Hellstrom 3 participants 3 messages Jan 27, 2011 – Jan 28, 2011 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 SPARC/LEON: power down instruction different of different LEONs

The way a LEON is powered down is implemented differently depending on CHIP type. The AMBA Plug&Play system ID tells revision of GRLIB and CHIP.

This is for example needed by the GR-LEON4-ITX board and the UT699.

Previously the power down support for LEON was limited to SMP, now both SMP and UP systems use the instruction.

---
 arch/sparc/include/asm/leon_amba.h |    6 +++
 arch/sparc/kernel/Makefile         |    1 +
 arch/sparc/kernel/leon_kernel.c    |    9 ++++-
 arch/sparc/kernel/leon_pmc.c       |   82 ++++++++++++++++++++++++++++++++++++
 arch/sparc/kernel/leon_smp.c       |   16 -------
 5 files changed, 97 insertions(+), 17 deletions(-)
 create mode 100644 arch/sparc/kernel/leon_pmc.c
arch/sparc/include/asm/leon_amba.h +6 -0
index 263c719..e50f326 100644
@@ -180,6 +180,7 @@ struct amba_ahb_device {
 struct device_node;
 void _amba_init(struct device_node *dp, struct device_node ***nextp);
 
+extern unsigned long amba_system_id;
 extern struct leon3_irqctrl_regs_map *leon3_irqctrl_regs;
 extern struct leon3_gptimer_regs_map *leon3_gptimer_regs;
 extern struct amba_apb_device leon_percpu_timer_dev[16];
@@ -254,6 +255,11 @@ extern unsigned int sparc_leon_eirq;
 #define GAISLER_L2C      0xffe	/* internal device: leon2compat */
 #define GAISLER_PLUGPLAY 0xfff	/* internal device: plug & play configarea */
 
+/* Chip IDs */
+#define AEROFLEX_UT699    0x0699
+#define LEON4_NEXTREME1   0x0102
+#define GAISLER_GR712RC   0x0712
+
 #define amba_vendor(x) (((x) >> 24) & 0xff)
 
 #define amba_device(x) (((x) >> 12) & 0xfff)
arch/sparc/kernel/Makefile +1 -0
index 599398f..27e7f25 100644
@@ -54,6 +54,7 @@ obj-y                   += of_device_$(BITS).o
 obj-$(CONFIG_SPARC64)   += prom_irqtrans.o
 
 obj-$(CONFIG_SPARC_LEON)+= leon_kernel.o
+obj-$(CONFIG_SPARC_LEON)+= leon_pmc.o
 
 obj-$(CONFIG_SPARC64)   += reboot.o
 obj-$(CONFIG_SPARC64)   += sysfs.o
arch/sparc/kernel/leon_kernel.c +8 -1
index fdab7f8..2f8a9a2 100644
@@ -30,6 +30,7 @@ struct amba_apb_device leon_percpu_timer_dev[16];
 int leondebug_irq_disable;
 int leon_debug_irqout;
 static int dummy_master_l10_counter;
+unsigned long amba_system_id;
 
 unsigned long leon3_gptimer_irq; /* interrupt controller irq number */
 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)
 	master_l10_counter = (unsigned int *)&dummy_master_l10_counter;
 	dummy_master_l10_counter = 0;
 
-	/*Find IRQMP IRQ Controller Registers base address otherwise bail out.*/
 	rootnp = of_find_node_by_path("/ambapp0");
 	if (!rootnp)
 		goto bad;
+
+	/* Find System ID: GRLIB build ID and optional CHIP ID */
+	pp = of_find_property(rootnp, "systemid", &len);
+	if (pp)
+		amba_system_id = *(unsigned long *)pp->value;
+
+	/* Find IRQMP IRQ Controller Registers base adr otherwise bail out */
 	np = of_find_node_by_name(rootnp, "GAISLER_IRQMP");
 	if (!np) {
 		np = of_find_node_by_name(rootnp, "01_00d");
arch/sparc/kernel/leon_pmc.c new file +82 -0

82 lines not on this page · raw message

arch/sparc/kernel/leon_smp.c +0 -16
index 16582d8..e9df87f 100644
@@ -437,15 +437,6 @@ void __init leon_blackbox_current(unsigned *addr)
 
 }
 
-/*
- * CPU idle callback function
- * See .../arch/sparc/kernel/process.c
- */
-void pmc_leon_idle(void)
-{
-	__asm__ volatile ("mov %g0, %asr19");
-}
-
 void __init leon_init_smp(void)
 {
 	/* Patch ipi15 trap table */
@@ -456,13 +447,6 @@ void __init leon_init_smp(void)
 	BTFIXUPSET_CALL(smp_cross_call, leon_cross_call, BTFIXUPCALL_NORM);
 	BTFIXUPSET_CALL(__hard_smp_processor_id, __leon_processor_id,
 			BTFIXUPCALL_NORM);
-
-#ifndef PMC_NO_IDLE
-	/* Assign power management IDLE handler */
-	pm_idle = pmc_leon_idle;
-	printk(KERN_INFO "leon: power management initialized\n");
-#endif
-
 }
 
 #endif /* CONFIG_SPARC_LEON */
Signature · 1 line
1.5.4
Acked-by on v2 1/1
#1 lore raw

Re: [PATCH v2] SPARC/LEON: power down instruction different of

Quoted 10 lines · Daniel Hellstrom

The way a LEON is powered down is implemented differently depending on CHIP type. The AMBA Plug&Play system ID tells revision of GRLIB and CHIP.

This is for example needed by the GR-LEON4-ITX board and the UT699.

Previously the power down support for LEON was limited to SMP, now both SMP and UP systems use the instruction.

maintainer Applied
#2 lore raw

Re: [PATCH v2] SPARC/LEON: power down instruction different of

In reply to Daniel Hellstrom

From: Sam Ravnborg <[email protected]>
Date: Thu, 27 Jan 2011 18:40:02 +0100

Quoted 5 lines · Daniel Hellstrom
Quoted 4 lines

The way a LEON is powered down is implemented differently depending on CHIP type. The AMBA Plug&Play system ID tells revision of GRLIB and CHIP.

Quoted 7 lines
Quoted 6 lines

This is for example needed by the GR-LEON4-ITX board and the UT699.

Previously the power down support for LEON was limited to SMP, now both SMP and UP systems use the instruction.

Applied to sparc-next-2.6, thanks.