diff -X kernel-patches/dontdiff -urN linux-2.4.17/Documentation/Configure.help linux-2.4.17-elan/Documentation/Configure.help --- linux-2.4.17/Documentation/Configure.help Fri Dec 21 18:41:53 2001 +++ linux-2.4.17-elan/Documentation/Configure.help Mon Dec 31 19:03:32 2001 @@ -3813,6 +3813,7 @@ - "Pentium-4" for the Intel Pentium 4. - "K6" for the AMD K6, K6-II and K6-III (aka K6-3D). - "Athlon" for the AMD K7 family (Athlon/Duron/Thunderbird). + - "Elan" for the AMD Elan family (Elan SC400/SC410). - "Crusoe" for the Transmeta Crusoe series. - "Winchip-C6" for original IDT Winchip. - "Winchip-2" for IDT Winchip 2. diff -X kernel-patches/dontdiff -urN linux-2.4.17/arch/i386/boot/setup.S linux-2.4.17-elan/arch/i386/boot/setup.S --- linux-2.4.17/arch/i386/boot/setup.S Fri Nov 9 22:58:02 2001 +++ linux-2.4.17-elan/arch/i386/boot/setup.S Wed Jan 2 14:18:28 2002 @@ -42,6 +42,9 @@ * if CX/DX have been changed in the e801 call and if so use AX/BX . * Michael Miller, April 2001 * + * New A20 code ported from SYSLINUX by H. Peter Anvin. AMD Elan bugfixes + * by Robert Schwebel, December 2001 + * */ #include @@ -646,7 +649,17 @@ # # Enable A20. This is at the very best an annoying procedure. # A20 code ported from SYSLINUX 1.52-1.63 by H. Peter Anvin. +# AMD Elan bug fix by Robert Schwebel. # + +#if defined(CONFIG_MELAN) + inb $0xee, %al # reading 0xee enables A20 +a20_elan_wait: + call a20_test + jz a20_elan_wait + jmp a20_done +#endif + A20_TEST_LOOPS = 32 # Iterations per wait A20_ENABLE_LOOPS = 255 # Total loops to try diff -X kernel-patches/dontdiff -urN linux-2.4.17/arch/i386/config.in linux-2.4.17-elan/arch/i386/config.in --- linux-2.4.17/arch/i386/config.in Fri Dec 21 18:41:53 2001 +++ linux-2.4.17-elan/arch/i386/config.in Mon Dec 31 19:03:32 2001 @@ -37,6 +37,7 @@ Pentium-4 CONFIG_MPENTIUM4 \ K6/K6-II/K6-III CONFIG_MK6 \ Athlon/Duron/K7 CONFIG_MK7 \ + Elan CONFIG_MELAN \ Crusoe CONFIG_MCRUSOE \ Winchip-C6 CONFIG_MWINCHIPC6 \ Winchip-2 CONFIG_MWINCHIP2 \ @@ -125,6 +126,11 @@ define_bool CONFIG_X86_USE_3DNOW y define_bool CONFIG_X86_PGE y define_bool CONFIG_X86_USE_PPRO_CHECKSUM y +fi +if [ "$CONFIG_MELAN" = "y" ]; then + define_int CONFIG_X86_L1_CACHE_SHIFT 4 + define_bool CONFIG_X86_USE_STRING_486 y + define_bool CONFIG_X86_ALIGNMENT_16 y fi if [ "$CONFIG_MCYRIXIII" = "y" ]; then define_int CONFIG_X86_L1_CACHE_SHIFT 5 diff -X kernel-patches/dontdiff -urN linux-2.4.17/arch/i386/kernel/setup.c linux-2.4.17-elan/arch/i386/kernel/setup.c --- linux-2.4.17/arch/i386/kernel/setup.c Fri Dec 21 18:41:53 2001 +++ linux-2.4.17-elan/arch/i386/kernel/setup.c Mon Dec 31 19:03:32 2001 @@ -329,6 +329,10 @@ { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY }, { "fpu", 0xf0, 0xff, IORESOURCE_BUSY } }; +#ifdef CONFIG_ELAN +standard_io_resources[1] = { "pic1", 0x20, 0x21, IORESOURCE_BUSY }; +standard_io_resources[5] = { "pic2", 0xa0, 0xa1, IORESOURCE_BUSY }; +#endif #define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource)) diff -X kernel-patches/dontdiff -urN linux-2.4.17/drivers/char/serial.c linux-2.4.17-elan/drivers/char/serial.c --- linux-2.4.17/drivers/char/serial.c Fri Dec 21 18:41:54 2001 +++ linux-2.4.17-elan/drivers/char/serial.c Mon Dec 31 19:03:33 2001 @@ -57,6 +57,9 @@ * 10/00: add in optional software flow control for serial console. * Kanoj Sarcar (Modified by Theodore Ts'o) * + * 12/01: Fix for AMD Elan bug in transmit irq routine, by + * Christer Weinigel , + * Robert Schwebel */ static char *serial_version = "5.05c"; @@ -853,7 +856,7 @@ if (!info) { info = IRQ_ports[irq]; if (pass_counter++ > RS_ISR_PASS_LIMIT) { -#if 0 +#ifdef SERIAL_DEBUG_INTR printk("rs loop break\n"); #endif break; /* Prevent infinite loops */ @@ -886,6 +889,9 @@ int first_multi = 0; struct rs_multiport_struct *multi; #endif +#ifdef CONFIG_MELAN + int iir; +#endif #ifdef SERIAL_DEBUG_INTR printk("rs_interrupt_single(%d)...", irq); @@ -900,7 +906,9 @@ if (multi->port_monitor) first_multi = inb(multi->port_monitor); #endif - +#ifdef CONFIG_MELAN + iir = serial_in(info, UART_IIR); +#endif do { status = serial_inp(info, UART_LSR); #ifdef SERIAL_DEBUG_INTR @@ -909,10 +917,24 @@ if (status & UART_LSR_DR) receive_chars(info, &status, regs); check_modem_status(info); + +#ifdef CONFIG_M_ELAN + /* + * There is a bug in the UART on the AMD Elan SC4x0 + * embedded processor series; the THRE bit of the line + * status register seems to be delayed one bit clock after + * the interrupt is generated, so kludge this if the + * IIR indicates a Transmit Holding Register Interrupt + * + */ + if (status & UART_LSR_THRE || (iir & UART_IIR_ID) == UART_IIR_THRI) + transmit_chars(info, 0); +#else if (status & UART_LSR_THRE) transmit_chars(info, 0); +#endif if (pass_counter++ > RS_ISR_PASS_LIMIT) { -#if 0 +#ifdef SERIAL_DEBUG_INTR printk("rs_single loop break.\n"); #endif break; diff -X kernel-patches/dontdiff -urN linux-2.4.17/include/asm-i386/timex.h linux-2.4.17-elan/include/asm-i386/timex.h --- linux-2.4.17/include/asm-i386/timex.h Thu Nov 22 20:46:18 2001 +++ linux-2.4.17-elan/include/asm-i386/timex.h Mon Dec 31 19:08:27 2001 @@ -9,7 +9,12 @@ #include #include -#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ +#ifdef CONFIG_MELAN +# define CLOCK_TICK_RATE 1189200 /* AMD Elan has different frequency! */ +#else +# define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ +#endif + #define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ #define FINETUNE ((((((long)LATCH * HZ - CLOCK_TICK_RATE) << SHIFT_HZ) * \ (1000000/CLOCK_TICK_FACTOR) / (CLOCK_TICK_RATE/CLOCK_TICK_FACTOR)) \