LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 4/4] cpm2: Reset the CPM when early debugging is not enabled.
From: Laurent Pinchart @ 2008-03-31 16:37 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood
In-Reply-To: <200803311834.42327.laurentp@cse-semaphore.com>

[-- Attachment #1: Type: text/plain, Size: 1046 bytes --]

Similarly to what is done for PQ1-based platforms, this patch resets the
PQ2 Communication Processor Module in cpm2_reset() when early debugging is
not enabled. This helps avoiding conflicts when the boot loader configured
the CPM in an unexpected way.

Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
---
 arch/powerpc/sysdev/cpm2.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
index 7be7112..57ed1a4 100644
--- a/arch/powerpc/sysdev/cpm2.c
+++ b/arch/powerpc/sysdev/cpm2.c
@@ -80,6 +80,12 @@ void __init cpm2_reset(void)
 	/* Tell everyone where the comm processor resides.
 	 */
 	cpmp = &cpm2_immr->im_cpm;
+
+#ifndef CONFIG_PPC_EARLY_DEBUG_CPM
+	/* Reset the CPM.
+	 */
+	cpm_command(CPM_CR_RST, 0);
+#endif
 }
 
 static DEFINE_SPINLOCK(cmd_lock);
-- 
1.5.0


-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* [PATCHv3 3/4] ep8248e: Reference SMC parameter RAM base in the device tree.
From: Laurent Pinchart @ 2008-03-31 16:37 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood
In-Reply-To: <200803311834.42327.laurentp@cse-semaphore.com>

[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]

This patch modifies the Embedded Planet EP8248E device tree to reference the
SMC paramater RAM base register instead of the parameter RAM allocated by the
boot loader.

The cpm_uart driver will allocate parameter RAM itself, making the serial port
initialisation independent of the boot loader.

The patch adds the parameter RAM allocated by the boot loader in the CPM muram
node, making it available to the kernel.

Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
---
 arch/powerpc/boot/dts/ep8248e.dts |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/boot/dts/ep8248e.dts b/arch/powerpc/boot/dts/ep8248e.dts
index 5d2fb76..756758f 100644
--- a/arch/powerpc/boot/dts/ep8248e.dts
+++ b/arch/powerpc/boot/dts/ep8248e.dts
@@ -121,8 +121,7 @@
 
 				data@0 {
 					compatible = "fsl,cpm-muram-data";
-					reg = <0 0x1100 0x1140
-					       0xec0 0x9800 0x800>;
+					reg = <0 0x2000 0x9800 0x800>;
 				};
 			};
 
@@ -138,7 +137,7 @@
 				device_type = "serial";
 				compatible = "fsl,mpc8248-smc-uart",
 				             "fsl,cpm2-smc-uart";
-				reg = <0x11a80 0x20 0x1100 0x40>;
+				reg = <0x11a80 0x20 0x87fc 2>;
 				interrupts = <4 8>;
 				interrupt-parent = <&PIC>;
 				fsl,cpm-brg = <7>;
-- 
1.5.0


-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* [PATCHv3 0/4] cpm2: Reset the CPM at startup and fix the cpm_uart driver accordingly.
From: Laurent Pinchart @ 2008-03-31 16:34 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

Hi everybody,

these 4 patches reset the CPM in cpm2_reset() and fix the cpm_uart driver to 
initialise SMC ports correctly without relying on any initialisation 
performed by the boot loader/wrapper. They update the boot wrapper code and
the EP8248E device tree to match the new SMC registers description.

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* [PATCHv3 1/4] cpm_uart: Allocate DPRAM memory for SMC ports on CPM2-based platforms.
From: Laurent Pinchart @ 2008-03-31 16:35 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood
In-Reply-To: <200803311834.42327.laurentp@cse-semaphore.com>

[-- Attachment #1: Type: text/plain, Size: 5713 bytes --]

This patch allocates parameter RAM for SMC serial ports without relying on
previous initialisation by a boot loader or a wrapper layer.

SMC parameter RAM on CPM2-based platforms can be allocated anywhere in the
general-purpose areas of the dual-port RAM. The current code relies on the
boot loader to allocate a section of general-purpose CPM RAM and gets the
section address from the device tree.

This patch modifies the device tree address usage to reference the SMC
parameter RAM base pointer instead of a pre-allocated RAM section and
allocates memory from the CPM dual-port RAM when initialising the SMC port.
CPM1-based platforms are not affected.

Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
---
 drivers/serial/cpm_uart/cpm_uart.h      |    3 ++
 drivers/serial/cpm_uart/cpm_uart_core.c |   19 +++++------
 drivers/serial/cpm_uart/cpm_uart_cpm1.c |   12 +++++++
 drivers/serial/cpm_uart/cpm_uart_cpm2.c |   52 +++++++++++++++++++++++++++++++
 4 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/drivers/serial/cpm_uart/cpm_uart.h b/drivers/serial/cpm_uart/cpm_uart.h
index 80a7d60..5334653 100644
--- a/drivers/serial/cpm_uart/cpm_uart.h
+++ b/drivers/serial/cpm_uart/cpm_uart.h
@@ -93,6 +93,9 @@ extern struct uart_cpm_port cpm_uart_ports[UART_NR];
 
 /* these are located in their respective files */
 void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd);
+void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
+				struct device_node *np);
+void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram);
 int cpm_uart_init_portdesc(void);
 int cpm_uart_allocbuf(struct uart_cpm_port *pinfo, unsigned int is_con);
 void cpm_uart_freebuf(struct uart_cpm_port *pinfo);
diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index 1ea123c..3a44a3f 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -997,24 +997,23 @@ static int cpm_uart_init_port(struct device_node *np,
 	if (!mem)
 		return -ENOMEM;
 
-	pram = of_iomap(np, 1);
-	if (!pram) {
-		ret = -ENOMEM;
-		goto out_mem;
-	}
-
 	if (of_device_is_compatible(np, "fsl,cpm1-scc-uart") ||
 	    of_device_is_compatible(np, "fsl,cpm2-scc-uart")) {
 		pinfo->sccp = mem;
-		pinfo->sccup = pram;
+		pinfo->sccup = pram = cpm_uart_map_pram(pinfo, np);
 	} else if (of_device_is_compatible(np, "fsl,cpm1-smc-uart") ||
 	           of_device_is_compatible(np, "fsl,cpm2-smc-uart")) {
 		pinfo->flags |= FLAG_SMC;
 		pinfo->smcp = mem;
-		pinfo->smcup = pram;
+		pinfo->smcup = pram = cpm_uart_map_pram(pinfo, np);
 	} else {
 		ret = -ENODEV;
-		goto out_pram;
+		goto out_mem;
+	}
+
+	if (!pram) {
+		ret = -ENOMEM;
+		goto out_mem;
 	}
 
 	pinfo->tx_nrfifos = TX_NUM_FIFO;
@@ -1038,7 +1037,7 @@ static int cpm_uart_init_port(struct device_node *np,
 	return cpm_uart_request_port(&pinfo->port);
 
 out_pram:
-	iounmap(pram);
+	cpm_uart_unmap_pram(pinfo, pram);
 out_mem:
 	iounmap(mem);
 	return ret;
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
index 6ea0366..e692593 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm1.c
@@ -54,6 +54,18 @@ void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
 {
 	cpm_command(port->command, cmd);
 }
+
+void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
+				struct device_node *np)
+{
+	return of_iomap(np, 1);
+}
+
+void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
+{
+	iounmap(pram);
+}
+
 #else
 void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
 {
diff --git a/drivers/serial/cpm_uart/cpm_uart_cpm2.c b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
index 6291094..a4cfb0b 100644
--- a/drivers/serial/cpm_uart/cpm_uart_cpm2.c
+++ b/drivers/serial/cpm_uart/cpm_uart_cpm2.c
@@ -41,6 +41,9 @@
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/fs_pd.h>
+#ifdef CONFIG_PPC_CPM_NEW_BINDING
+#include <asm/prom.h>
+#endif
 
 #include <linux/serial_core.h>
 #include <linux/kernel.h>
@@ -54,6 +57,55 @@ void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
 {
 	cpm_command(port->command, cmd);
 }
+
+void __iomem *cpm_uart_map_pram(struct uart_cpm_port *port,
+				struct device_node *np)
+{
+	void __iomem *pram;
+	unsigned long offset;
+	struct resource res;
+	unsigned long len;
+
+	/* Don't remap parameter RAM if it has already been initialized
+	 * during console setup.
+	 */
+	if (IS_SMC(port) && port->smcup)
+		return port->smcup;
+	else if (!IS_SMC(port) && port->sccup)
+		return port->sccup;
+
+	if (of_address_to_resource(np, 1, &res))
+		return NULL;
+
+	len = 1 + res.end - res.start;
+	pram = ioremap(res.start, len);
+	if (!pram)
+		return NULL;
+
+	if (!IS_SMC(port))
+		return pram;
+
+	if (len != 2) {
+		printk(KERN_WARNING "cpm_uart[%d]: device tree references "
+			"SMC pram, using boot loader/wrapper pram mapping. "
+			"Please fix your device tree to reference the pram "
+			"base register instead.\n",
+			port->port.line);
+		return pram;
+	}
+
+	offset = cpm_dpalloc(PROFF_SMC_SIZE, 64);
+	out_be16(pram, offset);
+	iounmap(pram);
+	return cpm_muram_addr(offset);
+}
+
+void cpm_uart_unmap_pram(struct uart_cpm_port *port, void __iomem *pram)
+{
+	if (!IS_SMC(port))
+		iounmap(pram);
+}
+
 #else
 void cpm_line_cr_cmd(struct uart_cpm_port *port, int cmd)
 {
-- 
1.5.0


-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* [PATCHv2] powerpc: Describe memory-mapped RAM&ROM chips OF bindings
From: Laurent Pinchart @ 2008-03-31 16:39 UTC (permalink / raw)
  To: linux-mtd; +Cc: ben, linuxppc-dev, David Gibson


Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
=2D--
 Documentation/powerpc/booting-without-of.txt |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/p=
owerpc/booting-without-of.txt
index 7b4e8a7..3e1963b 100644
=2D-- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -57,7 +57,8 @@ Table of Contents
       n) 4xx/Axon EMAC ethernet nodes
       o) Xilinx IP cores
       p) Freescale Synchronous Serial Interface
