wii.c (d8a382d2662822248a97ce9d670b90e68aefbd3a) wii.c (95f72d1ed41a66f1c1c29c24d479de81a0bea36f)
1/*
2 * arch/powerpc/platforms/embedded6xx/wii.c
3 *
4 * Nintendo Wii board-specific support
5 * Copyright (C) 2008-2009 The GameCube Linux Team
6 * Copyright (C) 2008,2009 Albert Herranz
7 *
8 * This program is free software; you can redistribute it and/or

--- 6 unchanged lines hidden (view full) ---

15#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/irq.h>
20#include <linux/seq_file.h>
21#include <linux/kexec.h>
22#include <linux/of_platform.h>
1/*
2 * arch/powerpc/platforms/embedded6xx/wii.c
3 *
4 * Nintendo Wii board-specific support
5 * Copyright (C) 2008-2009 The GameCube Linux Team
6 * Copyright (C) 2008,2009 Albert Herranz
7 *
8 * This program is free software; you can redistribute it and/or

--- 6 unchanged lines hidden (view full) ---

15#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/irq.h>
20#include <linux/seq_file.h>
21#include <linux/kexec.h>
22#include <linux/of_platform.h>
23#include <linux/lmb.h>
23#include <linux/memblock.h>
24#include <mm/mmu_decl.h>
25
26#include <asm/io.h>
27#include <asm/machdep.h>
28#include <asm/prom.h>
29#include <asm/time.h>
30#include <asm/udbg.h>
31

--- 28 unchanged lines hidden (view full) ---

60
61static int __init page_aligned(unsigned long x)
62{
63 return !(x & (PAGE_SIZE-1));
64}
65
66void __init wii_memory_fixups(void)
67{
24#include <mm/mmu_decl.h>
25
26#include <asm/io.h>
27#include <asm/machdep.h>
28#include <asm/prom.h>
29#include <asm/time.h>
30#include <asm/udbg.h>
31

--- 28 unchanged lines hidden (view full) ---

60
61static int __init page_aligned(unsigned long x)
62{
63 return !(x & (PAGE_SIZE-1));
64}
65
66void __init wii_memory_fixups(void)
67{
68 struct lmb_property *p = lmb.memory.region;
68 struct memblock_property *p = memblock.memory.region;
69
70 /*
71 * This is part of a workaround to allow the use of two
72 * discontinuous RAM ranges on the Wii, even if this is
73 * currently unsupported on 32-bit PowerPC Linux.
74 *
75 * We coalesce the two memory ranges of the Wii into a
76 * single range, then create a reservation for the "hole"
77 * between both ranges.
78 */
79
69
70 /*
71 * This is part of a workaround to allow the use of two
72 * discontinuous RAM ranges on the Wii, even if this is
73 * currently unsupported on 32-bit PowerPC Linux.
74 *
75 * We coalesce the two memory ranges of the Wii into a
76 * single range, then create a reservation for the "hole"
77 * between both ranges.
78 */
79
80 BUG_ON(lmb.memory.cnt != 2);
80 BUG_ON(memblock.memory.cnt != 2);
81 BUG_ON(!page_aligned(p[0].base) || !page_aligned(p[1].base));
82
83 p[0].size = _ALIGN_DOWN(p[0].size, PAGE_SIZE);
84 p[1].size = _ALIGN_DOWN(p[1].size, PAGE_SIZE);
85
86 wii_hole_start = p[0].base + p[0].size;
87 wii_hole_size = p[1].base - wii_hole_start;
88
89 pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size);
90 pr_info("HOLE: <%08lx %08lx>\n", wii_hole_start, wii_hole_size);
91 pr_info("MEM2: <%08llx %08llx>\n", p[1].base, p[1].size);
92
93 p[0].size += wii_hole_size + p[1].size;
94
81 BUG_ON(!page_aligned(p[0].base) || !page_aligned(p[1].base));
82
83 p[0].size = _ALIGN_DOWN(p[0].size, PAGE_SIZE);
84 p[1].size = _ALIGN_DOWN(p[1].size, PAGE_SIZE);
85
86 wii_hole_start = p[0].base + p[0].size;
87 wii_hole_size = p[1].base - wii_hole_start;
88
89 pr_info("MEM1: <%08llx %08llx>\n", p[0].base, p[0].size);
90 pr_info("HOLE: <%08lx %08lx>\n", wii_hole_start, wii_hole_size);
91 pr_info("MEM2: <%08llx %08llx>\n", p[1].base, p[1].size);
92
93 p[0].size += wii_hole_size + p[1].size;
94
95 lmb.memory.cnt = 1;
96 lmb_analyze();
95 memblock.memory.cnt = 1;
96 memblock_analyze();
97
98 /* reserve the hole */
97
98 /* reserve the hole */
99 lmb_reserve(wii_hole_start, wii_hole_size);
99 memblock_reserve(wii_hole_start, wii_hole_size);
100
101 /* allow ioremapping the address space in the hole */
102 __allow_ioremap_reserved = 1;
103}
104
105unsigned long __init wii_mmu_mapin_mem2(unsigned long top)
106{
107 unsigned long delta, size, bl;

--- 161 unchanged lines hidden ---
100
101 /* allow ioremapping the address space in the hole */
102 __allow_ioremap_reserved = 1;
103}
104
105unsigned long __init wii_mmu_mapin_mem2(unsigned long top)
106{
107 unsigned long delta, size, bl;

--- 161 unchanged lines hidden ---