blob: a69359fa1d954a54f50fe0fb66d14f0313f10c15 [file] [log] [blame]
Michael Jones84d7a012011-11-04 13:53:44 -04001/*
2 * MATRIX VISION GmbH mvBlueLYNX-X
3 *
4 * Derived from Beagle and Overo
5 *
6 * (C) Copyright 2004-2008
7 * Texas Instruments, <www.ti.com>
8 *
9 * Author :
10 * Sunil Kumar <sunilsaini05@gmail.com>
11 * Shashi Ranjan <shashiranjanmca05@gmail.com>
12 *
13 * Derived from Beagle Board and 3430 SDP code by
14 * Richard Woodruff <r-woodruff2@ti.com>
15 * Syed Mohammed Khasim <khasim@ti.com>
16 *
17 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020018 * SPDX-License-Identifier: GPL-2.0+
Michael Jones84d7a012011-11-04 13:53:44 -040019 */
20#include <common.h>
21#include <netdev.h>
22#include <twl4030.h>
23#include <asm/io.h>
24#include <asm/arch/mem.h>
25#include <asm/arch/mmc_host_def.h>
26#include <asm/arch/mux.h>
27#include <asm/arch/sys_proto.h>
28#include <asm/arch/gpio.h>
29#include <asm/mach-types.h>
30#include "mvblx.h"
31#include "fpga.h"
32
33DECLARE_GLOBAL_DATA_PTR;
34
35#if defined(CONFIG_CMD_NET)
36static void setup_net_chip(void);
37#endif /* CONFIG_CMD_NET */
38
39/*
40 * Routine: board_init
41 * Description: Early hardware init.
42 */
43int board_init(void)
44{
45 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
46 /* boot param addr */
47 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
48
49 return 0;
50}
51
52/*
53 * Routine: misc_init_r
54 * Description: Configure board specific parts
55 */
56int misc_init_r(void)
57{
58 printf("mvBlueLYNX-X\n");
59 if (get_cpu_family() == CPU_OMAP36XX)
60 setenv("mpurate", "1000");
61 else
62 setenv("mpurate", "600");
63
64 twl4030_power_init();
65
66#if defined(CONFIG_CMD_NET)
67 setup_net_chip();
68#endif /* CONFIG_CMD_NET */
69
70 mvblx_init_fpga();
71
72 mac_read_from_eeprom();
73
74 dieid_num_r();
75
76 return 0;
77}
78
79/*
80 * Routine: set_muxconf_regs
81 * Description: Setting up the configuration Mux registers specific to the
82 * hardware. Many pins need to be moved from protect to primary
83 * mode.
84 */
85void set_muxconf_regs(void)
86{
87 MUX_MVBLX();
88}
89
90#ifdef CONFIG_GENERIC_MMC
91int board_mmc_init(bd_t *bis)
92{
Nikita Kiryanove3913f52012-12-03 02:19:47 +000093 omap_mmc_init(0, 0, 0, -1, -1);
94 omap_mmc_init(1, 0, 0, -1, -1);
Michael Jones84d7a012011-11-04 13:53:44 -040095 return 0;
96}
97#endif
98
99#if defined(CONFIG_CMD_NET)
100/*
101 * Routine: setup_net_chip
102 * Description: Setting up the configuration GPMC registers specific to the
103 * Ethernet hardware.
104 */
105static void setup_net_chip(void)
106{
107 struct gpio *gpio5_base = (struct gpio *)OMAP34XX_GPIO5_BASE;
108 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
109
110 /* Configure GPMC registers */
111 writel(NET_GPMC_CONFIG1, &gpmc_cfg->cs[0].config1);
112 writel(NET_GPMC_CONFIG2, &gpmc_cfg->cs[0].config2);
113 writel(NET_GPMC_CONFIG3, &gpmc_cfg->cs[0].config3);
114 writel(NET_GPMC_CONFIG4, &gpmc_cfg->cs[0].config4);
115 writel(NET_GPMC_CONFIG5, &gpmc_cfg->cs[0].config5);
116 writel(NET_GPMC_CONFIG6, &gpmc_cfg->cs[0].config6);
117 writel(NET_GPMC_CONFIG7, &gpmc_cfg->cs[0].config7);
118
119 /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
120 writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
121 /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
122 writew(readw(&ctrl_base->gpmc_noe) | 0x0E00, &ctrl_base->gpmc_noe);
123 /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
124 writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
125 &ctrl_base->gpmc_nadv_ale);
126
127 /* Make GPIO 139 as output pin */
128 writel(readl(&gpio5_base->oe) & ~(GPIO11), &gpio5_base->oe);
129
130 /* Now send a pulse on the GPIO pin */
131 writel(GPIO11, &gpio5_base->setdataout);
132 udelay(1);
133 writel(GPIO11, &gpio5_base->cleardataout);
134 udelay(1);
135 writel(GPIO11, &gpio5_base->setdataout);
136}
137
138int board_eth_init(bd_t *bis)
139{
140 int rc = 0;
141#ifdef CONFIG_SMC911X
142 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
143#endif
144 return rc;
145}
146
147int overwrite_console(void)
148{
York Sun472d5462013-04-01 11:29:11 -0700149 /* return true if console should be overwritten */
Michael Jones84d7a012011-11-04 13:53:44 -0400150 return 0;
151}
152
153#endif /* CONFIG_CMD_NET */