Fixes a couple of errors in MTD NAND logic

This commit is contained in:
Gregory Nutt 2013-11-27 15:02:21 -06:00
parent afb0209207
commit 881c12cad8
2 changed files with 4 additions and 4 deletions

View File

@ -904,14 +904,14 @@ FAR struct mtd_dev_s *nand_initialize(FAR struct nand_raw_s *raw)
size = (uint64_t)onfi.pagesperblock *
(uint64_t)onfi.blocksperlun *
(uint64_t)onfi.pagesize;
DEBUGASSERT(size < (uint64_t)(1 << 21));
DEBUGASSERT(size < ((uint64_t)1 << 36));
model->devsize = (uint16_t)(size >> 20);
size = (uint64_t)onfi.pagesperblock *
(uint64_t)onfi.pagesize;
DEBUGASSERT(size < (uint64_t)(1 << 11));
DEBUGASSERT(size < ((uint64_t)1 << 26));
model->blocksize = (uint16_t)(size >> 10);
switch (onfi.pagesize)

View File

@ -282,7 +282,7 @@ int onfi_read(uintptr_t cmdaddr, uintptr_t addraddr, uintptr_t dataaddr,
fvdbg("cmdaddr=%08x addraddr=%08x dataaddr=%08x\n",
(int)cmdaddr, (int)addraddr, (int)dataaddr);
if (onfi_compatible(cmdaddr, addraddr, dataaddr))
if (!onfi_compatible(cmdaddr, addraddr, dataaddr))
{
fdbg("ERROR: No ONFI compatible device detected\n");
return -ENODEV;
@ -457,7 +457,7 @@ bool onfi_ebidetect(uintptr_t cmdaddr, uintptr_t addraddr,
{
uint32_t timer;
uint8_t rc;
bool found = 0;
bool found = false;
uint8_t ids[4];
uint8_t i;