aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/52xx/Makefile2
-rw-r--r--arch/powerpc/platforms/52xx/efika-pci.c119
-rw-r--r--arch/powerpc/platforms/52xx/efika-setup.c150
-rw-r--r--arch/powerpc/platforms/52xx/efika.c243
-rw-r--r--arch/powerpc/platforms/52xx/efika.h19
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c29
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_common.c4
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c10
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig24
-rw-r--r--arch/powerpc/platforms/83xx/Makefile3
-rw-r--r--arch/powerpc/platforms/83xx/mpc8313_rdb.c99
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_itx.c2
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_mds.c (renamed from arch/powerpc/platforms/83xx/mpc834x_sys.c)95
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.h23
-rw-r--r--arch/powerpc/platforms/83xx/mpc83xx.h18
-rw-r--r--arch/powerpc/platforms/Makefile2
-rw-r--r--arch/powerpc/platforms/cell/iommu.c5
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c102
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c12
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c177
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c6
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h4
-rw-r--r--arch/powerpc/platforms/celleb/htab.c19
-rw-r--r--arch/powerpc/platforms/celleb/pci.c12
-rw-r--r--arch/powerpc/platforms/celleb/scc_epci.c56
-rw-r--r--arch/powerpc/platforms/chrp/setup.c4
-rw-r--r--arch/powerpc/platforms/embedded6xx/linkstation.c12
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c2
-rw-r--r--arch/powerpc/platforms/iseries/mf.c6
-rw-r--r--arch/powerpc/platforms/iseries/proc.c2
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c2
-rw-r--r--arch/powerpc/platforms/powermac/setup.c4
-rw-r--r--arch/powerpc/platforms/ps3/Kconfig11
-rw-r--r--arch/powerpc/platforms/ps3/htab.c6
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c2
-rw-r--r--arch/powerpc/platforms/ps3/setup.c42
-rw-r--r--arch/powerpc/platforms/ps3/spu.c42
-rw-r--r--arch/powerpc/platforms/ps3/system-bus.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c2
-rw-r--r--arch/powerpc/platforms/pseries/hvCall_inst.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci.c4
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c3
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c2
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c2
44 files changed, 739 insertions, 648 deletions
diff --git a/arch/powerpc/platforms/52xx/Makefile b/arch/powerpc/platforms/52xx/Makefile
index 795b713ec9ee..07cdbcacf156 100644
--- a/arch/powerpc/platforms/52xx/Makefile
+++ b/arch/powerpc/platforms/52xx/Makefile
@@ -6,5 +6,5 @@ obj-y += mpc52xx_pic.o mpc52xx_common.o
6obj-$(CONFIG_PCI) += mpc52xx_pci.o 6obj-$(CONFIG_PCI) += mpc52xx_pci.o
7endif 7endif
8 8
9obj-$(CONFIG_PPC_EFIKA) += efika-setup.o efika-pci.o 9obj-$(CONFIG_PPC_EFIKA) += efika.o
10obj-$(CONFIG_PPC_LITE5200) += lite5200.o 10obj-$(CONFIG_PPC_LITE5200) += lite5200.o
diff --git a/arch/powerpc/platforms/52xx/efika-pci.c b/arch/powerpc/platforms/52xx/efika-pci.c
deleted file mode 100644
index 62e05b2a9227..000000000000
--- a/arch/powerpc/platforms/52xx/efika-pci.c
+++ /dev/null
@@ -1,119 +0,0 @@
1
2#include <linux/kernel.h>
3#include <linux/pci.h>
4#include <linux/string.h>
5#include <linux/init.h>
6
7#include <asm/io.h>
8#include <asm/irq.h>
9#include <asm/prom.h>
10#include <asm/machdep.h>
11#include <asm/sections.h>
12#include <asm/pci-bridge.h>
13#include <asm/rtas.h>
14
15#include "efika.h"
16
17#ifdef CONFIG_PCI
18/*
19 * Access functions for PCI config space using RTAS calls.
20 */
21static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
22 int len, u32 * val)
23{
24 struct pci_controller *hose = bus->sysdata;
25 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
26 | (((bus->number - hose->first_busno) & 0xff) << 16)
27 | (hose->index << 24);
28 int ret = -1;
29 int rval;
30
31 rval = rtas_call(rtas_token("read-pci-config"), 2, 2, &ret, addr, len);
32 *val = ret;
33 return rval ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
34}
35
36static int rtas_write_config(struct pci_bus *bus, unsigned int devfn,
37 int offset, int len, u32 val)
38{
39 struct pci_controller *hose = bus->sysdata;
40 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
41 | (((bus->number - hose->first_busno) & 0xff) << 16)
42 | (hose->index << 24);
43 int rval;
44
45 rval = rtas_call(rtas_token("write-pci-config"), 3, 1, NULL,
46 addr, len, val);
47 return rval ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
48}
49
50static struct pci_ops rtas_pci_ops = {
51 rtas_read_config,
52 rtas_write_config
53};
54
55void __init efika_pcisetup(void)
56{
57 const int *bus_range;
58 int len;
59 struct pci_controller *hose;
60 struct device_node *root;
61 struct device_node *pcictrl;
62
63 root = of_find_node_by_path("/");
64 if (root == NULL) {
65 printk(KERN_WARNING EFIKA_PLATFORM_NAME
66 ": Unable to find the root node\n");
67 return;
68 }
69
70 for (pcictrl = NULL;;) {
71 pcictrl = of_get_next_child(root, pcictrl);
72 if ((pcictrl == NULL) || (strcmp(pcictrl->name, "pci") == 0))
73 break;
74 }
75
76 of_node_put(root);
77
78 if (pcictrl == NULL) {
79 printk(KERN_WARNING EFIKA_PLATFORM_NAME
80 ": Unable to find the PCI bridge node\n");
81 return;
82 }
83
84 bus_range = get_property(pcictrl, "bus-range", &len);
85 if (bus_range == NULL || len < 2 * sizeof(int)) {
86 printk(KERN_WARNING EFIKA_PLATFORM_NAME
87 ": Can't get bus-range for %s\n", pcictrl->full_name);
88 return;
89 }
90
91 if (bus_range[1] == bus_range[0])
92 printk(KERN_INFO EFIKA_PLATFORM_NAME ": PCI bus %d",
93 bus_range[0]);
94 else
95 printk(KERN_INFO EFIKA_PLATFORM_NAME ": PCI buses %d..%d",
96 bus_range[0], bus_range[1]);
97 printk(" controlled by %s\n", pcictrl->full_name);
98 printk("\n");
99
100 hose = pcibios_alloc_controller();
101 if (!hose) {
102 printk(KERN_WARNING EFIKA_PLATFORM_NAME
103 ": Can't allocate PCI controller structure for %s\n",
104 pcictrl->full_name);
105 return;
106 }
107
108 hose->arch_data = of_node_get(pcictrl);
109 hose->first_busno = bus_range[0];
110 hose->last_busno = bus_range[1];
111 hose->ops = &rtas_pci_ops;
112
113 pci_process_bridge_OF_ranges(hose, pcictrl, 0);
114}
115
116#else
117void __init efika_pcisetup(void)
118{}
119#endif
diff --git a/arch/powerpc/platforms/52xx/efika-setup.c b/arch/powerpc/platforms/52xx/efika-setup.c
deleted file mode 100644
index 110c980ed1e0..000000000000
--- a/arch/powerpc/platforms/52xx/efika-setup.c
+++ /dev/null
@@ -1,150 +0,0 @@
1/*
2 *
3 * Efika 5K2 platform setup
4 * Some code really inspired from the lite5200b platform.
5 *
6 * Copyright (C) 2006 bplan GmbH
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 *
12 */
13
14#include <linux/errno.h>
15#include <linux/kernel.h>
16#include <linux/slab.h>
17#include <linux/reboot.h>
18#include <linux/init.h>
19#include <linux/utsrelease.h>
20#include <linux/seq_file.h>
21#include <linux/root_dev.h>
22#include <linux/initrd.h>
23#include <linux/timer.h>
24#include <linux/pci.h>
25
26#include <asm/pgtable.h>
27#include <asm/prom.h>
28#include <asm/time.h>
29#include <asm/machdep.h>
30#include <asm/rtas.h>
31#include <asm/of_device.h>
32#include <asm/of_platform.h>
33#include <asm/mpc52xx.h>
34
35#include "efika.h"
36
37static void efika_show_cpuinfo(struct seq_file *m)
38{
39 struct device_node *root;
40 const char *revision = NULL;
41 const char *codegendescription = NULL;
42 const char *codegenvendor = NULL;
43
44 root = of_find_node_by_path("/");
45 if (root) {
46 revision = get_property(root, "revision", NULL);
47 codegendescription =
48 get_property(root, "CODEGEN,description", NULL);
49 codegenvendor = get_property(root, "CODEGEN,vendor", NULL);
50
51 of_node_put(root);
52 }
53
54 if (codegendescription)
55 seq_printf(m, "machine\t\t: %s\n", codegendescription);
56 else
57 seq_printf(m, "machine\t\t: Efika\n");
58
59 if (revision)
60 seq_printf(m, "revision\t: %s\n", revision);
61
62 if (codegenvendor)
63 seq_printf(m, "vendor\t\t: %s\n", codegenvendor);
64
65 of_node_put(root);
66}
67
68static void __init efika_setup_arch(void)
69{
70 rtas_initialize();
71
72#ifdef CONFIG_BLK_DEV_INITRD
73 initrd_below_start_ok = 1;
74
75 if (initrd_start)
76 ROOT_DEV = Root_RAM0;
77 else
78#endif
79 ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
80
81 efika_pcisetup();
82
83 if (ppc_md.progress)
84 ppc_md.progress("Linux/PPC " UTS_RELEASE " runnung on Efika ;-)\n", 0x0);
85}
86
87static void __init efika_init(void)
88{
89 struct device_node *np;
90 struct device_node *cnp = NULL;
91 const u32 *base;
92
93 /* Find every child of the SOC node and add it to of_platform */
94 np = of_find_node_by_name(NULL, "builtin");
95 if (np) {
96 char name[BUS_ID_SIZE];
97 while ((cnp = of_get_next_child(np, cnp))) {
98 strcpy(name, cnp->name);
99
100 base = get_property(cnp, "reg", NULL);
101 if (base == NULL)
102 continue;
103
104 snprintf(name+strlen(name), BUS_ID_SIZE, "@%x", *base);
105 of_platform_device_create(cnp, name, NULL);
106
107 printk(KERN_INFO EFIKA_PLATFORM_NAME" : Added %s (type '%s' at '%s') to the known devices\n", name, cnp->type, cnp->full_name);
108 }
109 }
110
111 if (ppc_md.progress)
112 ppc_md.progress(" Have fun with your Efika! ", 0x7777);
113}
114
115static int __init efika_probe(void)
116{
117 char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
118 "model", NULL);
119
120 if (model == NULL)
121 return 0;
122 if (strcmp(model, "EFIKA5K2"))
123 return 0;
124
125 ISA_DMA_THRESHOLD = ~0L;
126 DMA_MODE_READ = 0x44;
127 DMA_MODE_WRITE = 0x48;
128
129 return 1;
130}
131
132define_machine(efika)
133{
134 .name = EFIKA_PLATFORM_NAME,
135 .probe = efika_probe,
136 .setup_arch = efika_setup_arch,
137 .init = efika_init,
138 .show_cpuinfo = efika_show_cpuinfo,
139 .init_IRQ = mpc52xx_init_irq,
140 .get_irq = mpc52xx_get_irq,
141 .restart = rtas_restart,
142 .power_off = rtas_power_off,
143 .halt = rtas_halt,
144 .set_rtc_time = rtas_set_rtc_time,
145 .get_rtc_time = rtas_get_rtc_time,
146 .progress = rtas_progress,
147 .get_boot_time = rtas_get_boot_time,
148 .calibrate_decr = generic_calibrate_decr,
149 .phys_mem_access_prot = pci_phys_mem_access_prot,
150};
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
new file mode 100644
index 000000000000..8de034116681
--- /dev/null
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -0,0 +1,243 @@
1/*
2 * Efika 5K2 platform code
3 * Some code really inspired from the lite5200b platform.
4 *
5 * Copyright (C) 2006 bplan GmbH
6 *
7 * This file is licensed under the terms of the GNU General Public License
8 * version 2. This program is licensed "as is" without any warranty of any
9 * kind, whether express or implied.
10 */
11
12#include <linux/errno.h>
13#include <linux/kernel.h>
14#include <linux/slab.h>
15#include <linux/reboot.h>
16#include <linux/init.h>
17#include <linux/utsrelease.h>
18#include <linux/seq_file.h>
19#include <linux/string.h>
20#include <linux/root_dev.h>
21#include <linux/initrd.h>
22#include <linux/timer.h>
23#include <linux/pci.h>
24
25#include <asm/io.h>
26#include <asm/irq.h>
27#include <asm/sections.h>
28#include <asm/pci-bridge.h>
29#include <asm/pgtable.h>
30#include <asm/prom.h>
31#include <asm/time.h>
32#include <asm/machdep.h>
33#include <asm/rtas.h>
34#include <asm/of_device.h>
35#include <asm/of_platform.h>
36#include <asm/mpc52xx.h>
37
38
39#define EFIKA_PLATFORM_NAME "Efika"
40
41
42/* ------------------------------------------------------------------------ */
43/* PCI accesses thru RTAS */
44/* ------------------------------------------------------------------------ */
45
46#ifdef CONFIG_PCI
47
48/*
49 * Access functions for PCI config space using RTAS calls.
50 */
51static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
52 int len, u32 * val)
53{
54 struct pci_controller *hose = bus->sysdata;
55 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
56 | (((bus->number - hose->first_busno) & 0xff) << 16)
57 | (hose->index << 24);
58 int ret = -1;
59 int rval;
60
61 rval = rtas_call(rtas_token("read-pci-config"), 2, 2, &ret, addr, len);
62 *val = ret;
63 return rval ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
64}
65
66static int rtas_write_config(struct pci_bus *bus, unsigned int devfn,
67 int offset, int len, u32 val)
68{
69 struct pci_controller *hose = bus->sysdata;
70 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
71 | (((bus->number - hose->first_busno) & 0xff) << 16)
72 | (hose->index << 24);
73 int rval;
74
75 rval = rtas_call(rtas_token("write-pci-config"), 3, 1, NULL,
76 addr, len, val);
77 return rval ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
78}
79
80static struct pci_ops rtas_pci_ops = {
81 rtas_read_config,
82 rtas_write_config
83};
84
85
86void __init efika_pcisetup(void)
87{
88 const int *bus_range;
89 int len;
90 struct pci_controller *hose;
91 struct device_node *root;
92 struct device_node *pcictrl;
93
94 root = of_find_node_by_path("/");
95 if (root == NULL) {
96 printk(KERN_WARNING EFIKA_PLATFORM_NAME
97 ": Unable to find the root node\n");
98 return;
99 }
100
101 for (pcictrl = NULL;;) {
102 pcictrl = of_get_next_child(root, pcictrl);
103 if ((pcictrl == NULL) || (strcmp(pcictrl->name, "pci") == 0))
104 break;
105 }
106
107 of_node_put(root);
108
109 if (pcictrl == NULL) {
110 printk(KERN_WARNING EFIKA_PLATFORM_NAME
111 ": Unable to find the PCI bridge node\n");
112 return;
113 }
114
115 bus_range = get_property(pcictrl, "bus-range", &len);
116 if (bus_range == NULL || len < 2 * sizeof(int)) {
117 printk(KERN_WARNING EFIKA_PLATFORM_NAME
118 ": Can't get bus-range for %s\n", pcictrl->full_name);
119 return;
120 }
121
122 if (bus_range[1] == bus_range[0])
123 printk(KERN_INFO EFIKA_PLATFORM_NAME ": PCI bus %d",
124 bus_range[0]);
125 else
126 printk(KERN_INFO EFIKA_PLATFORM_NAME ": PCI buses %d..%d",
127 bus_range[0], bus_range[1]);
128 printk(" controlled by %s\n", pcictrl->full_name);
129 printk("\n");
130
131 hose = pcibios_alloc_controller();
132 if (!hose) {
133 printk(KERN_WARNING EFIKA_PLATFORM_NAME
134 ": Can't allocate PCI controller structure for %s\n",
135 pcictrl->full_name);
136 return;
137 }
138
139 hose->arch_data = of_node_get(pcictrl);
140 hose->first_busno = bus_range[0];
141 hose->last_busno = bus_range[1];
142 hose->ops = &rtas_pci_ops;
143
144 pci_process_bridge_OF_ranges(hose, pcictrl, 0);
145}
146
147#else
148void __init efika_pcisetup(void)
149{}
150#endif
151
152
153
154/* ------------------------------------------------------------------------ */
155/* Platform setup */
156/* ------------------------------------------------------------------------ */
157
158static void efika_show_cpuinfo(struct seq_file *m)
159{
160 struct device_node *root;
161 const char *revision = NULL;
162 const char *codegendescription = NULL;
163 const char *codegenvendor = NULL;
164
165 root = of_find_node_by_path("/");
166 if (!root)
167 return;
168
169 revision = get_property(root, "revision", NULL);
170 codegendescription =
171 get_property(root, "CODEGEN,description", NULL);
172 codegenvendor = get_property(root, "CODEGEN,vendor", NULL);
173
174 if (codegendescription)
175 seq_printf(m, "machine\t\t: %s\n", codegendescription);
176 else
177 seq_printf(m, "machine\t\t: Efika\n");
178
179 if (revision)
180 seq_printf(m, "revision\t: %s\n", revision);
181
182 if (codegenvendor)
183 seq_printf(m, "vendor\t\t: %s\n", codegenvendor);
184
185 of_node_put(root);
186}
187
188static void __init efika_setup_arch(void)
189{
190 rtas_initialize();
191
192#ifdef CONFIG_BLK_DEV_INITRD
193 initrd_below_start_ok = 1;
194
195 if (initrd_start)
196 ROOT_DEV = Root_RAM0;
197 else
198#endif
199 ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
200
201 efika_pcisetup();
202
203 if (ppc_md.progress)
204 ppc_md.progress("Linux/PPC " UTS_RELEASE " running on Efika ;-)\n", 0x0);
205}
206
207static int __init efika_probe(void)
208{
209 char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
210 "model", NULL);
211
212 if (model == NULL)
213 return 0;
214 if (strcmp(model, "EFIKA5K2"))
215 return 0;
216
217 ISA_DMA_THRESHOLD = ~0L;
218 DMA_MODE_READ = 0x44;
219 DMA_MODE_WRITE = 0x48;
220
221 return 1;
222}
223
224define_machine(efika)
225{
226 .name = EFIKA_PLATFORM_NAME,
227 .probe = efika_probe,
228 .setup_arch = efika_setup_arch,
229 .init = mpc52xx_declare_of_platform_devices,
230 .show_cpuinfo = efika_show_cpuinfo,
231 .init_IRQ = mpc52xx_init_irq,
232 .get_irq = mpc52xx_get_irq,
233 .restart = rtas_restart,
234 .power_off = rtas_power_off,
235 .halt = rtas_halt,
236 .set_rtc_time = rtas_set_rtc_time,
237 .get_rtc_time = rtas_get_rtc_time,
238 .progress = rtas_progress,
239 .get_boot_time = rtas_get_boot_time,
240 .calibrate_decr = generic_calibrate_decr,
241 .phys_mem_access_prot = pci_phys_mem_access_prot,
242};
243
diff --git a/arch/powerpc/platforms/52xx/efika.h b/arch/powerpc/platforms/52xx/efika.h
deleted file mode 100644
index 2f060fd097d7..000000000000
--- a/arch/powerpc/platforms/52xx/efika.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Efika 5K2 platform setup - Header file
3 *
4 * Copyright (C) 2006 bplan GmbH
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 *
10 */
11
12#ifndef __ARCH_POWERPC_EFIKA__
13#define __ARCH_POWERPC_EFIKA__
14
15#define EFIKA_PLATFORM_NAME "Efika"
16
17extern void __init efika_pcisetup(void);
18
19#endif
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index cdb16bfa6ca6..cc3b40de21dd 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -51,13 +51,13 @@
51 */ 51 */
52 52
53static void __init 53static void __init
54lite52xx_setup_cpu(void) 54lite5200_setup_cpu(void)
55{ 55{
56 struct mpc52xx_gpio __iomem *gpio; 56 struct mpc52xx_gpio __iomem *gpio;
57 u32 port_config; 57 u32 port_config;
58 58
59 /* Map zones */ 59 /* Map zones */
60 gpio = mpc52xx_find_and_map("mpc52xx-gpio"); 60 gpio = mpc52xx_find_and_map("mpc5200-gpio");
61 if (!gpio) { 61 if (!gpio) {
62 printk(KERN_ERR __FILE__ ": " 62 printk(KERN_ERR __FILE__ ": "
63 "Error while mapping GPIO register for port config. " 63 "Error while mapping GPIO register for port config. "
@@ -85,12 +85,12 @@ error:
85 iounmap(gpio); 85 iounmap(gpio);
86} 86}
87 87
88static void __init lite52xx_setup_arch(void) 88static void __init lite5200_setup_arch(void)
89{ 89{
90 struct device_node *np; 90 struct device_node *np;
91 91
92 if (ppc_md.progress) 92 if (ppc_md.progress)
93 ppc_md.progress("lite52xx_setup_arch()", 0); 93 ppc_md.progress("lite5200_setup_arch()", 0);
94 94
95 np = of_find_node_by_type(NULL, "cpu"); 95 np = of_find_node_by_type(NULL, "cpu");
96 if (np) { 96 if (np) {
@@ -105,7 +105,7 @@ static void __init lite52xx_setup_arch(void)
105 105
106 /* CPU & Port mux setup */ 106 /* CPU & Port mux setup */
107 mpc52xx_setup_cpu(); /* Generic */ 107 mpc52xx_setup_cpu(); /* Generic */
108 lite52xx_setup_cpu(); /* Platorm specific */ 108 lite5200_setup_cpu(); /* Platorm specific */
109 109
110#ifdef CONFIG_PCI 110#ifdef CONFIG_PCI
111 np = of_find_node_by_type(np, "pci"); 111 np = of_find_node_by_type(np, "pci");
@@ -126,7 +126,7 @@ static void __init lite52xx_setup_arch(void)
126 126
127} 127}
128 128
129void lite52xx_show_cpuinfo(struct seq_file *m) 129void lite5200_show_cpuinfo(struct seq_file *m)
130{ 130{
131 struct device_node* np = of_find_all_nodes(NULL); 131 struct device_node* np = of_find_all_nodes(NULL);
132 const char *model = NULL; 132 const char *model = NULL;
@@ -143,25 +143,26 @@ void lite52xx_show_cpuinfo(struct seq_file *m)
143/* 143/*
144 * Called very early, MMU is off, device-tree isn't unflattened 144 * Called very early, MMU is off, device-tree isn't unflattened
145 */ 145 */
146static int __init lite52xx_probe(void) 146static int __init lite5200_probe(void)
147{ 147{
148 unsigned long node = of_get_flat_dt_root(); 148 unsigned long node = of_get_flat_dt_root();
149 const char *model = of_get_flat_dt_prop(node, "model", NULL); 149 const char *model = of_get_flat_dt_prop(node, "model", NULL);
150 150
151 if (!of_flat_dt_is_compatible(node, "lite52xx")) 151 if (!of_flat_dt_is_compatible(node, "fsl,lite5200") &&
152 !of_flat_dt_is_compatible(node, "fsl,lite5200b"))
152 return 0; 153 return 0;
153 pr_debug("%s board w/ mpc52xx found\n", model ? model : "unknown"); 154 pr_debug("%s board found\n", model ? model : "unknown");
154 155
155 return 1; 156 return 1;
156} 157}
157 158
158define_machine(lite52xx) { 159define_machine(lite5200) {
159 .name = "lite52xx", 160 .name = "lite5200",
160 .probe = lite52xx_probe, 161 .probe = lite5200_probe,
161 .setup_arch = lite52xx_setup_arch, 162 .setup_arch = lite5200_setup_arch,
162 .init = mpc52xx_declare_of_platform_devices, 163 .init = mpc52xx_declare_of_platform_devices,
163 .init_IRQ = mpc52xx_init_irq, 164 .init_IRQ = mpc52xx_init_irq,
164 .get_irq = mpc52xx_get_irq, 165 .get_irq = mpc52xx_get_irq,
165 .show_cpuinfo = lite52xx_show_cpuinfo, 166 .show_cpuinfo = lite5200_show_cpuinfo,
166 .calibrate_decr = generic_calibrate_decr, 167 .calibrate_decr = generic_calibrate_decr,
167}; 168};
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index cc40889074bd..ed0cb694aea8 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -83,8 +83,8 @@ mpc52xx_setup_cpu(void)
83 struct mpc52xx_xlb __iomem *xlb; 83 struct mpc52xx_xlb __iomem *xlb;
84 84
85 /* Map zones */ 85 /* Map zones */
86 cdm = mpc52xx_find_and_map("mpc52xx-cdm"); 86 cdm = mpc52xx_find_and_map("mpc5200-cdm");
87 xlb = mpc52xx_find_and_map("mpc52xx-xlb"); 87 xlb = mpc52xx_find_and_map("mpc5200-xlb");
88 88
89 if (!cdm || !xlb) { 89 if (!cdm || !xlb) {
90 printk(KERN_ERR __FILE__ ": " 90 printk(KERN_ERR __FILE__ ": "
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index cd91a6c3aafa..c75192567e55 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -383,16 +383,16 @@ void __init mpc52xx_init_irq(void)
383 struct device_node *picnode; 383 struct device_node *picnode;
384 384
385 /* Remap the necessary zones */ 385 /* Remap the necessary zones */
386 picnode = of_find_compatible_node(NULL, NULL, "mpc52xx-pic"); 386 picnode = of_find_compatible_node(NULL, NULL, "mpc5200-pic");
387 387
388 intr = mpc52xx_find_and_map("mpc52xx-pic"); 388 intr = mpc52xx_find_and_map("mpc5200-pic");
389 if (!intr) 389 if (!intr)
390 panic(__FILE__ ": find_and_map failed on 'mpc52xx-pic'. " 390 panic(__FILE__ ": find_and_map failed on 'mpc5200-pic'. "
391 "Check node !"); 391 "Check node !");
392 392
393 sdma = mpc52xx_find_and_map("mpc52xx-bestcomm"); 393 sdma = mpc52xx_find_and_map("mpc5200-bestcomm");
394 if (!sdma) 394 if (!sdma)
395 panic(__FILE__ ": find_and_map failed on 'mpc52xx-bestcomm'. " 395 panic(__FILE__ ": find_and_map failed on 'mpc5200-bestcomm'. "
396 "Check node !"); 396 "Check node !");
397 397
398 /* Disable all interrupt sources. */ 398 /* Disable all interrupt sources. */
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index edcd5b875b66..1aea1e69ff31 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -3,7 +3,13 @@ menu "Platform support"
3 3
4choice 4choice
5 prompt "Machine Type" 5 prompt "Machine Type"
6 default MPC834x_SYS 6 default MPC834x_MDS
7
8config MPC8313_RDB
9 bool "Freescale MPC8313 RDB"
10 select DEFAULT_UIMAGE
11 help
12 This option enables support for the MPC8313 RDB board.
7 13
8config MPC832x_MDS 14config MPC832x_MDS
9 bool "Freescale MPC832x MDS" 15 bool "Freescale MPC832x MDS"
@@ -12,13 +18,13 @@ config MPC832x_MDS
12 help 18 help
13 This option enables support for the MPC832x MDS evaluation board. 19 This option enables support for the MPC832x MDS evaluation board.
14 20
15config MPC834x_SYS 21config MPC834x_MDS
16 bool "Freescale MPC834x SYS" 22 bool "Freescale MPC834x MDS"
17 select DEFAULT_UIMAGE 23 select DEFAULT_UIMAGE
18 help 24 help
19 This option enables support for the MPC 834x SYS evaluation board. 25 This option enables support for the MPC 834x MDS evaluation board.
20 26
21 Be aware that PCI buses can only function when SYS board is plugged 27 Be aware that PCI buses can only function when MDS board is plugged
22 into the PIB (Platform IO Board) board from Freescale which provide 28 into the PIB (Platform IO Board) board from Freescale which provide
23 3 PCI slots. The PIBs PCI initialization is the bootloader's 29 3 PCI slots. The PIBs PCI initialization is the bootloader's
24 responsibility. 30 responsibility.
@@ -41,6 +47,12 @@ config MPC8360E_PB
41 47
42endchoice 48endchoice
43 49
50config PPC_MPC831x
51 bool
52 select PPC_UDBG_16550
53 select PPC_INDIRECT_PCI
54 default y if MPC8313_RDB
55
44config PPC_MPC832x 56config PPC_MPC832x
45 bool 57 bool
46 select PPC_UDBG_16550 58 select PPC_UDBG_16550
@@ -51,7 +63,7 @@ config MPC834x
51 bool 63 bool
52 select PPC_UDBG_16550 64 select PPC_UDBG_16550
53 select PPC_INDIRECT_PCI 65 select PPC_INDIRECT_PCI
54 default y if MPC834x_SYS || MPC834x_ITX 66 default y if MPC834x_MDS || MPC834x_ITX
55 67
56config PPC_MPC836x 68config PPC_MPC836x
57 bool 69 bool
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index f1aa7e24a938..6c8199c4c382 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -3,7 +3,8 @@
3# 3#
4obj-y := misc.o 4obj-y := misc.o
5obj-$(CONFIG_PCI) += pci.o 5obj-$(CONFIG_PCI) += pci.o
6obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o 6obj-$(CONFIG_MPC8313_RDB) += mpc8313_rdb.o
7obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o
7obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o 8obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o
8obj-$(CONFIG_MPC8360E_PB) += mpc8360e_pb.o 9obj-$(CONFIG_MPC8360E_PB) += mpc8360e_pb.o
9obj-$(CONFIG_MPC832x_MDS) += mpc832x_mds.o 10obj-$(CONFIG_MPC832x_MDS) += mpc832x_mds.o
diff --git a/arch/powerpc/platforms/83xx/mpc8313_rdb.c b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
new file mode 100644
index 000000000000..c3b98c34eb6b
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc8313_rdb.c
@@ -0,0 +1,99 @@
1/*
2 * arch/powerpc/platforms/83xx/mpc8313_rdb.c
3 *
4 * Description: MPC8313x RDB board specific routines.
5 * This file is based on mpc834x_sys.c
6 * Author: Lo Wlison <r43300@freescale.com>
7 *
8 * Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/pci.h>
17
18#include <asm/time.h>
19#include <asm/ipic.h>
20#include <asm/udbg.h>
21
22#include "mpc83xx.h"
23
24#undef DEBUG
25#ifdef DEBUG
26#define DBG(fmt...) udbg_printf(fmt)
27#else
28#define DBG(fmt...)
29#endif
30
31#ifndef CONFIG_PCI
32unsigned long isa_io_base = 0;
33unsigned long isa_mem_base = 0;
34#endif
35
36/* ************************************************************************
37 *
38 * Setup the architecture
39 *
40 */
41static void __init mpc8313_rdb_setup_arch(void)
42{
43 struct device_node *np;
44
45 if (ppc_md.progress)
46 ppc_md.progress("mpc8313_rdb_setup_arch()", 0);
47
48#ifdef CONFIG_PCI
49 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
50 add_bridge(np);
51
52 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
53#endif
54}
55
56void __init mpc8313_rdb_init_IRQ(void)
57{
58 struct device_node *np;
59
60 np = of_find_node_by_type(NULL, "ipic");
61 if (!np)
62 return;
63
64 ipic_init(np, 0);
65
66 /* Initialize the default interrupt mapping priorities,
67 * in case the boot rom changed something on us.
68 */
69 ipic_set_default_priority();
70}
71
72/*
73 * Called very early, MMU is off, device-tree isn't unflattened
74 */
75static int __init mpc8313_rdb_probe(void)
76{
77 char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
78 "model", NULL);
79 if (model == NULL)
80 return 0;
81 if (strcmp(model, "MPC8313ERDB"))
82 return 0;
83
84 DBG("MPC8313 RDB found\n");
85
86 return 1;
87}
88
89define_machine(mpc8313_rdb) {
90 .name = "MPC8313 RDB",
91 .probe = mpc8313_rdb_probe,
92 .setup_arch = mpc8313_rdb_setup_arch,
93 .init_IRQ = mpc8313_rdb_init_IRQ,
94 .get_irq = ipic_get_irq,
95 .restart = mpc83xx_restart,
96 .time_init = mpc83xx_time_init,
97 .calibrate_decr = generic_calibrate_decr,
98 .progress = udbg_progress,
99};
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 2446dea9407e..443a3172f370 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -38,8 +38,6 @@
38 38
39#include "mpc83xx.h" 39#include "mpc83xx.h"
40 40
41#include <platforms/83xx/mpc834x_sys.h>
42
43#ifndef CONFIG_PCI 41#ifndef CONFIG_PCI
44unsigned long isa_io_base = 0; 42unsigned long isa_io_base = 0;
45unsigned long isa_mem_base = 0; 43unsigned long isa_mem_base = 0;
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_mds.c
index f30393f0b832..d2736da76c46 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_mds.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/powerpc/platforms/83xx/mpc834x_sys.c 2 * arch/powerpc/platforms/83xx/mpc834x_mds.c
3 * 3 *
4 * MPC834x SYS board specific routines 4 * MPC834x MDS board specific routines
5 * 5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org> 6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 * 7 *
@@ -43,17 +43,87 @@ unsigned long isa_io_base = 0;
43unsigned long isa_mem_base = 0; 43unsigned long isa_mem_base = 0;
44#endif 44#endif
45 45
46#define BCSR5_INT_USB 0x02
47/* Note: This is only for PB, not for PB+PIB
48 * On PB only port0 is connected using ULPI */
49static int mpc834x_usb_cfg(void)
50{
51 unsigned long sccr, sicrl;
52 void __iomem *immap;
53 void __iomem *bcsr_regs = NULL;
54 u8 bcsr5;
55 struct device_node *np = NULL;
56 int port0_is_dr = 0;
57
58 if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL)
59 port0_is_dr = 1;
60 if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL){
61 if (port0_is_dr) {
62 printk(KERN_WARNING
63 "There is only one USB port on PB board! \n");
64 return -1;
65 } else if (!port0_is_dr)
66 /* No usb port enabled */
67 return -1;
68 }
69
70 immap = ioremap(get_immrbase(), 0x1000);
71 if (!immap)
72 return -1;
73
74 /* Configure clock */
75 sccr = in_be32(immap + MPC83XX_SCCR_OFFS);
76 if (port0_is_dr)
77 sccr |= MPC83XX_SCCR_USB_DRCM_11; /* 1:3 */
78 else
79 sccr |= MPC83XX_SCCR_USB_MPHCM_11; /* 1:3 */
80 out_be32(immap + MPC83XX_SCCR_OFFS, sccr);
81
82 /* Configure Pin */
83 sicrl = in_be32(immap + MPC83XX_SICRL_OFFS);
84 /* set port0 only */
85 if (port0_is_dr)
86 sicrl |= MPC83XX_SICRL_USB0;
87 else
88 sicrl &= ~(MPC83XX_SICRL_USB0);
89 out_be32(immap + MPC83XX_SICRL_OFFS, sicrl);
90
91 iounmap(immap);
92
93 /* Map BCSR area */
94 np = of_find_node_by_name(NULL, "bcsr");
95 if (np != 0) {
96 struct resource res;
97
98 of_address_to_resource(np, 0, &res);
99 bcsr_regs = ioremap(res.start, res.end - res.start + 1);
100 of_node_put(np);
101 }
102 if (!bcsr_regs)
103 return -1;
104
105 /*
106 * if MDS board is plug into PIB board,
107 * force to use the PHY on MDS board
108 */
109 bcsr5 = in_8(bcsr_regs + 5);
110 if (!(bcsr5 & BCSR5_INT_USB))
111 out_8(bcsr_regs + 5, (bcsr5 | BCSR5_INT_USB));
112 iounmap(bcsr_regs);
113 return 0;
114}
115
46/* ************************************************************************ 116/* ************************************************************************
47 * 117 *
48 * Setup the architecture 118 * Setup the architecture
49 * 119 *
50 */ 120 */
51static void __init mpc834x_sys_setup_arch(void) 121static void __init mpc834x_mds_setup_arch(void)
52{ 122{
53 struct device_node *np; 123 struct device_node *np;
54 124
55 if (ppc_md.progress) 125 if (ppc_md.progress)
56 ppc_md.progress("mpc834x_sys_setup_arch()", 0); 126 ppc_md.progress("mpc834x_mds_setup_arch()", 0);
57 127
58 np = of_find_node_by_type(NULL, "cpu"); 128 np = of_find_node_by_type(NULL, "cpu");
59 if (np != 0) { 129 if (np != 0) {
@@ -65,6 +135,7 @@ static void __init mpc834x_sys_setup_arch(void)
65 loops_per_jiffy = 50000000 / HZ; 135 loops_per_jiffy = 50000000 / HZ;
66 of_node_put(np); 136 of_node_put(np);
67 } 137 }
138
68#ifdef CONFIG_PCI 139#ifdef CONFIG_PCI
69 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) 140 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
70 add_bridge(np); 141 add_bridge(np);
@@ -72,6 +143,8 @@ static void __init mpc834x_sys_setup_arch(void)
72 ppc_md.pci_exclude_device = mpc83xx_exclude_device; 143 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
73#endif 144#endif
74 145
146 mpc834x_usb_cfg();
147
75#ifdef CONFIG_ROOT_NFS 148#ifdef CONFIG_ROOT_NFS
76 ROOT_DEV = Root_NFS; 149 ROOT_DEV = Root_NFS;
77#else 150#else
@@ -79,7 +152,7 @@ static void __init mpc834x_sys_setup_arch(void)
79#endif 152#endif
80} 153}
81 154
82static void __init mpc834x_sys_init_IRQ(void) 155static void __init mpc834x_mds_init_IRQ(void)
83{ 156{
84 struct device_node *np; 157 struct device_node *np;
85 158
@@ -119,7 +192,7 @@ late_initcall(mpc834x_rtc_hookup);
119/* 192/*
120 * Called very early, MMU is off, device-tree isn't unflattened 193 * Called very early, MMU is off, device-tree isn't unflattened
121 */ 194 */
122static int __init mpc834x_sys_probe(void) 195static int __init mpc834x_mds_probe(void)
123{ 196{
124 /* We always match for now, eventually we should look at the flat 197 /* We always match for now, eventually we should look at the flat
125 dev tree to ensure this is the board we are suppose to run on 198 dev tree to ensure this is the board we are suppose to run on
@@ -127,11 +200,11 @@ static int __init mpc834x_sys_probe(void)
127 return 1; 200 return 1;
128} 201}
129 202
130define_machine(mpc834x_sys) { 203define_machine(mpc834x_mds) {
131 .name = "MPC834x SYS", 204 .name = "MPC834x MDS",
132 .probe = mpc834x_sys_probe, 205 .probe = mpc834x_mds_probe,
133 .setup_arch = mpc834x_sys_setup_arch, 206 .setup_arch = mpc834x_mds_setup_arch,
134 .init_IRQ = mpc834x_sys_init_IRQ, 207 .init_IRQ = mpc834x_mds_init_IRQ,
135 .get_irq = ipic_get_irq, 208 .get_irq = ipic_get_irq,
136 .restart = mpc83xx_restart, 209 .restart = mpc83xx_restart,
137 .time_init = mpc83xx_time_init, 210 .time_init = mpc83xx_time_init,
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.h b/arch/powerpc/platforms/83xx/mpc834x_sys.h
deleted file mode 100644
index 7d5bbef084e7..000000000000
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/powerpc/platforms/83xx/mpc834x_sys.h
3 *
4 * MPC834X SYS common board definitions
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MACH_MPC83XX_SYS_H__
16#define __MACH_MPC83XX_SYS_H__
17
18#define PIRQA MPC83xx_IRQ_EXT4
19#define PIRQB MPC83xx_IRQ_EXT5
20#define PIRQC MPC83xx_IRQ_EXT6
21#define PIRQD MPC83xx_IRQ_EXT7
22
23#endif /* __MACH_MPC83XX_SYS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 01cae106912b..9cd03b59c8f4 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -4,6 +4,24 @@
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/device.h> 5#include <linux/device.h>
6 6
7/* System Clock Control Register */
8#define MPC83XX_SCCR_OFFS 0xA08
9#define MPC83XX_SCCR_USB_MPHCM_11 0x00c00000
10#define MPC83XX_SCCR_USB_MPHCM_01 0x00400000
11#define MPC83XX_SCCR_USB_MPHCM_10 0x00800000
12#define MPC83XX_SCCR_USB_DRCM_11 0x00300000
13#define MPC83XX_SCCR_USB_DRCM_01 0x00100000
14#define MPC83XX_SCCR_USB_DRCM_10 0x00200000
15
16/* system i/o configuration register low */
17#define MPC83XX_SICRL_OFFS 0x114
18#define MPC83XX_SICRL_USB0 0x40000000
19#define MPC83XX_SICRL_USB1 0x20000000
20
21/* system i/o configuration register high */
22#define MPC83XX_SICRH_OFFS 0x118
23#define MPC83XX_SICRH_USB_UTMI 0x00020000
24
7/* 25/*
8 * Declaration for the various functions exported by the 26 * Declaration for the various functions exported by the
9 * mpc83xx_* files. Mostly for use by mpc83xx_setup 27 * mpc83xx_* files. Mostly for use by mpc83xx_setup
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 65e612315b9b..452004283f17 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -5,9 +5,9 @@ ifeq ($(CONFIG_PPC64),y)
5obj-$(CONFIG_PPC_PMAC) += powermac/ 5obj-$(CONFIG_PPC_PMAC) += powermac/
6endif 6endif
7endif 7endif
8obj-$(CONFIG_PPC_MPC52xx) += 52xx/
9obj-$(CONFIG_PPC_CHRP) += chrp/ 8obj-$(CONFIG_PPC_CHRP) += chrp/
10obj-$(CONFIG_4xx) += 4xx/ 9obj-$(CONFIG_4xx) += 4xx/
10obj-$(CONFIG_PPC_MPC52xx) += 52xx/
11obj-$(CONFIG_PPC_8xx) += 8xx/ 11obj-$(CONFIG_PPC_8xx) += 8xx/
12obj-$(CONFIG_PPC_82xx) += 82xx/ 12obj-$(CONFIG_PPC_82xx) += 82xx/
13obj-$(CONFIG_PPC_83xx) += 83xx/ 13obj-$(CONFIG_PPC_83xx) += 83xx/
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index b43466ba8096..67d617b60a23 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -149,7 +149,8 @@ static int cbe_nr_iommus;
149static void invalidate_tce_cache(struct cbe_iommu *iommu, unsigned long *pte, 149static void invalidate_tce_cache(struct cbe_iommu *iommu, unsigned long *pte,
150 long n_ptes) 150 long n_ptes)
151{ 151{
152 unsigned long *reg, val; 152 unsigned long __iomem *reg;
153 unsigned long val;
153 long n; 154 long n;
154 155
155 reg = iommu->xlate_regs + IOC_IOPT_CacheInvd; 156 reg = iommu->xlate_regs + IOC_IOPT_CacheInvd;
@@ -592,7 +593,7 @@ static void __init cell_iommu_init_one(struct device_node *np, unsigned long off
592 /* Init base fields */ 593 /* Init base fields */
593 i = cbe_nr_iommus++; 594 i = cbe_nr_iommus++;
594 iommu = &iommus[i]; 595 iommu = &iommus[i];
595 iommu->stab = 0; 596 iommu->stab = NULL;
596 iommu->nid = nid; 597 iommu->nid = nid;
597 snprintf(iommu->name, sizeof(iommu->name), "iommu%d", i); 598 snprintf(iommu->name, sizeof(iommu->name), "iommu%d", i);
598 INIT_LIST_HEAD(&iommu->windows); 599 INIT_LIST_HEAD(&iommu->windows);
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index d8b39fe39cdd..e34599f53d28 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -59,63 +59,6 @@ static u64 __init find_spu_unit_number(struct device_node *spe)
59 return 0; 59 return 0;
60} 60}
61 61
62static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
63 const char *prop)
64{
65 const struct address_prop {
66 unsigned long address;
67 unsigned int len;
68 } __attribute__((packed)) *p;
69 int proplen;
70
71 unsigned long start_pfn, nr_pages;
72 struct pglist_data *pgdata;
73 struct zone *zone;
74 int ret;
75
76 p = get_property(spe, prop, &proplen);
77 WARN_ON(proplen != sizeof (*p));
78
79 start_pfn = p->address >> PAGE_SHIFT;
80 nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT;
81
82 pgdata = NODE_DATA(spu->node);
83 zone = pgdata->node_zones;
84
85 ret = __add_pages(zone, start_pfn, nr_pages);
86
87 return ret;
88}
89
90static void __iomem * __init map_spe_prop(struct spu *spu,
91 struct device_node *n, const char *name)
92{
93 const struct address_prop {
94 unsigned long address;
95 unsigned int len;
96 } __attribute__((packed)) *prop;
97
98 const void *p;
99 int proplen;
100 void __iomem *ret = NULL;
101 int err = 0;
102
103 p = get_property(n, name, &proplen);
104 if (proplen != sizeof (struct address_prop))
105 return NULL;
106
107 prop = p;
108
109 err = cell_spuprop_present(spu, n, name);
110 if (err && (err != -EEXIST))
111 goto out;
112
113 ret = ioremap(prop->address, prop->len);
114
115 out:
116 return ret;
117}
118
119static void spu_unmap(struct spu *spu) 62static void spu_unmap(struct spu *spu)
120{ 63{
121 if (!firmware_has_feature(FW_FEATURE_LPAR)) 64 if (!firmware_has_feature(FW_FEATURE_LPAR))
@@ -157,6 +100,23 @@ static int __init spu_map_interrupts_old(struct spu *spu,
157 return spu->irqs[2] == NO_IRQ ? -EINVAL : 0; 100 return spu->irqs[2] == NO_IRQ ? -EINVAL : 0;
158} 101}
159 102
103static void __iomem * __init spu_map_prop_old(struct spu *spu,
104 struct device_node *n,
105 const char *name)
106{
107 const struct address_prop {
108 unsigned long address;
109 unsigned int len;
110 } __attribute__((packed)) *prop;
111 int proplen;
112
113 prop = get_property(n, name, &proplen);
114 if (prop == NULL || proplen != sizeof (struct address_prop))
115 return NULL;
116
117 return ioremap(prop->address, prop->len);
118}
119
160static int __init spu_map_device_old(struct spu *spu) 120static int __init spu_map_device_old(struct spu *spu)
161{ 121{
162 struct device_node *node = spu->devnode; 122 struct device_node *node = spu->devnode;
@@ -175,7 +135,7 @@ static int __init spu_map_device_old(struct spu *spu)
175 135
176 /* we use local store as ram, not io memory */ 136 /* we use local store as ram, not io memory */
177 spu->local_store = (void __force *) 137 spu->local_store = (void __force *)
178 map_spe_prop(spu, node, "local-store"); 138 spu_map_prop_old(spu, node, "local-store");
179 if (!spu->local_store) 139 if (!spu->local_store)
180 goto out; 140 goto out;
181 141
@@ -184,16 +144,16 @@ static int __init spu_map_device_old(struct spu *spu)
184 goto out_unmap; 144 goto out_unmap;
185 spu->problem_phys = *(unsigned long *)prop; 145 spu->problem_phys = *(unsigned long *)prop;
186 146
187 spu->problem = map_spe_prop(spu, node, "problem"); 147 spu->problem = spu_map_prop_old(spu, node, "problem");
188 if (!spu->problem) 148 if (!spu->problem)
189 goto out_unmap; 149 goto out_unmap;
190 150
191 spu->priv2 = map_spe_prop(spu, node, "priv2"); 151 spu->priv2 = spu_map_prop_old(spu, node, "priv2");
192 if (!spu->priv2) 152 if (!spu->priv2)
193 goto out_unmap; 153 goto out_unmap;
194 154
195 if (!firmware_has_feature(FW_FEATURE_LPAR)) { 155 if (!firmware_has_feature(FW_FEATURE_LPAR)) {
196 spu->priv1 = map_spe_prop(spu, node, "priv1"); 156 spu->priv1 = spu_map_prop_old(spu, node, "priv1");
197 if (!spu->priv1) 157 if (!spu->priv1)
198 goto out_unmap; 158 goto out_unmap;
199 } 159 }
@@ -245,34 +205,20 @@ static int spu_map_resource(struct spu *spu, int nr,
245 void __iomem** virt, unsigned long *phys) 205 void __iomem** virt, unsigned long *phys)
246{ 206{
247 struct device_node *np = spu->devnode; 207 struct device_node *np = spu->devnode;
248 unsigned long start_pfn, nr_pages;
249 struct pglist_data *pgdata;
250 struct zone *zone;
251 struct resource resource = { }; 208 struct resource resource = { };
252 unsigned long len; 209 unsigned long len;
253 int ret; 210 int ret;
254 211
255 ret = of_address_to_resource(np, nr, &resource); 212 ret = of_address_to_resource(np, nr, &resource);
256 if (ret) 213 if (ret)
257 goto out; 214 return ret;
258
259 if (phys) 215 if (phys)
260 *phys = resource.start; 216 *phys = resource.start;
261 len = resource.end - resource.start + 1; 217 len = resource.end - resource.start + 1;
262 *virt = ioremap(resource.start, len); 218 *virt = ioremap(resource.start, len);
263 if (!*virt) 219 if (!*virt)
264 ret = -EINVAL; 220 return -EINVAL;
265 221 return 0;
266 start_pfn = resource.start >> PAGE_SHIFT;
267 nr_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
268
269 pgdata = NODE_DATA(spu->node);
270 zone = pgdata->node_zones;
271
272 ret = __add_pages(zone, start_pfn, nr_pages);
273
274out:
275 return ret;
276} 222}
277 223
278static int __init spu_map_device(struct spu *spu) 224static int __init spu_map_device(struct spu *spu)
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 0870009f56db..28c718ca3b51 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -111,13 +111,17 @@ void spu_unmap_mappings(struct spu_context *ctx)
111 if (ctx->local_store) 111 if (ctx->local_store)
112 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1); 112 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1);
113 if (ctx->mfc) 113 if (ctx->mfc)
114 unmap_mapping_range(ctx->mfc, 0, 0x4000, 1); 114 unmap_mapping_range(ctx->mfc, 0, 0x1000, 1);
115 if (ctx->cntl) 115 if (ctx->cntl)
116 unmap_mapping_range(ctx->cntl, 0, 0x4000, 1); 116 unmap_mapping_range(ctx->cntl, 0, 0x1000, 1);
117 if (ctx->signal1) 117 if (ctx->signal1)
118 unmap_mapping_range(ctx->signal1, 0, 0x4000, 1); 118 unmap_mapping_range(ctx->signal1, 0, PAGE_SIZE, 1);
119 if (ctx->signal2) 119 if (ctx->signal2)
120 unmap_mapping_range(ctx->signal2, 0, 0x4000, 1); 120 unmap_mapping_range(ctx->signal2, 0, PAGE_SIZE, 1);
121 if (ctx->mss)
122 unmap_mapping_range(ctx->mss, 0, 0x1000, 1);
123 if (ctx->psmap)
124 unmap_mapping_range(ctx->psmap, 0, 0x20000, 1);
121} 125}
122 126
123int spu_acquire_exclusive(struct spu_context *ctx) 127int spu_acquire_exclusive(struct spu_context *ctx)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 347eff56fcbd..a528020baa18 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -45,8 +45,8 @@ spufs_mem_open(struct inode *inode, struct file *file)
45 struct spufs_inode_info *i = SPUFS_I(inode); 45 struct spufs_inode_info *i = SPUFS_I(inode);
46 struct spu_context *ctx = i->i_ctx; 46 struct spu_context *ctx = i->i_ctx;
47 file->private_data = ctx; 47 file->private_data = ctx;
48 file->f_mapping = inode->i_mapping;
49 ctx->local_store = inode->i_mapping; 48 ctx->local_store = inode->i_mapping;
49 smp_wmb();
50 return 0; 50 return 0;
51} 51}
52 52
@@ -95,14 +95,12 @@ spufs_mem_write(struct file *file, const char __user *buffer,
95 return ret; 95 return ret;
96} 96}
97 97
98static struct page * 98static unsigned long spufs_mem_mmap_nopfn(struct vm_area_struct *vma,
99spufs_mem_mmap_nopage(struct vm_area_struct *vma, 99 unsigned long address)
100 unsigned long address, int *type)
101{ 100{
102 struct page *page = NOPAGE_SIGBUS;
103
104 struct spu_context *ctx = vma->vm_file->private_data; 101 struct spu_context *ctx = vma->vm_file->private_data;
105 unsigned long offset = address - vma->vm_start; 102 unsigned long pfn, offset = address - vma->vm_start;
103
106 offset += vma->vm_pgoff << PAGE_SHIFT; 104 offset += vma->vm_pgoff << PAGE_SHIFT;
107 105
108 spu_acquire(ctx); 106 spu_acquire(ctx);
@@ -110,24 +108,22 @@ spufs_mem_mmap_nopage(struct vm_area_struct *vma,
110 if (ctx->state == SPU_STATE_SAVED) { 108 if (ctx->state == SPU_STATE_SAVED) {
111 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 109 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
112 & ~_PAGE_NO_CACHE); 110 & ~_PAGE_NO_CACHE);
113 page = vmalloc_to_page(ctx->csa.lscsa->ls + offset); 111 pfn = vmalloc_to_pfn(ctx->csa.lscsa->ls + offset);
114 } else { 112 } else {
115 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 113 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
116 | _PAGE_NO_CACHE); 114 | _PAGE_NO_CACHE);
117 page = pfn_to_page((ctx->spu->local_store_phys + offset) 115 pfn = (ctx->spu->local_store_phys + offset) >> PAGE_SHIFT;
118 >> PAGE_SHIFT);
119 } 116 }
120 spu_release(ctx); 117 vm_insert_pfn(vma, address, pfn);
121 118
122 if (type) 119 spu_release(ctx);
123 *type = VM_FAULT_MINOR;
124 120
125 page_cache_get(page); 121 return NOPFN_REFAULT;
126 return page;
127} 122}
128 123
124
129static struct vm_operations_struct spufs_mem_mmap_vmops = { 125static struct vm_operations_struct spufs_mem_mmap_vmops = {
130 .nopage = spufs_mem_mmap_nopage, 126 .nopfn = spufs_mem_mmap_nopfn,
131}; 127};
132 128
133static int 129static int
@@ -136,7 +132,7 @@ spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
136 if (!(vma->vm_flags & VM_SHARED)) 132 if (!(vma->vm_flags & VM_SHARED))
137 return -EINVAL; 133 return -EINVAL;
138 134
139 vma->vm_flags |= VM_IO; 135 vma->vm_flags |= VM_IO | VM_PFNMAP;
140 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 136 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
141 | _PAGE_NO_CACHE); 137 | _PAGE_NO_CACHE);
142 138
@@ -144,7 +140,7 @@ spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
144 return 0; 140 return 0;
145} 141}
146 142
147static struct file_operations spufs_mem_fops = { 143static const struct file_operations spufs_mem_fops = {
148 .open = spufs_mem_open, 144 .open = spufs_mem_open,
149 .read = spufs_mem_read, 145 .read = spufs_mem_read,
150 .write = spufs_mem_write, 146 .write = spufs_mem_write,
@@ -152,49 +148,42 @@ static struct file_operations spufs_mem_fops = {
152 .mmap = spufs_mem_mmap, 148 .mmap = spufs_mem_mmap,
153}; 149};
154 150
155static struct page *spufs_ps_nopage(struct vm_area_struct *vma, 151static unsigned long spufs_ps_nopfn(struct vm_area_struct *vma,
156 unsigned long address, 152 unsigned long address,
157 int *type, unsigned long ps_offs, 153 unsigned long ps_offs,
158 unsigned long ps_size) 154 unsigned long ps_size)
159{ 155{
160 struct page *page = NOPAGE_SIGBUS;
161 int fault_type = VM_FAULT_SIGBUS;
162 struct spu_context *ctx = vma->vm_file->private_data; 156 struct spu_context *ctx = vma->vm_file->private_data;
163 unsigned long offset = address - vma->vm_start; 157 unsigned long area, offset = address - vma->vm_start;
164 unsigned long area;
165 int ret; 158 int ret;
166 159
167 offset += vma->vm_pgoff << PAGE_SHIFT; 160 offset += vma->vm_pgoff << PAGE_SHIFT;
168 if (offset >= ps_size) 161 if (offset >= ps_size)
169 goto out; 162 return NOPFN_SIGBUS;
170 163
164 /* error here usually means a signal.. we might want to test
165 * the error code more precisely though
166 */
171 ret = spu_acquire_runnable(ctx); 167 ret = spu_acquire_runnable(ctx);
172 if (ret) 168 if (ret)
173 goto out; 169 return NOPFN_REFAULT;
174 170
175 area = ctx->spu->problem_phys + ps_offs; 171 area = ctx->spu->problem_phys + ps_offs;
176 page = pfn_to_page((area + offset) >> PAGE_SHIFT); 172 vm_insert_pfn(vma, address, (area + offset) >> PAGE_SHIFT);
177 fault_type = VM_FAULT_MINOR;
178 page_cache_get(page);
179
180 spu_release(ctx); 173 spu_release(ctx);
181 174
182 out: 175 return NOPFN_REFAULT;
183 if (type)
184 *type = fault_type;
185
186 return page;
187} 176}
188 177
189#if SPUFS_MMAP_4K 178#if SPUFS_MMAP_4K
190static struct page *spufs_cntl_mmap_nopage(struct vm_area_struct *vma, 179static unsigned long spufs_cntl_mmap_nopfn(struct vm_area_struct *vma,
191 unsigned long address, int *type) 180 unsigned long address)
192{ 181{
193 return spufs_ps_nopage(vma, address, type, 0x4000, 0x1000); 182 return spufs_ps_nopfn(vma, address, 0x4000, 0x1000);
194} 183}
195 184
196static struct vm_operations_struct spufs_cntl_mmap_vmops = { 185static struct vm_operations_struct spufs_cntl_mmap_vmops = {
197 .nopage = spufs_cntl_mmap_nopage, 186 .nopfn = spufs_cntl_mmap_nopfn,
198}; 187};
199 188
200/* 189/*
@@ -205,7 +194,7 @@ static int spufs_cntl_mmap(struct file *file, struct vm_area_struct *vma)
205 if (!(vma->vm_flags & VM_SHARED)) 194 if (!(vma->vm_flags & VM_SHARED))
206 return -EINVAL; 195 return -EINVAL;
207 196
208 vma->vm_flags |= VM_IO; 197 vma->vm_flags |= VM_IO | VM_PFNMAP;
209 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 198 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
210 | _PAGE_NO_CACHE | _PAGE_GUARDED); 199 | _PAGE_NO_CACHE | _PAGE_GUARDED);
211 200
@@ -243,13 +232,13 @@ static int spufs_cntl_open(struct inode *inode, struct file *file)
243 struct spu_context *ctx = i->i_ctx; 232 struct spu_context *ctx = i->i_ctx;
244 233
245 file->private_data = ctx; 234 file->private_data = ctx;
246 file->f_mapping = inode->i_mapping;
247 ctx->cntl = inode->i_mapping; 235 ctx->cntl = inode->i_mapping;
236 smp_wmb();
248 return simple_attr_open(inode, file, spufs_cntl_get, 237 return simple_attr_open(inode, file, spufs_cntl_get,
249 spufs_cntl_set, "0x%08lx"); 238 spufs_cntl_set, "0x%08lx");
250} 239}
251 240
252static struct file_operations spufs_cntl_fops = { 241static const struct file_operations spufs_cntl_fops = {
253 .open = spufs_cntl_open, 242 .open = spufs_cntl_open,
254 .release = simple_attr_close, 243 .release = simple_attr_close,
255 .read = simple_attr_read, 244 .read = simple_attr_read,
@@ -309,7 +298,7 @@ spufs_regs_write(struct file *file, const char __user *buffer,
309 return ret; 298 return ret;
310} 299}
311 300
312static struct file_operations spufs_regs_fops = { 301static const struct file_operations spufs_regs_fops = {
313 .open = spufs_regs_open, 302 .open = spufs_regs_open,
314 .read = spufs_regs_read, 303 .read = spufs_regs_read,
315 .write = spufs_regs_write, 304 .write = spufs_regs_write,
@@ -360,7 +349,7 @@ spufs_fpcr_write(struct file *file, const char __user * buffer,
360 return ret; 349 return ret;
361} 350}
362 351
363static struct file_operations spufs_fpcr_fops = { 352static const struct file_operations spufs_fpcr_fops = {
364 .open = spufs_regs_open, 353 .open = spufs_regs_open,
365 .read = spufs_fpcr_read, 354 .read = spufs_fpcr_read,
366 .write = spufs_fpcr_write, 355 .write = spufs_fpcr_write,
@@ -426,7 +415,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
426 return count; 415 return count;
427} 416}
428 417
429static struct file_operations spufs_mbox_fops = { 418static const struct file_operations spufs_mbox_fops = {
430 .open = spufs_pipe_open, 419 .open = spufs_pipe_open,
431 .read = spufs_mbox_read, 420 .read = spufs_mbox_read,
432}; 421};
@@ -452,7 +441,7 @@ static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
452 return 4; 441 return 4;
453} 442}
454 443
455static struct file_operations spufs_mbox_stat_fops = { 444static const struct file_operations spufs_mbox_stat_fops = {
456 .open = spufs_pipe_open, 445 .open = spufs_pipe_open,
457 .read = spufs_mbox_stat_read, 446 .read = spufs_mbox_stat_read,
458}; 447};
@@ -559,7 +548,7 @@ static unsigned int spufs_ibox_poll(struct file *file, poll_table *wait)
559 return mask; 548 return mask;
560} 549}
561 550
562static struct file_operations spufs_ibox_fops = { 551static const struct file_operations spufs_ibox_fops = {
563 .open = spufs_pipe_open, 552 .open = spufs_pipe_open,
564 .read = spufs_ibox_read, 553 .read = spufs_ibox_read,
565 .poll = spufs_ibox_poll, 554 .poll = spufs_ibox_poll,
@@ -585,7 +574,7 @@ static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
585 return 4; 574 return 4;
586} 575}
587 576
588static struct file_operations spufs_ibox_stat_fops = { 577static const struct file_operations spufs_ibox_stat_fops = {
589 .open = spufs_pipe_open, 578 .open = spufs_pipe_open,
590 .read = spufs_ibox_stat_read, 579 .read = spufs_ibox_stat_read,
591}; 580};
@@ -692,7 +681,7 @@ static unsigned int spufs_wbox_poll(struct file *file, poll_table *wait)
692 return mask; 681 return mask;
693} 682}
694 683
695static struct file_operations spufs_wbox_fops = { 684static const struct file_operations spufs_wbox_fops = {
696 .open = spufs_pipe_open, 685 .open = spufs_pipe_open,
697 .write = spufs_wbox_write, 686 .write = spufs_wbox_write,
698 .poll = spufs_wbox_poll, 687 .poll = spufs_wbox_poll,
@@ -718,7 +707,7 @@ static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
718 return 4; 707 return 4;
719} 708}
720 709
721static struct file_operations spufs_wbox_stat_fops = { 710static const struct file_operations spufs_wbox_stat_fops = {
722 .open = spufs_pipe_open, 711 .open = spufs_pipe_open,
723 .read = spufs_wbox_stat_read, 712 .read = spufs_wbox_stat_read,
724}; 713};
@@ -728,8 +717,8 @@ static int spufs_signal1_open(struct inode *inode, struct file *file)
728 struct spufs_inode_info *i = SPUFS_I(inode); 717 struct spufs_inode_info *i = SPUFS_I(inode);
729 struct spu_context *ctx = i->i_ctx; 718 struct spu_context *ctx = i->i_ctx;
730 file->private_data = ctx; 719 file->private_data = ctx;
731 file->f_mapping = inode->i_mapping;
732 ctx->signal1 = inode->i_mapping; 720 ctx->signal1 = inode->i_mapping;
721 smp_wmb();
733 return nonseekable_open(inode, file); 722 return nonseekable_open(inode, file);
734} 723}
735 724
@@ -791,23 +780,23 @@ static ssize_t spufs_signal1_write(struct file *file, const char __user *buf,
791 return 4; 780 return 4;
792} 781}
793 782
794static struct page *spufs_signal1_mmap_nopage(struct vm_area_struct *vma, 783static unsigned long spufs_signal1_mmap_nopfn(struct vm_area_struct *vma,
795 unsigned long address, int *type) 784 unsigned long address)
796{ 785{
797#if PAGE_SIZE == 0x1000 786#if PAGE_SIZE == 0x1000
798 return spufs_ps_nopage(vma, address, type, 0x14000, 0x1000); 787 return spufs_ps_nopfn(vma, address, 0x14000, 0x1000);
799#elif PAGE_SIZE == 0x10000 788#elif PAGE_SIZE == 0x10000
800 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole 789 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole
801 * signal 1 and 2 area 790 * signal 1 and 2 area
802 */ 791 */
803 return spufs_ps_nopage(vma, address, type, 0x10000, 0x10000); 792 return spufs_ps_nopfn(vma, address, 0x10000, 0x10000);
804#else 793#else
805#error unsupported page size 794#error unsupported page size
806#endif 795#endif
807} 796}
808 797
809static struct vm_operations_struct spufs_signal1_mmap_vmops = { 798static struct vm_operations_struct spufs_signal1_mmap_vmops = {
810 .nopage = spufs_signal1_mmap_nopage, 799 .nopfn = spufs_signal1_mmap_nopfn,
811}; 800};
812 801
813static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma) 802static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
@@ -815,7 +804,7 @@ static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
815 if (!(vma->vm_flags & VM_SHARED)) 804 if (!(vma->vm_flags & VM_SHARED))
816 return -EINVAL; 805 return -EINVAL;
817 806
818 vma->vm_flags |= VM_IO; 807 vma->vm_flags |= VM_IO | VM_PFNMAP;
819 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 808 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
820 | _PAGE_NO_CACHE | _PAGE_GUARDED); 809 | _PAGE_NO_CACHE | _PAGE_GUARDED);
821 810
@@ -823,7 +812,7 @@ static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
823 return 0; 812 return 0;
824} 813}
825 814
826static struct file_operations spufs_signal1_fops = { 815static const struct file_operations spufs_signal1_fops = {
827 .open = spufs_signal1_open, 816 .open = spufs_signal1_open,
828 .read = spufs_signal1_read, 817 .read = spufs_signal1_read,
829 .write = spufs_signal1_write, 818 .write = spufs_signal1_write,
@@ -835,8 +824,8 @@ static int spufs_signal2_open(struct inode *inode, struct file *file)
835 struct spufs_inode_info *i = SPUFS_I(inode); 824 struct spufs_inode_info *i = SPUFS_I(inode);
836 struct spu_context *ctx = i->i_ctx; 825 struct spu_context *ctx = i->i_ctx;
837 file->private_data = ctx; 826 file->private_data = ctx;
838 file->f_mapping = inode->i_mapping;
839 ctx->signal2 = inode->i_mapping; 827 ctx->signal2 = inode->i_mapping;
828 smp_wmb();
840 return nonseekable_open(inode, file); 829 return nonseekable_open(inode, file);
841} 830}
842 831
@@ -899,23 +888,23 @@ static ssize_t spufs_signal2_write(struct file *file, const char __user *buf,
899} 888}
900 889
901#if SPUFS_MMAP_4K 890#if SPUFS_MMAP_4K
902static struct page *spufs_signal2_mmap_nopage(struct vm_area_struct *vma, 891static unsigned long spufs_signal2_mmap_nopfn(struct vm_area_struct *vma,
903 unsigned long address, int *type) 892 unsigned long address)
904{ 893{
905#if PAGE_SIZE == 0x1000 894#if PAGE_SIZE == 0x1000
906 return spufs_ps_nopage(vma, address, type, 0x1c000, 0x1000); 895 return spufs_ps_nopfn(vma, address, 0x1c000, 0x1000);
907#elif PAGE_SIZE == 0x10000 896#elif PAGE_SIZE == 0x10000
908 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole 897 /* For 64k pages, both signal1 and signal2 can be used to mmap the whole
909 * signal 1 and 2 area 898 * signal 1 and 2 area
910 */ 899 */
911 return spufs_ps_nopage(vma, address, type, 0x10000, 0x10000); 900 return spufs_ps_nopfn(vma, address, 0x10000, 0x10000);
912#else 901#else
913#error unsupported page size 902#error unsupported page size
914#endif 903#endif
915} 904}
916 905
917static struct vm_operations_struct spufs_signal2_mmap_vmops = { 906static struct vm_operations_struct spufs_signal2_mmap_vmops = {
918 .nopage = spufs_signal2_mmap_nopage, 907 .nopfn = spufs_signal2_mmap_nopfn,
919}; 908};
920 909
921static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma) 910static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
@@ -923,7 +912,7 @@ static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
923 if (!(vma->vm_flags & VM_SHARED)) 912 if (!(vma->vm_flags & VM_SHARED))
924 return -EINVAL; 913 return -EINVAL;
925 914
926 vma->vm_flags |= VM_IO; 915 vma->vm_flags |= VM_IO | VM_PFNMAP;
927 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 916 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
928 | _PAGE_NO_CACHE | _PAGE_GUARDED); 917 | _PAGE_NO_CACHE | _PAGE_GUARDED);
929 918
@@ -934,7 +923,7 @@ static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
934#define spufs_signal2_mmap NULL 923#define spufs_signal2_mmap NULL
935#endif /* !SPUFS_MMAP_4K */ 924#endif /* !SPUFS_MMAP_4K */
936 925
937static struct file_operations spufs_signal2_fops = { 926static const struct file_operations spufs_signal2_fops = {
938 .open = spufs_signal2_open, 927 .open = spufs_signal2_open,
939 .read = spufs_signal2_read, 928 .read = spufs_signal2_read,
940 .write = spufs_signal2_write, 929 .write = spufs_signal2_write,
@@ -1000,14 +989,14 @@ DEFINE_SIMPLE_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
1000 spufs_signal2_type_set, "%llu"); 989 spufs_signal2_type_set, "%llu");
1001 990
1002#if SPUFS_MMAP_4K 991#if SPUFS_MMAP_4K
1003static struct page *spufs_mss_mmap_nopage(struct vm_area_struct *vma, 992static unsigned long spufs_mss_mmap_nopfn(struct vm_area_struct *vma,
1004 unsigned long address, int *type) 993 unsigned long address)
1005{ 994{
1006 return spufs_ps_nopage(vma, address, type, 0x0000, 0x1000); 995 return spufs_ps_nopfn(vma, address, 0x0000, 0x1000);
1007} 996}
1008 997
1009static struct vm_operations_struct spufs_mss_mmap_vmops = { 998static struct vm_operations_struct spufs_mss_mmap_vmops = {
1010 .nopage = spufs_mss_mmap_nopage, 999 .nopfn = spufs_mss_mmap_nopfn,
1011}; 1000};
1012 1001
1013/* 1002/*
@@ -1018,7 +1007,7 @@ static int spufs_mss_mmap(struct file *file, struct vm_area_struct *vma)
1018 if (!(vma->vm_flags & VM_SHARED)) 1007 if (!(vma->vm_flags & VM_SHARED))
1019 return -EINVAL; 1008 return -EINVAL;
1020 1009
1021 vma->vm_flags |= VM_IO; 1010 vma->vm_flags |= VM_IO | VM_PFNMAP;
1022 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 1011 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
1023 | _PAGE_NO_CACHE | _PAGE_GUARDED); 1012 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1024 1013
@@ -1032,24 +1021,27 @@ static int spufs_mss_mmap(struct file *file, struct vm_area_struct *vma)
1032static int spufs_mss_open(struct inode *inode, struct file *file) 1021static int spufs_mss_open(struct inode *inode, struct file *file)
1033{ 1022{
1034 struct spufs_inode_info *i = SPUFS_I(inode); 1023 struct spufs_inode_info *i = SPUFS_I(inode);
1024 struct spu_context *ctx = i->i_ctx;
1035 1025
1036 file->private_data = i->i_ctx; 1026 file->private_data = i->i_ctx;
1027 ctx->mss = inode->i_mapping;
1028 smp_wmb();
1037 return nonseekable_open(inode, file); 1029 return nonseekable_open(inode, file);
1038} 1030}
1039 1031
1040static struct file_operations spufs_mss_fops = { 1032static const struct file_operations spufs_mss_fops = {
1041 .open = spufs_mss_open, 1033 .open = spufs_mss_open,
1042 .mmap = spufs_mss_mmap, 1034 .mmap = spufs_mss_mmap,
1043}; 1035};
1044 1036
1045static struct page *spufs_psmap_mmap_nopage(struct vm_area_struct *vma, 1037static unsigned long spufs_psmap_mmap_nopfn(struct vm_area_struct *vma,
1046 unsigned long address, int *type) 1038 unsigned long address)
1047{ 1039{
1048 return spufs_ps_nopage(vma, address, type, 0x0000, 0x20000); 1040 return spufs_ps_nopfn(vma, address, 0x0000, 0x20000);
1049} 1041}
1050 1042
1051static struct vm_operations_struct spufs_psmap_mmap_vmops = { 1043static struct vm_operations_struct spufs_psmap_mmap_vmops = {
1052 .nopage = spufs_psmap_mmap_nopage, 1044 .nopfn = spufs_psmap_mmap_nopfn,
1053}; 1045};
1054 1046
1055/* 1047/*
@@ -1060,7 +1052,7 @@ static int spufs_psmap_mmap(struct file *file, struct vm_area_struct *vma)
1060 if (!(vma->vm_flags & VM_SHARED)) 1052 if (!(vma->vm_flags & VM_SHARED))
1061 return -EINVAL; 1053 return -EINVAL;
1062 1054
1063 vma->vm_flags |= VM_IO; 1055 vma->vm_flags |= VM_IO | VM_PFNMAP;
1064 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 1056 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
1065 | _PAGE_NO_CACHE | _PAGE_GUARDED); 1057 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1066 1058
@@ -1071,26 +1063,29 @@ static int spufs_psmap_mmap(struct file *file, struct vm_area_struct *vma)
1071static int spufs_psmap_open(struct inode *inode, struct file *file) 1063static int spufs_psmap_open(struct inode *inode, struct file *file)
1072{ 1064{
1073 struct spufs_inode_info *i = SPUFS_I(inode); 1065 struct spufs_inode_info *i = SPUFS_I(inode);
1066 struct spu_context *ctx = i->i_ctx;
1074 1067
1075 file->private_data = i->i_ctx; 1068 file->private_data = i->i_ctx;
1069 ctx->psmap = inode->i_mapping;
1070 smp_wmb();
1076 return nonseekable_open(inode, file); 1071 return nonseekable_open(inode, file);
1077} 1072}
1078 1073
1079static struct file_operations spufs_psmap_fops = { 1074static const struct file_operations spufs_psmap_fops = {
1080 .open = spufs_psmap_open, 1075 .open = spufs_psmap_open,
1081 .mmap = spufs_psmap_mmap, 1076 .mmap = spufs_psmap_mmap,
1082}; 1077};
1083 1078
1084 1079
1085#if SPUFS_MMAP_4K 1080#if SPUFS_MMAP_4K
1086static struct page *spufs_mfc_mmap_nopage(struct vm_area_struct *vma, 1081static unsigned long spufs_mfc_mmap_nopfn(struct vm_area_struct *vma,
1087 unsigned long address, int *type) 1082 unsigned long address)
1088{ 1083{
1089 return spufs_ps_nopage(vma, address, type, 0x3000, 0x1000); 1084 return spufs_ps_nopfn(vma, address, 0x3000, 0x1000);
1090} 1085}
1091 1086
1092static struct vm_operations_struct spufs_mfc_mmap_vmops = { 1087static struct vm_operations_struct spufs_mfc_mmap_vmops = {
1093 .nopage = spufs_mfc_mmap_nopage, 1088 .nopfn = spufs_mfc_mmap_nopfn,
1094}; 1089};
1095 1090
1096/* 1091/*
@@ -1101,7 +1096,7 @@ static int spufs_mfc_mmap(struct file *file, struct vm_area_struct *vma)
1101 if (!(vma->vm_flags & VM_SHARED)) 1096 if (!(vma->vm_flags & VM_SHARED))
1102 return -EINVAL; 1097 return -EINVAL;
1103 1098
1104 vma->vm_flags |= VM_IO; 1099 vma->vm_flags |= VM_IO | VM_PFNMAP;
1105 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot) 1100 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
1106 | _PAGE_NO_CACHE | _PAGE_GUARDED); 1101 | _PAGE_NO_CACHE | _PAGE_GUARDED);
1107 1102
@@ -1125,6 +1120,8 @@ static int spufs_mfc_open(struct inode *inode, struct file *file)
1125 return -EBUSY; 1120 return -EBUSY;
1126 1121
1127 file->private_data = ctx; 1122 file->private_data = ctx;
1123 ctx->mfc = inode->i_mapping;
1124 smp_wmb();
1128 return nonseekable_open(inode, file); 1125 return nonseekable_open(inode, file);
1129} 1126}
1130 1127
@@ -1393,7 +1390,7 @@ static int spufs_mfc_fasync(int fd, struct file *file, int on)
1393 return fasync_helper(fd, file, on, &ctx->mfc_fasync); 1390 return fasync_helper(fd, file, on, &ctx->mfc_fasync);
1394} 1391}
1395 1392
1396static struct file_operations spufs_mfc_fops = { 1393static const struct file_operations spufs_mfc_fops = {
1397 .open = spufs_mfc_open, 1394 .open = spufs_mfc_open,
1398 .read = spufs_mfc_read, 1395 .read = spufs_mfc_read,
1399 .write = spufs_mfc_write, 1396 .write = spufs_mfc_write,
@@ -1650,7 +1647,7 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf,
1650 return ret; 1647 return ret;
1651} 1648}
1652 1649
1653static struct file_operations spufs_mbox_info_fops = { 1650static const struct file_operations spufs_mbox_info_fops = {
1654 .open = spufs_info_open, 1651 .open = spufs_info_open,
1655 .read = spufs_mbox_info_read, 1652 .read = spufs_mbox_info_read,
1656 .llseek = generic_file_llseek, 1653 .llseek = generic_file_llseek,
@@ -1688,7 +1685,7 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,
1688 return ret; 1685 return ret;
1689} 1686}
1690 1687
1691static struct file_operations spufs_ibox_info_fops = { 1688static const struct file_operations spufs_ibox_info_fops = {
1692 .open = spufs_info_open, 1689 .open = spufs_info_open,
1693 .read = spufs_ibox_info_read, 1690 .read = spufs_ibox_info_read,
1694 .llseek = generic_file_llseek, 1691 .llseek = generic_file_llseek,
@@ -1729,7 +1726,7 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,
1729 return ret; 1726 return ret;
1730} 1727}
1731 1728
1732static struct file_operations spufs_wbox_info_fops = { 1729static const struct file_operations spufs_wbox_info_fops = {
1733 .open = spufs_info_open, 1730 .open = spufs_info_open,
1734 .read = spufs_wbox_info_read, 1731 .read = spufs_wbox_info_read,
1735 .llseek = generic_file_llseek, 1732 .llseek = generic_file_llseek,
@@ -1779,7 +1776,7 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,
1779 return ret; 1776 return ret;
1780} 1777}
1781 1778
1782static struct file_operations spufs_dma_info_fops = { 1779static const struct file_operations spufs_dma_info_fops = {
1783 .open = spufs_info_open, 1780 .open = spufs_info_open,
1784 .read = spufs_dma_info_read, 1781 .read = spufs_dma_info_read,
1785}; 1782};
@@ -1830,7 +1827,7 @@ static ssize_t spufs_proxydma_info_read(struct file *file, char __user *buf,
1830 return ret; 1827 return ret;
1831} 1828}
1832 1829
1833static struct file_operations spufs_proxydma_info_fops = { 1830static const struct file_operations spufs_proxydma_info_fops = {
1834 .open = spufs_info_open, 1831 .open = spufs_info_open,
1835 .read = spufs_proxydma_info_read, 1832 .read = spufs_proxydma_info_read,
1836}; 1833};
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 738b9244382f..8079983ef94f 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -220,11 +220,11 @@ static int spufs_dir_close(struct inode *inode, struct file *file)
220 return dcache_dir_close(inode, file); 220 return dcache_dir_close(inode, file);
221} 221}
222 222
223struct inode_operations spufs_dir_inode_operations = { 223const struct inode_operations spufs_dir_inode_operations = {
224 .lookup = simple_lookup, 224 .lookup = simple_lookup,
225}; 225};
226 226
227struct file_operations spufs_context_fops = { 227const struct file_operations spufs_context_fops = {
228 .open = dcache_dir_open, 228 .open = dcache_dir_open,
229 .release = spufs_dir_close, 229 .release = spufs_dir_close,
230 .llseek = dcache_dir_lseek, 230 .llseek = dcache_dir_lseek,
@@ -372,7 +372,7 @@ static int spufs_gang_close(struct inode *inode, struct file *file)
372 return dcache_dir_close(inode, file); 372 return dcache_dir_close(inode, file);
373} 373}
374 374
375struct file_operations spufs_gang_fops = { 375const struct file_operations spufs_gang_fops = {
376 .open = dcache_dir_open, 376 .open = dcache_dir_open,
377 .release = spufs_gang_close, 377 .release = spufs_gang_close,
378 .llseek = dcache_dir_lseek, 378 .llseek = dcache_dir_lseek,
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index 70fb13395c04..0941c56df9b5 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -51,6 +51,8 @@ struct spu_context {
51 struct address_space *cntl; /* 'control' area mappings. */ 51 struct address_space *cntl; /* 'control' area mappings. */
52 struct address_space *signal1; /* 'signal1' area mappings. */ 52 struct address_space *signal1; /* 'signal1' area mappings. */
53 struct address_space *signal2; /* 'signal2' area mappings. */ 53 struct address_space *signal2; /* 'signal2' area mappings. */
54 struct address_space *mss; /* 'mss' area mappings. */
55 struct address_space *psmap; /* 'psmap' area mappings. */
54 u64 object_id; /* user space pointer for oprofile */ 56 u64 object_id; /* user space pointer for oprofile */
55 57
56 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state; 58 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
@@ -149,7 +151,7 @@ long spufs_run_spu(struct file *file,
149 struct spu_context *ctx, u32 *npc, u32 *status); 151 struct spu_context *ctx, u32 *npc, u32 *status);
150long spufs_create(struct nameidata *nd, 152long spufs_create(struct nameidata *nd,
151 unsigned int flags, mode_t mode); 153 unsigned int flags, mode_t mode);
152extern struct file_operations spufs_context_fops; 154extern const struct file_operations spufs_context_fops;
153 155
154/* gang management */ 156/* gang management */
155struct spu_gang *alloc_spu_gang(void); 157struct spu_gang *alloc_spu_gang(void);
diff --git a/arch/powerpc/platforms/celleb/htab.c b/arch/powerpc/platforms/celleb/htab.c
index ffa7c2c2030d..279d7339e170 100644
--- a/arch/powerpc/platforms/celleb/htab.c
+++ b/arch/powerpc/platforms/celleb/htab.c
@@ -95,7 +95,6 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group,
95 unsigned long lpar_rc; 95 unsigned long lpar_rc;
96 unsigned long slot; 96 unsigned long slot;
97 unsigned long hpte_v, hpte_r; 97 unsigned long hpte_v, hpte_r;
98 unsigned long flags;
99 98
100 /* same as iseries */ 99 /* same as iseries */
101 if (vflags & HPTE_V_SECONDARY) 100 if (vflags & HPTE_V_SECONDARY)
@@ -115,17 +114,17 @@ static long beat_lpar_hpte_insert(unsigned long hpte_group,
115 if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE)) 114 if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE))
116 hpte_r &= ~_PAGE_COHERENT; 115 hpte_r &= ~_PAGE_COHERENT;
117 116
118 spin_lock_irqsave(&beat_htab_lock, flags); 117 spin_lock(&beat_htab_lock);
119 if ((lpar_rc = beat_read_mask(hpte_group)) == 0) { 118 if ((lpar_rc = beat_read_mask(hpte_group)) == 0) {
120 if (!(vflags & HPTE_V_BOLTED)) 119 if (!(vflags & HPTE_V_BOLTED))
121 DBG_LOW(" full\n"); 120 DBG_LOW(" full\n");
122 spin_unlock_irqrestore(&beat_htab_lock, flags); 121 spin_unlock(&beat_htab_lock);
123 return -1; 122 return -1;
124 } 123 }
125 124
126 lpar_rc = beat_insert_htab_entry(0, hpte_group, lpar_rc << 48, 125 lpar_rc = beat_insert_htab_entry(0, hpte_group, lpar_rc << 48,
127 hpte_v, hpte_r, &slot); 126 hpte_v, hpte_r, &slot);
128 spin_unlock_irqrestore(&beat_htab_lock, flags); 127 spin_unlock(&beat_htab_lock);
129 128
130 /* 129 /*
131 * Since we try and ioremap PHBs we don't own, the pte insert 130 * Since we try and ioremap PHBs we don't own, the pte insert
@@ -189,7 +188,6 @@ static long beat_lpar_hpte_updatepp(unsigned long slot,
189{ 188{
190 unsigned long lpar_rc; 189 unsigned long lpar_rc;
191 unsigned long dummy0, dummy1, want_v; 190 unsigned long dummy0, dummy1, want_v;
192 unsigned long flags;
193 191
194 want_v = hpte_encode_v(va, psize); 192 want_v = hpte_encode_v(va, psize);
195 193
@@ -197,17 +195,17 @@ static long beat_lpar_hpte_updatepp(unsigned long slot,
197 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ", 195 "avpnv=%016lx, slot=%016lx, psize: %d, newpp %016lx ... ",
198 want_v & HPTE_V_AVPN, slot, psize, newpp); 196 want_v & HPTE_V_AVPN, slot, psize, newpp);
199 197
200 spin_lock_irqsave(&beat_htab_lock, flags); 198 spin_lock(&beat_htab_lock);
201 dummy0 = beat_lpar_hpte_getword0(slot); 199 dummy0 = beat_lpar_hpte_getword0(slot);
202 if ((dummy0 & ~0x7FUL) != (want_v & ~0x7FUL)) { 200 if ((dummy0 & ~0x7FUL) != (want_v & ~0x7FUL)) {
203 DBG_LOW("not found !\n"); 201 DBG_LOW("not found !\n");
204 spin_unlock_irqrestore(&beat_htab_lock, flags); 202 spin_unlock(&beat_htab_lock);
205 return -1; 203 return -1;
206 } 204 }
207 205
208 lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7, &dummy0, 206 lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7, &dummy0,
209 &dummy1); 207 &dummy1);
210 spin_unlock_irqrestore(&beat_htab_lock, flags); 208 spin_unlock(&beat_htab_lock);
211 if (lpar_rc != 0 || dummy0 == 0) { 209 if (lpar_rc != 0 || dummy0 == 0) {
212 DBG_LOW("not found !\n"); 210 DBG_LOW("not found !\n");
213 return -1; 211 return -1;
@@ -256,18 +254,17 @@ static void beat_lpar_hpte_updateboltedpp(unsigned long newpp,
256 int psize) 254 int psize)
257{ 255{
258 unsigned long lpar_rc, slot, vsid, va, dummy0, dummy1; 256 unsigned long lpar_rc, slot, vsid, va, dummy0, dummy1;
259 unsigned long flags;
260 257
261 vsid = get_kernel_vsid(ea); 258 vsid = get_kernel_vsid(ea);
262 va = (vsid << 28) | (ea & 0x0fffffff); 259 va = (vsid << 28) | (ea & 0x0fffffff);
263 260
264 spin_lock_irqsave(&beat_htab_lock, flags); 261 spin_lock(&beat_htab_lock);
265 slot = beat_lpar_hpte_find(va, psize); 262 slot = beat_lpar_hpte_find(va, psize);
266 BUG_ON(slot == -1); 263 BUG_ON(slot == -1);
267 264
268 lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7, 265 lpar_rc = beat_write_htab_entry(0, slot, 0, newpp, 0, 7,
269 &dummy0, &dummy1); 266 &dummy0, &dummy1);
270 spin_unlock_irqrestore(&beat_htab_lock, flags); 267 spin_unlock(&beat_htab_lock);
271 268
272 BUG_ON(lpar_rc != 0); 269 BUG_ON(lpar_rc != 0);
273} 270}
diff --git a/arch/powerpc/platforms/celleb/pci.c b/arch/powerpc/platforms/celleb/pci.c
index 867f83a7d0c9..98de836dfed3 100644
--- a/arch/powerpc/platforms/celleb/pci.c
+++ b/arch/powerpc/platforms/celleb/pci.c
@@ -65,13 +65,13 @@ static inline u8 celleb_fake_config_readb(void *addr)
65 65
66static inline u16 celleb_fake_config_readw(void *addr) 66static inline u16 celleb_fake_config_readw(void *addr)
67{ 67{
68 u16 *p = addr; 68 __le16 *p = addr;
69 return le16_to_cpu(*p); 69 return le16_to_cpu(*p);
70} 70}
71 71
72static inline u32 celleb_fake_config_readl(void *addr) 72static inline u32 celleb_fake_config_readl(void *addr)
73{ 73{
74 u32 *p = addr; 74 __le32 *p = addr;
75 return le32_to_cpu(*p); 75 return le32_to_cpu(*p);
76} 76}
77 77
@@ -83,16 +83,16 @@ static inline void celleb_fake_config_writeb(u32 val, void *addr)
83 83
84static inline void celleb_fake_config_writew(u32 val, void *addr) 84static inline void celleb_fake_config_writew(u32 val, void *addr)
85{ 85{
86 u16 val16; 86 __le16 val16;
87 u16 *p = addr; 87 __le16 *p = addr;
88 val16 = cpu_to_le16(val); 88 val16 = cpu_to_le16(val);
89 *p = val16; 89 *p = val16;
90} 90}
91 91
92static inline void celleb_fake_config_writel(u32 val, void *addr) 92static inline void celleb_fake_config_writel(u32 val, void *addr)
93{ 93{
94 u32 val32; 94 __le32 val32;
95 u32 *p = addr; 95 __le32 *p = addr;
96 val32 = cpu_to_le32(val); 96 val32 = cpu_to_le32(val);
97 *p = val32; 97 *p = val32;
98} 98}
diff --git a/arch/powerpc/platforms/celleb/scc_epci.c b/arch/powerpc/platforms/celleb/scc_epci.c
index 0edbc0c4f338..c11b39c3776a 100644
--- a/arch/powerpc/platforms/celleb/scc_epci.c
+++ b/arch/powerpc/platforms/celleb/scc_epci.c
@@ -47,7 +47,7 @@
47#if 0 /* test code for epci dummy read */ 47#if 0 /* test code for epci dummy read */
48static void celleb_epci_dummy_read(struct pci_dev *dev) 48static void celleb_epci_dummy_read(struct pci_dev *dev)
49{ 49{
50 void *epci_base; 50 void __iomem *epci_base;
51 struct device_node *node; 51 struct device_node *node;
52 struct pci_controller *hose; 52 struct pci_controller *hose;
53 u32 val; 53 u32 val;
@@ -58,7 +58,7 @@ static void celleb_epci_dummy_read(struct pci_dev *dev)
58 if (!hose) 58 if (!hose)
59 return; 59 return;
60 60
61 epci_base = (void *)hose->cfg_addr; 61 epci_base = hose->cfg_addr;
62 62
63 val = in_be32(epci_base + SCC_EPCI_WATRP); 63 val = in_be32(epci_base + SCC_EPCI_WATRP);
64 iosync(); 64 iosync();
@@ -71,18 +71,18 @@ static inline void clear_and_disable_master_abort_interrupt(
71 struct pci_controller *hose) 71 struct pci_controller *hose)
72{ 72{
73 void __iomem *addr; 73 void __iomem *addr;
74 addr = (void *)hose->cfg_addr + PCI_COMMAND; 74 addr = hose->cfg_addr + PCI_COMMAND;
75 out_be32(addr, in_be32(addr) | (PCI_STATUS_REC_MASTER_ABORT << 16)); 75 out_be32(addr, in_be32(addr) | (PCI_STATUS_REC_MASTER_ABORT << 16));
76} 76}
77 77
78static int celleb_epci_check_abort(struct pci_controller *hose, 78static int celleb_epci_check_abort(struct pci_controller *hose,
79 unsigned long addr) 79 void __iomem *addr)
80{ 80{
81 void __iomem *reg, *epci_base; 81 void __iomem *reg, *epci_base;
82 u32 val; 82 u32 val;
83 83
84 iob(); 84 iob();
85 epci_base = (void *)hose->cfg_addr; 85 epci_base = hose->cfg_addr;
86 86
87 reg = epci_base + PCI_COMMAND; 87 reg = epci_base + PCI_COMMAND;
88 val = in_be32(reg); 88 val = in_be32(reg);
@@ -108,23 +108,23 @@ static int celleb_epci_check_abort(struct pci_controller *hose,
108 return PCIBIOS_SUCCESSFUL; 108 return PCIBIOS_SUCCESSFUL;
109} 109}
110 110
111static unsigned long celleb_epci_make_config_addr(struct pci_controller *hose, 111static void __iomem *celleb_epci_make_config_addr(struct pci_controller *hose,
112 unsigned int devfn, int where) 112 unsigned int devfn, int where)
113{ 113{
114 unsigned long addr; 114 void __iomem *addr;
115 struct pci_bus *bus = hose->bus; 115 struct pci_bus *bus = hose->bus;
116 116
117 if (bus->self) 117 if (bus->self)
118 addr = (unsigned long)hose->cfg_data + 118 addr = hose->cfg_data +
119 (((bus->number & 0xff) << 16) 119 (((bus->number & 0xff) << 16)
120 | ((devfn & 0xff) << 8) 120 | ((devfn & 0xff) << 8)
121 | (where & 0xff) 121 | (where & 0xff)
122 | 0x01000000); 122 | 0x01000000);
123 else 123 else
124 addr = (unsigned long)hose->cfg_data + 124 addr = hose->cfg_data +
125 (((devfn & 0xff) << 8) | (where & 0xff)); 125 (((devfn & 0xff) << 8) | (where & 0xff));
126 126
127 pr_debug("EPCI: config_addr = 0x%016lx\n", addr); 127 pr_debug("EPCI: config_addr = 0x%p\n", addr);
128 128
129 return addr; 129 return addr;
130} 130}
@@ -132,7 +132,7 @@ static unsigned long celleb_epci_make_config_addr(struct pci_controller *hose,
132static int celleb_epci_read_config(struct pci_bus *bus, 132static int celleb_epci_read_config(struct pci_bus *bus,
133 unsigned int devfn, int where, int size, u32 * val) 133 unsigned int devfn, int where, int size, u32 * val)
134{ 134{
135 unsigned long addr; 135 void __iomem *addr;
136 struct device_node *node; 136 struct device_node *node;
137 struct pci_controller *hose; 137 struct pci_controller *hose;
138 138
@@ -148,17 +148,17 @@ static int celleb_epci_read_config(struct pci_bus *bus,
148 if (bus->number == hose->first_busno && devfn == 0) { 148 if (bus->number == hose->first_busno && devfn == 0) {
149 /* EPCI controller self */ 149 /* EPCI controller self */
150 150
151 addr = (unsigned long)hose->cfg_addr + where; 151 addr = hose->cfg_addr + where;
152 152
153 switch (size) { 153 switch (size) {
154 case 1: 154 case 1:
155 *val = in_8((u8 *)addr); 155 *val = in_8(addr);
156 break; 156 break;
157 case 2: 157 case 2:
158 *val = in_be16((u16 *)addr); 158 *val = in_be16(addr);
159 break; 159 break;
160 case 4: 160 case 4:
161 *val = in_be32((u32 *)addr); 161 *val = in_be32(addr);
162 break; 162 break;
163 default: 163 default:
164 return PCIBIOS_DEVICE_NOT_FOUND; 164 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -171,13 +171,13 @@ static int celleb_epci_read_config(struct pci_bus *bus,
171 171
172 switch (size) { 172 switch (size) {
173 case 1: 173 case 1:
174 *val = in_8((u8 *)addr); 174 *val = in_8(addr);
175 break; 175 break;
176 case 2: 176 case 2:
177 *val = in_le16((u16 *)addr); 177 *val = in_le16(addr);
178 break; 178 break;
179 case 4: 179 case 4:
180 *val = in_le32((u32 *)addr); 180 *val = in_le32(addr);
181 break; 181 break;
182 default: 182 default:
183 return PCIBIOS_DEVICE_NOT_FOUND; 183 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -188,13 +188,13 @@ static int celleb_epci_read_config(struct pci_bus *bus,
188 "addr=0x%lx, devfn=0x%x, where=0x%x, size=0x%x, val=0x%x\n", 188 "addr=0x%lx, devfn=0x%x, where=0x%x, size=0x%x, val=0x%x\n",
189 addr, devfn, where, size, *val); 189 addr, devfn, where, size, *val);
190 190
191 return celleb_epci_check_abort(hose, 0); 191 return celleb_epci_check_abort(hose, NULL);
192} 192}
193 193
194static int celleb_epci_write_config(struct pci_bus *bus, 194static int celleb_epci_write_config(struct pci_bus *bus,
195 unsigned int devfn, int where, int size, u32 val) 195 unsigned int devfn, int where, int size, u32 val)
196{ 196{
197 unsigned long addr; 197 void __iomem *addr;
198 struct device_node *node; 198 struct device_node *node;
199 struct pci_controller *hose; 199 struct pci_controller *hose;
200 200
@@ -210,17 +210,17 @@ static int celleb_epci_write_config(struct pci_bus *bus,
210 if (bus->number == hose->first_busno && devfn == 0) { 210 if (bus->number == hose->first_busno && devfn == 0) {
211 /* EPCI controller self */ 211 /* EPCI controller self */
212 212
213 addr = (unsigned long)hose->cfg_addr + where; 213 addr = hose->cfg_addr + where;
214 214
215 switch (size) { 215 switch (size) {
216 case 1: 216 case 1:
217 out_8((u8 *)addr, val); 217 out_8(addr, val);
218 break; 218 break;
219 case 2: 219 case 2:
220 out_be16((u16 *)addr, val); 220 out_be16(addr, val);
221 break; 221 break;
222 case 4: 222 case 4:
223 out_be32((u32 *)addr, val); 223 out_be32(addr, val);
224 break; 224 break;
225 default: 225 default:
226 return PCIBIOS_DEVICE_NOT_FOUND; 226 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -233,13 +233,13 @@ static int celleb_epci_write_config(struct pci_bus *bus,
233 233
234 switch (size) { 234 switch (size) {
235 case 1: 235 case 1:
236 out_8((u8 *)addr, val); 236 out_8(addr, val);
237 break; 237 break;
238 case 2: 238 case 2:
239 out_le16((u16 *)addr, val); 239 out_le16(addr, val);
240 break; 240 break;
241 case 4: 241 case 4:
242 out_le32((u32 *)addr, val); 242 out_le32(addr, val);
243 break; 243 break;
244 default: 244 default:
245 return PCIBIOS_DEVICE_NOT_FOUND; 245 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -261,7 +261,7 @@ static int __devinit celleb_epci_init(struct pci_controller *hose)
261 void __iomem *reg, *epci_base; 261 void __iomem *reg, *epci_base;
262 int hwres = 0; 262 int hwres = 0;
263 263
264 epci_base = (void *)hose->cfg_addr; 264 epci_base = hose->cfg_addr;
265 265
266 /* PCI core reset(Internal bus and PCI clock) */ 266 /* PCI core reset(Internal bus and PCI clock) */
267 reg = epci_base + SCC_EPCI_CKCTRL; 267 reg = epci_base + SCC_EPCI_CKCTRL;
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index e1f51d455984..117c9a0055bd 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -75,7 +75,7 @@ extern irqreturn_t xmon_irq(int, void *);
75extern unsigned long loops_per_jiffy; 75extern unsigned long loops_per_jiffy;
76 76
77/* To be replaced by RTAS when available */ 77/* To be replaced by RTAS when available */
78static unsigned int *briq_SPOR; 78static unsigned int __iomem *briq_SPOR;
79 79
80#ifdef CONFIG_SMP 80#ifdef CONFIG_SMP
81extern struct smp_ops_t chrp_smp_ops; 81extern struct smp_ops_t chrp_smp_ops;
@@ -267,7 +267,7 @@ void __init chrp_setup_arch(void)
267 } else if (machine && strncmp(machine, "TotalImpact,BRIQ-1", 18) == 0) { 267 } else if (machine && strncmp(machine, "TotalImpact,BRIQ-1", 18) == 0) {
268 _chrp_type = _CHRP_briq; 268 _chrp_type = _CHRP_briq;
269 /* Map the SPOR register on briq and change the restart hook */ 269 /* Map the SPOR register on briq and change the restart hook */
270 briq_SPOR = (unsigned int *)ioremap(0xff0000e8, 4); 270 briq_SPOR = ioremap(0xff0000e8, 4);
271 ppc_md.restart = briq_restart; 271 ppc_md.restart = briq_restart;
272 } else { 272 } else {
273 /* Let's assume it is an IBM chrp if all else fails */ 273 /* Let's assume it is an IBM chrp if all else fails */
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c
index 61599d919ea8..3f6c4114f908 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -13,7 +13,6 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/pci.h> 14#include <linux/pci.h>
15#include <linux/initrd.h> 15#include <linux/initrd.h>
16#include <linux/root_dev.h>
17#include <linux/mtd/physmap.h> 16#include <linux/mtd/physmap.h>
18 17
19#include <asm/time.h> 18#include <asm/time.h>
@@ -91,17 +90,6 @@ static void __init linkstation_setup_arch(void)
91 ARRAY_SIZE(linkstation_physmap_partitions)); 90 ARRAY_SIZE(linkstation_physmap_partitions));
92#endif 91#endif
93 92
94#ifdef CONFIG_BLK_DEV_INITRD
95 if (initrd_start)
96 ROOT_DEV = Root_RAM0;
97 else
98#endif
99#ifdef CONFIG_ROOT_NFS
100 ROOT_DEV = Root_NFS;
101#else
102 ROOT_DEV = Root_HDA1;
103#endif
104
105 /* Lookup PCI host bridges */ 93 /* Lookup PCI host bridges */
106 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) 94 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
107 add_bridge(np); 95 add_bridge(np);
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
index c1f4502a3c6a..91df52a1899a 100644
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -308,7 +308,7 @@ static int proc_lpevents_open(struct inode *inode, struct file *file)
308 return single_open(file, proc_lpevents_show, NULL); 308 return single_open(file, proc_lpevents_show, NULL);
309} 309}
310 310
311static struct file_operations proc_lpevents_operations = { 311static const struct file_operations proc_lpevents_operations = {
312 .open = proc_lpevents_open, 312 .open = proc_lpevents_open,
313 .read = seq_read, 313 .read = seq_read,
314 .llseek = seq_lseek, 314 .llseek = seq_lseek,
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 1ad0e4aaad1a..b1187d95e3b2 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -1224,7 +1224,7 @@ out:
1224 return rc; 1224 return rc;
1225} 1225}
1226 1226
1227static struct file_operations proc_vmlinux_operations = { 1227static const struct file_operations proc_vmlinux_operations = {
1228 .write = proc_mf_change_vmlinux, 1228 .write = proc_mf_change_vmlinux,
1229}; 1229};
1230 1230
@@ -1253,7 +1253,6 @@ static int __init mf_proc_init(void)
1253 ent = create_proc_entry("cmdline", S_IFREG|S_IRUSR|S_IWUSR, mf); 1253 ent = create_proc_entry("cmdline", S_IFREG|S_IRUSR|S_IWUSR, mf);
1254 if (!ent) 1254 if (!ent)
1255 return 1; 1255 return 1;
1256 ent->nlink = 1;
1257 ent->data = (void *)(long)i; 1256 ent->data = (void *)(long)i;
1258 ent->read_proc = proc_mf_dump_cmdline; 1257 ent->read_proc = proc_mf_dump_cmdline;
1259 ent->write_proc = proc_mf_change_cmdline; 1258 ent->write_proc = proc_mf_change_cmdline;
@@ -1264,7 +1263,6 @@ static int __init mf_proc_init(void)
1264 ent = create_proc_entry("vmlinux", S_IFREG|S_IWUSR, mf); 1263 ent = create_proc_entry("vmlinux", S_IFREG|S_IWUSR, mf);
1265 if (!ent) 1264 if (!ent)
1266 return 1; 1265 return 1;
1267 ent->nlink = 1;
1268 ent->data = (void *)(long)i; 1266 ent->data = (void *)(long)i;
1269 ent->proc_fops = &proc_vmlinux_operations; 1267 ent->proc_fops = &proc_vmlinux_operations;
1270 } 1268 }
@@ -1272,7 +1270,6 @@ static int __init mf_proc_init(void)
1272 ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); 1270 ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root);
1273 if (!ent) 1271 if (!ent)
1274 return 1; 1272 return 1;
1275 ent->nlink = 1;
1276 ent->data = (void *)0; 1273 ent->data = (void *)0;
1277 ent->read_proc = proc_mf_dump_side; 1274 ent->read_proc = proc_mf_dump_side;
1278 ent->write_proc = proc_mf_change_side; 1275 ent->write_proc = proc_mf_change_side;
@@ -1280,7 +1277,6 @@ static int __init mf_proc_init(void)
1280 ent = create_proc_entry("src", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); 1277 ent = create_proc_entry("src", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root);
1281 if (!ent) 1278 if (!ent)
1282 return 1; 1279 return 1;
1283 ent->nlink = 1;
1284 ent->data = (void *)0; 1280 ent->data = (void *)0;
1285 ent->read_proc = proc_mf_dump_src; 1281 ent->read_proc = proc_mf_dump_src;
1286 ent->write_proc = proc_mf_change_src; 1282 ent->write_proc = proc_mf_change_src;
diff --git a/arch/powerpc/platforms/iseries/proc.c b/arch/powerpc/platforms/iseries/proc.c
index b54e37101e69..f2cde4180204 100644
--- a/arch/powerpc/platforms/iseries/proc.c
+++ b/arch/powerpc/platforms/iseries/proc.c
@@ -101,7 +101,7 @@ static int proc_titantod_open(struct inode *inode, struct file *file)
101 return single_open(file, proc_titantod_show, NULL); 101 return single_open(file, proc_titantod_show, NULL);
102} 102}
103 103
104static struct file_operations proc_titantod_operations = { 104static const struct file_operations proc_titantod_operations = {
105 .open = proc_titantod_open, 105 .open = proc_titantod_open,
106 .read = seq_read, 106 .read = seq_read,
107 .llseek = seq_lseek, 107 .llseek = seq_lseek,
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c
index a6799ed34a66..e2100ece9c65 100644
--- a/arch/powerpc/platforms/iseries/viopath.c
+++ b/arch/powerpc/platforms/iseries/viopath.c
@@ -173,7 +173,7 @@ static int proc_viopath_open(struct inode *inode, struct file *file)
173 return single_open(file, proc_viopath_show, NULL); 173 return single_open(file, proc_viopath_show, NULL);
174} 174}
175 175
176static struct file_operations proc_viopath_operations = { 176static const struct file_operations proc_viopath_operations = {
177 .open = proc_viopath_open, 177 .open = proc_viopath_open,
178 .read = seq_read, 178 .read = seq_read,
179 .llseek = seq_lseek, 179 .llseek = seq_lseek,
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index d949e9df41ef..651fa424ea06 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -506,8 +506,8 @@ void note_bootable_part(dev_t dev, int part, int goodness)
506 if ((goodness <= current_root_goodness) && 506 if ((goodness <= current_root_goodness) &&
507 ROOT_DEV != DEFAULT_ROOT_DEVICE) 507 ROOT_DEV != DEFAULT_ROOT_DEVICE)
508 return; 508 return;
509 p = strstr(saved_command_line, "root="); 509 p = strstr(boot_command_line, "root=");
510 if (p != NULL && (p == saved_command_line || p[-1] == ' ')) 510 if (p != NULL && (p == boot_command_line || p[-1] == ' '))
511 return; 511 return;
512 512
513 if (!found_boot) { 513 if (!found_boot) {
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig
index de52ec4e9e58..4be3943d1c0d 100644
--- a/arch/powerpc/platforms/ps3/Kconfig
+++ b/arch/powerpc/platforms/ps3/Kconfig
@@ -51,4 +51,15 @@ config PS3_VUART
51 including the System Manager and AV Settings. In 51 including the System Manager and AV Settings. In
52 general, all users will say Y. 52 general, all users will say Y.
53 53
54config PS3_PS3AV
55 tristate "PS3 AV settings driver"
56 depends on PPC_PS3
57 select PS3_VUART
58 default y
59 help
60 Include support for the PS3 AV Settings driver.
61
62 This support is required for graphics and sound. In
63 general, all users will say Y or M.
64
54endmenu 65endmenu
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index a4b5a1bc60f4..e12e59fea13a 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -2,7 +2,7 @@
2 * PS3 pagetable management routines. 2 * PS3 pagetable management routines.
3 * 3 *
4 * Copyright (C) 2006 Sony Computer Entertainment Inc. 4 * Copyright (C) 2006 Sony Computer Entertainment Inc.
5 * Copyright 2006 Sony Corp. 5 * Copyright 2006, 2007 Sony Corporation
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@
24#include <asm/lmb.h> 24#include <asm/lmb.h>
25#include <asm/udbg.h> 25#include <asm/udbg.h>
26#include <asm/lv1call.h> 26#include <asm/lv1call.h>
27#include <asm/ps3fb.h>
27 28
28#include "platform.h" 29#include "platform.h"
29 30
@@ -233,6 +234,9 @@ static void ps3_hpte_invalidate(unsigned long slot, unsigned long va,
233 234
234static void ps3_hpte_clear(void) 235static void ps3_hpte_clear(void)
235{ 236{
237 /* Make sure to clean up the frame buffer device first */
238 ps3fb_cleanup();
239
236 lv1_unmap_htab(htab_addr); 240 lv1_unmap_htab(htab_addr);
237} 241}
238 242
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index bb17283275aa..631c30095617 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -194,6 +194,7 @@ int ps3_alloc_io_irq(enum ps3_cpu_binding cpu, unsigned int interrupt_id,
194 194
195 return result; 195 return result;
196} 196}
197EXPORT_SYMBOL_GPL(ps3_alloc_io_irq);
197 198
198int ps3_free_io_irq(unsigned int virq) 199int ps3_free_io_irq(unsigned int virq)
199{ 200{
@@ -209,6 +210,7 @@ int ps3_free_io_irq(unsigned int virq)
209 210
210 return result; 211 return result;
211} 212}
213EXPORT_SYMBOL_GPL(ps3_free_io_irq);
212 214
213/** 215/**
214 * ps3_alloc_event_irq - Allocate a virq for use with a system event. 216 * ps3_alloc_event_irq - Allocate a virq for use with a system event.
diff --git a/arch/powerpc/platforms/ps3/setup.c b/arch/powerpc/platforms/ps3/setup.c
index e62505e18813..13d669a8ecae 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -24,6 +24,7 @@
24#include <linux/root_dev.h> 24#include <linux/root_dev.h>
25#include <linux/console.h> 25#include <linux/console.h>
26#include <linux/kexec.h> 26#include <linux/kexec.h>
27#include <linux/bootmem.h>
27 28
28#include <asm/machdep.h> 29#include <asm/machdep.h>
29#include <asm/firmware.h> 30#include <asm/firmware.h>
@@ -80,6 +81,46 @@ static void ps3_panic(char *str)
80 for (;;) ; 81 for (;;) ;
81} 82}
82 83
84
85static void prealloc(struct ps3_prealloc *p)
86{
87 if (!p->size)
88 return;
89
90 p->address = __alloc_bootmem(p->size, p->align, __pa(MAX_DMA_ADDRESS));
91 if (!p->address) {
92 printk(KERN_ERR "%s: Cannot allocate %s\n", __FUNCTION__,
93 p->name);
94 return;
95 }
96
97 printk(KERN_INFO "%s: %lu bytes at %p\n", p->name, p->size,
98 p->address);
99}
100
101#ifdef CONFIG_FB_PS3
102struct ps3_prealloc ps3fb_videomemory = {
103 .name = "ps3fb videomemory",
104 .size = CONFIG_FB_PS3_DEFAULT_SIZE_M*1024*1024,
105 .align = 1024*1024 /* the GPU requires 1 MiB alignment */
106};
107#define prealloc_ps3fb_videomemory() prealloc(&ps3fb_videomemory)
108
109static int __init early_parse_ps3fb(char *p)
110{
111 if (!p)
112 return 1;
113
114 ps3fb_videomemory.size = _ALIGN_UP(memparse(p, &p),
115 ps3fb_videomemory.align);
116 return 0;
117}
118early_param("ps3fb", early_parse_ps3fb);
119#else
120#define prealloc_ps3fb_videomemory() do { } while (0)
121#endif
122
123
83static void __init ps3_setup_arch(void) 124static void __init ps3_setup_arch(void)
84{ 125{
85 union ps3_firmware_version v; 126 union ps3_firmware_version v;
@@ -101,6 +142,7 @@ static void __init ps3_setup_arch(void)
101 conswitchp = &dummy_con; 142 conswitchp = &dummy_con;
102#endif 143#endif
103 144
145 prealloc_ps3fb_videomemory();
104 ppc_md.power_save = ps3_power_save; 146 ppc_md.power_save = ps3_power_save;
105 147
106 DBG(" <- %s:%d\n", __func__, __LINE__); 148 DBG(" <- %s:%d\n", __func__, __LINE__);
diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index d1929721b0e4..a397e4e17c13 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -170,31 +170,6 @@ static int __init construct_spu(struct spu *spu)
170 return result; 170 return result;
171} 171}
172 172
173static int __init add_spu_pages(unsigned long start_addr, unsigned long size)
174{
175 int result;
176 unsigned long start_pfn;
177 unsigned long nr_pages;
178 struct pglist_data *pgdata;
179 struct zone *zone;
180
181 BUG_ON(!mem_init_done);
182
183 start_pfn = start_addr >> PAGE_SHIFT;
184 nr_pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
185
186 pgdata = NODE_DATA(0);
187 zone = pgdata->node_zones;
188
189 result = __add_pages(zone, start_pfn, nr_pages);
190
191 if (result)
192 pr_debug("%s:%d: __add_pages failed: (%d)\n",
193 __func__, __LINE__, result);
194
195 return result;
196}
197
198static void spu_unmap(struct spu *spu) 173static void spu_unmap(struct spu *spu)
199{ 174{
200 iounmap(spu->priv2); 175 iounmap(spu->priv2);
@@ -206,19 +181,6 @@ static void spu_unmap(struct spu *spu)
206static int __init setup_areas(struct spu *spu) 181static int __init setup_areas(struct spu *spu)
207{ 182{
208 struct table {char* name; unsigned long addr; unsigned long size;}; 183 struct table {char* name; unsigned long addr; unsigned long size;};
209 int result;
210
211 /* setup pages */
212
213 result = add_spu_pages(spu->local_store_phys, LS_SIZE);
214 if (result)
215 goto fail_add;
216
217 result = add_spu_pages(spu->problem_phys, sizeof(struct spu_problem));
218 if (result)
219 goto fail_add;
220
221 /* ioremap */
222 184
223 spu_pdata(spu)->shadow = __ioremap( 185 spu_pdata(spu)->shadow = __ioremap(
224 spu_pdata(spu)->shadow_addr, sizeof(struct spe_shadow), 186 spu_pdata(spu)->shadow_addr, sizeof(struct spe_shadow),
@@ -260,8 +222,8 @@ static int __init setup_areas(struct spu *spu)
260 222
261fail_ioremap: 223fail_ioremap:
262 spu_unmap(spu); 224 spu_unmap(spu);
263fail_add: 225
264 return result; 226 return -ENOMEM;
265} 227}
266 228
267static int __init setup_interrupts(struct spu *spu) 229static int __init setup_interrupts(struct spu *spu)
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index bce6136cbce7..a9f7e4a39a2a 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -57,6 +57,7 @@ int ps3_mmio_region_create(struct ps3_mmio_region *r)
57 dump_mmio_region(r); 57 dump_mmio_region(r);
58 return result; 58 return result;
59} 59}
60EXPORT_SYMBOL_GPL(ps3_mmio_region_create);
60 61
61int ps3_free_mmio_region(struct ps3_mmio_region *r) 62int ps3_free_mmio_region(struct ps3_mmio_region *r)
62{ 63{
@@ -72,6 +73,7 @@ int ps3_free_mmio_region(struct ps3_mmio_region *r)
72 r->lpar_addr = 0; 73 r->lpar_addr = 0;
73 return result; 74 return result;
74} 75}
76EXPORT_SYMBOL_GPL(ps3_free_mmio_region);
75 77
76static int ps3_system_bus_match(struct device *_dev, 78static int ps3_system_bus_match(struct device *_dev,
77 struct device_driver *_drv) 79 struct device_driver *_drv)
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 9437f48cc9e7..6cedbc002e0f 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -1078,7 +1078,7 @@ static int proc_eeh_open(struct inode *inode, struct file *file)
1078 return single_open(file, proc_eeh_show, NULL); 1078 return single_open(file, proc_eeh_show, NULL);
1079} 1079}
1080 1080
1081static struct file_operations proc_eeh_operations = { 1081static const struct file_operations proc_eeh_operations = {
1082 .open = proc_eeh_open, 1082 .open = proc_eeh_open,
1083 .read = seq_read, 1083 .read = seq_read,
1084 .llseek = seq_lseek, 1084 .llseek = seq_lseek,
diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
index 3ddc04925d50..eae51ef9af24 100644
--- a/arch/powerpc/platforms/pseries/hvCall_inst.c
+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
@@ -90,7 +90,7 @@ static int hcall_inst_seq_open(struct inode *inode, struct file *file)
90 return rc; 90 return rc;
91} 91}
92 92
93static struct file_operations hcall_inst_seq_fops = { 93static const struct file_operations hcall_inst_seq_fops = {
94 .open = hcall_inst_seq_open, 94 .open = hcall_inst_seq_open,
95 .read = seq_read, 95 .read = seq_read,
96 .llseek = seq_lseek, 96 .llseek = seq_lseek,
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index c69bd15ced9c..fa59124ce3fe 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -98,6 +98,10 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
98 if (dev->resource[i].flags & IORESOURCE_IO 98 if (dev->resource[i].flags & IORESOURCE_IO
99 && dev->bus->number == 0 && dev->devfn == 0x81) 99 && dev->bus->number == 0 && dev->devfn == 0x81)
100 dev->resource[i].flags &= ~IORESOURCE_IO; 100 dev->resource[i].flags &= ~IORESOURCE_IO;
101 if (dev->resource[i].start == 0 && dev->resource[i].end) {
102 dev->resource[i].flags = 0;
103 dev->resource[i].end = 0;
104 }
101 } 105 }
102} 106}
103DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, 107DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 4ad33e41b008..5aa97aff3391 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -499,7 +499,7 @@ out:
499 return rv ? rv : count; 499 return rv ? rv : count;
500} 500}
501 501
502static struct file_operations ofdt_fops = { 502static const struct file_operations ofdt_fops = {
503 .write = ofdt_write 503 .write = ofdt_write
504}; 504};
505 505
@@ -513,7 +513,6 @@ static int proc_ppc64_create_ofdt(void)
513 513
514 ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL); 514 ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL);
515 if (ent) { 515 if (ent) {
516 ent->nlink = 1;
517 ent->data = NULL; 516 ent->data = NULL;
518 ent->size = 0; 517 ent->size = 0;
519 ent->proc_fops = &ofdt_fops; 518 ent->proc_fops = &ofdt_fops;
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index 8ca2612221d6..77d0937d5c07 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -331,7 +331,7 @@ static unsigned int rtas_log_poll(struct file *file, poll_table * wait)
331 return 0; 331 return 0;
332} 332}
333 333
334struct file_operations proc_rtas_log_operations = { 334const struct file_operations proc_rtas_log_operations = {
335 .read = rtas_log_read, 335 .read = rtas_log_read,
336 .poll = rtas_log_poll, 336 .poll = rtas_log_poll,
337 .open = rtas_log_open, 337 .open = rtas_log_open,
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index 45368a57d7dd..8e1ef168e2dd 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -184,7 +184,7 @@ static int scanlog_release(struct inode * inode, struct file * file)
184 return 0; 184 return 0;
185} 185}
186 186
187struct file_operations scanlog_fops = { 187const struct file_operations scanlog_fops = {
188 .owner = THIS_MODULE, 188 .owner = THIS_MODULE,
189 .read = scanlog_read, 189 .read = scanlog_read,
190 .write = scanlog_write, 190 .write = scanlog_write,