=2D	  q) USB EHCI controllers
+      q) USB EHCI controllers
+      r) Memory-mapped RAM & ROM
=20
   VII - Specifying interrupt information for devices
     1) interrupts property
@@ -2816,6 +2817,16 @@ platforms are moved over to use the flattened-device=
=2Dtree model.
 		   big-endian;
 	   };
=20
+   r) Memory-mapped RAM & ROM
+
+    Dedicated RAM and ROM chips are often used as storage for temporary or
+    permanent data in embedded devices. Possible usage include non-volatile
+    storage in battery-backed SRAM, semi-permanent storage in dedicated SR=
AM
+    to preserve data accross reboots and firmware storage in dedicated ROM.
+
+     - name : should be either "ram" or "rom"
+     - reg : Address range of the RAM/ROM chip
+
=20
    More devices will be defined as this spec matures.
=20
=2D-=20
1.5.0


=2D-=20
Laurent Pinchart
CSE Semaphore Belgium

Chauss=E9e de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
=46 +32 (2) 387 42 75

^ permalink raw reply

* Re: [kvm-ppc-devel] [PATCH] Add idle power save for ppc 4xx
From: Jerone Young @ 2008-03-31 16:52 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: kvm-ppc-devel, linuxppc-dev
In-Reply-To: <1206980871.5919.5.camel@basalt>

On Mon, 2008-03-31 at 11:27 -0500, Hollis Blanchard wrote:
> On Mon, 2008-03-31 at 08:12 -0500, Jerone Young wrote:
> > # HG changeset patch
> > # User Jerone Young <jyoung5@us.ibm.com>
> > # Date 1206969060 18000
> > # Node ID 10aea37177130bbe5de7bee6ec06d9010bc5da1f
> > # Parent  1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc
> > Add idle power save for ppc 4xx
> > 
> > This patch sets the wait state MSR when power_save is called in
> > cpu_idle loop for ppc4xx. This is mainly to help out virtualization
> > solutions such as KVM. This way the virtualization soultions are able
> > to tell if the guest kernel is idle.
> > 
> > I have tested this on hardware & KVM virtual guest.
> > 
> > Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
> > 
> > diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> > --- a/arch/powerpc/kernel/Makefile
> > +++ b/arch/powerpc/kernel/Makefile
> > @@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsy
> >  obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsync.o
> >  obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
> >  obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
> > +obj-$(CONFIG_4xx)		+= idle_4xx.o
> >  obj-$(CONFIG_TAU)		+= tau_6xx.o
> >  obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o \
> >  				   swsusp_$(CONFIG_WORD_SIZE).o
> > diff --git a/arch/powerpc/kernel/idle_4xx.c b/arch/powerpc/kernel/idle_4xx.c
> > new file mode 100644
> > --- /dev/null
> > +++ b/arch/powerpc/kernel/idle_4xx.c
> > @@ -0,0 +1,24 @@
> > +/*
> > + * This file contains the power_save function for 4xx CPUs
> > + *
> > + * added by Jerone Young <jyoung5@us.ibm.com>
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License
> > + * as published by the Free Software Foundation; either version
> > + * 2 of the License, or (at your option) any later version.
> > + */
> > +
> > +#include <asm/processor.h>
> > +#include <asm/machdep.h>
> > +
> > +void ppc4xx_idle()
> 
> void ppc4xx_idle(void)
> 
> > +{
> > +	unsigned long msr_save;
> > +
> > +	/* set wait state MSR */
> > +	local_irq_enable();
> > +	msr_save = mfmsr();
> > +	mtmsr(msr_save|MSR_WE);
> 
> Why don't you |MSR_WE|MSR_EE at the same time?

You technically can do this. But the question is do all 4xx cpus use
MSR_EE to enable interrupts? I can assume they do (from what I know),
but figured it would be safer to make the local_irq_enable() call.
I can change it to just set the MSR_EE bit though, since all 4xx cpus
(as far as I know) use it.


> 
> > +	local_irq_disable();
> > +}
> 
> None of the other power_save() implementations need this. In fact many
> of them don't even seem to return; they just loop around mtmsr.

Sure it can be removed. Though with the comment in the mach_dep
structure about power_save. It specifically says that interrupts are off
when it is called. So I was following it here mainly. But I can remove
the disabling of interrupts, since mtmsr is the only used under
power_save.

> 
> > diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
> > --- a/arch/powerpc/kernel/setup_32.c
> > +++ b/arch/powerpc/kernel/setup_32.c
> > @@ -132,6 +132,10 @@ void __init machine_init(unsigned long d
> >  	if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
> >  	    cpu_has_feature(CPU_FTR_CAN_NAP))
> >  		ppc_md.power_save = ppc6xx_idle;
> > +#endif
> > +
> > +#ifdef CONFIG_4xx
> > +	ppc_md.power_save = ppc4xx_idle;
> >  #endif
> > 
> >  	if (ppc_md.progress)
> 
> This belongs in the platform setup code.

I'll move this to the 4xx platform setup code.

> 

^ permalink raw reply

* Re: [PATCH 1/9] [POWERPC] mv64x60: change FDT compatible prefix to mrvl
From: Dale Farnsworth @ 2008-03-31 16:56 UTC (permalink / raw)
  To: Grant Likely, linuxppc-dev, paulus
In-Reply-To: <20080330234420.GA24402@localhost.localdomain>

