aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/Makefile2
-rw-r--r--arch/powerpc/platforms/cell/io-workarounds.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_priv1_mmio.c95
-rw-r--r--arch/powerpc/platforms/iseries/Kconfig2
4 files changed, 56 insertions, 45 deletions
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 44d95eaf22e6..507d1b98f270 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/
8obj-$(CONFIG_PPC_CHRP) += chrp/ 9obj-$(CONFIG_PPC_CHRP) += chrp/
9obj-$(CONFIG_4xx) += 4xx/ 10obj-$(CONFIG_4xx) += 4xx/
10obj-$(CONFIG_PPC_MPC52xx) += 52xx/
11obj-$(CONFIG_PPC_83xx) += 83xx/ 11obj-$(CONFIG_PPC_83xx) += 83xx/
12obj-$(CONFIG_PPC_85xx) += 85xx/ 12obj-$(CONFIG_PPC_85xx) += 85xx/
13obj-$(CONFIG_PPC_86xx) += 86xx/ 13obj-$(CONFIG_PPC_86xx) += 86xx/
diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c
index 580d42595912..7c73128305ec 100644
--- a/arch/powerpc/platforms/cell/io-workarounds.c
+++ b/arch/powerpc/platforms/cell/io-workarounds.c
@@ -37,7 +37,7 @@
37 */ 37 */
38#define SPIDER_DISABLE_PREFETCH 38#define SPIDER_DISABLE_PREFETCH
39 39
40#define MAX_SPIDERS 2 40#define MAX_SPIDERS 3
41 41
42static struct spider_pci_bus { 42static struct spider_pci_bus {
43 void __iomem *regs; 43 void __iomem *regs;
diff --git a/arch/powerpc/platforms/cell/spu_priv1_mmio.c b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
index a5de0430c56d..910a926b61a2 100644
--- a/arch/powerpc/platforms/cell/spu_priv1_mmio.c
+++ b/arch/powerpc/platforms/cell/spu_priv1_mmio.c
@@ -37,8 +37,9 @@
37#include "interrupt.h" 37#include "interrupt.h"
38#include "spu_priv1_mmio.h" 38#include "spu_priv1_mmio.h"
39 39
40static DEFINE_MUTEX(add_spumem_mutex);
41
40struct spu_pdata { 42struct spu_pdata {
41 int nid;
42 struct device_node *devnode; 43 struct device_node *devnode;
43 struct spu_priv1 __iomem *priv1; 44 struct spu_priv1 __iomem *priv1;
44}; 45};
@@ -56,20 +57,9 @@ struct device_node *spu_devnode(struct spu *spu)
56 57
57EXPORT_SYMBOL_GPL(spu_devnode); 58EXPORT_SYMBOL_GPL(spu_devnode);
58 59
59static int __init find_spu_node_id(struct device_node *spe)
60{
61 const unsigned int *id;
62 struct device_node *cpu;
63 cpu = spe->parent->parent;
64 id = get_property(cpu, "node-id", NULL);
65 return id ? *id : 0;
66}
67
68static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe, 60static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
69 const char *prop) 61 const char *prop)
70{ 62{
71 static DEFINE_MUTEX(add_spumem_mutex);
72
73 const struct address_prop { 63 const struct address_prop {
74 unsigned long address; 64 unsigned long address;
75 unsigned int len; 65 unsigned int len;
@@ -87,7 +77,7 @@ static int __init cell_spuprop_present(struct spu *spu, struct device_node *spe,
87 start_pfn = p->address >> PAGE_SHIFT; 77 start_pfn = p->address >> PAGE_SHIFT;
88 nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT; 78 nr_pages = ((unsigned long)p->len + PAGE_SIZE - 1) >> PAGE_SHIFT;
89 79
90 pgdata = NODE_DATA(spu_get_pdata(spu)->nid); 80 pgdata = NODE_DATA(spu->node);
91 zone = pgdata->node_zones; 81 zone = pgdata->node_zones;
92 82
93 /* XXX rethink locking here */ 83 /* XXX rethink locking here */
@@ -140,6 +130,7 @@ static int __init spu_map_interrupts_old(struct spu *spu,
140{ 130{
141 unsigned int isrc; 131 unsigned int isrc;
142 const u32 *tmp; 132 const u32 *tmp;
133 int nid;
143 134
144 /* Get the interrupt source unit from the device-tree */ 135 /* Get the interrupt source unit from the device-tree */
145 tmp = get_property(np, "isrc", NULL); 136 tmp = get_property(np, "isrc", NULL);
@@ -147,8 +138,15 @@ static int __init spu_map_interrupts_old(struct spu *spu,
147 return -ENODEV; 138 return -ENODEV;
148 isrc = tmp[0]; 139 isrc = tmp[0];
149 140
141 tmp = get_property(np->parent->parent, "node-id", NULL);
142 if (!tmp) {
143 printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__);
144 nid = spu->node;
145 } else
146 nid = tmp[0];
147
150 /* Add the node number */ 148 /* Add the node number */
151 isrc |= spu->node << IIC_IRQ_NODE_SHIFT; 149 isrc |= nid << IIC_IRQ_NODE_SHIFT;
152 150
153 /* Now map interrupts of all 3 classes */ 151 /* Now map interrupts of all 3 classes */
154 spu->irqs[0] = irq_create_mapping(NULL, IIC_IRQ_CLASS_0 | isrc); 152 spu->irqs[0] = irq_create_mapping(NULL, IIC_IRQ_CLASS_0 | isrc);
@@ -237,70 +235,88 @@ err:
237 return ret; 235 return ret;
238} 236}
239 237
240static int spu_map_resource(struct device_node *node, int nr, 238static int spu_map_resource(struct spu *spu, int nr,
241 void __iomem** virt, unsigned long *phys) 239 void __iomem** virt, unsigned long *phys)
242{ 240{
241 struct device_node *np = spu_get_pdata(spu)->devnode;
242 unsigned long start_pfn, nr_pages;
243 struct pglist_data *pgdata;
244 struct zone *zone;
243 struct resource resource = { }; 245 struct resource resource = { };
246 unsigned long len;
244 int ret; 247 int ret;
245 248
246 ret = of_address_to_resource(node, nr, &resource); 249 ret = of_address_to_resource(np, nr, &resource);
247 if (ret) 250 if (ret)
248 goto out; 251 goto out;
249 252
250 if (phys) 253 if (phys)
251 *phys = resource.start; 254 *phys = resource.start;
252 *virt = ioremap(resource.start, resource.end - resource.start); 255 len = resource.end - resource.start + 1;
256 *virt = ioremap(resource.start, len);
253 if (!*virt) 257 if (!*virt)
254 ret = -EINVAL; 258 ret = -EINVAL;
255 259
260 start_pfn = resource.start >> PAGE_SHIFT;
261 nr_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
262
263 pgdata = NODE_DATA(spu->node);
264 zone = pgdata->node_zones;
265
266 /* XXX rethink locking here */
267 mutex_lock(&add_spumem_mutex);
268 ret = __add_pages(zone, start_pfn, nr_pages);
269 mutex_unlock(&add_spumem_mutex);
270
256out: 271out:
257 return ret; 272 return ret;
258} 273}
259 274
260static int __init spu_map_device(struct spu *spu, struct device_node *node) 275static int __init spu_map_device(struct spu *spu)
261{ 276{
277 struct device_node *np = spu_get_pdata(spu)->devnode;
262 int ret = -ENODEV; 278 int ret = -ENODEV;
263 spu->name = get_property(node, "name", NULL); 279
280 spu->name = get_property(np, "name", NULL);
264 if (!spu->name) 281 if (!spu->name)
265 goto out; 282 goto out;
266 283
267 ret = spu_map_resource(node, 0, (void __iomem**)&spu->local_store, 284 ret = spu_map_resource(spu, 0, (void __iomem**)&spu->local_store,
268 &spu->local_store_phys); 285 &spu->local_store_phys);
269 if (ret) { 286 if (ret) {
270 pr_debug("spu_new: failed to map %s resource 0\n", 287 pr_debug("spu_new: failed to map %s resource 0\n",
271 node->full_name); 288 np->full_name);
272 goto out; 289 goto out;
273 } 290 }
274 ret = spu_map_resource(node, 1, (void __iomem**)&spu->problem, 291 ret = spu_map_resource(spu, 1, (void __iomem**)&spu->problem,
275 &spu->problem_phys); 292 &spu->problem_phys);
276 if (ret) { 293 if (ret) {
277 pr_debug("spu_new: failed to map %s resource 1\n", 294 pr_debug("spu_new: failed to map %s resource 1\n",
278 node->full_name); 295 np->full_name);
279 goto out_unmap; 296 goto out_unmap;
280 } 297 }
281 ret = spu_map_resource(node, 2, (void __iomem**)&spu->priv2, 298 ret = spu_map_resource(spu, 2, (void __iomem**)&spu->priv2, NULL);
282 NULL);
283 if (ret) { 299 if (ret) {
284 pr_debug("spu_new: failed to map %s resource 2\n", 300 pr_debug("spu_new: failed to map %s resource 2\n",
285 node->full_name); 301 np->full_name);
286 goto out_unmap; 302 goto out_unmap;
287 } 303 }
288 if (!firmware_has_feature(FW_FEATURE_LPAR)) 304 if (!firmware_has_feature(FW_FEATURE_LPAR))
289 ret = spu_map_resource(node, 3, 305 ret = spu_map_resource(spu, 3,
290 (void __iomem**)&spu_get_pdata(spu)->priv1, NULL); 306 (void __iomem**)&spu_get_pdata(spu)->priv1, NULL);
291 if (ret) { 307 if (ret) {
292 pr_debug("spu_new: failed to map %s resource 3\n", 308 pr_debug("spu_new: failed to map %s resource 3\n",
293 node->full_name); 309 np->full_name);
294 goto out_unmap; 310 goto out_unmap;
295 } 311 }
296 pr_debug("spu_new: %s maps:\n", node->full_name); 312 pr_debug("spu_new: %s maps:\n", np->full_name);
297 pr_debug(" local store : 0x%016lx -> 0x%p\n", 313 pr_debug(" local store : 0x%016lx -> 0x%p\n",
298 spu->local_store_phys, spu->local_store); 314 spu->local_store_phys, spu->local_store);
299 pr_debug(" problem state : 0x%016lx -> 0x%p\n", 315 pr_debug(" problem state : 0x%016lx -> 0x%p\n",
300 spu->problem_phys, spu->problem); 316 spu->problem_phys, spu->problem);
301 pr_debug(" priv2 : 0x%p\n", spu->priv2); 317 pr_debug(" priv2 : 0x%p\n", spu->priv2);
302 pr_debug(" priv1 : 0x%p\n", 318 pr_debug(" priv1 : 0x%p\n",
303 spu_get_pdata(spu)->priv1); 319 spu_get_pdata(spu)->priv1);
304 320
305 return 0; 321 return 0;
306 322
@@ -340,8 +356,9 @@ static int __init of_create_spu(struct spu *spu, void *data)
340 ret = -ENOMEM; 356 ret = -ENOMEM;
341 goto out; 357 goto out;
342 } 358 }
359 spu_get_pdata(spu)->devnode = of_node_get(spe);
343 360
344 spu->node = find_spu_node_id(spe); 361 spu->node = of_node_to_nid(spe);
345 if (spu->node >= MAX_NUMNODES) { 362 if (spu->node >= MAX_NUMNODES) {
346 printk(KERN_WARNING "SPE %s on node %d ignored," 363 printk(KERN_WARNING "SPE %s on node %d ignored,"
347 " node number too big\n", spe->full_name, spu->node); 364 " node number too big\n", spe->full_name, spu->node);
@@ -350,11 +367,7 @@ static int __init of_create_spu(struct spu *spu, void *data)
350 goto out_free; 367 goto out_free;
351 } 368 }
352 369
353 spu_get_pdata(spu)->nid = of_node_to_nid(spe); 370 ret = spu_map_device(spu);
354 if (spu_get_pdata(spu)->nid == -1)
355 spu_get_pdata(spu)->nid = 0;
356
357 ret = spu_map_device(spu, spe);
358 /* try old method */ 371 /* try old method */
359 if (ret) 372 if (ret)
360 ret = spu_map_device_old(spu, spe); 373 ret = spu_map_device_old(spu, spe);
@@ -367,8 +380,6 @@ static int __init of_create_spu(struct spu *spu, void *data)
367 if (ret) 380 if (ret)
368 goto out_unmap; 381 goto out_unmap;
369 382
370 spu_get_pdata(spu)->devnode = of_node_get(spe);
371
372 pr_debug(KERN_DEBUG "Using SPE %s %p %p %p %p %d\n", spu->name, 383 pr_debug(KERN_DEBUG "Using SPE %s %p %p %p %p %d\n", spu->name,
373 spu->local_store, spu->problem, spu_get_pdata(spu)->priv1, 384 spu->local_store, spu->problem, spu_get_pdata(spu)->priv1,
374 spu->priv2, spu->number); 385 spu->priv2, spu->number);
diff --git a/arch/powerpc/platforms/iseries/Kconfig b/arch/powerpc/platforms/iseries/Kconfig
index 887b68804e6d..54e6b3b6f261 100644
--- a/arch/powerpc/platforms/iseries/Kconfig
+++ b/arch/powerpc/platforms/iseries/Kconfig
@@ -31,5 +31,5 @@ endmenu
31 31
32config VIOPATH 32config VIOPATH
33 bool 33 bool
34 depends on VIOCONS || VIODASD || VIOCD || VIOTAPE || VETH 34 depends on VIOCONS || VIODASD || VIOCD || VIOTAPE || ISERIES_VETH
35 default y 35 default y