Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] IP28: switch to "normal" mode after PROM no longer needed
@ 2008-03-18 21:47 Thomas Bogendoerfer
  2008-07-03 15:43 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Bogendoerfer @ 2008-03-18 21:47 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

SGI-IP28 is running in so called slow mode, when kernel is started
from the PROM. PROM calls must be done in slow mode otherwise the
PROM will issue an error. To get better memory performance we now
switch to normal mode, when the PROM is no longer needed.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
---

 arch/mips/sgi-ip22/ip22-mc.c |   26 ++++++++++++++++++++++++++
 include/asm-mips/barrier.h   |   14 ++++++++++++++
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/arch/mips/sgi-ip22/ip22-mc.c b/arch/mips/sgi-ip22/ip22-mc.c
index 3f35d63..5268ac1 100644
--- a/arch/mips/sgi-ip22/ip22-mc.c
+++ b/arch/mips/sgi-ip22/ip22-mc.c
@@ -208,4 +208,30 @@ void __init sgimc_init(void)
 void __init prom_meminit(void) {}
 void __init prom_free_prom_memory(void)
 {
+#ifdef CONFIG_SGI_IP28
+	u32 mconfig1;
+	unsigned long flags;
+	spinlock_t lock;
+
+	/*
+	 * because ARCS accesses memory uncached we wait until ARCS
+	 * isn't needed any longer, before we switch from slow to
+	 * normal mode
+	 */
+	spin_lock_irqsave(&lock, flags);
+	mconfig1 = sgimc->mconfig1;
+	/* map ECC register */
+	sgimc->mconfig1 = (mconfig1 & 0xffff0000) | 0x2060;
+	iob();
+	/* switch to normal mode */
+	*(unsigned long *)PHYS_TO_XKSEG_UNCACHED(0x60000000) = 0;
+	iob();
+	/* reduce WR_COL */
+	sgimc->cmacc = (sgimc->cmacc & ~0xf) | 4;
+	iob();
+	/* restore old config */
+	sgimc->mconfig1 = mconfig1;
+	iob();
+	spin_unlock_irqrestore(&lock, flags);
+#endif
 }
diff --git a/include/asm-mips/barrier.h b/include/asm-mips/barrier.h
index 9d8cfbb..8e9ac31 100644
--- a/include/asm-mips/barrier.h
+++ b/include/asm-mips/barrier.h
@@ -92,11 +92,25 @@
 #define fast_wmb()	__sync()
 #define fast_rmb()	__sync()
 #define fast_mb()	__sync()
+#ifdef CONFIG_SGI_IP28
+#define fast_iob()				\
+	__asm__ __volatile__(			\
+		".set	push\n\t"		\
+		".set	noreorder\n\t"		\
+		"lw	$0,%0\n\t"		\
+		"sync\n\t"			\
+		"lw	$0,%0\n\t"		\
+		".set	pop"			\
+		: /* no output */		\
+		: "m" (*(int *)CKSEG1ADDR(0x1fa00004)) \
+		: "memory")
+#else
 #define fast_iob()				\
 	do {					\
 		__sync();			\
 		__fast_iob();			\
 	} while (0)
+#endif
 
 #ifdef CONFIG_CPU_HAS_WB
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] IP28: switch to "normal" mode after PROM no longer needed
  2008-03-18 21:47 [PATCH] IP28: switch to "normal" mode after PROM no longer needed Thomas Bogendoerfer
@ 2008-07-03 15:43 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2008-07-03 15:43 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: linux-mips

On Tue, Mar 18, 2008 at 10:47:56PM +0100, Thomas Bogendoerfer wrote:

> SGI-IP28 is running in so called slow mode, when kernel is started
> from the PROM. PROM calls must be done in slow mode otherwise the
> PROM will issue an error. To get better memory performance we now
> switch to normal mode, when the PROM is no longer needed.
> 
> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

Ugly ...  but applied anyway.

Thanks,

  Ralf

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-03 15:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-18 21:47 [PATCH] IP28: switch to "normal" mode after PROM no longer needed Thomas Bogendoerfer
2008-07-03 15:43 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox