| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * arch/powerpc/platforms/embedded6xx/wii.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Nintendo Wii board-specific support |
|---|
| 5 | 6 | * Copyright (C) 2008-2009 The GameCube Linux Team |
|---|
| 6 | 7 | * Copyright (C) 2008,2009 Albert Herranz |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or |
|---|
| 9 | | - * modify it under the terms of the GNU General Public License |
|---|
| 10 | | - * as published by the Free Software Foundation; either version 2 |
|---|
| 11 | | - * of the License, or (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | 8 | */ |
|---|
| 14 | 9 | #define DRV_MODULE_NAME "wii" |
|---|
| 15 | 10 | #define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt |
|---|
| .. | .. |
|---|
| 54 | 49 | static void __iomem *hw_ctrl; |
|---|
| 55 | 50 | static void __iomem *hw_gpio; |
|---|
| 56 | 51 | |
|---|
| 57 | | -unsigned long wii_hole_start; |
|---|
| 58 | | -unsigned long wii_hole_size; |
|---|
| 59 | | - |
|---|
| 60 | | - |
|---|
| 61 | 52 | static int __init page_aligned(unsigned long x) |
|---|
| 62 | 53 | { |
|---|
| 63 | 54 | return !(x & (PAGE_SIZE-1)); |
|---|
| .. | .. |
|---|
| 69 | 60 | |
|---|
| 70 | 61 | BUG_ON(memblock.memory.cnt != 2); |
|---|
| 71 | 62 | BUG_ON(!page_aligned(p[0].base) || !page_aligned(p[1].base)); |
|---|
| 72 | | - |
|---|
| 73 | | - /* determine hole */ |
|---|
| 74 | | - wii_hole_start = ALIGN(p[0].base + p[0].size, PAGE_SIZE); |
|---|
| 75 | | - wii_hole_size = p[1].base - wii_hole_start; |
|---|
| 76 | | -} |
|---|
| 77 | | - |
|---|
| 78 | | -unsigned long __init wii_mmu_mapin_mem2(unsigned long top) |
|---|
| 79 | | -{ |
|---|
| 80 | | - unsigned long delta, size, bl; |
|---|
| 81 | | - unsigned long max_size = (256<<20); |
|---|
| 82 | | - |
|---|
| 83 | | - /* MEM2 64MB@0x10000000 */ |
|---|
| 84 | | - delta = wii_hole_start + wii_hole_size; |
|---|
| 85 | | - size = top - delta; |
|---|
| 86 | | - |
|---|
| 87 | | - if (__map_without_bats) |
|---|
| 88 | | - return delta; |
|---|
| 89 | | - |
|---|
| 90 | | - for (bl = 128<<10; bl < max_size; bl <<= 1) { |
|---|
| 91 | | - if (bl * 2 > size) |
|---|
| 92 | | - break; |
|---|
| 93 | | - } |
|---|
| 94 | | - setbat(4, PAGE_OFFSET+delta, delta, bl, PAGE_KERNEL_X); |
|---|
| 95 | | - return delta + bl; |
|---|
| 96 | 63 | } |
|---|
| 97 | 64 | |
|---|
| 98 | 65 | static void __noreturn wii_spin(void) |
|---|
| .. | .. |
|---|
| 116 | 83 | } |
|---|
| 117 | 84 | error = of_address_to_resource(np, 0, &res); |
|---|
| 118 | 85 | if (error) { |
|---|
| 119 | | - pr_err("no valid reg found for %s\n", np->name); |
|---|
| 86 | + pr_err("no valid reg found for %pOFn\n", np); |
|---|
| 120 | 87 | goto out_put; |
|---|
| 121 | 88 | } |
|---|
| 122 | 89 | |
|---|
| 123 | 90 | hw_regs = ioremap(res.start, resource_size(&res)); |
|---|
| 124 | 91 | if (hw_regs) { |
|---|
| 125 | | - pr_info("%s at 0x%08x mapped to 0x%p\n", name, |
|---|
| 126 | | - res.start, hw_regs); |
|---|
| 92 | + pr_info("%s at 0x%pa mapped to 0x%p\n", name, |
|---|
| 93 | + &res.start, hw_regs); |
|---|
| 127 | 94 | } |
|---|
| 128 | 95 | |
|---|
| 129 | 96 | out_put: |
|---|
| .. | .. |
|---|
| 205 | 172 | flipper_quiesce(); |
|---|
| 206 | 173 | } |
|---|
| 207 | 174 | |
|---|
| 208 | | -define_machine(wii) { |
|---|
| 209 | | - .name = "wii", |
|---|
| 210 | | - .probe = wii_probe, |
|---|
| 211 | | - .setup_arch = wii_setup_arch, |
|---|
| 212 | | - .restart = wii_restart, |
|---|
| 213 | | - .halt = wii_halt, |
|---|
| 214 | | - .init_IRQ = wii_pic_probe, |
|---|
| 215 | | - .get_irq = flipper_pic_get_irq, |
|---|
| 216 | | - .calibrate_decr = generic_calibrate_decr, |
|---|
| 217 | | - .progress = udbg_progress, |
|---|
| 218 | | - .machine_shutdown = wii_shutdown, |
|---|
| 219 | | -}; |
|---|
| 220 | | - |
|---|
| 221 | 175 | static const struct of_device_id wii_of_bus[] = { |
|---|
| 222 | 176 | { .compatible = "nintendo,hollywood", }, |
|---|
| 223 | 177 | { }, |
|---|
| .. | .. |
|---|
| 233 | 187 | } |
|---|
| 234 | 188 | device_initcall(wii_device_probe); |
|---|
| 235 | 189 | |
|---|
| 190 | +define_machine(wii) { |
|---|
| 191 | + .name = "wii", |
|---|
| 192 | + .probe = wii_probe, |
|---|
| 193 | + .setup_arch = wii_setup_arch, |
|---|
| 194 | + .restart = wii_restart, |
|---|
| 195 | + .halt = wii_halt, |
|---|
| 196 | + .init_IRQ = wii_pic_probe, |
|---|
| 197 | + .get_irq = flipper_pic_get_irq, |
|---|
| 198 | + .calibrate_decr = generic_calibrate_decr, |
|---|
| 199 | + .progress = udbg_progress, |
|---|
| 200 | + .machine_shutdown = wii_shutdown, |
|---|
| 201 | +}; |
|---|