Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New cypress chips #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bscan_spi/xc6s_cs484.ucf
Original file line number Diff line number Diff line change
@@ -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";
Binary file added bscan_spi/xc6slx150-cs484.bit
Binary file not shown.
40 changes: 40 additions & 0 deletions progalgspiflash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions progalgspiflash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down