On Mon, Mar 31, 2008 at 10:44:20AM +1100, David Gibson wrote:
> On Fri, Mar 28, 2008 at 05:47:25PM -0600, Grant Likely wrote:
> > On Fri, Mar 28, 2008 at 5:42 PM, Dale Farnsworth <dale@farnsworth.org> wrote:
> > > From: Dale Farnsworth <dale@farnsworth.org>
> > >
> > >  Follow the convention that compatible names are prefixed by the
> > >  vendor's stock ticker symbol.  For Marvell Technology Group Ltd.,
> > >  that's MRVL.
> > >
> > >  Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> > >  Acked-by: Mark A. Greer <mgreer@mvista.com>
> > 
> > Are there any boards "in the wild" using the old string?  If so are
> > does changing this string risk complicating upgrades to a new kernel
> > version?
> 
> In particular are there any pre-flattened-tree real-OF systems in the
> wild using "marvell" as the vendor prefix (there might be Apple or IBM
> systems out there with Marvell PHYs for example).

It's difficult to prove a negative.  However, I've seen no evidence of
such systems.  When Mark invented the "marvell," prefix, it wasn't based
on existing practice.

However, I believe that the Genesi Pegasos board uses OF and has a
Marvell bridge chip.  They may have copied the "marvell," prefix.

Matt, can you check whether any of the Genesi boards contain device node
descriptions for the Marvel 64[34]60, and let us know what prefix is used
in their compatible properties?

Thanks,
-Dale

^ permalink raw reply

* [PATCHv3 2/4] cpm-serial: Relocate CPM buffer descriptors and SMC parameter ram.
From: Laurent Pinchart @ 2008-03-31 16:36 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Scott Wood
In-Reply-To: <200803311834.42327.laurentp@cse-semaphore.com>

