macio modalias & mpc52xx related patches for 2.6.22
Subsystems (5)
Hello Paul,
Here's the patch I'd like to see merged for 2.6.22
The first one fixs the remaining autoload problems that appeared with the uevent stuff. It has been tested by me, Johannes & benh.
The second & third are just a clean up to avoid discrepency in the modalias generation (the same string was generated differently at several place). They work fine on my G5.
The rest of the series are patch I received on the -embedded list, they've been reviewed/tested by at least either Grant or me.
Sylvain
PATCH 1/8 powerpc: Fix the MODALIAS generation in modpost for of devices
Since the devices may have multiple (or none) compatible properties, the uevent generated internally by the kernel may have multiple "C..." entries. So the MODALIAS stored in the module must have wilcard before and after the compatible entry.
Also, if the 'compatible' field is not used for matching, there will be no 'C' and that must handled as well.
The previous code handled all those case incorrectly and it "mostly" worked ... but not always.
--- scripts/mod/file2alias.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
scripts/mod/file2alias.c +8 -3
@@ -354,11 +354,16 @@ static int do_pcmcia_entry(const char *filename,static int do_of_entry (const char *filename,struct of_device_id *of,char *alias) { +int len;char *tmp; -sprintf (alias,"of:N%sT%sC%s" , + len =sprintf (alias,"of:N%sT%s" , of->name[0 ] ? of->name :"*" , - of->type[0 ] ? of->type :"*" , - of->compatible[0 ] ? of->compatible :"*" ); + of->type[0 ] ? of->type :"*" ); + +if (of->compatible[0 ]) +sprintf (&alias[len],"%sC%s" , + of->type[0 ] ?"*" :"" , + of->compatible);/* Replace all whitespace with underscores */ for (tmp = alias; tmp && *tmp; tmp++)
Signature · 1 line
1.5.1.2
PATCH 2/8 powerpc: export of_device_get_modalias
Apparently other parts of the kernel need to know the modalias internally (like the sysfs code in macintosh driver).
To avoid consistency issues, we export this code and use it everywhere it's needed rather than repeat it ...
--- arch/powerpc/kernel/of_device.c | 5 +++-- include/asm-powerpc/of_device.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/kernel/of_device.c +3 -2
@@ -120,8 +120,8 @@ void of_device_unregister(struct of_device *ofdev) } -static ssize_t of_device_get_modalias (struct of_device *ofdev, -char *str,ssize_t len) +ssize_t of_device_get_modalias (struct of_device *ofdev, +char *str,ssize_t len) {const char *compat;int cplen, i;
@@ -239,3 +239,4 @@ EXPORT_SYMBOL(of_dev_get);EXPORT_SYMBOL (of_dev_put);EXPORT_SYMBOL (of_release_dev);EXPORT_SYMBOL (of_device_uevent); +EXPORT_SYMBOL (of_device_get_modalias);
include/asm-powerpc/of_device.h +2 -0
@@ -32,6 +32,8 @@ extern int of_device_register(struct of_device *ofdev);extern void of_device_unregister (struct of_device *ofdev);extern void of_release_dev (struct device *dev); +extern ssize_t of_device_get_modalias (struct of_device *ofdev, +char *str,ssize_t len);extern int of_device_uevent (struct device *dev,char **envp,int num_envp,char *buffer,int buffer_size);
Signature · 1 line
1.5.1.2
PATCH 3/8 macintosh: Use common modalias generation for macio_sysfs
There is now a common function to generate the modalias string, so use it. We just need to add the \n at the end.
--- drivers/macintosh/macio_sysfs.c | 29 ++++++++--------------------- 1 files changed, 8 insertions(+), 21 deletions(-)
drivers/macintosh/macio_sysfs.c +8 -21
@@ -40,29 +40,16 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)static ssize_t modalias_show (struct device *dev,struct device_attribute *attr,char *buf) -{ -struct of_device *of; -const char *compat; -int cplen; -int length; +{ +struct of_device *ofdev =to_of_device (dev); +int len; - of = &to_macio_device (dev)->ofdev; - compat =of_get_property (of->node,"compatible" , &cplen); -if (!compat) compat ="" , cplen =1 ; - length =sprintf (buf,"of:N%sT%s" , of->node->name, of->node->type); - buf += length; -while (cplen >0 ) { -int l; - l =sprintf (buf,"C%s" , compat); - length += l; - buf += l; - l =strlen (compat) +1 ; - compat += l; - cplen -= l; - } - length +=sprintf (buf,"\n" ); + len =of_device_get_modalias (ofdev, buf,PAGE_SIZE ); -return length; + buf[len] ='\n' ; + buf[len+1 ] =0 ; + +return len+1 ; }macio_config_of_attr (name,"%s\n" );
Signature · 1 line
1.5.1.2
PATCH 4/8 powerpc: lite5200(b) dts fixes
From: Domen Puncer <[email protected]>
Three trivial DTS fixes:
-Mark Lite5200(b) boards as "mpc5200" compatible. On efika the
firmware already does that.
-Fix mscan interrupt.
-Fix wakeup GPIO address.
--- arch/powerpc/boot/dts/lite5200.dts | 5 +++-- arch/powerpc/boot/dts/lite5200b.dts | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/powerpc/boot/dts/lite5200.dts +3 -2
@@ -48,6 +48,7 @@ soc5200@f0000000 { model = "fsl,mpc5200"; + compatible = "mpc5200"; revision = "" // from bootloader #interrupt-cells = <3>; device_type = "soc";
@@ -166,7 +167,7 @@ device_type = "mscan"; compatible = "mpc5200-mscan"; cell-index = <1>; - interrupts = <1 12 0>; + interrupts = <2 12 0>; interrupt-parent = <500>; reg = <980 80>; };
@@ -178,7 +179,7 @@ interrupt-parent = <500>; }; - gpio-wkup@b00 { + gpio-wkup@c00 { compatible = "mpc5200-gpio-wkup"; reg = <c00 40>; interrupts = <1 8 0 0 3 0>;
arch/powerpc/boot/dts/lite5200b.dts +3 -2
@@ -48,6 +48,7 @@ soc5200@f0000000 { model = "fsl,mpc5200b"; + compatible = "mpc5200"; revision = ""; // from bootloader #interrupt-cells = <3>; device_type = "soc";
@@ -166,7 +167,7 @@ device_type = "mscan"; compatible = "mpc5200b-mscan\0mpc5200-mscan"; cell-index = <1>; - interrupts = <1 12 0>; + interrupts = <2 12 0>; interrupt-parent = <500>; reg = <980 80>; };
@@ -178,7 +179,7 @@ interrupt-parent = <500>; }; - gpio-wkup@b00 { + gpio-wkup@c00 { compatible = "mpc5200b-gpio-wkup\0mpc5200-gpio-wkup"; reg = <c00 40>; interrupts = <1 8 0 0 3 0>;
Signature · 1 line
1.5.1.2
PATCH 5/8 powerpc: lite5200(b) support for i2c
From: Domen Puncer <[email protected]>
Add fsl-i2c to mpc5200 i2c node in device tree, and enable FSL_SOC.
Tested to work with built-in eeprom on lite5200b.
--- arch/powerpc/boot/dts/lite5200.dts | 6 ++++-- arch/powerpc/boot/dts/lite5200b.dts | 6 ++++-- arch/powerpc/platforms/52xx/Kconfig | 1 + 3 files changed, 9 insertions(+), 4 deletions(-)
arch/powerpc/boot/dts/lite5200.dts +4 -2
@@ -318,20 +318,22 @@ i2c@3d00 { device_type = "i2c"; - compatible = "mpc5200-i2c"; + compatible = "mpc5200-i2c\0fsl-i2c"; cell-index = <0>; reg = <3d00 40>; interrupts = <2 f 0>; interrupt-parent = <500>; + fsl5200-clocking; }; i2c@3d40 { device_type = "i2c"; - compatible = "mpc5200-i2c"; + compatible = "mpc5200-i2c\0fsl-i2c"; cell-index = <1>; reg = <3d40 40>; interrupts = <2 10 0>; interrupt-parent = <500>; + fsl5200-clocking; }; sram@8000 { device_type = "sram";
arch/powerpc/boot/dts/lite5200b.dts +4 -2
@@ -323,20 +323,22 @@ i2c@3d00 { device_type = "i2c"; - compatible = "mpc5200b-i2c\0mpc5200-i2c"; + compatible = "mpc5200b-i2c\0mpc5200-i2c\0fsl-i2c"; cell-index = <0>; reg = <3d00 40>; interrupts = <2 f 0>; interrupt-parent = <500>; + fsl5200-clocking; }; i2c@3d40 { device_type = "i2c"; - compatible = "mpc5200b-i2c\0mpc5200-i2c"; + compatible = "mpc5200b-i2c\0mpc5200-i2c\0fsl-i2c"; cell-index = <1>; reg = <3d40 40>; interrupts = <2 10 0>; interrupt-parent = <500>; + fsl5200-clocking; }; sram@8000 { device_type = "sram";
arch/powerpc/platforms/52xx/Kconfig +1 -0
@@ -1,5 +1,6 @@ config PPC_MPC52xx bool + select FSL_SOC default n config PPC_MPC5200
Signature · 1 line
1.5.1.2
PATCH 6/8 powerpc: Set efika's device_type to "soc"
From: Domen Puncer <[email protected]>
Device type should be "soc" (as in lite5200.dts), compatible is already set to "mpc5200".
--- arch/powerpc/kernel/prom_init.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/kernel/prom_init.c +1 -1
@@ -2153,7 +2153,7 @@ static void __init fixup_device_tree_efika(void) 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" ,"device_type" ,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) },
Signature · 1 line
1.5.1.2
PATCH 7/8 serial/powerpc: Don't shutdown TX on mpc5200 serial port if it is a console
From: Grant Likely <[email protected]>
If the serial port gets shut down, then console output stalls. 9 out of 10 kernel hackers agree, this is a bad thing.
--- drivers/serial/mpc52xx_uart.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/serial/mpc52xx_uart.c +3 -2
@@ -257,9 +257,10 @@ mpc52xx_uart_shutdown(struct uart_port *port) {struct mpc52xx_psc __iomem *psc =PSC (port); -/* Shut down the port, interrupt and all */ +/* Shut down the port. Leave TX active if on a console port */ out_8 (&psc->command,MPC52xx_PSC_RST_RX); -out_8 (&psc->command,MPC52xx_PSC_RST_TX); +if (!uart_console (port)) +out_8 (&psc->command,MPC52xx_PSC_RST_TX); port->read_status_mask =0 ;out_be16 (&psc->mpc52xx_psc_imr,port->read_status_mask);
Signature · 1 line
1.5.1.2
PATCH 8/8 powerpc: mpc52xx suspend to deep-sleep
From: Domen Puncer <[email protected]>
Implement deep-sleep on MPC52xx.
SDRAM is put into self-refresh with help of SRAM code (alternatives would be code in FLASH, I-cache). Interrupt code must also not be in SDRAM, so put it in I-cache.
MPC52xx core is static, so contents will remain intact even with clocks turned off.
--- arch/powerpc/platforms/52xx/Makefile | 2 + arch/powerpc/platforms/52xx/efika.c | 15 ++ arch/powerpc/platforms/52xx/lite5200.c | 28 ++++ arch/powerpc/platforms/52xx/mpc52xx_pm.c | 191 +++++++++++++++++++++++++++ arch/powerpc/platforms/52xx/mpc52xx_sleep.S | 154 +++++++++++++++++++++ include/asm-powerpc/mpc52xx.h | 11 ++ 6 files changed, 401 insertions(+), 0 deletions(-) create mode 100644 arch/powerpc/platforms/52xx/mpc52xx_pm.c create mode 100644 arch/powerpc/platforms/52xx/mpc52xx_sleep.S
arch/powerpc/platforms/52xx/Makefile +2 -0
@@ -8,3 +8,5 @@ endif obj-$(CONFIG_PPC_EFIKA) += efika.o obj-$(CONFIG_PPC_LITE5200) += lite5200.o + +obj-$(CONFIG_PM) += mpc52xx_sleep.o mpc52xx_pm.o
arch/powerpc/platforms/52xx/efika.c +15 -0
@@ -184,6 +184,16 @@ static void efika_show_cpuinfo(struct seq_file *m)of_node_put (root); } +#ifdef CONFIG_PM +static void efika_suspend_prepare (void __iomem *mbar) +{ +u8 pin =4 ;/* GPIO_WKUP_4 (GPIO_PSC6_0 - IRDA_RX) */ +u8 level =1 ;/* wakeup on high level */ +/* IOW. to wake it up, short pins 1 and 3 on IRDA connector */ +mpc52xx_set_wakeup_gpio (pin, level); +} +#endif +static void __init efika_setup_arch (void ) {rtas_initialize ();
@@ -199,6 +209,11 @@ static void __init efika_setup_arch(void)efika_pcisetup (); +#ifdef CONFIG_PM + mpc52xx_suspend.board_suspend_prepare = efika_suspend_prepare; +mpc52xx_pm_init (); +#endif +if (ppc_md.progress) ppc_md.progress ("Linux/PPC " UTS_RELEASE " running on Efika ;-)\n" ,0x0 ); }
arch/powerpc/platforms/52xx/lite5200.c +28 -0
@@ -85,6 +85,28 @@ error:iounmap (gpio); } +#ifdef CONFIG_PM +static u32 descr_a; +static void lite5200_suspend_prepare (void __iomem *mbar) +{ +u8 pin =1 ;/* GPIO_WKUP_1 (GPIO_PSC2_4) */ +u8 level =0 ;/* wakeup on low level */ +mpc52xx_set_wakeup_gpio (pin, level); + +/* +* power down usb port +* this needs to be called before of-ohci suspend code +*/ + descr_a =in_be32 (mbar +0x1048 ); +out_be32 (mbar +0x1048 , (descr_a & ~0x200 ) |0x100 ); +} + +static void lite5200_resume_finish (void __iomem *mbar) +{ +out_be32 (mbar +0x1048 , descr_a); +} +#endif +static void __init lite5200_setup_arch (void ) {struct device_node *np;
@@ -107,6 +129,12 @@ static void __init lite5200_setup_arch(void)mpc52xx_setup_cpu ();/* Generic */ lite5200_setup_cpu ();/* Platorm specific */ +#ifdef CONFIG_PM + mpc52xx_suspend.board_suspend_prepare = lite5200_suspend_prepare; + mpc52xx_suspend.board_resume_finish = lite5200_resume_finish; +mpc52xx_pm_init (); +#endif +#ifdef CONFIG_PCI np =of_find_node_by_type (NULL ,"pci" );if (np) {
arch/powerpc/platforms/52xx/mpc52xx_pm.c new file +191 -0
191 lines not on this page · raw message
arch/powerpc/platforms/52xx/mpc52xx_sleep.S new file +154 -0
154 lines not on this page · raw message
include/asm-powerpc/mpc52xx.h +11 -0
@@ -253,5 +253,16 @@ extern int __init mpc52xx_add_bridge(struct device_node *node);#endif /* __ASSEMBLY__ */ +#ifdef CONFIG_PM +struct mpc52xx_suspend { +void (*board_suspend_prepare)(void __iomem *mbar); +void (*board_resume_finish)(void __iomem *mbar); +}; + +extern struct mpc52xx_suspend mpc52xx_suspend; +extern int __init mpc52xx_pm_init (void ); +extern int mpc52xx_set_wakeup_gpio (u8 pin,u8 level); +#endif /* CONFIG_PM */ +#endif /* __ASM_POWERPC_MPC52xx_H__ */
Signature · 1 line
1.5.1.2
Re: [PATCH 1/8] powerpc: Fix the MODALIAS generation in modpost for of devices
In reply to Sylvain MunautQuoted 6 lines · Sylvain Munaut
Since the devices may have multiple (or none) compatible properties, the uevent generated internally by the kernel may have multiple "C..." entries. So the MODALIAS stored in the module must have wilcard before and after the compatible entry.
Also, if the 'compatible' field is not used for matching, there will be no 'C' and that must handled as well.
Ack, I really need this patch for aoa now.
johannes