diff options
Diffstat (limited to 'arch/sparc64/kernel/sbus.c')
-rw-r--r-- | arch/sparc64/kernel/sbus.c | 67 |
1 files changed, 58 insertions, 9 deletions
diff --git a/arch/sparc64/kernel/sbus.c b/arch/sparc64/kernel/sbus.c index 8812417247d4..ac05e0f692ef 100644 --- a/arch/sparc64/kernel/sbus.c +++ b/arch/sparc64/kernel/sbus.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <asm/cache.h> | 19 | #include <asm/cache.h> |
20 | #include <asm/dma.h> | 20 | #include <asm/dma.h> |
21 | #include <asm/irq.h> | 21 | #include <asm/irq.h> |
22 | #include <asm/prom.h> | ||
22 | #include <asm/starfire.h> | 23 | #include <asm/starfire.h> |
23 | 24 | ||
24 | #include "iommu_common.h" | 25 | #include "iommu_common.h" |
@@ -1098,24 +1099,25 @@ static void __init sysio_register_error_handlers(struct sbus_bus *sbus) | |||
1098 | } | 1099 | } |
1099 | 1100 | ||
1100 | /* Boot time initialization. */ | 1101 | /* Boot time initialization. */ |
1101 | void __init sbus_iommu_init(int prom_node, struct sbus_bus *sbus) | 1102 | static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus) |
1102 | { | 1103 | { |
1103 | struct linux_prom64_registers rprop; | 1104 | struct linux_prom64_registers *pr; |
1105 | struct device_node *dp; | ||
1104 | struct sbus_iommu *iommu; | 1106 | struct sbus_iommu *iommu; |
1105 | unsigned long regs, tsb_base; | 1107 | unsigned long regs, tsb_base; |
1106 | u64 control; | 1108 | u64 control; |
1107 | int err, i; | 1109 | int i; |
1110 | |||
1111 | dp = of_find_node_by_phandle(__node); | ||
1108 | 1112 | ||
1109 | sbus->portid = prom_getintdefault(sbus->prom_node, | 1113 | sbus->portid = of_getintprop_default(dp, "upa-portid", -1); |
1110 | "upa-portid", -1); | ||
1111 | 1114 | ||
1112 | err = prom_getproperty(prom_node, "reg", | 1115 | pr = of_get_property(dp, "reg", NULL); |
1113 | (char *)&rprop, sizeof(rprop)); | 1116 | if (!pr) { |
1114 | if (err < 0) { | ||
1115 | prom_printf("sbus_iommu_init: Cannot map SYSIO control registers.\n"); | 1117 | prom_printf("sbus_iommu_init: Cannot map SYSIO control registers.\n"); |
1116 | prom_halt(); | 1118 | prom_halt(); |
1117 | } | 1119 | } |
1118 | regs = rprop.phys_addr; | 1120 | regs = pr->phys_addr; |
1119 | 1121 | ||
1120 | iommu = kmalloc(sizeof(*iommu) + SMP_CACHE_BYTES, GFP_ATOMIC); | 1122 | iommu = kmalloc(sizeof(*iommu) + SMP_CACHE_BYTES, GFP_ATOMIC); |
1121 | if (iommu == NULL) { | 1123 | if (iommu == NULL) { |
@@ -1225,3 +1227,50 @@ void __init sbus_iommu_init(int prom_node, struct sbus_bus *sbus) | |||
1225 | 1227 | ||
1226 | sysio_register_error_handlers(sbus); | 1228 | sysio_register_error_handlers(sbus); |
1227 | } | 1229 | } |
1230 | |||
1231 | void sbus_fill_device_irq(struct sbus_dev *sdev) | ||
1232 | { | ||
1233 | struct device_node *dp = of_find_node_by_phandle(sdev->prom_node); | ||
1234 | struct linux_prom_irqs *irqs; | ||
1235 | |||
1236 | irqs = of_get_property(dp, "interrupts", NULL); | ||
1237 | if (!irqs) { | ||
1238 | sdev->irqs[0] = 0; | ||
1239 | sdev->num_irqs = 0; | ||
1240 | } else { | ||
1241 | unsigned int pri = irqs[0].pri; | ||
1242 | |||
1243 | sdev->num_irqs = 1; | ||
1244 | if (pri < 0x20) | ||
1245 | pri += sdev->slot * 8; | ||
1246 | |||
1247 | sdev->irqs[0] = sbus_build_irq(sdev->bus, pri); | ||
1248 | } | ||
1249 | } | ||
1250 | |||
1251 | void __init sbus_arch_bus_ranges_init(struct device_node *pn, struct sbus_bus *sbus) | ||
1252 | { | ||
1253 | } | ||
1254 | |||
1255 | void __init sbus_setup_iommu(struct sbus_bus *sbus, struct device_node *dp) | ||
1256 | { | ||
1257 | sbus_iommu_init(dp->node, sbus); | ||
1258 | } | ||
1259 | |||
1260 | void __init sbus_setup_arch_props(struct sbus_bus *sbus, struct device_node *dp) | ||
1261 | { | ||
1262 | } | ||
1263 | |||
1264 | int __init sbus_arch_preinit(void) | ||
1265 | { | ||
1266 | return 0; | ||
1267 | } | ||
1268 | |||
1269 | void __init sbus_arch_postinit(void) | ||
1270 | { | ||
1271 | extern void firetruck_init(void); | ||
1272 | extern void clock_probe(void); | ||
1273 | |||
1274 | firetruck_init(); | ||
1275 | clock_probe(); | ||
1276 | } | ||