Skip to contentSkip to conversation

8xx drivers for 2.6

PATCH Tom Rini 5 participants 8 messages Dec 11, 2003 – Dec 22, 2003

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

Ok. I've gone and ported the 8xx serial driver, and other misc 8xx things up to what 2.6 wants them to be, as well as a few of the simpler changes to head_8xx.S. You can get the patch at
http://stop.crashing.org:16080/~trini/XXX-mpc8xx_round_one.patch
or below. There are a few issues that could still use additional work (serial), and in 2.6 having request_8xxirq becomes much uglier because of the irqreturn_t stuff (at least I couldn't make it happen w/o chaning <linux/interrupt.h>, and I never did figure out why cond_syscall() doesn't work in some files but not others.

Dan, if you have _anything_ done for head_8xx.S can you please post it? Thanks.

--
Tom Rini
http://gate.crashing.org/~trini/

arch/ppc/8xx_io/commproc.c +6 -4
diff -Nru a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
@@ -33,6 +33,7 @@
 #include <asm/pgtable.h>
 #include <asm/8xx_immap.h>
 #include <asm/commproc.h>
+#include <asm/io.h>
 
 extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep);
 
@@ -49,13 +50,13 @@
 	void	*dev_id;
 };
 static	struct	cpm_action cpm_vecs[CPMVEC_NR];
-static	void	cpm_interrupt(int irq, void * dev, struct pt_regs * regs);
+static	irqreturn_t cpm_interrupt(int irq, void * dev, struct pt_regs * regs);
 static	void	cpm_error_interrupt(void *, struct pt_regs * regs);
 static	void	alloc_host_memory(void);
 
 #if 1
 void
