diff options
Diffstat (limited to 'arch/sparc64/kernel/of_device.c')
-rw-r--r-- | arch/sparc64/kernel/of_device.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index d822c7c18e1f..cec0eceae552 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c | |||
@@ -131,8 +131,13 @@ static int of_device_resume(struct device * dev) | |||
131 | void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name) | 131 | void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name) |
132 | { | 132 | { |
133 | unsigned long ret = res->start + offset; | 133 | unsigned long ret = res->start + offset; |
134 | struct resource *r; | ||
134 | 135 | ||
135 | if (!request_region(ret, size, name)) | 136 | if (res->flags & IORESOURCE_MEM) |
137 | r = request_mem_region(ret, size, name); | ||
138 | else | ||
139 | r = request_region(ret, size, name); | ||
140 | if (!r) | ||
136 | ret = 0; | 141 | ret = 0; |
137 | 142 | ||
138 | return (void __iomem *) ret; | 143 | return (void __iomem *) ret; |
@@ -397,16 +402,22 @@ static void of_bus_sbus_count_cells(struct device_node *child, | |||
397 | *sizec = 1; | 402 | *sizec = 1; |
398 | } | 403 | } |
399 | 404 | ||
400 | static int of_bus_sbus_map(u32 *addr, const u32 *range, int na, int ns, int pna) | 405 | /* |
401 | { | 406 | * FHC/Central bus specific translator. |
402 | return of_bus_default_map(addr, range, na, ns, pna); | 407 | * |
403 | } | 408 | * This is just needed to hard-code the address and size cell |
404 | 409 | * counts. 'fhc' and 'central' nodes lack the #address-cells and | |
405 | static unsigned int of_bus_sbus_get_flags(u32 *addr) | 410 | * #size-cells properties, and if you walk to the root on such |
411 | * Enterprise boxes all you'll get is a #size-cells of 2 which is | ||
412 | * not what we want to use. | ||
413 | */ | ||
414 | static int of_bus_fhc_match(struct device_node *np) | ||
406 | { | 415 | { |
407 | return IORESOURCE_MEM; | 416 | return !strcmp(np->name, "fhc") || |
417 | !strcmp(np->name, "central"); | ||
408 | } | 418 | } |
409 | 419 | ||
420 | #define of_bus_fhc_count_cells of_bus_sbus_count_cells | ||
410 | 421 | ||
411 | /* | 422 | /* |
412 | * Array of bus specific translators | 423 | * Array of bus specific translators |
@@ -428,8 +439,17 @@ static struct of_bus of_busses[] = { | |||
428 | .addr_prop_name = "reg", | 439 | .addr_prop_name = "reg", |
429 | .match = of_bus_sbus_match, | 440 | .match = of_bus_sbus_match, |
430 | .count_cells = of_bus_sbus_count_cells, | 441 | .count_cells = of_bus_sbus_count_cells, |
431 | .map = of_bus_sbus_map, | 442 | .map = of_bus_default_map, |
432 | .get_flags = of_bus_sbus_get_flags, | 443 | .get_flags = of_bus_default_get_flags, |
444 | }, | ||
445 | /* FHC */ | ||
446 | { | ||
447 | .name = "fhc", | ||
448 | .addr_prop_name = "reg", | ||
449 | .match = of_bus_fhc_match, | ||
450 | .count_cells = of_bus_fhc_count_cells, | ||
451 | .map = of_bus_default_map, | ||
452 | .get_flags = of_bus_default_get_flags, | ||
433 | }, | 453 | }, |
434 | /* Default */ | 454 | /* Default */ |
435 | { | 455 | { |
@@ -841,7 +861,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp, | |||
841 | if (!parent) | 861 | if (!parent) |
842 | strcpy(op->dev.bus_id, "root"); | 862 | strcpy(op->dev.bus_id, "root"); |
843 | else | 863 | else |
844 | sprintf(op->dev.bus_id, "%s@%08x", dp->name, dp->node); | 864 | sprintf(op->dev.bus_id, "%08x", dp->node); |
845 | 865 | ||
846 | if (of_device_register(op)) { | 866 | if (of_device_register(op)) { |
847 | printk("%s: Could not register of device.\n", | 867 | printk("%s: Could not register of device.\n", |
@@ -987,10 +1007,9 @@ struct of_device* of_platform_device_create(struct device_node *np, | |||
987 | { | 1007 | { |
988 | struct of_device *dev; | 1008 | struct of_device *dev; |
989 | 1009 | ||
990 | dev = kmalloc(sizeof(*dev), GFP_KERNEL); | 1010 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
991 | if (!dev) | 1011 | if (!dev) |
992 | return NULL; | 1012 | return NULL; |
993 | memset(dev, 0, sizeof(*dev)); | ||
994 | 1013 | ||
995 | dev->dev.parent = parent; | 1014 | dev->dev.parent = parent; |
996 | dev->dev.bus = bus; | 1015 | dev->dev.bus = bus; |