diff options
Diffstat (limited to 'drivers/macintosh/via-cuda.c')
-rw-r--r-- | drivers/macintosh/via-cuda.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c index d843a6c9c6df..18ff770ea668 100644 --- a/drivers/macintosh/via-cuda.c +++ b/drivers/macintosh/via-cuda.c | |||
@@ -127,39 +127,34 @@ struct adb_driver via_cuda_driver = { | |||
127 | #endif /* CONFIG_ADB */ | 127 | #endif /* CONFIG_ADB */ |
128 | 128 | ||
129 | #ifdef CONFIG_PPC | 129 | #ifdef CONFIG_PPC |
130 | int __init | 130 | int __init find_via_cuda(void) |
131 | find_via_cuda(void) | ||
132 | { | 131 | { |
133 | int err; | ||
134 | struct adb_request req; | 132 | struct adb_request req; |
133 | phys_addr_t taddr; | ||
134 | u32 *reg; | ||
135 | int err; | ||
135 | 136 | ||
136 | if (vias != 0) | 137 | if (vias != 0) |
137 | return 1; | 138 | return 1; |
138 | vias = find_devices("via-cuda"); | 139 | vias = of_find_node_by_name(NULL, "via-cuda"); |
139 | if (vias == 0) | 140 | if (vias == 0) |
140 | return 0; | 141 | return 0; |
141 | if (vias->next != 0) | ||
142 | printk(KERN_WARNING "Warning: only using 1st via-cuda\n"); | ||
143 | |||
144 | #if 0 | ||
145 | { int i; | ||
146 | |||
147 | printk("find_via_cuda: node = %p, addrs =", vias->node); | ||
148 | for (i = 0; i < vias->n_addrs; ++i) | ||
149 | printk(" %x(%x)", vias->addrs[i].address, vias->addrs[i].size); | ||
150 | printk(", intrs ="); | ||
151 | for (i = 0; i < vias->n_intrs; ++i) | ||
152 | printk(" %x", vias->intrs[i].line); | ||
153 | printk("\n"); } | ||
154 | #endif | ||
155 | 142 | ||
156 | if (vias->n_addrs != 1 || vias->n_intrs != 1) { | 143 | reg = (u32 *)get_property(vias, "reg", NULL); |
157 | printk(KERN_ERR "via-cuda: expecting 1 address (%d) and 1 interrupt (%d)\n", | 144 | if (reg == NULL) { |
158 | vias->n_addrs, vias->n_intrs); | 145 | printk(KERN_ERR "via-cuda: No \"reg\" property !\n"); |
159 | if (vias->n_addrs < 1 || vias->n_intrs < 1) | 146 | goto fail; |
160 | return 0; | 147 | } |
148 | taddr = of_translate_address(vias, reg); | ||
149 | if (taddr == 0) { | ||
150 | printk(KERN_ERR "via-cuda: Can't translate address !\n"); | ||
151 | goto fail; | ||
152 | } | ||
153 | via = ioremap(taddr, 0x2000); | ||
154 | if (via == NULL) { | ||
155 | printk(KERN_ERR "via-cuda: Can't map address !\n"); | ||
156 | goto fail; | ||
161 | } | 157 | } |
162 | via = ioremap(vias->addrs->address, 0x2000); | ||
163 | 158 | ||
164 | cuda_state = idle; | 159 | cuda_state = idle; |
165 | sys_ctrler = SYS_CTRLER_CUDA; | 160 | sys_ctrler = SYS_CTRLER_CUDA; |
@@ -185,6 +180,11 @@ find_via_cuda(void) | |||
185 | cuda_poll(); | 180 | cuda_poll(); |
186 | 181 | ||
187 | return 1; | 182 | return 1; |
183 | |||
184 | fail: | ||
185 | of_node_put(vias); | ||
186 | vias = NULL; | ||
187 | return 0; | ||
188 | } | 188 | } |
189 | #endif /* CONFIG_PPC */ | 189 | #endif /* CONFIG_PPC */ |
190 | 190 | ||