3 * ISEE 2007 SL, <www.iseebcn.com>
5 * SPDX-License-Identifier: GPL-2.0+
8 #include <status_led.h>
15 #include <asm/arch/mem.h>
16 #include <asm/arch/mmc_host_def.h>
17 #include <asm/arch/mux.h>
18 #include <asm/arch/sys_proto.h>
19 #include <asm/mach-types.h>
20 #include <linux/mtd/nand.h>
21 #include <linux/mtd/nand.h>
22 #include <linux/mtd/onenand.h>
23 #include <jffs2/load_kernel.h>
26 DECLARE_GLOBAL_DATA_PTR;
28 const omap3_sysinfo sysinfo = {
30 #if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020)
33 #if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030)
34 "IGEP COM MODULE/ELECTRON",
36 #if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0032)
39 #if defined(CONFIG_ENV_IS_IN_ONENAND)
46 static const struct ns16550_platdata igep_serial = {
47 .base = OMAP34XX_UART3,
49 .clock = V_NS16550_CLK
52 U_BOOT_DEVICE(igep_uart) = {
59 * Description: Early hardware init.
65 /* find out flash memory type, assume NAND first */
66 gpmc_cs0_flash = MTD_DEV_TYPE_NAND;
69 /* Issue a RESET and then READID */
70 writeb(NAND_CMD_RESET, &gpmc_cfg->cs[0].nand_cmd);
71 writeb(NAND_CMD_STATUS, &gpmc_cfg->cs[0].nand_cmd);
72 while ((readl(&gpmc_cfg->cs[0].nand_dat) & NAND_STATUS_READY)
73 != NAND_STATUS_READY) {
76 gpmc_cs0_flash = MTD_DEV_TYPE_ONENAND;
77 gpmc_init(); /* reinitialize for OneNAND */
83 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
85 #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT)
86 status_led_set(STATUS_LED_BOOT, STATUS_LED_ON);
92 #ifdef CONFIG_SPL_BUILD
94 * Routine: get_board_mem_timings
95 * Description: If we use SPL then there is no x-loader nor config header
96 * so we have to setup the DDR timings ourself on both banks.
98 void get_board_mem_timings(struct board_sdrc_timings *timings)
100 int mfr, id, err = identify_nand_chip(&mfr, &id);
102 timings->mr = MICRON_V_MR_165;
103 if (!err && mfr == NAND_MFR_MICRON) {
104 timings->mcfg = MICRON_V_MCFG_200(256 << 20);
105 timings->ctrla = MICRON_V_ACTIMA_200;
106 timings->ctrlb = MICRON_V_ACTIMB_200;
107 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
108 gpmc_cs0_flash = MTD_DEV_TYPE_NAND;
110 if (get_cpu_family() == CPU_OMAP34XX) {
111 timings->mcfg = NUMONYX_V_MCFG_165(256 << 20);
112 timings->ctrla = NUMONYX_V_ACTIMA_165;
113 timings->ctrlb = NUMONYX_V_ACTIMB_165;
114 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
116 timings->mcfg = NUMONYX_V_MCFG_200(256 << 20);
117 timings->ctrla = NUMONYX_V_ACTIMA_200;
118 timings->ctrlb = NUMONYX_V_ACTIMB_200;
119 timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
121 gpmc_cs0_flash = MTD_DEV_TYPE_ONENAND;
126 int onenand_board_init(struct mtd_info *mtd)
128 if (gpmc_cs0_flash == MTD_DEV_TYPE_ONENAND) {
129 struct onenand_chip *this = mtd->priv;
130 this->base = (void *)CONFIG_SYS_ONENAND_BASE;
136 #if defined(CONFIG_CMD_NET)
137 static void reset_net_chip(int gpio)
139 if (!gpio_request(gpio, "eth nrst")) {
140 gpio_direction_output(gpio, 1);
142 gpio_set_value(gpio, 0);
144 gpio_set_value(gpio, 1);
150 * Routine: setup_net_chip
151 * Description: Setting up the configuration GPMC registers specific to the
154 static void setup_net_chip(void)
156 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
157 static const u32 gpmc_lan_config[] = {
158 NET_LAN9221_GPMC_CONFIG1,
159 NET_LAN9221_GPMC_CONFIG2,
160 NET_LAN9221_GPMC_CONFIG3,
161 NET_LAN9221_GPMC_CONFIG4,
162 NET_LAN9221_GPMC_CONFIG5,
163 NET_LAN9221_GPMC_CONFIG6,
166 enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5],
167 CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
169 /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
170 writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
171 /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
172 writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
173 /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
174 writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
175 &ctrl_base->gpmc_nadv_ale);
180 int board_eth_init(bd_t *bis)
182 #ifdef CONFIG_SMC911X
183 return smc911x_initialize(0, CONFIG_SMC911X_BASE);
189 static inline void setup_net_chip(void) {}
192 #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
193 int board_mmc_init(bd_t *bis)
195 return omap_mmc_init(0, 0, 0, -1, -1);
199 #if defined(CONFIG_GENERIC_MMC)
200 void board_mmc_power_init(void)
202 twl4030_power_mmc_init(0);
208 switch (gd->bd->bi_arch_number) {
209 case MACH_TYPE_IGEP0020:
210 setenv("fdtfile", "omap3-igep0020.dtb");
212 case MACH_TYPE_IGEP0030:
213 setenv("fdtfile", "omap3-igep0030.dtb");
219 * Routine: misc_init_r
220 * Description: Configure board specific parts
222 int misc_init_r(void)
224 twl4030_power_init();
228 omap_die_id_display();
236 * Routine: set_muxconf_regs
237 * Description: Setting up the configuration Mux registers specific to the
238 * hardware. Many pins need to be moved from protect to primary
241 void set_muxconf_regs(void)
245 #if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0020)
249 #if (CONFIG_MACH_TYPE == MACH_TYPE_IGEP0030)