X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=board%2Ft3corp%2Ft3corp.c;h=57f09fa36710ba61ab0a7f01d8765f30f691e48c;hb=81316a902a2c76bc880ab49c6d157e3e9754806d;hp=ddf58970a38c032d0d8f42f56f90ca16fb47a746;hpb=07c9cd81170335307a3090add3cd37147d29482e;p=u-boot diff --git a/board/t3corp/t3corp.c b/board/t3corp/t3corp.c index ddf58970a3..57f09fa367 100644 --- a/board/t3corp/t3corp.c +++ b/board/t3corp/t3corp.c @@ -19,15 +19,16 @@ */ #include -#include +#include #include #include #include +#include #include #include #include #include -#include +#include int board_early_init_f(void) { @@ -88,13 +89,14 @@ int board_early_init_f(void) int checkboard(void) { - char *s = getenv("serial#"); + char buf[64]; + int i = getenv_f("serial#", buf, sizeof(buf)); printf("Board: T3CORP"); - if (s != NULL) { + if (i > 0) { puts(", serial# "); - puts(s); + puts(buf); } putc('\n'); @@ -191,3 +193,40 @@ struct sdram_timing *ddr_scan_option(struct sdram_timing *default_val) { return board_scan_options; } + +/* + * Accessor functions replacing the "weak" functions in + * drivers/mtd/cfi_flash.c + * + * The NOR flash devices "behind" the FPGA's (Xilinx DS617) + * can only be read correctly in 16bit mode. We need to emulate + * 8bit and 32bit reads here in the board specific code. + */ +u8 flash_read8(void *addr) +{ + u16 val = __raw_readw((void *)((u32)addr & ~1)); + + if ((u32)addr & 1) + return val; + + return val >> 8; +} + +u32 flash_read32(void *addr) +{ + return (__raw_readw(addr) << 16) | __raw_readw((void *)((u32)addr + 2)); +} + +void flash_cmd_reset(flash_info_t *info) +{ + /* + * FLASH at address CONFIG_SYS_FLASH_BASE is a Spansion chip and + * needs the Spansion type reset commands. The other flash chip + * is located behind a FPGA (Xilinx DS617) and needs the Intel type + * reset command. + */ + if (info->start[0] == CONFIG_SYS_FLASH_BASE) + flash_write_cmd(info, 0, 0, AMD_CMD_RESET); + else + flash_write_cmd(info, 0, 0, FLASH_CMD_RESET); +}