Skip to contentSkip to conversation

52xx fixes for 2.6.20

PATCH In review Sylvain Munaut 4 participants 13 messages Jan 2, 2007 – Jan 11, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover 52xx fixes for 2.6.20

Hello Paul,

This is a set of fixes for the various 52xx platforms I'd like to see in 2.6.20.

- First patch is just an obvious omission in the serial driver. Certainly not critical but a simple fix nonetheless.

- The second patch corrects an incorrect usage of device_initcall

Note that it's possible other platforms make the same mistake, a grep "device_initcall" arch/powerpc/platforms/* -R gives several potential hits. I haven't investigated further though as I don't know those platforms well enough to know if the use is legit or not.

- The two last patches make the assumption the device tree of the EFIKA has been fixed properly for linux and allow it to boot using more common code.

Sylvain

#4 lore raw

PATCH 4/4 powerpc: Restore 'proper' link order in platform

In reply to Sylvain Munaut

The 52xx was put before CHRP to allow EFIKA to be recognized properly. Now the efika tree is fixed up in prom_init so no need for this ugly hack. So we restore the 'normal' order.

---
 arch/powerpc/platforms/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/platforms/Makefile +1 -1
index 507d1b9..44d95ea 100644
@@ -5,9 +5,9 @@ ifeq ($(CONFIG_PPC64),y)
 obj-$(CONFIG_PPC_PMAC)		+= powermac/
 endif
 endif
-obj-$(CONFIG_PPC_MPC52xx)	+= 52xx/
 obj-$(CONFIG_PPC_CHRP)		+= chrp/
 obj-$(CONFIG_4xx)		+= 4xx/
+obj-$(CONFIG_PPC_MPC52xx)	+= 52xx/
 obj-$(CONFIG_PPC_83xx)		+= 83xx/
 obj-$(CONFIG_PPC_85xx)		+= 85xx/
 obj-$(CONFIG_PPC_86xx)		+= 86xx/
Signature · 1 line
1.4.2
#1 lore raw

PATCH 1/4 powerpc/serial: Dispose irq mapping when done in mpc52xx_serial.c

In reply to Sylvain Munaut
---
 drivers/serial/mpc52xx_uart.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/serial/mpc52xx_uart.c +3 -0
index 9d11a75..eef3b02 100644
@@ -997,6 +997,9 @@ mpc52xx_uart_of_remove(struct of_device 
 	if (port)
 		uart_remove_one_port(&mpc52xx_uart_driver, port);
 
+	if (port->irq != NO_IRQ)
+		irq_dispose_mapping(port->irq);
+
 	return 0;
 }
 
Signature · 1 line
1.4.2
#2 lore raw

PATCH 2/4 powerpc: 52xx, Don't use device_initcall to probe of_platform_bus

Using device_initcall makes it happen for every platform that compiles this file in. This is really bad, for obvious reasons.

Instead, we use the .init field of the machine description. If the platform needs the hook to do something specific it can provides its own function and call mpc52xx_declare_of_platform_devices from there. If not, the mpc52xx_declare_of_platform_devices function can directly be used as the init hook.

---
 arch/powerpc/platforms/52xx/lite5200.c       |    1 +
 arch/powerpc/platforms/52xx/mpc52xx_common.c |    7 ++++---
 include/asm-powerpc/mpc52xx.h                |    1 +
 3 files changed, 6 insertions(+), 3 deletions(-)
arch/powerpc/platforms/52xx/lite5200.c +1 -0
index eaff71e..0f21bab 100644
@@ -153,6 +153,7 @@ define_machine(lite52xx) {
 	.name 		= "lite52xx",
 	.probe 		= lite52xx_probe,
 	.setup_arch 	= lite52xx_setup_arch,
+	.init		= mpc52xx_declare_of_platform_devices,
 	.init_IRQ 	= mpc52xx_init_irq,
 	.get_irq 	= mpc52xx_get_irq,
 	.show_cpuinfo	= lite52xx_show_cpuinfo,
arch/powerpc/platforms/52xx/mpc52xx_common.c +4 -3
index 8331ff4..cc40889 100644
@@ -116,11 +116,12 @@ unmap_regs:
 	if (xlb) iounmap(xlb);
 }
 
-static int __init
+void __init
 mpc52xx_declare_of_platform_devices(void)
 {
 	/* Find every child of the SOC node and add it to of_platform */
-	return of_platform_bus_probe(NULL, NULL, NULL);
+	if (of_platform_bus_probe(NULL, NULL, NULL))
+		printk(KERN_ERR __FILE__ ": "
+			"Error while probing of_platform bus\n");
 }
 
