From: Alan Cox Date: Thu, 4 Jun 2015 22:01:53 +0000 (+0100) Subject: dragon-nx32: turn on the SPI driver logic X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=95a7237174d7e25d9a84bb966f93b87e0fe2007b;p=FUZIX.git dragon-nx32: turn on the SPI driver logic We probe carefully for the 65SPI so hopefully that'll prove to be safe enough in the real world too --- diff --git a/Kernel/platform-dragon-nx32/Makefile b/Kernel/platform-dragon-nx32/Makefile index 9e1a94f9..faffc344 100644 --- a/Kernel/platform-dragon-nx32/Makefile +++ b/Kernel/platform-dragon-nx32/Makefile @@ -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 diff --git a/Kernel/platform-dragon-nx32/config.h b/Kernel/platform-dragon-nx32/config.h index 2632fea9..6f776569 100644 --- a/Kernel/platform-dragon-nx32/config.h +++ b/Kernel/platform-dragon-nx32/config.h @@ -25,10 +25,11 @@ /* 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 diff --git a/Kernel/platform-dragon-nx32/device.h b/Kernel/platform-dragon-nx32/device.h index 2e2a3e20..e57c6a38 100644 --- a/Kernel/platform-dragon-nx32/device.h +++ b/Kernel/platform-dragon-nx32/device.h @@ -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__ */ diff --git a/Kernel/platform-dragon-nx32/devices.c b/Kernel/platform-dragon-nx32/devices.c index 556fd548..b8671d30 100644 --- a/Kernel/platform-dragon-nx32/devices.c +++ b/Kernel/platform-dragon-nx32/devices.c @@ -11,6 +11,8 @@ #include #include #include +#include +#include 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(); }