NOR Flash support on DM365
From Texas Instruments Embedded Processors Wiki
The following is a guideline on how to add NOR flash support to DM365 LSP:
- Port Spectrum Digital NOR test code from DM6446 release. This can be used for initial board bring up to test NOR flash before running Linux.
- Modify NOR flash writer code (CCS project including source code is part of Flash Utility tools in the PSP release). Change EMIF initilizaion code for correct PINMUX.
- Modify UBL code to add NOR flash configuration (Add PINMUX in the low level initialization code)
- Modify Uboot configuration to add support for NOR flash ( Since DM6446 already has NOR support enable, take example from DM6446 code, then change DM365 board configuration (/include/configs/davinci_dm365_evm.h: Add NOR support)
Define NOR flash support in Uboot
*=======*/
/* Board */
/*=======*/
#define CFG_DM365_EVM
/* #define CFG_USE_NAND */
#define CFG_USE_NOR
#ifdef CFG_USE_NAND
#define CFG_DAVINCI_STD_NAND_LAYOUT
#endif
#define CONFIG_ENV_OVERWRITE
...
Add Flash configuration in the header file: see example below
/*=====================*/
/* Flash & Environment */
/*=====================*/
elif defined(CFG_USE_NOR)
#define CONFIG_SKIP_LOWLEVEL_INIT /* U-Boot is loaded by a bootloader */
#define CONFIG_SKIP_RELOCATE_UBOOT /* to a proper address, init done */
#define CFG_ENV_IS_IN_FLASH
#undef CFG_NO_FLASH
#define CONFIG_FLASH_CFI_DRIVER
#define CFG_FLASH_CFI
#define CFG_MAX_FLASH_BANKS 1
#define CFG_FLASH_SECT_SZ 0x10000 /* 64 KByte *sector size AMD flash */
#define PHYS_FLASH_SIZE 0x800000 /* Flash Size 8 MByte */
#define CFG_ENV_OFFSET 0x60000
#define PHYS_FLASH_1 0x02000000 /* CS1 Based Address */
#define CFG_FLASH_BASE PHYS_FLASH_1 /* Flash Base for U-Boot */
#define CFG_MAX_FLASH_SECT 0x80 /* 128 Sector */
#define CFG_ENV_SECT_SIZE CFG_FLASH_SECT_SZ
- After the above change, recompile Uboot and this should add proper NOR support.
If you need support for NOR MTD file system, modify Linux MTD driver to add support for NOR flash. This can be done by porting MTD driver code from DM6446 (since we have NOR support already in DM6446 MTD driver).
- Copy davinci_nor.c from DM6446 LSP
- Modify the code to add the appropriate header ( /linux/platform_device.h> )
- Modify Kconfig and Makefile
- Modify NOR partition in board-dm365-evm.c
- Disable MMC/SD driver. (EMIF address line EM_A20 is muxed with MMCSD1_CLK)
- Additional information on MTD filesystem can be found in related WIKI page ( Filesystem_in_NOR_or_NAND )
Below are some detail on PIN MUX and boot strap for NOR flash support. HW boot strap
BTSEL[2:0] = 001 (AEMIF boot), this disable HPI, set EM_A0, EM_A1, EM_A2, EM_BA1
AECFG[2:0] = 101 Activate 16 bit mode (EM_D0-15), this enable address pins EM_A0 – EM_A14 (switch EM_BA0 to EM_A14) , EM_BA1
SW pinmux register programming (done in UBL code)
PINMUX0 [ xx xx : xx xx : xx xx : xx 10 : xx xx : xx xx : xx xx : xx xx ]
PINMUX4 [10 10 : 10 10 : 10 xx : 10 xx : xx xx : xx xx : xx xx : xx xx ]
