## Automatically generated incremental diff
## From:   linux-2.4.22-bk35
## To:     linux-2.4.22-bk36
## Robot:  $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $

diff -urN linux-2.4.22-bk35/Makefile linux-2.4.22-bk36/Makefile
--- linux-2.4.22-bk35/Makefile	2003-10-16 02:49:25.000000000 -0700
+++ linux-2.4.22-bk36/Makefile	2003-10-16 02:49:28.000000000 -0700
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 22
-EXTRAVERSION = -bk35
+EXTRAVERSION = -bk36
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
diff -urN linux-2.4.22-bk35/arch/sh/kernel/irq_intc2.c linux-2.4.22-bk36/arch/sh/kernel/irq_intc2.c
--- linux-2.4.22-bk35/arch/sh/kernel/irq_intc2.c	2003-06-13 07:51:32.000000000 -0700
+++ linux-2.4.22-bk36/arch/sh/kernel/irq_intc2.c	2003-10-16 02:49:28.000000000 -0700
@@ -12,6 +12,8 @@
  * Hitachi 7751 and the STM ST40 STB1.
  */
 
+#include <linux/config.h>
+#include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/irq.h>
@@ -22,8 +24,11 @@
 
 
 struct intc2_data {
-	unsigned int addr;	/* Address of Interrupt Priority Register */
-	int mask; /*Mask to apply */
+	unsigned char msk_offset;
+	unsigned char msk_shift;
+#ifdef CONFIG_CPU_SUBTYPE_ST40
+	int (*clear_irq) (int);
+#endif
 };
 
 
@@ -56,33 +61,34 @@
 
 static void disable_intc2_irq(unsigned int irq)
 {
-	unsigned addr;
-	int offset=irq-INTC2_FIRST_IRQ;
-	unsigned val,flags;
+	int irq_offset = irq - INTC2_FIRST_IRQ;
+	int msk_shift, msk_offset;
 
 	// Sanity check
-	if(offset<0 || offset>=NR_INTC2_IRQS) return;
-
-	addr=intc2_data[offset].addr+INTC2_INTMSK_OFFSET;
+	if((irq_offset<0) || (irq_offset>=NR_INTC2_IRQS))
+		return;
 
-	save_and_cli(flags);
-	val=ctrl_inl(addr);
-	val|=intc2_data[offset].mask;
-	ctrl_outl(val,addr);
+	msk_shift = intc2_data[irq_offset].msk_shift;
+	msk_offset = intc2_data[irq_offset].msk_offset;
 
-	restore_flags(flags);
+	ctrl_outl(1<<msk_shift,
+		  INTC2_BASE+INTC2_INTMSK_OFFSET+msk_offset);
 }
 
 static void enable_intc2_irq(unsigned int irq)
 {
-	int offset=irq-INTC2_FIRST_IRQ;
+	int irq_offset = irq - INTC2_FIRST_IRQ;
+	int msk_shift, msk_offset;
 
-	// Sanity check
-	if(offset<0 || offset>=NR_INTC2_IRQS) return;
+	/* Sanity check */
+	if((irq_offset<0) || (irq_offset>=NR_INTC2_IRQS))
+		return;
 
-	ctrl_outl(intc2_data[offset].mask,
-		  intc2_data[offset].addr+INTC2_INTMSKCLR_OFFSET);
+	msk_shift = intc2_data[irq_offset].msk_shift;
+	msk_offset = intc2_data[irq_offset].msk_offset;
 
+	ctrl_outl(1<<msk_shift,
+		  INTC2_BASE+INTC2_INTMSKCLR_OFFSET+msk_offset);
 }
 
 static void mask_and_ack_intc2(unsigned int irq)
@@ -94,28 +100,50 @@
 {
 	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
 		enable_intc2_irq(irq);
+
+#ifdef CONFIG_CPU_SUBTYPE_ST40
+	if (intc2_data[irq - INTC2_FIRST_IRQ].clear_irq)
+		intc2_data[irq - INTC2_FIRST_IRQ].clear_irq (irq);
+#endif
 }
 
