xref: /openbmc/u-boot/doc/README.cfi (revision 66723eda4ebbb53a0708aa0cbb1853f2b86fb117)
1466f0137SHeiko SchocherThe common CFI driver provides this weak default implementation for
2466f0137SHeiko Schocherflash_cmd_reset():
3466f0137SHeiko Schocher
4*66723edaSRobert P. J. Daystatic void __flash_cmd_reset(flash_info_t *info)
5466f0137SHeiko Schocher{
6466f0137SHeiko Schocher	/*
7466f0137SHeiko Schocher	 * We do not yet know what kind of commandset to use, so we issue
8466f0137SHeiko Schocher	 * the reset command in both Intel and AMD variants, in the hope
9466f0137SHeiko Schocher	 * that AMD flash roms ignore the Intel command.
10466f0137SHeiko Schocher	 */
11466f0137SHeiko Schocher	flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
12*66723edaSRobert P. J. Day	udelay(1);
13466f0137SHeiko Schocher	flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
14466f0137SHeiko Schocher}
15466f0137SHeiko Schochervoid flash_cmd_reset(flash_info_t *info)
16466f0137SHeiko Schocher	__attribute__((weak,alias("__flash_cmd_reset")));
17466f0137SHeiko Schocher
18*66723edaSRobert P. J. DaySome flash chips seem to have trouble with this reset sequence.
19*66723edaSRobert P. J. DayIn this case, board-specific code can override this weak default
20*66723edaSRobert P. J. Dayversion with a board-specific function.
21466f0137SHeiko Schocher
22*66723edaSRobert P. J. DayAt the time of writing, there are two boards that define their own
23*66723edaSRobert P. J. Dayroutine for this.
24*66723edaSRobert P. J. Day
25*66723edaSRobert P. J. DayFirst, the digsy_mtc board equipped with the M29W128GH from Numonyx
26*66723edaSRobert P. J. Dayneeds this version to function properly:
27466f0137SHeiko Schocher
28466f0137SHeiko Schochervoid flash_cmd_reset(flash_info_t *info)
29466f0137SHeiko Schocher{
30466f0137SHeiko Schocher	flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
31466f0137SHeiko Schocher}
32466f0137SHeiko Schocher
33*66723edaSRobert P. J. DayIn addition, the t3corp board defines the routine thusly:
34*66723edaSRobert P. J. Day
35*66723edaSRobert P. J. Dayvoid flash_cmd_reset(flash_info_t *info)
36*66723edaSRobert P. J. Day{
37*66723edaSRobert P. J. Day	/*
38*66723edaSRobert P. J. Day	 * FLASH at address CONFIG_SYS_FLASH_BASE is a Spansion chip and
39*66723edaSRobert P. J. Day	 * needs the Spansion type reset commands. The other flash chip
40*66723edaSRobert P. J. Day	 * is located behind a FPGA (Xilinx DS617) and needs the Intel type
41*66723edaSRobert P. J. Day	 * reset command.
42*66723edaSRobert P. J. Day	 */
43*66723edaSRobert P. J. Day	if (info->start[0] == CONFIG_SYS_FLASH_BASE)
44*66723edaSRobert P. J. Day		flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
45*66723edaSRobert P. J. Day	else
46*66723edaSRobert P. J. Day		flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
47*66723edaSRobert P. J. Day}
48*66723edaSRobert P. J. Day
49466f0137SHeiko Schochersee also:
50466f0137SHeiko Schocherhttp://www.mail-archive.com/u-boot@lists.denx.de/msg24368.html
513df3bc1eSpekon gupta
523df3bc1eSpekon gupta
533df3bc1eSpekon guptaConfig Option
543df3bc1eSpekon gupta
553df3bc1eSpekon gupta  CONFIG_SYS_MAX_FLASH_SECT: Number of sectors available on Flash device
563df3bc1eSpekon gupta
573df3bc1eSpekon gupta  CONFIG_SYS_FLASH_CFI_WIDTH: Data-width of the flash device
583df3bc1eSpekon gupta
593df3bc1eSpekon gupta  CONFIG_CMD_FLASH: Enables Flash command library
603df3bc1eSpekon gupta
613df3bc1eSpekon gupta  CONFIG_FLASH_CFI_DRIVER: Enables CFI Flash driver
623df3bc1eSpekon gupta
633df3bc1eSpekon gupta  CONFIG_FLASH_CFI_MTD: Enables MTD frame work for NOR Flash devices
64