Mainly 52xx patches for 2.6.21 (but not only)
cover Mainly 52xx patches for 2.6.21 (but not only)
Hi Paul,
This patchset is against a recent linus clone (it relies on recent additions) + the two patches Grant posted today.
This patch set starts with 52xx specific stuff. They've been tested on the EFIKA and lite5200 by Grant and myself.
The last 4 patches add a unified uevent handler for bus relying on of_device. This patch has been tested on the efika as well. It has been posted here before and was tested then by some other people. The problems reported then have been fixed in this version.
I hope this will make it to 2.6.21.
Sylvain
PATCH 1/10 powerpc/serial: Dispose irq mapping when done in mpc52xx_serial.c
--- drivers/serial/mpc52xx_uart.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/serial/mpc52xx_uart.c +3 -0
@@ -999,6 +999,9 @@ mpc52xx_uart_of_remove(struct of_deviceif (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
PATCH 2/10 powerpc: Add device tree fixups for the EFIKA
We make the efika device tree compliant with the defined bindings (at least compliant enough). This is mostly done by mangling the device_type and compatible properties, but also adding some missing bits.
--- arch/powerpc/kernel/prom_init.c | 81 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-)
arch/powerpc/kernel/prom_init.c +81 -0
@@ -2117,11 +2117,92 @@ #else#define fixup_device_tree_pmac ()#endif +#ifdef CONFIG_PPC_EFIKA +/* The current fw of the Efika has a device tree needs quite a few +* fixups to be compliant with the mpc52xx bindings. It's currently +* unknown if it will ever be compliant (come on bPlan ...) so we do fixups. +* NOTE that we (barely) tolerate it because the EFIKA was out before +* the bindings were finished, for any new boards -> RTFM ! */ + +struct subst_entry { +char *path; +char *property; +void *value; +int value_len; +}; + +static void __init fixup_device_tree_efika (void ) +{ +/* Substitution table */ +#define prop_cstr (x) x, sizeof(x) +int prop_sound_irq[3 ] = {2 ,2 ,0 }; +int prop_bcomm_irq[3 *16 ] = {3 ,0 ,0 ,3 ,1 ,0 ,3 ,2 ,0 ,3 ,3 ,0 , +3 ,4 ,0 ,3 ,5 ,0 ,3 ,6 ,0 ,3 ,7 ,0 , +3 ,8 ,0 ,3 ,9 ,0 ,3 ,10 ,0 ,3 ,11 ,0 , +3 ,12 ,0 ,3 ,13 ,0 ,3 ,14 ,0 ,3 ,15 ,0 }; +struct subst_entry efika_subst_table[] = { + {"/" ,"device_type" ,prop_cstr ("efika" ) }, + {"/builtin" ,"compatible" ,prop_cstr ("soc" ) }, + {"/builtin/ata" ,"compatible" ,prop_cstr ("mpc5200b-ata\0mpc5200-ata" ), }, + {"/builtin/bestcomm" ,"compatible" ,prop_cstr ("mpc5200b-bestcomm\0mpc5200-bestcomm" ) }, + {"/builtin/bestcomm" ,"interrupts" , prop_bcomm_irq,sizeof (prop_bcomm_irq) }, + {"/builtin/ethernet" ,"compatible" ,prop_cstr ("mpc5200b-fec\0mpc5200-fec" ) }, + {"/builtin/pic" ,"compatible" ,prop_cstr ("mpc5200b-pic\0mpc5200-pic" ) }, + {"/builtin/serial" ,"compatible" ,prop_cstr ("mpc5200b-psc-uart\0mpc5200-psc-uart" ) }, + {"/builtin/sound" ,"compatible" ,prop_cstr ("mpc5200b-psc-ac97\0mpc5200-psc-ac97" ) }, + {"/builtin/sound" ,"interrupts" , prop_sound_irq,sizeof (prop_sound_irq) }, + {"/builtin/sram" ,"compatible" ,prop_cstr ("mpc5200b-sram\0mpc5200-sram" ) }, + {"/builtin/sram" ,"device_type" ,prop_cstr ("sram" ) }, + {} + }; +#undef prop_cstr + +/* Vars */ +u32 node; +char prop[64 ]; +int rv, i; + +/* Check if we're really running on a EFIKA */ + node =call_prom ("finddevice" ,1 ,1 ,ADDR ("/" )); +if (!PHANDLE_VALID (node)) +return ; + + rv =prom_getprop (node,"model" , prop,sizeof (prop)); +if (rv ==PROM_ERROR ) +return ; +if (strcmp (prop,"EFIKA5K2" )) +return ; + +prom_printf ("Applying EFIKA device tree fixups\n" ); + +/* Process substitution table */ +for (i=0 ; efika_subst_table[i].path; i++) { +struct subst_entry *se = &efika_subst_table[i]; + + node =call_prom ("finddevice" ,1 ,1 ,ADDR (se->path)); +if (!PHANDLE_VALID (node)) { +prom_printf ("fixup_device_tree_efika: " , +"skipped entry %x - not found\n" , i); +continue ; + } + + rv =prom_setprop (node, se->path, se->property, + se->value, se->value_len ); +if (rv ==PROM_ERROR ) +prom_printf ("fixup_device_tree_efika: " , +"skipped entry %x - setprop error\n" , i); + } +} +#else +#define fixup_device_tree_efika () +#endif +static void __init fixup_device_tree (void ) {fixup_device_tree_maple ();fixup_device_tree_chrp ();fixup_device_tree_pmac (); +fixup_device_tree_efika (); }static void __init prom_find_boot_cpu (void )
Signature · 1 line
1.4.2
PATCH 3/10 powerpc: Restore 'proper' link order in platform
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
@@ -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_8xx) += 8xx/ obj-$(CONFIG_PPC_82xx) += 82xx/ obj-$(CONFIG_PPC_83xx) += 83xx/
Signature · 1 line
1.4.2
PATCH 4/10 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
@@ -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 @@ #endifefika_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
PATCH 5/10 powerpc: Fix unbalanced of_node_{get, put} in efika-setup.c
--- arch/powerpc/platforms/52xx/efika-setup.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-)
arch/powerpc/platforms/52xx/efika-setup.c +6 -7
@@ -42,14 +42,13 @@ static void efika_show_cpuinfo(struct seconst char *codegenvendor =NULL ; root =of_find_node_by_path ("/" ); -if (root) { - revision =get_property (root,"revision" ,NULL ); - codegendescription = -get_property (root,"CODEGEN,description" ,NULL ); - codegenvendor =get_property (root,"CODEGEN,vendor" ,NULL ); +if (!root) +return ; -of_node_put (root); - } + revision =get_property (root,"revision" ,NULL ); + codegendescription = +get_property (root,"CODEGEN,description" ,NULL ); + codegenvendor =get_property (root,"CODEGEN,vendor" ,NULL );if (codegendescription)seq_printf (m,"machine\t\t: %s\n" , codegendescription);
Signature · 1 line
1.4.2
PATCH 6/10 powerpc: Small cleanup of EFIKA platform
The efika platform used three files efika-pci.c efika-setup.c and a 2 line efika.h to link the two. The total of code in those is really not much and therefore, I think they're better merged in a single file.
There is absolutely _no_code_change_ at all, just merged the files.
--- arch/powerpc/platforms/52xx/Makefile | 2 arch/powerpc/platforms/52xx/efika-pci.c | 119 -------------- arch/powerpc/platforms/52xx/efika-setup.c | 121 -------------- arch/powerpc/platforms/52xx/efika.c | 243 +++++++++++++++++++++++++++++ arch/powerpc/platforms/52xx/efika.h | 19 -- 5 files changed, 244 insertions(+), 260 deletions(-)
arch/powerpc/platforms/52xx/Makefile +1 -1
@@ -6,5 +6,5 @@ obj-y += mpc52xx_pic.o mpc52xx_common obj-$(CONFIG_PCI) += mpc52xx_pci.o endif -obj-$(CONFIG_PPC_EFIKA) += efika-setup.o efika-pci.o +obj-$(CONFIG_PPC_EFIKA) += efika.o obj-$(CONFIG_PPC_LITE5200) += lite5200.o
arch/powerpc/platforms/52xx/efika-pci.c deleted +0 -119
119 lines not on this page · raw message
arch/powerpc/platforms/52xx/efika-setup.c deleted +0 -121
121 lines not on this page · raw message
arch/powerpc/platforms/52xx/efika.c new file +243 -0
243 lines not on this page · raw message
arch/powerpc/platforms/52xx/efika.h deleted +0 -19
@@ -1,19 +0,0 @@ -/* -* Efika 5K2 platform setup - Header file -* -* Copyright (C) 2006 bplan GmbH -* -* This file is licensed under the terms of the GNU General Public License -* version 2. This program is licensed "as is" without any warranty of any -* kind, whether express or implied. -* -*/ - -#ifndef __ARCH_POWERPC_EFIKA__ -#define __ARCH_POWERPC_EFIKA__ - -#define EFIKA_PLATFORM_NAME "Efika" - -extern void __init efika_pcisetup (void ); - -#endif
Signature · 1 line
1.4.2
PATCH 7/10 powerpc: Add a unified uevent handler for bus based on of_device
This common uevent handler allow the several bus types based on of_device to generate the uevent properly and avoiding code duplication.
This handlers take a struct device as argument and can therefore be used as the uevent call directly if no special treatment is needed for the bus.
--- arch/powerpc/kernel/of_device.c | 112 +++++++++++++++++++++++++++++++++++++++ include/asm-powerpc/of_device.h | 3 + 2 files changed, 115 insertions(+), 0 deletions(-)
arch/powerpc/kernel/of_device.c +112 -0
@@ -120,6 +120,117 @@ void of_device_unregister(struct of_devi } +static ssize_t of_device_get_modalias (struct of_device *ofdev, +char *str,ssize_t len) +{ +const char *compat; +int cplen, i; +ssize_t tsize, csize, repend; + +/* Name & Type */ + csize =snprintf (str, len,"of:N%sT%s" , + ofdev->node->name, ofdev->node->type); + +/* Get compatible property if any */ + compat =get_property (ofdev->node,"compatible" , &cplen); +if (!compat) +return csize; + +/* Find true end (we tolerate multiple \0 at the end */ +for (i=(cplen-1 ); i>=0 && !compat[i]; i--) + cplen--; +if (!cplen) +return csize; + cplen++; + +/* Check space (need cplen+1 chars including final \0) */ + tsize = csize + cplen; + repend = tsize; + +if (csize>=len)/* @ the limit, all is already filled */ +return tsize; + +if (tsize>=len) {/* limit compat list */ + cplen = len-csize-1 ; + repend = len; + } + +/* Copy and do char replacement */ +memcpy (&str[csize+1 ], compat, cplen); +for (i=csize; i<repend; i++) { +char c = str[i]; +if (c=='\0' ) + str[i] ='C' ; +else if (c==' ' ) + str[i] ='_' ; + } + +return tsize; +} + +int of_device_uevent (struct device *dev, +char **envp,int num_envp,char *buffer,int buffer_size) +{ +struct of_device *ofdev; +const char *compat; +int i =0 , length =0 , seen =0 , cplen, sl; + +if (!dev) +return -ENODEV ; + + ofdev =to_of_device (dev); + +if (add_uevent_var (envp, num_envp, &i, + buffer, buffer_size, &length, +"OF_NAME=%s" , ofdev->node->name)) +return -ENOMEM ; + +if (add_uevent_var (envp, num_envp, &i, + buffer, buffer_size, &length, +"OF_TYPE=%s" , ofdev->node->type)) +return -ENOMEM ; + +/* Since the compatible field can contain pretty much anything +* it's not really legal to split it out with commas. We split it +* up using a number of environment variables instead. */ + + compat =get_property (ofdev->node,"compatible" , &cplen); +while (compat && *compat && cplen >0 ) { +if (add_uevent_var (envp, num_envp, &i, + buffer, buffer_size, &length, +"OF_COMPATIBLE_%d=%s" , seen, compat)) +return -ENOMEM ; + + sl =strlen (compat) +1 ; + compat += sl; + cplen -= sl; + seen++; + } + +if (add_uevent_var (envp, num_envp, &i, + buffer, buffer_size, &length, +"OF_COMPATIBLE_N=%d" , seen)) +return -ENOMEM ; + +/* modalias is trickier, we add it in 2 steps */ +if (add_uevent_var (envp, num_envp, &i, + buffer, buffer_size, &length, +"MODALIAS=" )) +return -ENOMEM ; + + sl =of_device_get_modalias (ofdev, &buffer[length-1 ], + buffer_size-length); +if (sl >= (buffer_size-length)) +return -ENOMEM ; + + length += sl; + + envp[i] =NULL ; + +return 0 ; +} + +EXPORT_SYMBOL (of_match_node);EXPORT_SYMBOL (of_match_device);EXPORT_SYMBOL (of_device_register);
@@ -127,3 +238,4 @@ EXPORT_SYMBOL(of_device_unregister);EXPORT_SYMBOL (of_dev_get);EXPORT_SYMBOL (of_dev_put);EXPORT_SYMBOL (of_release_dev); +EXPORT_SYMBOL (of_device_uevent);
include/asm-powerpc/of_device.h +3 -0
@@ -32,5 +32,8 @@ extern int of_device_register(struct of_extern void of_device_unregister (struct of_device *ofdev);extern void of_release_dev (struct device *dev); +extern int of_device_uevent (struct device *dev, +char **envp,int num_envp,char *buffer,int buffer_size); +#endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_OF_DEVICE_H */
Signature · 1 line
1.4.2
PATCH 8/10 macintosh: Use the new of_device common uevent handler
The generation of the uevent is now common to all bus using of_device.
--- drivers/macintosh/macio_asic.c | 98 ---------------------------------------- 1 files changed, 1 insertions(+), 97 deletions(-)
drivers/macintosh/macio_asic.c +1 -97
@@ -134,108 +134,12 @@ static int macio_device_resume(struct dereturn 0 ; } -static int macio_uevent (struct device *dev,char **envp,int num_envp, -char *buffer,int buffer_size) -{ -struct macio_dev * macio_dev; -struct of_device * of; -char *scratch; -const char *compat, *compat2; - -int i =0 ; -int length, cplen, cplen2, seen =0 ; - -if (!dev) -return -ENODEV ; - - macio_dev =to_macio_device (dev); -if (!macio_dev) -return -ENODEV ; - - of = &macio_dev->ofdev; - -/* stuff we want to pass to /sbin/hotplug */ - envp[i++] = scratch = buffer; - length =scnprintf (scratch, buffer_size,"OF_NAME=%s" , of->node->name); - ++length; - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - - envp[i++] = scratch; - length =scnprintf (scratch, buffer_size,"OF_TYPE=%s" , of->node->type); - ++length; - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - -/* Since the compatible field can contain pretty much anything -* it's not really legal to split it out with commas. We split it -* up using a number of environment variables instead. */ - - compat =get_property (of->node,"compatible" , &cplen); - compat2 = compat; - cplen2= cplen; -while (compat && cplen >0 ) { - envp[i++] = scratch; - length =scnprintf (scratch, buffer_size, -"OF_COMPATIBLE_%d=%s" , seen, compat); - ++length; - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - length =strlen (compat) +1 ; - compat += length; - cplen -= length; - seen++; - } - - envp[i++] = scratch; - length =scnprintf (scratch, buffer_size,"OF_COMPATIBLE_N=%d" , seen); - ++length; - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - - envp[i++] = scratch; - length =scnprintf (scratch, buffer_size,"MODALIAS=of:N%sT%s" , - of->node->name, of->node->type); -/* overwrite '\0' */ - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - -if (!compat2) { - compat2 ="" ; - cplen2 =1 ; - } -while (cplen2 >0 ) { - length =snprintf (scratch, buffer_size,"C%s" , compat2); - buffer_size -= length; -if (buffer_size <=0 ) -return -ENOMEM ; - scratch += length; - length =strlen (compat2) +1 ; - compat2 += length; - cplen2 -= length; - } - - envp[i] =NULL ; - -return 0 ; -} -extern struct device_attribute macio_dev_attrs[];struct bus_type macio_bus_type = { .name ="macio" , .match = macio_bus_match, - .uevent = macio_uevent, + .uevent = of_device_uevent, .probe = macio_device_probe, .remove = macio_device_remove, .shutdown = macio_device_shutdown,
Signature · 1 line
1.4.2
PATCH 9/10 powerpc: Add uevent handler for of_platform_bus
Adding this handler allow userspace to properly handle the module autoloading. The generation of the uevent itself is now common to all bus using of_device, so not much code here.
--- arch/powerpc/kernel/of_platform.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/powerpc/kernel/of_platform.c +1 -0
@@ -133,6 +133,7 @@ static int of_platform_device_resume(strstruct bus_type of_platform_bus_type = { .name ="of_platform" , .match = of_platform_bus_match, + .uevent = of_device_uevent, .probe = of_platform_device_probe, .remove = of_platform_device_remove, .suspend = of_platform_device_suspend,
Signature · 1 line
1.4.2
PATCH 10/10 powerpc: Add uevent handler for ibmebus
Adding this handler allow userspace to properly handle the module autoloading. The generation of the uevent itself is now common to all bus using of_device, so not much code here.
But we still need a small wrapper to filter out the dummy root device node used by this bus.
--- arch/powerpc/kernel/ibmebus.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
arch/powerpc/kernel/ibmebus.c +16 -0
@@ -361,9 +361,25 @@ static int ibmebus_bus_match(struct devireturn 0 ; } +static int ibmebus_bus_uevent (struct device *dev, +char **envp,int num_envp,char *buffer,int buffer_size) +{ +struct ibmebus_dev *ebus_dev; + +if (!dev) +return -ENODEV ; + + ebus_dev =to_ibmebus_dev (dev); +if (ebus_dev==ibmebus_bus_device)/* filter dummy root device */ +return -ENODEV ; + +return of_device_uevent (dev, envp, num_envp, buffer, buffer_size); +} +struct bus_type ibmebus_bus_type = { .name ="ibmebus" , .match = ibmebus_bus_match, + .uevent = ibmebus_bus_uevent, };EXPORT_SYMBOL (ibmebus_bus_type);
Signature · 1 line
1.4.2
Re: [PATCH 10/10] powerpc: Add uevent handler for ibmebus
arch/powerpc/kernel/ibmebus.c static int ibmebus_bus_match(struct devi · line 373
Quoted 3 lines · Sylvain Munaut
arch/powerpc/kernel/ibmebus.c | 16 ++++++++++++++++arch/powerpc/kernel/ibmebus.c +1
-0+if (ebus_dev==ibmebus_bus_device)/* filter dummy root device */
Does that compile for you?ibmebus_bus_device should be &ibmebus_bus_device
Re: [PATCH 10/10] powerpc: Add uevent handler for ibmebus
[email protected] wrote on 29.03.2007 16:46:23:
Quoted 8 lines · Sylvain Munaut
Quoted 4 lines
arch/powerpc/kernel/ibmebus.c | 16 +++++++++++++++++ if (ebus_dev==ibmebus_bus_device) /* filter dummy root device */
Does that compile for you?
ibmebus_bus_deviceshould be&ibmebus_bus_device
Can you tell me from which code base you're seeing this?
Is above change from Sylvain? I looked at Joachim's recent patches and did not find that code line.
Thanks
Nam
Re: [PATCH 10/10] powerpc: Add uevent handler for ibmebus
Quoted 11 lines · Hoang-Nam Nguyen
[email protected] wrote on 29.03.2007 16:46:23:
Quoted 7 lines · Sylvain Munaut
Quoted 6 lines
arch/powerpc/kernel/ibmebus.c | 16 +++++++++++++++++ if (ebus_dev==ibmebus_bus_device) /* filter dummy root device */
Quoted 9 lines
Quoted 3 lines
Does that compile for you?
ibmebus_bus_deviceshould be&ibmebus_bus_deviceCan you tell me from which code base you're seeing this?
Is above change from Sylvain? I looked at Joachim's recent patches and did not find that code line.
Thanks
Nam
Yes it's a line my pacthe adds.
But IIRC, Joachim's patch remove the dummy root device which means that's use less.
In fact my whole [PATCH 10/10] should not be used and Joachim's version is the good one.
Sylvain
Re: [PATCH 08/10] macintosh: Use the new of_device common uevent handler
In reply to Sylvain MunautQuoted 2 lines · Sylvain Munaut
The generation of the uevent is now common to all bus using
of_device.
I haven't managed to figure out why so far (a quick inspection of the code didn't show anything obvious) but with your patch, the snd-aoa driver fails to auto-load at boot... might be the modalias being broken, dunno.
Ben.
Quoted 119 lines
Signed-off-by Sylvain Munaut <[email protected]>--- drivers/macintosh/macio_asic.c | 98 ---------------------------------------- 1 files changed, 1 insertions(+), 97 deletions(-)drivers/macintosh/macio_asic.c +1
-97@@ -134,108 +134,12 @@ static int macio_device_resume(struct dereturn 0 ; } -static int macio_uevent (struct device *dev,char **envp,int num_envp, -char *buffer,int buffer_size) -{ -struct macio_dev * macio_dev; -struct of_device * of; -char *scratch; -const char *compat, *compat2; - -int i =0 ; -int length, cplen, cplen2, seen =0 ; - -if (!dev) -return -ENODEV ; - - macio_dev =to_macio_device (dev); -if (!macio_dev) -return -ENODEV ; - - of = &macio_dev->ofdev; - -/* stuff we want to pass to /sbin/hotplug */ - envp[i++] = scratch = buffer; - length =scnprintf (scratch, buffer_size,"OF_NAME=%s" , of->node->name); - ++length; - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - - envp[i++] = scratch; - length =scnprintf (scratch, buffer_size,"OF_TYPE=%s" , of->node->type); - ++length; - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - -/* Since the compatible field can contain pretty much anything -* it's not really legal to split it out with commas. We split it -* up using a number of environment variables instead. */ - - compat =get_property (of->node,"compatible" , &cplen); - compat2 = compat; - cplen2= cplen; -while (compat && cplen >0 ) { - envp[i++] = scratch; - length =scnprintf (scratch, buffer_size, -"OF_COMPATIBLE_%d=%s" , seen, compat); - ++length; - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - length =strlen (compat) +1 ; - compat += length; - cplen -= length; - seen++; - } - - envp[i++] = scratch; - length =scnprintf (scratch, buffer_size,"OF_COMPATIBLE_N=%d" , seen); - ++length; - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - - envp[i++] = scratch; - length =scnprintf (scratch, buffer_size,"MODALIAS=of:N%sT%s" , - of->node->name, of->node->type); -/* overwrite '\0' */ - buffer_size -= length; -if ((buffer_size <=0 ) || (i >= num_envp)) -return -ENOMEM ; - scratch += length; - -if (!compat2) { - compat2 ="" ; - cplen2 =1 ; - } -while (cplen2 >0 ) { - length =snprintf (scratch, buffer_size,"C%s" , compat2); - buffer_size -= length; -if (buffer_size <=0 ) -return -ENOMEM ; - scratch += length; - length =strlen (compat2) +1 ; - compat2 += length; - cplen2 -= length; - } - - envp[i] =NULL ; - -return 0 ; -} -extern struct device_attribute macio_dev_attrs[];struct bus_type macio_bus_type = { .name ="macio" , .match = macio_bus_match, - .uevent = macio_uevent, + .uevent = of_device_uevent, .probe = macio_device_probe, .remove = macio_device_remove, .shutdown = macio_device_shutdown,
Re: [PATCH 08/10] macintosh: Use the new of_device common uevent handler
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 3 lines · Sylvain Munaut
The generation of the uevent is now common to all bus using
of_device.I haven't managed to figure out why so far (a quick inspection of the code didn't show anything obvious) but with your patch, the snd-aoa driver fails to auto-load at boot... might be the modalias being broken, dunno.
Hi Ben,
Thanks for testing. That issue looks weird.
I had a look at sound/aoa/soundbus/i2sbus/i2sbus-core.c , which is the only part of aoa with of_device_id and I see that it uses the MODULE_ALIAS directly :MODULE_ALIAS("of:Ni2sTi2sC");
instead of usingMODULE_DEVICE_TABLE(of, i2sbus_match);
and letting modpost do the job. Because that module alias is not the one that's gonna be generated by modpost.
But that doesn't explain why it worked before and not now ...
Sylvain
Re: [PATCH 08/10] macintosh: Use the new of_device common uevent handler
Quoted 8 lines · Sylvain Munaut
I had a look at
sound/aoa/soundbus/i2sbus/i2sbus-core.c, which is the only part of aoa withof_device_idand I see that it uses theMODULE_ALIASdirectly :MODULE_ALIAS("of:Ni2sTi2sC");
instead of usingMODULE_DEVICE_TABLE(of, i2sbus_match);
and letting modpost do the job. Because that module alias is not the one that's gonna be generated by modpost.
Can you elaborate on that for me? If that's the incorrect thing to do I should probably change that :)
johannes
Re: [PATCH 08/10] macintosh: Use the new of_device common uevent handler
Quoted 11 lines · Johannes Berg
Quoted 8 lines · Sylvain Munaut
I had a look at
sound/aoa/soundbus/i2sbus/i2sbus-core.c, which is the only part of aoa withof_device_idand I see that it uses theMODULE_ALIASdirectly :MODULE_ALIAS("of:Ni2sTi2sC");
instead of usingMODULE_DEVICE_TABLE(of, i2sbus_match);
and letting modpost do the job. Because that module alias is not the one that's gonna be generated by modpost.
Quoted 2 lines
Can you elaborate on that for me? If that's the incorrect thing to do I should probably change that :)
To avoid to the driver writer the burden of writing the module_alias himself, there is
a mechanism to do it automatically.
You just add
MODULE_DEVICE_TABLE(of, i2sbus_match);
to your driver, with "of" being the bus type and i2sbus_match the match table used when registering the driver.
And during the modpost step of module compilation, the module_device_table will be use to magically generate the module_alias string. This also has the advantages that if the format of that string changes, you don't have to go change all the driver code but just the "of" bus handler in modpost.
Sylvain
Re: [PATCH 08/10] macintosh: Use the new of_device common uevent handler
Quoted 1 line · Sylvain Munaut
MODULE_DEVICE_TABLE(of, i2sbus_match);
Ok. That results in the alias of:Ni2sT*C* instead of of:Ni2sTi2sC as I had it, but I assume * has some match-semantics here.
I'll submit a patch to the alsa folks.
johannes
Re: [PATCH 02/10] powerpc: Add device tree fixups for the EFIKA
In reply to Sylvain MunautQuoted 17 lines · Sylvain Munaut
We make the efika device tree compliant with the defined bindings (at least compliant enough). This is mostly done by mangling the
device_typeand compatible properties, but also adding some missing bits.Signed-off-by Sylvain Munaut <[email protected]>Acked-by Grant Likely <[email protected]>--- arch/powerpc/kernel/prom_init.c | 81 ++++++++++++++++++++++++++++ +++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-)arch/powerpc/kernel/prom_init.c +0
-0
arch/powerpc/kernel/prom_init.c #else · line 2121
Quoted 5 lines
arch/powerpc/kernel/prom_init.c +1
-0@@ -2117,11 +2117,92 @@ #else#define fixup_device_tree_pmac ()#endif +#ifdef CONFIG_PPC_EFIKA
can't this EFIKA fixup live in efika board code (platforms/52xx/efika*)
- k
Re: [PATCH 02/10] powerpc: Add device tree fixups for the EFIKA
Quoted 24 lines · Kumar Gala
Quoted 21 lines · Sylvain Munaut
We make the efika device tree compliant with the defined bindings (at least compliant enough). This is mostly done by mangling the
device_typeand compatible properties, but also adding some missing bits.Signed-off-by Sylvain Munaut <[email protected]>Acked-by Grant Likely <[email protected]>--- arch/powerpc/kernel/prom_init.c | 81 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-)arch/powerpc/kernel/prom_init.c +0
-0@@ -2117,11 +2117,92 @@ #else#define fixup_device_tree_pmac ()#endif
Quoted 4 lines
arch/powerpc/kernel/prom_init.c #else · line 2121
Quoted 2 lines
arch/powerpc/kernel/prom_init.c +1
-0+#ifdef CONFIG_PPC_EFIKA can't this EFIKA fixup live in efika board code (platforms/52xx/efika*)
It's too late by then.
Since some of these are needed just to make the board recognized as an efika and not chrp.
Or for the sram not to be assimilated to normal RAM ...
Some of them probably could by "hacking" the tree after it's been built I guess that would be possible.
But since some of them are needed in prom_init anyway I think it's better to keep it grouped there.
Sylvain
Re: [PATCH 02/10] powerpc: Add device tree fixups for the EFIKA
In reply to Kumar GalaQuoted 23 lines · Kumar Gala
Quoted 21 lines · Sylvain Munaut
We make the efika device tree compliant with the defined bindings (at least compliant enough). This is mostly done by mangling the
device_typeand compatible properties, but also adding some missing bits.Signed-off-by Sylvain Munaut <[email protected]>Acked-by Grant Likely <[email protected]>--- arch/powerpc/kernel/prom_init.c | 81 ++++++++++++++++++++++++++++ +++++++++++ 1 files changed, 81 insertions(+), 0 deletions(-)arch/powerpc/kernel/ renamed from arch/powerpc/kernel/prom_init.c +0
-0
prom_init.c
index 520ef42..4fb5938 100644arch/powerpc/kernel/prom_init.c +0
-0@@ -2117,11 +2117,92 @@ #else#define fixup_device_tree_pmac ()#endif
Quoted 4 lines
arch/powerpc/kernel/prom_init.c #else · line 2121
Quoted 2 lines
arch/powerpc/kernel/prom_init.c +1
-0+#ifdef CONFIG_PPC_EFIKA can't this EFIKA fixup live in efika board code (platforms/52xx/efika*)
Nah, those fixups belong in prom_init which itself may endup being split in the boot wrappers on day ...
Ben.
Re: [PATCH 02/10] powerpc: Add device tree fixups for the EFIKA
In reply to Sylvain MunautQuoted 16 lines
arch/powerpc/kernel/prom_init.c +15
-0+static void __init fixup_device_tree_efika (void ) +{ +/* Substitution table */ +#define prop_cstr (x) x, sizeof(x) +int prop_sound_irq[3 ] = {2 ,2 ,0 }; +int prop_bcomm_irq[3 *16 ] = {3 ,0 ,0 ,3 ,1 ,0 ,3 ,2 ,0 ,3 ,3 ,0 , +3 ,4 ,0 ,3 ,5 ,0 ,3 ,6 ,0 ,3 ,7 ,0 , +3 ,8 ,0 ,3 ,9 ,0 ,3 ,10 ,0 ,3 ,11 ,0 , +3 ,12 ,0 ,3 ,13 ,0 ,3 ,14 ,0 ,3 ,15 ,0 }; +struct subst_entry efika_subst_table[] = { + {"/" ,"device_type" ,prop_cstr ("efika" ) }, + {"/builtin" ,"compatible" ,prop_cstr ("soc" ) }, + {"/builtin/ata" ,"compatible" ,prop_cstr ("mpc5200b-ata\0mpc5200-ata" ), }, + {"/builtin/bestcomm" ,"compatible" ,prop_cstr ("mpc5200b-bestcomm\0mpc5200-bestcomm" ) }, + {"/builtin/bestcomm" ,"interrupts" , prop_bcomm_irq,sizeof (prop_bcomm_irq) },
arch/powerpc/kernel/prom_init.c #else · line 2158
Quoted 10 lines
arch/powerpc/kernel/prom_init.c +10
-0+ { "/builtin/ethernet", "compatible", prop_cstr("mpc5200b-fec\0mpc5200-fec") }, + { "/builtin/pic", "compatible", prop_cstr("mpc5200b-pic\0mpc5200-pic") }, + { "/builtin/serial", "compatible", prop_cstr("mpc5200b-psc-uart\0mpc5200-psc-uart") }, + { "/builtin/sound", "compatible", prop_cstr("mpc5200b-psc-ac97\0mpc5200-psc-ac97") }, + { "/builtin/sound", "interrupts", prop_sound_irq, sizeof(prop_sound_irq) }, + { "/builtin/sram", "compatible", prop_cstr("mpc5200b-sram\0mpc5200-sram") }, + { "/builtin/sram", "device_type", prop_cstr("sram") }, + {} + }; +#undef prop_cstr
What about making all of the above const ? Also I wonder wether it's useful to mark the tables as static and __initdata too...
arch/powerpc/kernel/prom_init.c #else · line 2174
Quoted 6 lines
arch/powerpc/kernel/prom_init.c +6
-0+ + rv =prom_getprop (node,"model" , prop,sizeof (prop)); +if (rv ==PROM_ERROR ) +return ; +if (strcmp (prop,"EFIKA5K2" )) +return ;
Is there a version in their device-tree ? We might want to check in case they ever fix it ...
Ben.
Re: [PATCH 02/10] powerpc: Add device tree fixups for the EFIKA
Quoted 21 lines · Benjamin Herrenschmidt
Quoted 21 lines
arch/powerpc/kernel/prom_init.c +21
-0+static void __init fixup_device_tree_efika (void ) +{ +/* Substitution table */ +#define prop_cstr (x) x, sizeof(x) +int prop_sound_irq[3 ] = {2 ,2 ,0 }; +int prop_bcomm_irq[3 *16 ] = {3 ,0 ,0 ,3 ,1 ,0 ,3 ,2 ,0 ,3 ,3 ,0 , +3 ,4 ,0 ,3 ,5 ,0 ,3 ,6 ,0 ,3 ,7 ,0 , +3 ,8 ,0 ,3 ,9 ,0 ,3 ,10 ,0 ,3 ,11 ,0 , +3 ,12 ,0 ,3 ,13 ,0 ,3 ,14 ,0 ,3 ,15 ,0 }; +struct subst_entry efika_subst_table[] = { + {"/" ,"device_type" ,prop_cstr ("efika" ) }, + {"/builtin" ,"compatible" ,prop_cstr ("soc" ) }, + {"/builtin/ata" ,"compatible" ,prop_cstr ("mpc5200b-ata\0mpc5200-ata" ), }, + {"/builtin/bestcomm" ,"compatible" ,prop_cstr ("mpc5200b-bestcomm\0mpc5200-bestcomm" ) }, + {"/builtin/bestcomm" ,"interrupts" , prop_bcomm_irq,sizeof (prop_bcomm_irq) }, + {"/builtin/ethernet" ,"compatible" ,prop_cstr ("mpc5200b-fec\0mpc5200-fec" ) }, + {"/builtin/pic" ,"compatible" ,prop_cstr ("mpc5200b-pic\0mpc5200-pic" ) }, + {"/builtin/serial" ,"compatible" ,prop_cstr ("mpc5200b-psc-uart\0mpc5200-psc-uart" ) }, + {"/builtin/sound" ,"compatible" ,prop_cstr ("mpc5200b-psc-ac97\0mpc5200-psc-ac97" ) }, + {"/builtin/sound" ,"interrupts" , prop_sound_irq,sizeof (prop_sound_irq) }, + {"/builtin/sram" ,"compatible" ,prop_cstr ("mpc5200b-sram\0mpc5200-sram" ) },
Quoted 9 lines
arch/powerpc/kernel/prom_init.c #else · line 2158
Quoted 5 lines
arch/powerpc/kernel/prom_init.c +4
-0+ { "/builtin/sram", "device_type", prop_cstr("sram") }, + {} + }; +#undef prop_cstrWhat about making all of the above const ? Also I wonder wether it's useful to mark the tables as static and
__initdatatoo...
Interesting remark.
The const might cause a warning because prop_set_prop takes a void *value and not
a const void *value. I don't know if does need to modify the value or not though.
About static, that might achieve the same effect as const without the warning and since the function is called only once anyway ...
I would have hoped that being local to a __init function the memory for the initial values would be freed but I might me over optimistic.
Quoted 11 lines
arch/powerpc/kernel/prom_init.c #else · line 2174
Quoted 7 lines
arch/powerpc/kernel/prom_init.c +6
-0+ + rv =prom_getprop (node,"model" , prop,sizeof (prop)); +if (rv ==PROM_ERROR ) +return ; +if (strcmp (prop,"EFIKA5K2" )) +return ;Is there a version in their device-tree ? We might want to check in case they ever fix it ...
Yes there is a "revision" that's "2B3" for the moment. I'm not too sure if it's a firmware
revision or a board revision though ...
Sylvain
Re: [PATCH 02/10] powerpc: Add device tree fixups for the EFIKA
Quoted 5 lines
The const might cause a warning because
prop_set_proptakes a void *value and not
a const void *value. I don't know if does need to modify the value or not though.
Ok, there's room for another patch to constify prom_set_prop and all callers then :-)
Quoted 5 lines
About static, that might achieve the same effect as const without the warning and since the function is called only once anyway ...
I would have hoped that being local to a
__initfunction the memory for the initial values would be freed but I might me over optimistic.
Yeah, worth checking the ELF output but I think you are over optimistic :-)
Quoted 12 lines
Quoted 12 lines
arch/powerpc/kernel/prom_init.c #else · line 2174
Quoted 8 lines
arch/powerpc/kernel/prom_init.c +6
-0+ + rv =prom_getprop (node,"model" , prop,sizeof (prop)); +if (rv ==PROM_ERROR ) +return ; +if (strcmp (prop,"EFIKA5K2" )) +return ;Is there a version in their device-tree ? We might want to check in case they ever fix it ...
Quoted 3 lines
Yes there is a "revision" that's "2B3" for the moment. I'm not too sure if it's a firmware
revision or a board revision though ...
Hrm... let's ignore it for now, we can always fixup the fixups if necessary :-)
Ben.
Re: [PATCH 02/10] powerpc: Add device tree fixups for the EFIKA
Quoted 7 lines
Quoted 4 lines
The const might cause a warning because
prop_set_proptakes a void *value and not
a const void *value. I don't know if does need to modify the value or not though.Ok, there's room for another patch to constify
prom_set_propand all callers then :-)
No callers should need changing. If they do then that's some bonus bugs fixed ;-)
Quoted 5 lines
Quoted 2 lines
I would have hoped that being local to a
__initfunction the memory for the initial values would be freed but I might me over optimistic.Yeah, worth checking the ELF output but I think you are over optimistic :-)
There is nothing that makes data in a function in the .init.text section automagically end up in the .init.data section -- those names are just names, for all the tools involved, with no attached meaning.
Segher
Re: [PATCH 01/10] powerpc/serial: Dispose irq mapping when done in mpc52xx_serial.c
In reply to Sylvain MunautQuoted 11 lines · Sylvain Munaut
Signed-off-by Sylvain Munaut <[email protected]>Acked-by Grant Likely <[email protected]>--- drivers/serial/mpc52xx_uart.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)drivers/serial/mpc52xx_uart.c +0
-0
drivers/serial/mpc52xx_uart.c mpc52xx_uart_of_remove(struct of_device · line 1006
Quoted 8 lines
drivers/serial/mpc52xx_uart.c +3
-0@@ -999,6 +999,9 @@ mpc52xx_uart_of_remove(struct of_deviceif (port)uart_remove_one_port (&mpc52xx_uart_driver, port); +if (port->irq !=NO_IRQ ) +irq_dispose_mapping (port->irq); +return 0 ; }
The NO_IRQ test isn't useful.
Cheers,
Ben
PATCH 1/1 powerpc/serial: Dispose irq mapping when done in mpc52xx_serial.c
In reply to Sylvain Munaut---
Hi Paulus,
This is a 'fixed' version of the uart patch. The test on port->irq != NO_IRQ is removed. But I added a check for port because it might be NULL ...
Sylvain
--- drivers/serial/mpc52xx_uart.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/serial/mpc52xx_uart.c +3 -1
@@ -995,8 +995,10 @@ mpc52xx_uart_of_remove(struct of_devicestruct uart_port *port =dev_get_drvdata (&op->dev);dev_set_drvdata (&op->dev,NULL ); -if (port) +if (port) {uart_remove_one_port (&mpc52xx_uart_driver, port); +irq_dispose_mapping (port->irq); + }return 0 ; }
Signature · 1 line
1.4.2