[-- Attachment #1: Type: text/plain, Size: 6599 bytes --]

This patch relocates the buffer descriptors and the SMC parameter RAM at the
end of the first CPM muram chunk, as described in the device tree. This allows
device trees to stop excluding SMC parameter ram allocated by the boot loader
from the CPM muram node.

Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
---
 arch/powerpc/Kconfig.debug     |    2 +-
 arch/powerpc/boot/cpm-serial.c |  132 ++++++++++++++++++++++++++--------------
 2 files changed, 87 insertions(+), 47 deletions(-)

diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index db7cc34..a86d8d8 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -269,7 +269,7 @@ config PPC_EARLY_DEBUG_CPM_ADDR
 	hex "CPM UART early debug transmit descriptor address"
 	depends on PPC_EARLY_DEBUG_CPM
 	default "0xfa202008" if PPC_EP88XC
-	default "0xf0000008" if CPM2
+	default "0xf0001ff8" if CPM2
 	default "0xff002008" if CPM1
 	help
 	  This specifies the address of the transmit descriptor
diff --git a/arch/powerpc/boot/cpm-serial.c b/arch/powerpc/boot/cpm-serial.c
index 28296fa..8d02b2d 100644
--- a/arch/powerpc/boot/cpm-serial.c
+++ b/arch/powerpc/boot/cpm-serial.c
@@ -11,6 +11,7 @@
 #include "types.h"
 #include "io.h"
 #include "ops.h"
+#include "page.h"
 
 struct cpm_scc {
 	u32 gsmrl;
@@ -42,6 +43,22 @@ struct cpm_param {
 	u16 tbase;
 	u8 rfcr;
 	u8 tfcr;
+	u16 mrblr;
+	u32 rstate;
+	u8 res1[4];
+	u16 rbptr;
+	u8 res2[6];
+	u32 tstate;
+	u8 res3[4];
+	u16 tbptr;
+	u8 res4[6];
+	u16 maxidl;
+	u16 idlc;
+	u16 brkln;
+	u16 brkec;
+	u16 brkcr;
+	u16 rmask;
+	u8 res5[4];
 };
 
 struct cpm_bd {
@@ -54,10 +71,10 @@ static void *cpcr;
 static struct cpm_param *param;
 static struct cpm_smc *smc;
 static struct cpm_scc *scc;
-struct cpm_bd *tbdf, *rbdf;
+static struct cpm_bd *tbdf, *rbdf;
 static u32 cpm_cmd;
-static u8 *muram_start;
-static u32 muram_offset;
+static void *cbd_addr;
+static u32 cbd_offset;
 
 static void (*do_cmd)(int op);
 static void (*enable_port)(void);
@@ -119,20 +136,25 @@ static int cpm_serial_open(void)
 
 	out_8(&param->rfcr, 0x10);
 	out_8(&param->tfcr, 0x10);
-
-	rbdf = (struct cpm_bd *)muram_start;
-	rbdf->addr = (u8 *)(rbdf + 2);
+	out_be16(&param->mrblr, 1);
+	out_be16(&param->maxidl, 0);
+	out_be16(&param->brkec, 0);
+	out_be16(&param->brkln, 0);
+	out_be16(&param->brkcr, 0);
+
+	rbdf = cbd_addr;
+	rbdf->addr = (u8 *)rbdf - 1;
 	rbdf->sc = 0xa000;
 	rbdf->len = 1;
 
 	tbdf = rbdf + 1;
-	tbdf->addr = (u8 *)(rbdf + 2) + 1;
+	tbdf->addr = (u8 *)rbdf - 2;
 	tbdf->sc = 0x2000;
 	tbdf->len = 1;
 
 	sync();
-	out_be16(&param->rbase, muram_offset);
-	out_be16(&param->tbase, muram_offset + sizeof(struct cpm_bd));
+	out_be16(&param->rbase, cbd_offset);
+	out_be16(&param->tbase, cbd_offset + sizeof(struct cpm_bd));
 
 	do_cmd(CPM_CMD_INIT_RX_TX);
 
@@ -173,12 +195,31 @@ static unsigned char cpm_serial_getc(void)
 	return c;
 }
 
+static int cpm_get_virtual_address(void *devp, void **addr, int ncells)
+{
+	unsigned long xaddr;
+	int n;
+
+	n = getprop(devp, "virtual-reg", addr, ncells * sizeof *addr);
+	if (n < ncells * sizeof *addr) {
+		for (n = 0; n < ncells; n++) {
+			if (!dt_xlate_reg(devp, n, &xaddr, NULL))
+				return -1;
+
+			addr[n] = (void*)xaddr;
+		}
+	}
+
+	return ncells;
+}
+
 int cpm_console_init(void *devp, struct serial_console_data *scdp)
 {
-	void *reg_virt[2];
-	int is_smc = 0, is_cpm2 = 0, n;
-	unsigned long reg_phys;
+	void *reg[2];
 	void *parent, *muram;
+	void *muram_addr;
+	int is_smc = 0, is_cpm2 = 0;
+	unsigned long muram_offset, muram_size;
 
 	if (dt_is_compatible(devp, "fsl,cpm1-smc-uart")) {
 		is_smc = 1;
@@ -202,63 +243,62 @@ int cpm_console_init(void *devp, struct serial_console_data *scdp)
 	else
 		do_cmd = cpm1_cmd;
 
-	n = getprop(devp, "fsl,cpm-command", &cpm_cmd, 4);
-	if (n < 4)
+	if (getprop(devp, "fsl,cpm-command", &cpm_cmd, 4) < sizeof cpm_cmd)
 		return -1;
 
-	n = getprop(devp, "virtual-reg", reg_virt, sizeof(reg_virt));
-	if (n < (int)sizeof(reg_virt)) {
-		for (n = 0; n < 2; n++) {
-			if (!dt_xlate_reg(devp, n, &reg_phys, NULL))
-				return -1;
-
-			reg_virt[n] = (void *)reg_phys;
-		}
-	}
+	if (cpm_get_virtual_address(devp, reg, 2) < 0)
+		return -1;
 
 	if (is_smc)
-		smc = reg_virt[0];
+		smc = reg[0];
 	else
-		scc = reg_virt[0];
+		scc = reg[0];
 
-	param = reg_virt[1];
+	param = reg[1];
 
 	parent = get_parent(devp);
 	if (!parent)
 		return -1;
 
-	n = getprop(parent, "virtual-reg", reg_virt, sizeof(reg_virt));
-	if (n < (int)sizeof(reg_virt)) {
-		if (!dt_xlate_reg(parent, 0, &reg_phys, NULL))
-			return -1;
-
-		reg_virt[0] = (void *)reg_phys;
-	}
-
-	cpcr = reg_virt[0];
+	if (cpm_get_virtual_address(devp, &cpcr, 1) < 0)
+		return -1;
 
 	muram = finddevice("/soc/cpm/muram/data");
 	if (!muram)
 		return -1;
 
 	/* For bootwrapper-compatible device trees, we assume that the first
-	 * entry has at least 18 bytes, and that #address-cells/#data-cells
+	 * entry has at least 128 bytes, and that #address-cells/#data-cells
 	 * is one for both parent and child.
 	 */
 
-	n = getprop(muram, "virtual-reg", reg_virt, sizeof(reg_virt));
-	if (n < (int)sizeof(reg_virt)) {
-		if (!dt_xlate_reg(muram, 0, &reg_phys, NULL))
-			return -1;
+	if (cpm_get_virtual_address(devp, &muram_addr, 1) < 0)
+		return -1;
+	
+	if (getprop(muram, "reg", reg, sizeof reg) < sizeof reg)
+		return -1;
+
+	muram_offset = (unsigned long)reg[0];
+	muram_size = (unsigned long)reg[1];
+
+	/* Store the buffer descriptors at the end of the first muram chunk.
+	 * For SMC ports on CPM2-based platforms, relocate the parameter RAM
+	 * just before the buffer descriptors.
+	 */
+
+	cbd_offset = muram_offset + muram_size - 2 * sizeof(struct cpm_bd);
 
-		reg_virt[0] = (void *)reg_phys;
-	}
+	if (is_cpm2 && is_smc) {
+		u16 *smc_base = (u16*)param;
+		u16 pram_offset;
 
-	muram_start = reg_virt[0];
+		pram_offset = cbd_offset - 64;
+		pram_offset = _ALIGN_DOWN(pram_offset, 64);
+		*smc_base = pram_offset;
+		param = muram_addr - muram_offset + pram_offset;
+	}
 
-	n = getprop(muram, "reg", &muram_offset, 4);
-	if (n < 4)
-		return -1;
+	cbd_addr = muram_addr - muram_offset + cbd_offset;
 
 	scdp->open = cpm_serial_open;
 	scdp->putc = cpm_serial_putc;
-- 
1.5.0


-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* [PATCH] [POWERPC] Fix defconfigs so we dont set both GENRTC and RTCLIB
From: Kumar Gala @ 2008-03-31 16:55 UTC (permalink / raw)
  To: linuxppc-dev

The new rtc subsystem conflicts with genrtc so don't enable GENRTC
if RTCLIB is enabled.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/configs/mpc832x_mds_defconfig  |   11 +++--------
 arch/powerpc/configs/mpc834x_mds_defconfig  |   11 +++--------
 arch/powerpc/configs/mpc836x_mds_defconfig  |   11 +++--------
 arch/powerpc/configs/mpc8544_ds_defconfig   |   11 +++--------
 arch/powerpc/configs/mpc8568mds_defconfig   |   11 +++--------
 arch/powerpc/configs/mpc8572_ds_defconfig   |   11 +++--------
 arch/powerpc/configs/mpc85xx_defconfig      |   11 +++--------
 arch/powerpc/configs/mpc8641_hpcn_defconfig |   11 +++--------
 arch/powerpc/configs/prpmc2800_defconfig    |   11 +++--------
 arch/powerpc/configs/storcenter_defconfig   |   11 +++--------
 10 files changed, 30 insertions(+), 80 deletions(-)

diff --git a/arch/powerpc/configs/mpc832x_mds_defconfig b/arch/powerpc/configs/mpc832x_mds_defconfig
index 79d228f..50cceda 100644
--- a/arch/powerpc/configs/mpc832x_mds_defconfig
+++ b/arch/powerpc/configs/mpc832x_mds_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:16 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:36:51 2008
 #
 # CONFIG_PPC64 is not set

@@ -628,8 +628,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_NVRAM is not set
-CONFIG_GEN_RTC=y
-# CONFIG_GEN_RTC_X is not set
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -824,10 +823,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
diff --git a/arch/powerpc/configs/mpc834x_mds_defconfig b/arch/powerpc/configs/mpc834x_mds_defconfig
index 9360144..b4e82c0 100644
--- a/arch/powerpc/configs/mpc834x_mds_defconfig
+++ b/arch/powerpc/configs/mpc834x_mds_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:20 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:36:56 2008
 #
 # CONFIG_PPC64 is not set

@@ -571,8 +571,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_NVRAM is not set
-CONFIG_GEN_RTC=y
-# CONFIG_GEN_RTC_X is not set
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -767,10 +766,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
diff --git a/arch/powerpc/configs/mpc836x_mds_defconfig b/arch/powerpc/configs/mpc836x_mds_defconfig
index 7c8b060..d50a96e 100644
--- a/arch/powerpc/configs/mpc836x_mds_defconfig
+++ b/arch/powerpc/configs/mpc836x_mds_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:21 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:36:57 2008
 #
 # CONFIG_PPC64 is not set

@@ -626,8 +626,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_NVRAM is not set
-CONFIG_GEN_RTC=y
-# CONFIG_GEN_RTC_X is not set
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -822,10 +821,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
diff --git a/arch/powerpc/configs/mpc8544_ds_defconfig b/arch/powerpc/configs/mpc8544_ds_defconfig
index c75b6ae..418bcdb 100644
--- a/arch/powerpc/configs/mpc8544_ds_defconfig
+++ b/arch/powerpc/configs/mpc8544_ds_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:26 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:37:03 2008
 #
 # CONFIG_PPC64 is not set

@@ -742,8 +742,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 CONFIG_NVRAM=y
-CONFIG_GEN_RTC=y
-CONFIG_GEN_RTC_X=y
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -1209,10 +1208,6 @@ CONFIG_USB_MON=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
diff --git a/arch/powerpc/configs/mpc8568mds_defconfig b/arch/powerpc/configs/mpc8568mds_defconfig
index e7da4b9..2b866b3 100644
--- a/arch/powerpc/configs/mpc8568mds_defconfig
+++ b/arch/powerpc/configs/mpc8568mds_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:28 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:37:05 2008
 #
 # CONFIG_PPC64 is not set

@@ -629,8 +629,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_NVRAM is not set
-CONFIG_GEN_RTC=y
-# CONFIG_GEN_RTC_X is not set
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -825,10 +824,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
diff --git a/arch/powerpc/configs/mpc8572_ds_defconfig b/arch/powerpc/configs/mpc8572_ds_defconfig
index 460afe9..53aa6f3 100644
--- a/arch/powerpc/configs/mpc8572_ds_defconfig
+++ b/arch/powerpc/configs/mpc8572_ds_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:29 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:37:06 2008
 #
 # CONFIG_PPC64 is not set

@@ -742,8 +742,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 CONFIG_NVRAM=y
-CONFIG_GEN_RTC=y
-CONFIG_GEN_RTC_X=y
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -1209,10 +1208,6 @@ CONFIG_USB_MON=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index 615e4c1..2075722 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:31 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:37:08 2008
 #
 # CONFIG_PPC64 is not set

@@ -750,8 +750,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 CONFIG_NVRAM=y
-CONFIG_GEN_RTC=y
-CONFIG_GEN_RTC_X=y
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -1217,10 +1216,6 @@ CONFIG_USB_MON=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
diff --git a/arch/powerpc/configs/mpc8641_hpcn_defconfig b/arch/powerpc/configs/mpc8641_hpcn_defconfig
index 994e768..d01dcdb 100644
--- a/arch/powerpc/configs/mpc8641_hpcn_defconfig
+++ b/arch/powerpc/configs/mpc8641_hpcn_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:34 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:37:11 2008
 #
 # CONFIG_PPC64 is not set

@@ -736,8 +736,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 CONFIG_NVRAM=y
-CONFIG_GEN_RTC=y
-CONFIG_GEN_RTC_X=y
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -1203,10 +1202,6 @@ CONFIG_USB_MON=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
diff --git a/arch/powerpc/configs/prpmc2800_defconfig b/arch/powerpc/configs/prpmc2800_defconfig
index f53d55b..f912168 100644
--- a/arch/powerpc/configs/prpmc2800_defconfig
+++ b/arch/powerpc/configs/prpmc2800_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:37 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:37:15 2008
 #
 # CONFIG_PPC64 is not set

@@ -855,8 +855,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
 # CONFIG_NVRAM is not set
-CONFIG_GEN_RTC=y
-# CONFIG_GEN_RTC_X is not set
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -1129,10 +1128,6 @@ CONFIG_USB_MON=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
diff --git a/arch/powerpc/configs/storcenter_defconfig b/arch/powerpc/configs/storcenter_defconfig
index 8fc8574..fdbfd39 100644
--- a/arch/powerpc/configs/storcenter_defconfig
+++ b/arch/powerpc/configs/storcenter_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Mon Mar 24 08:48:41 2008
+# Linux kernel version: 2.6.25-rc7
+# Mon Mar 31 11:37:19 2008
 #
 # CONFIG_PPC64 is not set

@@ -717,8 +717,7 @@ CONFIG_LEGACY_PTY_COUNT=256
 # CONFIG_IPMI_HANDLER is not set
 CONFIG_HW_RANDOM=m
 CONFIG_NVRAM=y
-CONFIG_GEN_RTC=y
-# CONFIG_GEN_RTC_X is not set
+# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_RAW_DRIVER is not set
@@ -931,10 +930,6 @@ CONFIG_USB_STORAGE=y
 # CONFIG_EDAC is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
-
-#
-# Conflicting RTC option has been selected, check GEN_RTC and RTC
-#
 CONFIG_RTC_HCTOSYS=y
 CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
 # CONFIG_RTC_DEBUG is not set
-- 
1.5.4.1

^ permalink raw reply related

* Please pull from 'for-2.6.25' branch
From: Kumar Gala @ 2008-03-31 16:57 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, Linus Torvalds

Please pull from 'for-2.6.25' branch of

	master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for-2.6.25

I'd like to get these minor fixes into 2.6.25.  They aren't critical but
extremely convenient at this point.

to receive the following updates:

 arch/powerpc/boot/dts/mpc8377_mds.dts       |    4 ++--
 arch/powerpc/boot/dts/mpc8377_rdb.dts       |    3 +--
 arch/powerpc/boot/dts/mpc8378_rdb.dts       |    3 +--
 arch/powerpc/boot/dts/mpc8379_mds.dts       |    8 ++++----
 arch/powerpc/boot/dts/mpc8379_rdb.dts       |    3 +--
 arch/powerpc/configs/mpc832x_mds_defconfig  |   11 +++--------
 arch/powerpc/configs/mpc834x_mds_defconfig  |   11 +++--------
 arch/powerpc/configs/mpc836x_mds_defconfig  |   11 +++--------
 arch/powerpc/configs/mpc837x_rdb_defconfig  |   24 +++++++++++++++++++++++-
 arch/powerpc/configs/mpc83xx_defconfig      |   24 +++++++++++++++++++++++-
 arch/powerpc/configs/mpc8544_ds_defconfig   |   11 +++--------
 arch/powerpc/configs/mpc8568mds_defconfig   |   11 +++--------
 arch/powerpc/configs/mpc8572_ds_defconfig   |   11 +++--------
 arch/powerpc/configs/mpc85xx_defconfig      |   11 +++--------
 arch/powerpc/configs/mpc8641_hpcn_defconfig |   11 +++--------
 arch/powerpc/configs/prpmc2800_defconfig    |   11 +++--------
 arch/powerpc/configs/storcenter_defconfig   |   11 +++--------
 drivers/ata/sata_fsl.c                      |    5 +----
 drivers/dma/fsldma.c                        |    8 ++++----
 19 files changed, 90 insertions(+), 102 deletions(-)

Anton Vorontsov (1):
      [POWERPC] 83xx: Fix wrong USB phy type in mpc837xrdb dts

Kim Phillips (2):
      [POWERPC] 83xx: enable usb in 837x rdb and 83xx defconfigs
      [POWERPC] sata_fsl: reduce compatibility to fsl,pq-sata

Kumar Gala (2):
      [POWERPC] fsldma: Use compatiable binding as spec
      [POWERPC] Fix defconfigs so we dont set both GENRTC and RTCLIB

^ permalink raw reply

* Re: 8543 console baud rate change problem
From: Dan Wilson @ 2008-03-31 16:56 UTC (permalink / raw)
  Cc: linuxppc-embedded
In-Reply-To: <47EEFB5B.3050700@fulcrummicro.com>

Dan Wilson wrote:
> We are using ELDK 4.1, linux kernel 2.6.22 on an 8543 board with a 
> Layer 2 switch on it (i.e., the actual packet switching is done in an 
> external chip, not by the 8543 itself).  One of our customers has 
> encountered a strange issue with system console baud rate changes.  
> The system console is connected to a UART port on the 8543.
>
>
> Here is the sequence of events:
>
> + powercycle unit at 115200
>
> + have ping session going
> + establish telnet session
> + have L2 traffic traversing the switch
>
> + switch baud rate to any other baud rate beside 38400
> + hit a few returns
> + switch baud rate back to 115200 and no problem
>
> + switch baud rate to 38400
> + type a few char
> + switch baud rate back to 115200
> + console is not responsive
>
> + existing ping session is still going
> + L2 traffic is still OK
> + telnet session disconnected and can not reconnect;
>  telnet session is being served by linux ip stack
>
> + Had to power cycle to get everything back
>
Just to follow up on this.  We were able to determine that our customer 
had shut off the normal telnet daemon and was using their own program to 
handle telnet sessions.  In addition, they weren't using agetty.  We got 
them to use agetty, and now things seem to be working for them.

Dan.

^ permalink raw reply

* Re: [PATCHv2] powerpc: Describe memory-mapped RAM&ROM chips OF bindings
From: Sergei Shtylyov @ 2008-03-31 17:06 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: ben, linuxppc-dev, linux-mtd, David Gibson
In-Reply-To: <200803311839.10519.laurentp@cse-semaphore.com>

Hello.

Laurent Pinchart wrote:

> Signed-off-by: Laurent Pinchart <laurentp@cse-semaphore.com>
> ---
>  Documentation/powerpc/booting-without-of.txt |   13 ++++++++++++-
>  1 files changed, 12 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
> index 7b4e8a7..3e1963b 100644
> --- a/Documentation/powerpc/booting-without-of.txt
> +++ b/Documentation/powerpc/booting-without-of.txt
> @@ -57,7 +57,8 @@ Table of Contents
>        n) 4xx/Axon EMAC ethernet nodes
>        o) Xilinx IP cores
>        p) Freescale Synchronous Serial Interface
> -	  q) USB EHCI controllers
> +      q) USB EHCI controllers
> +      r) Memory-mapped RAM & ROM

    Memory-mapped RA/RO Memory again? Should better drop this. :-)

