From: aleph Date: Tue, 19 Apr 2011 17:04:19 +0000 (+0000) Subject: mt29f NAND driver: fix I/O pin numbers and row/column addressing. X-Git-Tag: 2.7.0~104 X-Git-Url: https://codewiz.org/gitweb?p=bertos.git;a=commitdiff_plain;h=b13dbf31d82c002be6169e7cba5923c9970f5267 mt29f NAND driver: fix I/O pin numbers and row/column addressing. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4862 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/bertos/cpu/cortex-m3/drv/mt29f_sam3.c b/bertos/cpu/cortex-m3/drv/mt29f_sam3.c index 2754f13f..25d4537b 100644 --- a/bertos/cpu/cortex-m3/drv/mt29f_sam3.c +++ b/bertos/cpu/cortex-m3/drv/mt29f_sam3.c @@ -110,15 +110,10 @@ struct Mt29fHardware */ static void mt29f_getAddrCycles(block_idx_t page, size_t offset, uint32_t *cycle0, uint32_t *cycle1234) { - uint32_t addr = (page * MT29F_PAGE_SIZE) + offset; + ASSERT(offset < MT29F_PAGE_SIZE); - /* - * offset nibbles 77776666 55554444 33332222 11110000 - * cycle1234 -------7 66665555 ----4444 33332222 - * cycle0 11110000 - */ - *cycle0 = addr & 0xff; - *cycle1234 = ((addr >> 8) & 0x00000fff) | ((addr >> 4) & 0x01ff0000); + *cycle0 = offset & 0xff; + *cycle1234 = (page << 8) | ((offset >> 8) & 0xf); LOG_INFO("mt29f addr: %lx %lx\n", *cycle1234, *cycle0); } @@ -251,9 +246,6 @@ int mt29f_blockErase(Mt29f *fls, block_idx_t page) */ bool mt29f_getDevId(Mt29f *fls, uint8_t dev_id[5]) { - memset(dev_id, 0x66, 5); - memset((void *)NFC_SRAM_BASE_ADDR, 0x77, 2048); - mt29f_sendCommand( NFC_CMD_NFCCMD | NFC_CMD_NFCEN | MT29F_CSID | NFC_CMD_ACYCLE_ONE | MT29F_CMD_READID << 2, diff --git a/bertos/cpu/cortex-m3/drv/mt29f_sam3.h b/bertos/cpu/cortex-m3/drv/mt29f_sam3.h index 06a582ba..2d2d7353 100644 --- a/bertos/cpu/cortex-m3/drv/mt29f_sam3.h +++ b/bertos/cpu/cortex-m3/drv/mt29f_sam3.h @@ -61,8 +61,8 @@ #define MT29F_PINS_PORTC (MT29F_PIN_OE | MT29F_PIN_WE | MT29F_PIN_IO) #define MT29F_PERIPH_PORTC PIO_PERIPH_A -#define MT29F_PIN_CLE BV(22) -#define MT29F_PIN_ALE BV(21) +#define MT29F_PIN_CLE BV(9) +#define MT29F_PIN_ALE BV(8) #define MT29F_PINS_PORTD (MT29F_PIN_CLE | MT29F_PIN_ALE) #define MT29F_PERIPH_PORTD PIO_PERIPH_A