powermac: clean up PIC initialisation code
Subsystems (2)
PATCH 1/1 powermac: clean up PIC initialisation code
This patch cleans up the powermac PIC initialisation code so that for G5 powermacs we don't even compile the old pmac pic file.
---
And all I was trying to do is implement a proper suspend/resume handler for mpic... still haven't figured that out though I wonder how it works on my powerbook...
arch/powerpc/platforms/powermac/Makefile +3 -3
@@ -1,6 +1,6 @@ CFLAGS_bootx_init.o += -fPIC -obj-y += pic.o setup.o time.o feature.o pci.o \ +obj-y += setup.o time.o feature.o pci.o \ sleep.o low_i2c.o cache.o pfunc_core.o \ pfunc_base.o obj-$(CONFIG_PMAC_BACKLIGHT) += backlight.o
@@ -8,7 +8,7 @@ obj-$(CONFIG_CPU_FREQ_PMAC) += cpufreq_3 obj-$(CONFIG_CPU_FREQ_PMAC64) += cpufreq_64.o obj-$(CONFIG_NVRAM) += nvram.o # ppc64 pmac doesn't define CONFIG_NVRAM but needs nvram stuff -obj-$(CONFIG_PPC64) += nvram.o -obj-$(CONFIG_PPC32) += bootx_init.o +obj-$(CONFIG_PPC64) += nvram.o mpic.o +obj-$(CONFIG_PPC32) += bootx_init.o pic.o mpic.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_PPC_MERGE) += udbg_scc.o udbg_adb.o
arch/powerpc/platforms/powermac/mpic.c new file +148 -0
148 lines not on this page · raw message
arch/powerpc/platforms/powermac/pic.c +5 -150
220 lines not on this page · raw message
arch/powerpc/platforms/powermac/pmac.h +2 -0
@@ -45,5 +45,7 @@ extern void pmac_ide_init_hwif_ports(hw_extern int pmac_nvram_init (void );extern void pmac_pic_init (void ); +extern void pmac_mpic_init (void ); +extern int pmac_pic_probe_mpic (void );#endif /* __PMAC_H__ */
arch/powerpc/platforms/powermac/setup.c +4 -0
@@ -756,7 +756,11 @@ define_machine(powermac) { .setup_arch = pmac_setup_arch, .init_early = pmac_init_early, .show_cpuinfo = pmac_show_cpuinfo, +#ifdef CONFIG_PPC32 .init_IRQ = pmac_pic_init, +#else + .init_IRQ = pmac_mpic_init, +#endif .get_irq =NULL ,/* changed later */ .pci_irq_fixup = pmac_pci_irq_fixup, .restart = pmac_restart,
arch/powerpc/platforms/powermac/setup.c define_machine(powermac) { · line 763
Quoted 12 lines
arch/powerpc/platforms/powermac/setup.c +4
-0@@ -756,7 +756,11 @@ define_machine(powermac) { .setup_arch = pmac_setup_arch, .init_early = pmac_init_early, .show_cpuinfo = pmac_show_cpuinfo, +#ifdef CONFIG_PPC32 .init_IRQ = pmac_pic_init, +#else + .init_IRQ = pmac_mpic_init, +#endif
Not fan of having an ifdef here... I'd rather have a pmac_pic_init() that does the right thing, maybe in setup.c
Ben.
Quoted 2 lines · Benjamin Herrenschmidt
Not fan of having an ifdef here... I'd rather have a
pmac_pic_init()that does the right thing, maybe insetup.c
Ok. From what I can tell it isn't necessary to call of_irq_map_init() on newer machines that have an IBM mpic2. So how about this?
arch/powerpc/platforms/powermac/Makefile +3 -3
@@ -1,6 +1,6 @@ CFLAGS_bootx_init.o += -fPIC -obj-y += pic.o setup.o time.o feature.o pci.o \ +obj-y += setup.o time.o feature.o pci.o \ sleep.o low_i2c.o cache.o pfunc_core.o \ pfunc_base.o obj-$(CONFIG_PMAC_BACKLIGHT) += backlight.o
@@ -8,7 +8,7 @@ obj-$(CONFIG_CPU_FREQ_PMAC) += cpufreq_3 obj-$(CONFIG_CPU_FREQ_PMAC64) += cpufreq_64.o obj-$(CONFIG_NVRAM) += nvram.o # ppc64 pmac doesn't define CONFIG_NVRAM but needs nvram stuff -obj-$(CONFIG_PPC64) += nvram.o -obj-$(CONFIG_PPC32) += bootx_init.o +obj-$(CONFIG_PPC64) += nvram.o mpic.o +obj-$(CONFIG_PPC32) += bootx_init.o pic.o mpic.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_PPC_MERGE) += udbg_scc.o udbg_adb.o
arch/powerpc/platforms/powermac/mpic.c new file +143 -0
143 lines not on this page · raw message
arch/powerpc/platforms/powermac/pic.c +5 -156
223 lines not on this page · raw message
arch/powerpc/platforms/powermac/pmac.h +1 -0
@@ -45,5 +45,6 @@ extern void pmac_ide_init_hwif_ports(hw_extern int pmac_nvram_init (void );extern void pmac_pic_init (void ); +extern int pmac_pic_probe_mpic (void );#endif /* __PMAC_H__ */
arch/powerpc/platforms/powermac/setup.c +16 -1
@@ -718,13 +718,28 @@ static int pmac_pci_probe_mode(struct pc }#endif +static void __init pmac_init_irq (void ) +{ +int ret; + +/* We first try to detect Apple's new Core99 chipset, since mac-io +* is quite different on those machines and contains an IBM MPIC2. +*/ + ret =pmac_pic_probe_mpic (); + +#ifdef CONFIG_PPC32 +if (!ret) +pmac_pic_init (); +#endif +} +define_machine (powermac) { .name = "PowerMac", .probe = pmac_probe, .setup_arch = pmac_setup_arch, .init_early = pmac_init_early, .show_cpuinfo = pmac_show_cpuinfo, - .init_IRQ = pmac_pic_init, + .init_IRQ = pmac_init_irq, .get_irq = NULL, /* changed later */ .pci_irq_fixup = pmac_pci_irq_fixup, .restart = pmac_restart,
Quoted 7 lines · Johannes Berg
Quoted 2 lines · Benjamin Herrenschmidt
Not fan of having an ifdef here... I'd rather have a
pmac_pic_init()that does the right thing, maybe insetup.cOk. From what I can tell it isn't necessary to call
of_irq_map_init()on newer machines that have an IBM mpic2. So how about this?
Ignore for now, seems I broke something and I can't find what or why right now.
johannes