4 * This file is part of BeRTOS.
6 * Bertos is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * As a special exception, you may use this file as part of a free software
21 * library without restriction. Specifically, if other files instantiate
22 * templates or use macros or inline functions from this file, or you compile
23 * this file and link it with other files to produce an executable, this
24 * file does not by itself cause the resulting executable to be covered by
25 * the GNU General Public License. This exception does not however
26 * invalidate any other reasons why the executable file might be covered by
27 * the GNU General Public License.
29 * Copyright 2011 Develer S.r.l. (http://www.develer.com/)
33 * \brief Micron MT29F serial NAND driver for SAM3's static memory controller (interface).
35 * \author Stefano Fedrigo <aleph@develer.com>
41 #include <drv/mt29f.h>
44 // MT29F2G08AAD, FIXME: configurable
45 #define MT29F_DATA_SIZE 0x800 // 2048 B
46 #define MT29F_SPARE_SIZE 0x40 // 64 B
47 #define MT29F_PAGE_SIZE (MT29F_DATA_SIZE + MT29F_SPARE_SIZE)
48 #define MT29F_PAGES_PER_BLOCK 64
49 #define MT29F_BLOCK_SIZE (MT29F_DATA_SIZE * MT29F_PAGES_PER_BLOCK)
50 #define MT29F_NUM_BLOCKS 2048
51 #define MT29F_ECC_NWORDS (MT29F_DATA_SIZE / 256)
52 #define MT29F_REMAP_TAG_OFFSET 0x38
53 #define MT29F_REMAP_TAG 0x3e10c8ed
55 // Number of reserved block for remapping
56 #define MT29F_NUM_REMAP_BLOCKS 128
57 // Number of usable blocks, and index of first remapping block
58 #define MT29F_NUM_USER_BLOCKS (MT29F_NUM_BLOCKS - MT29F_NUM_REMAP_BLOCKS)
64 #define MT29F_PIN_CE BV(6)
65 #define MT29F_PIN_RB BV(2)
66 #define MT29F_PINS_PORTA (MT29F_PIN_CE | MT29F_PIN_RB)
67 #define MT29F_PERIPH_PORTA PIO_PERIPH_B
69 #define MT29F_PIN_OE BV(19)
70 #define MT29F_PIN_WE BV(20)
71 #define MT29F_PIN_IO 0x0000FFFF
72 #define MT29F_PINS_PORTC (MT29F_PIN_OE | MT29F_PIN_WE | MT29F_PIN_IO)
73 #define MT29F_PERIPH_PORTC PIO_PERIPH_A
75 #define MT29F_PIN_CLE BV(9)
76 #define MT29F_PIN_ALE BV(8)
77 #define MT29F_PINS_PORTD (MT29F_PIN_CLE | MT29F_PIN_ALE)
78 #define MT29F_PERIPH_PORTD PIO_PERIPH_A
81 #endif /* MT29F_SAM3_H */