-void make_intc2_irq(unsigned int irq, unsigned int addr, 
-		    unsigned int group,int pos, int priority)
+/*
+ * Setup an INTC2 style interrupt.
+ * NOTE: Unlike IPR interrupts, parameters are not shifted by this code,
+ * allowing the use of the numbers straight out of the datasheet.
+ * For example:
+ *    PIO1 which is INTPRI00[19,16] and INTMSK00[13]
+ * would be:               ^     ^             ^  ^
+ *                         |     |             |  |
+ *    make_intc2_irq(84,   0,   16,            0, 13);
+ */
+void make_intc2_irq(unsigned int irq,
+		    unsigned int ipr_offset, unsigned int ipr_shift,
+		    unsigned int msk_offset, unsigned int msk_shift,
+		    unsigned int priority)
 {
-	int offset=irq-INTC2_FIRST_IRQ;
-	unsigned flags,val;
+	int irq_offset = irq - INTC2_FIRST_IRQ;
+	unsigned int flags;
+	unsigned long ipr;
 
-	if(offset<0 || offset>=NR_INTC2_IRQS) {
+	if((irq_offset<0) || (irq_offset>=NR_INTC2_IRQS))
 		return;
-	}
+
 
 	disable_irq_nosync(irq);
-	/* Fill the data we need */
-	intc2_data[offset].addr=addr;
-	intc2_data[offset].mask=1<<pos;
-		
+
+	intc2_data[irq_offset].msk_offset = msk_offset;
+	intc2_data[irq_offset].msk_shift  = msk_shift;
+#ifdef CONFIG_CPU_SUBTYPE_ST40
+	intc2_data[irq_offset].clear_irq = NULL;
+#endif
+
 	/* Set the priority level */
 	save_and_cli(flags);
-	val=ctrl_inl(addr+INTC2_INTPRI_OFFSET);
-	val|=(priority)<< (group<<4);
-	ctrl_outl(val,addr+INTC2_INTPRI_OFFSET);
+	ipr=ctrl_inl(INTC2_BASE+INTC2_INTPRI_OFFSET+ipr_offset);
+	ipr&=~(0xf<<ipr_shift);
+	ipr|=(priority)<<ipr_shift;
+	ctrl_outl(ipr, INTC2_BASE+INTC2_INTPRI_OFFSET+ipr_offset);
 	restore_flags(flags);
 
 	irq_desc[irq].handler=&intc2_irq_type;
@@ -123,5 +151,70 @@
 	disable_intc2_irq(irq);
 }
 
+#ifdef CONFIG_CPU_SUBTYPE_ST40
 
+struct intc2_init {
+	unsigned short irq;
+	unsigned char ipr_offset, ipr_shift;
+	unsigned char msk_offset, msk_shift;
+};
+
+static struct intc2_init intc2_init_data[]  __initdata = {
+	{64,  0,  0, 0,  0},	/* PCI serr */
+	{65,  0,  4, 0,  1},	/* PCI err */
+	{66,  0,  4, 0,  2},	/* PCI ad */
+	{67,  0,  4, 0,  3},	/* PCI pwd down */
+	{72,  0,  8, 0,  5},	/* DMAC INT0 */
+	{73,  0,  8, 0,  6},	/* DMAC INT1 */
+	{74,  0,  8, 0,  7},	/* DMAC INT2 */
+	{75,  0,  8, 0,  8},	/* DMAC INT3 */
+	{76,  0,  8, 0,  9},	/* DMAC INT4 */
+	{78,  0,  8, 0, 11},	/* DMAC ERR */
+	{80,  0, 12, 0, 12},	/* PIO0 */
+	{84,  0, 16, 0, 13},	/* PIO1 */
+	{88,  0, 20, 0, 14},	/* PIO2 */
+	{112, 4,  0, 4,  0},	/* Mailbox */
+#ifdef CONFIG_CPU_SUBTYPE_ST40GX1
+	{116, 4,  4, 4,  4},	/* SSC0 */
+	{120, 4,  8, 4,  8},	/* IR Blaster */
+	{124, 4, 12, 4, 12},	/* USB host */
+	{128, 4, 16, 4, 16},	/* Video processor BLITTER */
+	{132, 4, 20, 4, 20},	/* UART0 */
+	{134, 4, 20, 4, 22},	/* UART2 */
+	{136, 4, 24, 4, 24},	/* IO_PIO0 */
+	{140, 4, 28, 4, 28},	/* EMPI */
+	{144, 8,  0, 8,  0},	/* MAFE */
+	{148, 8,  4, 8,  4},	/* PWM */
+	{152, 8,  8, 8,  8},	/* SSC1 */
+	{156, 8, 12, 8, 12},	/* IO_PIO1 */
+	{160, 8, 16, 8, 16},	/* USB target */
+	{164, 8, 20, 8, 20},	/* UART1 */
+	{168, 8, 24, 8, 24},	/* Teletext */
+	{172, 8, 28, 8, 28},	/* VideoSync VTG */
+	{173, 8, 28, 8, 29},	/* VideoSync DVP0 */
+	{174, 8, 28, 8, 30},	/* VideoSync DVP1 */
+#endif
+};
+
+void __init init_IRQ_intc2(void)
+{
+	struct intc2_init *p;	
+
+	for (p = intc2_init_data;
+	     p<intc2_init_data+ARRAY_SIZE(intc2_init_data);
+	     p++) {
+		make_intc2_irq(p->irq, p->ipr_offset, p->ipr_shift,
+			       p-> msk_offset, p->msk_shift, 13);
+	}
+}
+
+/* Adds a termination callback to the interrupt */
+void intc2_add_clear_irq(int irq, int (*fn)(int))
+{
+	if (irq < INTC2_FIRST_IRQ)
+		return;
+
+	intc2_data[irq - INTC2_FIRST_IRQ].clear_irq = fn;
+}
 
