diff --git a/bscan_spi/xc6s_cs484.ucf b/bscan_spi/xc6s_cs484.ucf new file mode 100644 index 0000000..2526183 --- /dev/null +++ b/bscan_spi/xc6s_cs484.ucf @@ -0,0 +1,7 @@ +CONFIG VCCAUX = 3.3; +NET "*" IOSTANDARD = LVCMOS33; + +net "MISO" LOC = "Y17"; +net "MOSI" LOC = "AB17"; +net "DRCK1" LOC= "W17"; +net "CSB" LOC = "AB5"; diff --git a/bscan_spi/xc6slx150-cs484.bit b/bscan_spi/xc6slx150-cs484.bit new file mode 100644 index 0000000..c638d45 Binary files /dev/null and b/bscan_spi/xc6slx150-cs484.bit differ diff --git a/progalgspiflash.cpp b/progalgspiflash.cpp index 32a746f..92d199a 100644 --- a/progalgspiflash.cpp +++ b/progalgspiflash.cpp @@ -532,6 +532,42 @@ int ProgAlgSPIFlash::spi_flashinfo_issi(unsigned char *buf) return 1; } +int ProgAlgSPIFlash::spi_flashinfo_cypress(unsigned char *buf) +{ + + sector_size = 4096; + sector_erase_cmd = 0x20; + pgsize = 256; + + switch (buf[1]) + { + case 0x60: + switch (buf[2]) + { + case 0x18: // 128Mbit + pages = 65536; + break; + + case 0x19: // 256Mbit + pages = 131072; + break; + + default: + fprintf(stderr,"Cypress: Unexpected Device ID 0x%02x\n", buf[2]); + return -1; + } + fprintf(stderr, "Found Spansion/Cypress Device, Device ID 0x%02x%02x\n", + buf[1], buf[2]); + break; + + default: + fprintf(stderr,"Cypress: Unexpected upper Device ID 0x%02x\n", buf[1]); + return -1; + } + + return 1; +} + int ProgAlgSPIFlash::spi_flashinfo(void) { byte fbuf[8]={READ_IDENTIFICATION, 0, 0, 0, 0, 0, 0, 0}; @@ -597,6 +633,9 @@ int ProgAlgSPIFlash::spi_flashinfo(void) case 0xbf: res = spi_flashinfo_sst(fbuf); break; + case 0x01: + res = spi_flashinfo_cypress(fbuf); + break; default: fprintf(stderr, "unknown JEDEC manufacturer: %02x\n",fbuf[0]); return -1; @@ -1248,6 +1287,7 @@ int ProgAlgSPIFlash::program(BitFile &pfile) case 0x9d: /* ISSI */ case 0xef: /* Winbond */ case 0x89: /* Intel S33 */ + case 0x01: /* Spansion / Cypress */ return sectorerase_and_program(pfile); case 0xbf: return program_sst(pfile); diff --git a/progalgspiflash.h b/progalgspiflash.h index 103343a..0e7f2c5 100644 --- a/progalgspiflash.h +++ b/progalgspiflash.h @@ -68,6 +68,7 @@ class ProgAlgSPIFlash int spi_flashinfo_at45(unsigned char * fbuf); int spi_flashinfo_m25p_mx25l(unsigned char * fbuf, int is_mx25l); int spi_flashinfo_sst(unsigned char * fbuf); + int spi_flashinfo_cypress(unsigned char * fbuf); int wait(byte command, int report, int limit, double *delta); int wait(byte command, byte mask, byte value, int report, int limit, double *delta); int program_at45(BitFile &file);