xref: /openbmc/u-boot/board/shmin/shmin.c (revision 9b914727)
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 #include <netdev.h>
32 
33 int checkboard(void)
34 {
35 	puts("BOARD: T-SH7706LAN ");
36 	if(readb(0xb0008006) == 0xab)
37 		puts("v2\n");
38 	else
39 		puts("v1\n");
40 	return 0;
41 }
42 
43 int board_init(void)
44 {
45 	writew(0x2980, BCR2);
46 	return 0;
47 }
48 
49 int dram_init(void)
50 {
51 	DECLARE_GLOBAL_DATA_PTR;
52 
53 	gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
54 	gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
55 	printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
56 	return 0;
57 }
58 
59 int board_eth_init(bd_t *bis)
60 {
61 	return ne2k_register();
62 }
63 
64 void led_set_state(unsigned short value)
65 {
66 
67 }
68 
69 #if defined(CONFIG_FLASH_CFI_LEGACY)
70 #include <flash.h>
71 ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
72 {
73 	int sect[] = CONFIG_SYS_ATMEL_SECT;
74 	int sectsz[] = CONFIG_SYS_ATMEL_SECTSZ;
75 		int i, j, k;
76 
77 	if (base != CONFIG_SYS_ATMEL_BASE)
78 		return 0;
79 
80 	info->flash_id			= 0x01000000;
81 	info->portwidth			= 1;
82 	info->chipwidth			= 1;
83 	info->buffer_size		= 1;
84 	info->erase_blk_tout	= 16384;
85 	info->write_tout		= 2;
86 	info->buffer_write_tout	= 5;
87 	info->vendor			= 0xFFF0; /* CFI_CMDSET_AMD_LEGACY */
88 	info->cmd_reset			= 0x00F0;
89 	info->interface			= FLASH_CFI_X8;
90 	info->legacy_unlock		= 0;
91 	info->manufacturer_id	= (u16) ATM_MANUFACT;
92 	info->device_id			= ATM_ID_LV040;
93 	info->device_id2		= 0;
94 	info->ext_addr			= 0;
95 	info->cfi_version		= 0x3133;
96 	info->cfi_offset		= 0x0000;
97 	info->addr_unlock1		= 0x00000555;
98 	info->addr_unlock2		= 0x000002AA;
99 	info->name				= "CFI conformant";
100 	info->size				= 0;
101 	info->sector_count		= CONFIG_SYS_ATMEL_TOTALSECT;
102 	info->start[0] = base;
103 
104 	for (k = 0, i = 0; i < CONFIG_SYS_ATMEL_REGION; i++) {
105 		info->size += sect[i] * sectsz[i];
106 		for (j = 0; j < sect[i]; j++, k++) {
107 			info->start[k + 1] = info->start[k] + sectsz[i];
108 			info->protect[k] = 0;
109 		}
110 	}
111 
112 	return 1;
113 }
114 #endif /* CONFIG_FLASH_CFI_LEGACY */
115