-m8xx_cpm_reset()
+m8xx_cpm_reset(void)
 {
 	volatile immap_t	 *imp;
 	volatile cpm8xx_t	*commproc;
@@ -191,7 +192,7 @@
 
 /* CPM interrupt controller interrupt.
 */
-static	void
+static	irqreturn_t
 cpm_interrupt(int irq, void * dev, struct pt_regs * regs)
 {
 	uint	vec;
@@ -212,7 +213,8 @@
 	 * indicator.
 	 */
 	((immap_t *)IMAP_ADDR)->im_cpic.cpic_cisr = (1 << vec);
-
+
+	return IRQ_HANDLED;
 }
 
 /* The CPM can generate the error interrupt when there is a race condition
arch/ppc/8xx_io/uart.c +62 -97

378 lines not on this page · raw message

arch/ppc/kernel/Makefile +1 -1
diff -Nru a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
@@ -30,7 +30,7 @@
 obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_TAU)		+= temp.o
 
-ifdef CONFIG_MATH_EMULATION
+ifndef CONFIG_MATH_EMULATION
 obj-$(CONFIG_8xx)		+= softemu8xx.o
 endif
 
arch/ppc/kernel/head_8xx.S +17 -47

156 lines not on this page · raw message

arch/ppc/kernel/irq.c +4 -0
diff -Nru a/arch/ppc/kernel/irq.c b/arch/ppc/kernel/irq.c
@@ -217,6 +217,10 @@
 
 EXPORT_SYMBOL(free_irq);
 
+#ifdef CONFIG_8xx
+#define request_irq request_8xxirq
+#endif
+
 int request_irq(unsigned int irq,
 	irqreturn_t (*handler)(int, void *, struct pt_regs *),
 	unsigned long irqflags, const char * devname, void *dev_id)
arch/ppc/kernel/softemu8xx.c +1 -1
diff -Nru a/arch/ppc/kernel/softemu8xx.c b/arch/ppc/kernel/softemu8xx.c
@@ -133,7 +133,7 @@
 			print_8xx_pte(current->mm,regs->nip);
 			pa = get_8xx_pte(current->mm,regs->nip) & PAGE_MASK;
 			pa |= (regs->nip & ~PAGE_MASK);
-			pa = __va(pa);
+			pa = (unsigned long)__va(pa);
 			printk("Kernel VA for NIP %x ", pa);
 			print_8xx_pte(current->mm,pa);
 		}
arch/ppc/kernel/syscalls.c +0 -2
diff -Nru a/arch/ppc/kernel/syscalls.c b/arch/ppc/kernel/syscalls.c
@@ -271,5 +271,3 @@
 {
 	return sys_fadvise64_64(fd, offset, len, advice);
 }
-
-cond_syscall(sys_pciconfig_iobase);
arch/ppc/mm/fault.c +0 -1
diff -Nru a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
@@ -359,7 +359,6 @@
 	pgd_t *dir;
 	pmd_t *pmd;
 	pte_t *pte;
-	struct mm_struct *mm;
 
 	if (address < TASK_SIZE)
 		return NULL;
arch/ppc/syslib/m8xx_setup.c +4 -3
diff -Nru a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c
@@ -117,9 +117,11 @@
 }
 
 /* A place holder for time base interrupts, if they are ever enabled. */
-void timebase_interrupt(int irq, void * dev, struct pt_regs * regs)
+irqreturn_t timebase_interrupt(int irq, void * dev, struct pt_regs * regs)
 {
 	printk ("timebase_interrupt()\n");
+
+	return IRQ_HANDLED;
 }
 
 /* The decrementer counts at the system (internal) clock frequency divided by
@@ -214,14 +216,13 @@
 m8xx_restart(char *cmd)
 {
 	__volatile__ unsigned char dummy;
-	uint	msr;
 
 	cli();
 	((immap_t *)IMAP_ADDR)->im_clkrst.car_plprcr |= 0x00000080;
 
 	/* Clear the ME bit in MSR to cause checkstop on machine check
 	*/
-	mtmsr(mfmsr(msr) & ~0x1000);
+	mtmsr(mfmsr() & ~0x1000);
 
 	dummy = ((immap_t *)IMAP_ADDR)->im_clkrst.res[0];
 	printk("Restart failed\n");
arch/ppc/syslib/ppc8xx_pic.c +1 -0
diff -Nru a/arch/ppc/syslib/ppc8xx_pic.c b/arch/ppc/syslib/ppc8xx_pic.c
@@ -4,6 +4,7 @@
 #include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/signal.h>
+#include <linux/interrupt.h>
 #include <asm/irq.h>
 #include <asm/8xx_immap.h>
 #include <asm/mpc8xx.h>
include/asm-ppc/mpc8xx.h +3 -1
diff -Nru a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h
@@ -96,8 +96,10 @@
 extern unsigned char __res[];
 
 struct pt_regs;
+typedef int irqreturn_t;	/* FIXME -- Tom */
+
 extern int request_8xxirq(unsigned int irq,
-		       void (*handler)(int, void *, struct pt_regs *),
+		       irqreturn_t (*handler)(int, void *, struct pt_regs *),
 		       unsigned long flags,
 		       const char *device,
 		       void *dev_id);
include/linux/interrupt.h +2 -0
diff -Nru a/include/linux/interrupt.h b/include/linux/interrupt.h
@@ -26,7 +26,9 @@
  * IRQ_HANDLED means that we did have a valid interrupt and handled it.
  * IRQ_RETVAL(x) selects on the two depending on x being non-zero (for handled)
  */
+#ifndef __CONFIG_8xx_DEFS
 typedef int irqreturn_t;
+#endif
 
 #define IRQ_NONE	(0)
 #define IRQ_HANDLED	(1)
kernel/sys.c +1 -0
diff -Nru a/kernel/sys.c b/kernel/sys.c
@@ -251,6 +251,7 @@
 cond_syscall(sys_epoll_wait)
 cond_syscall(sys_pciconfig_read)
 cond_syscall(sys_pciconfig_write)
+cond_syscall(sys_pciconfig_iobase)
 
 static int set_one_prio(struct task_struct *p, int niceval, int error)
 {
#1 lore raw
Quoted 3 lines · Tom Rini

Ok. I've gone and ported the 8xx serial driver, and other misc 8xx things up to what 2.6 wants them to be, as well as a few of the simpler changes to head_8xx.S.

Thanks. So, does the kernel at least compile now? :-)

Quoted 2 lines

...and in 2.6 having request_8xxirq becomes much uglier because of the irqreturn_t stuff

I'm finally going to update this. I've got a pretty good implemenation of the cascaded controller stuff for the 8560, once I get this debugged I'll port it here.

Quoted 2 lines

Dan, if you have _anything_ done for head_8xx.S can you please post it?

Yeah, maybe I can do some debug now, too.

Thanks.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

author
#2 lore raw
Quoted 7 lines · Dan Malek
Quoted 3 lines · Tom Rini

Ok. I've gone and ported the 8xx serial driver, and other misc 8xx things up to what 2.6 wants them to be, as well as a few of the simpler changes to head_8xx.S.

Thanks. So, does the kernel at least compile now? :-)

Compiles, links, boots and happily dies inside of head_8xx.S :)

Quoted 6 lines
Quoted 2 lines

...and in 2.6 having request_8xxirq becomes much uglier because of the irqreturn_t stuff

I'm finally going to update this. I've got a pretty good implemenation of the cascaded controller stuff for the 8560, once I get this debugged I'll port it here.

Sounds like a plan.

Quoted 4 lines
Quoted 2 lines

Dan, if you have _anything_ done for head_8xx.S can you please post it?

Yeah, maybe I can do some debug now, too.

Hopefully :)

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
Quoted 35 lines · Tom Rini
Quoted 4 lines · Dan Malek

Tom Rini wrote:

Quoted 8 lines
Quoted 5 lines

Ok. I've gone and ported the 8xx serial driver, and other misc 8xx things up to what 2.6 wants them to be, as well as a few of the simpler changes to head_8xx.S.

Thanks. So, does the kernel at least compile now? :-)

Compiles, links, boots and happily dies inside of head_8xx.S :)

Quoted 9 lines
Quoted 4 lines

...and in 2.6 having request_8xxirq becomes much uglier because of the irqreturn_t stuff

I'm finally going to update this. I've got a pretty good implemenation of the cascaded controller stuff for the 8560, once I get this debugged I'll port it here.

