aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc')
-rw-r--r--arch/sparc/Kconfig4
-rw-r--r--arch/sparc/boot/btfixupprep.c4
-rw-r--r--arch/sparc/include/asm/device.h11
-rw-r--r--arch/sparc/include/asm/floppy_64.h10
-rw-r--r--arch/sparc/include/asm/of_device.h38
-rw-r--r--arch/sparc/include/asm/of_platform.h18
-rw-r--r--arch/sparc/include/asm/parport.h12
-rw-r--r--arch/sparc/include/asm/prom.h10
-rw-r--r--arch/sparc/kernel/apc.c6
-rw-r--r--arch/sparc/kernel/auxio_64.c5
-rw-r--r--arch/sparc/kernel/central.c8
-rw-r--r--arch/sparc/kernel/chmc.c16
-rw-r--r--arch/sparc/kernel/ioport.c2
-rw-r--r--arch/sparc/kernel/of_device_32.c63
-rw-r--r--arch/sparc/kernel/of_device_64.c61
-rw-r--r--arch/sparc/kernel/of_device_common.c35
-rw-r--r--arch/sparc/kernel/pci.c6
-rw-r--r--arch/sparc/kernel/pci_fire.c6
-rw-r--r--arch/sparc/kernel/pci_impl.h2
-rw-r--r--arch/sparc/kernel/pci_psycho.c16
-rw-r--r--arch/sparc/kernel/pci_sabre.c16
-rw-r--r--arch/sparc/kernel/pci_schizo.c32
-rw-r--r--arch/sparc/kernel/pci_sun4v.c6
-rw-r--r--arch/sparc/kernel/pmc.c4
-rw-r--r--arch/sparc/kernel/power.c6
-rw-r--r--arch/sparc/kernel/prom.h8
-rw-r--r--arch/sparc/kernel/prom_64.c6
-rw-r--r--arch/sparc/kernel/prom_common.c2
-rw-r--r--arch/sparc/kernel/prom_irqtrans.c2
-rw-r--r--arch/sparc/kernel/psycho_common.c2
-rw-r--r--arch/sparc/kernel/psycho_common.h2
-rw-r--r--arch/sparc/kernel/sbus.c16
-rw-r--r--arch/sparc/kernel/time_32.c4
-rw-r--r--arch/sparc/kernel/time_64.c12
-rw-r--r--arch/sparc/mm/io-unit.c4
-rw-r--r--arch/sparc/mm/iommu.c6
36 files changed, 175 insertions, 286 deletions
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c0015db247ba..ba068c833e5d 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -18,6 +18,7 @@ config 64BIT
18config SPARC 18config SPARC
19 bool 19 bool
20 default y 20 default y
21 select OF
21 select HAVE_IDE 22 select HAVE_IDE
22 select HAVE_OPROFILE 23 select HAVE_OPROFILE
23 select HAVE_ARCH_KGDB if !SMP || SPARC64 24 select HAVE_ARCH_KGDB if !SMP || SPARC64
@@ -148,9 +149,6 @@ config GENERIC_GPIO
148config ARCH_NO_VIRT_TO_BUS 149config ARCH_NO_VIRT_TO_BUS
149 def_bool y 150 def_bool y
150 151
151config OF
152 def_bool y
153
154config ARCH_SUPPORTS_DEBUG_PAGEALLOC 152config ARCH_SUPPORTS_DEBUG_PAGEALLOC
155 def_bool y if SPARC64 153 def_bool y if SPARC64
156 154
diff --git a/arch/sparc/boot/btfixupprep.c b/arch/sparc/boot/btfixupprep.c
index e7f2940bd270..da031159e2b7 100644
--- a/arch/sparc/boot/btfixupprep.c
+++ b/arch/sparc/boot/btfixupprep.c
@@ -216,7 +216,7 @@ main1:
216 switch (buffer[nbase+3]) { 216 switch (buffer[nbase+3]) {
217 case 'f': 217 case 'f':
218 if (initval) { 218 if (initval) {
219 fprintf(stderr, "Cannot use pre-initalized fixups for calls\n%s\n", buffer); 219 fprintf(stderr, "Cannot use pre-initialized fixups for calls\n%s\n", buffer);
220 exit(1); 220 exit(1);
221 } 221 }
222 if (!strcmp (sect, "__ksymtab")) { 222 if (!strcmp (sect, "__ksymtab")) {
@@ -273,7 +273,7 @@ main1:
273 break; 273 break;
274 case 'i': 274 case 'i':
275 if (initval) { 275 if (initval) {
276 fprintf(stderr, "Cannot use pre-initalized fixups for INT\n%s\n", buffer); 276 fprintf(stderr, "Cannot use pre-initialized fixups for INT\n%s\n", buffer);
277 exit(1); 277 exit(1);
278 } 278 }
279 if (strncmp (buffer + mode+9, "HI22 ", 10) && strncmp (buffer + mode+9, "LO10 ", 10)) { 279 if (strncmp (buffer + mode+9, "HI22 ", 10) && strncmp (buffer + mode+9, "LO10 ", 10)) {
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index d4c452147412..daa6a8a5e9cd 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -6,18 +6,25 @@
6#ifndef _ASM_SPARC_DEVICE_H 6#ifndef _ASM_SPARC_DEVICE_H
7#define _ASM_SPARC_DEVICE_H 7#define _ASM_SPARC_DEVICE_H
8 8
9#include <asm/openprom.h>
10
9struct device_node; 11struct device_node;
10struct of_device; 12struct platform_device;
11 13
12struct dev_archdata { 14struct dev_archdata {
13 void *iommu; 15 void *iommu;
14 void *stc; 16 void *stc;
15 void *host_controller; 17 void *host_controller;
16 struct of_device *op; 18 struct platform_device *op;
17 int numa_node; 19 int numa_node;
18}; 20};
19 21
22extern void of_propagate_archdata(struct platform_device *bus);
23
20struct pdev_archdata { 24struct pdev_archdata {
25 struct resource resource[PROMREG_MAX];
26 unsigned int irqs[PROMINTR_MAX];
27 int num_irqs;
21}; 28};
22 29
23#endif /* _ASM_SPARC_DEVICE_H */ 30#endif /* _ASM_SPARC_DEVICE_H */
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index 8fac3ab22f36..6597ce874d78 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -43,7 +43,7 @@ struct sun_flpy_controller {
43/* You'll only ever find one controller on an Ultra anyways. */ 43/* You'll only ever find one controller on an Ultra anyways. */
44static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1; 44static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1;
45unsigned long fdc_status; 45unsigned long fdc_status;
46static struct of_device *floppy_op = NULL; 46static struct platform_device *floppy_op = NULL;
47 47
48struct sun_floppy_ops { 48struct sun_floppy_ops {
49 unsigned char (*fd_inb) (unsigned long port); 49 unsigned char (*fd_inb) (unsigned long port);
@@ -548,7 +548,7 @@ static unsigned long __init sun_floppy_init(void)
548{ 548{
549 static int initialized = 0; 549 static int initialized = 0;
550 struct device_node *dp; 550 struct device_node *dp;
551 struct of_device *op; 551 struct platform_device *op;
552 const char *prop; 552 const char *prop;
553 char state[128]; 553 char state[128];
554 554
@@ -567,7 +567,7 @@ static unsigned long __init sun_floppy_init(void)
567 } 567 }
568 if (op) { 568 if (op) {
569 floppy_op = op; 569 floppy_op = op;
570 FLOPPY_IRQ = op->irqs[0]; 570 FLOPPY_IRQ = op->archdata.irqs[0];
571 } else { 571 } else {
572 struct device_node *ebus_dp; 572 struct device_node *ebus_dp;
573 void __iomem *auxio_reg; 573 void __iomem *auxio_reg;
@@ -593,7 +593,7 @@ static unsigned long __init sun_floppy_init(void)
593 if (state_prop && !strncmp(state_prop, "disabled", 8)) 593 if (state_prop && !strncmp(state_prop, "disabled", 8))
594 return 0; 594 return 0;
595 595
596 FLOPPY_IRQ = op->irqs[0]; 596 FLOPPY_IRQ = op->archdata.irqs[0];
597 597
598 /* Make sure the high density bit is set, some systems 598 /* Make sure the high density bit is set, some systems
599 * (most notably Ultra5/Ultra10) come up with it clear. 599 * (most notably Ultra5/Ultra10) come up with it clear.
@@ -661,7 +661,7 @@ static unsigned long __init sun_floppy_init(void)
661 config = 0; 661 config = 0;
662 for (dp = ebus_dp->child; dp; dp = dp->sibling) { 662 for (dp = ebus_dp->child; dp; dp = dp->sibling) {
663 if (!strcmp(dp->name, "ecpp")) { 663 if (!strcmp(dp->name, "ecpp")) {
664 struct of_device *ecpp_op; 664 struct platform_device *ecpp_op;
665 665
666 ecpp_op = of_find_device_by_node(dp); 666 ecpp_op = of_find_device_by_node(dp);
667 if (ecpp_op) 667 if (ecpp_op)
diff --git a/arch/sparc/include/asm/of_device.h b/arch/sparc/include/asm/of_device.h
deleted file mode 100644
index f320246a0586..000000000000
--- a/arch/sparc/include/asm/of_device.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef _ASM_SPARC_OF_DEVICE_H
2#define _ASM_SPARC_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/of.h>
7#include <linux/mod_devicetable.h>
8#include <asm/openprom.h>
9
10/*
11 * The of_device is a kind of "base class" that is a superset of
12 * struct device for use by devices attached to an OF node and
13 * probed using OF properties.
14 */
15struct of_device
16{
17 struct device dev;
18 struct resource resource[PROMREG_MAX];
19 unsigned int irqs[PROMINTR_MAX];
20 int num_irqs;
21
22 void *sysdata;
23
24 int slot;
25 int portid;
26 int clock_freq;
27};
28
29extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
30extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
31
32extern void of_propagate_archdata(struct of_device *bus);
33
34/* This is just here during the transition */
35#include <linux/of_platform.h>
36
37#endif /* __KERNEL__ */
38#endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/arch/sparc/include/asm/of_platform.h b/arch/sparc/include/asm/of_platform.h
deleted file mode 100644
index 90da99059f83..000000000000
--- a/arch/sparc/include/asm/of_platform.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef ___ASM_SPARC_OF_PLATFORM_H
2#define ___ASM_SPARC_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 * Modified for Sparc by merging parts of asm/of_device.h
7 * by Stephen Rothwell
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16#define of_bus_type of_platform_bus_type /* for compatibility */
17
18#endif
diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index c333b8d0949b..4f7afa01b2ae 100644
--- a/arch/sparc/include/asm/parport.h
+++ b/arch/sparc/include/asm/parport.h
@@ -103,7 +103,7 @@ static inline unsigned int get_dma_residue(unsigned int dmanr)
103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
104} 104}
105 105
106static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match) 106static int __devinit ecpp_probe(struct platform_device *op, const struct of_device_id *match)
107{ 107{
108 unsigned long base = op->resource[0].start; 108 unsigned long base = op->resource[0].start;
109 unsigned long config = op->resource[1].start; 109 unsigned long config = op->resource[1].start;
@@ -116,7 +116,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id
116 parent = op->dev.of_node->parent; 116 parent = op->dev.of_node->parent;
117 if (!strcmp(parent->name, "dma")) { 117 if (!strcmp(parent->name, "dma")) {
118 p = parport_pc_probe_port(base, base + 0x400, 118 p = parport_pc_probe_port(base, base + 0x400,
119 op->irqs[0], PARPORT_DMA_NOFIFO, 119 op->archdata.irqs[0], PARPORT_DMA_NOFIFO,
120 op->dev.parent->parent, 0); 120 op->dev.parent->parent, 0);
121 if (!p) 121 if (!p)
122 return -ENOMEM; 122 return -ENOMEM;
@@ -166,7 +166,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id
166 0, PTR_LPT_REG_DIR); 166 0, PTR_LPT_REG_DIR);
167 167
168 p = parport_pc_probe_port(base, base + 0x400, 168 p = parport_pc_probe_port(base, base + 0x400,
169 op->irqs[0], 169 op->archdata.irqs[0],
170 slot, 170 slot,
171 op->dev.parent, 171 op->dev.parent,
172 0); 172 0);
@@ -192,7 +192,7 @@ out_err:
192 return err; 192 return err;
193} 193}
194 194
195static int __devexit ecpp_remove(struct of_device *op) 195static int __devexit ecpp_remove(struct platform_device *op)
196{ 196{
197 struct parport *p = dev_get_drvdata(&op->dev); 197 struct parport *p = dev_get_drvdata(&op->dev);
198 int slot = p->dma; 198 int slot = p->dma;
@@ -243,9 +243,7 @@ static struct of_platform_driver ecpp_driver = {
243 243
244static int parport_pc_find_nonpci_ports(int autoirq, int autodma) 244static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
245{ 245{
246 of_register_driver(&ecpp_driver, &of_bus_type); 246 return of_register_platform_driver(&ecpp_driver);
247
248 return 0;
249} 247}
250 248
251#endif /* !(_ASM_SPARC64_PARPORT_H */ 249#endif /* !(_ASM_SPARC64_PARPORT_H */
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index f845828ca4c6..291f12575edd 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -43,20 +43,22 @@ extern int of_getintprop_default(struct device_node *np,
43extern int of_find_in_proplist(const char *list, const char *match, int len); 43extern int of_find_in_proplist(const char *list, const char *match, int len);
44#ifdef CONFIG_NUMA 44#ifdef CONFIG_NUMA
45extern int of_node_to_nid(struct device_node *dp); 45extern int of_node_to_nid(struct device_node *dp);
46#else 46#define of_node_to_nid of_node_to_nid
47#define of_node_to_nid(dp) (-1)
48#endif 47#endif
49 48
50extern void prom_build_devicetree(void); 49extern void prom_build_devicetree(void);
51extern void of_populate_present_mask(void); 50extern void of_populate_present_mask(void);
52extern void of_fill_in_cpu_data(void); 51extern void of_fill_in_cpu_data(void);
53 52
53struct resource;
54extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
55extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
56
54/* These routines are here to provide compatibility with how powerpc 57/* These routines are here to provide compatibility with how powerpc
55 * handles IRQ mapping for OF device nodes. We precompute and permanently 58 * handles IRQ mapping for OF device nodes. We precompute and permanently
56 * register them in the of_device objects, whereas powerpc computes them 59 * register them in the platform_device objects, whereas powerpc computes them
57 * on request. 60 * on request.
58 */ 61 */
59extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
60static inline void irq_dispose_mapping(unsigned int virq) 62static inline void irq_dispose_mapping(unsigned int virq)
61{ 63{
62} 64}
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index b27476caa133..2c0046ecc715 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -68,7 +68,7 @@ static void apc_swift_idle(void)
68#endif 68#endif
69} 69}
70 70
71static inline void apc_free(struct of_device *op) 71static inline void apc_free(struct platform_device *op)
72{ 72{
73 of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0])); 73 of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0]));
74} 74}
@@ -136,7 +136,7 @@ static const struct file_operations apc_fops = {
136 136
137static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops }; 137static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };
138 138
139static int __devinit apc_probe(struct of_device *op, 139static int __devinit apc_probe(struct platform_device *op,
140 const struct of_device_id *match) 140 const struct of_device_id *match)
141{ 141{
142 int err; 142 int err;
@@ -184,7 +184,7 @@ static struct of_platform_driver apc_driver = {
184 184
185static int __init apc_init(void) 185static int __init apc_init(void)
186{ 186{
187 return of_register_driver(&apc_driver, &of_bus_type); 187 return of_register_platform_driver(&apc_driver);
188} 188}
189 189
190/* This driver is not critical to the boot process 190/* This driver is not critical to the boot process
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index ddc84128b3c2..3efd3c5af6a9 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -102,7 +102,8 @@ static struct of_device_id __initdata auxio_match[] = {
102 102
103MODULE_DEVICE_TABLE(of, auxio_match); 103MODULE_DEVICE_TABLE(of, auxio_match);
104 104
105static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match) 105static int __devinit auxio_probe(struct platform_device *dev,
106 const struct of_device_id *match)
106{ 107{
107 struct device_node *dp = dev->dev.of_node; 108 struct device_node *dp = dev->dev.of_node;
108 unsigned long size; 109 unsigned long size;
@@ -142,7 +143,7 @@ static struct of_platform_driver auxio_driver = {
142 143
143static int __init auxio_init(void) 144static int __init auxio_init(void)
144{ 145{
145 return of_register_driver(&auxio_driver, &of_platform_bus_type); 146 return of_register_platform_driver(&auxio_driver);
146} 147}
147 148
148/* Must be after subsys_initcall() so that busses are probed. Must 149/* Must be after subsys_initcall() so that busses are probed. Must
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index 434335f65823..cfa2624c5332 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -59,7 +59,7 @@ static int __devinit clock_board_calc_nslots(struct clock_board *p)
59 } 59 }
60} 60}
61 61
62static int __devinit clock_board_probe(struct of_device *op, 62static int __devinit clock_board_probe(struct platform_device *op,
63 const struct of_device_id *match) 63 const struct of_device_id *match)
64{ 64{
65 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL); 65 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -157,7 +157,7 @@ static struct of_platform_driver clock_board_driver = {
157 }, 157 },
158}; 158};
159 159
160static int __devinit fhc_probe(struct of_device *op, 160static int __devinit fhc_probe(struct platform_device *op,
161 const struct of_device_id *match) 161 const struct of_device_id *match)
162{ 162{
163 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL); 163 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -265,8 +265,8 @@ static struct of_platform_driver fhc_driver = {
265 265
266static int __init sunfire_init(void) 266static int __init sunfire_init(void)
267{ 267{
268 (void) of_register_driver(&fhc_driver, &of_platform_bus_type); 268 (void) of_register_platform_driver(&fhc_driver);
269 (void) of_register_driver(&clock_board_driver, &of_platform_bus_type); 269 (void) of_register_platform_driver(&clock_board_driver);
270 return 0; 270 return 0;
271} 271}
272 272
diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 870cb65b3f21..08c466ebb32b 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -392,7 +392,7 @@ static void __devinit jbusmc_construct_dimm_groups(struct jbusmc *p,
392 } 392 }
393} 393}
394 394
395static int __devinit jbusmc_probe(struct of_device *op, 395static int __devinit jbusmc_probe(struct platform_device *op,
396 const struct of_device_id *match) 396 const struct of_device_id *match)
397{ 397{
398 const struct linux_prom64_registers *mem_regs; 398 const struct linux_prom64_registers *mem_regs;
@@ -690,7 +690,7 @@ static void chmc_fetch_decode_regs(struct chmc *p)
690 chmc_read_mcreg(p, CHMCTRL_DECODE4)); 690 chmc_read_mcreg(p, CHMCTRL_DECODE4));
691} 691}
692 692
693static int __devinit chmc_probe(struct of_device *op, 693static int __devinit chmc_probe(struct platform_device *op,
694 const struct of_device_id *match) 694 const struct of_device_id *match)
695{ 695{
696 struct device_node *dp = op->dev.of_node; 696 struct device_node *dp = op->dev.of_node;
@@ -765,7 +765,7 @@ out_free:
765 goto out; 765 goto out;
766} 766}
767 767
768static int __devinit us3mc_probe(struct of_device *op, 768static int __devinit us3mc_probe(struct platform_device *op,
769 const struct of_device_id *match) 769 const struct of_device_id *match)
770{ 770{
771 if (mc_type == MC_TYPE_SAFARI) 771 if (mc_type == MC_TYPE_SAFARI)
@@ -775,21 +775,21 @@ static int __devinit us3mc_probe(struct of_device *op,
775 return -ENODEV; 775 return -ENODEV;
776} 776}
777 777
778static void __devexit chmc_destroy(struct of_device *op, struct chmc *p) 778static void __devexit chmc_destroy(struct platform_device *op, struct chmc *p)
779{ 779{
780 list_del(&p->list); 780 list_del(&p->list);
781 of_iounmap(&op->resource[0], p->regs, 0x48); 781 of_iounmap(&op->resource[0], p->regs, 0x48);
782 kfree(p); 782 kfree(p);
783} 783}
784 784
785static void __devexit jbusmc_destroy(struct of_device *op, struct jbusmc *p) 785static void __devexit jbusmc_destroy(struct platform_device *op, struct jbusmc *p)
786{ 786{
787 mc_list_del(&p->list); 787 mc_list_del(&p->list);
788 of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE); 788 of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE);
789 kfree(p); 789 kfree(p);
790} 790}
791 791
792static int __devexit us3mc_remove(struct of_device *op) 792static int __devexit us3mc_remove(struct platform_device *op)
793{ 793{
794 void *p = dev_get_drvdata(&op->dev); 794 void *p = dev_get_drvdata(&op->dev);
795 795
@@ -848,7 +848,7 @@ static int __init us3mc_init(void)
848 ret = register_dimm_printer(us3mc_dimm_printer); 848 ret = register_dimm_printer(us3mc_dimm_printer);
849 849
850 if (!ret) { 850 if (!ret) {
851 ret = of_register_driver(&us3mc_driver, &of_bus_type); 851 ret = of_register_platform_driver(&us3mc_driver);
852 if (ret) 852 if (ret)
853 unregister_dimm_printer(us3mc_dimm_printer); 853 unregister_dimm_printer(us3mc_dimm_printer);
854 } 854 }
@@ -859,7 +859,7 @@ static void __exit us3mc_cleanup(void)
859{ 859{
860 if (us3mc_platform()) { 860 if (us3mc_platform()) {
861 unregister_dimm_printer(us3mc_dimm_printer); 861 unregister_dimm_printer(us3mc_dimm_printer);
862 of_unregister_driver(&us3mc_driver); 862 of_unregister_platform_driver(&us3mc_driver);
863 } 863 }
864} 864}
865 865
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 703e4aa9bc38..41f7e4e0f72a 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -253,7 +253,7 @@ EXPORT_SYMBOL(sbus_set_sbus64);
253static void *sbus_alloc_coherent(struct device *dev, size_t len, 253static void *sbus_alloc_coherent(struct device *dev, size_t len,
254 dma_addr_t *dma_addrp, gfp_t gfp) 254 dma_addr_t *dma_addrp, gfp_t gfp)
255{ 255{
256 struct of_device *op = to_of_device(dev); 256 struct platform_device *op = to_platform_device(dev);
257 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK; 257 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
258 unsigned long va; 258 unsigned long va;
259 struct resource *res; 259 struct resource *res;
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 47e63f1e719c..2d055a1e9cc2 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -241,10 +241,10 @@ static int __init use_1to1_mapping(struct device_node *pp)
241 241
242static int of_resource_verbose; 242static int of_resource_verbose;
243 243
244static void __init build_device_resources(struct of_device *op, 244static void __init build_device_resources(struct platform_device *op,
245 struct device *parent) 245 struct device *parent)
246{ 246{
247 struct of_device *p_op; 247 struct platform_device *p_op;
248 struct of_bus *bus; 248 struct of_bus *bus;
249 int na, ns; 249 int na, ns;
250 int index, num_reg; 250 int index, num_reg;
@@ -253,7 +253,7 @@ static void __init build_device_resources(struct of_device *op,
253 if (!parent) 253 if (!parent)
254 return; 254 return;
255 255
256 p_op = to_of_device(parent); 256 p_op = to_platform_device(parent);
257 bus = of_match_bus(p_op->dev.of_node); 257 bus = of_match_bus(p_op->dev.of_node);
258 bus->count_cells(op->dev.of_node, &na, &ns); 258 bus->count_cells(op->dev.of_node, &na, &ns);
259 259
@@ -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];
@@ -333,10 +335,10 @@ static void __init build_device_resources(struct of_device *op,
333 } 335 }
334} 336}
335 337
336static struct of_device * __init scan_one_device(struct device_node *dp, 338static struct platform_device * __init scan_one_device(struct device_node *dp,
337 struct device *parent) 339 struct device *parent)
338{ 340{
339 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 341 struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
340 const struct linux_prom_irqs *intr; 342 const struct linux_prom_irqs *intr;
341 struct dev_archdata *sd; 343 struct dev_archdata *sd;
342 int len, i; 344 int len, i;
@@ -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
@@ -428,7 +424,7 @@ build_resources:
428 build_device_resources(op, parent); 424 build_device_resources(op, parent);
429 425
430 op->dev.parent = parent; 426 op->dev.parent = parent;
431 op->dev.bus = &of_platform_bus_type; 427 op->dev.bus = &platform_bus_type;
432 if (!parent) 428 if (!parent)
433 dev_set_name(&op->dev, "root"); 429 dev_set_name(&op->dev, "root");
434 else 430 else
@@ -447,7 +443,7 @@ build_resources:
447static void __init scan_tree(struct device_node *dp, struct device *parent) 443static void __init scan_tree(struct device_node *dp, struct device *parent)
448{ 444{
449 while (dp) { 445 while (dp) {
450 struct of_device *op = scan_one_device(dp, parent); 446 struct platform_device *op = scan_one_device(dp, parent);
451 447
452 if (op) 448 if (op)
453 scan_tree(dp->child, &op->dev); 449 scan_tree(dp->child, &op->dev);
@@ -456,30 +452,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent)
456 } 452 }
457} 453}
458 454
459static void __init scan_of_devices(void) 455static int __init scan_of_devices(void)
460{ 456{
461 struct device_node *root = of_find_node_by_path("/"); 457 struct device_node *root = of_find_node_by_path("/");
462 struct of_device *parent; 458 struct platform_device *parent;
463 459
464 parent = scan_one_device(root, NULL); 460 parent = scan_one_device(root, NULL);
465 if (!parent) 461 if (!parent)
466 return; 462 return 0;
467 463
468 scan_tree(root->child, &parent->dev); 464 scan_tree(root->child, &parent->dev);
465 return 0;
469} 466}
470 467postcore_initcall(scan_of_devices);
471static int __init of_bus_driver_init(void)
472{
473 int err;
474
475 err = of_bus_type_init(&of_platform_bus_type, "of");
476 if (!err)
477 scan_of_devices();
478
479 return err;
480}
481
482postcore_initcall(of_bus_driver_init);
483 468
484static int __init of_debug(char *str) 469static int __init of_debug(char *str)
485{ 470{
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 1dae8079f728..63cd4e5d47c2 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -310,10 +310,10 @@ static int __init use_1to1_mapping(struct device_node *pp)
310 310
311static int of_resource_verbose; 311static int of_resource_verbose;
312 312
313static void __init build_device_resources(struct of_device *op, 313static void __init build_device_resources(struct platform_device *op,
314 struct device *parent) 314 struct device *parent)
315{ 315{
316 struct of_device *p_op; 316 struct platform_device *p_op;
317 struct of_bus *bus; 317 struct of_bus *bus;
318 int na, ns; 318 int na, ns;
319 int index, num_reg; 319 int index, num_reg;
@@ -322,7 +322,7 @@ static void __init build_device_resources(struct of_device *op,
322 if (!parent) 322 if (!parent)
323 return; 323 return;
324 324
325 p_op = to_of_device(parent); 325 p_op = to_platform_device(parent);
326 bus = of_match_bus(p_op->dev.of_node); 326 bus = of_match_bus(p_op->dev.of_node);
327 bus->count_cells(op->dev.of_node, &na, &ns); 327 bus->count_cells(op->dev.of_node, &na, &ns);
328 328
@@ -344,6 +344,8 @@ static void __init build_device_resources(struct of_device *op,
344 num_reg = PROMREG_MAX; 344 num_reg = PROMREG_MAX;
345 } 345 }
346 346
347 op->resource = op->archdata.resource;
348 op->num_resources = num_reg;
347 for (index = 0; index < num_reg; index++) { 349 for (index = 0; index < num_reg; index++) {
348 struct resource *r = &op->resource[index]; 350 struct resource *r = &op->resource[index];
349 u32 addr[OF_MAX_ADDR_CELLS]; 351 u32 addr[OF_MAX_ADDR_CELLS];
@@ -526,7 +528,7 @@ static unsigned int __init pci_irq_swizzle(struct device_node *dp,
526 528
527static int of_irq_verbose; 529static int of_irq_verbose;
528 530
529static unsigned int __init build_one_device_irq(struct of_device *op, 531static unsigned int __init build_one_device_irq(struct platform_device *op,
530 struct device *parent, 532 struct device *parent,
531 unsigned int irq) 533 unsigned int irq)
532{ 534{
@@ -628,10 +630,10 @@ out:
628 return irq; 630 return irq;
629} 631}
630 632
631static struct of_device * __init scan_one_device(struct device_node *dp, 633static struct platform_device * __init scan_one_device(struct device_node *dp,
632 struct device *parent) 634 struct device *parent)
633{ 635{
634 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 636 struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
635 const unsigned int *irq; 637 const unsigned int *irq;
636 struct dev_archdata *sd; 638 struct dev_archdata *sd;
637 int len, i; 639 int len, i;
@@ -644,34 +646,28 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
644 646
645 op->dev.of_node = dp; 647 op->dev.of_node = dp;
646 648
647 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
648 (25*1000*1000));
649 op->portid = of_getintprop_default(dp, "upa-portid", -1);
650 if (op->portid == -1)
651 op->portid = of_getintprop_default(dp, "portid", -1);
652
653 irq = of_get_property(dp, "interrupts", &len); 649 irq = of_get_property(dp, "interrupts", &len);
654 if (irq) { 650 if (irq) {
655 op->num_irqs = len / 4; 651 op->archdata.num_irqs = len / 4;
656 652
657 /* Prevent overrunning the op->irqs[] array. */ 653 /* Prevent overrunning the op->irqs[] array. */
658 if (op->num_irqs > PROMINTR_MAX) { 654 if (op->archdata.num_irqs > PROMINTR_MAX) {
659 printk(KERN_WARNING "%s: Too many irqs (%d), " 655 printk(KERN_WARNING "%s: Too many irqs (%d), "
660 "limiting to %d.\n", 656 "limiting to %d.\n",
661 dp->full_name, op->num_irqs, PROMINTR_MAX); 657 dp->full_name, op->archdata.num_irqs, PROMINTR_MAX);
662 op->num_irqs = PROMINTR_MAX; 658 op->archdata.num_irqs = PROMINTR_MAX;
663 } 659 }
664 memcpy(op->irqs, irq, op->num_irqs * 4); 660 memcpy(op->archdata.irqs, irq, op->archdata.num_irqs * 4);
665 } else { 661 } else {
666 op->num_irqs = 0; 662 op->archdata.num_irqs = 0;
667 } 663 }
668 664
669 build_device_resources(op, parent); 665 build_device_resources(op, parent);
670 for (i = 0; i < op->num_irqs; i++) 666 for (i = 0; i < op->archdata.num_irqs; i++)
671 op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]); 667 op->archdata.irqs[i] = build_one_device_irq(op, parent, op->archdata.irqs[i]);
672 668
673 op->dev.parent = parent; 669 op->dev.parent = parent;
674 op->dev.bus = &of_platform_bus_type; 670 op->dev.bus = &platform_bus_type;
675 if (!parent) 671 if (!parent)
676 dev_set_name(&op->dev, "root"); 672 dev_set_name(&op->dev, "root");
677 else 673 else
@@ -690,7 +686,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
690static void __init scan_tree(struct device_node *dp, struct device *parent) 686static void __init scan_tree(struct device_node *dp, struct device *parent)
691{ 687{
692 while (dp) { 688 while (dp) {
693 struct of_device *op = scan_one_device(dp, parent); 689 struct platform_device *op = scan_one_device(dp, parent);
694 690
695 if (op) 691 if (op)
696 scan_tree(dp->child, &op->dev); 692 scan_tree(dp->child, &op->dev);
@@ -699,30 +695,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent)
699 } 695 }
700} 696}
701 697
702static void __init scan_of_devices(void) 698static int __init scan_of_devices(void)
703{ 699{
704 struct device_node *root = of_find_node_by_path("/"); 700 struct device_node *root = of_find_node_by_path("/");
705 struct of_device *parent; 701 struct platform_device *parent;
706 702
707 parent = scan_one_device(root, NULL); 703 parent = scan_one_device(root, NULL);
708 if (!parent) 704 if (!parent)
709 return; 705 return 0;
710 706
711 scan_tree(root->child, &parent->dev); 707 scan_tree(root->child, &parent->dev);
708 return 0;
712} 709}
713 710postcore_initcall(scan_of_devices);
714static int __init of_bus_driver_init(void)
715{
716 int err;
717
718 err = of_bus_type_init(&of_platform_bus_type, "of");
719 if (!err)
720 scan_of_devices();
721
722 return err;
723}
724
725postcore_initcall(of_bus_driver_init);
726 711
727static int __init of_debug(char *str) 712static int __init of_debug(char *str)
728{ 713{
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 10c6c36a6e75..49ddff56cb04 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -11,48 +11,28 @@
11 11
12#include "of_device_common.h" 12#include "of_device_common.h"
13 13
14static int node_match(struct device *dev, void *data)
15{
16 struct of_device *op = to_of_device(dev);
17 struct device_node *dp = data;
18
19 return (op->dev.of_node == dp);
20}
21
22struct of_device *of_find_device_by_node(struct device_node *dp)
23{
24 struct device *dev = bus_find_device(&of_platform_bus_type, NULL,
25 dp, node_match);
26
27 if (dev)
28 return to_of_device(dev);
29
30 return NULL;
31}
32EXPORT_SYMBOL(of_find_device_by_node);
33
34unsigned int irq_of_parse_and_map(struct device_node *node, int index) 14unsigned int irq_of_parse_and_map(struct device_node *node, int index)
35{ 15{
36 struct of_device *op = of_find_device_by_node(node); 16 struct platform_device *op = of_find_device_by_node(node);
37 17
38 if (!op || index >= op->num_irqs) 18 if (!op || index >= op->archdata.num_irqs)
39 return 0; 19 return 0;
40 20
41 return op->irqs[index]; 21 return op->archdata.irqs[index];
42} 22}
43EXPORT_SYMBOL(irq_of_parse_and_map); 23EXPORT_SYMBOL(irq_of_parse_and_map);
44 24
45/* Take the archdata values for IOMMU, STC, and HOSTDATA found in 25/* Take the archdata values for IOMMU, STC, and HOSTDATA found in
46 * BUS and propagate to all child of_device objects. 26 * BUS and propagate to all child platform_device objects.
47 */ 27 */
48void of_propagate_archdata(struct of_device *bus) 28void of_propagate_archdata(struct platform_device *bus)
49{ 29{
50 struct dev_archdata *bus_sd = &bus->dev.archdata; 30 struct dev_archdata *bus_sd = &bus->dev.archdata;
51 struct device_node *bus_dp = bus->dev.of_node; 31 struct device_node *bus_dp = bus->dev.of_node;
52 struct device_node *dp; 32 struct device_node *dp;
53 33
54 for (dp = bus_dp->child; dp; dp = dp->sibling) { 34 for (dp = bus_dp->child; dp; dp = dp->sibling) {
55 struct of_device *op = of_find_device_by_node(dp); 35 struct platform_device *op = of_find_device_by_node(dp);
56 36
57 op->dev.archdata.iommu = bus_sd->iommu; 37 op->dev.archdata.iommu = bus_sd->iommu;
58 op->dev.archdata.stc = bus_sd->stc; 38 op->dev.archdata.stc = bus_sd->stc;
@@ -64,9 +44,6 @@ void of_propagate_archdata(struct of_device *bus)
64 } 44 }
65} 45}
66 46
67struct bus_type of_platform_bus_type;
68EXPORT_SYMBOL(of_platform_bus_type);
69
70static void get_cells(struct device_node *dp, int *addrc, int *sizec) 47static void get_cells(struct device_node *dp, int *addrc, int *sizec)
71{ 48{
72 if (addrc) 49 if (addrc)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 8a8363adb8bd..4137579d9adc 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -198,7 +198,7 @@ static unsigned long pci_parse_of_flags(u32 addr0)
198 * into physical address resources, we only have to figure out the register 198 * into physical address resources, we only have to figure out the register
199 * mapping. 199 * mapping.
200 */ 200 */
201static void pci_parse_of_addrs(struct of_device *op, 201static void pci_parse_of_addrs(struct platform_device *op,
202 struct device_node *node, 202 struct device_node *node,
203 struct pci_dev *dev) 203 struct pci_dev *dev)
204{ 204{
@@ -248,7 +248,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
248{ 248{
249 struct dev_archdata *sd; 249 struct dev_archdata *sd;
250 struct pci_slot *slot; 250 struct pci_slot *slot;
251 struct of_device *op; 251 struct platform_device *op;
252 struct pci_dev *dev; 252 struct pci_dev *dev;
253 const char *type; 253 const char *type;
254 u32 class; 254 u32 class;
@@ -340,7 +340,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
340 dev->hdr_type = PCI_HEADER_TYPE_NORMAL; 340 dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
341 dev->rom_base_reg = PCI_ROM_ADDRESS; 341 dev->rom_base_reg = PCI_ROM_ADDRESS;
342 342
343 dev->irq = sd->op->irqs[0]; 343 dev->irq = sd->op->archdata.irqs[0];
344 if (dev->irq == 0xffffffff) 344 if (dev->irq == 0xffffffff)
345 dev->irq = PCI_IRQ_NONE; 345 dev->irq = PCI_IRQ_NONE;
346 } 346 }
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index 51cfa09e392a..efb896d68754 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -410,7 +410,7 @@ static void pci_fire_hw_init(struct pci_pbm_info *pbm)
410} 410}
411 411
412static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm, 412static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
413 struct of_device *op, u32 portid) 413 struct platform_device *op, u32 portid)
414{ 414{
415 const struct linux_prom64_registers *regs; 415 const struct linux_prom64_registers *regs;
416 struct device_node *dp = op->dev.of_node; 416 struct device_node *dp = op->dev.of_node;
@@ -455,7 +455,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
455 return 0; 455 return 0;
456} 456}
457 457
458static int __devinit fire_probe(struct of_device *op, 458static int __devinit fire_probe(struct platform_device *op,
459 const struct of_device_id *match) 459 const struct of_device_id *match)
460{ 460{
461 struct device_node *dp = op->dev.of_node; 461 struct device_node *dp = op->dev.of_node;
@@ -518,7 +518,7 @@ static struct of_platform_driver fire_driver = {
518 518
519static int __init fire_init(void) 519static int __init fire_init(void)
520{ 520{
521 return of_register_driver(&fire_driver, &of_bus_type); 521 return of_register_platform_driver(&fire_driver);
522} 522}
523 523
524subsys_initcall(fire_init); 524subsys_initcall(fire_init);
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 03186824327e..e20ed5f06e9c 100644
--- a/arch/sparc/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
@@ -91,7 +91,7 @@ struct pci_pbm_info {
91 char *name; 91 char *name;
92 92
93 /* OBP specific information. */ 93 /* OBP specific information. */
94 struct of_device *op; 94 struct platform_device *op;
95 u64 ino_bitmap; 95 u64 ino_bitmap;
96 96
97 /* PBM I/O and Memory space resources. */ 97 /* PBM I/O and Memory space resources. */
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index 558a70512824..22eab7cf3b11 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -285,7 +285,7 @@ static irqreturn_t psycho_ce_intr(int irq, void *dev_id)
285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */ 285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */
286static void psycho_register_error_handlers(struct pci_pbm_info *pbm) 286static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
287{ 287{
288 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); 288 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
289 unsigned long base = pbm->controller_regs; 289 unsigned long base = pbm->controller_regs;
290 u64 tmp; 290 u64 tmp;
291 int err; 291 int err;
@@ -302,23 +302,23 @@ static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
302 * 5: POWER MANAGEMENT 302 * 5: POWER MANAGEMENT
303 */ 303 */
304 304
305 if (op->num_irqs < 6) 305 if (op->archdata.num_irqs < 6)
306 return; 306 return;
307 307
308 /* We really mean to ignore the return result here. Two 308 /* We really mean to ignore the return result here. Two
309 * PCI controller share the same interrupt numbers and 309 * PCI controller share the same interrupt numbers and
310 * drive the same front-end hardware. 310 * drive the same front-end hardware.
311 */ 311 */
312 err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED, 312 err = request_irq(op->archdata.irqs[1], psycho_ue_intr, IRQF_SHARED,
313 "PSYCHO_UE", pbm); 313 "PSYCHO_UE", pbm);
314 err = request_irq(op->irqs[2], psycho_ce_intr, IRQF_SHARED, 314 err = request_irq(op->archdata.irqs[2], psycho_ce_intr, IRQF_SHARED,
315 "PSYCHO_CE", pbm); 315 "PSYCHO_CE", pbm);
316 316
317 /* This one, however, ought not to fail. We can just warn 317 /* This one, however, ought not to fail. We can just warn
318 * about it since the system can still operate properly even 318 * about it since the system can still operate properly even
319 * if this fails. 319 * if this fails.
320 */ 320 */
321 err = request_irq(op->irqs[0], psycho_pcierr_intr, IRQF_SHARED, 321 err = request_irq(op->archdata.irqs[0], psycho_pcierr_intr, IRQF_SHARED,
322 "PSYCHO_PCIERR", pbm); 322 "PSYCHO_PCIERR", pbm);
323 if (err) 323 if (err)
324 printk(KERN_WARNING "%s: Could not register PCIERR, " 324 printk(KERN_WARNING "%s: Could not register PCIERR, "
@@ -483,7 +483,7 @@ static void psycho_pbm_strbuf_init(struct pci_pbm_info *pbm,
483#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL 483#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL
484 484
485static void __devinit psycho_pbm_init(struct pci_pbm_info *pbm, 485static void __devinit psycho_pbm_init(struct pci_pbm_info *pbm,
486 struct of_device *op, int is_pbm_a) 486 struct platform_device *op, int is_pbm_a)
487{ 487{
488 psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO); 488 psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO);
489 psycho_pbm_strbuf_init(pbm, is_pbm_a); 489 psycho_pbm_strbuf_init(pbm, is_pbm_a);
@@ -503,7 +503,7 @@ static struct pci_pbm_info * __devinit psycho_find_sibling(u32 upa_portid)
503 503
504#define PSYCHO_CONFIGSPACE 0x001000000UL 504#define PSYCHO_CONFIGSPACE 0x001000000UL
505 505
506static int __devinit psycho_probe(struct of_device *op, 506static int __devinit psycho_probe(struct platform_device *op,
507 const struct of_device_id *match) 507 const struct of_device_id *match)
508{ 508{
509 const struct linux_prom64_registers *pr_regs; 509 const struct linux_prom64_registers *pr_regs;
@@ -612,7 +612,7 @@ static struct of_platform_driver psycho_driver = {
612 612
613static int __init psycho_init(void) 613static int __init psycho_init(void)
614{ 614{
615 return of_register_driver(&psycho_driver, &of_bus_type); 615 return of_register_platform_driver(&psycho_driver);
616} 616}
617 617
618subsys_initcall(psycho_init); 618subsys_initcall(psycho_init);
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 6dad8e3b7506..5c3f5ec4cabc 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -311,7 +311,7 @@ static irqreturn_t sabre_ce_intr(int irq, void *dev_id)
311static void sabre_register_error_handlers(struct pci_pbm_info *pbm) 311static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
312{ 312{
313 struct device_node *dp = pbm->op->dev.of_node; 313 struct device_node *dp = pbm->op->dev.of_node;
314 struct of_device *op; 314 struct platform_device *op;
315 unsigned long base = pbm->controller_regs; 315 unsigned long base = pbm->controller_regs;
316 u64 tmp; 316 u64 tmp;
317 int err; 317 int err;
@@ -329,7 +329,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
329 * 2: CE ERR 329 * 2: CE ERR
330 * 3: POWER FAIL 330 * 3: POWER FAIL
331 */ 331 */
332 if (op->num_irqs < 4) 332 if (op->archdata.num_irqs < 4)
333 return; 333 return;
334 334
335 /* We clear the error bits in the appropriate AFSR before 335 /* We clear the error bits in the appropriate AFSR before
@@ -341,7 +341,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
341 SABRE_UEAFSR_SDTE | SABRE_UEAFSR_PDTE), 341 SABRE_UEAFSR_SDTE | SABRE_UEAFSR_PDTE),
342 base + SABRE_UE_AFSR); 342 base + SABRE_UE_AFSR);
343 343
344 err = request_irq(op->irqs[1], sabre_ue_intr, 0, "SABRE_UE", pbm); 344 err = request_irq(op->archdata.irqs[1], sabre_ue_intr, 0, "SABRE_UE", pbm);
345 if (err) 345 if (err)
346 printk(KERN_WARNING "%s: Couldn't register UE, err=%d.\n", 346 printk(KERN_WARNING "%s: Couldn't register UE, err=%d.\n",
347 pbm->name, err); 347 pbm->name, err);
@@ -351,11 +351,11 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
351 base + SABRE_CE_AFSR); 351 base + SABRE_CE_AFSR);
352 352
353 353
354 err = request_irq(op->irqs[2], sabre_ce_intr, 0, "SABRE_CE", pbm); 354 err = request_irq(op->archdata.irqs[2], sabre_ce_intr, 0, "SABRE_CE", pbm);
355 if (err) 355 if (err)
356 printk(KERN_WARNING "%s: Couldn't register CE, err=%d.\n", 356 printk(KERN_WARNING "%s: Couldn't register CE, err=%d.\n",
357 pbm->name, err); 357 pbm->name, err);
358 err = request_irq(op->irqs[0], psycho_pcierr_intr, 0, 358 err = request_irq(op->archdata.irqs[0], psycho_pcierr_intr, 0,
359 "SABRE_PCIERR", pbm); 359 "SABRE_PCIERR", pbm);
360 if (err) 360 if (err)
361 printk(KERN_WARNING "%s: Couldn't register PCIERR, err=%d.\n", 361 printk(KERN_WARNING "%s: Couldn't register PCIERR, err=%d.\n",
@@ -443,7 +443,7 @@ static void __devinit sabre_scan_bus(struct pci_pbm_info *pbm,
443} 443}
444 444
445static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm, 445static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
446 struct of_device *op) 446 struct platform_device *op)
447{ 447{
448 psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE); 448 psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE);
449 pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR; 449 pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR;
@@ -452,7 +452,7 @@ static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
452 sabre_scan_bus(pbm, &op->dev); 452 sabre_scan_bus(pbm, &op->dev);
453} 453}
454 454
455static int __devinit sabre_probe(struct of_device *op, 455static int __devinit sabre_probe(struct platform_device *op,
456 const struct of_device_id *match) 456 const struct of_device_id *match)
457{ 457{
458 const struct linux_prom64_registers *pr_regs; 458 const struct linux_prom64_registers *pr_regs;
@@ -606,7 +606,7 @@ static struct of_platform_driver sabre_driver = {
606 606
607static int __init sabre_init(void) 607static int __init sabre_init(void)
608{ 608{
609 return of_register_driver(&sabre_driver, &of_bus_type); 609 return of_register_platform_driver(&sabre_driver);
610} 610}
611 611
612subsys_initcall(sabre_init); 612subsys_initcall(sabre_init);
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 97a1ae2e1c02..445a47a2fb3d 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -844,7 +844,7 @@ static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino)
844 */ 844 */
845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) 845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
846{ 846{
847 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); 847 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
848 u64 tmp, err_mask, err_no_mask; 848 u64 tmp, err_mask, err_no_mask;
849 int err; 849 int err;
850 850
@@ -857,14 +857,14 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
857 */ 857 */
858 858
859 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { 859 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) {
860 err = request_irq(op->irqs[1], schizo_ue_intr, 0, 860 err = request_irq(op->archdata.irqs[1], schizo_ue_intr, 0,
861 "TOMATILLO_UE", pbm); 861 "TOMATILLO_UE", pbm);
862 if (err) 862 if (err)
863 printk(KERN_WARNING "%s: Could not register UE, " 863 printk(KERN_WARNING "%s: Could not register UE, "
864 "err=%d\n", pbm->name, err); 864 "err=%d\n", pbm->name, err);
865 } 865 }
866 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { 866 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) {
867 err = request_irq(op->irqs[2], schizo_ce_intr, 0, 867 err = request_irq(op->archdata.irqs[2], schizo_ce_intr, 0,
868 "TOMATILLO_CE", pbm); 868 "TOMATILLO_CE", pbm);
869 if (err) 869 if (err)
870 printk(KERN_WARNING "%s: Could not register CE, " 870 printk(KERN_WARNING "%s: Could not register CE, "
@@ -872,10 +872,10 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
872 } 872 }
873 err = 0; 873 err = 0;
874 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { 874 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) {
875 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 875 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
876 "TOMATILLO_PCIERR", pbm); 876 "TOMATILLO_PCIERR", pbm);
877 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { 877 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) {
878 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 878 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
879 "TOMATILLO_PCIERR", pbm); 879 "TOMATILLO_PCIERR", pbm);
880 } 880 }
881 if (err) 881 if (err)
@@ -883,7 +883,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
883 "err=%d\n", pbm->name, err); 883 "err=%d\n", pbm->name, err);
884 884
885 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { 885 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) {
886 err = request_irq(op->irqs[3], schizo_safarierr_intr, 0, 886 err = request_irq(op->archdata.irqs[3], schizo_safarierr_intr, 0,
887 "TOMATILLO_SERR", pbm); 887 "TOMATILLO_SERR", pbm);
888 if (err) 888 if (err)
889 printk(KERN_WARNING "%s: Could not register SERR, " 889 printk(KERN_WARNING "%s: Could not register SERR, "
@@ -939,7 +939,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
939 939
940static void schizo_register_error_handlers(struct pci_pbm_info *pbm) 940static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
941{ 941{
942 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); 942 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
943 u64 tmp, err_mask, err_no_mask; 943 u64 tmp, err_mask, err_no_mask;
944 int err; 944 int err;
945 945
@@ -952,14 +952,14 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
952 */ 952 */
953 953
954 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { 954 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) {
955 err = request_irq(op->irqs[1], schizo_ue_intr, 0, 955 err = request_irq(op->archdata.irqs[1], schizo_ue_intr, 0,
956 "SCHIZO_UE", pbm); 956 "SCHIZO_UE", pbm);
957 if (err) 957 if (err)
958 printk(KERN_WARNING "%s: Could not register UE, " 958 printk(KERN_WARNING "%s: Could not register UE, "
959 "err=%d\n", pbm->name, err); 959 "err=%d\n", pbm->name, err);
960 } 960 }
961 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { 961 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) {
962 err = request_irq(op->irqs[2], schizo_ce_intr, 0, 962 err = request_irq(op->archdata.irqs[2], schizo_ce_intr, 0,
963 "SCHIZO_CE", pbm); 963 "SCHIZO_CE", pbm);
964 if (err) 964 if (err)
965 printk(KERN_WARNING "%s: Could not register CE, " 965 printk(KERN_WARNING "%s: Could not register CE, "
@@ -967,10 +967,10 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
967 } 967 }
968 err = 0; 968 err = 0;
969 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { 969 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) {
970 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 970 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
971 "SCHIZO_PCIERR", pbm); 971 "SCHIZO_PCIERR", pbm);
972 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { 972 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) {
973 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 973 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
974 "SCHIZO_PCIERR", pbm); 974 "SCHIZO_PCIERR", pbm);
975 } 975 }
976 if (err) 976 if (err)
@@ -978,7 +978,7 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
978 "err=%d\n", pbm->name, err); 978 "err=%d\n", pbm->name, err);
979 979
980 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { 980 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) {
981 err = request_irq(op->irqs[3], schizo_safarierr_intr, 0, 981 err = request_irq(op->archdata.irqs[3], schizo_safarierr_intr, 0,
982 "SCHIZO_SERR", pbm); 982 "SCHIZO_SERR", pbm);
983 if (err) 983 if (err)
984 printk(KERN_WARNING "%s: Could not register SERR, " 984 printk(KERN_WARNING "%s: Could not register SERR, "
@@ -1307,7 +1307,7 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1307} 1307}
1308 1308
1309static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm, 1309static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm,
1310 struct of_device *op, u32 portid, 1310 struct platform_device *op, u32 portid,
1311 int chip_type) 1311 int chip_type)
1312{ 1312{
1313 const struct linux_prom64_registers *regs; 1313 const struct linux_prom64_registers *regs;
@@ -1413,7 +1413,7 @@ static struct pci_pbm_info * __devinit schizo_find_sibling(u32 portid,
1413 return NULL; 1413 return NULL;
1414} 1414}
1415 1415
1416static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type) 1416static int __devinit __schizo_init(struct platform_device *op, unsigned long chip_type)
1417{ 1417{
1418 struct device_node *dp = op->dev.of_node; 1418 struct device_node *dp = op->dev.of_node;
1419 struct pci_pbm_info *pbm; 1419 struct pci_pbm_info *pbm;
@@ -1460,7 +1460,7 @@ out_err:
1460 return err; 1460 return err;
1461} 1461}
1462 1462
1463static int __devinit schizo_probe(struct of_device *op, 1463static int __devinit schizo_probe(struct platform_device *op,
1464 const struct of_device_id *match) 1464 const struct of_device_id *match)
1465{ 1465{
1466 return __schizo_init(op, (unsigned long) match->data); 1466 return __schizo_init(op, (unsigned long) match->data);
@@ -1501,7 +1501,7 @@ static struct of_platform_driver schizo_driver = {
1501 1501
1502static int __init schizo_init(void) 1502static int __init schizo_init(void)
1503{ 1503{
1504 return of_register_driver(&schizo_driver, &of_bus_type); 1504 return of_register_platform_driver(&schizo_driver);
1505} 1505}
1506 1506
1507subsys_initcall(schizo_init); 1507subsys_initcall(schizo_init);
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index a24af6f7e17f..743344aa6d8a 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -879,7 +879,7 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
879#endif /* !(CONFIG_PCI_MSI) */ 879#endif /* !(CONFIG_PCI_MSI) */
880 880
881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm, 881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
882 struct of_device *op, u32 devhandle) 882 struct platform_device *op, u32 devhandle)
883{ 883{
884 struct device_node *dp = op->dev.of_node; 884 struct device_node *dp = op->dev.of_node;
885 int err; 885 int err;
@@ -918,7 +918,7 @@ static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
918 return 0; 918 return 0;
919} 919}
920 920
921static int __devinit pci_sun4v_probe(struct of_device *op, 921static int __devinit pci_sun4v_probe(struct platform_device *op,
922 const struct of_device_id *match) 922 const struct of_device_id *match)
923{ 923{
924 const struct linux_prom64_registers *regs; 924 const struct linux_prom64_registers *regs;
@@ -1019,7 +1019,7 @@ static struct of_platform_driver pci_sun4v_driver = {
1019 1019
1020static int __init pci_sun4v_init(void) 1020static int __init pci_sun4v_init(void)
1021{ 1021{
1022 return of_register_driver(&pci_sun4v_driver, &of_bus_type); 1022 return of_register_platform_driver(&pci_sun4v_driver);
1023} 1023}
1024 1024
1025subsys_initcall(pci_sun4v_init); 1025subsys_initcall(pci_sun4v_init);
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 9589d8b9b0c1..94536a85f161 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -51,7 +51,7 @@ static void pmc_swift_idle(void)
51#endif 51#endif
52} 52}
53 53
54static int __devinit pmc_probe(struct of_device *op, 54static int __devinit pmc_probe(struct platform_device *op,
55 const struct of_device_id *match) 55 const struct of_device_id *match)
56{ 56{
57 regs = of_ioremap(&op->resource[0], 0, 57 regs = of_ioremap(&op->resource[0], 0,
@@ -89,7 +89,7 @@ static struct of_platform_driver pmc_driver = {
89 89
90static int __init pmc_init(void) 90static int __init pmc_init(void)
91{ 91{
92 return of_register_driver(&pmc_driver, &of_bus_type); 92 return of_register_platform_driver(&pmc_driver);
93} 93}
94 94
95/* This driver is not critical to the boot process 95/* This driver is not critical to the boot process
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index 168d4cb63f5b..2c59f4d387dd 100644
--- a/arch/sparc/kernel/power.c
+++ b/arch/sparc/kernel/power.c
@@ -33,10 +33,10 @@ static int __devinit has_button_interrupt(unsigned int irq, struct device_node *
33 return 1; 33 return 1;
34} 34}
35 35
36static int __devinit power_probe(struct of_device *op, const struct of_device_id *match) 36static int __devinit power_probe(struct platform_device *op, const struct of_device_id *match)
37{ 37{
38 struct resource *res = &op->resource[0]; 38 struct resource *res = &op->resource[0];
39 unsigned int irq= op->irqs[0]; 39 unsigned int irq = op->archdata.irqs[0];
40 40
41 power_reg = of_ioremap(res, 0, 0x4, "power"); 41 power_reg = of_ioremap(res, 0, 0x4, "power");
42 42
@@ -70,7 +70,7 @@ static struct of_platform_driver power_driver = {
70 70
71static int __init power_init(void) 71static int __init power_init(void)
72{ 72{
73 return of_register_driver(&power_driver, &of_platform_bus_type); 73 return of_register_platform_driver(&power_driver);
74} 74}
75 75
76device_initcall(power_init); 76device_initcall(power_init);
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index a8591ef2636d..eeb04a782ec8 100644
--- a/arch/sparc/kernel/prom.h
+++ b/arch/sparc/kernel/prom.h
@@ -9,14 +9,6 @@ extern void irq_trans_init(struct device_node *dp);
9 9
10extern unsigned int prom_unique_id; 10extern unsigned int prom_unique_id;
11 11
12static inline int is_root_node(const struct device_node *dp)
13{
14 if (!dp)
15 return 0;
16
17 return (dp->parent == NULL);
18}
19
20extern char *build_path_component(struct device_node *dp); 12extern char *build_path_component(struct device_node *dp);
21extern void of_console_init(void); 13extern void of_console_init(void);
22 14
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index 466a32763ea8..86597d9867fd 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -21,7 +21,7 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/memblock.h> 23#include <linux/memblock.h>
24#include <linux/of_device.h> 24#include <linux/of.h>
25 25
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include <asm/oplib.h> 27#include <asm/oplib.h>
@@ -81,7 +81,7 @@ static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
81 return; 81 return;
82 82
83 regs = rprop->value; 83 regs = rprop->value;
84 if (!is_root_node(dp->parent)) { 84 if (!of_node_is_root(dp->parent)) {
85 sprintf(tmp_buf, "%s@%x,%x", 85 sprintf(tmp_buf, "%s@%x,%x",
86 dp->name, 86 dp->name,
87 (unsigned int) (regs->phys_addr >> 32UL), 87 (unsigned int) (regs->phys_addr >> 32UL),
@@ -121,7 +121,7 @@ static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
121 return; 121 return;
122 122
123 regs = prop->value; 123 regs = prop->value;
124 if (!is_root_node(dp->parent)) { 124 if (!of_node_is_root(dp->parent)) {
125 sprintf(tmp_buf, "%s@%x,%x", 125 sprintf(tmp_buf, "%s@%x,%x",
126 dp->name, 126 dp->name,
127 (unsigned int) (regs->phys_addr >> 32UL), 127 (unsigned int) (regs->phys_addr >> 32UL),
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index 57ac9e28be0c..1f830da2ddf2 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -244,7 +244,7 @@ char * __init build_full_name(struct device_node *dp)
244 244
245 n = prom_early_alloc(len); 245 n = prom_early_alloc(len);
246 strcpy(n, dp->parent->full_name); 246 strcpy(n, dp->parent->full_name);
247 if (!is_root_node(dp->parent)) { 247 if (!of_node_is_root(dp->parent)) {
248 strcpy(n + plen, "/"); 248 strcpy(n + plen, "/");
249 plen++; 249 plen++;
250 } 250 }
diff --git a/arch/sparc/kernel/prom_irqtrans.c b/arch/sparc/kernel/prom_irqtrans.c
index 5702ad4710cb..ce651147fabc 100644
--- a/arch/sparc/kernel/prom_irqtrans.c
+++ b/arch/sparc/kernel/prom_irqtrans.c
@@ -719,7 +719,7 @@ static unsigned int central_build_irq(struct device_node *dp,
719 void *_data) 719 void *_data)
720{ 720{
721 struct device_node *central_dp = _data; 721 struct device_node *central_dp = _data;
722 struct of_device *central_op = of_find_device_by_node(central_dp); 722 struct platform_device *central_op = of_find_device_by_node(central_dp);
723 struct resource *res; 723 struct resource *res;
724 unsigned long imap, iclr; 724 unsigned long imap, iclr;
725 u32 tmp; 725 u32 tmp;
diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 3f34ac853931..fe2af66bb198 100644
--- a/arch/sparc/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
@@ -447,7 +447,7 @@ int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
447 447
448} 448}
449 449
450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op, 450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op,
451 const char *chip_name, int chip_type) 451 const char *chip_name, int chip_type)
452{ 452{
453 struct device_node *dp = op->dev.of_node; 453 struct device_node *dp = op->dev.of_node;
diff --git a/arch/sparc/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h
index 092c278ef28d..590b4ed8ab5e 100644
--- a/arch/sparc/kernel/psycho_common.h
+++ b/arch/sparc/kernel/psycho_common.h
@@ -42,7 +42,7 @@ extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
42 unsigned long write_complete_offset); 42 unsigned long write_complete_offset);
43 43
44extern void psycho_pbm_init_common(struct pci_pbm_info *pbm, 44extern void psycho_pbm_init_common(struct pci_pbm_info *pbm,
45 struct of_device *op, 45 struct platform_device *op,
46 const char *chip_name, int chip_type); 46 const char *chip_name, int chip_type);
47 47
48#endif /* _PSYCHO_COMMON_H */ 48#endif /* _PSYCHO_COMMON_H */
diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index cfeaf04b9cdf..2ca32d13abcf 100644
--- a/arch/sparc/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
@@ -57,7 +57,7 @@
57void sbus_set_sbus64(struct device *dev, int bursts) 57void sbus_set_sbus64(struct device *dev, int bursts)
58{ 58{
59 struct iommu *iommu = dev->archdata.iommu; 59 struct iommu *iommu = dev->archdata.iommu;
60 struct of_device *op = to_of_device(dev); 60 struct platform_device *op = to_platform_device(dev);
61 const struct linux_prom_registers *regs; 61 const struct linux_prom_registers *regs;
62 unsigned long cfg_reg; 62 unsigned long cfg_reg;
63 int slot; 63 int slot;
@@ -204,7 +204,7 @@ static unsigned long sysio_imap_to_iclr(unsigned long imap)
204 return imap + diff; 204 return imap + diff;
205} 205}
206 206
207static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino) 207static unsigned int sbus_build_irq(struct platform_device *op, unsigned int ino)
208{ 208{
209 struct iommu *iommu = op->dev.archdata.iommu; 209 struct iommu *iommu = op->dev.archdata.iommu;
210 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 210 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
@@ -267,7 +267,7 @@ static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino)
267#define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ 267#define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */
268static irqreturn_t sysio_ue_handler(int irq, void *dev_id) 268static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
269{ 269{
270 struct of_device *op = dev_id; 270 struct platform_device *op = dev_id;
271 struct iommu *iommu = op->dev.archdata.iommu; 271 struct iommu *iommu = op->dev.archdata.iommu;
272 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 272 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
273 unsigned long afsr_reg, afar_reg; 273 unsigned long afsr_reg, afar_reg;
@@ -341,7 +341,7 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
341#define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ 341#define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */
342static irqreturn_t sysio_ce_handler(int irq, void *dev_id) 342static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
343{ 343{
344 struct of_device *op = dev_id; 344 struct platform_device *op = dev_id;
345 struct iommu *iommu = op->dev.archdata.iommu; 345 struct iommu *iommu = op->dev.archdata.iommu;
346 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 346 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
347 unsigned long afsr_reg, afar_reg; 347 unsigned long afsr_reg, afar_reg;
@@ -420,7 +420,7 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
420#define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */ 420#define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */
421static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) 421static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
422{ 422{
423 struct of_device *op = dev_id; 423 struct platform_device *op = dev_id;
424 struct iommu *iommu = op->dev.archdata.iommu; 424 struct iommu *iommu = op->dev.archdata.iommu;
425 unsigned long afsr_reg, afar_reg, reg_base; 425 unsigned long afsr_reg, afar_reg, reg_base;
426 unsigned long afsr, afar, error_bits; 426 unsigned long afsr, afar, error_bits;
@@ -488,7 +488,7 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
488#define SYSIO_CE_INO 0x35 488#define SYSIO_CE_INO 0x35
489#define SYSIO_SBUSERR_INO 0x36 489#define SYSIO_SBUSERR_INO 0x36
490 490
491static void __init sysio_register_error_handlers(struct of_device *op) 491static void __init sysio_register_error_handlers(struct platform_device *op)
492{ 492{
493 struct iommu *iommu = op->dev.archdata.iommu; 493 struct iommu *iommu = op->dev.archdata.iommu;
494 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 494 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
@@ -534,7 +534,7 @@ static void __init sysio_register_error_handlers(struct of_device *op)
534} 534}
535 535
536/* Boot time initialization. */ 536/* Boot time initialization. */
537static void __init sbus_iommu_init(struct of_device *op) 537static void __init sbus_iommu_init(struct platform_device *op)
538{ 538{
539 const struct linux_prom64_registers *pr; 539 const struct linux_prom64_registers *pr;
540 struct device_node *dp = op->dev.of_node; 540 struct device_node *dp = op->dev.of_node;
@@ -663,7 +663,7 @@ static int __init sbus_init(void)
663 struct device_node *dp; 663 struct device_node *dp;
664 664
665 for_each_node_by_name(dp, "sbus") { 665 for_each_node_by_name(dp, "sbus") {
666 struct of_device *op = of_find_device_by_node(dp); 666 struct platform_device *op = of_find_device_by_node(dp);
667 667
668 sbus_iommu_init(op); 668 sbus_iommu_init(op);
669 of_propagate_archdata(op); 669 of_propagate_archdata(op);
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index e404b063be2c..9c743b1886ff 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -142,7 +142,7 @@ static struct platform_device m48t59_rtc = {
142 }, 142 },
143}; 143};
144 144
145static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match) 145static int __devinit clock_probe(struct platform_device *op, const struct of_device_id *match)
146{ 146{
147 struct device_node *dp = op->dev.of_node; 147 struct device_node *dp = op->dev.of_node;
148 const char *model = of_get_property(dp, "model", NULL); 148 const char *model = of_get_property(dp, "model", NULL);
@@ -189,7 +189,7 @@ static struct of_platform_driver clock_driver = {
189/* Probe for the mostek real time clock chip. */ 189/* Probe for the mostek real time clock chip. */
190static int __init clock_init(void) 190static int __init clock_init(void)
191{ 191{
192 return of_register_driver(&clock_driver, &of_platform_bus_type); 192 return of_register_platform_driver(&clock_driver);
193} 193}
194/* Must be after subsys_initcall() so that busses are probed. Must 194/* Must be after subsys_initcall() so that busses are probed. Must
195 * be before device_initcall() because things like the RTC driver 195 * be before device_initcall() because things like the RTC driver
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 21e9fcae0668..3bc9c9979b92 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -419,7 +419,7 @@ static struct platform_device rtc_cmos_device = {
419 .num_resources = 1, 419 .num_resources = 1,
420}; 420};
421 421
422static int __devinit rtc_probe(struct of_device *op, const struct of_device_id *match) 422static int __devinit rtc_probe(struct platform_device *op, const struct of_device_id *match)
423{ 423{
424 struct resource *r; 424 struct resource *r;
425 425
@@ -477,7 +477,7 @@ static struct platform_device rtc_bq4802_device = {
477 .num_resources = 1, 477 .num_resources = 1,
478}; 478};
479 479
480static int __devinit bq4802_probe(struct of_device *op, const struct of_device_id *match) 480static int __devinit bq4802_probe(struct platform_device *op, const struct of_device_id *match)
481{ 481{
482 482
483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n", 483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n",
@@ -534,7 +534,7 @@ static struct platform_device m48t59_rtc = {
534 }, 534 },
535}; 535};
536 536
537static int __devinit mostek_probe(struct of_device *op, const struct of_device_id *match) 537static int __devinit mostek_probe(struct platform_device *op, const struct of_device_id *match)
538{ 538{
539 struct device_node *dp = op->dev.of_node; 539 struct device_node *dp = op->dev.of_node;
540 540
@@ -586,9 +586,9 @@ static int __init clock_init(void)
586 if (tlb_type == hypervisor) 586 if (tlb_type == hypervisor)
587 return platform_device_register(&rtc_sun4v_device); 587 return platform_device_register(&rtc_sun4v_device);
588 588
589 (void) of_register_driver(&rtc_driver, &of_platform_bus_type); 589 (void) of_register_platform_driver(&rtc_driver);
590 (void) of_register_driver(&mostek_driver, &of_platform_bus_type); 590 (void) of_register_platform_driver(&mostek_driver);
591 (void) of_register_driver(&bq4802_driver, &of_platform_bus_type); 591 (void) of_register_platform_driver(&bq4802_driver);
592 592
593 return 0; 593 return 0;
594} 594}
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index 005e758a4db7..fc58c3e917df 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -35,7 +35,7 @@
35#define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID) 35#define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID)
36#define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM) 36#define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM)
37 37
38static void __init iounit_iommu_init(struct of_device *op) 38static void __init iounit_iommu_init(struct platform_device *op)
39{ 39{
40 struct iounit_struct *iounit; 40 struct iounit_struct *iounit;
41 iopte_t *xpt, *xptend; 41 iopte_t *xpt, *xptend;
@@ -74,7 +74,7 @@ static int __init iounit_init(void)
74 struct device_node *dp; 74 struct device_node *dp;
75 75
76 for_each_node_by_name(dp, "sbi") { 76 for_each_node_by_name(dp, "sbi") {
77 struct of_device *op = of_find_device_by_node(dp); 77 struct platform_device *op = of_find_device_by_node(dp);
78 78
79 iounit_iommu_init(op); 79 iounit_iommu_init(op);
80 of_propagate_archdata(op); 80 of_propagate_archdata(op);
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index b2e6e73888b5..07fc6a65d9b6 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -56,14 +56,14 @@ static pgprot_t dvma_prot; /* Consistent mapping pte flags */
56#define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID) 56#define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID)
57#define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ) 57#define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ)
58 58
59static void __init sbus_iommu_init(struct of_device *op) 59static void __init sbus_iommu_init(struct platform_device *op)
60{ 60{
61 struct iommu_struct *iommu; 61 struct iommu_struct *iommu;
62 unsigned int impl, vers; 62 unsigned int impl, vers;
63 unsigned long *bitmap; 63 unsigned long *bitmap;
64 unsigned long tmp; 64 unsigned long tmp;
65 65
66 iommu = kmalloc(sizeof(struct iommu_struct), GFP_ATOMIC); 66 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL);
67 if (!iommu) { 67 if (!iommu) {
68 prom_printf("Unable to allocate iommu structure\n"); 68 prom_printf("Unable to allocate iommu structure\n");
69 prom_halt(); 69 prom_halt();
@@ -132,7 +132,7 @@ static int __init iommu_init(void)
132 struct device_node *dp; 132 struct device_node *dp;
133 133
134 for_each_node_by_name(dp, "iommu") { 134 for_each_node_by_name(dp, "iommu") {
135 struct of_device *op = of_find_device_by_node(dp); 135 struct platform_device *op = of_find_device_by_node(dp);
136 136
137 sbus_iommu_init(op); 137 sbus_iommu_init(op);
138 of_propagate_archdata(op); 138 of_propagate_archdata(op);