* [PATCH 10/13] mac68k: start CUDA early
@ 2009-11-03 13:46 Finn Thain
2009-11-17 2:03 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 4+ messages in thread
From: Finn Thain @ 2009-11-03 13:46 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linuxppc-dev, linux-m68k
The valkyriefb driver needs the CUDA to work in order to set the video
mode at boot. Initialising the device earlier, and bring the m68k code
closer to the powermac code.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
arch/m68k/mac/config.c | 6 ++++
drivers/macintosh/via-cuda.c | 57 +++++++++++++++++++++++++++----------------
2 files changed, 43 insertions(+), 20 deletions(-)
Index: linux-2.6.31/arch/m68k/mac/config.c
===================================================================
--- linux-2.6.31.orig/arch/m68k/mac/config.c 2009-11-03 03:23:42.000000000 +1100
+++ linux-2.6.31/arch/m68k/mac/config.c 2009-11-03 03:23:43.000000000 +1100
@@ -23,6 +23,8 @@
#include <linux/init.h>
#include <linux/vt_kern.h>
#include <linux/platform_device.h>
+#include <linux/adb.h>
+#include <linux/cuda.h>
#define BOOTINFO_COMPAT_1_0
#include <asm/setup.h>
@@ -889,6 +891,10 @@ static void __init mac_identify(void)
oss_init();
psc_init();
baboon_init();
+
+#ifdef CONFIG_ADB_CUDA
+ find_via_cuda();
+#endif
}
static void __init mac_report_hardware(void)
Index: linux-2.6.31/drivers/macintosh/via-cuda.c
===================================================================
--- linux-2.6.31.orig/drivers/macintosh/via-cuda.c 2009-11-03 03:23:24.000000000 +1100
+++ linux-2.6.31/drivers/macintosh/via-cuda.c 2009-11-03 03:23:43.000000000 +1100
@@ -117,7 +117,33 @@ struct adb_driver via_cuda_driver = {
};
#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)
{
struct adb_request req;
@@ -175,7 +201,7 @@ int __init find_via_cuda(void)
vias = NULL;
return 0;
}
-#endif /* CONFIG_PPC */
+#endif /* !defined CONFIG_MAC */
static int __init via_cuda_start(void)
{
@@ -184,14 +210,14 @@ static int __init via_cuda_start(void)
#ifdef CONFIG_MAC
cuda_irq = IRQ_MAC_ADB;
-#else /* CONFIG_MAC */
+#else
cuda_irq = irq_of_parse_and_map(vias, 0);
if (cuda_irq == NO_IRQ) {
printk(KERN_ERR "via-cuda: can't map interrupts for %s\n",
vias->full_name);
return -ENODEV;
}
-#endif /* CONFIG_MAC */
+#endif
if (request_irq(cuda_irq, cuda_interrupt, 0, "ADB", cuda_interrupt)) {
printk(KERN_ERR "via-cuda: can't request irq %d\n", cuda_irq);
@@ -216,7 +242,6 @@ cuda_probe(void)
#else
if (macintosh_config->adb_type != MAC_ADB_CUDA)
return -ENODEV;
- via = via1;
#endif
return 0;
}
@@ -224,20 +249,9 @@ cuda_probe(void)
static int __init
cuda_init(void)
{
-#ifdef CONFIG_PPC
if (via == NULL)
return -ENODEV;
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 */
@@ -430,9 +444,12 @@ cuda_poll(void)
/* cuda_interrupt only takes a normal lock, we disable
* interrupts here to avoid re-entering and thus deadlocking.
*/
- disable_irq(cuda_irq);
- cuda_interrupt(0, NULL);
- enable_irq(cuda_irq);
+ if (cuda_fully_inited) {
+ disable_irq(cuda_irq);
+ cuda_interrupt(0, NULL);
+ enable_irq(cuda_irq);
+ } else
+ cuda_interrupt(0, NULL);
}
static irqreturn_t
@@ -446,7 +463,7 @@ cuda_interrupt(int irq, void *arg)
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.
* On m68k macs, the VIA IRQ sources are dispatched individually. Unless
* we are polling, the shift register IRQ flag has already been cleared.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 10/13] mac68k: start CUDA early
2009-11-03 13:46 [PATCH 10/13] mac68k: start CUDA early Finn Thain
@ 2009-11-17 2:03 ` Benjamin Herrenschmidt
2009-11-17 9:03 ` [PATCH 10/13] mac68k: start CUDA early, take 2 Finn Thain
0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-17 2:03 UTC (permalink / raw)
To: Finn Thain; +Cc: linuxppc-dev, linux-m68k, Geert Uytterhoeven
On Wed, 2009-11-04 at 00:46 +1100, Finn Thain wrote:
> The valkyriefb driver needs the CUDA to work in order to set the video
> mode at boot. Initialising the device earlier, and bring the m68k code
> closer to the powermac code.
>
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Hi Finn !
> @@ -224,20 +249,9 @@ cuda_probe(void)
> static int __init
> cuda_init(void)
> {
> -#ifdef CONFIG_PPC
> if (via == NULL)
> return -ENODEV;
> 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 */
Can't we just get rid of cuda_init() completely ?
> @@ -430,9 +444,12 @@ cuda_poll(void)
> /* cuda_interrupt only takes a normal lock, we disable
> * interrupts here to avoid re-entering and thus deadlocking.
> */
> - disable_irq(cuda_irq);
> - cuda_interrupt(0, NULL);
> - enable_irq(cuda_irq);
> + if (cuda_fully_inited) {
> + disable_irq(cuda_irq);
> + cuda_interrupt(0, NULL);
> + enable_irq(cuda_irq);
> + } else
> + cuda_interrupt(0, NULL);
> }
Wouldn't it be better that way ?
if (cuda_irq)
disable_irq(cuda_irq);
cuda_interrupt(0, NULL);
if (cuda_irq)
enable_irq(cuda_irq);
Cheers,
Ben.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 10/13] mac68k: start CUDA early, take 2
2009-11-17 2:03 ` Benjamin Herrenschmidt
@ 2009-11-17 9:03 ` Finn Thain
2009-12-23 20:15 ` Geert Uytterhoeven
0 siblings, 1 reply; 4+ messages in thread
From: Finn Thain @ 2009-11-17 9:03 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, linuxppc-dev
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.
Take 2 was changed as per Benjamin Herrenschmidt's review.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
arch/m68k/mac/config.c | 6 +++
drivers/macintosh/adb.c | 6 ++-
drivers/macintosh/via-cuda.c | 74 +++++++++++++++++++++++--------------------
3 files changed, 51 insertions(+), 35 deletions(-)
Index: linux-2.6.31/arch/m68k/mac/config.c
===================================================================
--- linux-2.6.31.orig/arch/m68k/mac/config.c 2009-11-17 17:11:47.000000000 +1100
+++ linux-2.6.31/arch/m68k/mac/config.c 2009-11-17 17:11:47.000000000 +1100
@@ -23,6 +23,8 @@
#include <linux/init.h>
#include <linux/vt_kern.h>
#include <linux/platform_device.h>
+#include <linux/adb.h>
+#include <linux/cuda.h>
#define BOOTINFO_COMPAT_1_0
#include <asm/setup.h>
@@ -889,6 +891,10 @@ static void __init mac_identify(void)
oss_init();
psc_init();
baboon_init();
+
+#ifdef CONFIG_ADB_CUDA
+ find_via_cuda();
+#endif
}
static void __init mac_report_hardware(void)
Index: linux-2.6.31/drivers/macintosh/via-cuda.c
===================================================================
--- linux-2.6.31.orig/drivers/macintosh/via-cuda.c 2009-11-17 17:07:58.000000000 +1100
+++ linux-2.6.31/drivers/macintosh/via-cuda.c 2009-11-17 17:11:47.000000000 +1100
@@ -89,7 +89,6 @@ static int cuda_fully_inited;
#ifdef CONFIG_ADB
static int cuda_probe(void);
-static int cuda_init(void);
static int cuda_send_request(struct adb_request *req, int sync);
static int cuda_adb_autopoll(int devs);
static int cuda_reset_adb_bus(void);
@@ -107,17 +106,42 @@ int cuda_request(struct adb_request *req
#ifdef CONFIG_ADB
struct adb_driver via_cuda_driver = {
- "CUDA",
- cuda_probe,
- cuda_init,
- cuda_send_request,
- cuda_adb_autopoll,
- cuda_poll,
- cuda_reset_adb_bus
+ .name = "CUDA",
+ .probe = cuda_probe,
+ .send_request = cuda_send_request,
+ .autopoll = cuda_adb_autopoll,
+ .poll = cuda_poll,
+ .reset_bus = cuda_reset_adb_bus,
};
#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)
{
struct adb_request req;
@@ -175,7 +199,7 @@ int __init find_via_cuda(void)
vias = NULL;
return 0;
}
-#endif /* CONFIG_PPC */
+#endif /* !defined CONFIG_MAC */
static int __init via_cuda_start(void)
{
@@ -184,14 +208,14 @@ static int __init via_cuda_start(void)
#ifdef CONFIG_MAC
cuda_irq = IRQ_MAC_ADB;
-#else /* CONFIG_MAC */
+#else
cuda_irq = irq_of_parse_and_map(vias, 0);
if (cuda_irq == NO_IRQ) {
printk(KERN_ERR "via-cuda: can't map interrupts for %s\n",
vias->full_name);
return -ENODEV;
}
-#endif /* CONFIG_MAC */
+#endif
if (request_irq(cuda_irq, cuda_interrupt, 0, "ADB", cuda_interrupt)) {
printk(KERN_ERR "via-cuda: can't request irq %d\n", cuda_irq);
@@ -216,28 +240,10 @@ cuda_probe(void)
#else
if (macintosh_config->adb_type != MAC_ADB_CUDA)
return -ENODEV;
- via = via1;
#endif
- return 0;
-}
-
-static int __init
-cuda_init(void)
-{
-#ifdef CONFIG_PPC
if (via == NULL)
return -ENODEV;
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 */
@@ -430,9 +436,11 @@ cuda_poll(void)
/* cuda_interrupt only takes a normal lock, we disable
* interrupts here to avoid re-entering and thus deadlocking.
*/
- disable_irq(cuda_irq);
+ if (cuda_irq)
+ disable_irq(cuda_irq);
cuda_interrupt(0, NULL);
- enable_irq(cuda_irq);
+ if (cuda_irq)
+ enable_irq(cuda_irq);
}
static irqreturn_t
@@ -446,7 +454,7 @@ cuda_interrupt(int irq, void *arg)
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.
* On m68k macs, the VIA IRQ sources are dispatched individually. Unless
* we are polling, the shift register IRQ flag has already been cleared.
Index: linux-2.6.31/drivers/macintosh/adb.c
===================================================================
--- linux-2.6.31.orig/drivers/macintosh/adb.c 2009-11-17 17:07:58.000000000 +1100
+++ linux-2.6.31/drivers/macintosh/adb.c 2009-11-17 17:11:47.000000000 +1100
@@ -317,9 +317,11 @@ static int __init adb_init(void)
break;
}
}
- if ((adb_controller == NULL) || adb_controller->init()) {
- printk(KERN_WARNING "Warning: no ADB interface detected\n");
+ if (adb_controller != NULL && adb_controller->init &&
+ adb_controller->init())
adb_controller = NULL;
+ if (adb_controller == NULL) {
+ printk(KERN_WARNING "Warning: no ADB interface detected\n");
} else {
#ifdef CONFIG_PPC
if (machine_is_compatible("AAPL,PowerBook1998") ||
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 10/13] mac68k: start CUDA early, take 2
2009-11-17 9:03 ` [PATCH 10/13] mac68k: start CUDA early, take 2 Finn Thain
@ 2009-12-23 20:15 ` Geert Uytterhoeven
0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2009-12-23 20:15 UTC (permalink / raw)
To: Finn Thain; +Cc: linux-m68k, linuxppc-dev
On Tue, Nov 17, 2009 at 10:03, Finn Thain <fthain@telegraphics.com.au> wrot=
e:
> 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.
>
> Take 2 was changed as per Benjamin Herrenschmidt's review.
Ben, OK for you?
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
>
> ---
> =C2=A0arch/m68k/mac/config.c =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A06 +++
> =C2=A0drivers/macintosh/adb.c =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A06 ++-
> =C2=A0drivers/macintosh/via-cuda.c | =C2=A0 74 +++++++++++++++++++++++---=
-----------------
> =C2=A03 files changed, 51 insertions(+), 35 deletions(-)
>
> Index: linux-2.6.31/arch/m68k/mac/config.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/arch/m68k/mac/config.c =C2=A0 =C2=A02009-11-17 17:1=
1:47.000000000 +1100
> +++ linux-2.6.31/arch/m68k/mac/config.c 2009-11-17 17:11:47.000000000 +11=
00
> @@ -23,6 +23,8 @@
> =C2=A0#include <linux/init.h>
> =C2=A0#include <linux/vt_kern.h>
> =C2=A0#include <linux/platform_device.h>
> +#include <linux/adb.h>
> +#include <linux/cuda.h>
>
> =C2=A0#define BOOTINFO_COMPAT_1_0
> =C2=A0#include <asm/setup.h>
> @@ -889,6 +891,10 @@ static void __init mac_identify(void)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0oss_init();
> =C2=A0 =C2=A0 =C2=A0 =C2=A0psc_init();
> =C2=A0 =C2=A0 =C2=A0 =C2=A0baboon_init();
> +
> +#ifdef CONFIG_ADB_CUDA
> + =C2=A0 =C2=A0 =C2=A0 find_via_cuda();
> +#endif
> =C2=A0}
>
> =C2=A0static void __init mac_report_hardware(void)
> Index: linux-2.6.31/drivers/macintosh/via-cuda.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/drivers/macintosh/via-cuda.c =C2=A0 =C2=A0 =C2=A020=
09-11-17 17:07:58.000000000 +1100
> +++ linux-2.6.31/drivers/macintosh/via-cuda.c =C2=A0 2009-11-17 17:11:47.=
000000000 +1100
> @@ -89,7 +89,6 @@ static int cuda_fully_inited;
>
> =C2=A0#ifdef CONFIG_ADB
> =C2=A0static int cuda_probe(void);
> -static int cuda_init(void);
> =C2=A0static int cuda_send_request(struct adb_request *req, int sync);
> =C2=A0static int cuda_adb_autopoll(int devs);
> =C2=A0static int cuda_reset_adb_bus(void);
> @@ -107,17 +106,42 @@ int cuda_request(struct adb_request *req
>
> =C2=A0#ifdef CONFIG_ADB
> =C2=A0struct adb_driver via_cuda_driver =3D {
> - =C2=A0 =C2=A0 =C2=A0 "CUDA",
> - =C2=A0 =C2=A0 =C2=A0 cuda_probe,
> - =C2=A0 =C2=A0 =C2=A0 cuda_init,
> - =C2=A0 =C2=A0 =C2=A0 cuda_send_request,
> - =C2=A0 =C2=A0 =C2=A0 cuda_adb_autopoll,
> - =C2=A0 =C2=A0 =C2=A0 cuda_poll,
> - =C2=A0 =C2=A0 =C2=A0 cuda_reset_adb_bus
> + =C2=A0 =C2=A0 =C2=A0 .name =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D "CUDA",
> + =C2=A0 =C2=A0 =C2=A0 .probe =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D cuda_probe,
> + =C2=A0 =C2=A0 =C2=A0 .send_request =3D cuda_send_request,
> + =C2=A0 =C2=A0 =C2=A0 .autopoll =C2=A0 =C2=A0 =3D cuda_adb_autopoll,
> + =C2=A0 =C2=A0 =C2=A0 .poll =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D cuda_poll,
> + =C2=A0 =C2=A0 =C2=A0 .reset_bus =C2=A0 =C2=A0=3D cuda_reset_adb_bus,
> =C2=A0};
> =C2=A0#endif /* CONFIG_ADB */
>
> -#ifdef CONFIG_PPC
> +#ifdef CONFIG_MAC
> +int __init find_via_cuda(void)
> +{
> + =C2=A0 =C2=A0struct adb_request req;
> + =C2=A0 =C2=A0int err;
> +
> + =C2=A0 =C2=A0if (macintosh_config->adb_type !=3D MAC_ADB_CUDA)
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +
> + =C2=A0 =C2=A0via =3D via1;
> + =C2=A0 =C2=A0cuda_state =3D idle;
> +
> + =C2=A0 =C2=A0err =3D cuda_init_via();
> + =C2=A0 =C2=A0if (err) {
> + =C2=A0 =C2=A0 =C2=A0 printk(KERN_ERR "cuda_init_via() failed\n");
> + =C2=A0 =C2=A0 =C2=A0 via =3D NULL;
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> + =C2=A0 =C2=A0}
> +
> + =C2=A0 =C2=A0/* enable autopoll */
> + =C2=A0 =C2=A0cuda_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1)=
;
> + =C2=A0 =C2=A0while (!req.complete)
> + =C2=A0 =C2=A0 =C2=A0 cuda_poll();
> +
> + =C2=A0 =C2=A0return 1;
> +}
> +#else
> =C2=A0int __init find_via_cuda(void)
> =C2=A0{
> =C2=A0 =C2=A0 struct adb_request req;
> @@ -175,7 +199,7 @@ int __init find_via_cuda(void)
> =C2=A0 =C2=A0 vias =3D NULL;
> =C2=A0 =C2=A0 return 0;
> =C2=A0}
> -#endif /* CONFIG_PPC */
> +#endif /* !defined CONFIG_MAC */
>
> =C2=A0static int __init via_cuda_start(void)
> =C2=A0{
> @@ -184,14 +208,14 @@ static int __init via_cuda_start(void)
>
> =C2=A0#ifdef CONFIG_MAC
> =C2=A0 =C2=A0 cuda_irq =3D IRQ_MAC_ADB;
> -#else /* CONFIG_MAC */
> +#else
> =C2=A0 =C2=A0 cuda_irq =3D irq_of_parse_and_map(vias, 0);
> =C2=A0 =C2=A0 if (cuda_irq =3D=3D NO_IRQ) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0printk(KERN_ERR "via-cuda: can't map interrupt=
s for %s\n",
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vias->full_name);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENODEV;
> =C2=A0 =C2=A0 }
> -#endif /* CONFIG_MAC */
> +#endif
>
> =C2=A0 =C2=A0 if (request_irq(cuda_irq, cuda_interrupt, 0, "ADB", cuda_in=
terrupt)) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0printk(KERN_ERR "via-cuda: can't request irq %=
d\n", cuda_irq);
> @@ -216,28 +240,10 @@ cuda_probe(void)
> =C2=A0#else
> =C2=A0 =C2=A0 if (macintosh_config->adb_type !=3D MAC_ADB_CUDA)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENODEV;
> - =C2=A0 =C2=A0via =3D via1;
> =C2=A0#endif
> - =C2=A0 =C2=A0return 0;
> -}
> -
> -static int __init
> -cuda_init(void)
> -{
> -#ifdef CONFIG_PPC
> =C2=A0 =C2=A0 if (via =3D=3D NULL)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENODEV;
> =C2=A0 =C2=A0 return 0;
> -#else
> - =C2=A0 =C2=A0int err =3D cuda_init_via();
> - =C2=A0 =C2=A0if (err) {
> - =C2=A0 =C2=A0 =C2=A0 printk(KERN_ERR "cuda_init_via() failed\n");
> - =C2=A0 =C2=A0 =C2=A0 return -ENODEV;
> - =C2=A0 =C2=A0}
> - =C2=A0 =C2=A0out_8(&via[IER], IER_SET|SR_INT); /* enable interrupt from=
SR */
> -
> - =C2=A0 =C2=A0return via_cuda_start();
> -#endif
> =C2=A0}
> =C2=A0#endif /* CONFIG_ADB */
>
> @@ -430,9 +436,11 @@ cuda_poll(void)
> =C2=A0 =C2=A0 /* cuda_interrupt only takes a normal lock, we disable
> =C2=A0 =C2=A0 =C2=A0* interrupts here to avoid re-entering and thus deadl=
ocking.
> =C2=A0 =C2=A0 =C2=A0*/
> - =C2=A0 =C2=A0disable_irq(cuda_irq);
> + =C2=A0 =C2=A0if (cuda_irq)
> + =C2=A0 =C2=A0 =C2=A0 disable_irq(cuda_irq);
> =C2=A0 =C2=A0 cuda_interrupt(0, NULL);
> - =C2=A0 =C2=A0enable_irq(cuda_irq);
> + =C2=A0 =C2=A0if (cuda_irq)
> + =C2=A0 =C2=A0 =C2=A0 enable_irq(cuda_irq);
> =C2=A0}
>
> =C2=A0static irqreturn_t
> @@ -446,7 +454,7 @@ cuda_interrupt(int irq, void *arg)
>
> =C2=A0 =C2=A0 spin_lock(&cuda_lock);
>
> - =C2=A0 =C2=A0/* On powermacs, this handler is registered for the VIA IR=
Q. But it uses
> + =C2=A0 =C2=A0/* On powermacs, this handler is registered for the VIA IR=
Q. But they use
> =C2=A0 =C2=A0 =C2=A0* just the shift register IRQ -- other VIA interrupt =
sources are disabled.
> =C2=A0 =C2=A0 =C2=A0* On m68k macs, the VIA IRQ sources are dispatched in=
dividually. Unless
> =C2=A0 =C2=A0 =C2=A0* we are polling, the shift register IRQ flag has alr=
eady been cleared.
> Index: linux-2.6.31/drivers/macintosh/adb.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/drivers/macintosh/adb.c =C2=A0 2009-11-17 17:07:58.=
000000000 +1100
> +++ linux-2.6.31/drivers/macintosh/adb.c =C2=A0 =C2=A0 =C2=A0 =C2=A02009-=
11-17 17:11:47.000000000 +1100
> @@ -317,9 +317,11 @@ static int __init adb_init(void)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0break;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> - =C2=A0 =C2=A0 =C2=A0 if ((adb_controller =3D=3D NULL) || adb_controller=
->init()) {
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk(KERN_WARNING "W=
arning: no ADB interface detected\n");
> + =C2=A0 =C2=A0 =C2=A0 if (adb_controller !=3D NULL && adb_controller->in=
it &&
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 adb_controller->init())
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0adb_controller =3D=
NULL;
> + =C2=A0 =C2=A0 =C2=A0 if (adb_controller =3D=3D NULL) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk(KERN_WARNING "W=
arning: no ADB interface detected\n");
> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else {
> =C2=A0#ifdef CONFIG_PPC
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (machine_is_com=
patible("AAPL,PowerBook1998") ||
>
--=20
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k=
.org
In personal conversations with technical people, I call myself a hacker. Bu=
t
when I'm talking to journalists I just say "programmer" or something like t=
hat.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-12-23 20:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-03 13:46 [PATCH 10/13] mac68k: start CUDA early Finn Thain
2009-11-17 2:03 ` Benjamin Herrenschmidt
2009-11-17 9:03 ` [PATCH 10/13] mac68k: start CUDA early, take 2 Finn Thain
2009-12-23 20:15 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).