]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/isee/igep0020/igep0020.c
Merge branch 'master' of git://git.denx.de/u-boot-i2c
[karo-tx-uboot.git] / board / isee / igep0020 / igep0020.c
1 /*
2  * (C) Copyright 2010
3  * ISEE 2007 SL, <www.iseebcn.com>
4  *
5  * See file CREDITS for list of people who contributed to this
6  * project.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of
11  * the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21  * MA 02111-1307 USA
22  */
23 #include <common.h>
24 #include <netdev.h>
25 #include <twl4030.h>
26 #include <asm/io.h>
27 #include <asm/arch/gpio.h>
28 #include <asm/arch/mem.h>
29 #include <asm/arch/mmc_host_def.h>
30 #include <asm/arch/mux.h>
31 #include <asm/arch/sys_proto.h>
32 #include <asm/mach-types.h>
33 #include "igep0020.h"
34
35 /* GPMC definitions for LAN9221 chips */
36 static const u32 gpmc_lan_config[] = {
37     NET_LAN9221_GPMC_CONFIG1,
38     NET_LAN9221_GPMC_CONFIG2,
39     NET_LAN9221_GPMC_CONFIG3,
40     NET_LAN9221_GPMC_CONFIG4,
41     NET_LAN9221_GPMC_CONFIG5,
42     NET_LAN9221_GPMC_CONFIG6,
43 };
44
45 /*
46  * Routine: board_init
47  * Description: Early hardware init.
48  */
49 int board_init(void)
50 {
51         DECLARE_GLOBAL_DATA_PTR;
52
53         gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
54         /* board id for Linux */
55         gd->bd->bi_arch_number = MACH_TYPE_IGEP0020;
56         /* boot param addr */
57         gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
58
59         return 0;
60 }
61
62 /*
63  * Routine: setup_net_chip
64  * Description: Setting up the configuration GPMC registers specific to the
65  *              Ethernet hardware.
66  */
67 #if defined(CONFIG_CMD_NET)
68 static void setup_net_chip(void)
69 {
70         struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
71
72         enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], 0x2C000000,
73                         GPMC_SIZE_16M);
74
75         /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
76         writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
77         /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
78         writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
79         /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
80         writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
81                 &ctrl_base->gpmc_nadv_ale);
82
83         /* Make GPIO 64 as output pin and send a magic pulse through it */
84         if (!omap_request_gpio(64)) {
85                 omap_set_gpio_direction(64, 0);
86                 omap_set_gpio_dataout(64, 1);
87                 udelay(1);
88                 omap_set_gpio_dataout(64, 0);
89                 udelay(1);
90                 omap_set_gpio_dataout(64, 1);
91         }
92 }
93 #endif
94
95 #ifdef CONFIG_GENERIC_MMC
96 int board_mmc_init(bd_t *bis)
97 {
98         omap_mmc_init(0);
99         return 0;
100 }
101 #endif
102
103 /*
104  * Routine: misc_init_r
105  * Description: Configure board specific parts
106  */
107 int misc_init_r(void)
108 {
109         twl4030_power_init();
110
111 #if defined(CONFIG_CMD_NET)
112         setup_net_chip();
113 #endif
114
115         dieid_num_r();
116
117         return 0;
118 }
119
120 /*
121  * Routine: set_muxconf_regs
122  * Description: Setting up the configuration Mux registers specific to the
123  *              hardware. Many pins need to be moved from protect to primary
124  *              mode.
125  */
126 void set_muxconf_regs(void)
127 {
128         MUX_DEFAULT();
129 }
130
131 int board_eth_init(bd_t *bis)
132 {
133         int rc = 0;
134 #ifdef CONFIG_SMC911X
135         rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
136 #endif
137         return rc;
138 }