WBR, Sergei

^ permalink raw reply

* Re: [PATCH] Add idle power save for ppc 4xx
From: Josh Boyer @ 2008-03-31 17:07 UTC (permalink / raw)
  To: Jerone Young; +Cc: kvm-ppc-devel, linuxppc-dev
In-Reply-To: <10aea37177130bbe5de7.1206969157@thinkpadL>

On Mon, 2008-03-31 at 08:12 -0500, Jerone Young wrote:
> # HG changeset patch
> # User Jerone Young <jyoung5@us.ibm.com>
> # Date 1206969060 18000
> # Node ID 10aea37177130bbe5de7bee6ec06d9010bc5da1f
> # Parent  1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc
> Add idle power save for ppc 4xx
> 
> This patch sets the wait state MSR when power_save is called in cpu_idle loop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
> 
> I have tested this on hardware & KVM virtual guest.

I'm not overly thrilled with adding this to all of 4xx.  It doesn't
actually save much power at all (1% on a project that actually measured
it with an amp meter recently) and there's really no other benefit to
doing it outside of the virtual guest case.

I'm assuming you pass a dtb to the virtual guest when you start it up.
Could you define a property in the CPU node there that can be parsed to
use the power_save function instead of always making it the default?

> Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
> 
> diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> --- a/arch/powerpc/kernel/Makefile
> +++ b/arch/powerpc/kernel/Makefile
> @@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsy
>  obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsync.o
>  obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
>  obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
> +obj-$(CONFIG_4xx)		+= idle_4xx.o
>  obj-$(CONFIG_TAU)		+= tau_6xx.o
>  obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o \
>  				   swsusp_$(CONFIG_WORD_SIZE).o
> diff --git a/arch/powerpc/kernel/idle_4xx.c b/arch/powerpc/kernel/idle_4xx.c
> new file mode 100644
> --- /dev/null
> +++ b/arch/powerpc/kernel/idle_4xx.c