+#endif /* CONFIG_CPU_SUBTYPE_ST40 */
diff -urN linux-2.4.22-bk35/arch/sh/kernel/irq_ipr.c linux-2.4.22-bk36/arch/sh/kernel/irq_ipr.c
--- linux-2.4.22-bk35/arch/sh/kernel/irq_ipr.c	2003-08-25 04:44:40.000000000 -0700
+++ linux-2.4.22-bk36/arch/sh/kernel/irq_ipr.c	2003-10-16 02:49:28.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: irq_ipr.c,v 1.1.1.1.2.1 2003/07/16 18:41:20 yoshii Exp $
+/* $Id: irq_ipr.c,v 1.1.1.1.2.2 2003/10/14 16:46:10 trent Exp $
  *
  * linux/arch/sh/kernel/irq_ipr.c
  *
@@ -274,6 +274,10 @@
 #endif
 #endif /* CONFIG_CPU_SUBTYPE_SH7300 || CONFIG_CPU_SUBTYPE_SH7707 || CONFIG_CPU_SUBTYPE_SH7709 */
 
+#ifdef CONFIG_CPU_SUBTYPE_ST40
+	init_IRQ_intc2();
+#endif
+
 	/* Perform the machine specific initialisation */
 	if (sh_mv.mv_init_irq != NULL) {
 		sh_mv.mv_init_irq();
diff -urN linux-2.4.22-bk35/arch/sh/kernel/signal.c linux-2.4.22-bk36/arch/sh/kernel/signal.c
--- linux-2.4.22-bk35/arch/sh/kernel/signal.c	2003-08-25 04:44:40.000000000 -0700
+++ linux-2.4.22-bk36/arch/sh/kernel/signal.c	2003-10-16 02:49:28.000000000 -0700
@@ -1,4 +1,4 @@
-/* $Id: signal.c,v 1.1.1.1.2.11 2002/10/23 00:57:46 mrbrown Exp $
+/* $Id: signal.c,v 1.1.1.1.2.12 2003/10/01 10:54:28 kkojima Exp $
  *
  *  linux/arch/sh/kernel/signal.c
  *
@@ -168,21 +168,22 @@
  * Do a signal return; undo the signal stack.
  */
 
-#define MOVW(n)	(0x9300|((n)-2))	/* Move mem word at PC+n to R3 */
-#define TRAP16	0xc310			/* Syscall w/no args (NR in R3) */
+#define MOVW(n)	 (0x9300|((n)-2))	/* Move mem word at PC+n to R3 */
+#define TRAP16	 0xc310			/* Syscall w/no args (NR in R3) */
+#define OR_R0_R0 0x200b			/* or r0,r0 (insert to avoid hardware bug) */
 
 struct sigframe
 {
 	struct sigcontext sc;
 	unsigned long extramask[_NSIG_WORDS-1];
-	u16 retcode[3];
+	u16 retcode[8];
 };
 
 struct rt_sigframe
 {
 	struct siginfo info;
 	struct ucontext uc;
-	u16 retcode[3];
+	u16 retcode[8];
 };
 
 #if defined(__SH4__)
@@ -397,9 +398,14 @@
 		regs->pr = (unsigned long) ka->sa.sa_restorer;
 	} else {
 		/* Generate return code (system call to sigreturn) */
-		err |= __put_user(MOVW(2), &frame->retcode[0]);
+		err |= __put_user(MOVW(7), &frame->retcode[0]);
 		err |= __put_user(TRAP16, &frame->retcode[1]);
-		err |= __put_user((__NR_sigreturn), &frame->retcode[2]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[2]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[3]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[4]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[5]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[6]);
+		err |= __put_user((__NR_sigreturn), &frame->retcode[7]);
 		regs->pr = (unsigned long) frame->retcode;
 	}
 
@@ -409,6 +415,8 @@
 	/* Set up registers for signal handler */
 	regs->regs[15] = (unsigned long) frame;
 	regs->regs[4] = signal; /* Arg for signal handler */
+	regs->regs[5] = 0;
+	regs->regs[6] = (unsigned long) &frame->sc;
 	regs->pc = (unsigned long) ka->sa.sa_handler;
 
 	set_fs(USER_DS);
@@ -419,6 +427,8 @@
 #endif
 
 	flush_cache_sigtramp(regs->pr);
