via-cuda.c (3d5271f9883cba7b54762bc4fe027d4172f06db7) via-cuda.c (51d3082fe6e55aecfa17113dbe98077c749f724c)
1/*
2 * Device driver for the via-cuda on Apple Powermacs.
3 *
4 * The VIA (versatile interface adapter) interfaces to the CUDA,
5 * a 6805 microprocessor core which controls the ADB (Apple Desktop
6 * Bus) which connects to the keyboard and mouse. The CUDA also
7 * controls system power and the RTC (real time clock) chip.
8 *

--- 113 unchanged lines hidden (view full) ---

122 cuda_send_request,
123 cuda_adb_autopoll,
124 cuda_poll,
125 cuda_reset_adb_bus
126};
127#endif /* CONFIG_ADB */
128
129#ifdef CONFIG_PPC
1/*
2 * Device driver for the via-cuda on Apple Powermacs.
3 *
4 * The VIA (versatile interface adapter) interfaces to the CUDA,
5 * a 6805 microprocessor core which controls the ADB (Apple Desktop
6 * Bus) which connects to the keyboard and mouse. The CUDA also
7 * controls system power and the RTC (real time clock) chip.
8 *

--- 113 unchanged lines hidden (view full) ---

122 cuda_send_request,
123 cuda_adb_autopoll,
124 cuda_poll,
125 cuda_reset_adb_bus
126};
127#endif /* CONFIG_ADB */
128
129#ifdef CONFIG_PPC
130int __init
131find_via_cuda(void)
130int __init 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 if (vias != 0)
137 return 1;
136
137 if (vias != 0)
138 return 1;
138 vias = find_devices("via-cuda");
139 vias = of_find_node_by_name(NULL, "via-cuda");
139 if (vias == 0)
140 return 0;
140 if (vias == 0)
141 return 0;
141 if (vias->next != 0)
142 printk(KERN_WARNING "Warning: only using 1st via-cuda\n");
143
142
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
156 if (vias->n_addrs != 1 || vias->n_intrs != 1) {
157 printk(KERN_ERR "via-cuda: expecting 1 address (%d) and 1 interrupt (%d)\n",
158 vias->n_addrs, vias->n_intrs);
159 if (vias->n_addrs < 1 || vias->n_intrs < 1)
160 return 0;
143 reg = (u32 *)get_property(vias, "reg", NULL);
144 if (reg == NULL) {
145 printk(KERN_ERR "via-cuda: No \"reg\" property !\n");
146 goto fail;
161 }
147 }
162 via = ioremap(vias->addrs->address, 0x2000);
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;
157 }
163
164 cuda_state = idle;
165 sys_ctrler = SYS_CTRLER_CUDA;
166
167 err = cuda_init_via();
168 if (err) {
169 printk(KERN_ERR "cuda_init_via() failed\n");
170 via = NULL;

--- 9 unchanged lines hidden (view full) ---

180#endif
181
182 /* enable autopoll */
183 cuda_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1);
184 while (!req.complete)
185 cuda_poll();
186
187 return 1;
158
159 cuda_state = idle;
160 sys_ctrler = SYS_CTRLER_CUDA;
161
162 err = cuda_init_via();
163 if (err) {
164 printk(KERN_ERR "cuda_init_via() failed\n");
165 via = NULL;

--- 9 unchanged lines hidden (view full) ---

175#endif
176
177 /* enable autopoll */
178 cuda_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1);
179 while (!req.complete)
180 cuda_poll();
181
182 return 1;
183
184 fail:
185 of_node_put(vias);
186 vias = NULL;
187 return 0;
188}
189#endif /* CONFIG_PPC */
190
191static int __init via_cuda_start(void)
192{
193 if (via == NULL)
194 return -ENODEV;
195

--- 432 unchanged lines hidden ---
188}
189#endif /* CONFIG_PPC */
190
191static int __init via_cuda_start(void)
192{
193 if (via == NULL)
194 return -ENODEV;
195

--- 432 unchanged lines hidden ---