Can this be added to sysdev/ppc4xx_soc.c instead?

> +#include <asm/processor.h>
> +#include <asm/machdep.h>
> +
> +void ppc4xx_idle()
> +{
> +	unsigned long msr_save;
> +
> +	/* set wait state MSR */
> +	local_irq_enable();
> +	msr_save = mfmsr();
> +	mtmsr(msr_save|MSR_WE);
> +	local_irq_disable();
> +}

I agree with Hollis on both the MSR_WE|MSR_EE and removing the
local_irq_disable changes.

> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
> --- a/arch/powerpc/kernel/setup_32.c
> +++ b/arch/powerpc/kernel/setup_32.c
> @@ -132,6 +132,10 @@ void __init machine_init(unsigned long d
>  	if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
>  	    cpu_has_feature(CPU_FTR_CAN_NAP))
>  		ppc_md.power_save = ppc6xx_idle;
> +#endif
> +
> +#ifdef CONFIG_4xx
> +	ppc_md.power_save = ppc4xx_idle;
>  #endif

I agree this belongs in platform setup code.  Finding the right spot for
it might be a bit of a challenge.

josh

^ permalink raw reply

* RE: JFFS2 root-fs
From: Sugathan, Rupesh @ 2008-03-31 17:23 UTC (permalink / raw)
  To: Georg Schardt; +Cc: linuxppc-embedded

=20
It seems to me, that the kernel does not find ANY file. because the
/dev/console file is in the image, but the initial console is not found
too

1) You should probably unpack and mount the jffs2 image on your host
directory to ensure that you see all files in place.=20
2) Check to see if your designated flash partition can hold all of your
jffs2 image.

Were you able to use the 'same' rootfs in any other way (nfs mount or
ramdisk) on the target?

Thanks
--
Rupesh Sugathan

^ permalink raw reply

* RE: [PATCHv2 2/3] ep8248e: Reference SMC parameter RAM base in thedevice tree.
From: Rune Torgersen @ 2008-03-31 17:38 UTC (permalink / raw)
  To: Scott Wood, Laurent Pinchart; +Cc: linuxppc-dev
In-Reply-To: <20080331153301.GA23806@ld0162-tx32.am.freescale.net>

