xref: /openbmc/u-boot/board/LaCie/edminiv2/edminiv2.c (revision d59c33a1)
1 /*
2  * Copyright (C) 2010 Albert ARIBAUD <albert.u.boot@aribaud.net>
3  *
4  * (C) Copyright 2009
5  * Marvell Semiconductor <www.marvell.com>
6  * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
7  *
8  * See file CREDITS for list of people who contributed to this
9  * project.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License as
13  * published by the Free Software Foundation; either version 2 of
14  * the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24  * MA 02110-1301 USA
25  */
26 
27 #include <common.h>
28 #include <miiphy.h>
29 #include <asm/arch/orion5x.h>
30 
31 DECLARE_GLOBAL_DATA_PTR;
32 
33 /*
34  * The ED Mini V2 is equipped with a Macronix MXLV400CB FLASH
35  * which CFI does not properly detect, hence the LEGACY config.
36  */
37 #if defined(CONFIG_FLASH_CFI_LEGACY)
38 #include <flash.h>
39 ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
40 {
41 	int sectsz[] = CONFIG_SYS_FLASH_SECTSZ;
42 	int sect;
43 
44 	if (base != CONFIG_SYS_FLASH_BASE)
45 		return 0;
46 
47 	info->size = 0;
48 	info->sector_count = CONFIG_SYS_MAX_FLASH_SECT;
49 	/* set each sector's start address and size based */
50 	for (sect = 0; sect < CONFIG_SYS_MAX_FLASH_SECT; sect++) {
51 		info->start[sect] = base+info->size;
52 		info->size += sectsz[sect];
53 	}
54 	/* This flash must be accessed in 8-bits mode, no buffer. */
55 	info->flash_id = 0x01000000;
56 	info->portwidth = FLASH_CFI_8BIT;
57 	info->chipwidth = FLASH_CFI_BY8;
58 	info->buffer_size = 0;
59 	/* timings are derived from the Macronix datasheet. */
60 	info->erase_blk_tout = 1000;
61 	info->write_tout = 10;
62 	info->buffer_write_tout = 300;
63 	/* Commands and addresses are for AMD mode 8-bit access. */
64 	info->vendor = CFI_CMDSET_AMD_LEGACY;
65 	info->cmd_reset = 0xF0;
66 	info->interface = FLASH_CFI_X8;
67 	info->legacy_unlock = 0;
68 	info->ext_addr = 0;
69 	info->addr_unlock1 = 0x00000aaa;
70 	info->addr_unlock2 = 0x00000555;
71 	/* Manufacturer Macronix, device MX29LV400CB, CFI 1.3. */
72 	info->manufacturer_id = 0x22;
73 	info->device_id = 0xBA;
74 	info->device_id2 = 0;
75 	info->cfi_version = 0x3133;
76 	info->cfi_offset = 0x0000;
77 	info->name = "MX29LV400CB";
78 
79 	return 1;
80 }
81 #endif				/* CONFIG_SYS_FLASH_CFI */
82 
83 int board_init(void)
84 {
85 	/* arch number of board */
86 	gd->bd->bi_arch_number = MACH_TYPE_EDMINI_V2;
87 
88 	/* boot parameter start at 256th byte of RAM base */
89 	gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
90 
91 	return 0;
92 }
93 
94 #if defined(CONFIG_CMD_NET) && defined(CONFIG_RESET_PHY_R)
95 /* Configure and enable MV88E1116 PHY */
96 void reset_phy(void)
97 {
98 	mv_phy_88e1116_init("egiga0");
99 }
100 #endif /* CONFIG_RESET_PHY_R */
101