aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sbus
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-08-27 07:54:04 -0400
committerDavid S. Miller <davem@davemloft.net>2008-08-29 05:15:21 -0400
commit046e26a8ba10b8ceff822f8d91451ab6c1e08c4e (patch)
tree92e95380c0f7f6c5257023a59b88d4221d3f9744 /drivers/sbus
parent5059625ed8862e897760b86effff0f8a35989c0d (diff)
sparc: Remove generic SBUS probing layer.
The individual SBUS IOMMU arch code now sets the IOMMU information directly into the OF device objects. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/sbus')
-rw-r--r--drivers/sbus/Makefile4
-rw-r--r--drivers/sbus/sbus.c170
2 files changed, 0 insertions, 174 deletions
diff --git a/drivers/sbus/Makefile b/drivers/sbus/Makefile
index 56f73318eba2..e94dc25805f9 100644
--- a/drivers/sbus/Makefile
+++ b/drivers/sbus/Makefile
@@ -2,8 +2,4 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5ifneq ($(ARCH),m68k)
6obj-y := sbus.o
7endif
8
9obj-$(CONFIG_SBUSCHAR) += char/ 5obj-$(CONFIG_SBUSCHAR) += char/
diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c
deleted file mode 100644
index 399567b7e15e..000000000000
--- a/drivers/sbus/sbus.c
+++ /dev/null
@@ -1,170 +0,0 @@
1/* sbus.c: SBus support routines.
2 *
3 * Copyright (C) 1995, 2006 David S. Miller (davem@davemloft.net)
4 */
5
6#include <linux/kernel.h>
7#include <linux/slab.h>
8#include <linux/init.h>
9#include <linux/device.h>
10#include <linux/of_device.h>
11
12#include <asm/system.h>
13#include <asm/sbus.h>
14#include <asm/dma.h>
15#include <asm/oplib.h>
16#include <asm/prom.h>
17#include <asm/irq.h>
18
19static ssize_t
20show_sbusobppath_attr(struct device * dev, struct device_attribute * attr, char * buf)
21{
22 struct sbus_dev *sbus;
23
24 sbus = to_sbus_device(dev);
25
26 return snprintf (buf, PAGE_SIZE, "%s\n", sbus->ofdev.node->full_name);
27}
28
29static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_sbusobppath_attr, NULL);
30
31static void __init fill_sbus_device_iommu(struct sbus_dev *sdev)
32{
33 struct of_device *op = of_find_device_by_node(sdev->ofdev.node);
34 struct dev_archdata *sd, *bus_sd;
35 struct sbus_bus *sbus;
36
37 sbus = sdev->bus;
38 bus_sd = &sbus->ofdev.dev.archdata;
39
40 sd = &sdev->ofdev.dev.archdata;
41 sd->iommu = bus_sd->iommu;
42 sd->stc = bus_sd->stc;
43
44 sd = &op->dev.archdata;
45 sd->iommu = bus_sd->iommu;
46 sd->stc = bus_sd->stc;
47}
48
49static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sdev)
50{
51 struct dev_archdata *sd;
52 int err;
53
54 sd = &sdev->ofdev.dev.archdata;
55 sd->prom_node = dp;
56 sd->op = &sdev->ofdev;
57
58 sdev->ofdev.node = dp;
59 if (sdev->parent)
60 sdev->ofdev.dev.parent = &sdev->parent->ofdev.dev;
61 else
62 sdev->ofdev.dev.parent = &sdev->bus->ofdev.dev;
63 sdev->ofdev.dev.bus = &sbus_bus_type;
64 dev_set_name(&sdev->ofdev.dev, "sbus[%08x]", dp->node);
65
66 if (of_device_register(&sdev->ofdev) != 0)
67 printk(KERN_DEBUG "sbus: device registration error for %s!\n",
68 dp->path_component_name);
69
70 /* WE HAVE BEEN INVADED BY ALIENS! */
71 err = sysfs_create_file(&sdev->ofdev.dev.kobj, &dev_attr_obppath.attr);
72
73 fill_sbus_device_iommu(sdev);
74}
75
76static void __init sdev_insert(struct sbus_dev *sdev, struct sbus_dev **root)
77{
78 while (*root)
79 root = &(*root)->next;
80 *root = sdev;
81 sdev->next = NULL;
82}
83
84static void __init walk_children(struct device_node *dp, struct sbus_dev *parent, struct sbus_bus *sbus)
85{
86 dp = dp->child;
87 while (dp) {
88 struct sbus_dev *sdev;
89
90 sdev = kzalloc(sizeof(struct sbus_dev), GFP_ATOMIC);
91 if (sdev) {
92 sdev_insert(sdev, &parent->child);
93
94 sdev->bus = sbus;
95 sdev->parent = parent;
96
97 fill_sbus_device(dp, sdev);
98
99 walk_children(dp, sdev, sbus);
100 }
101 dp = dp->sibling;
102 }
103}
104
105static void __init build_one_sbus(struct device_node *dp, int num_sbus)
106{
107 struct device_node *dev_dp;
108 struct sbus_bus *sbus;
109
110 sbus = kzalloc(sizeof(struct sbus_bus), GFP_ATOMIC);
111 if (!sbus)
112 return;
113
114 sbus_setup_iommu(sbus, dp);
115
116 printk("sbus%d: ", num_sbus);
117
118 sbus->ofdev.node = dp;
119 sbus->ofdev.dev.parent = NULL;
120 sbus->ofdev.dev.bus = &sbus_bus_type;
121 dev_set_name(&sbus->ofdev.dev, "sbus%d", num_sbus);
122
123 if (of_device_register(&sbus->ofdev) != 0)
124 printk(KERN_DEBUG "sbus: device registration error for %s!\n",
125 dev_name(&sbus->ofdev.dev));
126
127 dev_dp = dp->child;
128 while (dev_dp) {
129 struct sbus_dev *sdev;
130
131 sdev = kzalloc(sizeof(struct sbus_dev), GFP_ATOMIC);
132 if (sdev) {
133 sdev_insert(sdev, &sbus->devices);
134
135 sdev->bus = sbus;
136 sdev->parent = NULL;
137 sdev->ofdev.dev.archdata.iommu =
138 sbus->ofdev.dev.archdata.iommu;
139 sdev->ofdev.dev.archdata.stc =
140 sbus->ofdev.dev.archdata.stc;
141
142 fill_sbus_device(dev_dp, sdev);
143
144 walk_children(dev_dp, sdev, sbus);
145 }
146 dev_dp = dev_dp->sibling;
147 }
148}
149
150static int __init sbus_init(void)
151{
152 struct device_node *dp;
153 const char *sbus_name = "sbus";
154 int num_sbus = 0;
155
156 if (sparc_cpu_model == sun4d)
157 sbus_name = "sbi";
158
159 for_each_node_by_name(dp, sbus_name) {
160 build_one_sbus(dp, num_sbus);
161 num_sbus++;
162
163 }
164
165 sbus_arch_postinit();
166
167 return 0;
168}
169
170subsys_initcall(sbus_init);