+	if ((-regs->pr & (L1_CACHE_BYTES-1)) < sizeof(frame->retcode))
+		flush_cache_sigtramp(regs->pr + L1_CACHE_BYTES);
 	return;
 
 give_sigsegv:
@@ -465,9 +475,14 @@
 		regs->pr = (unsigned long) ka->sa.sa_restorer;
 	} else {
 		/* Generate return code (system call to rt_sigreturn) */
-		err |= __put_user(MOVW(2), &frame->retcode[0]);
+		err |= __put_user(MOVW(7), &frame->retcode[0]);
 		err |= __put_user(TRAP16, &frame->retcode[1]);
-		err |= __put_user((__NR_rt_sigreturn), &frame->retcode[2]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[2]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[3]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[4]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[5]);
+		err |= __put_user(OR_R0_R0, &frame->retcode[6]);
+		err |= __put_user((__NR_rt_sigreturn), &frame->retcode[7]);
 		regs->pr = (unsigned long) frame->retcode;
 	}
 
@@ -489,6 +504,8 @@
 #endif
 
 	flush_cache_sigtramp(regs->pr);
+	if ((-regs->pr & (L1_CACHE_BYTES-1)) < sizeof(frame->retcode))
+		flush_cache_sigtramp(regs->pr + L1_CACHE_BYTES);
 	return;
 
 give_sigsegv:
diff -urN linux-2.4.22-bk35/drivers/char/sh-sci.h linux-2.4.22-bk36/drivers/char/sh-sci.h
--- linux-2.4.22-bk35/drivers/char/sh-sci.h	2003-10-16 02:49:26.000000000 -0700
+++ linux-2.4.22-bk36/drivers/char/sh-sci.h	2003-10-16 02:49:29.000000000 -0700
@@ -432,4 +432,5 @@
 #define BPS_38400      SCBRR_VALUE(38400)
 #define BPS_57600      SCBRR_VALUE(57600)
 #define BPS_115200     SCBRR_VALUE(115200)
+#define BPS_230400     SCBRR_VALUE(230400)
 
diff -urN linux-2.4.22-bk35/include/asm-sh/irq.h linux-2.4.22-bk36/include/asm-sh/irq.h
--- linux-2.4.22-bk35/include/asm-sh/irq.h	2003-10-16 02:49:27.000000000 -0700
+++ linux-2.4.22-bk36/include/asm-sh/irq.h	2003-10-16 02:49:30.000000000 -0700
@@ -86,7 +86,7 @@
 #define IRDA_IPR_POS	2
 #define IRDA_PRIORITY	3
 #elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) || \
-      defined(CONFIG_CPU_SUBTYPE_ST40) || defined(CONFIG_CPU_SUBTYPE_SH4_202)
+      defined(CONFIG_CPU_SUBTYPE_ST40)
 #define SCIF_ERI_IRQ	40
 #define SCIF_RXI_IRQ	41
 #define SCIF_BRI_IRQ	42
@@ -295,18 +295,21 @@
 #else
 #error Unknown CPU
 #endif
- 
-#define INTC2_BASE0 0xfe080000
-#define INTC2_INTC2MODE  (INTC2_BASE0+0x80)
- 
+
+#define INTC2_BASE	0xfe080000
+#define INTC2_INTC2MODE	(INTC2_BASE+0x80)
+
 #define INTC2_INTPRI_OFFSET	0x00
 #define INTC2_INTREQ_OFFSET	0x20
 #define INTC2_INTMSK_OFFSET	0x40
 #define INTC2_INTMSKCLR_OFFSET	0x60
- 
-extern void make_intc2_irq(unsigned int irq,unsigned int addr,
-                           unsigned int group,int pos,int priority);
- 
+
+void make_intc2_irq(unsigned int irq,
+		    unsigned int ipr_offset, unsigned int ipr_shift,
+		    unsigned int msk_offset, unsigned int msk_shift,
+		    unsigned int priority);
+void init_IRQ_intc2(void);
+void intc2_add_clear_irq(int irq, int (*fn)(int));
 #endif                                                                        
        
 #ifdef CONFIG_SH_GENERIC
diff -urN linux-2.4.22-bk35/include/asm-sh64/pci.h linux-2.4.22-bk36/include/asm-sh64/pci.h
--- linux-2.4.22-bk35/include/asm-sh64/pci.h	2003-08-25 04:44:44.000000000 -0700
+++ linux-2.4.22-bk36/include/asm-sh64/pci.h	2003-10-16 02:49:30.000000000 -0700
@@ -42,6 +42,7 @@
 ** or architectures with incomplete PCI setup by the loader 
 */
 #define pcibios_assign_all_busses()     1
+#define pcibios_scan_all_fns()		0
 
 /* 
 ** These are currently the correct values for the STM overdrive board.
