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