-device_initcall(mpc52xx_declare_of_platform_devices);
include/asm-powerpc/mpc52xx.h +1 -0
index 4a28a85..4560d72 100644
@@ -244,6 +244,7 @@ #ifndef __ASSEMBLY__
 extern void __iomem * mpc52xx_find_and_map(const char *);
 extern unsigned int mpc52xx_find_ipb_freq(struct device_node *node);
 extern void mpc52xx_setup_cpu(void);
+extern void mpc52xx_declare_of_platform_devices(void);
 
 extern void mpc52xx_init_irq(void);
 extern unsigned int mpc52xx_get_irq(void);
Signature · 1 line
1.4.2
#3 lore raw

PATCH 3/4 powerpc: Use common 52xx of_platform probe code for EFIKA

Now that the device tree has the good properties, we can remove all the efika_init code by a single call to common code.

While we're modifying that file, a few whitespaces/alignement/typo fixes are made (nothing significant).

---
 arch/powerpc/platforms/52xx/efika-setup.c |   64 ++++++++---------------------
 1 files changed, 18 insertions(+), 46 deletions(-)
arch/powerpc/platforms/52xx/efika-setup.c +18 -46
index 110c980..d61ce84 100644
@@ -2,7 +2,7 @@
  *
  * Efika 5K2 platform setup
  * Some code really inspired from the lite5200b platform.
- * 
+ *
  * Copyright (C) 2006 bplan GmbH
  *
  * This file is licensed under the terms of the GNU General Public License
@@ -81,35 +81,7 @@ #endif
 	efika_pcisetup();
 
 	if (ppc_md.progress)
-		ppc_md.progress("Linux/PPC " UTS_RELEASE " runnung on Efika ;-)\n", 0x0);
-}
-
-static void __init efika_init(void)
-{
-	struct device_node *np;
-	struct device_node *cnp = NULL;
-	const u32 *base;
-
-	/* Find every child of the SOC node and add it to of_platform */
-	np = of_find_node_by_name(NULL, "builtin");
-	if (np) {
-		char name[BUS_ID_SIZE];
-		while ((cnp = of_get_next_child(np, cnp))) {
-			strcpy(name, cnp->name);
-
-			base = get_property(cnp, "reg", NULL);
-			if (base == NULL)
-				continue;
-
-			snprintf(name+strlen(name), BUS_ID_SIZE, "@%x", *base);
-			of_platform_device_create(cnp, name, NULL);
-
-			printk(KERN_INFO EFIKA_PLATFORM_NAME" : Added %s (type '%s' at '%s') to the known devices\n", name, cnp->type, cnp->full_name);
-		}
-	}
-
-	if (ppc_md.progress)
-		ppc_md.progress("  Have fun with your Efika!    ", 0x7777);
+		ppc_md.progress("Linux/PPC " UTS_RELEASE " running on Efika ;-)\n", 0x0);
 }
 
 static int __init efika_probe(void)
@@ -131,20 +103,20 @@ static int __init efika_probe(void)
 
 define_machine(efika)
 {
-	.name = EFIKA_PLATFORM_NAME,
-	.probe = efika_probe,
-	.setup_arch = efika_setup_arch,
-	.init = efika_init,
-	.show_cpuinfo = efika_show_cpuinfo,
-	.init_IRQ = mpc52xx_init_irq,
-	.get_irq = mpc52xx_get_irq,
-	.restart = rtas_restart,
-	.power_off = rtas_power_off,
-	.halt = rtas_halt,
-	.set_rtc_time = rtas_set_rtc_time,
-	.get_rtc_time = rtas_get_rtc_time,
-	.progress = rtas_progress,
-	.get_boot_time = rtas_get_boot_time,
-	.calibrate_decr = generic_calibrate_decr,
-	.phys_mem_access_prot = pci_phys_mem_access_prot,
+	.name			= EFIKA_PLATFORM_NAME,
+	.probe			= efika_probe,
+	.setup_arch		= efika_setup_arch,
+	.init			= mpc52xx_declare_of_platform_devices,
+	.show_cpuinfo		= efika_show_cpuinfo,
+	.init_IRQ		= mpc52xx_init_irq,
+	.get_irq		= mpc52xx_get_irq,
+	.restart		= rtas_restart,
+	.power_off		= rtas_power_off,
+	.halt			= rtas_halt,
+	.set_rtc_time		= rtas_set_rtc_time,
+	.get_rtc_time		= rtas_get_rtc_time,
+	.progress		= rtas_progress,
+	.get_boot_time		= rtas_get_boot_time,
+	.calibrate_decr		= generic_calibrate_decr,
+	.phys_mem_access_prot	= pci_phys_mem_access_prot,
 };
