sbcv2: Add support for timer hack mode (DSR wired to a 10Hz clock)
authorAlan Cox <alan@linux.intel.com>
Sat, 25 Aug 2018 20:57:07 +0000 (21:57 +0100)
committerAlan Cox <alan@linux.intel.com>
Sat, 25 Aug 2018 20:57:07 +0000 (21:57 +0100)
Specify timermsr on the command line for this and the kernel will instead of
polling the timers look for DSR signal events on the UART, effectively using
the UART as an interrupt controller.

Still need to support routing ECB interrupts this way.

Kernel/platform-sbcv2/discard.c
Kernel/platform-sbcv2/main.c

index 784017a..3703edc 100644 (file)
@@ -9,6 +9,15 @@
 
 extern int strcmp(const char *, const char *);
 
+/* Could move to discard */
+uint8_t platform_param(unsigned char *p)
+{
+       used(p);
+       if (strcmp(p, "msr") == 0)
+               timermsr = 1;
+       return 0;
+}
+
 void map_init(void)
 {
 }
@@ -21,14 +30,6 @@ void pagemap_init(void)
                pagemap_add(i);
 }
 
-uint8_t platform_param(char *p)
-{
-       if (strcmp(p, "compumuse") == 0) {
-               return 1;
-       }
-       return 0;
-}
-
 void platform_swap_found(uint8_t letter, uint8_t m)
 {
   blkdev_t *blk = blk_op.blkdev;
index f01f9cc..4de9430 100644 (file)
@@ -8,6 +8,7 @@
 
 uint16_t ramtop = PROGTOP;
 uint16_t swap_dev = 0xFFFF;
+uint8_t timermsr = 0;
 
 /* On idle we spin checking for the terminals. Gives us more responsiveness
    for the polled ports */
@@ -21,7 +22,6 @@ void platform_idle(void)
 
 void platform_interrupt(void)
 {
-       /* TODO */
        tty_poll();
 }
 
@@ -73,23 +73,25 @@ void sync_clock_read(void)
 
 void sync_clock(void)
 {
-       irqflags_t irq = di();
-       int16_t tmp;
-       if (!re_enter++) {
-               sync_clock_read();
-               if (oldticks != 0xFF) {
-                       tmp = newticks - oldticks;
-                       if (tmp < 0)
-                               tmp += 60;
-                       tmp *= 10;
-                       while(tmp--) {
-                               timer_interrupt();
+       if (!timermsr) {
+               irqflags_t irq = di();
+               int16_t tmp;
+               if (!re_enter++) {
+                       sync_clock_read();
+                       if (oldticks != 0xFF) {
+                               tmp = newticks - oldticks;
+                               if (tmp < 0)
+                                       tmp += 60;
+                               tmp *= 10;
+                               while(tmp--) {
+                                       timer_interrupt();
+                               }
+                               platform_interrupt();
                        }
-                       platform_interrupt();
-               }
-               re_enter--;
-       } 
-       irqrestore(irq);
+                       re_enter--;
+               } 
+               irqrestore(irq);
+       }
 }
 
 void update_sync_clock(void)