blob: 1f9840c34d09305dff1302ab87d7b9c9f68e0d87 [file] [log] [blame]
Ilya Yanok4ab779c2012-02-07 23:30:22 +00001/*
2 * Copyright (C) 2011 Ilya Yanok, Emcraft Systems
3 *
4 * Based on ti/evm/evm.c
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc.
19 */
20
21#include <common.h>
22#include <asm/io.h>
23#include <asm/arch/mem.h>
24#include <asm/arch/mmc_host_def.h>
25#include <asm/arch/mux.h>
26#include <asm/arch/sys_proto.h>
27#include <asm/mach-types.h>
28#include <asm/gpio.h>
29#include <asm/omap_gpio.h>
30#include "errno.h"
31#include <i2c.h>
32#ifdef CONFIG_USB_EHCI
33#include <usb.h>
34#include <asm/ehci-omap.h>
35#endif
36#include "mcx.h"
37
38DECLARE_GLOBAL_DATA_PTR;
39
Stefano Babic8c735b92012-10-16 04:07:04 +000040#define HOT_WATER_BUTTON 42
Stefano Babic3ae6abb2012-06-13 22:34:44 +000041
Ilya Yanok4ab779c2012-02-07 23:30:22 +000042#ifdef CONFIG_USB_EHCI
43static struct omap_usbhs_board_data usbhs_bdata = {
44 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
Stefano Babic8c735b92012-10-16 04:07:04 +000045 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
Ilya Yanok4ab779c2012-02-07 23:30:22 +000046 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
47};
48
Lucas Stach676ae062012-09-26 00:14:35 +020049int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
Ilya Yanok4ab779c2012-02-07 23:30:22 +000050{
Lucas Stach676ae062012-09-26 00:14:35 +020051 return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor);
Ilya Yanok4ab779c2012-02-07 23:30:22 +000052}
53
Lucas Stach676ae062012-09-26 00:14:35 +020054int ehci_hcd_stop(int index)
Ilya Yanok4ab779c2012-02-07 23:30:22 +000055{
56 return omap_ehci_hcd_stop();
57}
58#endif
59
60/*
61 * Routine: board_init
62 * Description: Early hardware init.
63 */
64int board_init(void)
65{
66 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
67 /* boot param addr */
68 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
69
70 return 0;
71}
72
Stefano Babic3ae6abb2012-06-13 22:34:44 +000073#ifdef CONFIG_BOARD_LATE_INIT
74int board_late_init(void)
75{
76 if (gpio_request(HOT_WATER_BUTTON, "hot-water-button") < 0) {
77 puts("Failed to get hot-water-button pin\n");
78 return -ENODEV;
79 }
80 gpio_direction_input(HOT_WATER_BUTTON);
81
82 /*
83 * if hot-water-button is pressed
84 * change bootcmd
85 */
86 if (gpio_get_value(HOT_WATER_BUTTON))
87 return 0;
88
89 setenv("bootcmd", "run swupdate");
Stefano Babic8c735b92012-10-16 04:07:04 +000090
Stefano Babic3ae6abb2012-06-13 22:34:44 +000091 return 0;
92}
93#endif
94
Ilya Yanok4ab779c2012-02-07 23:30:22 +000095/*
Ilya Yanok4ab779c2012-02-07 23:30:22 +000096 * Routine: set_muxconf_regs
97 * Description: Setting up the configuration Mux registers specific to the
98 * hardware. Many pins need to be moved from protect to primary
99 * mode.
100 */
101void set_muxconf_regs(void)
102{
103 MUX_MCX();
104}
105
106#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
107int board_mmc_init(bd_t *bis)
108{
Jonathan Solnitbbbc1ae2012-02-24 11:30:18 +0000109 return omap_mmc_init(0, 0, 0);
Ilya Yanok4ab779c2012-02-07 23:30:22 +0000110}
111#endif