Sounds like a plan.

Quoted 3 lines
Quoted 3 lines

Dan, if you have _anything_ done for head_8xx.S can you please post it?

Quoted 13 lines
Quoted 2 lines

Yeah, maybe I can do some debug now, too.

Hopefully :)

--
Tom Rini
http://gate.crashing.org/~trini/

That sounds nice.

Any chance to push the changes to the linuxppc-2.5 tree for us poor saps? It doesn't have to work or anything, just give us something to work...

Regards

Pantelis

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

author
#4 lore raw
Quoted 30 lines · Pantelis Antoniou
Quoted 29 lines · Tom Rini
Quoted 9 lines · Dan Malek
Quoted 5 lines · Tom Rini

Ok. I've gone and ported the 8xx serial driver, and other misc 8xx things up to what 2.6 wants them to be, as well as a few of the simpler changes to head_8xx.S.

Thanks. So, does the kernel at least compile now? :-)

Compiles, links, boots and happily dies inside of head_8xx.S :)

Quoted 7 lines
Quoted 4 lines

...and in 2.6 having request_8xxirq becomes much uglier because of the irqreturn_t stuff

I'm finally going to update this. I've got a pretty good implemenation of the cascaded controller stuff for the 8560, once I get this debugged I'll port it here.

Sounds like a plan.

Quoted 5 lines
Quoted 3 lines

Dan, if you have _anything_ done for head_8xx.S can you please post it?

Yeah, maybe I can do some debug now, too.

Quoted 6 lines
Quoted 1 line

Hopefully :)

That sounds nice.

Any chance to push the changes to the linuxppc-2.5 tree for us poor saps? It doesn't have to work or anything, just give us something to work...

Sure, done.

--
Tom Rini
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw
Quoted 29 lines · Tom Rini
Quoted 14 lines · Pantelis Antoniou
Quoted 13 lines · Tom Rini
Quoted 9 lines · Dan Malek
Quoted 5 lines · Tom Rini

Ok. I've gone and ported the 8xx serial driver, and other misc 8xx things up to what 2.6 wants them to be, as well as a few of the simpler changes to head_8xx.S.

Thanks. So, does the kernel at least compile now? :-)

Compiles, links, boots and happily dies inside of head_8xx.S :)

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

...and in 2.6 having request_8xxirq becomes much uglier because of the irqreturn_t stuff

That sounds nice.

Any chance to push the changes to the linuxppc-2.5 tree for us poor saps? It doesn't have to work or anything, just give us something to work...

Sure, done.

diff -Nru a/include/linux/interrupt.h b/include/linux/interrupt.h

include/linux/interrupt.h line 34

Quoted 9 lines
include/linux/interrupt.h +2 -0
@@ -26,7 +26,9 @@
  * IRQ_HANDLED means that we did have a valid interrupt and handled it.
  * IRQ_RETVAL(x) selects on the two depending on x being non-zero (for handled)
  */
+#ifndef __CONFIG_8xx_DEFS
 typedef int irqreturn_t;
+#endif
 
 #define IRQ_NONE	(0)
 #define IRQ_HANDLED	(1)

And this breaks compilation for non-8xx machines in current linuxppc-2.5:

| In file included from arch/ppc/kernel/traps.c:29:
| include/linux/interrupt.h:38: error: parse error before "irqreturn_t"

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw
In reply to Tom Rini
Quoted 4 lines · Tom Rini

(serial), and in 2.6 having request_8xxirq becomes much uglier because of the irqreturn_t stuff (at least I couldn't make it happen w/o chaning <linux/interrupt.h>, and I never did figure out why cond_syscall() doesn't work in some files but not others.

Gaahhhh, I thought we had got rid of request_8xxirq. I don't want to see it come back. And this sort of thing is just bad:

Quoted 9 lines

diff -Nru a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h

include/asm-ppc/mpc8xx.h +2 -0
@@ -96,8 +96,10 @@
 extern unsigned char __res[];
 
 struct pt_regs;
+typedef int irqreturn_t;	/* FIXME -- Tom */
+

[snip]

include/linux/interrupt.h line 31

Quoted 10 lines

diff -Nru a/include/linux/interrupt.h b/include/linux/interrupt.h

include/linux/interrupt.h +2 -0
@@ -26,7 +26,9 @@
  * IRQ_HANDLED means that we did have a valid interrupt and handled it.
  * IRQ_RETVAL(x) selects on the two depending on x being non-zero (for handled)
  */
+#ifndef __CONFIG_8xx_DEFS
 typedef int irqreturn_t;
+#endif

Paul.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#7 lore raw
Quoted 2 lines · Paul Mackerras

Gaahhhh, I thought we had got rid of request_8xxirq. I don't want to see it come back. And this sort of thing is just bad.

I don't know why in the hell this has irritated you so badly. It's 10 lines of code to allow people to use those legacy PC devices on boards like the MBX860 have have an 8259 controller.

In any case, since the 2.4 was screwed up so badly when it was removed there, I have removed it from 2.6. I'm just building various configurations right now to ensure I didn't break some non-8xx stuff in the process.

Thanks.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/