3 * Stefano Babic, DENX Software Engineering, sbabic@denx.de.
5 * Copyright (C) 2009 TechNexion Ltd.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
26 #include <asm/arch/mem.h>
27 #include <asm/arch/mux.h>
28 #include <asm/arch/sys_proto.h>
29 #include <asm/omap_gpio.h>
30 #include <asm/arch/mmc_host_def.h>
34 #ifdef CONFIG_USB_EHCI
36 #include <asm/ehci-omap.h>
38 #include "mt_ventoux.h"
40 DECLARE_GLOBAL_DATA_PTR;
43 #error "The Teejet mt_ventoux must have CONFIG_FPGA enabled"
53 /* Timing definitions for FPGA */
54 static const u32 gpmc_fpga[] = {
63 #ifdef CONFIG_USB_EHCI
64 static struct omap_usbhs_board_data usbhs_bdata = {
65 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
66 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
67 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
70 int ehci_hcd_init(void)
72 return omap_ehci_hcd_init(&usbhs_bdata);
75 int ehci_hcd_stop(void)
77 return omap_ehci_hcd_stop();
82 static inline void fpga_reset(int nassert)
84 gpio_set_value(FPGA_RESET, !nassert);
87 int fpga_pgm_fn(int nassert, int nflush, int cookie)
89 debug("%s:%d: FPGA PROGRAM ", __func__, __LINE__);
91 gpio_set_value(FPGA_PROG, !nassert);
96 int fpga_init_fn(int cookie)
98 return !gpio_get_value(FPGA_INIT);
101 int fpga_done_fn(int cookie)
103 return gpio_get_value(FPGA_DONE);
106 int fpga_pre_config_fn(int cookie)
108 debug("%s:%d: FPGA pre-configuration\n", __func__, __LINE__);
110 /* Setting GPIOs for programming Mode */
111 gpio_request(FPGA_RESET, "FPGA_RESET");
112 gpio_direction_output(FPGA_RESET, 1);
113 gpio_request(FPGA_PROG, "FPGA_PROG");
114 gpio_direction_output(FPGA_PROG, 1);
115 gpio_request(FPGA_CCLK, "FPGA_CCLK");
116 gpio_direction_output(FPGA_CCLK, 1);
117 gpio_request(FPGA_DIN, "FPGA_DIN");
118 gpio_direction_output(FPGA_DIN, 0);
119 gpio_request(FPGA_INIT, "FPGA_INIT");
120 gpio_direction_input(FPGA_INIT);
121 gpio_request(FPGA_DONE, "FPGA_DONE");
122 gpio_direction_input(FPGA_DONE);
124 /* Be sure that signal are deasserted */
125 gpio_set_value(FPGA_RESET, 1);
126 gpio_set_value(FPGA_PROG, 1);
131 int fpga_post_config_fn(int cookie)
133 debug("%s:%d: FPGA post-configuration\n", __func__, __LINE__);
142 /* Write program to the FPGA */
143 int fpga_wr_fn(int nassert_write, int flush, int cookie)
145 gpio_set_value(FPGA_DIN, nassert_write);
147 return nassert_write;
150 int fpga_clk_fn(int assert_clk, int flush, int cookie)
152 gpio_set_value(FPGA_CCLK, assert_clk);
157 Xilinx_Spartan3_Slave_Serial_fns mt_ventoux_fpga_fns = {
167 Xilinx_desc fpga = XILINX_XC6SLX4_DESC(slave_serial,
168 (void *)&mt_ventoux_fpga_fns, 0);
170 /* Initialize the FPGA */
171 static void mt_ventoux_init_fpga(void)
173 fpga_pre_config_fn(0);
175 /* Setting CS1 for FPGA access */
176 enable_gpmc_cs_config(gpmc_fpga, &gpmc_cfg->cs[1],
177 FPGA_BASE_ADDR, GPMC_SIZE_128M);
180 fpga_add(fpga_xilinx, &fpga);
184 * Routine: board_init
185 * Description: Early hardware init.
189 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
191 /* boot param addr */
192 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
194 mt_ventoux_init_fpga();
200 * Routine: set_muxconf_regs
201 * Description: Setting up the configuration Mux registers specific to the
202 * hardware. Many pins need to be moved from protect to primary
205 void set_muxconf_regs(void)
211 * Initializes on-chip ethernet controllers.
212 * to override, implement board_eth_init()
214 int board_eth_init(bd_t *bis)
216 davinci_emac_initialize();
220 #if defined(CONFIG_OMAP_HSMMC) && \
221 !defined(CONFIG_SPL_BUILD)
222 int board_mmc_init(bd_t *bis)
224 return omap_mmc_init(0, 0, 0);