dragon-nx32: turn on the SPI driver logic
authorAlan Cox <alan@linux.intel.com>
Thu, 4 Jun 2015 22:01:53 +0000 (23:01 +0100)
committerAlan Cox <alan@linux.intel.com>
Thu, 4 Jun 2015 22:01:53 +0000 (23:01 +0100)
We probe carefully for the 65SPI so hopefully that'll prove to be safe
enough in the real world too

Kernel/platform-dragon-nx32/Makefile
Kernel/platform-dragon-nx32/config.h
Kernel/platform-dragon-nx32/device.h
Kernel/platform-dragon-nx32/devices.c

index 9e1a94f..faffc34 100644 (file)
@@ -3,9 +3,10 @@ CSRCS = devlpr.c devtty.c devfd.c
 CSRCS += devices.c main.c libc.c
 
 DSRCS = ../dev/devdw.c ../dev/blkdev.c ../dev/devide.c \
-        ../dev/devide_discard.c ../dev/mbr.c
+        ../dev/devide_discard.c ../dev/mbr.c \
+        ../dev/devsd.c ../dev/devsd_discard.c
 
-ASRCS = crt0.s dragon.s mem-nx32.s video.s ide.s
+ASRCS = crt0.s dragon.s mem-nx32.s video.s ide.s spi.s
 ASRCS += tricks.s commonmem.s usermem_sam.s floppy.s drivewire.s
 
 COBJS = $(CSRCS:.c=$(BINEXT))
@@ -42,5 +43,6 @@ image:
        ../syscall_proc.o ../syscall_other.o ../mm.o ../swap.o \
        ../tty.o ../devsys.o ../usermem.o ../syscall_fs2.o ../syscall_exec16.o \
        devlpr.o devtty.o libc.o ../vt.o video.o ../font8x8.o \
-       devide.o blkdev.o ide.o devide_discard.o mbr.o
+       devide.o blkdev.o ide.o devide_discard.o mbr.o \
+       devsd.o devsd_discard.o spi.o
        ../tools/pad256 ../fuzix.bin
index 2632fea..6f77656 100644 (file)
 /* Permit large I/O requests to bypass cache and go direct to userspace */
 #define CONFIG_LARGE_IO_DIRECT
 
-#define MAX_BLKDEV  2              /* 2 IDE drives */
-#define DEVICE_IDE                  /* enable if IDE interface present */
+#define MAX_BLKDEV     3       /* 2 IDE drives + 1 SPI */
+#define SD_DRIVE_COUNT 1       /* Could be higher with multiple CS used */
+#define DEVICE_IDE              /* enable if IDE interface present */
 #define IDE_REG_CS1_BASE 0xFF50
-#define IDE_IS_MMIO  1             /* MMIO IDE */
+#define IDE_IS_MMIO  1         /* MMIO IDE */
 
 /* Video terminal, not a serial tty */
 #define CONFIG_VT
index 2e2a3e2..e57c6a3 100644 (file)
@@ -2,5 +2,10 @@
 #define __DEVICE_DOT_H__
 
 extern uint8_t system_id;
+extern uint8_t mpi_present(void);
+extern uint8_t mpi_set_slot(uint8_t slot);
+extern uint16_t cart_hash(void);
+
+extern uint8_t spi_setup(void);
 
 #endif /* __DEVICE_DOT_H__ */
index 556fd54..b8671d3 100644 (file)
@@ -11,6 +11,8 @@
 #include <devtty.h>
 #include <blkdev.h>
 #include <devide.h>
+#include <devsd.h>
+#include <device.h>
 
 struct devsw dev_tab[] =  /* The device driver switch table */
 {
@@ -46,5 +48,7 @@ bool validdev(uint16_t dev)
 
 void device_init(void)
 {
+    if (spi_setup())
+        devsd_init();
     devide_init();
 }