Alex Lennon wrote:
> 
> >> hello... has anyone ever tried to install any form of embedded linux on a
> >> sc400-based device?
> >> i have a wyse winterm that is powered by a sc400...
> 
> >Overall it will work great.  I have a sc400 system running off a 16 meg MTD
> >drive with Linux 2.2.18. We have a muli-user system with FTP, Telnet, HTTP
> >servers, a minimal file system, ftp and telnet clients, some proprietary
> >software, and glibc all for 3.2Meg.
> 
> >There is a bug in the serial port and you need a patch for that if you are
> >running it directly off the chip.  I'm not sure where we found the patch,
> but
> >if you have trouble let met know.
> 
> Also, depending on the board design you are using there is a possibility
> (probability?) that the system timer is counting at the wrong rate. There
> is a patch for this around somewhere as well.

Patch enclosed for the serial port and the timer.
It was made for 2.2.15 but works on 2.2.18 as well (applying the patch
to 2.2.18 produces two warnings that can be ignored).

cheers
Anders
-- 
"In theory there is no difference between theory and practice.
 In practice there is." - Yogi Berra
diff -u --recursive v2.2.15/Documentation/Configure.help 
linux/Documentation/Configure.help
--- v2.2.15/Documentation/Configure.help        Thu May  4 11:28:17 2000
+++ linux/Documentation/Configure.help  Thu May  4 13:04:18 2000
@@ -1648,6 +1648,11 @@
      class machine.
    - "486" for the AMD/Cyrix/IBM/Intel DX4 or 486DX/DX2/SL/SX/SX2,
      AMD/Cyrix 5x86, NexGen Nx586 and UMC U5D or U5S.
+   - "SC4x0" for the AMD Elan SC400 and SC410 embedded processors.
+     These CPUs have a buggy on-chip serial interface and a non-
+     standard 8253 clock frequency.
+     Selecting this CPU type enables work-arounds, which will not
+     run correctly on any other CPU!
    - "586" for generic Pentium CPUs, possibly lacking the TSC 
      (time stamp counter) register.
    - "Pentium" for the Intel Pentium/Pentium MMX, AMD K5, K6 and 
@@ -12399,5 +12404,5 @@
 # LocalWords:  BVME BVME WRITETHROUGH copyback writethrough fwmark syncookie tu
 # LocalWords:  alphalinux GOBIOS csn chemnitz nat ACARD AMI MegaRAID megaraid
 # LocalWords:  QNX4FS ISI isicom xterms Apollos VPN RCPCI rcpci sgi visws pcmcia
-# LocalWords:  IrLPT UIRCC Tecra
+# LocalWords:  IrLPT UIRCC Tecra SC400 Elan
 
diff -u --recursive v2.2.15/arch/i386/config.in linux/arch/i386/config.in
--- v2.2.15/arch/i386/config.in Thu May  4 11:28:23 2000
+++ linux/arch/i386/config.in   Thu May  4 11:51:29 2000
@@ -14,6 +14,7 @@
 choice 'Processor family' \
        "386                    CONFIG_M386     \
         486/Cx486              CONFIG_M486     \
+        SC4x0                  CONFIG_AMD_SC400\
         586/K5/5x86/6x86       CONFIG_M586     \
         Pentium/K6/TSC         CONFIG_M586TSC  \
         PPro/6x86MX            CONFIG_M686" PPro
@@ -25,6 +26,9 @@
   define_bool CONFIG_X86_INVLPG y
   define_bool CONFIG_X86_BSWAP y
   define_bool CONFIG_X86_POPAD_OK y
+fi
+if [ "$CONFIG_AMD_SC400" = "y" ]; then
+  define_bool CONFIG_M486 y
 fi
 if [ "$CONFIG_M686" = "y" -o "$CONFIG_M586TSC" = "y" ]; then
   define_bool CONFIG_X86_TSC y
diff -u --recursive v2.2.15/arch/i386/defconfig linux/arch/i386/defconfig
--- v2.2.15/arch/i386/defconfig Thu May  4 11:28:23 2000
+++ linux/arch/i386/defconfig   Thu May  4 13:24:49 2000
@@ -12,6 +12,7 @@
 #
 # CONFIG_M386 is not set
 # CONFIG_M486 is not set
+# CONFIG_AMD_SC400 is not set
 # CONFIG_M586 is not set
 # CONFIG_M586TSC is not set
 CONFIG_M686=y
diff -u --recursive v2.2.15/drivers/char/serial.c linux/drivers/char/serial.c
--- v2.2.15/drivers/char/serial.c       Thu May  4 11:28:36 2000
+++ linux/drivers/char/serial.c Thu May  4 11:38:33 2000
@@ -622,7 +622,7 @@
                if (!info) {
                        info = IRQ_ports[irq];
                        if (pass_counter++ > RS_ISR_PASS_LIMIT) {
-#if 0
+#if SERIAL_DEBUG_INTR
                                printk("rs loop break\n");
 #endif
                                break;  /* Prevent infinite loops */
@@ -651,6 +651,7 @@
        int status;
        int pass_counter = 0;
        struct async_struct * info;
+       int iir;
 #ifdef CONFIG_SERIAL_MULTIPORT 
        int first_multi = 0;
        struct rs_multiport_struct *multi;
@@ -670,6 +671,7 @@
                first_multi = inb(multi->port_monitor);
 #endif
 
+       iir = serial_in(info, UART_IIR);
        do {
                status = serial_inp(info, UART_LSR);
 #ifdef SERIAL_DEBUG_INTR
@@ -678,15 +680,25 @@
                if (status & UART_LSR_DR)
                        receive_chars(info, &status);
                check_modem_status(info);
+#ifdef CONFIG_AMD_SC400
+               /* 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
+#if SERIAL_DEBUG_INTR
                        printk("rs_single loop break.\n");
 #endif
                        break;
                }
-       } while (!(serial_in(info, UART_IIR) & UART_IIR_NO_INT));
+       } while (!((iir = serial_in(info, UART_IIR)) & UART_IIR_NO_INT));
        info->last_active = jiffies;
 #ifdef CONFIG_SERIAL_MULTIPORT 
        if (multi->port_monitor)
diff -u --recursive v2.2.15/include/asm-i386/timex.h linux/include/asm-i386/timex.h
--- v2.2.15/include/asm-i386/timex.h    Thu May  4 11:01:16 2000
+++ linux/include/asm-i386/timex.h      Thu May  4 12:31:43 2000
@@ -9,7 +9,11 @@
 #include <linux/config.h>
 #include <asm/msr.h>
 
+#ifdef CONFIG_AMD_SC400
+#define CLOCK_TICK_RATE        1189200 /* Underlying HZ on AMD SC4x0 */
+#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)) \

Reply via email to