提交 18814ee8 编写于 作者: F Finn Thain 提交者: Geert Uytterhoeven

mac68k: start CUDA early

The valkyriefb driver needs the CUDA to work in order to set the video
mode at boot. So initialise the device earlier, and bring the m68k code
closer to the powermac code.
Signed-off-by: NFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: NGeert Uytterhoeven <geert@linux-m68k.org>
上级 11e8faca
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/vt_kern.h> #include <linux/vt_kern.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/adb.h>
#include <linux/cuda.h>
#define BOOTINFO_COMPAT_1_0 #define BOOTINFO_COMPAT_1_0
#include <asm/setup.h> #include <asm/setup.h>
...@@ -889,6 +891,10 @@ static void __init mac_identify(void) ...@@ -889,6 +891,10 @@ static void __init mac_identify(void)
oss_init(); oss_init();
psc_init(); psc_init();
baboon_init(); baboon_init();
#ifdef CONFIG_ADB_CUDA
find_via_cuda();
#endif
} }
static void __init mac_report_hardware(void) static void __init mac_report_hardware(void)
......
...@@ -317,9 +317,11 @@ static int __init adb_init(void) ...@@ -317,9 +317,11 @@ static int __init adb_init(void)
break; break;
} }
} }
if ((adb_controller == NULL) || adb_controller->init()) { if (adb_controller != NULL && adb_controller->init &&
printk(KERN_WARNING "Warning: no ADB interface detected\n"); adb_controller->init())
adb_controller = NULL; adb_controller = NULL;
if (adb_controller == NULL) {
printk(KERN_WARNING "Warning: no ADB interface detected\n");
} else { } else {
#ifdef CONFIG_PPC #ifdef CONFIG_PPC
if (of_machine_is_compatible("AAPL,PowerBook1998") || if (of_machine_is_compatible("AAPL,PowerBook1998") ||
......
...@@ -89,7 +89,6 @@ static int cuda_fully_inited; ...@@ -89,7 +89,6 @@ static int cuda_fully_inited;
#ifdef CONFIG_ADB #ifdef CONFIG_ADB
static int cuda_probe(void); static int cuda_probe(void);
static int cuda_init(void);
static int cuda_send_request(struct adb_request *req, int sync); static int cuda_send_request(struct adb_request *req, int sync);
static int cuda_adb_autopoll(int devs); static int cuda_adb_autopoll(int devs);
static int cuda_reset_adb_bus(void); static int cuda_reset_adb_bus(void);
...@@ -107,17 +106,42 @@ int cuda_request(struct adb_request *req, ...@@ -107,17 +106,42 @@ int cuda_request(struct adb_request *req,
#ifdef CONFIG_ADB #ifdef CONFIG_ADB
struct adb_driver via_cuda_driver = { struct adb_driver via_cuda_driver = {
"CUDA", .name = "CUDA",
cuda_probe, .probe = cuda_probe,
cuda_init, .send_request = cuda_send_request,
cuda_send_request, .autopoll = cuda_adb_autopoll,
cuda_adb_autopoll, .poll = cuda_poll,
cuda_poll, .reset_bus = cuda_reset_adb_bus,
cuda_reset_adb_bus
}; };
#endif /* CONFIG_ADB */ #endif /* CONFIG_ADB */
#ifdef CONFIG_PPC #ifdef CONFIG_MAC
int __init find_via_cuda(void)
{
struct adb_request req;
int err;
if (macintosh_config->adb_type != MAC_ADB_CUDA)
return 0;
via = via1;
cuda_state = idle;
err = cuda_init_via();
if (err) {
printk(KERN_ERR "cuda_init_via() failed\n");
via = NULL;
return 0;
}
/* enable autopoll */
cuda_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1);
while (!req.complete)
cuda_poll();
return 1;
}
#else
int __init find_via_cuda(void) int __init find_via_cuda(void)
{ {
struct adb_request req; struct adb_request req;
...@@ -175,7 +199,7 @@ int __init find_via_cuda(void) ...@@ -175,7 +199,7 @@ int __init find_via_cuda(void)
vias = NULL; vias = NULL;
return 0; return 0;
} }
#endif /* CONFIG_PPC */ #endif /* !defined CONFIG_MAC */
static int __init via_cuda_start(void) static int __init via_cuda_start(void)
{ {
...@@ -184,14 +208,14 @@ static int __init via_cuda_start(void) ...@@ -184,14 +208,14 @@ static int __init via_cuda_start(void)
#ifdef CONFIG_MAC #ifdef CONFIG_MAC
cuda_irq = IRQ_MAC_ADB; cuda_irq = IRQ_MAC_ADB;
#else /* CONFIG_MAC */ #else
cuda_irq = irq_of_parse_and_map(vias, 0); cuda_irq = irq_of_parse_and_map(vias, 0);
if (cuda_irq == NO_IRQ) { if (cuda_irq == NO_IRQ) {
printk(KERN_ERR "via-cuda: can't map interrupts for %s\n", printk(KERN_ERR "via-cuda: can't map interrupts for %s\n",
vias->full_name); vias->full_name);
return -ENODEV; return -ENODEV;
} }
#endif /* CONFIG_MAC */ #endif
if (request_irq(cuda_irq, cuda_interrupt, 0, "ADB", cuda_interrupt)) { if (request_irq(cuda_irq, cuda_interrupt, 0, "ADB", cuda_interrupt)) {
printk(KERN_ERR "via-cuda: can't request irq %d\n", cuda_irq); printk(KERN_ERR "via-cuda: can't request irq %d\n", cuda_irq);
...@@ -216,28 +240,10 @@ cuda_probe(void) ...@@ -216,28 +240,10 @@ cuda_probe(void)
#else #else
if (macintosh_config->adb_type != MAC_ADB_CUDA) if (macintosh_config->adb_type != MAC_ADB_CUDA)
return -ENODEV; return -ENODEV;
via = via1;
#endif #endif
return 0;
}
static int __init
cuda_init(void)
{
#ifdef CONFIG_PPC
if (via == NULL) if (via == NULL)
return -ENODEV; return -ENODEV;
return 0; return 0;
#else
int err = cuda_init_via();
if (err) {
printk(KERN_ERR "cuda_init_via() failed\n");
return -ENODEV;
}
out_8(&via[IER], IER_SET|SR_INT); /* enable interrupt from SR */
return via_cuda_start();
#endif
} }
#endif /* CONFIG_ADB */ #endif /* CONFIG_ADB */
...@@ -430,8 +436,10 @@ cuda_poll(void) ...@@ -430,8 +436,10 @@ cuda_poll(void)
/* cuda_interrupt only takes a normal lock, we disable /* cuda_interrupt only takes a normal lock, we disable
* interrupts here to avoid re-entering and thus deadlocking. * interrupts here to avoid re-entering and thus deadlocking.
*/ */
if (cuda_irq)
disable_irq(cuda_irq); disable_irq(cuda_irq);
cuda_interrupt(0, NULL); cuda_interrupt(0, NULL);
if (cuda_irq)
enable_irq(cuda_irq); enable_irq(cuda_irq);
} }
...@@ -446,7 +454,7 @@ cuda_interrupt(int irq, void *arg) ...@@ -446,7 +454,7 @@ cuda_interrupt(int irq, void *arg)
spin_lock(&cuda_lock); spin_lock(&cuda_lock);
/* On powermacs, this handler is registered for the VIA IRQ. But it uses /* On powermacs, this handler is registered for the VIA IRQ. But they use
* just the shift register IRQ -- other VIA interrupt sources are disabled. * just the shift register IRQ -- other VIA interrupt sources are disabled.
* On m68k macs, the VIA IRQ sources are dispatched individually. Unless * On m68k macs, the VIA IRQ sources are dispatched individually. Unless
* we are polling, the shift register IRQ flag has already been cleared. * we are polling, the shift register IRQ flag has already been cleared.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册