xref: /openbmc/u-boot/board/shmin/shmin.c (revision d66ff4ba)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2007 - 2010
4  *     Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
5  * (C) Copyright 2000-2003
6  *     Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7  * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
8  *
9  * board/shmin/shmin.c
10  *
11  * Copy board_flash_get_legacy() from board/freescale/m54455evb/m54455evb.c
12  */
13 
14 #include <common.h>
15 #include <asm/io.h>
16 #include <asm/processor.h>
17 #include <netdev.h>
18 
19 int checkboard(void)
20 {
21 	puts("BOARD: T-SH7706LAN ");
22 	if(readb(0xb0008006) == 0xab)
23 		puts("v2\n");
24 	else
25 		puts("v1\n");
26 	return 0;
27 }
28 
29 int board_init(void)
30 {
31 	writew(0x2980, BCR2);
32 	return 0;
33 }
34 
35 int board_eth_init(bd_t *bis)
36 {
37 	return ne2k_register();
38 }
39 
40 void led_set_state(unsigned short value)
41 {
42 
43 }
44 
45 #if defined(CONFIG_FLASH_CFI_LEGACY)
46 #include <flash.h>
47 ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
48 {
49 	int sect[] = CONFIG_SYS_ATMEL_SECT;
50 	int sectsz[] = CONFIG_SYS_ATMEL_SECTSZ;
51 		int i, j, k;
52 
53 	if (base != CONFIG_SYS_ATMEL_BASE)
54 		return 0;
55 
56 	info->flash_id			= 0x01000000;
57 	info->portwidth			= 1;
58 	info->chipwidth			= 1;
59 	info->buffer_size		= 1;
60 	info->erase_blk_tout	= 16384;
61 	info->write_tout		= 2;
62 	info->buffer_write_tout	= 5;
63 	info->vendor			= 0xFFF0; /* CFI_CMDSET_AMD_LEGACY */
64 	info->cmd_reset			= 0x00F0;
65 	info->interface			= FLASH_CFI_X8;
66 	info->legacy_unlock		= 0;
67 	info->manufacturer_id	= (u16) ATM_MANUFACT;
68 	info->device_id			= ATM_ID_LV040;
69 	info->device_id2		= 0;
70 	info->ext_addr			= 0;
71 	info->cfi_version		= 0x3133;
72 	info->cfi_offset		= 0x0000;
73 	info->addr_unlock1		= 0x00000555;
74 	info->addr_unlock2		= 0x000002AA;
75 	info->name				= "CFI conformant";
76 	info->size				= 0;
77 	info->sector_count		= CONFIG_SYS_ATMEL_TOTALSECT;
78 	info->start[0] = base;
79 
80 	for (k = 0, i = 0; i < CONFIG_SYS_ATMEL_REGION; i++) {
81 		info->size += sect[i] * sectsz[i];
82 		for (j = 0; j < sect[i]; j++, k++) {
83 			info->start[k + 1] = info->start[k] + sectsz[i];
84 			info->protect[k] = 0;
85 		}
86 	}
87 
88 	return 1;
89 }
90 #endif /* CONFIG_FLASH_CFI_LEGACY */
91