aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 12:05:55 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 12:05:55 -0400
commitc548f08a4f7b89b93c805e0c4024b8302afa7121 (patch)
tree5cf791db4912831469b70390aa58376f1c724386 /arch/powerpc/kernel
parent347c53dca73fca317d57781f510f5ff4f6c0d0d7 (diff)
parent4acadb965c4aa587aac29a0a91203c4745d6fb4e (diff)
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (24 commits) [POWERPC] Fix vmemmap warning in init_64.c [POWERPC] Fix 64 bits vDSO DWARF info for CR register [POWERPC] Add 1TB workaround for PA6T [POWERPC] Enable NO_HZ and high res timers for pseries and ppc64 configs [POWERPC] Quieten cache information at boot [POWERPC] Quieten clockevent printk [POWERPC] Enable SLUB in *_defconfig [POWERPC] Fix 1TB segment detection [POWERPC] Fix iSeries_hpte_insert prototype [POWERPC] Fix copyright symbol [POWERPC] ibmebus: Move to of_device and of_platform_driver, match eHCA and eHEA drivers [POWERPC] ibmebus: Add device creation and bus probing based on of_device [POWERPC] ibmebus: Remove bus match/probe/remove functions [POWERPC] Move of_device allocation into of_device.[ch] [POWERPC] mpc52xx: device tree changes for FEC and MDIO [POWERPC] bestcomm: GenBD task support [POWERPC] bestcomm: FEC task support [POWERPC] bestcomm: ATA task support [POWERPC] bestcomm: core bestcomm support for Freescale MPC5200 [POWERPC] mpc52xx: Update mpc52xx_psc structure with B revision changes ...
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r--arch/powerpc/kernel/entry_64.S6
-rw-r--r--arch/powerpc/kernel/ibmebus.c263
-rw-r--r--arch/powerpc/kernel/of_device.c80
-rw-r--r--arch/powerpc/kernel/of_platform.c70
-rw-r--r--arch/powerpc/kernel/setup_64.c13
-rw-r--r--arch/powerpc/kernel/time.c2
-rw-r--r--arch/powerpc/kernel/vdso64/sigtramp.S11
7 files changed, 175 insertions, 270 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 0ec134034899..148a3547c9aa 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -408,6 +408,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_1T_SEGMENT)
408 std r7,SLBSHADOW_STACKVSID(r9) /* Save VSID */ 408 std r7,SLBSHADOW_STACKVSID(r9) /* Save VSID */
409 std r0,SLBSHADOW_STACKESID(r9) /* Save ESID */ 409 std r0,SLBSHADOW_STACKESID(r9) /* Save ESID */
410 410
411 /* No need to check for CPU_FTR_NO_SLBIE_B here, since when
412 * we have 1TB segments, the only CPUs known to have the errata
413 * only support less than 1TB of system memory and we'll never
414 * actually hit this code path.
415 */
416
411 slbie r6 417 slbie r6
412 slbie r6 /* Workaround POWER5 < DD2.1 issue */ 418 slbie r6 /* Workaround POWER5 < DD2.1 issue */
413 slbmte r7,r0 419 slbmte r7,r0
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 2e16ca5778a3..289d7e935918 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -41,6 +41,7 @@
41#include <linux/kobject.h> 41#include <linux/kobject.h>
42#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
43#include <linux/interrupt.h> 43#include <linux/interrupt.h>
44#include <linux/of_platform.h>
44#include <asm/ibmebus.h> 45#include <asm/ibmebus.h>
45#include <asm/abs_addr.h> 46#include <asm/abs_addr.h>
46 47
@@ -50,6 +51,13 @@ static struct device ibmebus_bus_device = { /* fake "parent" device */
50 51
51struct bus_type ibmebus_bus_type; 52struct bus_type ibmebus_bus_type;
52 53
54/* These devices will automatically be added to the bus during init */
55static struct of_device_id builtin_matches[] = {
56 { .compatible = "IBM,lhca" },
57 { .compatible = "IBM,lhea" },
58 {},
59};
60
53static void *ibmebus_alloc_coherent(struct device *dev, 61static void *ibmebus_alloc_coherent(struct device *dev,
54 size_t size, 62 size_t size,
55 dma_addr_t *dma_handle, 63 dma_addr_t *dma_handle,
@@ -124,190 +132,87 @@ static struct dma_mapping_ops ibmebus_dma_ops = {
124 .dma_supported = ibmebus_dma_supported, 132 .dma_supported = ibmebus_dma_supported,
125}; 133};
126 134
127static int ibmebus_bus_probe(struct device *dev) 135static int ibmebus_match_path(struct device *dev, void *data)
128{ 136{
129 struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev); 137 struct device_node *dn = to_of_device(dev)->node;
130 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver); 138 return (dn->full_name &&
131 const struct of_device_id *id; 139 (strcasecmp((char *)data, dn->full_name) == 0));
132 int error = -ENODEV;
133
134 if (!ibmebusdrv->probe)
135 return error;
136
137 id = of_match_device(ibmebusdrv->id_table, &ibmebusdev->ofdev);
138 if (id) {
139 error = ibmebusdrv->probe(ibmebusdev, id);
140 }
141
142 return error;
143} 140}
144 141
145static int ibmebus_bus_remove(struct device *dev) 142static int ibmebus_match_node(struct device *dev, void *data)
146{ 143{
147 struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev); 144 return to_of_device(dev)->node == data;
148 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver);
149
150 if (ibmebusdrv->remove) {
151 return ibmebusdrv->remove(ibmebusdev);
152 }
153
154 return 0;
155} 145}
156 146
157static void __devinit ibmebus_dev_release(struct device *dev) 147static int ibmebus_create_device(struct device_node *dn)
158{ 148{
159 of_node_put(to_ibmebus_dev(dev)->ofdev.node); 149 struct of_device *dev;
160 kfree(to_ibmebus_dev(dev)); 150 int ret;
161}
162
163static int __devinit ibmebus_register_device_common(
164 struct ibmebus_dev *dev, const char *name)
165{
166 int err = 0;
167
168 dev->ofdev.dev.parent = &ibmebus_bus_device;
169 dev->ofdev.dev.bus = &ibmebus_bus_type;
170 dev->ofdev.dev.release = ibmebus_dev_release;
171 151
172 dev->ofdev.dev.archdata.of_node = dev->ofdev.node; 152 dev = of_device_alloc(dn, NULL, &ibmebus_bus_device);
173 dev->ofdev.dev.archdata.dma_ops = &ibmebus_dma_ops;
174 dev->ofdev.dev.archdata.numa_node = of_node_to_nid(dev->ofdev.node);
175
176 /* An ibmebusdev is based on a of_device. We have to change the
177 * bus type to use our own DMA mapping operations.
178 */
179 if ((err = of_device_register(&dev->ofdev)) != 0) {
180 printk(KERN_ERR "%s: failed to register device (%d).\n",
181 __FUNCTION__, err);
182 return -ENODEV;
183 }
184
185 return 0;
186}
187
188static struct ibmebus_dev* __devinit ibmebus_register_device_node(
189 struct device_node *dn)
190{
191 struct ibmebus_dev *dev;
192 int i, len, bus_len;
193
194 dev = kzalloc(sizeof(struct ibmebus_dev), GFP_KERNEL);
195 if (!dev) 153 if (!dev)
196 return ERR_PTR(-ENOMEM); 154 return -ENOMEM;
197
198 dev->ofdev.node = of_node_get(dn);
199
200 len = strlen(dn->full_name + 1);
201 bus_len = min(len, BUS_ID_SIZE - 1);
202 memcpy(dev->ofdev.dev.bus_id, dn->full_name + 1
203 + (len - bus_len), bus_len);
204 for (i = 0; i < bus_len; i++)
205 if (dev->ofdev.dev.bus_id[i] == '/')
206 dev->ofdev.dev.bus_id[i] = '_';
207
208 /* Register with generic device framework. */
209 if (ibmebus_register_device_common(dev, dn->name) != 0) {
210 kfree(dev);
211 return ERR_PTR(-ENODEV);
212 }
213
214 return dev;
215}
216
217static void ibmebus_probe_of_nodes(char* name)
218{
219 struct device_node *dn = NULL;
220
221 while ((dn = of_find_node_by_name(dn, name))) {
222 if (IS_ERR(ibmebus_register_device_node(dn))) {
223 of_node_put(dn);
224 return;
225 }
226 }
227
228 of_node_put(dn);
229 155
230 return; 156 dev->dev.bus = &ibmebus_bus_type;
231} 157 dev->dev.archdata.dma_ops = &ibmebus_dma_ops;
232 158
233static void ibmebus_add_devices_by_id(struct of_device_id *idt) 159 ret = of_device_register(dev);
234{ 160 if (ret) {
235 while (strlen(idt->name) > 0) { 161 of_device_free(dev);
236 ibmebus_probe_of_nodes(idt->name); 162 return ret;
237 idt++;
238 } 163 }
239 164
240 return;
241}
242
243static int ibmebus_match_name(struct device *dev, void *data)
244{
245 const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
246 const char *name;
247
248 name = of_get_property(ebus_dev->ofdev.node, "name", NULL);
249
250 if (name && (strcmp(data, name) == 0))
251 return 1;
252
253 return 0; 165 return 0;
254} 166}
255 167
256static int ibmebus_unregister_device(struct device *dev) 168static int ibmebus_create_devices(const struct of_device_id *matches)
257{ 169{
258 of_device_unregister(to_of_device(dev)); 170 struct device_node *root, *child;
171 int ret = 0;
259 172
260 return 0; 173 root = of_find_node_by_path("/");
261}
262 174
263static void ibmebus_remove_devices_by_id(struct of_device_id *idt) 175 for (child = NULL; (child = of_get_next_child(root, child)); ) {
264{ 176 if (!of_match_node(matches, child))
265 struct device *dev; 177 continue;
266 178
267 while (strlen(idt->name) > 0) { 179 if (bus_find_device(&ibmebus_bus_type, NULL, child,
268 while ((dev = bus_find_device(&ibmebus_bus_type, NULL, 180 ibmebus_match_node))
269 (void*)idt->name, 181 continue;
270 ibmebus_match_name))) { 182
271 ibmebus_unregister_device(dev); 183 ret = ibmebus_create_device(child);
184 if (ret) {
185 printk(KERN_ERR "%s: failed to create device (%i)",
186 __FUNCTION__, ret);
187 of_node_put(child);
188 break;
272 } 189 }
273 idt++;
274 } 190 }
275 191
276 return; 192 of_node_put(root);
193 return ret;
277} 194}
278 195
279int ibmebus_register_driver(struct ibmebus_driver *drv) 196int ibmebus_register_driver(struct of_platform_driver *drv)
280{ 197{
281 int err = 0; 198 /* If the driver uses devices that ibmebus doesn't know, add them */
199 ibmebus_create_devices(drv->match_table);
282 200
283 drv->driver.name = drv->name; 201 drv->driver.name = drv->name;
284 drv->driver.bus = &ibmebus_bus_type; 202 drv->driver.bus = &ibmebus_bus_type;
285 drv->driver.probe = ibmebus_bus_probe;
286 drv->driver.remove = ibmebus_bus_remove;
287 203
288 if ((err = driver_register(&drv->driver) != 0)) 204 return driver_register(&drv->driver);
289 return err;
290
291 /* remove all supported devices first, in case someone
292 * probed them manually before registering the driver */
293 ibmebus_remove_devices_by_id(drv->id_table);
294 ibmebus_add_devices_by_id(drv->id_table);
295
296 return 0;
297} 205}
298EXPORT_SYMBOL(ibmebus_register_driver); 206EXPORT_SYMBOL(ibmebus_register_driver);
299 207
300void ibmebus_unregister_driver(struct ibmebus_driver *drv) 208void ibmebus_unregister_driver(struct of_platform_driver *drv)
301{ 209{
302 driver_unregister(&drv->driver); 210 driver_unregister(&drv->driver);
303 ibmebus_remove_devices_by_id(drv->id_table);
304} 211}
305EXPORT_SYMBOL(ibmebus_unregister_driver); 212EXPORT_SYMBOL(ibmebus_unregister_driver);
306 213
307int ibmebus_request_irq(struct ibmebus_dev *dev, 214int ibmebus_request_irq(u32 ist, irq_handler_t handler,
308 u32 ist, 215 unsigned long irq_flags, const char *devname,
309 irq_handler_t handler,
310 unsigned long irq_flags, const char * devname,
311 void *dev_id) 216 void *dev_id)
312{ 217{
313 unsigned int irq = irq_create_mapping(NULL, ist); 218 unsigned int irq = irq_create_mapping(NULL, ist);
@@ -315,12 +220,11 @@ int ibmebus_request_irq(struct ibmebus_dev *dev,
315 if (irq == NO_IRQ) 220 if (irq == NO_IRQ)
316 return -EINVAL; 221 return -EINVAL;
317 222
318 return request_irq(irq, handler, 223 return request_irq(irq, handler, irq_flags, devname, dev_id);
319 irq_flags, devname, dev_id);
320} 224}
321EXPORT_SYMBOL(ibmebus_request_irq); 225EXPORT_SYMBOL(ibmebus_request_irq);
322 226
323void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id) 227void ibmebus_free_irq(u32 ist, void *dev_id)
324{ 228{
325 unsigned int irq = irq_find_mapping(NULL, ist); 229 unsigned int irq = irq_find_mapping(NULL, ist);
326 230
@@ -328,29 +232,10 @@ void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id)
328} 232}
329EXPORT_SYMBOL(ibmebus_free_irq); 233EXPORT_SYMBOL(ibmebus_free_irq);
330 234
331static int ibmebus_bus_match(struct device *dev, struct device_driver *drv)
332{
333 const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
334 struct ibmebus_driver *ebus_drv = to_ibmebus_driver(drv);
335 const struct of_device_id *ids = ebus_drv->id_table;
336 const struct of_device_id *found_id;
337
338 if (!ids)
339 return 0;
340
341 found_id = of_match_device(ids, &ebus_dev->ofdev);
342 if (found_id)
343 return 1;
344
345 return 0;
346}
347
348static ssize_t name_show(struct device *dev, 235static ssize_t name_show(struct device *dev,
349 struct device_attribute *attr, char *buf) 236 struct device_attribute *attr, char *buf)
350{ 237{
351 struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev); 238 return sprintf(buf, "%s\n", to_of_device(dev)->node->name);
352 const char *name = of_get_property(ebus_dev->ofdev.node, "name", NULL);
353 return sprintf(buf, "%s\n", name);
354} 239}
355 240
356static struct device_attribute ibmebus_dev_attrs[] = { 241static struct device_attribute ibmebus_dev_attrs[] = {
@@ -358,18 +243,6 @@ static struct device_attribute ibmebus_dev_attrs[] = {
358 __ATTR_NULL 243 __ATTR_NULL
359}; 244};
360 245
361static int ibmebus_match_path(struct device *dev, void *data)
362{
363 int rc;
364 struct device_node *dn =
365 of_node_get(to_ibmebus_dev(dev)->ofdev.node);
366
367 rc = (dn->full_name && (strcasecmp((char*)data, dn->full_name) == 0));
368
369 of_node_put(dn);
370 return rc;
371}
372
373static char *ibmebus_chomp(const char *in, size_t count) 246static char *ibmebus_chomp(const char *in, size_t count)
374{ 247{
375 char *out = kmalloc(count + 1, GFP_KERNEL); 248 char *out = kmalloc(count + 1, GFP_KERNEL);
@@ -389,9 +262,8 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
389 const char *buf, size_t count) 262 const char *buf, size_t count)
390{ 263{
391 struct device_node *dn = NULL; 264 struct device_node *dn = NULL;
392 struct ibmebus_dev *dev;
393 char *path; 265 char *path;
394 ssize_t rc; 266 ssize_t rc = 0;
395 267
396 path = ibmebus_chomp(buf, count); 268 path = ibmebus_chomp(buf, count);
397 if (!path) 269 if (!path)
@@ -406,9 +278,8 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
406 } 278 }
407 279
408 if ((dn = of_find_node_by_path(path))) { 280 if ((dn = of_find_node_by_path(path))) {
409 dev = ibmebus_register_device_node(dn); 281 rc = ibmebus_create_device(dn);
410 of_node_put(dn); 282 of_node_put(dn);
411 rc = IS_ERR(dev) ? PTR_ERR(dev) : count;
412 } else { 283 } else {
413 printk(KERN_WARNING "%s: no such device node: %s\n", 284 printk(KERN_WARNING "%s: no such device node: %s\n",
414 __FUNCTION__, path); 285 __FUNCTION__, path);
@@ -417,7 +288,9 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
417 288
418out: 289out:
419 kfree(path); 290 kfree(path);
420 return rc; 291 if (rc)
292 return rc;
293 return count;
421} 294}
422 295
423static ssize_t ibmebus_store_remove(struct bus_type *bus, 296static ssize_t ibmebus_store_remove(struct bus_type *bus,
@@ -432,7 +305,7 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
432 305
433 if ((dev = bus_find_device(&ibmebus_bus_type, NULL, path, 306 if ((dev = bus_find_device(&ibmebus_bus_type, NULL, path,
434 ibmebus_match_path))) { 307 ibmebus_match_path))) {
435 ibmebus_unregister_device(dev); 308 of_device_unregister(to_of_device(dev));
436 309
437 kfree(path); 310 kfree(path);
438 return count; 311 return count;
@@ -452,8 +325,7 @@ static struct bus_attribute ibmebus_bus_attrs[] = {
452}; 325};
453 326
454struct bus_type ibmebus_bus_type = { 327struct bus_type ibmebus_bus_type = {
455 .name = "ibmebus", 328 .uevent = of_device_uevent,
456 .match = ibmebus_bus_match,
457 .dev_attrs = ibmebus_dev_attrs, 329 .dev_attrs = ibmebus_dev_attrs,
458 .bus_attrs = ibmebus_bus_attrs 330 .bus_attrs = ibmebus_bus_attrs
459}; 331};
@@ -465,9 +337,9 @@ static int __init ibmebus_bus_init(void)
465 337
466 printk(KERN_INFO "IBM eBus Device Driver\n"); 338 printk(KERN_INFO "IBM eBus Device Driver\n");
467 339
468 err = bus_register(&ibmebus_bus_type); 340 err = of_bus_type_init(&ibmebus_bus_type, "ibmebus");
469 if (err) { 341 if (err) {
470 printk(KERN_ERR ":%s: failed to register IBM eBus.\n", 342 printk(KERN_ERR "%s: failed to register IBM eBus.\n",
471 __FUNCTION__); 343 __FUNCTION__);
472 return err; 344 return err;
473 } 345 }
@@ -481,6 +353,13 @@ static int __init ibmebus_bus_init(void)
481 return err; 353 return err;
482 } 354 }
483 355
356 err = ibmebus_create_devices(builtin_matches);
357 if (err) {
358 device_unregister(&ibmebus_bus_device);
359 bus_unregister(&ibmebus_bus_type);
360 return err;
361 }
362
484 return 0; 363 return 0;
485} 364}
486__initcall(ibmebus_bus_init); 365postcore_initcall(ibmebus_bus_init);
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 8f3db32fac8b..3388ad619996 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -7,8 +7,88 @@
7#include <linux/slab.h> 7#include <linux/slab.h>
8 8
9#include <asm/errno.h> 9#include <asm/errno.h>
10#include <asm/dcr.h>
10#include <asm/of_device.h> 11#include <asm/of_device.h>
11 12
13static void of_device_make_bus_id(struct of_device *dev)
14{
15 static atomic_t bus_no_reg_magic;
16 struct device_node *node = dev->node;
17 char *name = dev->dev.bus_id;
18 const u32 *reg;
19 u64 addr;
20 int magic;
21
22 /*
23 * If it's a DCR based device, use 'd' for native DCRs
24 * and 'D' for MMIO DCRs.
25 */
26#ifdef CONFIG_PPC_DCR
27 reg = of_get_property(node, "dcr-reg", NULL);
28 if (reg) {
29#ifdef CONFIG_PPC_DCR_NATIVE
30 snprintf(name, BUS_ID_SIZE, "d%x.%s",
31 *reg, node->name);
32#else /* CONFIG_PPC_DCR_NATIVE */
33 addr = of_translate_dcr_address(node, *reg, NULL);
34 if (addr != OF_BAD_ADDR) {
35 snprintf(name, BUS_ID_SIZE,
36 "D%llx.%s", (unsigned long long)addr,
37 node->name);
38 return;
39 }
40#endif /* !CONFIG_PPC_DCR_NATIVE */
41 }
42#endif /* CONFIG_PPC_DCR */
43
44 /*
45 * For MMIO, get the physical address
46 */
47 reg = of_get_property(node, "reg", NULL);
48 if (reg) {
49 addr = of_translate_address(node, reg);
50 if (addr != OF_BAD_ADDR) {
51 snprintf(name, BUS_ID_SIZE,
52 "%llx.%s", (unsigned long long)addr,
53 node->name);
54 return;
55 }
56 }
57
58 /*
59 * No BusID, use the node name and add a globally incremented
60 * counter (and pray...)
61 */
62 magic = atomic_add_return(1, &bus_no_reg_magic);
63 snprintf(name, BUS_ID_SIZE, "%s.%d", node->name, magic - 1);
64}
65
66struct of_device *of_device_alloc(struct device_node *np,
67 const char *bus_id,
68 struct device *parent)
69{
70 struct of_device *dev;
71
72 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
73 if (!dev)
74 return NULL;
75
76 dev->node = of_node_get(np);
77 dev->dev.dma_mask = &dev->dma_mask;
78 dev->dev.parent = parent;
79 dev->dev.release = of_release_dev;
80 dev->dev.archdata.of_node = np;
81 dev->dev.archdata.numa_node = of_node_to_nid(np);
82
83 if (bus_id)
84 strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
85 else
86 of_device_make_bus_id(dev);
87
88 return dev;
89}
90EXPORT_SYMBOL(of_device_alloc);
91
12ssize_t of_device_get_modalias(struct of_device *ofdev, 92ssize_t of_device_get_modalias(struct of_device *ofdev,
13 char *str, ssize_t len) 93 char *str, ssize_t len)
14{ 94{
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index eca8ccc3fa12..aeaa20268ce2 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -23,7 +23,6 @@
23#include <linux/of_platform.h> 23#include <linux/of_platform.h>
24 24
25#include <asm/errno.h> 25#include <asm/errno.h>
26#include <asm/dcr.h>
27#include <asm/topology.h> 26#include <asm/topology.h>
28#include <asm/pci-bridge.h> 27#include <asm/pci-bridge.h>
29#include <asm/ppc-pci.h> 28#include <asm/ppc-pci.h>
@@ -53,8 +52,6 @@ static struct of_device_id of_default_bus_ids[] = {
53 {}, 52 {},
54}; 53};
55 54
56static atomic_t bus_no_reg_magic;
57
58struct bus_type of_platform_bus_type = { 55struct bus_type of_platform_bus_type = {
59 .uevent = of_device_uevent, 56 .uevent = of_device_uevent,
60}; 57};
@@ -87,89 +84,26 @@ void of_unregister_platform_driver(struct of_platform_driver *drv)
87} 84}
88EXPORT_SYMBOL(of_unregister_platform_driver); 85EXPORT_SYMBOL(of_unregister_platform_driver);
89 86
90static void of_platform_make_bus_id(struct of_device *dev)
91{
92 struct device_node *node = dev->node;
93 char *name = dev->dev.bus_id;
94 const u32 *reg;
95 u64 addr;
96 int magic;
97
98 /*
99 * If it's a DCR based device, use 'd' for native DCRs
100 * and 'D' for MMIO DCRs.
101 */
102#ifdef CONFIG_PPC_DCR
103 reg = of_get_property(node, "dcr-reg", NULL);
104 if (reg) {
105#ifdef CONFIG_PPC_DCR_NATIVE
106 snprintf(name, BUS_ID_SIZE, "d%x.%s",
107 *reg, node->name);
108#else /* CONFIG_PPC_DCR_NATIVE */
109 addr = of_translate_dcr_address(node, *reg, NULL);
110 if (addr != OF_BAD_ADDR) {
111 snprintf(name, BUS_ID_SIZE,
112 "D%llx.%s", (unsigned long long)addr,
113 node->name);
114 return;
115 }
116#endif /* !CONFIG_PPC_DCR_NATIVE */
117 }
118#endif /* CONFIG_PPC_DCR */
119
120 /*
121 * For MMIO, get the physical address
122 */
123 reg = of_get_property(node, "reg", NULL);
124 if (reg) {
125 addr = of_translate_address(node, reg);
126 if (addr != OF_BAD_ADDR) {
127 snprintf(name, BUS_ID_SIZE,
128 "%llx.%s", (unsigned long long)addr,
129 node->name);
130 return;
131 }
132 }
133
134 /*
135 * No BusID, use the node name and add a globally incremented
136 * counter (and pray...)
137 */
138 magic = atomic_add_return(1, &bus_no_reg_magic);
139 snprintf(name, BUS_ID_SIZE, "%s.%d", node->name, magic - 1);
140}
141
142struct of_device* of_platform_device_create(struct device_node *np, 87struct of_device* of_platform_device_create(struct device_node *np,
143 const char *bus_id, 88 const char *bus_id,
144 struct device *parent) 89 struct device *parent)
145{ 90{
146 struct of_device *dev; 91 struct of_device *dev;
147 92
148 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 93 dev = of_device_alloc(np, bus_id, parent);
149 if (!dev) 94 if (!dev)
150 return NULL; 95 return NULL;
151 96
152 dev->node = of_node_get(np);
153 dev->dma_mask = 0xffffffffUL; 97 dev->dma_mask = 0xffffffffUL;
154 dev->dev.dma_mask = &dev->dma_mask;
155 dev->dev.parent = parent;
156 dev->dev.bus = &of_platform_bus_type; 98 dev->dev.bus = &of_platform_bus_type;
157 dev->dev.release = of_release_dev;
158 dev->dev.archdata.of_node = np;
159 dev->dev.archdata.numa_node = of_node_to_nid(np);
160 99
161 /* We do not fill the DMA ops for platform devices by default. 100 /* We do not fill the DMA ops for platform devices by default.
162 * This is currently the responsibility of the platform code 101 * This is currently the responsibility of the platform code
163 * to do such, possibly using a device notifier 102 * to do such, possibly using a device notifier
164 */ 103 */
165 104
166 if (bus_id)
167 strlcpy(dev->dev.bus_id, bus_id, BUS_ID_SIZE);
168 else
169 of_platform_make_bus_id(dev);
170
171 if (of_device_register(dev) != 0) { 105 if (of_device_register(dev) != 0) {
172 kfree(dev); 106 of_device_free(dev);
173 return NULL; 107 return NULL;
174 } 108 }
175 109
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 0e014550b83f..ede77dbbd4df 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -426,11 +426,14 @@ void __init setup_system(void)
426 printk("-----------------------------------------------------\n"); 426 printk("-----------------------------------------------------\n");
427 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 427 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
428 printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); 428 printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size());
429 printk("ppc64_caches.dcache_line_size = 0x%x\n", 429 if (ppc64_caches.dline_size != 0x80)
430 ppc64_caches.dline_size); 430 printk("ppc64_caches.dcache_line_size = 0x%x\n",
431 printk("ppc64_caches.icache_line_size = 0x%x\n", 431 ppc64_caches.dline_size);
432 ppc64_caches.iline_size); 432 if (ppc64_caches.iline_size != 0x80)
433 printk("htab_address = 0x%p\n", htab_address); 433 printk("ppc64_caches.icache_line_size = 0x%x\n",
434 ppc64_caches.iline_size);
435 if (htab_address)
436 printk("htab_address = 0x%p\n", htab_address);
434 printk("htab_hash_mask = 0x%lx\n", htab_hash_mask); 437 printk("htab_hash_mask = 0x%lx\n", htab_hash_mask);
435#if PHYSICAL_START > 0 438#if PHYSICAL_START > 0
436 printk("physical_start = 0x%x\n", PHYSICAL_START); 439 printk("physical_start = 0x%x\n", PHYSICAL_START);
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 9368da371f36..863a5d6d9b18 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -829,7 +829,7 @@ static void register_decrementer_clockevent(int cpu)
829 *dec = decrementer_clockevent; 829 *dec = decrementer_clockevent;
830 dec->cpumask = cpumask_of_cpu(cpu); 830 dec->cpumask = cpumask_of_cpu(cpu);
831 831
832 printk(KERN_ERR "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n", 832 printk(KERN_INFO "clockevent: %s mult[%lx] shift[%d] cpu[%d]\n",
833 dec->name, dec->mult, dec->shift, cpu); 833 dec->name, dec->mult, dec->shift, cpu);
834 834
835 clockevents_register_device(dec); 835 clockevents_register_device(dec);
diff --git a/arch/powerpc/kernel/vdso64/sigtramp.S b/arch/powerpc/kernel/vdso64/sigtramp.S
index 17a83fa6dc52..59eb59bb4082 100644
--- a/arch/powerpc/kernel/vdso64/sigtramp.S
+++ b/arch/powerpc/kernel/vdso64/sigtramp.S
@@ -134,13 +134,16 @@ V_FUNCTION_END(__kernel_sigtramp_rt64)
1349: 1349:
135 135
136/* This is where the pt_regs pointer can be found on the stack. */ 136/* This is where the pt_regs pointer can be found on the stack. */
137#define PTREGS 128+168+56 137#define PTREGS 128+168+56
138 138
139/* Size of regs. */ 139/* Size of regs. */
140#define RSIZE 8 140#define RSIZE 8
141
142/* Size of CR reg in DWARF unwind info. */
143#define CRSIZE 4
141 144
142/* This is the offset of the VMX reg pointer. */ 145/* This is the offset of the VMX reg pointer. */
143#define VREGS 48*RSIZE+33*8 146#define VREGS 48*RSIZE+33*8
144 147
145/* Describe where general purpose regs are saved. */ 148/* Describe where general purpose regs are saved. */
146#define EH_FRAME_GEN \ 149#define EH_FRAME_GEN \
@@ -178,7 +181,7 @@ V_FUNCTION_END(__kernel_sigtramp_rt64)
178 rsave (31, 31*RSIZE); \ 181 rsave (31, 31*RSIZE); \
179 rsave (67, 32*RSIZE); /* ap, used as temp for nip */ \ 182 rsave (67, 32*RSIZE); /* ap, used as temp for nip */ \
180 rsave (65, 36*RSIZE); /* lr */ \ 183 rsave (65, 36*RSIZE); /* lr */ \
181 rsave (70, 38*RSIZE) /* cr */ 184 rsave (70, 38*RSIZE + (RSIZE - CRSIZE)) /* cr */
182 185
183/* Describe where the FP regs are saved. */ 186/* Describe where the FP regs are saved. */
184#define EH_FRAME_FP \ 187#define EH_FRAME_FP \