Hi, I recently found some docs for 53c770 chip and after bit of hacking I have now a SCSI driver for the MKIII board, that even seems to work quite well. :) It needs a little more cleaning up, but if anyone wants to try it out here it goes. BTW if someone has docs for the 53c720, I'd be happy about it so I can clean the driver a little up, as there a few register differences and I don't know if they are old 8xx stuff or real. bye, Roman --- drivers/scsi/Kconfig | 8 ++ drivers/scsi/Makefile | 2 drivers/scsi/cyberstormIII.c | 128 +++++++++++++++++++++++++++++++++++++++++++ drivers/scsi/ncr53c8xx.c | 10 ++- drivers/scsi/ncr53c8xx.h | 27 +++------ 5 files changed, 157 insertions(+), 18 deletions(-) Index: linux-2.6/drivers/scsi/Kconfig =================================================================== --- linux-2.6.orig/drivers/scsi/Kconfig +++ linux-2.6/drivers/scsi/Kconfig @@ -1601,6 +1601,14 @@ config CYBERSTORMII_SCSI and the optional Cyberstorm SCSI controller, say Y. Otherwise, answer N. +config CYBERSTORMIII_SCSI + tristate "CyberStorm Mk III SCSI support" + depends on ZORRO && SCSI + help + If you have an Amiga with a Phase5 Cyberstorm MkII accelerator board + and the Cyberstorm SCSI controller, say Y. Otherwise, + answer N. + config BLZ2060_SCSI tristate "Blizzard 2060 SCSI support" depends on ZORRO && SCSI Index: linux-2.6/drivers/scsi/Makefile =================================================================== --- linux-2.6.orig/drivers/scsi/Makefile +++ linux-2.6/drivers/scsi/Makefile @@ -46,6 +46,7 @@ obj-$(CONFIG_MVME147_SCSI) += mvme147.o obj-$(CONFIG_SGIWD93_SCSI) += sgiwd93.o wd33c93.o obj-$(CONFIG_CYBERSTORM_SCSI) += NCR53C9x.o cyberstorm.o obj-$(CONFIG_CYBERSTORMII_SCSI) += NCR53C9x.o cyberstormII.o +obj-$(CONFIG_CYBERSTORMIII_SCSI) += cyberstormIII_mod.o obj-$(CONFIG_BLZ2060_SCSI) += NCR53C9x.o blz2060.o obj-$(CONFIG_BLZ1230_SCSI) += NCR53C9x.o blz1230.o obj-$(CONFIG_FASTLANE_SCSI) += NCR53C9x.o fastlane.o @@ -166,6 +167,7 @@ ncr53c8xx-flags-$(CONFIG_SCSI_ZALON) \ CFLAGS_ncr53c8xx.o := $(ncr53c8xx-flags-y) $(ncr53c8xx-flags-m) zalon7xx-objs := zalon.o ncr53c8xx.o NCR_Q720_mod-objs := NCR_Q720.o ncr53c8xx.o +cyberstormIII_mod-objs := cyberstormIII.o ncr53c8xx.o oktagon_esp_mod-objs := oktagon_esp.o oktagon_io.o # Files generated that shall be removed upon make clean Index: linux-2.6/drivers/scsi/cyberstormIII.c =================================================================== --- /dev/null +++ linux-2.6/drivers/scsi/cyberstormIII.c @@ -0,0 +1,128 @@ +#include <linux/module.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/zorro.h> + +#include <asm/amigahw.h> +#include <asm/amigaints.h> + +#include "ncr53c8xx.h" + +#define CSIII_BASE ZTWO_VADDR(0x00f60000) +#define CSIII_REG_RESET (CSIII_BASE + 0x00) +#define CSIII_REG_IRQ (CSIII_BASE + 0x08) +#define CSIII_REG_WAITSTATE (CSIII_BASE + 0x10) +#define CSIII_REG_SHADOW (CSIII_BASE + 0x18) +#define CSIII_REG_LOCK (CSIII_BASE + 0x20) +#define CSIII_REG_INT (CSIII_BASE + 0x28) +#define CSIII_IPL_EMU (CSIII_BASE + 0x30) +#define CSIII_INT_LVL (CSIII_BASE + 0x38) + + +static struct scsi_host_template csIII_host_template = { + .module = THIS_MODULE, + .proc_name = "cyberstormIII", + .name = "CyberStorm III SCSI", +}; + +static struct ncr_chip csIII_chip = { + .burst_max = 4, + .offset_max = 8, + .nr_divisor = 5, + .features = FE_WIDE | FE_EA | FE_ULTRA | FE_RAM, +}; + +irqreturn_t csIII_interrupt(int irq, void *dev_id) +{ + if (!(raw_inb(CSIII_REG_IRQ) & 1)) + return ncr53c8xx_intr(irq, dev_id); + return IRQ_NONE; +} + +static int __devinit csIII_probe(struct zorro_dev *dev, + const struct zorro_device_id *ent) +{ + struct Scsi_Host *host; + struct ncr_device device; + int res = -ENODEV; + + memset(&device, 0, sizeof(struct ncr_device)); + device.chip = csIII_chip; + device.host_id = 7; + device.dev = &dev->dev; + device.slot.base = 0xf40000; + device.slot.base_v = (void *)ZTWO_VADDR(0xf40000); + device.slot.base_2 = 0xf41000; + device.slot.base_2_v = (void *)ZTWO_VADDR(0xf41000); + device.slot.irq = IRQ_AMIGA_PORTS; + + host = ncr_attach(&csIII_host_template, 0, &device); + if (!host) + goto fail; + + res = request_irq(IRQ_AMIGA_PORTS, csIII_interrupt, IRQF_SHARED, "CyberStorm III SCSI", host); + if (res) + goto fail_detach; + + raw_outb(0x84, CSIII_REG_IRQ); + raw_outb(0x02, CSIII_REG_IRQ); + dev_set_drvdata(&dev->dev, host); + + res = scsi_add_host(host, &dev->dev); + if (res) + goto fail_free_irq; + scsi_scan_host(host); + + return 0; + +fail_free_irq: + free_irq(IRQ_AMIGA_PORTS, host); +fail_detach: + ncr53c8xx_release(host); +fail: + return -ENODEV; +} + +static int __exit csIII_remove(struct zorro_dev *dev) +{ + struct Scsi_Host *host = dev_get_drvdata(&dev->dev); + + scsi_remove_host(host); + ncr53c8xx_release(host); + free_irq(IRQ_AMIGA_PORTS, host); + + return 0; +} + +static struct zorro_device_id csIII_zorro_tbl[] __devinitdata = { + { ZORRO_PROD_PHASE5_CYBERSTORM_MK_III , }, + { 0 } +}; + +static struct zorro_driver csIII_driver = { + .name = "CyberStorm III SCSI", + .id_table = csIII_zorro_tbl, + .probe = csIII_probe, + .remove = __devexit_p(csIII_remove), +}; + +static int __init csIII_init(void) +{ + int ret = ncr53c8xx_init(); + if (!ret) + ret = zorro_register_driver(&csIII_driver); + if (ret) + ncr53c8xx_exit(); + return ret; +} + +static void __exit csIII_exit(void) +{ + zorro_unregister_driver(&csIII_driver); + ncr53c8xx_exit(); +} + +module_init(csIII_init); +module_exit(csIII_exit); + +MODULE_LICENSE("GPL"); Index: linux-2.6/drivers/scsi/ncr53c8xx.c =================================================================== --- linux-2.6.orig/drivers/scsi/ncr53c8xx.c +++ linux-2.6/drivers/scsi/ncr53c8xx.c @@ -194,7 +194,7 @@ static inline struct list_head *ncr_list #if PAGE_SIZE >= 8192 #define MEMO_PAGE_ORDER 0 /* 1 PAGE maximum */ #else -#define MEMO_PAGE_ORDER 1 /* 2 PAGES maximum */ +#define MEMO_PAGE_ORDER 0 /* 2 PAGES maximum */ #endif #define MEMO_FREE_UNUSED /* Free unused pages immediately */ #define MEMO_WARN 1 @@ -1749,6 +1749,7 @@ struct ncb { ** written with a SCR_COPY script command. **---------------------------------------------------------------- */ + char dummy1[0] __attribute__ ((aligned (4))); u_char msgout[8]; /* Buffer for MESSAGE OUT */ u_char msgin [8]; /* Buffer for MESSAGE IN */ u32 lastmsg; /* Last SCSI message sent */ @@ -1762,6 +1763,7 @@ struct ncb { u_char scsi_mode; /* Current SCSI BUS mode */ u_char order; /* Tag order to use */ u_char verbose; /* Verbosity for this controller*/ + char dummy2[0] __attribute__ ((aligned (4))); int ncr_cache; /* Used for cache test at init. */ u_long p_ncb; /* BUS address of this NCB */ @@ -1770,6 +1772,7 @@ struct ncb { **---------------------------------------------------------------- */ #ifdef SCSI_NCR_CCB_DONE_SUPPORT + char dummy3[0] __attribute__ ((aligned (4))); struct ccb *(ccb_done[MAX_DONE]); int ccb_done_ic; #endif @@ -3761,7 +3764,7 @@ static inline void ncr_init_burst(struct } else { --bc; np->rv_dmode |= ((bc & 0x3) << 6); - np->rv_ctest5 |= (bc & 0x4); + np->rv_ctest5 |= 0x4; } } @@ -3800,6 +3803,7 @@ static void __init ncr_prepare_setting(s np->clock_khz = 80000; else np->clock_khz = 40000; + np->clock_khz = 50000; /* * Get the clock multiplier factor. @@ -3829,6 +3833,7 @@ static void __init ncr_prepare_setting(s } } np->rv_scntl3 = i+1; + np->rv_scntl3 = 5; /* * Minimum synchronous period factor supported by the chip. @@ -3903,6 +3908,7 @@ static void __init ncr_prepare_setting(s np->rv_dcntl |= EA; /* Enable ACK */ if (np->features & FE_EHP) np->rv_ctest0 |= EHP; /* Even host parity */ + np->rv_ctest5 |= 0x04; /* ** Select some other Index: linux-2.6/drivers/scsi/ncr53c8xx.h =================================================================== --- linux-2.6.orig/drivers/scsi/ncr53c8xx.h +++ linux-2.6/drivers/scsi/ncr53c8xx.h @@ -55,6 +55,7 @@ #include <scsi/scsi_host.h> +#define SCSI_NCR_BIG_ENDIAN /* ** If you want a driver as small as possible, donnot define the @@ -172,20 +173,20 @@ /* * Disable master parity checking (flawed hardwares need that) */ -#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK +//#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_MPARITY_CHECK #define SCSI_NCR_SETUP_MASTER_PARITY (0) -#else -#define SCSI_NCR_SETUP_MASTER_PARITY (1) -#endif +//#else +//#define SCSI_NCR_SETUP_MASTER_PARITY (1) +//#endif /* * Disable scsi parity checking (flawed devices may need that) */ -#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK +//#ifdef CONFIG_SCSI_NCR53C8XX_DISABLE_PARITY_CHECK #define SCSI_NCR_SETUP_SCSI_PARITY (0) -#else -#define SCSI_NCR_SETUP_SCSI_PARITY (1) -#endif +//#else +//#define SCSI_NCR_SETUP_SCSI_PARITY (1) +//#endif /* * Settle time after reset at boot-up @@ -321,12 +322,6 @@ #endif -#if !defined(__hppa__) && !defined(__mips__) -#ifdef SCSI_NCR_BIG_ENDIAN -#error "The NCR in BIG ENDIAN addressing mode is not (yet) supported" -#endif -#endif - #define MEMORY_BARRIER() mb() @@ -561,10 +556,10 @@ struct ncr_driver_setup { 0, \ 0, \ 1, \ - 0, \ + 15, \ SCSI_NCR_SETUP_DEFAULT_TAGS, \ SCSI_NCR_SETUP_DEFAULT_SYNC, \ - 0x00, \ + 0xff, \ 7, \ 0, \ 1, \ - To unsubscribe from this list: send the line "unsubscribe linux-m68k" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html