blob: 3818574702860c0b22a94a39f2e8396928f3cfd6 [file] [log] [blame]
Heiko Schocher466f0132011-01-13 08:25:00 +01001The common CFI driver provides this weak default implementation for
2flash_cmd_reset():
3
Robert P. J. Day66723ed2016-12-29 05:23:19 -05004static void __flash_cmd_reset(flash_info_t *info)
Heiko Schocher466f0132011-01-13 08:25:00 +01005{
6 /*
7 * We do not yet know what kind of commandset to use, so we issue
8 * the reset command in both Intel and AMD variants, in the hope
9 * that AMD flash roms ignore the Intel command.
10 */
11 flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
Robert P. J. Day66723ed2016-12-29 05:23:19 -050012 udelay(1);
Heiko Schocher466f0132011-01-13 08:25:00 +010013 flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
14}
15void flash_cmd_reset(flash_info_t *info)
16 __attribute__((weak,alias("__flash_cmd_reset")));
17
Robert P. J. Day66723ed2016-12-29 05:23:19 -050018Some flash chips seem to have trouble with this reset sequence.
19In this case, board-specific code can override this weak default
20version with a board-specific function.
Heiko Schocher466f0132011-01-13 08:25:00 +010021
Robert P. J. Day66723ed2016-12-29 05:23:19 -050022At the time of writing, there are two boards that define their own
23routine for this.
24
25First, the digsy_mtc board equipped with the M29W128GH from Numonyx
26needs this version to function properly:
Heiko Schocher466f0132011-01-13 08:25:00 +010027
28void flash_cmd_reset(flash_info_t *info)
29{
30 flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
31}
32
Robert P. J. Day66723ed2016-12-29 05:23:19 -050033In addition, the t3corp board defines the routine thusly:
34
35void flash_cmd_reset(flash_info_t *info)
36{
37 /*
Tom Rini65cc0e22022-11-16 13:10:41 -050038 * FLASH at address CFG_SYS_FLASH_BASE is a Spansion chip and
Robert P. J. Day66723ed2016-12-29 05:23:19 -050039 * needs the Spansion type reset commands. The other flash chip
40 * is located behind a FPGA (Xilinx DS617) and needs the Intel type
41 * reset command.
42 */
Tom Rini65cc0e22022-11-16 13:10:41 -050043 if (info->start[0] == CFG_SYS_FLASH_BASE)
Robert P. J. Day66723ed2016-12-29 05:23:19 -050044 flash_write_cmd(info, 0, 0, AMD_CMD_RESET);
45 else
46 flash_write_cmd(info, 0, 0, FLASH_CMD_RESET);
47}
48
Heiko Schocher466f0132011-01-13 08:25:00 +010049see also:
50http://www.mail-archive.com/u-boot@lists.denx.de/msg24368.html
pekon gupta3df3bc12014-07-22 16:03:21 +053051
52
53Config Option
54
55 CONFIG_SYS_MAX_FLASH_SECT: Number of sectors available on Flash device
56
57 CONFIG_SYS_FLASH_CFI_WIDTH: Data-width of the flash device
58
59 CONFIG_CMD_FLASH: Enables Flash command library
60
61 CONFIG_FLASH_CFI_DRIVER: Enables CFI Flash driver
62
63 CONFIG_FLASH_CFI_MTD: Enables MTD frame work for NOR Flash devices