LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] powerpc: fix os-term usage on kernel panic
From: Will Schmidt @ 2007-11-29 17:19 UTC (permalink / raw)
  To: Linas Vepstas, Olaf Hering; +Cc: linuxppc-dev, paulus
In-Reply-To: <20071128201838.GH19584@austin.ibm.com>


On Wed, 2007-11-28 at 14:18 -0600, Linas Vepstas wrote:
> On Tue, Nov 27, 2007 at 06:15:59PM -0600, Will Schmidt wrote:
> > (resending with the proper "from" addr this time). 
> > 
> > 
> > I'm seeing some funky behavior on power5/power6 partitions with this
> > patch.    A "/sbin/reboot" is now behaving much more like a
> > "/sbin/halt".
> > 
> > Anybody else seeing this, or is it time for me to call an exorcist for
> > my boxes? 
> 
> I beleive the patch
> http://www.nabble.com/-PATCH--powerpc-pseries:-tell-phyp-to-auto-restart-t4847604.html
> 
> will cure this problem.

It does not.   this code is getting called, but still turns the box into
a doorstop at /sbin/reboot. 

It does clear up if I apply this patch, which is a revert of part of
your earlier patch.

My js2X also turns into a doorstop after /sbin/reboot..     Though I'm
not going through a panic path, I wonder if the panic portion is OK and
this is what Olaf is hitting.  

diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index fdeefe5..c9fac5a 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -508,7 +508,7 @@ define_machine(pseries) {
 	.power_off		= pSeries_power_off,
 	.halt			= rtas_halt,
 	.panic			= rtas_panic_msg,
-	.machine_shutdown	= rtas_os_term,
+/*	.machine_shutdown	= rtas_os_term,*/
 	.get_boot_time		= rtas_get_boot_time,
 	.get_rtc_time		= rtas_get_rtc_time,
 	.set_rtc_time		= rtas_set_rtc_time,

^ permalink raw reply related

* Re: Timers on mpc8248 etc...
From: Alan Bennett @ 2007-11-29 19:05 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-dev
In-Reply-To: <bfa0697f0711290550v57b28002s9f241094cdedeea6@mail.gmail.com>

Though I'd like to move to a uboot fdt, I can't afford to port it yet,
maybe in January.  But until then ...

It appears that a simple change in U-boot constant,
   #define CONFIG_8260_CLKIN	66000000	/* in Hz */
   to
   #define CONFIG_8260_CLKIN	100000000	/* in Hz */

has fixed the speed mismatch, and I've verified that
schedule_timeout(HZ/10) produces a 100 millisecond delay.  However, my
serial ports (brgs) are hosed.

-Alan


On 11/29/07, Alan Bennett <embedded@akb.net> wrote:
> My uboot is new-ish, but I don't have the fdt commands?  U-Boot 1.3.0
> g992742a5-dirty
>
> u-boot:clock configuration
> ===========================
> MPC8248 Clock Configuration
>  - Bus-to-Core Mult 3.5x, VCO Div 2, 60x Bus Freq  30-85 , Core Freq 100-300
>  - dfbrg 1, corecnf 0x1e, busdf 3, cpmdf 1, plldf 0, pllmf 5, pcidf 5
>  - vco_out  396000000, scc_clk   99000000, brg_clk   24750000
>  - cpu_clk  231000000, cpm_clk  198000000, bus_clk   66000000
>
> Boot Wrapper Reporting
> ===========================
> Memory <- <0x0 0x8000000> (128MB)
> CPU clock-frequency <- 0xdc4c7c0 (231MHz)
> CPU timebase-frequency <- 0xfbc520 (17MHz)
> CPU bus-frequency <- 0x3ef1480 (66MHz)
>
> Kernel reporting
> ===========================
> clocksource: timebase mult[f26c9b2] shift[22] registered
>
> device tree in kernel (hex= `od -x`:
> ===========================
> /proc/device-tree/cpus/PowerPC,8248@0/name
>     PowerPC,8248
> /proc/device-tree/cpus/PowerPC,8248@0/bus-frequency
>     0000000 03ef 1480
> /proc/device-tree/cpus/PowerPC,8248@0/clock-frequency
>     0000000 0dc4 c7c0
> /proc/device-tree/cpus/PowerPC,8248@0/timebase-frequency
>     0000000 00fb c520
> /proc/device-tree/cpus/PowerPC,8248@0/i-cache-size
>     0000000 0000 4000
>
>
>
> On 11/29/07, Vitaly Bordug <vitb@kernel.crashing.org> wrote:
> > On Wed, 28 Nov 2007 21:06:36 -0700
> > Alan Bennett wrote:
> >
> > > It comes from uboot.  Can you point me in the right direction to make
> > > sure its right?
> > >                PowerPC,8248@0 {
> > >                        device_type = "cpu";
> > >                        reg = <0>;
> > >                        d-cache-line-size = <d#32>;
> > >                        i-cache-line-size = <d#32>;
> > >                        d-cache-size = <d#16384>;
> > >                        i-cache-size = <d#16384>;
> > >                        timebase-frequency = <0>;
> > >                        clock-frequency = <0>;
> > >                };
> > >
> > if your u-boot is up to  date, it will have fdt command, and by
> > fdt boardsetup
> > fdt print /
> >
> > inspect what u-boot did. Of course you should have dtb preloaded to memory and
> > fdt addr <offset> should be said to let u-boot know where dtb resides.
> >
> >
> > >
> > > On 11/28/07, Scott Wood <scottwood@freescale.com> wrote:
> > > > Alan Bennett wrote:
> > > > > I've got a routine that needs to delay for X microseconds, this
> > > > > is a must.  The command after schedule_timeout must has to wait
> > > > > for the HW to complete a task that takes X microseconds.
> > > > >
> > > > > I would think that one way to do this is with a simple
> > > > > schedule_timeout.  But in the example below, the time that passes
> > > > > from run1() to dontrun() is far less than 3.2 msecs.  Infact,
> > > > > sometimes its ~ 800 micros according the a analyzer looking at
> > > > > points triggered in run1() and donrun().  Could this be a
> > > > > configuration problem with the timer/interrupt that generates the
> > > > > jiffies?
> > > >
> > > > Are you sure the timebase frequency is set correctly in the device
> > > > tree?
> > > >
> > > > -Scott
> > > >
> > > _______________________________________________
> > > Linuxppc-dev mailing list
> > > Linuxppc-dev@ozlabs.org
> > > https://ozlabs.org/mailman/listinfo/linuxppc-dev
> >
> >
> > --
> > Sincerely, Vitaly
> >
>

^ permalink raw reply

* RE: The question about the high memory support on MPC8360?
From: Rune Torgersen @ 2007-11-29 19:41 UTC (permalink / raw)
  To: robert lazarski; +Cc: linuxppc-embedded
In-Reply-To: <f87675ee0711290459r20aa606ak7b3be9d3b0a8ec1c@mail.gmail.com>

> From: robert lazarski
> Sent: Thursday, November 29, 2007 7:00 AM
> Subject: Re: The question about the high memory support on MPC8360?
> I also have a requirement to use more than 768MB and 0x30000000. I
> have other problems at the moment, so I haven't tested this completely
> yet. My limited understanding, though, is that to use more than 768MB
> you have to change your kernel configuration, including shifting the
> kernel start address. This is what I plan on testing for 1GB when I
> have time:
>=20
> CONFIG_ADVANCED_OPTIONS=3Dy
> CONFIG_LOWMEM_SIZE_BOOL=3Dy
> CONFIG_LOWMEM_SIZE=3D0x40000000
> CONFIG_KERNEL_START_BOOL=3Dy
> CONFIG_KERNEL_START=3D0xa0000000
> # CONFIG_CONSISTENT_START_BOOL is not set
> # CONFIG_CONSISTENT_SIZE_BOOL is not set
> # CONFIG_BOOT_LOAD_BOOL is not set
>=20
> If that works for current kernels, please respond to the list ;-) .

This is how I do 1G of mem on a /arch/ppc kernel. A short while (couple
of weeks ago) I commented about thei s on a thread about setting up the
TLB handlers on arch/powerpc, and asked if this was going to be possible
to do, and basically got a resouding NO as answer.

WHich means I'll be sticking to arch/ppc for a while yet.
It would be nice to have this also working on arch/powerpc though.

^ permalink raw reply

* [PATCH 0/5] PPC cleanup: do use for_each macro
From: Cyrill Gorcunov @ 2007-11-29 19:44 UTC (permalink / raw)
  To: PPCML; +Cc: Paul Mackerras, LKML

This is a cleanup patch set. It does convert for(...)/while(...) cycles
into appropriate for_each_...() macros calls.

The patch set is splitted up in idea to hold changes localy
to a specified platform.

Any comments are welcome.

		Cyrill

^ permalink raw reply

* [PATCH 1/5] PPC cleanup: sysdev - do use for_each macro
From: Cyrill Gorcunov @ 2007-11-29 19:44 UTC (permalink / raw)
  To: PPCML; +Cc: Paul Mackerras, LKML

From: Cyrill Gorcunov <gorcunov@gmail.com>

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

 arch/powerpc/sysdev/fsl_soc.c      |    7 +++----
 arch/powerpc/sysdev/mv64x60_dev.c  |   24 ++++++++++--------------
 arch/powerpc/sysdev/mv64x60_pci.c  |    4 ++--
 arch/powerpc/sysdev/mv64x60_udbg.c |    4 ++--
 arch/powerpc/sysdev/tsi108_dev.c   |    9 ++++-----
 arch/powerpc/sysdev/uic.c          |   17 +++++------------
 6 files changed, 26 insertions(+), 39 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3ace747..927c238 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1125,13 +1125,12 @@ arch_initcall(fs_enet_of_init);
 
 static int __init fsl_pcmcia_of_init(void)
 {
-	struct device_node *np = NULL;
+	struct device_node *np;
 	/*
 	 * Register all the devices which type is "pcmcia"
 	 */
-	while ((np = of_find_compatible_node(np,
-			"pcmcia", "fsl,pq-pcmcia")) != NULL)
-			    of_platform_device_create(np, "m8xx-pcmcia", NULL);
+	for_each_compatible_node(np, "pcmcia", "fsl,pq-pcmcia")
+		of_platform_device_create(np, "m8xx-pcmcia", NULL);
 	return 0;
 }
 
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index 548a320..304056c 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -241,7 +241,7 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id)
 
 	/* only register the shared platform device the first time through */
 	if (id == 0 && (err = eth_register_shared_pdev(np)))
