Browse Source

fix qspi capacity reg

Signed-off-by: surenyi <surenyi82@163.com>
master
surenyi 2 weeks ago
parent
commit
05d294b946
  1. 2
      bspStubs.c
  2. 3
      hwconf.c
  3. 11
      vxbFtQspi.c
  4. 2
      vxbLfsLib.c
  5. 5
      vxbSp25SpiFlash.c
  6. 1
      vxbSp25SpiFlash.h

2
bspStubs.c

@ -32,7 +32,7 @@ int bspLoadUserApp()
SEGMENT_ID seg;
SYMBOL_DESC symDesc;
struct stat stbuf;
MODULE_ID module = ld(1, 0, USER_APP_PATH);
MODULE_ID module;
void (*appEntry)(void) = NULL;
if (stat(USER_APP_PATH, &stbuf) != 0) {

3
hwconf.c

@ -248,7 +248,7 @@ struct vxbSpiDevInfo qspiDevTbl[] = {
struct hcfResource qspiResources[] = {
{ "regBase", HCF_RES_INT, { (void *)(0x28014000) } },
{ "capacity", HCF_RES_INT, { (void *)(QSPI_FLASH_CAP_32MB) } },
{ "clkDiv", HCF_RES_INT, { (void *)(QSPI_SCK_DIV_128) } },
{ "clkDiv", HCF_RES_INT, { (void *)(QSPI_SCK_DIV_32) } },
{ "transMode", HCF_RES_INT, { (void *)(QSPI_TRANSFER_1_1_1) } },
{ "addrMode", HCF_RES_INT, { (void *)(QSPI_ADDR_SEL_4) } },
{ "spiDev", HCF_RES_ADDR, { (void *)&qspiDevTbl[0]} },
@ -518,7 +518,6 @@ struct hcfResource lfsResources[] = {
{ "mountPoint" , HCF_RES_STRING, {(void *)TFFS_FLASH_MOUNT_POINTOT}},
{ "flashName" , HCF_RES_STRING, {(void *)TFFS_PART0_FLASH_NAME}},
{ "flashOffset", HCF_RES_INT, {(void *)(TFFS_PART0_FLASH_BOOT_SIZE)}},
{ "flashSize" , HCF_RES_INT, {(void *)((TFFS_PART0_FLASH_SIZE) - (TFFS_PART0_FLASH_BOOT_SIZE))}},
{ "autoFormat", HCF_RES_INT, {(void *)(1)}},
};
#define lfsResNum NELEMENTS(lfsResources)

11
vxbFtQspi.c

@ -294,10 +294,15 @@ LOCAL void vxbFtQspiCtrlInit
)
{
FT_QSPI_CTRL * pDrvCtrl;
UINT8 ndev;
pDrvCtrl = (FT_QSPI_CTRL *) pDev->pDrvCtrl;
CSR_WRITE_4 (pDev, REG_QSPI_CAP, CAP_FLASH_NUM(pDrvCtrl->spiDevNum) | CAP_FLASH_CAP(pDrvCtrl->capacity));
ndev = pDrvCtrl->spiDevNum & 0x3;
if (ndev > 0) {
ndev -= 1;
}
CSR_WRITE_4 (pDev, REG_QSPI_CAP, CAP_FLASH_NUM(ndev) | CAP_FLASH_CAP(pDrvCtrl->capacity));
pDrvCtrl->initDone = TRUE;
}
@ -947,12 +952,12 @@ LOCAL STATUS vxbFtQspiTransfer
vxbFtQspiFlashRegGet(pDev);
break;
case QSPI_FLASH_CMD_4BAM:
vxbFtQspiFlashRegSet(pDev);
pDrvCtrl->addrMode = QSPI_ADDR_SEL_4;
/*vxbFtQspiFlashRegSet(pDev);*/
break;
case QSPI_FLASH_CMD_4BEX:
vxbFtQspiFlashRegSet(pDev);
pDrvCtrl->addrMode = QSPI_ADDR_SEL_3;
/*vxbFtQspiFlashRegSet(pDev);*/
break;
case QSPI_FLASH_CMD_WREN:
case QSPI_FLASH_CMD_WRDI:

2
vxbLfsLib.c

@ -23,6 +23,8 @@
#define LFS_NO_ASSERT 1
#define LFS_THREADSAFE 1
#define LFS_NO_DEBUG 1
#define LFS_NO_WARN 1
#include "lfs/lfs.c"
#include "lfs/lfs_util.c"

5
vxbSp25SpiFlash.c

@ -620,7 +620,8 @@ LOCAL char * vendorGet
case SAMSUNG:
return "Samsung";
case GIGADEVICE:
return "GigaDevice";
default:
return "Unknown";
}
@ -1724,7 +1725,7 @@ LOCAL STATUS enter4BMode
break;
else
return ERROR;
case GIGADEVICE:
case MXIC:
case EON:
case WINBOND:

1
vxbSp25SpiFlash.h

@ -61,6 +61,7 @@ extern "C"
#define MXIC (0xC2) /* The manufacturer id for MXIC */
#define SAMSUNG (0xEC) /* The manufacturer id for SAMSUNG */
#define WINBOND (0xEF) /* The manufacturer id for SAMSUNG */
#define GIGADEVICE (0xC8) /* The manufacturer id for GigaDevice */
#define MISSING (0xFF)
/* Spansion SPI Flash Commands info */

Loading…
Cancel
Save