Merge git://git.denx.de/u-boot-mpc85xx
[oweals/u-boot.git] / board / shmin / shmin.c
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 board_eth_init(bd_t *bis)
37 {
38         return ne2k_register();
39 }
40
41 void led_set_state(unsigned short value)
42 {
43
44 }
45
46 #if defined(CONFIG_FLASH_CFI_LEGACY)
47 #include <flash.h>
48 ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
49 {
50         int sect[] = CONFIG_SYS_ATMEL_SECT;
51         int sectsz[] = CONFIG_SYS_ATMEL_SECTSZ;
52                 int i, j, k;
53
54         if (base != CONFIG_SYS_ATMEL_BASE)
55                 return 0;
56
57         info->flash_id                  = 0x01000000;
58         info->portwidth                 = 1;
59         info->chipwidth                 = 1;
60         info->buffer_size               = 1;
61         info->erase_blk_tout    = 16384;
62         info->write_tout                = 2;
63         info->buffer_write_tout = 5;
64         info->vendor                    = 0xFFF0; /* CFI_CMDSET_AMD_LEGACY */
65         info->cmd_reset                 = 0x00F0;
66         info->interface                 = FLASH_CFI_X8;
67         info->legacy_unlock             = 0;
68         info->manufacturer_id   = (u16) ATM_MANUFACT;
69         info->device_id                 = ATM_ID_LV040;
70         info->device_id2                = 0;
71         info->ext_addr                  = 0;
72         info->cfi_version               = 0x3133;
73         info->cfi_offset                = 0x0000;
74         info->addr_unlock1              = 0x00000555;
75         info->addr_unlock2              = 0x000002AA;
76         info->name                              = "CFI conformant";
77         info->size                              = 0;
78         info->sector_count              = CONFIG_SYS_ATMEL_TOTALSECT;
79         info->start[0] = base;
80
81         for (k = 0, i = 0; i < CONFIG_SYS_ATMEL_REGION; i++) {
82                 info->size += sect[i] * sectsz[i];
83                 for (j = 0; j < sect[i]; j++, k++) {
84                         info->start[k + 1] = info->start[k] + sectsz[i];
85                         info->protect[k] = 0;
86                 }
87         }
88
89         return 1;
90 }
91 #endif /* CONFIG_FLASH_CFI_LEGACY */