-		return err;;
+		return err;
 
 	memset(r, 0, sizeof(r));
 	of_irq_to_resource(np, 0, &r[0]);
@@ -451,22 +451,19 @@ static int __init mv64x60_device_setup(void)
 	int id;
 	int err;
 
-	for (id = 0;
-	     (np = of_find_compatible_node(np, "serial", "marvell,mpsc")); id++)
-		if ((err = mv64x60_mpsc_device_setup(np, id)))
+	id = 0;
+	for_each_compatible_node(np, "serial", "marvell,mpsc")
+		if ((err = mv64x60_mpsc_device_setup(np, id++)))
 			goto error;
 
-	for (id = 0;
-	     (np = of_find_compatible_node(np, "network",
-					   "marvell,mv64x60-eth"));
-	     id++)
-		if ((err = mv64x60_eth_device_setup(np, id)))
+	id = 0;
+	for_each_compatible_node(np, "network", "marvell,mv64x60-eth")
+		if ((err = mv64x60_eth_device_setup(np, id++)))
 			goto error;
 
-	for (id = 0;
-	     (np = of_find_compatible_node(np, "i2c", "marvell,mv64x60-i2c"));
-	     id++)
-		if ((err = mv64x60_i2c_device_setup(np, id)))
+	id = 0;
+	for_each_compatible_node(np, "i2c", "marvell,mv64x60-i2c")
+		if ((err = mv64x60_i2c_device_setup(np, id++)))
 			goto error;
 
 	/* support up to one watchdog timer */
@@ -477,7 +474,6 @@ static int __init mv64x60_device_setup(void)
 		of_node_put(np);
 	}
 
-
 	return 0;
 
 error:
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c
index 6933f9c..d21ab8f 100644
--- a/arch/powerpc/sysdev/mv64x60_pci.c
+++ b/arch/powerpc/sysdev/mv64x60_pci.c
@@ -164,8 +164,8 @@ static int __init mv64x60_add_bridge(struct device_node *dev)
 
 void __init mv64x60_pci_init(void)
 {
-	struct device_node *np = NULL;
+	struct device_node *np;
 
-	while ((np = of_find_compatible_node(np, "pci", "marvell,mv64x60-pci")))
+	for_each_compatible_node(np, "pci", "marvell,mv64x60-pci")
 		mv64x60_add_bridge(np);
 }
diff --git a/arch/powerpc/sysdev/mv64x60_udbg.c b/arch/powerpc/sysdev/mv64x60_udbg.c
index 367e7b1..35c77c7 100644
--- a/arch/powerpc/sysdev/mv64x60_udbg.c
+++ b/arch/powerpc/sysdev/mv64x60_udbg.c
@@ -85,10 +85,10 @@ static void mv64x60_udbg_init(void)
 	if (!stdout)
 		return;
 
-	for (np = NULL;
-	     (np = of_find_compatible_node(np, "serial", "marvell,mpsc")); )
+	for_each_compatible_node(np, "serial", "marvell,mpsc") {
 		if (np == stdout)
 			break;
+	}
 
 	of_node_put(stdout);
 	if (!np)
