X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=arch%2Fpowerpc%2Fplatforms%2Fmaple%2Fsetup.c;h=24c0aef4ea39b8497e6a5377f85f911085e67524;hb=4e8f10b7ccf1c3c53a818a157962074a7340732e;hp=7ece8983a105d2b87e50155f9a10950fd5483c57;hpb=53b2ec5518aa2623e8c0cb36f1c304a797988a46;p=linux-2.6-omap-h63xx.git diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index 7ece8983a10..24c0aef4ea3 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -70,41 +71,60 @@ #define DBG(fmt...) #endif -extern void generic_find_legacy_serial_ports(u64 *physport, - unsigned int *default_speed); +static unsigned long maple_find_nvram_base(void) +{ + struct device_node *rtcs; + unsigned long result = 0; + + /* find NVRAM device */ + rtcs = of_find_compatible_node(NULL, "nvram", "AMD8111"); + if (rtcs) { + struct resource r; + if (of_address_to_resource(rtcs, 0, &r)) { + printk(KERN_EMERG "Maple: Unable to translate NVRAM" + " address\n"); + goto bail; + } + if (!(r.flags & IORESOURCE_IO)) { + printk(KERN_EMERG "Maple: NVRAM address isn't PIO!\n"); + goto bail; + } + result = r.start; + } else + printk(KERN_EMERG "Maple: Unable to find NVRAM\n"); + bail: + of_node_put(rtcs); + return result; +} static void maple_restart(char *cmd) { unsigned int maple_nvram_base; unsigned int maple_nvram_offset; unsigned int maple_nvram_command; - struct device_node *rtcs; + struct device_node *sp; - /* find NVRAM device */ - rtcs = find_compatible_devices("nvram", "AMD8111"); - if (rtcs && rtcs->addrs) { - maple_nvram_base = rtcs->addrs[0].address; - } else { - printk(KERN_EMERG "Maple: Unable to find NVRAM\n"); - printk(KERN_EMERG "Maple: Manual Restart Required\n"); - return; - } + maple_nvram_base = maple_find_nvram_base(); + if (maple_nvram_base == 0) + goto fail; /* find service processor device */ - rtcs = find_devices("service-processor"); - if (!rtcs) { + sp = of_find_node_by_name(NULL, "service-processor"); + if (!sp) { printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); - printk(KERN_EMERG "Maple: Manual Restart Required\n"); - return; + goto fail; } - maple_nvram_offset = *(unsigned int*) get_property(rtcs, + maple_nvram_offset = *(unsigned int*) get_property(sp, "restart-addr", NULL); - maple_nvram_command = *(unsigned int*) get_property(rtcs, + maple_nvram_command = *(unsigned int*) get_property(sp, "restart-value", NULL); + of_node_put(sp); /* send command */ outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); for (;;) ; + fail: + printk(KERN_EMERG "Maple: Manual Restart Required\n"); } static void maple_power_off(void) @@ -112,33 +132,29 @@ static void maple_power_off(void) unsigned int maple_nvram_base; unsigned int maple_nvram_offset; unsigned int maple_nvram_command; - struct device_node *rtcs; + struct device_node *sp; - /* find NVRAM device */ - rtcs = find_compatible_devices("nvram", "AMD8111"); - if (rtcs && rtcs->addrs) { - maple_nvram_base = rtcs->addrs[0].address; - } else { - printk(KERN_EMERG "Maple: Unable to find NVRAM\n"); - printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); - return; - } + maple_nvram_base = maple_find_nvram_base(); + if (maple_nvram_base == 0) + goto fail; /* find service processor device */ - rtcs = find_devices("service-processor"); - if (!rtcs) { + sp = of_find_node_by_name(NULL, "service-processor"); + if (!sp) { printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); - printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); - return; + goto fail; } - maple_nvram_offset = *(unsigned int*) get_property(rtcs, + maple_nvram_offset = *(unsigned int*) get_property(sp, "power-off-addr", NULL); - maple_nvram_command = *(unsigned int*) get_property(rtcs, + maple_nvram_command = *(unsigned int*) get_property(sp, "power-off-value", NULL); + of_node_put(sp); /* send command */ outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); for (;;) ; + fail: + printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); } static void maple_halt(void) @@ -181,9 +197,6 @@ void __init maple_setup_arch(void) */ static void __init maple_init_early(void) { - unsigned int default_speed; - u64 physport; - DBG(" -> maple_init_early\n"); /* Initialize hash table, from now on, we can take hash faults @@ -191,24 +204,10 @@ static void __init maple_init_early(void) */ hpte_init_native(); - /* Find the serial port */ - generic_find_legacy_serial_ports(&physport, &default_speed); - - DBG("phys port addr: %lx\n", (long)physport); - - if (physport) { - void *comport; - /* Map the uart for udbg. */ - comport = (void *)ioremap(physport, 16); - udbg_init_uart(comport, default_speed); - - DBG("Hello World !\n"); - } - /* Setup interrupt mapping options */ ppc64_interrupt_controller = IC_OPEN_PIC; - iommu_init_early_u3(); + iommu_init_early_dart(); DBG(" <- maple_init_early\n"); } @@ -260,9 +259,10 @@ static void __init maple_progress(char *s, unsigned short hex) /* * Called very early, MMU is off, device-tree isn't unflattened */ -static int __init maple_probe(int platform) +static int __init maple_probe(void) { - if (platform != PLATFORM_MAPLE) + unsigned long root = of_get_flat_dt_root(); + if (!of_flat_dt_is_compatible(root, "Momentum,Maple")) return 0; /* * On U3, the DART (iommu) must be allocated now since it @@ -270,12 +270,13 @@ static int __init maple_probe(int platform) * occupies having to be broken up so the DART itself is not * part of the cacheable linar mapping */ - alloc_u3_dart_table(); + alloc_dart_table(); return 1; } -struct machdep_calls __initdata maple_md = { +define_machine(maple_md) { + .name = "Maple", .probe = maple_probe, .setup_arch = maple_setup_arch, .init_early = maple_init_early, @@ -291,5 +292,10 @@ struct machdep_calls __initdata maple_md = { .get_rtc_time = maple_get_rtc_time, .calibrate_decr = generic_calibrate_decr, .progress = maple_progress, - .idle_loop = native_idle, + .power_save = power4_idle, +#ifdef CONFIG_KEXEC + .machine_kexec = default_machine_kexec, + .machine_kexec_prepare = default_machine_kexec_prepare, + .machine_crash_shutdown = default_machine_crash_shutdown, +#endif };