linc80: support SD cards on PIO port B
authorAlan Cox <alan@linux.intel.com>
Tue, 8 Jan 2019 01:02:04 +0000 (01:02 +0000)
committerAlan Cox <alan@linux.intel.com>
Tue, 8 Jan 2019 01:02:04 +0000 (01:02 +0000)
5v to 3.3v convertors obviously required!

Kernel/platform-linc80/Makefile
Kernel/platform-linc80/config.h
Kernel/platform-linc80/discard.c
Kernel/platform-linc80/fuzix.lnk
Kernel/platform-linc80/kernel.def

index 6b5c584..bb5edf3 100644 (file)
@@ -1,8 +1,8 @@
-ASRCS = crt0.s tricks.s commonmem.s linc80.s
-CSRCS = devices.c main.c devtty.c
+ASRCS = crt0.s tricks.s commonmem.s linc80.s piospi.s
+CSRCS = devices.c main.c devtty.c sd.c
 DISCARD_CSRCS = discard.c
-DISCARD_DSRCS = ../dev/devide_discard.c
-DSRCS = ../dev/devide.c ../dev/mbr.c ../dev/blkdev.c
+DISCARD_DSRCS = ../dev/devide_discard.c ../dev/devsd_discard.c
+DSRCS = ../dev/devide.c ../dev/mbr.c ../dev/blkdev.c ../dev/devsd.c
 NSRCS = 
 
 AOBJS = $(ASRCS:.s=.rel)
@@ -48,3 +48,5 @@ loader.bin: loader.s
        sdldz80 -i loader.rel
        makebin -s 65536 loader.ihx loader.tmp
        dd if=loader.tmp bs=256 skip=208 of=loader.bin
+
+piospi.rel: ../dev/z80softspi.s
index fa23cee..15e3fbe 100644 (file)
@@ -52,10 +52,13 @@ extern unsigned int swap_dev;
 #define NBUFS    4        /* Number of block buffers, keep in line with space reserved in zeta-v2.s */
 #define NMOUNTS         2        /* Number of mounts at a time */
 
-#define MAX_BLKDEV 1       /* 1 IDE for now */
+#define MAX_BLKDEV 3       /* 3 IDE + 2 x SD for now */
 
 /* IDE/CF support */
 #define CONFIG_IDE
+#define CONFIG_SD
+
+#define SD_DRIVE_COUNT         2
 
 /* Device parameters */
 #define NUM_DEV_TTY 2
@@ -67,3 +70,5 @@ extern unsigned int swap_dev;
 #define TTYDEV   BOOT_TTY /* Device used by kernel for messages, panics */
 
 #define platform_copyright()
+
+#define SD_SPI_CALLTYPE __z88dk_fastcall
index 3b5281f..0b0ccd8 100644 (file)
@@ -2,11 +2,13 @@
 #include <kdata.h>
 #include <printf.h>
 #include <devtty.h>
-#include <ds1302.h>
 #include <devide.h>
+#include <devsd.h>
 #include <blkdev.h>
 #include "config.h"
 
+extern void pio_setup(void);
+
 void map_init(void)
 {
 }
@@ -34,7 +36,11 @@ void platform_swap_found(uint8_t letter, uint8_t m)
 
 void device_init(void)
 {
+        pio_setup();
 #ifdef CONFIG_IDE
        devide_init();
 #endif
+#ifdef CONFIG_SD
+       devsd_init();
+#endif
 }
index 4c22ca5..67cca01 100644 (file)
@@ -37,4 +37,8 @@ platform-linc80/mbr.rel
 platform-linc80/blkdev.rel
 platform-linc80/devide.rel
 platform-linc80/devide_discard.rel
+platform-linc80/devsd.rel
+platform-linc80/devsd_discard.rel
+platform-linc80/sd.rel
+platform-linc80/piospi.rel
 -e
index c4764f7..636b59f 100644 (file)
@@ -30,3 +30,5 @@ CTC_CH3               .equ    0x0B    ; CTC channel 3
 
 NBUFS          .equ    4
 
+SPI_DATA       .equ    0x04
+SPI_CLOCK      .equ    0x02