xref: /openbmc/u-boot/board/shmin/shmin.c (revision efc05ae1)
1 /*
2  * Copyright (C) 2007 - 2010
3  *     Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
4  * (C) Copyright 2000-2003
5  *     Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6  * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
7  *
8  * board/shmin/shmin.c
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License as
12  * published by the Free Software Foundation; either version 2 of
13  * the License, or (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
23  * MA 02111-1307 USA
24  *
25  * Copy board_flash_get_legacy() from board/freescale/m54455evb/m54455evb.c
26  */
27 
28 #include <common.h>
29 #include <asm/io.h>
30 #include <asm/processor.h>
31 
32 int checkboard(void)
33 {
34 	puts("BOARD: T-SH7706LAN ");
35 	if(readb(0xb0008006) == 0xab)
36 		puts("v2\n");
37 	else
38 		puts("v1\n");
39 	return 0;
40 }
41 
42 int board_init(void)
43 {
44 	writew(0x2980, BCR2);
45 	return 0;
46 }
47 
48 int dram_init(void)
49 {
50 	DECLARE_GLOBAL_DATA_PTR;
51 
52 	gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
53 	gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
54 	printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
55 	return 0;
56 }
57 
58 void led_set_state(unsigned short value)
59 {
60 
61 }
62 
63 #if defined(CONFIG_FLASH_CFI_LEGACY)
64 #include <flash.h>
65 ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
66 {
67 	int sect[] = CONFIG_SYS_ATMEL_SECT;
68 	int sectsz[] = CONFIG_SYS_ATMEL_SECTSZ;
69 		int i, j, k;
70 
71 	if (base != CONFIG_SYS_ATMEL_BASE)
72 		return 0;
73 
74 	info->flash_id			= 0x01000000;
75 	info->portwidth			= 1;
76 	info->chipwidth			= 1;
77 	info->buffer_size		= 1;
78 	info->erase_blk_tout	= 16384;
79 	info->write_tout		= 2;
80 	info->buffer_write_tout	= 5;
81 	info->vendor			= 0xFFF0; /* CFI_CMDSET_AMD_LEGACY */
82 	info->cmd_reset			= 0x00F0;
83 	info->interface			= FLASH_CFI_X8;
84 	info->legacy_unlock		= 0;
85 	info->manufacturer_id	= (u16) ATM_MANUFACT;
86 	info->device_id			= ATM_ID_LV040;
87 	info->device_id2		= 0;
88 	info->ext_addr			= 0;
89 	info->cfi_version		= 0x3133;
90 	info->cfi_offset		= 0x0000;
91 	info->addr_unlock1		= 0x00000555;
92 	info->addr_unlock2		= 0x000002AA;
93 	info->name				= "CFI conformant";
94 	info->size				= 0;
95 	info->sector_count		= CONFIG_SYS_ATMEL_TOTALSECT;
96 	info->start[0] = base;
97 
98 	for (k = 0, i = 0; i < CONFIG_SYS_ATMEL_REGION; i++) {
99 		info->size += sect[i] * sectsz[i];
100 		for (j = 0; j < sect[i]; j++, k++) {
101 			info->start[k + 1] = info->start[k] + sectsz[i];
102 			info->protect[k] = 0;
103 		}
104 	}
105 
106 	return 1;
107 }
108 #endif /* CONFIG_FLASH_CFI_LEGACY */
109