]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/htkw/mcx/mcx.c
ARM: OMAP2+: Rename asm/arch/clocks.h asm/arch/clock.h
[people/ms/u-boot.git] / board / htkw / mcx / mcx.c
CommitLineData
4ab779cb
IY
1/*
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>
8f1fae26 30#include <asm/arch/dss.h>
af1d002f 31#include <asm/arch/clock.h>
4ab779cb
IY
32#include "errno.h"
33#include <i2c.h>
34#ifdef CONFIG_USB_EHCI
35#include <usb.h>
36#include <asm/ehci-omap.h>
37#endif
38#include "mcx.h"
39
40DECLARE_GLOBAL_DATA_PTR;
41
8c735b99 42#define HOT_WATER_BUTTON 42
8f1fae26
SB
43#define LCD_OUTPUT 55
44
45/* Address of the framebuffer in RAM. */
46#define FB_START_ADDRESS 0x88000000
3ae6abb6 47
4ab779cb
IY
48#ifdef CONFIG_USB_EHCI
49static struct omap_usbhs_board_data usbhs_bdata = {
50 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
8c735b99 51 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
4ab779cb
IY
52 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
53};
54
676ae068 55int ehci_hcd_init(int index, struct ehci_hccr **hccr, struct ehci_hcor **hcor)
4ab779cb 56{
676ae068 57 return omap_ehci_hcd_init(&usbhs_bdata, hccr, hcor);
4ab779cb
IY
58}
59
676ae068 60int ehci_hcd_stop(int index)
4ab779cb
IY
61{
62 return omap_ehci_hcd_stop();
63}
64#endif
65
66/*
67 * Routine: board_init
68 * Description: Early hardware init.
69 */
70int board_init(void)
71{
72 gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
73 /* boot param addr */
74 gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
75
8f1fae26
SB
76 gpio_direction_output(LCD_OUTPUT, 0);
77
4ab779cb
IY
78 return 0;
79}
80
3ae6abb6
SB
81#ifdef CONFIG_BOARD_LATE_INIT
82int board_late_init(void)
83{
84 if (gpio_request(HOT_WATER_BUTTON, "hot-water-button") < 0) {
85 puts("Failed to get hot-water-button pin\n");
86 return -ENODEV;
87 }
88 gpio_direction_input(HOT_WATER_BUTTON);
89
90 /*
91 * if hot-water-button is pressed
92 * change bootcmd
93 */
94 if (gpio_get_value(HOT_WATER_BUTTON))
95 return 0;
96
97 setenv("bootcmd", "run swupdate");
8c735b99 98
3ae6abb6
SB
99 return 0;
100}
101#endif
102
4ab779cb
IY
103/*
104 * Routine: set_muxconf_regs
105 * Description: Setting up the configuration Mux registers specific to the
106 * hardware. Many pins need to be moved from protect to primary
107 * mode.
108 */
109void set_muxconf_regs(void)
110{
111 MUX_MCX();
112}
113
114#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
115int board_mmc_init(bd_t *bis)
116{
e3913f56 117 return omap_mmc_init(0, 0, 0, -1, -1);
4ab779cb
IY
118}
119#endif
8f1fae26
SB
120
121#if defined(CONFIG_VIDEO) && !defined(CONFIG_SPL_BUILD)
122
123static struct panel_config lcd_cfg = {
124 .timing_h = PANEL_TIMING_H(40, 40, 48),
125 .timing_v = PANEL_TIMING_V(29, 13, 3),
126 .pol_freq = 0x00003000, /* Pol Freq */
127 .divisor = 0x0001000E,
128 .panel_type = 0x01, /* TFT */
129 .data_lines = 0x03, /* 24 Bit RGB */
130 .load_mode = 0x02, /* Frame Mode */
131 .panel_color = 0,
132 .lcd_size = PANEL_LCD_SIZE(800, 480),
bcc6cc9b 133 .gfx_format = GFXFORMAT_RGB24_UNPACKED,
8f1fae26
SB
134};
135
136int board_video_init(void)
137{
138 struct prcm *prcm_base = (struct prcm *)PRCM_BASE;
139 void *fb;
140
141 fb = (void *)FB_START_ADDRESS;
142
143 lcd_cfg.frame_buffer = fb;
144
145 setbits_le32(&prcm_base->fclken_dss, FCK_DSS_ON);
146 setbits_le32(&prcm_base->iclken_dss, ICK_DSS_ON);
147
148 omap3_dss_panel_config(&lcd_cfg);
149 omap3_dss_enable();
150
151 return 0;
152}
153#endif