Signature · 1 line
1.4.2
Acked-by on v1 2/4
#10 lore raw

Re: [PATCH 2/4] powerpc: 52xx, Don't use device_initcall to probe of_platform_bus

In reply to Sylvain Munaut
Quoted 10 lines · Sylvain Munaut

Using device_initcall makes it happen for every platform that compiles this file in. This is really bad, for obvious reasons.

Instead, we use the .init field of the machine description. If the platform needs the hook to do something specific it can provides its own function and call mpc52xx_declare_of_platform_devices from there. If not, the mpc52xx_declare_of_platform_devices function can directly be used as the init hook.

Acked-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] powerpc: Use common 52xx of_platform probe code for EFIKA

In reply to Sylvain Munaut
Quoted 7 lines · Sylvain Munaut

Now that the device tree has the good properties, we can remove all the efika_init code by a single call to common code.

While we're modifying that file, a few whitespaces/alignement/typo fixes are made (nothing significant).

#12 lore raw

Re: [PATCH 1/4] powerpc/serial: Dispose irq mapping when done in mpc52xx_serial.c

In reply to Sylvain Munaut
Quoted 10 lines · Sylvain Munaut
---
 drivers/serial/mpc52xx_uart.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/serial/mpc52xx_uart.c +0 -0
index 9d11a75..eef3b02 100644

drivers/serial/mpc52xx_uart.c mpc52xx_uart_of_remove(struct of_device · line 1002

Quoted 6 lines
drivers/serial/mpc52xx_uart.c +3 -0
@@ -997,6 +997,9 @@ mpc52xx_uart_of_remove(struct of_device 
 	if (port)
 		uart_remove_one_port(&mpc52xx_uart_driver, port);
 
+	if (port->irq != NO_IRQ)
+		irq_dispose_mapping(port->irq);
+

I didn't put this one in for 2.6.20, because it doesn't solve any actual problem, and Ben H tells me it might trigger a bug in the generic irq code.

Paul.

#7 lore raw

Re: [PATCH 3/4] powerpc: Use common 52xx of_platform probe code for EFIKA

In reply to Sylvain Munaut
Quoted 2 lines · Sylvain Munaut

Now that the device tree has the good properties, we can remove all the efika_init code by a single call to common code.

Ummm, but the device tree doesn't have good properties, does it, without your patch that adds a whole pile of device tree fixups? I'm reluctant to put that in for 2.6.20 because it's moderately large, has at least the potential to upset other platforms, and what it fixes isn't a regression from 2.6.19, and we're already past -rc4.

Your patch 4/4 seems to depend on this one (3/4) so I didn't put it in for 2.6.20 either.

Paul.

#8 lore raw

Re: [PATCH 3/4] powerpc: Use common 52xx of_platform probe code for EFIKA

About the serial patch :

Quoted 3 lines

I didn't put this one in for 2.6.20, because it doesn't solve any actual problem, and Ben H tells me it might trigger a bug in the generic irq code.

The bug it triggered has been fixed eons ago (like last December 22), in a impressive one-liner patch that has 5 Signed-off/Acked-by ;) ...

But that code is rarely executed as it would imply the PSC can be unloaded ... (impossible when used as console). So later merge is OK.

Quoted 7 lines · Paul Mackerras
Quoted 3 lines · Sylvain Munaut

Now that the device tree has the good properties, we can remove all the efika_init code by a single call to common code.

Quoted 6 lines

Ummm, but the device tree doesn't have good properties, does it, without your patch that adds a whole pile of device tree fixups? I'm reluctant to put that in for 2.6.20 because it's moderately large, has at least the potential to upset other platforms, and what it fixes isn't a regression from 2.6.19, and we're already past -rc4.

Ok, let's just delay everything to the next merge window. Anyway most the drivers won't get merged until then.

I'll redo a nice patchset with all I got when it opens (or if you open a for-2.6.21 branch ;).

Sylvain

#9 lore raw

Re: [PATCH 3/4] powerpc: Use common 52xx of_platform probe code for EFIKA

Quoted 6 lines · Sylvain Munaut

About the serial patch :

Quoted 3 lines

I didn't put this one in for 2.6.20, because it doesn't solve any actual problem, and Ben H tells me it might trigger a bug in the generic irq code.

Quoted 6 lines

The bug it triggered has been fixed eons ago (like last December 22), in a impressive one-liner patch that has 5 Signed-off/Acked-by ;) ...

But that code is rarely executed as it would imply the PSC can be unloaded ... (impossible when used as console). So later merge is OK.

And there is no real problem in this case for not disposing of the mapping anyway. You'll just get the same mapping again when you reload it.

Ben.