diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-27 06:38:42 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-29 05:15:11 -0400 |
commit | 104364810ff5b0844a2183fbca989f70e86d486b (patch) | |
tree | e7aa24484aefae8ad6ba00d9e0f52ee5bfb384f3 | |
parent | 33c4655c00e6af3ec4023f2cafd63dd4a42de49b (diff) |
sparc: Remove SBUS layer resource and irq handling.
All the drivers use OF device objects now for this
information.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | arch/sparc/include/asm/sbus_32.h | 15 | ||||
-rw-r--r-- | arch/sparc/include/asm/sbus_64.h | 16 | ||||
-rw-r--r-- | arch/sparc/kernel/ioport.c | 27 | ||||
-rw-r--r-- | arch/sparc64/kernel/sbus.c | 4 | ||||
-rw-r--r-- | drivers/sbus/sbus.c | 124 |
5 files changed, 1 insertions, 185 deletions
diff --git a/arch/sparc/include/asm/sbus_32.h b/arch/sparc/include/asm/sbus_32.h index 81ea0f687b18..8f5900baca32 100644 --- a/arch/sparc/include/asm/sbus_32.h +++ b/arch/sparc/include/asm/sbus_32.h | |||
@@ -51,17 +51,6 @@ struct sbus_dev { | |||
51 | int prom_node; | 51 | int prom_node; |
52 | char prom_name[64]; | 52 | char prom_name[64]; |
53 | int slot; | 53 | int slot; |
54 | |||
55 | struct resource resource[PROMREG_MAX]; | ||
56 | |||
57 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; | ||
58 | int num_registers; | ||
59 | |||
60 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; | ||
61 | int num_device_ranges; | ||
62 | |||
63 | unsigned int irqs[4]; | ||
64 | int num_irqs; | ||
65 | }; | 54 | }; |
66 | #define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev) | 55 | #define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev) |
67 | 56 | ||
@@ -73,9 +62,6 @@ struct sbus_bus { | |||
73 | int prom_node; /* PROM device tree node for this SBus */ | 62 | int prom_node; /* PROM device tree node for this SBus */ |
74 | char prom_name[64]; /* Usually "sbus" or "sbi" */ | 63 | char prom_name[64]; /* Usually "sbus" or "sbi" */ |
75 | int clock_freq; | 64 | int clock_freq; |
76 | |||
77 | struct linux_prom_ranges sbus_ranges[PROMREG_MAX]; | ||
78 | int num_sbus_ranges; | ||
79 | }; | 65 | }; |
80 | #define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev) | 66 | #define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev) |
81 | 67 | ||
@@ -103,7 +89,6 @@ sbus_is_slave(struct sbus_dev *dev) | |||
103 | void prom_adjust_ranges(struct linux_prom_ranges *, int, | 89 | void prom_adjust_ranges(struct linux_prom_ranges *, int, |
104 | struct linux_prom_ranges *, int); | 90 | struct linux_prom_ranges *, int); |
105 | 91 | ||
106 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); | ||
107 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); | 92 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); |
108 | extern int sbus_arch_preinit(void); | 93 | extern int sbus_arch_preinit(void); |
109 | extern void sbus_arch_postinit(void); | 94 | extern void sbus_arch_postinit(void); |
diff --git a/arch/sparc/include/asm/sbus_64.h b/arch/sparc/include/asm/sbus_64.h index 2b2562e0e5c1..75f95ff6d01c 100644 --- a/arch/sparc/include/asm/sbus_64.h +++ b/arch/sparc/include/asm/sbus_64.h | |||
@@ -51,17 +51,6 @@ struct sbus_dev { | |||
51 | int prom_node; | 51 | int prom_node; |
52 | char prom_name[64]; | 52 | char prom_name[64]; |
53 | int slot; | 53 | int slot; |
54 | |||
55 | struct resource resource[PROMREG_MAX]; | ||
56 | |||
57 | struct linux_prom_registers reg_addrs[PROMREG_MAX]; | ||
58 | int num_registers; | ||
59 | |||
60 | struct linux_prom_ranges device_ranges[PROMREG_MAX]; | ||
61 | int num_device_ranges; | ||
62 | |||
63 | unsigned int irqs[4]; | ||
64 | int num_irqs; | ||
65 | }; | 54 | }; |
66 | #define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev) | 55 | #define to_sbus_device(d) container_of(d, struct sbus_dev, ofdev.dev) |
67 | 56 | ||
@@ -73,10 +62,6 @@ struct sbus_bus { | |||
73 | int prom_node; /* OBP node of SBUS */ | 62 | int prom_node; /* OBP node of SBUS */ |
74 | char prom_name[64]; /* Usually "sbus" or "sbi" */ | 63 | char prom_name[64]; /* Usually "sbus" or "sbi" */ |
75 | int clock_freq; | 64 | int clock_freq; |
76 | |||
77 | struct linux_prom_ranges sbus_ranges[PROMREG_MAX]; | ||
78 | int num_sbus_ranges; | ||
79 | |||
80 | int portid; | 65 | int portid; |
81 | }; | 66 | }; |
82 | #define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev) | 67 | #define to_sbus(d) container_of(d, struct sbus_bus, ofdev.dev) |
@@ -94,7 +79,6 @@ extern struct sbus_bus *sbus_root; | |||
94 | for ((bus) = sbus_root; (bus); (bus) = (bus)->next) \ | 79 | for ((bus) = sbus_root; (bus); (bus) = (bus)->next) \ |
95 | for ((device) = (bus)->devices; (device); (device) = (device)->next) | 80 | for ((device) = (bus)->devices; (device); (device) = (device)->next) |
96 | 81 | ||
97 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); | ||
98 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); | 82 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); |
99 | extern int sbus_arch_preinit(void); | 83 | extern int sbus_arch_preinit(void); |
100 | extern void sbus_arch_postinit(void); | 84 | extern void sbus_arch_postinit(void); |
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c index 0e478301e8e5..d82a810564ba 100644 --- a/arch/sparc/kernel/ioport.c +++ b/arch/sparc/kernel/ioport.c | |||
@@ -394,33 +394,6 @@ void sbus_dma_sync_single_for_device(struct device *dev, dma_addr_t ba, size_t s | |||
394 | } | 394 | } |
395 | 395 | ||
396 | /* Support code for sbus_init(). */ | 396 | /* Support code for sbus_init(). */ |
397 | /* | ||
398 | * XXX This functions appears to be a distorted version of | ||
399 | * prom_sbus_ranges_init(), with all sun4d stuff cut away. | ||
400 | * Ask DaveM what is going on here, how is sun4d supposed to work... XXX | ||
401 | */ | ||
402 | /* added back sun4d patch from Thomas Bogendoerfer - should be OK (crn) */ | ||
403 | void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *sbus) | ||
404 | { | ||
405 | int parent_node = pn->node; | ||
406 | |||
407 | if (sparc_cpu_model == sun4d) { | ||
408 | struct linux_prom_ranges iounit_ranges[PROMREG_MAX]; | ||
409 | int num_iounit_ranges, len; | ||
410 | |||
411 | len = prom_getproperty(parent_node, "ranges", | ||
412 | (char *) iounit_ranges, | ||
413 | sizeof (iounit_ranges)); | ||
414 | if (len != -1) { | ||
415 | num_iounit_ranges = | ||
416 | (len / sizeof(struct linux_prom_ranges)); | ||
417 | prom_adjust_ranges(sbus->sbus_ranges, | ||
418 | sbus->num_sbus_ranges, | ||
419 | iounit_ranges, num_iounit_ranges); | ||
420 | } | ||
421 | } | ||
422 | } | ||
423 | |||
424 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) | 397 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) |
425 | { | 398 | { |
426 | #ifndef CONFIG_SUN4 | 399 | #ifndef CONFIG_SUN4 |
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c index 60fac2d64b15..0193e3823196 100644 --- a/arch/sparc64/kernel/sbus.c +++ b/arch/sparc64/kernel/sbus.c | |||
@@ -650,10 +650,6 @@ fatal_memory_error: | |||
650 | prom_printf("sbus_iommu_init: Fatal memory allocation error.\n"); | 650 | prom_printf("sbus_iommu_init: Fatal memory allocation error.\n"); |
651 | } | 651 | } |
652 | 652 | ||
653 | void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *sbus) | ||
654 | { | ||
655 | } | ||
656 | |||
657 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) | 653 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) |
658 | { | 654 | { |
659 | sbus_iommu_init(dp->node, sbus); | 655 | sbus_iommu_init(dp->node, sbus); |
diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c index 08f4667188d2..89eb922a6acd 100644 --- a/drivers/sbus/sbus.c +++ b/drivers/sbus/sbus.c | |||
@@ -51,38 +51,11 @@ static void __init fill_sbus_device_iommu(struct sbus_dev *sdev) | |||
51 | static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sdev) | 51 | static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sdev) |
52 | { | 52 | { |
53 | struct dev_archdata *sd; | 53 | struct dev_archdata *sd; |
54 | unsigned long base; | 54 | int err; |
55 | const void *pval; | ||
56 | int len, err; | ||
57 | 55 | ||
58 | sdev->prom_node = dp->node; | 56 | sdev->prom_node = dp->node; |
59 | strcpy(sdev->prom_name, dp->name); | 57 | strcpy(sdev->prom_name, dp->name); |
60 | 58 | ||
61 | pval = of_get_property(dp, "reg", &len); | ||
62 | sdev->num_registers = 0; | ||
63 | if (pval) { | ||
64 | memcpy(sdev->reg_addrs, pval, len); | ||
65 | |||
66 | sdev->num_registers = | ||
67 | len / sizeof(struct linux_prom_registers); | ||
68 | |||
69 | base = (unsigned long) sdev->reg_addrs[0].phys_addr; | ||
70 | |||
71 | /* Compute the slot number. */ | ||
72 | if (base >= SUN_SBUS_BVADDR && sparc_cpu_model == sun4m) | ||
73 | sdev->slot = sbus_dev_slot(base); | ||
74 | else | ||
75 | sdev->slot = sdev->reg_addrs[0].which_io; | ||
76 | } | ||
77 | |||
78 | pval = of_get_property(dp, "ranges", &len); | ||
79 | sdev->num_device_ranges = 0; | ||
80 | if (pval) { | ||
81 | memcpy(sdev->device_ranges, pval, len); | ||
82 | sdev->num_device_ranges = | ||
83 | len / sizeof(struct linux_prom_ranges); | ||
84 | } | ||
85 | |||
86 | sd = &sdev->ofdev.dev.archdata; | 59 | sd = &sdev->ofdev.dev.archdata; |
87 | sd->prom_node = dp; | 60 | sd->prom_node = dp; |
88 | sd->op = &sdev->ofdev; | 61 | sd->op = &sdev->ofdev; |
@@ -105,97 +78,6 @@ static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sde | |||
105 | fill_sbus_device_iommu(sdev); | 78 | fill_sbus_device_iommu(sdev); |
106 | } | 79 | } |
107 | 80 | ||
108 | static void __init sbus_bus_ranges_init(struct device_node *dp, struct sbus_bus *sbus) | ||
109 | { | ||
110 | const void *pval; | ||
111 | int len; | ||
112 | |||
113 | pval = of_get_property(dp, "ranges", &len); | ||
114 | sbus->num_sbus_ranges = 0; | ||
115 | if (pval) { | ||
116 | memcpy(sbus->sbus_ranges, pval, len); | ||
117 | sbus->num_sbus_ranges = | ||
118 | len / sizeof(struct linux_prom_ranges); | ||
119 | |||
120 | sbus_arch_bus_ranges_init(dp->parent, sbus); | ||
121 | } | ||
122 | } | ||
123 | |||
124 | static void __init __apply_ranges_to_regs(struct linux_prom_ranges *ranges, | ||
125 | int num_ranges, | ||
126 | struct linux_prom_registers *regs, | ||
127 | int num_regs) | ||
128 | { | ||
129 | if (num_ranges) { | ||
130 | int regnum; | ||
131 | |||
132 | for (regnum = 0; regnum < num_regs; regnum++) { | ||
133 | int rngnum; | ||
134 | |||
135 | for (rngnum = 0; rngnum < num_ranges; rngnum++) { | ||
136 | if (regs[regnum].which_io == ranges[rngnum].ot_child_space) | ||
137 | break; | ||
138 | } | ||
139 | if (rngnum == num_ranges) { | ||
140 | /* We used to flag this as an error. Actually | ||
141 | * some devices do not report the regs as we expect. | ||
142 | * For example, see SUNW,pln device. In that case | ||
143 | * the reg property is in a format internal to that | ||
144 | * node, ie. it is not in the SBUS register space | ||
145 | * per se. -DaveM | ||
146 | */ | ||
147 | return; | ||
148 | } | ||
149 | regs[regnum].which_io = ranges[rngnum].ot_parent_space; | ||
150 | regs[regnum].phys_addr -= ranges[rngnum].ot_child_base; | ||
151 | regs[regnum].phys_addr += ranges[rngnum].ot_parent_base; | ||
152 | } | ||
153 | } | ||
154 | } | ||
155 | |||
156 | static void __init __fixup_regs_sdev(struct sbus_dev *sdev) | ||
157 | { | ||
158 | if (sdev->num_registers != 0) { | ||
159 | struct sbus_dev *parent = sdev->parent; | ||
160 | int i; | ||
161 | |||
162 | while (parent != NULL) { | ||
163 | __apply_ranges_to_regs(parent->device_ranges, | ||
164 | parent->num_device_ranges, | ||
165 | sdev->reg_addrs, | ||
166 | sdev->num_registers); | ||
167 | |||
168 | parent = parent->parent; | ||
169 | } | ||
170 | |||
171 | __apply_ranges_to_regs(sdev->bus->sbus_ranges, | ||
172 | sdev->bus->num_sbus_ranges, | ||
173 | sdev->reg_addrs, | ||
174 | sdev->num_registers); | ||
175 | |||
176 | for (i = 0; i < sdev->num_registers; i++) { | ||
177 | struct resource *res = &sdev->resource[i]; | ||
178 | |||
179 | res->start = sdev->reg_addrs[i].phys_addr; | ||
180 | res->end = (res->start + | ||
181 | (unsigned long)sdev->reg_addrs[i].reg_size - 1UL); | ||
182 | res->flags = IORESOURCE_IO | | ||
183 | (sdev->reg_addrs[i].which_io & 0xff); | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | |||
188 | static void __init sbus_fixup_all_regs(struct sbus_dev *first_sdev) | ||
189 | { | ||
190 | struct sbus_dev *sdev; | ||
191 | |||
192 | for (sdev = first_sdev; sdev; sdev = sdev->next) { | ||
193 | if (sdev->child) | ||
194 | sbus_fixup_all_regs(sdev->child); | ||
195 | __fixup_regs_sdev(sdev); | ||
196 | } | ||
197 | } | ||
198 | |||
199 | /* We preserve the "probe order" of these bus and device lists to give | 81 | /* We preserve the "probe order" of these bus and device lists to give |
200 | * the same ordering as the old code. | 82 | * the same ordering as the old code. |
201 | */ | 83 | */ |
@@ -263,8 +145,6 @@ static void __init build_one_sbus(struct device_node *dp, int num_sbus) | |||
263 | 145 | ||
264 | strcpy(sbus->prom_name, dp->name); | 146 | strcpy(sbus->prom_name, dp->name); |
265 | 147 | ||
266 | sbus_bus_ranges_init(dp, sbus); | ||
267 | |||
268 | sbus->ofdev.node = dp; | 148 | sbus->ofdev.node = dp; |
269 | sbus->ofdev.dev.parent = NULL; | 149 | sbus->ofdev.dev.parent = NULL; |
270 | sbus->ofdev.dev.bus = &sbus_bus_type; | 150 | sbus->ofdev.dev.bus = &sbus_bus_type; |
@@ -295,8 +175,6 @@ static void __init build_one_sbus(struct device_node *dp, int num_sbus) | |||
295 | } | 175 | } |
296 | dev_dp = dev_dp->sibling; | 176 | dev_dp = dev_dp->sibling; |
297 | } | 177 | } |
298 | |||
299 | sbus_fixup_all_regs(sbus->devices); | ||
300 | } | 178 | } |
301 | 179 | ||
302 | static int __init sbus_init(void) | 180 | static int __init sbus_init(void) |