Scott Wood wrote:
> 0x2000 minus sizeof(...) would be a good default for CPM1 and CPM2
> (8280 has its first chunk go up to 0x4000, but for some reason that
> didn't get reflected in the dts for the one 8280 board in-tree).

Except that last time I tested it, it is not from 0 - 0x4000, but the
extra 0x2000 is added from offset 0x9000.....
So 8280 has available muram from 0 - 0x2000 and 0x9000 - 0xb000

^ permalink raw reply

* Re: [PATCHv2 2/3] ep8248e: Reference SMC parameter RAM base in thedevice tree.
From: Scott Wood @ 2008-03-31 17:42 UTC (permalink / raw)
  To: Rune Torgersen; +Cc: linuxppc-dev
In-Reply-To: <DCEAAC0833DD314AB0B58112AD99B93B043011C7@ismail.innsys.innovsys.com>

Rune Torgersen wrote:
> Scott Wood wrote:
>> 0x2000 minus sizeof(...) would be a good default for CPM1 and CPM2
>> (8280 has its first chunk go up to 0x4000, but for some reason that
>> didn't get reflected in the dts for the one 8280 board in-tree).
> 
> Except that last time I tested it, it is not from 0 - 0x4000, but the
> extra 0x2000 is added from offset 0x9000.....
> So 8280 has available muram from 0 - 0x2000 and 0x9000 - 0xb000

According to the docs, it has 0 - 0x4000 and 0x9000 - 0xc000.

-Scott

^ permalink raw reply

* RE: [PATCHv2 2/3] ep8248e: Reference SMC parameter RAM base in thedevice tree.
From: Rune Torgersen @ 2008-03-31 17:45 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <47F12287.5030503@freescale.com>

Scott Wood wrote:
> Rune Torgersen wrote:
>> Scott Wood wrote:
>>> 0x2000 minus sizeof(...) would be a good default for CPM1 and CPM2
>>> (8280 has its first chunk go up to 0x4000, but for some reason that
>>> didn't get reflected in the dts for the one 8280 board in-tree).
>>=20
>> Except that last time I tested it, it is not from 0 - 0x4000, but the
>> extra 0x2000 is added from offset 0x9000.....
>> So 8280 has available muram from 0 - 0x2000 and 0x9000 - 0xb000
>=20
> According to the docs, it has 0 - 0x4000 and 0x9000 - 0xc000.

I tried it on out 8280 board inhouse, and any addresses from 0x2000 to
0x3fff does not work with at least the MCC's.
(running ss7 with the extended ss7 microcode)
If I only used 0-0x2000 and 0x9000 to 0xB000 then it is happy.

^ permalink raw reply

* Re: [kvm-ppc-devel] [PATCH] Add idle power save for ppc 4xx
From: Josh Boyer @ 2008-03-31 17:48 UTC (permalink / raw)
  To: jyoung5; +Cc: kvm-ppc-devel, linuxppc-dev, Hollis Blanchard
In-Reply-To: <1206982322.9165.7.camel@thinkpadL>

On Mon, 31 Mar 2008 11:52:02 -0500
Jerone Young <jyoung5@us.ibm.com> wrote:

> > void ppc4xx_idle(void)
> > 
> > > +{
> > > +	unsigned long msr_save;
> > > +
> > > +	/* set wait state MSR */
> > > +	local_irq_enable();
> > > +	msr_save = mfmsr();
> > > +	mtmsr(msr_save|MSR_WE);
> > 
> > Why don't you |MSR_WE|MSR_EE at the same time?
> 
> You technically can do this. But the question is do all 4xx cpus use
> MSR_EE to enable interrupts? I can assume they do (from what I know),

They do for enabling external interrupts of normal priority.  MSR_CE
might also be used/needed if someone has the watchdog enabled or has an
external device with the UIC pin mapped as a CE.

josh

^ permalink raw reply

* Re: [PATCH] Add idle power save for ppc 4xx
From: Josh Boyer @ 2008-03-31 18:05 UTC (permalink / raw)
  To: Josh Boyer; +Cc: kvm-ppc-devel, linuxppc-dev
In-Reply-To: <1206983237.12155.60.camel@vader.jdub.homelinux.org>

On Mon, 31 Mar 2008 12:07:17 -0500
Josh Boyer <jwboyer@gmail.com> wrote:

> On Mon, 2008-03-31 at 08:12 -0500, Jerone Young wrote:
> > # HG changeset patch
> > # User Jerone Young <jyoung5@us.ibm.com>
> > # Date 1206969060 18000
> > # Node ID 10aea37177130bbe5de7bee6ec06d9010bc5da1f
> > # Parent  1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc
> > Add idle power save for ppc 4xx
> > 
> > This patch sets the wait state MSR when power_save is called in cpu_idle loop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
> > 
> > I have tested this on hardware & KVM virtual guest.
> 
> I'm not overly thrilled with adding this to all of 4xx.  It doesn't
> actually save much power at all (1% on a project that actually measured
> it with an amp meter recently) and there's really no other benefit to
> doing it outside of the virtual guest case.
> 
> I'm assuming you pass a dtb to the virtual guest when you start it up.
> Could you define a property in the CPU node there that can be parsed to
> use the power_save function instead of always making it the default?

Actually, you probably don't want this as a property in the device
tree.  It doesn't describe hardware.  A Kconfig option might be
warranted though.

josh

^ permalink raw reply

* Re: [PATCH] Add idle power save for ppc 4xx
From: Jerone Young @ 2008-03-31 18:19 UTC (permalink / raw)
  To: Josh Boyer; +Cc: kvm-ppc-devel, linuxppc-dev
In-Reply-To: <20080331130518.2a6b0264@zod.rchland.ibm.com>

On Mon, 2008-03-31 at 13:05 -0500, Josh Boyer wrote:
> On Mon, 31 Mar 2008 12:07:17 -0500
> Josh Boyer <jwboyer@gmail.com> wrote:
> 
> > On Mon, 2008-03-31 at 08:12 -0500, Jerone Young wrote:
> > > # HG changeset patch
> > > # User Jerone Young <jyoung5@us.ibm.com>
> > > # Date 1206969060 18000
> > > # Node ID 10aea37177130bbe5de7bee6ec06d9010bc5da1f
> > > # Parent  1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc
> > > Add idle power save for ppc 4xx
> > > 
> > > This patch sets the wait state MSR when power_save is called in cpu_idle loop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
> > > 
> > > I have tested this on hardware & KVM virtual guest.
> > 
> > I'm not overly thrilled with adding this to all of 4xx.  It doesn't
> > actually save much power at all (1% on a project that actually measured
> > it with an amp meter recently) and there's really no other benefit to
> > doing it outside of the virtual guest case.
> > 
> > I'm assuming you pass a dtb to the virtual guest when you start it up.
> > Could you define a property in the CPU node there that can be parsed to
> > use the power_save function instead of always making it the default?
> 
> Actually, you probably don't want this as a property in the device
> tree.  It doesn't describe hardware.  A Kconfig option might be
> warranted though.

I'll go with the Kconfig option. 

> 
> josh

^ permalink raw reply

* Re: [PATCH] Add idle power save for ppc 4xx
From: Jerone Young @ 2008-03-31 18:23 UTC (permalink / raw)
  To: Josh Boyer; +Cc: kvm-ppc-devel, linuxppc-dev
In-Reply-To: <1206983237.12155.60.camel@vader.jdub.homelinux.org>

On Mon, 2008-03-31 at 12:07 -0500, Josh Boyer wrote:
> On Mon, 2008-03-31 at 08:12 -0500, Jerone Young wrote:
> > # HG changeset patch
> > # User Jerone Young <jyoung5@us.ibm.com>
> > # Date 1206969060 18000
> > # Node ID 10aea37177130bbe5de7bee6ec06d9010bc5da1f
> > # Parent  1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc
> > Add idle power save for ppc 4xx
> > 
> > This patch sets the wait state MSR when power_save is called in cpu_idle loop for ppc4xx. This is mainly to help out virtualization solutions such as KVM. This way the virtualization soultions are able to tell if the guest kernel is idle.
> > 
> > I have tested this on hardware & KVM virtual guest.
> 
> I'm not overly thrilled with adding this to all of 4xx.  It doesn't
> actually save much power at all (1% on a project that actually measured
> it with an amp meter recently) and there's really no other benefit to
> doing it outside of the virtual guest case.
> 
> I'm assuming you pass a dtb to the virtual guest when you start it up.
> Could you define a property in the CPU node there that can be parsed to
> use the power_save function instead of always making it the default?
> 
> > Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
> > 
> > diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> > --- a/arch/powerpc/kernel/Makefile
> > +++ b/arch/powerpc/kernel/Makefile
> > @@ -39,6 +39,7 @@ obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsy
> >  obj-$(CONFIG_GENERIC_TBSYNC)	+= smp-tbsync.o
> >  obj-$(CONFIG_CRASH_DUMP)	+= crash_dump.o
> >  obj-$(CONFIG_6xx)		+= idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
> > +obj-$(CONFIG_4xx)		+= idle_4xx.o
> >  obj-$(CONFIG_TAU)		+= tau_6xx.o
> >  obj-$(CONFIG_HIBERNATION)	+= swsusp.o suspend.o \
> >  				   swsusp_$(CONFIG_WORD_SIZE).o
> > diff --git a/arch/powerpc/kernel/idle_4xx.c b/arch/powerpc/kernel/idle_4xx.c
> > new file mode 100644
> > --- /dev/null
> > +++ b/arch/powerpc/kernel/idle_4xx.c
> 
> Can this be added to sysdev/ppc4xx_soc.c instead?

Probably. Though the other platforms have there power_save code in
idle_<platform>.S files, as they are in assembly.

Also I don't appear to have ppc4xx_soc.c in my source (using
2.6.25-rc6).

> 
> > +#include <asm/processor.h>
> > +#include <asm/machdep.h>
> > +
> > +void ppc4xx_idle()
> > +{
> > +	unsigned long msr_save;
> > +
> > +	/* set wait state MSR */
> > +	local_irq_enable();
> > +	msr_save = mfmsr();
> > +	mtmsr(msr_save|MSR_WE);
> > +	local_irq_disable();
> > +}
> 
> I agree with Hollis on both the MSR_WE|MSR_EE and removing the
> local_irq_disable changes.

You mention adding MSR_CE in a followup email. I'll add that to and
remove local_irq_disable.

> 
> > diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
> > --- a/arch/powerpc/kernel/setup_32.c
> > +++ b/arch/powerpc/kernel/setup_32.c
> > @@ -132,6 +132,10 @@ void __init machine_init(unsigned long d
> >  	if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
> >  	    cpu_has_feature(CPU_FTR_CAN_NAP))
> >  		ppc_md.power_save = ppc6xx_idle;
> > +#endif
> > +
> > +#ifdef CONFIG_4xx
> > +	ppc_md.power_save = ppc4xx_idle;
> >  #endif
> 
> I agree this belongs in platform setup code.  Finding the right spot for
> it might be a bit of a challenge.
> 
> josh
> 

^ permalink raw reply

* Re: [PATCHv3 2/4] cpm-serial: Relocate CPM buffer descriptors and SMC parameter ram.
From: Scott Wood @ 2008-03-31 19:10 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linuxppc-dev
In-Reply-To: <200803311836.08142.laurentp@cse-semaphore.com>

Laurent Pinchart wrote:
> This patch relocates the buffer descriptors and the SMC parameter RAM at the
> end of the first CPM muram chunk, as described in the device tree. This allows
> device trees to stop excluding SMC parameter ram allocated by the boot loader
> from the CPM muram node.

It's usually a good idea to state that something is untested if that's 
the case. :-)

This patch cannot work as is.

> +static int cpm_get_virtual_address(void *devp, void **addr, int ncells)
> +{
> +	unsigned long xaddr;
> +	int n;
> +
> +	n = getprop(devp, "virtual-reg", addr, ncells * sizeof *addr);
> +	if (n < ncells * sizeof *addr) {

You must cast the sizeof to a signed int; otherwise, a negative return 
from getprop will be "bigger" than the unsigned size, and you'll return 
garbage as the address.

> +		for (n = 0; n < ncells; n++) {
> +			if (!dt_xlate_reg(devp, n, &xaddr, NULL))
> +				return -1;
> +
> +			addr[n] = (void*)xaddr;

(void *)

> +		}
> +	}
> +
> +	return ncells;
> +}

This could be a generic bootwrapper function.  It should return the 
number of resources (ncells is a misnomer) actually found, though, 
rather than failing if there are fewer than asked for.  Let the caller 
decide if it's fatal.

> @@ -202,63 +243,62 @@ int cpm_console_init(void *devp, struct serial_console_data *scdp)
>  	else
>  		do_cmd = cpm1_cmd;
>  
> -	n = getprop(devp, "fsl,cpm-command", &cpm_cmd, 4);
> -	if (n < 4)
> +	if (getprop(devp, "fsl,cpm-command", &cpm_cmd, 4) < sizeof cpm_cmd)
>  		return -1;

Standard kernel style is sizeof(foo), not sizeof foo.

Plus, if you're going to replace 4 with sizeof(cpm_cmd), do it both 
places.  I don't really see the need, though; a cell is always 4 bytes.

> -	n = getprop(parent, "virtual-reg", reg_virt, sizeof(reg_virt));
> -	if (n < (int)sizeof(reg_virt)) {
> -		if (!dt_xlate_reg(parent, 0, &reg_phys, NULL))
> -			return -1;
> -
> -		reg_virt[0] = (void *)reg_phys;
> -	}
> -
> -	cpcr = reg_virt[0];
> +	if (cpm_get_virtual_address(devp, &cpcr, 1) < 0)
> +		return -1;

s/devp/parent/

>  	muram = finddevice("/soc/cpm/muram/data");
>  	if (!muram)
>  		return -1;
>  
>  	/* For bootwrapper-compatible device trees, we assume that the first
> -	 * entry has at least 18 bytes, and that #address-cells/#data-cells
> +	 * entry has at least 128 bytes, and that #address-cells/#data-cells
>  	 * is one for both parent and child.
>  	 */
>  
> -	n = getprop(muram, "virtual-reg", reg_virt, sizeof(reg_virt));
> -	if (n < (int)sizeof(reg_virt)) {
> -		if (!dt_xlate_reg(muram, 0, &reg_phys, NULL))
> -			return -1;
> +	if (cpm_get_virtual_address(devp, &muram_addr, 1) < 0)
> +		return -1;

s/devp/muram/

> +	
> +	if (getprop(muram, "reg", reg, sizeof reg) < sizeof reg)
> +		return -1;

Should read into array of u32, not void *.

> +	if (is_cpm2 && is_smc) {
> +		u16 *smc_base = (u16*)param;

(u16 *)

> +		u16 pram_offset;
>  
> -	muram_start = reg_virt[0];
> +		pram_offset = cbd_offset - 64;
> +		pram_offset = _ALIGN_DOWN(pram_offset, 64);
> +		*smc_base = pram_offset;

Use out_be16().

The SMC should be stopped before you do this.

-Scott

^ permalink raw reply

* Re: [PATCH] Add idle power save for ppc 4xx
From: Josh Boyer @ 2008-03-31 19:11 UTC (permalink / raw)
  To: jyoung5; +Cc: kvm-ppc-devel, linuxppc-dev
In-Reply-To: <1206987826.9165.15.camel@thinkpadL>

On Mon, 2008-03-31 at 13:23 -0500, Jerone Young wrote:
> > > diff --git a/arch/powerpc/kernel/idle_4xx.c b/arch/powerpc/kernel/idle_4xx.c
> > > new file mode 100644
> > > --- /dev/null
> > > +++ b/arch/powerpc/kernel/idle_4xx.c
> > 
> > Can this be added to sysdev/ppc4xx_soc.c instead?
> 
> Probably. Though the other platforms have there power_save code in
> idle_<platform>.S files, as they are in assembly.

No, just two of them do.  Cell, pseries, and pasemi all have them under
the platform directory.

> Also I don't appear to have ppc4xx_soc.c in my source (using
> 2.6.25-rc6).

You're working against a very old tree, relatively speaking.  Use either
my for-2.6.26 branch in my git tree, or the linux-next tree.

josh

^ permalink raw reply

* Re: [PATCH] Add idle power save for ppc 4xx
From: Hollis Blanchard @ 2008-03-31 19:24 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20080331130518.2a6b0264@zod.rchland.ibm.com>

On Mon, 31 Mar 2008 13:05:18 -0500, Josh Boyer wrote:

> On Mon, 31 Mar 2008 12:07:17 -0500
> Josh Boyer <jwboyer@gmail.com> wrote:
> 
>> On Mon, 2008-03-31 at 08:12 -0500, Jerone Young wrote:
>> > # HG changeset patch
>> > # User Jerone Young <jyoung5@us.ibm.com> # Date 1206969060 18000
>> > # Node ID 10aea37177130bbe5de7bee6ec06d9010bc5da1f # Parent 
>> > 1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc Add idle power save for ppc
>> > 4xx
>> > 
>> > This patch sets the wait state MSR when power_save is called in
>> > cpu_idle loop for ppc4xx. This is mainly to help out virtualization
>> > solutions such as KVM. This way the virtualization soultions are able
>> > to tell if the guest kernel is idle.
>> > 
>> > I have tested this on hardware & KVM virtual guest.
>> 
>> I'm not overly thrilled with adding this to all of 4xx.  It doesn't
>> actually save much power at all (1% on a project that actually measured
>> it with an amp meter recently) and there's really no other benefit to
>> doing it outside of the virtual guest case.

So it slightly helps hardware, and it helps virtualization a *lot*. 
What's the problem?

>> I'm assuming you pass a dtb to the virtual guest when you start it up.
>> Could you define a property in the CPU node there that can be parsed to
>> use the power_save function instead of always making it the default?
> 
> Actually, you probably don't want this as a property in the device tree.
>  It doesn't describe hardware.  A Kconfig option might be warranted
> though.

There will be a device tree binding for hypervisor properties, so if it's 
not always enabled, having a hypervisor node (for any hypervisor) in the 
device tree would be an indicator. Far better than a Kconfig option, at 
any rate.

-- 
Hollis Blanchard
IBM Linux Technology Center

^ permalink raw reply

* Re: [PATCH] Add idle power save for ppc 4xx
From: Josh Boyer @ 2008-03-31 20:28 UTC (permalink / raw)
  To: Hollis Blanchard; +Cc: linuxppc-dev
In-Reply-To: <fsrdp7$958$1@ger.gmane.org>

On Mon, 2008-03-31 at 19:24 +0000, Hollis Blanchard wrote:
> On Mon, 31 Mar 2008 13:05:18 -0500, Josh Boyer wrote:
> 
> > On Mon, 31 Mar 2008 12:07:17 -0500
> > Josh Boyer <jwboyer@gmail.com> wrote:
> > 
> >> On Mon, 2008-03-31 at 08:12 -0500, Jerone Young wrote:
> >> > # HG changeset patch
> >> > # User Jerone Young <jyoung5@us.ibm.com> # Date 1206969060 18000
> >> > # Node ID 10aea37177130bbe5de7bee6ec06d9010bc5da1f # Parent 
> >> > 1506aa38ddabb0bf73fff3ac3f3db5f9ef6458cc Add idle power save for ppc
> >> > 4xx
> >> > 
> >> > This patch sets the wait state MSR when power_save is called in
> >> > cpu_idle loop for ppc4xx. This is mainly to help out virtualization
> >> > solutions such as KVM. This way the virtualization soultions are able
> >> > to tell if the guest kernel is idle.
> >> > 
> >> > I have tested this on hardware & KVM virtual guest.
> >> 
> >> I'm not overly thrilled with adding this to all of 4xx.  It doesn't
> >> actually save much power at all (1% on a project that actually measured
> >> it with an amp meter recently) and there's really no other benefit to
> >> doing it outside of the virtual guest case.
> 
> So it slightly helps hardware, and it helps virtualization a *lot*. 
> What's the problem?

There's 0 publicly available documentation on exactly what "Wait State
Enable" means other than the description for the MSR register bit in the
4xx UM.  I'm a very paranoid person.

Explain to me what it really provides with some kind of concrete numbers
on real hardware and I'll think about it as the default.  Until then, I
think a Kconfig option (or DT property) is acceptable for now.  I didn't
say "no", I just said "make it optional."

> >> I'm assuming you pass a dtb to the virtual guest when you start it up.
> >> Could you define a property in the CPU node there that can be parsed to
> >> use the power_save function instead of always making it the default?
> > 
> > Actually, you probably don't want this as a property in the device tree.
> >  It doesn't describe hardware.  A Kconfig option might be warranted
> > though.
> 
> There will be a device tree binding for hypervisor properties, so if it's 
> not always enabled, having a hypervisor node (for any hypervisor) in the 
> device tree would be an indicator. Far better than a Kconfig option, at 
> any rate.

But you want this in the guests, right?  Not the hypervisor...

josh

^ permalink raw reply


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