ARM: omap3: add support to Technexion twister board
[platform/kernel/u-boot.git] / board / technexion / twister / twister.c
1 /*
2  * Copyright (C) 2011
3  * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
4  *
5  * Copyright (C) 2009 TechNexion Ltd.
6  *
7  * See file CREDITS for list of people who contributed to this
8  * project.
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
26 #include <common.h>
27 #include <netdev.h>
28 #include <asm/io.h>
29 #include <asm/arch/mem.h>
30 #include <asm/arch/mux.h>
31 #include <asm/arch/sys_proto.h>
32 #include <asm/omap_gpio.h>
33 #include <asm/arch/mmc_host_def.h>
34 #include <i2c.h>
35 #include <asm/gpio.h>
36 #include "twister.h"
37
38 DECLARE_GLOBAL_DATA_PTR;
39
40 /* Timing definitions for Ethernet Controller */
41 static const u32 gpmc_smc911[] = {
42         NET_GPMC_CONFIG1,
43         NET_GPMC_CONFIG2,
44         NET_GPMC_CONFIG3,
45         NET_GPMC_CONFIG4,
46         NET_GPMC_CONFIG5,
47         NET_GPMC_CONFIG6,
48 };
49
50 static const u32 gpmc_XR16L2751[] = {
51         XR16L2751_GPMC_CONFIG1,
52         XR16L2751_GPMC_CONFIG2,
53         XR16L2751_GPMC_CONFIG3,
54         XR16L2751_GPMC_CONFIG4,
55         XR16L2751_GPMC_CONFIG5,
56         XR16L2751_GPMC_CONFIG6,
57 };
58
59 int board_init(void)
60 {
61         gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
62
63         /* boot param addr */
64         gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
65
66         /* Chip select 1  and 3 are used for XR16L2751 UART controller */
67         enable_gpmc_cs_config(gpmc_XR16L2751, &gpmc_cfg->cs[1],
68                 XR16L2751_UART1_BASE, GPMC_SIZE_16M);
69
70         enable_gpmc_cs_config(gpmc_XR16L2751, &gpmc_cfg->cs[3],
71                 XR16L2751_UART2_BASE, GPMC_SIZE_16M);
72
73         gpio_request(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO, "USB_PHY1_RESET");
74         gpio_direction_output(CONFIG_OMAP_EHCI_PHY1_RESET_GPIO, 1);
75
76         return 0;
77 }
78
79 int misc_init_r(void)
80 {
81         dieid_num_r();
82
83         return 0;
84 }
85
86 /*
87  * Routine: set_muxconf_regs
88  * Description: Setting up the configuration Mux registers specific to the
89  *              hardware. Many pins need to be moved from protect to primary
90  *              mode.
91  */
92 void set_muxconf_regs(void)
93 {
94         MUX_TWISTER();
95 }
96
97 int board_eth_init(bd_t *bis)
98 {
99         davinci_emac_initialize();
100
101         /* init cs for extern lan */
102         enable_gpmc_cs_config(gpmc_smc911, &gpmc_cfg->cs[5],
103                 CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
104         if (smc911x_initialize(0, CONFIG_SMC911X_BASE) <= 0)
105                 printf("\nError initializing SMC911x controlleri\n");
106
107         return 0;
108 }
109
110 #if defined(CONFIG_OMAP_HSMMC) && \
111         !defined(CONFIG_SPL_BUILD)
112 int board_mmc_init(bd_t *bis)
113 {
114         return omap_mmc_init(0);
115 }
116 #endif