diff options
author | David Ungar <david.ungar@timesys.com> | 2010-10-11 14:24:08 -0400 |
---|---|---|
committer | David Ungar <david.ungar@timesys.com> | 2010-10-11 14:39:23 -0400 |
commit | a718de3f42a6280fefd8b60b3e4733e015b0f637 (patch) | |
tree | 1b0c5b36cd7fb408e8119d56c542f86903cc56d5 /include | |
parent | 411a2e5823bf4280d70d5b9e9ea683e27b09f7b2 (diff) |
Additional NAND support
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-arm/arch-omap3/omap_gpmc.h | 19 | ||||
-rw-r--r-- | include/asm-arm/arch-omap3/sys_proto.h | 10 | ||||
-rw-r--r-- | include/configs/omap3_logic.h | 50 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 3 | ||||
-rw-r--r-- | include/linux/mtd/nand.h | 12 | ||||
-rw-r--r-- | include/nand.h | 2 |
6 files changed, 47 insertions, 49 deletions
diff --git a/include/asm-arm/arch-omap3/omap_gpmc.h b/include/asm-arm/arch-omap3/omap_gpmc.h index bd22bce837f..c86448baa81 100644 --- a/include/asm-arm/arch-omap3/omap_gpmc.h +++ b/include/asm-arm/arch-omap3/omap_gpmc.h @@ -58,6 +58,25 @@ } #endif +/* Micron MT29F4G16ABBDA internal-to-NAND ECC layout */ +#define GPMC_NAND_CHIP_ECC_LAYOUT {\ + .eccbytes = 32,\ + .eccpos = {8, 9, 10, 11, 12, 13, 14, 15, \ + 24, 25, 26, 27, 28, 19, 30, 31, \ + 40, 41, 42, 43, 44, 45, 46, 47, \ + 56, 57, 58, 59, 60, 61, 62, 63}, \ + .oobfree = {\ + {.offset = 4,\ + .length = 4 },\ + {.offset = 20,\ + .length = 4 },\ + {.offset = 36,\ + .length = 4 },\ + {.offset = 52,\ + .length = 4 },\ + } \ +}; + /* Small Page x8 NAND device Layout */ #ifdef GPMC_NAND_ECC_SP_x8_LAYOUT #define GPMC_NAND_HW_ECC_LAYOUT {\ diff --git a/include/asm-arm/arch-omap3/sys_proto.h b/include/asm-arm/arch-omap3/sys_proto.h index 7361d089612..a7a6523a420 100644 --- a/include/asm-arm/arch-omap3/sys_proto.h +++ b/include/asm-arm/arch-omap3/sys_proto.h @@ -60,7 +60,15 @@ void sr32(void *, u32, u32, u32); u32 wait_on_value(u32, u32, void *, u32); void sdelay(unsigned long); void make_cs1_contiguous(void); -void omap_nand_switch_ecc(int); + +enum omap_nand_ecc_mode { + OMAP_ECC_SOFT = 1, + OMAP_ECC_HW, + OMAP_ECC_CHIP, +}; + +void omap_nand_switch_ecc(enum omap_nand_ecc_mode mode); +int omap_nand_chip_has_ecc(void); void power_init_r(void); void dieid_num_r(void); diff --git a/include/configs/omap3_logic.h b/include/configs/omap3_logic.h index 1599eeea287..6dcec746d1c 100644 --- a/include/configs/omap3_logic.h +++ b/include/configs/omap3_logic.h @@ -114,6 +114,7 @@ #define CONFIG_CMD_I2C /* I2C serial bus support */ #define CONFIG_CMD_MMC /* MMC support */ #define CONFIG_CMD_NAND /* NAND support */ +#define CONFIG_CMD_NAND_LOCK_UNLOCK #undef CONFIG_CMD_FLASH /* flinfo, erase, protect */ #undef CONFIG_CMD_FPGA /* FPGA configuration Support */ @@ -164,7 +165,6 @@ /* Environment information */ #define CONFIG_BOOTDELAY 10 -#if 1 #define CONFIG_EXTRA_ENV_SETTINGS \ "display=15\0" \ "loadaddr=0x81000000\0" \ @@ -177,55 +177,13 @@ "nfsboot=setenv bootargs display=${display} console=${consoledev},${baudrate} root=/dev/nfs rw nfsroot=${serverip}:${rootpath}${nfsoptions} ip=dhcp ${otherbootargs};tftpboot ${loadaddr} ${kernelimage};bootm ${loadaddr}\0" \ "ramboot=setenv bootargs display=${display} console=${consoledev},${baudrate} root=/dev/ram rw ramdisk_size=${ramdisksize} ${otherbootargs};tftpboot ${loadaddr} ${kernelimage};tftpboot ${rootfsaddr} rootfs.ext2.gz.uboot;bootm ${loadaddr} ${rootfsaddr}\0" \ "xipboot=setenv bootargs display=${display} console=${consoledev},${baudrate} root=/dev/ram rw ramdisk_size=${ramdisksize} ${otherbootargs};bootm ${loadaddr} ${rootfsaddr}\0" \ - "rootdevice=/dev/mtdblock4\0" \ + "rootdevice=/dev/mtdblock3\0" \ "rootfstype=yaffs\0" \ "mtdboot=setenv bootargs display=${display} console=${consoledev},${baudrate} root=${rootdevice} rootfstype=${rootfstype} rw ${otherbootargs};bootm ${loadaddr}\0" \ "sdmtdboot=setenv bootargs display=${display} console=${consoledev},${baudrate} root=${rootdevice} rootfstype=${rootfstype} rw ${otherbootargs};mmcinit;fatload mmc0 ${loadaddr} ${kernelimage}; bootm ${loadaddr}\0" #define CONFIG_BOOTCOMMAND "run xipboot" -#else - -// Beagle ENV_SETTINGS -#define CONFIG_EXTRA_ENV_SETTINGS \ - "loadaddr=0x82000000\0" \ - "console=ttyS2,115200n8\0" \ - "videomode=1024x768@60,vxres=1024,vyres=768\0" \ - "videospec=omapfb:vram:2M,vram:4M\0" \ - "mmcargs=setenv bootargs console=${console} " \ - "video=${videospec},mode:${videomode} " \ - "root=/dev/mmcblk0p2 rw " \ - "rootfstype=ext3 rootwait\0" \ - "nandargs=setenv bootargs console=${console} " \ - "video=${videospec},mode:${videomode} " \ - "root=/dev/mtdblock4 rw " \ - "rootfstype=jffs2\0" \ - "loadbootscript=fatload mmc 0 ${loadaddr} boot.scr\0" \ - "bootscript=echo Running bootscript from mmc ...; " \ - "source ${loadaddr}\0" \ - "loaduimage=fatload mmc 0 ${loadaddr} uImage\0" \ - "mmcboot=echo Booting from mmc ...; " \ - "run mmcargs; " \ - "bootm ${loadaddr}\0" \ - "nandboot=echo Booting from nand ...; " \ - "run nandargs; " \ - "nand read ${loadaddr} 280000 400000; " \ - "bootm ${loadaddr}\0" \ - -// Beagle BOOTCOMMAND -#define CONFIG_BOOTCOMMAND \ - "if mmc init; then " \ - "if run loadbootscript; then " \ - "run bootscript; " \ - "else " \ - "if run loaduimage; then " \ - "run mmcboot; " \ - "else run nandboot; " \ - "fi; " \ - "fi; " \ - "else run nandboot; fi" -#endif - #define CONFIG_PREBOOT \ "echo ======================NOTICE============================;" \ "echo This is the first time that you boot up this board. You are;" \ @@ -330,10 +288,8 @@ #define CONFIG_ENV_OFFSET boot_flash_off #define CONFIG_ENV_ADDR SMNAND_ENV_OFFSET -#if 0 #define CONFIG_MTD_DEBUG 1 -#define CONFIG_MTD_DEBUG_VERBOSE 2 // Loud MTD debug messages -#endif +#define CONFIG_MTD_DEBUG_VERBOSE -1 // No MTD debug messages /*----------------------------------------------------------------------- * CFI FLASH driver setup diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 16556c4798d..11c76dc008f 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -297,9 +297,10 @@ static inline void mtd_erase_callback(struct erase_info *instr) #define MTD_DEBUG_LEVEL3 (3) /* Noisy */ #ifdef CONFIG_MTD_DEBUG +extern int mtd_debug_verbose; #define MTDDEBUG(n, args...) \ do { \ - if (n <= CONFIG_MTD_DEBUG_VERBOSE) \ + if (n <= mtd_debug_verbose) \ printk(KERN_INFO args); \ } while(0) #else /* CONFIG_MTD_DEBUG */ diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 3e0044b94f2..c23c1fd4ccf 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -85,6 +85,8 @@ extern void nand_wait_ready(struct mtd_info *mtd); #define NAND_CMD_RNDIN 0x85 #define NAND_CMD_READID 0x90 #define NAND_CMD_ERASE2 0xd0 +#define NAND_CMD_SETFEATURE 0xee +#define NAND_CMD_GETFEATURE 0xef #define NAND_CMD_RESET 0xff /* Extended commands for large page devices */ @@ -92,6 +94,11 @@ extern void nand_wait_ready(struct mtd_info *mtd); #define NAND_CMD_RNDOUTSTART 0xE0 #define NAND_CMD_CACHEDPROG 0x15 +/* Extended commands for ONFI devices */ +#define NAND_CMD_READ_PARAM 0xec +#define NAND_CMD_GET_FEATURES 0xee +#define NAND_CMD_SET_FEATURES 0xef + /* Extended commands for AG-AND device */ /* * Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but @@ -128,6 +135,7 @@ typedef enum { NAND_ECC_SOFT, NAND_ECC_HW, NAND_ECC_HW_SYNDROME, + NAND_ECC_CHIP, } nand_ecc_modes_t; /* @@ -369,6 +377,10 @@ struct nand_chip { void __iomem *IO_ADDR_R; void __iomem *IO_ADDR_W; + uint8_t maf_id, dev_id; /* manufacturer/device identifier */ + uint8_t has_chip_ecc; /* !0 if chip has internal ECC engine */ + uint8_t ecc_status; /* status of read w/ECC */ + uint8_t (*read_byte)(struct mtd_info *mtd); u16 (*read_word)(struct mtd_info *mtd); void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); diff --git a/include/nand.h b/include/nand.h index 2a81597a65d..03bbce9d5f8 100644 --- a/include/nand.h +++ b/include/nand.h @@ -123,6 +123,8 @@ int nand_lock( nand_info_t *meminfo, int tight ); int nand_unlock( nand_info_t *meminfo, ulong start, ulong length ); int nand_get_lock_status(nand_info_t *meminfo, loff_t offset); +int nand_get_features( nand_info_t *meminfo, uint8_t faddr, uint8_t *features); + #ifdef CONFIG_SYS_NAND_SELECT_DEVICE void board_nand_select_device(struct nand_chip *nand, int chip); #endif |