diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-06-18 13:09:58 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-06-28 15:41:33 -0400 |
commit | 1636f8ac2b08410df4766449f7c86b912443cd99 (patch) | |
tree | 9c923c017e956779f237d4ffa51d49beb3de6d3e /arch/sparc/kernel/of_device_32.c | |
parent | 2b07be2493681220cac4d185494a4edb0b8efd1e (diff) |
sparc/of: Move of_device fields into struct pdev_archdata
This patch moves SPARC architecture specific data members out of
struct of_device and into the pdev_archdata structure. The reason
for this change is to unify the struct of_device definition amongst
all the architectures. It also remvoes the .sysdata, .slot, .portid
and .clock_freq properties because they aren't actually used by
anything.
A subsequent patch will replace struct of_device entirely with struct
platform_device and the of_platform support code will share common
routines with the platform bus (but the bus instances themselves can
remain separate).
This patch also adds 'struct resources *resource' and num_resources
to match the fields defined in struct platform_device. After this
change, 'struct platform_device' can be used as a drop-in replacement
for 'struct of_platform'.
This change is in preparation for merging the of_platform_bus_type
with the platform_bus_type.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'arch/sparc/kernel/of_device_32.c')
-rw-r--r-- | arch/sparc/kernel/of_device_32.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c index 47e63f1e719c..331de91ad2bc 100644 --- a/arch/sparc/kernel/of_device_32.c +++ b/arch/sparc/kernel/of_device_32.c | |||
@@ -267,6 +267,8 @@ static void __init build_device_resources(struct of_device *op, | |||
267 | /* Conver to num-entries. */ | 267 | /* Conver to num-entries. */ |
268 | num_reg /= na + ns; | 268 | num_reg /= na + ns; |
269 | 269 | ||
270 | op->resource = op->archdata.resource; | ||
271 | op->num_resources = num_reg; | ||
270 | for (index = 0; index < num_reg; index++) { | 272 | for (index = 0; index < num_reg; index++) { |
271 | struct resource *r = &op->resource[index]; | 273 | struct resource *r = &op->resource[index]; |
272 | u32 addr[OF_MAX_ADDR_CELLS]; | 274 | u32 addr[OF_MAX_ADDR_CELLS]; |
@@ -349,27 +351,21 @@ static struct of_device * __init scan_one_device(struct device_node *dp, | |||
349 | 351 | ||
350 | op->dev.of_node = dp; | 352 | op->dev.of_node = dp; |
351 | 353 | ||
352 | op->clock_freq = of_getintprop_default(dp, "clock-frequency", | ||
353 | (25*1000*1000)); | ||
354 | op->portid = of_getintprop_default(dp, "upa-portid", -1); | ||
355 | if (op->portid == -1) | ||
356 | op->portid = of_getintprop_default(dp, "portid", -1); | ||
357 | |||
358 | intr = of_get_property(dp, "intr", &len); | 354 | intr = of_get_property(dp, "intr", &len); |
359 | if (intr) { | 355 | if (intr) { |
360 | op->num_irqs = len / sizeof(struct linux_prom_irqs); | 356 | op->archdata.num_irqs = len / sizeof(struct linux_prom_irqs); |
361 | for (i = 0; i < op->num_irqs; i++) | 357 | for (i = 0; i < op->archdata.num_irqs; i++) |
362 | op->irqs[i] = intr[i].pri; | 358 | op->archdata.irqs[i] = intr[i].pri; |
363 | } else { | 359 | } else { |
364 | const unsigned int *irq = | 360 | const unsigned int *irq = |
365 | of_get_property(dp, "interrupts", &len); | 361 | of_get_property(dp, "interrupts", &len); |
366 | 362 | ||
367 | if (irq) { | 363 | if (irq) { |
368 | op->num_irqs = len / sizeof(unsigned int); | 364 | op->archdata.num_irqs = len / sizeof(unsigned int); |
369 | for (i = 0; i < op->num_irqs; i++) | 365 | for (i = 0; i < op->archdata.num_irqs; i++) |
370 | op->irqs[i] = irq[i]; | 366 | op->archdata.irqs[i] = irq[i]; |
371 | } else { | 367 | } else { |
372 | op->num_irqs = 0; | 368 | op->archdata.num_irqs = 0; |
373 | } | 369 | } |
374 | } | 370 | } |
375 | if (sparc_cpu_model == sun4d) { | 371 | if (sparc_cpu_model == sun4d) { |
@@ -411,8 +407,8 @@ static struct of_device * __init scan_one_device(struct device_node *dp, | |||
411 | goto build_resources; | 407 | goto build_resources; |
412 | } | 408 | } |
413 | 409 | ||
414 | for (i = 0; i < op->num_irqs; i++) { | 410 | for (i = 0; i < op->archdata.num_irqs; i++) { |
415 | int this_irq = op->irqs[i]; | 411 | int this_irq = op->archdata.irqs[i]; |
416 | int sbusl = pil_to_sbus[this_irq]; | 412 | int sbusl = pil_to_sbus[this_irq]; |
417 | 413 | ||
418 | if (sbusl) | 414 | if (sbusl) |
@@ -420,7 +416,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp, | |||
420 | (sbusl << 2) + | 416 | (sbusl << 2) + |
421 | slot); | 417 | slot); |
422 | 418 | ||
423 | op->irqs[i] = this_irq; | 419 | op->archdata.irqs[i] = this_irq; |
424 | } | 420 | } |
425 | } | 421 | } |
426 | 422 | ||