diff --git a/arch/powerpc/sysdev/tsi108_dev.c b/arch/powerpc/sysdev/tsi108_dev.c
index a113d80..be2808a 100644
--- a/arch/powerpc/sysdev/tsi108_dev.c
+++ b/arch/powerpc/sysdev/tsi108_dev.c
@@ -66,14 +66,12 @@ EXPORT_SYMBOL(get_vir_csrbase);
 static int __init tsi108_eth_of_init(void)
 {
 	struct device_node *np;
-	unsigned int i;
+	unsigned int i = 0;
 	struct platform_device *tsi_eth_dev;
 	struct resource res;
 	int ret;
 
-	for (np = NULL, i = 0;
-	     (np = of_find_compatible_node(np, "network", "tsi108-ethernet")) != NULL;
-	     i++) {
+	for_each_compatible_node(np, "network", "tsi108-ethernet") {
 		struct resource r[2];
 		struct device_node *phy, *mdio;
 		hw_info tsi_eth_data;
@@ -98,7 +96,7 @@ static int __init tsi108_eth_of_init(void)
 			__FUNCTION__,r[1].name, r[1].start, r[1].end);
 
 		tsi_eth_dev =
-		    platform_device_register_simple("tsi-ethernet", i, &r[0],
+		    platform_device_register_simple("tsi-ethernet", i++, &r[0],
 						    1);
 
 		if (IS_ERR(tsi_eth_dev)) {
@@ -154,6 +152,7 @@ static int __init tsi108_eth_of_init(void)
 unreg:
 	platform_device_unregister(tsi_eth_dev);
 err:
+	of_node_put(np);
 	return ret;
 }
 
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 5149716..815d6db 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -326,28 +326,23 @@ void __init uic_init_tree(void)
 	const u32 *interrupts;
 
 	/* First locate and initialize the top-level UIC */
-
-	np = of_find_compatible_node(NULL, NULL, "ibm,uic");
-	while (np) {
+	for_each_compatible_node(np, NULL, "ibm,uic") {
 		interrupts = of_get_property(np, "interrupts", NULL);
-		if (! interrupts)
+		if (!interrupts)
 			break;
-
-		np = of_find_compatible_node(np, NULL, "ibm,uic");
 	}
 
 	BUG_ON(!np); /* uic_init_tree() assumes there's a UIC as the
 		      * top-level interrupt controller */
 	primary_uic = uic_init_one(np);
-	if (! primary_uic)
+	if (!primary_uic)
 		panic("Unable to initialize primary UIC %s\n", np->full_name);
 
 	irq_set_default_host(primary_uic->irqhost);
 	of_node_put(np);
 
 	/* The scan again for cascaded UICs */
-	np = of_find_compatible_node(NULL, NULL, "ibm,uic");
-	while (np) {
+	for_each_compatible_node(np, NULL, "ibm,uic") {
 		interrupts = of_get_property(np, "interrupts", NULL);
 		if (interrupts) {
 			/* Secondary UIC */
@@ -355,7 +350,7 @@ void __init uic_init_tree(void)
 			int ret;
 
 			uic = uic_init_one(np);
-			if (! uic)
+			if (!uic)
 				panic("Unable to initialize a secondary UIC %s\n",
 				      np->full_name);
 
@@ -373,8 +368,6 @@ void __init uic_init_tree(void)
 
 			/* FIXME: setup critical cascade?? */
 		}
-
-		np = of_find_compatible_node(np, NULL, "ibm,uic");
 	}
 }
 
-- 
1.5.3.5

^ permalink raw reply related

* [PATCH 2/5] PPC cleanup: do use for_each macro
From: Cyrill Gorcunov @ 2007-11-29 19:45 UTC (permalink / raw)
  To: PPCML; +Cc: Paul Mackerras, LKML

From: Cyrill Gorcunov <gorcunov@gmail.com>

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

 arch/powerpc/kernel/btext.c         |    2 +-
 arch/powerpc/kernel/legacy_serial.c |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index 3ef51fb..04c9249 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -234,7 +234,7 @@ int __init btext_find_display(int allow_nonstdout)
 	if (rc == 0 || !allow_nonstdout)
 		return rc;
 
-	for (np = NULL; (np = of_find_node_by_type(np, "display"));) {
+	for_each_node_by_type(np, "display") {
 		if (of_get_property(np, "linux,opened", NULL)) {
 			printk("trying %s ...\n", np->full_name);
 			rc = btext_initialize(np);
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 4ed5887..b5dc646 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -307,7 +307,7 @@ void __init find_legacy_serial_ports(void)
 	}
 
 	/* First fill our array with SOC ports */
-	for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) {
+	for_each_compatible_node(np, "serial", "ns16550") {
 		struct device_node *soc = of_get_parent(np);
 		if (soc && !strcmp(soc->type, "soc")) {
 			index = add_legacy_soc_port(np, np);
@@ -318,7 +318,7 @@ void __init find_legacy_serial_ports(void)
 	}
 
 	/* First fill our array with ISA ports */
-	for (np = NULL; (np = of_find_node_by_type(np, "serial"));) {
+	for_each_node_by_type(np, "serial") {
 		struct device_node *isa = of_get_parent(np);
 		if (isa && !strcmp(isa->name, "isa")) {
 			index = add_legacy_isa_port(np, isa);
@@ -329,7 +329,7 @@ void __init find_legacy_serial_ports(void)
 	}
 
 	/* First fill our array with tsi-bridge ports */
-	for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) {
+	for_each_compatible_node(np, "serial", "ns16550") {
 		struct device_node *tsi = of_get_parent(np);
 		if (tsi && !strcmp(tsi->type, "tsi-bridge")) {
 			index = add_legacy_soc_port(np, np);
@@ -340,7 +340,7 @@ void __init find_legacy_serial_ports(void)
 	}
 
 	/* First fill our array with opb bus ports */
-	for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) {
+	for_each_compatible_node(np, "serial", "ns16550") {
 		struct device_node *opb = of_get_parent(np);
 		if (opb && (!strcmp(opb->type, "opb") ||
 			    of_device_is_compatible(opb, "ibm,opb"))) {
-- 
1.5.3.5

^ permalink raw reply related

* [PATCH 3/5] PPC cleanup: 82xx - do use for_each macro
From: Cyrill Gorcunov @ 2007-11-29 19:46 UTC (permalink / raw)
  To: PPCML; +Cc: Paul Mackerras, LKML

From: Cyrill Gorcunov <gorcunov@gmail.com>

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

 arch/powerpc/platforms/82xx/pq2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/82xx/pq2.c b/arch/powerpc/platforms/82xx/pq2.c
index a497cba..9e74393 100644
--- a/arch/powerpc/platforms/82xx/pq2.c
+++ b/arch/powerpc/platforms/82xx/pq2.c
@@ -72,11 +72,11 @@ err:
 
 void __init pq2_init_pci(void)
 {
-	struct device_node *np = NULL;
+	struct device_node *np;
 
 	ppc_md.pci_exclude_device = pq2_pci_exclude_device;
 
-	while ((np = of_find_compatible_node(np, NULL, "fsl,pq2-pci")))
+	for_each_compatible_node(np, NULL, "fsl,pq2-pci")
 		pq2_pci_add_bridge(np);
 }
 #endif
-- 
1.5.3.5

^ permalink raw reply related

* [PATCH 4/5] PPC cleanup: celleb - do use for_each macro
From: Cyrill Gorcunov @ 2007-11-29 19:46 UTC (permalink / raw)
  To: PPCML; +Cc: Paul Mackerras, LKML

From: Cyrill Gorcunov <gorcunov@gmail.com>

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

 arch/powerpc/platforms/celleb/scc_sio.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/celleb/scc_sio.c b/arch/powerpc/platforms/celleb/scc_sio.c
index 6100082..5e43bac 100644
--- a/arch/powerpc/platforms/celleb/scc_sio.c
+++ b/arch/powerpc/platforms/celleb/scc_sio.c
@@ -42,14 +42,13 @@ static struct {
 static int __init txx9_serial_init(void)
 {
 	extern int early_serial_txx9_setup(struct uart_port *port);
-	struct device_node *node = NULL;
+	struct device_node *node;
 	int i;
 	struct uart_port req;
 	struct of_irq irq;
 	struct resource res;
 
-	while ((node = of_find_compatible_node(node,
-				"serial", "toshiba,sio-scc")) != NULL) {
+	for_each_compatible_node(node, "serial", "toshiba,sio-scc") {
 		for (i = 0; i < ARRAY_SIZE(txx9_scc_tab); i++) {
 			if (!(txx9_serial_bitmap & (1<<i)))
 				continue;
-- 
1.5.3.5

^ permalink raw reply related

* [PATCH 5/5] PPC cleanup: powermac - do use for_each macro
From: Cyrill Gorcunov @ 2007-11-29 19:46 UTC (permalink / raw)
  To: PPCML; +Cc: Paul Mackerras, LKML

From: Cyrill Gorcunov <gorcunov@gmail.com>

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---

 arch/powerpc/platforms/powermac/low_i2c.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index da2007e..864fbf4 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -585,8 +585,7 @@ static void __init kw_i2c_probe(void)
 	struct device_node *np, *child, *parent;
 
 	/* Probe keywest-i2c busses */
-	for (np = NULL;
-	     (np = of_find_compatible_node(np, "i2c","keywest-i2c")) != NULL;){
+	for_each_compatible_node(np, "i2c","keywest-i2c") {
 		struct pmac_i2c_host_kw *host;
 		int multibus, chans, i;
 
-- 
1.5.3.5

^ permalink raw reply related

* Re: DS1337 RTC on I2C broken.
From: Clemens Koller @ 2007-11-29 20:03 UTC (permalink / raw)
  To: Alessandro Zummo; +Cc: rtc-linux, linuxppc-embedded
In-Reply-To: <20071128194321.0804b3aa@i1501.lan.towertech.it>

Hi There!

> Clemens Koller <clemens.koller@anagramm.de> wrote:
>> Well, as already mentioned, I have problems to get my DS1337 RTC on I2C
>> on my MPC8540(ads like) PowerPC working properly on
>> latest 2.6.24-rc2-ge6a5c27f kernels. A paulus.git 2.6.21-rc5-g9a5ee4cc
>> as well as a 2.6.22-rc6-gb75ae860 is working fine.
>> (mainstream's console is broken, so cannot test these, yet.)
>>
>>
>> My guess is that the new rtc-lib's RTC_DRV_DS1307 support is still broken
>> and it also breaks the deprecated SENSORS_DS1337. :-(

One more update:
I am back to mainline (linus' .git) on 2.6.24-rc3-g09f345da to
verify that the problem with the RTC still persists.

I startet to bisect, but ran quickly into other crashes.
(no console on 2.6.23-rc2 and 2.6.23)
So, I just can tell that it broke in between 2.6.22-rc6-gb75ae860 and
and 2.6.24-rc2-ge6a5c27f.

Regards,

Clemens Koller
__________________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com

^ permalink raw reply

* powerpc: fix guts_set_dmacr() and add guts_set_pmuxcr_dma() to immap_86xx.h
From: Timur Tabi @ 2007-11-29 20:19 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Timur Tabi

Updated guts_set_dmacr() to enumerate the DMA controllers at 0, instead of 1,
so that it now matches other related functions.  Added function
guts_set_pmuxcr_dma() to set the external DMA control bits in the PMUXCR
register of the global utilities structure.

Signed-off-by: Timur Tabi <timur@freescale.com>
---

Changing the behavior of guts_set_dmacr() is okay because no one uses that
function yet.

This patch is for Kumar's for-2.6.25 branch.

 include/asm-powerpc/immap_86xx.h |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/include/asm-powerpc/immap_86xx.h b/include/asm-powerpc/immap_86xx.h
index 0ad4e65..0f165e5 100644
--- a/include/asm-powerpc/immap_86xx.h
+++ b/include/asm-powerpc/immap_86xx.h
@@ -89,14 +89,14 @@ struct ccsr_guts {
  * them.
  *
  * guts: Pointer to GUTS structure
- * co: The DMA controller (1 or 2)
+ * co: The DMA controller (0 or 1)
  * ch: The channel on the DMA controller (0, 1, 2, or 3)
  * device: The device to set as the source (CCSR_GUTS_DMACR_DEV_xx)
  */
 static inline void guts_set_dmacr(struct ccsr_guts __iomem *guts,
 	unsigned int co, unsigned int ch, unsigned int device)
 {
-	unsigned int shift = 16 + (8 * (2 - co) + 2 * (3 - ch));
+	unsigned int shift = 16 + (8 * (1 - co) + 2 * (3 - ch));
 
 	clrsetbits_be32(&guts->dmacr, 3 << shift, device << shift);
 }
@@ -118,6 +118,27 @@ static inline void guts_set_dmacr(struct ccsr_guts __iomem *guts,
 #define CCSR_GUTS_PMUXCR_DMA1_0		0x00000002
 #define CCSR_GUTS_PMUXCR_DMA1_3		0x00000001
 
+/*
+ * Set the DMA external control bits in the GUTS
+ *
+ * The DMA external control bits in the PMUXCR are only meaningful for
+ * channels 0 and 3.  Any other channels are ignored.
+ *
+ * guts: Pointer to GUTS structure
+ * co: The DMA controller (0 or 1)
+ * ch: The channel on the DMA controller (0, 1, 2, or 3)
+ * value: the new value for the bit (0 or 1)
+ */
+static inline void guts_set_pmuxcr_dma(struct ccsr_guts __iomem *guts,
+	unsigned int co, unsigned int ch, unsigned int value)
+{
+	if ((ch == 0) || (ch == 3)) {
+		unsigned int shift = 2 * (co + 1) - (ch & 1) - 1;
+
+		clrsetbits_be32(&guts->pmuxcr, 1 << shift, value << shift);
+	}
+}
+
 #define CCSR_GUTS_CLKDVDR_PXCKEN	0x80000000
 #define CCSR_GUTS_CLKDVDR_SSICKEN	0x20000000
 #define CCSR_GUTS_CLKDVDR_PXCKINV	0x10000000
-- 
1.5.2.4

^ permalink raw reply related

* Re: DS1337 RTC on I2C broken.
From: Alessandro Zummo @ 2007-11-29 20:19 UTC (permalink / raw)
  To: Clemens Koller; +Cc: rtc-linux, linuxppc-embedded
In-Reply-To: <474F1B25.8080508@anagramm.de>

On Thu, 29 Nov 2007 21:03:49 +0100
Clemens Koller <clemens.koller@anagramm.de> wrote:

> >> My guess is that the new rtc-lib's RTC_DRV_DS1307 support is still broken
> >> and it also breaks the deprecated SENSORS_DS1337. :-(
> 
> One more update:
> I am back to mainline (linus' .git) on 2.6.24-rc3-g09f345da to
> verify that the problem with the RTC still persists.
> 
> I startet to bisect, but ran quickly into other crashes.
> (no console on 2.6.23-rc2 and 2.6.23)
> So, I just can tell that it broke in between 2.6.22-rc6-gb75ae860 and
> and 2.6.24-rc2-ge6a5c27f.

 did you tried compiling it modular? you might even check with
 i2cdetect if the chip is there

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it

^ permalink raw reply

* qe: fix device tree lookup code in qe_muram_init()
From: Timur Tabi @ 2007-11-29 20:29 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Timur Tabi

Function qe_muram_init() was only looking for a node called "data-only",
instead of making sure it is the correct node.  This patch modifies
qe_muram_init() to find the QE node first, then the MURAM node inside it,
and then the data-only node.  It also reports errors.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 arch/powerpc/sysdev/qe_lib/qe.c |   39 +++++++++++++++++++++++++++++++--------
 1 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 3d57d38..298e073 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -282,6 +282,12 @@ static DEFINE_SPINLOCK(qe_muram_lock);
 static rh_block_t qe_boot_muram_rh_block[16];
 static rh_info_t qe_muram_info;
 
+/* Initialize the MURAM remote heap
+ *
+ * This function queries the device tree to obtain the offset within MURAM
+ * to initialize the MURAM remote heap, and then it initializes the remote
+ * heap with that value.
+ */
 static void qe_muram_init(void)
 {
 	struct device_node *np;
@@ -294,15 +300,32 @@ static void qe_muram_init(void)
 		sizeof(qe_boot_muram_rh_block) /
 		sizeof(qe_boot_muram_rh_block[0]), qe_boot_muram_rh_block);
 
-	/* Attach the usable muram area */
-	/* XXX: This is a subset of the available muram. It
-	 * varies with the processor and the microcode patches activated.
-	 */
-	if ((np = of_find_node_by_name(NULL, "data-only")) != NULL) {
-		address = *of_get_address(np, 0, &size, &flags);
-		of_node_put(np);
-		rh_attach_region(&qe_muram_info, address, (int) size);
+	/* Find the data-only node in the QE's muram node */
+	np = of_find_node_by_type(NULL, "qe");
+	if (!np) {
+		printk(KERN_ERR
+			"qe-muram: cannot find 'qe' node in device tree\n");
+		return;
+	}
+
+	np = of_find_node_by_type(np, "muram");
+	if (!np) {
+		printk(KERN_ERR
+			"qe-muram: cannot find 'muram' node in device tree\n");
+		return;
 	}
+
+	np = of_find_node_by_name(np, "data-only");
+	if (!np) {
+		printk(KERN_ERR "qe-muram: "
+			"cannot find 'data-only' node in device tree\n");
+		return;
+	}
+
+	/* Attach the usable muram area */
+	address = *of_get_address(np, 0, &size, &flags);
+	of_node_put(np);
+	rh_attach_region(&qe_muram_info, address, (int) size);
 }
 
 /* This function returns an index into the MURAM area.
-- 
1.5.2.4

^ permalink raw reply related

* Re: [PATCH 5/5] PPC cleanup: powermac - do use for_each macro
From: Benjamin Herrenschmidt @ 2007-11-29 20:54 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: PPCML, Paul Mackerras, LKML
In-Reply-To: <20071129194654.GF12123@cvg>


On Thu, 2007-11-29 at 22:46 +0300, Cyrill Gorcunov wrote:
> From: Cyrill Gorcunov <gorcunov@gmail.com>
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---

Ack.

>  arch/powerpc/platforms/powermac/low_i2c.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
> index da2007e..864fbf4 100644
> --- a/arch/powerpc/platforms/powermac/low_i2c.c
> +++ b/arch/powerpc/platforms/powermac/low_i2c.c
> @@ -585,8 +585,7 @@ static void __init kw_i2c_probe(void)
>  	struct device_node *np, *child, *parent;
>  
>  	/* Probe keywest-i2c busses */
> -	for (np = NULL;
> -	     (np = of_find_compatible_node(np, "i2c","keywest-i2c")) != NULL;){
> +	for_each_compatible_node(np, "i2c","keywest-i2c") {
>  		struct pmac_i2c_host_kw *host;
>  		int multibus, chans, i;
>  

^ permalink raw reply

* Re: [BUG] 2.6.24-rc3-mm2 soft lockup while running tbench
From: Andrew Morton @ 2007-11-29 21:09 UTC (permalink / raw)
  To: Kamalesh Babulal; +Cc: linuxppc-dev, balbir, linux-kernel
In-Reply-To: <474D7C32.1070809@linux.vnet.ibm.com>

On Wed, 28 Nov 2007 20:03:22 +0530
Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> wrote:

> Hi Andrew,
> 
> while running tbench on the powerpc with 2.6.24-rc3-mm2 softlock up occurs
> 
> BUG: soft lockup - CPU#0 stuck for 11s! [tbench:12183]
> NIP: c0000000000ac978 LR: c0000000000acff0 CTR: c00000000005c648
> REGS: C00000076F0F3200 TRAP: 0901   Not tainted  (2.6.24-rc3-mm2-autotest)
> MSR: 8000000000009032 <EE,ME,IR,DR>  CR: 44000482  XER: 00000000
> TASK = C00000076F4BC000[12183] 'tbench' THREAD: C00000076F0F0000 CPU: 0
> NIP [c0000000000ac978] .get_page_from_freelist+0x1cc/0x754
> LR [c0000000000acff0] .__alloc_pages+0xb0/0x3a8
> Call Trace:
> [c00000076f0f3480] [c00000076f0f3560] 0xc00000076f0f3560 (unreliable)
> [c00000076f0f3590] [c0000000000acff0] .__alloc_pages+0xb0/0x3a8
> [c00000076f0f3680] [c0000000000ce2e4] .alloc_pages_current+0xa8/0xc8
> [c00000076f0f3710] [c0000000000ac6ec] .__get_free_pages+0x20/0x70
> [c00000076f0f3790] [c0000000000d75c8] .__kmalloc_node_track_caller+0x60/0x148
> [c00000076f0f3840] [c0000000002c22b0] .__alloc_skb+0x98/0x184
> [c00000076f0f38f0] [c000000000306cd8] .tcp_sendmsg+0x1fc/0xe24
> [c00000076f0f3a10] [c0000000002b963c] .sock_sendmsg+0xe4/0x128
> [c00000076f0f3c10] [c0000000002ba4ec] .sys_sendto+0xd4/0x120
> [c00000076f0f3d90] [c0000000002df2f8] .compat_sys_socketcall+0x148/0x214
> [c00000076f0f3e30] [c00000000000872c] syscall_exit+0x0/0x40
> Instruction dump:
> 720b0001 eb970000 40820070 72000002 4182000c e8bc0000 48000018 72080004 
> 4182000c e8bc0008 48000008 e8bc0010 <e8c10078> 7f83e378 7de407b4 7e078378 
> 

hm.  Beats me.  Does the machine recover OK?

^ permalink raw reply

* Re: [PATCH 1/5] PPC cleanup: sysdev - do use for_each macro
From: Dale Farnsworth @ 2007-11-29 21:30 UTC (permalink / raw)
  To: gorcunov, linuxppc-dev
In-Reply-To: <20071129194436.GB12123@cvg>

> From: Cyrill Gorcunov <gorcunov@gmail.com>
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
> 
>  arch/powerpc/sysdev/fsl_soc.c      |    7 +++----
>  arch/powerpc/sysdev/mv64x60_dev.c  |   24 ++++++++++--------------
>  arch/powerpc/sysdev/mv64x60_pci.c  |    4 ++--
>  arch/powerpc/sysdev/mv64x60_udbg.c |    4 ++--
>  arch/powerpc/sysdev/tsi108_dev.c   |    9 ++++-----
>  arch/powerpc/sysdev/uic.c          |   17 +++++------------
>  6 files changed, 26 insertions(+), 39 deletions(-)

Ack of the mv64x60 bits.

-Dale

^ permalink raw reply

* qe: change qe_setbrg() to take an enum qe_clock instead of an integer
From: Timur Tabi @ 2007-11-29 21:56 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Timur Tabi

qe_setbrg() currently takes an integer to indicate the BRG number.  Change that
to take an enum qe_clock instead, since this enum is intended to represent
clock sources.

Signed-off-by: Timur Tabi <timur@freescale.com>
---

This patch applies to Kumar's for-2.6.25 branch.  You might need to apply my
other patch, "qe: fix device tree lookup code in qe_muram_init()", first.

It's safe to change the parameters to qe_setbrg() because no one is using that
function yet.

 arch/powerpc/sysdev/qe_lib/qe.c |   12 +++--
 include/asm-powerpc/qe.h        |   94 +++++++++++++++++++-------------------
 2 files changed, 54 insertions(+), 52 deletions(-)

diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 298e073..8ef4690 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -167,19 +167,20 @@ unsigned int get_brg_clk(void)
 
 /* Program the BRG to the given sampling rate and multiplier
  *
- * @brg: the BRG, 1-16
+ * @brg: the BRG, QE_BRG1 - QE_BRG16
  * @rate: the desired sampling rate
  * @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or
  * GUMR_L[TDCR].  E.g., if this BRG is the RX clock, and GUMR_L[RDCR]=01,
  * then 'multiplier' should be 8.
- *
- * Also note that the value programmed into the BRGC register must be even.
  */
-void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier)
+void qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier)
 {
 	u32 divisor, tempval;
 	u32 div16 = 0;
 
+	if ((brg < QE_BRG1) || (brg > QE_BRG16))
+		return;
+
 	divisor = get_brg_clk() / (rate * multiplier);
 
 	if (divisor > QE_BRGC_DIVISOR_MAX + 1) {
@@ -196,8 +197,9 @@ void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier)
 	tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) |
 		QE_BRGC_ENABLE | div16;
 
-	out_be32(&qe_immr->brg.brgc[brg - 1], tempval);
+	out_be32(&qe_immr->brg.brgc[brg - QE_BRG1], tempval);
 }
+EXPORT_SYMBOL(qe_setbrg);
 
 /* Initialize SNUMs (thread serial numbers) according to
  * QE Module Control chapter, SNUM table
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h
index 0dabe46..c779033 100644
--- a/include/asm-powerpc/qe.h
+++ b/include/asm-powerpc/qe.h
@@ -28,6 +28,52 @@
 #define MEM_PART_SECONDARY	1
 #define MEM_PART_MURAM		2
 
+/* Clocks and BRGs */
+enum qe_clock {
+	QE_CLK_NONE = 0,
+	QE_BRG1,		/* Baud Rate Generator 1 */
+	QE_BRG2,		/* Baud Rate Generator 2 */
+	QE_BRG3,		/* Baud Rate Generator 3 */
+	QE_BRG4,		/* Baud Rate Generator 4 */
+	QE_BRG5,		/* Baud Rate Generator 5 */
+	QE_BRG6,		/* Baud Rate Generator 6 */
+	QE_BRG7,		/* Baud Rate Generator 7 */
+	QE_BRG8,		/* Baud Rate Generator 8 */
+	QE_BRG9,		/* Baud Rate Generator 9 */
+	QE_BRG10,		/* Baud Rate Generator 10 */
+	QE_BRG11,		/* Baud Rate Generator 11 */
+	QE_BRG12,		/* Baud Rate Generator 12 */
+	QE_BRG13,		/* Baud Rate Generator 13 */
+	QE_BRG14,		/* Baud Rate Generator 14 */
+	QE_BRG15,		/* Baud Rate Generator 15 */
+	QE_BRG16,		/* Baud Rate Generator 16 */
+	QE_CLK1,		/* Clock 1 */
+	QE_CLK2,		/* Clock 2 */
+	QE_CLK3,		/* Clock 3 */
+	QE_CLK4,		/* Clock 4 */
+	QE_CLK5,		/* Clock 5 */
+	QE_CLK6,		/* Clock 6 */
+	QE_CLK7,		/* Clock 7 */
+	QE_CLK8,		/* Clock 8 */
+	QE_CLK9,		/* Clock 9 */
+	QE_CLK10,		/* Clock 10 */
+	QE_CLK11,		/* Clock 11 */
+	QE_CLK12,		/* Clock 12 */
+	QE_CLK13,		/* Clock 13 */
+	QE_CLK14,		/* Clock 14 */
+	QE_CLK15,		/* Clock 15 */
+	QE_CLK16,		/* Clock 16 */
+	QE_CLK17,		/* Clock 17 */
+	QE_CLK18,		/* Clock 18 */
+	QE_CLK19,		/* Clock 19 */
+	QE_CLK20,		/* Clock 20 */
+	QE_CLK21,		/* Clock 21 */
+	QE_CLK22,		/* Clock 22 */
+	QE_CLK23,		/* Clock 23 */
+	QE_CLK24,		/* Clock 24 */
+	QE_CLK_DUMMY
+};
+
 /* Export QE common operations */
 extern void qe_reset(void);
 extern int par_io_init(struct device_node *np);
@@ -38,7 +84,7 @@ extern int par_io_data_set(u8 port, u8 pin, u8 val);
 
 /* QE internal API */
 int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
-void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier);
+void qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier);
 int qe_get_snum(void);
 void qe_put_snum(u8 snum);
 unsigned long qe_muram_alloc(int size, int align);
@@ -129,52 +175,6 @@ enum comm_dir {
 	COMM_DIR_RX_AND_TX = 3
 };
 
-/* Clocks and BRGs */
-enum qe_clock {
-	QE_CLK_NONE = 0,
-	QE_BRG1,		/* Baud Rate Generator 1 */
-	QE_BRG2,		/* Baud Rate Generator 2 */
-	QE_BRG3,		/* Baud Rate Generator 3 */
-	QE_BRG4,		/* Baud Rate Generator 4 */
-	QE_BRG5,		/* Baud Rate Generator 5 */
-	QE_BRG6,		/* Baud Rate Generator 6 */
-	QE_BRG7,		/* Baud Rate Generator 7 */
-	QE_BRG8,		/* Baud Rate Generator 8 */
-	QE_BRG9,		/* Baud Rate Generator 9 */
-	QE_BRG10,		/* Baud Rate Generator 10 */
-	QE_BRG11,		/* Baud Rate Generator 11 */
-	QE_BRG12,		/* Baud Rate Generator 12 */
-	QE_BRG13,		/* Baud Rate Generator 13 */
-	QE_BRG14,		/* Baud Rate Generator 14 */
-	QE_BRG15,		/* Baud Rate Generator 15 */
-	QE_BRG16,		/* Baud Rate Generator 16 */
-	QE_CLK1,		/* Clock 1 */
-	QE_CLK2,		/* Clock 2 */
-	QE_CLK3,		/* Clock 3 */
-	QE_CLK4,		/* Clock 4 */
-	QE_CLK5,		/* Clock 5 */
-	QE_CLK6,		/* Clock 6 */
-	QE_CLK7,		/* Clock 7 */
-	QE_CLK8,		/* Clock 8 */
-	QE_CLK9,		/* Clock 9 */
-	QE_CLK10,		/* Clock 10 */
-	QE_CLK11,		/* Clock 11 */
-	QE_CLK12,		/* Clock 12 */
-	QE_CLK13,		/* Clock 13 */
-	QE_CLK14,		/* Clock 14 */
-	QE_CLK15,		/* Clock 15 */
-	QE_CLK16,		/* Clock 16 */
-	QE_CLK17,		/* Clock 17 */
-	QE_CLK18,		/* Clock 18 */
-	QE_CLK19,		/* Clock 19 */
-	QE_CLK20,		/* Clock 20 */
-	QE_CLK21,		/* Clock 21 */
-	QE_CLK22,		/* Clock 22 */
-	QE_CLK23,		/* Clock 23 */
-	QE_CLK24,		/* Clock 24 */
-	QE_CLK_DUMMY,
-};
-
 /* QE CMXUCR Registers.
  * There are two UCCs represented in each of the four CMXUCR registers.
  * These values are for the UCC in the LSBs
-- 
1.5.2.4

^ permalink raw reply related

* Re: qe: change qe_setbrg() to take an enum qe_clock instead of an integer
From: Kumar Gala @ 2007-11-29 22:45 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev
In-Reply-To: <1196373406380-git-send-email-timur@freescale.com>


On Nov 29, 2007, at 3:56 PM, Timur Tabi wrote:

> qe_setbrg() currently takes an integer to indicate the BRG number.   
> Change that
> to take an enum qe_clock instead, since this enum is intended to  
> represent
> clock sources.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> This patch applies to Kumar's for-2.6.25 branch.  You might need to  
> apply my
> other patch, "qe: fix device tree lookup code in qe_muram_init()",  
> first.
>
> It's safe to change the parameters to qe_setbrg() because no one is  
> using that
> function yet.
>
> arch/powerpc/sysdev/qe_lib/qe.c |   12 +++--
> include/asm-powerpc/qe.h        |   94 ++++++++++++++++++ 
> +-------------------
> 2 files changed, 54 insertions(+), 52 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/ 
> qe_lib/qe.c
> index 298e073..8ef4690 100644
> --- a/arch/powerpc/sysdev/qe_lib/qe.c
> +++ b/arch/powerpc/sysdev/qe_lib/qe.c
> @@ -167,19 +167,20 @@ unsigned int get_brg_clk(void)
>
> /* Program the BRG to the given sampling rate and multiplier
>  *
> - * @brg: the BRG, 1-16
> + * @brg: the BRG, QE_BRG1 - QE_BRG16
>  * @rate: the desired sampling rate
>  * @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or
>  * GUMR_L[TDCR].  E.g., if this BRG is the RX clock, and  
> GUMR_L[RDCR]=01,
>  * then 'multiplier' should be 8.
> - *
> - * Also note that the value programmed into the BRGC register must  
> be even.
>  */
> -void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int  
> multiplier)
> +void qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int  
> multiplier)
> {
> 	u32 divisor, tempval;
> 	u32 div16 = 0;
>
> +	if ((brg < QE_BRG1) || (brg > QE_BRG16))
> +		return;

seems like we should report some form of error like -EINVAL instead.

>
> +
> 	divisor = get_brg_clk() / (rate * multiplier);
>
> 	if (divisor > QE_BRGC_DIVISOR_MAX + 1) {
> @@ -196,8 +197,9 @@ void qe_setbrg(unsigned int brg, unsigned int  
> rate, unsigned int multiplier)
> 	tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) |
> 		QE_BRGC_ENABLE | div16;
>
> -	out_be32(&qe_immr->brg.brgc[brg - 1], tempval);
> +	out_be32(&qe_immr->brg.brgc[brg - QE_BRG1], tempval);
> }
> +EXPORT_SYMBOL(qe_setbrg);
>
> /* Initialize SNUMs (thread serial numbers) according to
>  * QE Module Control chapter, SNUM table

- k

^ permalink raw reply

* Re: qe: fix device tree lookup code in qe_muram_init()
From: Kumar Gala @ 2007-11-29 22:54 UTC (permalink / raw)
  To: Timur Tabi; +Cc: linuxppc-dev
In-Reply-To: <11963681602431-git-send-email-timur@freescale.com>


On Nov 29, 2007, at 2:29 PM, Timur Tabi wrote:

> Function qe_muram_init() was only looking for a node called "data- 
> only",
> instead of making sure it is the correct node.  This patch modifies
> qe_muram_init() to find the QE node first, then the MURAM node  
> inside it,
> and then the data-only node.  It also reports errors.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> arch/powerpc/sysdev/qe_lib/qe.c |   39 ++++++++++++++++++++++++++++++ 
> +--------
> 1 files changed, 31 insertions(+), 8 deletions(-)

Add a compatible property in the muram data-only node called "fsl,qe- 
muram-data" and match on that compatible to find the node instead of  
walking the tree like you are. And report an error if there isn't a  
'fsl,qe-muram-data' node

- k

^ permalink raw reply

* [PATCH v2] qe: change qe_setbrg() to take an enum qe_clock instead of an integer
From: Timur Tabi @ 2007-11-29 23:26 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Timur Tabi

qe_setbrg() currently takes an integer to indicate the BRG number.  Change that
to take an enum qe_clock instead, since this enum is intended to represent
clock sources.

Signed-off-by: Timur Tabi <timur@freescale.com>
---

This patch applies to Kumar's for-2.6.25 branch.  You might need to apply my
other patch, "qe: fix device tree lookup code in qe_muram_init()", first.

It's safe to change the parameters to qe_setbrg() because no one is using that
function yet.

 arch/powerpc/sysdev/qe_lib/qe.c |   14 ++++--
 include/asm-powerpc/qe.h        |   94 +++++++++++++++++++-------------------
 2 files changed, 56 insertions(+), 52 deletions(-)

diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 298e073..f26bc0c 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -167,19 +167,20 @@ unsigned int get_brg_clk(void)
 
 /* Program the BRG to the given sampling rate and multiplier
  *
- * @brg: the BRG, 1-16
+ * @brg: the BRG, QE_BRG1 - QE_BRG16
  * @rate: the desired sampling rate
  * @multiplier: corresponds to the value programmed in GUMR_L[RDCR] or
  * GUMR_L[TDCR].  E.g., if this BRG is the RX clock, and GUMR_L[RDCR]=01,
  * then 'multiplier' should be 8.
- *
- * Also note that the value programmed into the BRGC register must be even.
  */
-void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier)
+int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier)
 {
 	u32 divisor, tempval;
 	u32 div16 = 0;
 
+	if ((brg < QE_BRG1) || (brg > QE_BRG16))
+		return -EINVAL;
+
 	divisor = get_brg_clk() / (rate * multiplier);
 
 	if (divisor > QE_BRGC_DIVISOR_MAX + 1) {
@@ -196,8 +197,11 @@ void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier)
 	tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) |
 		QE_BRGC_ENABLE | div16;
 
-	out_be32(&qe_immr->brg.brgc[brg - 1], tempval);
+	out_be32(&qe_immr->brg.brgc[brg - QE_BRG1], tempval);
+
+	return 0;
 }
+EXPORT_SYMBOL(qe_setbrg);
 
 /* Initialize SNUMs (thread serial numbers) according to
  * QE Module Control chapter, SNUM table
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h
index 0dabe46..bcf60be 100644
--- a/include/asm-powerpc/qe.h
+++ b/include/asm-powerpc/qe.h
@@ -28,6 +28,52 @@
 #define MEM_PART_SECONDARY	1
 #define MEM_PART_MURAM		2
 
+/* Clocks and BRGs */
+enum qe_clock {
+	QE_CLK_NONE = 0,
+	QE_BRG1,		/* Baud Rate Generator 1 */
+	QE_BRG2,		/* Baud Rate Generator 2 */
+	QE_BRG3,		/* Baud Rate Generator 3 */
+	QE_BRG4,		/* Baud Rate Generator 4 */
+	QE_BRG5,		/* Baud Rate Generator 5 */
+	QE_BRG6,		/* Baud Rate Generator 6 */
+	QE_BRG7,		/* Baud Rate Generator 7 */
+	QE_BRG8,		/* Baud Rate Generator 8 */
+	QE_BRG9,		/* Baud Rate Generator 9 */
+	QE_BRG10,		/* Baud Rate Generator 10 */
+	QE_BRG11,		/* Baud Rate Generator 11 */
+	QE_BRG12,		/* Baud Rate Generator 12 */
+	QE_BRG13,		/* Baud Rate Generator 13 */
+	QE_BRG14,		/* Baud Rate Generator 14 */
+	QE_BRG15,		/* Baud Rate Generator 15 */
+	QE_BRG16,		/* Baud Rate Generator 16 */
+	QE_CLK1,		/* Clock 1 */
+	QE_CLK2,		/* Clock 2 */
+	QE_CLK3,		/* Clock 3 */
+	QE_CLK4,		/* Clock 4 */
+	QE_CLK5,		/* Clock 5 */
+	QE_CLK6,		/* Clock 6 */
+	QE_CLK7,		/* Clock 7 */
+	QE_CLK8,		/* Clock 8 */
+	QE_CLK9,		/* Clock 9 */
+	QE_CLK10,		/* Clock 10 */
+	QE_CLK11,		/* Clock 11 */
+	QE_CLK12,		/* Clock 12 */
+	QE_CLK13,		/* Clock 13 */
+	QE_CLK14,		/* Clock 14 */
+	QE_CLK15,		/* Clock 15 */
+	QE_CLK16,		/* Clock 16 */
+	QE_CLK17,		/* Clock 17 */
+	QE_CLK18,		/* Clock 18 */
+	QE_CLK19,		/* Clock 19 */
+	QE_CLK20,		/* Clock 20 */
+	QE_CLK21,		/* Clock 21 */
+	QE_CLK22,		/* Clock 22 */
+	QE_CLK23,		/* Clock 23 */
+	QE_CLK24,		/* Clock 24 */
+	QE_CLK_DUMMY
+};
+
 /* Export QE common operations */
 extern void qe_reset(void);
 extern int par_io_init(struct device_node *np);
@@ -38,7 +84,7 @@ extern int par_io_data_set(u8 port, u8 pin, u8 val);
 
 /* QE internal API */
 int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
-void qe_setbrg(unsigned int brg, unsigned int rate, unsigned int multiplier);
+int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier);
 int qe_get_snum(void);
 void qe_put_snum(u8 snum);
 unsigned long qe_muram_alloc(int size, int align);
@@ -129,52 +175,6 @@ enum comm_dir {
 	COMM_DIR_RX_AND_TX = 3
 };
 
-/* Clocks and BRGs */
-enum qe_clock {
-	QE_CLK_NONE = 0,
-	QE_BRG1,		/* Baud Rate Generator 1 */
-	QE_BRG2,		/* Baud Rate Generator 2 */
-	QE_BRG3,		/* Baud Rate Generator 3 */
-	QE_BRG4,		/* Baud Rate Generator 4 */
-	QE_BRG5,		/* Baud Rate Generator 5 */
-	QE_BRG6,		/* Baud Rate Generator 6 */
-	QE_BRG7,		/* Baud Rate Generator 7 */
-	QE_BRG8,		/* Baud Rate Generator 8 */
-	QE_BRG9,		/* Baud Rate Generator 9 */
-	QE_BRG10,		/* Baud Rate Generator 10 */
-	QE_BRG11,		/* Baud Rate Generator 11 */
-	QE_BRG12,		/* Baud Rate Generator 12 */
-	QE_BRG13,		/* Baud Rate Generator 13 */
-	QE_BRG14,		/* Baud Rate Generator 14 */
-	QE_BRG15,		/* Baud Rate Generator 15 */
-	QE_BRG16,		/* Baud Rate Generator 16 */
-	QE_CLK1,		/* Clock 1 */
-	QE_CLK2,		/* Clock 2 */
-	QE_CLK3,		/* Clock 3 */
-	QE_CLK4,		/* Clock 4 */
-	QE_CLK5,		/* Clock 5 */
-	QE_CLK6,		/* Clock 6 */
-	QE_CLK7,		/* Clock 7 */
-	QE_CLK8,		/* Clock 8 */
-	QE_CLK9,		/* Clock 9 */
-	QE_CLK10,		/* Clock 10 */
-	QE_CLK11,		/* Clock 11 */
-	QE_CLK12,		/* Clock 12 */
-	QE_CLK13,		/* Clock 13 */
-	QE_CLK14,		/* Clock 14 */
-	QE_CLK15,		/* Clock 15 */
-	QE_CLK16,		/* Clock 16 */
-	QE_CLK17,		/* Clock 17 */
-	QE_CLK18,		/* Clock 18 */
-	QE_CLK19,		/* Clock 19 */
-	QE_CLK20,		/* Clock 20 */
-	QE_CLK21,		/* Clock 21 */
-	QE_CLK22,		/* Clock 22 */
-	QE_CLK23,		/* Clock 23 */
-	QE_CLK24,		/* Clock 24 */
-	QE_CLK_DUMMY,
-};
-
 /* QE CMXUCR Registers.
  * There are two UCCs represented in each of the four CMXUCR registers.
  * These values are for the UCC in the LSBs
-- 
1.5.2.4

^ permalink raw reply related

* Re: [PATCH Rev 2] 8xxx: Convert #include of asm/of_{platform, device}.h into linux/of_{platform, device}.h.
From: Kumar Gala @ 2007-11-30  0:33 UTC (permalink / raw)
  To: Jon Loeliger; +Cc: linuxppc-dev
In-Reply-To: <E1IpStN-0003li-2G@jdl.com>


On Nov 6, 2007, at 12:11 PM, Jon Loeliger wrote:

> From: Jon Loeliger <jdl@freescale.com>
>
> Signed-off-by: Jon Loeliger <jdl@freescale.com>
> Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
> ---
>
> Chip away at some janitor work.
> Catch both asm/of_platform.h and asm/of_device.h this time.
> Add sfr's ACK.
>
> arch/powerpc/platforms/82xx/pq2fads.c     |    2 +-
> arch/powerpc/platforms/83xx/mpc832x_mds.c |    4 ++--
> arch/powerpc/platforms/83xx/mpc832x_rdb.c |    2 +-
> arch/powerpc/platforms/83xx/mpc836x_mds.c |    4 ++--
> arch/powerpc/platforms/85xx/mpc85xx_mds.c |    4 ++--
> 5 files changed, 8 insertions(+), 8 deletions(-)
>

applied.

- k

^ permalink raw reply

* Re: [PATCH v7 1/9] add e300c4 entry to cputable
From: Kumar Gala @ 2007-11-30  0:33 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev
In-Reply-To: <1192793930-26039-2-git-send-email-leoli@freescale.com>


On Oct 19, 2007, at 6:38 AM, Li Yang wrote:

> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/kernel/cputable.c |   13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)

applied.

- k

^ permalink raw reply

* Re: [PATCH v7 2/9] ipic: add new interrupts introduced by new chip
From: Kumar Gala @ 2007-11-30  0:34 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev, paulus
In-Reply-To: <1192793930-26039-3-git-send-email-leoli@freescale.com>


On Oct 19, 2007, at 6:38 AM, Li Yang wrote:

> These interrupts are introduced by the latest Freescale SoC such as
> MPC837x.
>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/sysdev/ipic.c |  138 +++++++++++++++++++++++++++++++++++ 
> +++++++--
> arch/powerpc/sysdev/ipic.h |    7 +-
> include/asm-powerpc/ipic.h |   12 ++--
> 3 files changed, 143 insertions(+), 14 deletions(-)


applied.

- k

^ permalink raw reply

* Re: [PATCH v7 4/9] add platform support for MPC837x MDS board
From: Kumar Gala @ 2007-11-30  0:34 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev
In-Reply-To: <1192793930-26039-5-git-send-email-leoli@freescale.com>


On Oct 19, 2007, at 6:38 AM, Li Yang wrote:

> The MPC837x MDS is a new member of Freescale MDS reference system.
>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/platforms/83xx/Kconfig       |   12 +++
> arch/powerpc/platforms/83xx/Makefile      |    1 +
> arch/powerpc/platforms/83xx/mpc837x_mds.c |  104 ++++++++++++++++++++ 
> +++++++++
> 3 files changed, 117 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/platforms/83xx/mpc837x_mds.c


applied.

- k

^ permalink raw reply

* Re: [PATCH v7 7/9] ipic: clean up unsupported ack operations
From: Kumar Gala @ 2007-11-30  0:35 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev
In-Reply-To: <1192793930-26039-8-git-send-email-leoli@freescale.com>


On Oct 19, 2007, at 6:38 AM, Li Yang wrote:

> IPIC controller doesn't support ack operations.  The pending registers
> are read-only.  The patch removes ack operations which are not needed.
>
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> arch/powerpc/sysdev/ipic.c |   40 + 
> +--------------------------------------
> 1 files changed, 2 insertions(+), 38 deletions(-)

applied.

- 

^ 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