2 * Modified for Hawkboard - Syed Mohammed Khasim <khasim@beagleboard.org>
4 * Copyright (C) 2008 Sekhar Nori, Texas Instruments, Inc. <nsekhar@ti.com>
5 * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
6 * Copyright (C) 2004 Texas Instruments.
8 * ----------------------------------------------------------------------------
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * ----------------------------------------------------------------------------
26 #include <asm/errno.h>
27 #include <asm/arch/hardware.h>
29 #include <asm/arch/davinci_misc.h>
33 DECLARE_GLOBAL_DATA_PTR;
35 #define pinmux(x) (&davinci_syscfg_regs->pinmux[x])
37 static const struct pinmux_config mii_pins[] = {
47 static const struct pinmux_config mdio_pins[] = {
52 static const struct pinmux_config nand_pins[] = {
69 static const struct pinmux_config uart2_pins[] = {
76 static const struct pinmux_config i2c_pins[] = {
81 static const struct pinmux_resource pinmuxes[] = {
82 PINMUX_ITEM(mii_pins),
83 PINMUX_ITEM(mdio_pins),
84 PINMUX_ITEM(i2c_pins),
85 PINMUX_ITEM(nand_pins),
86 PINMUX_ITEM(uart2_pins),
89 static const struct lpsc_resource lpsc[] = {
90 { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
91 { DAVINCI_LPSC_SPI1 }, /* Serial Flash */
92 { DAVINCI_LPSC_EMAC }, /* image download */
93 { DAVINCI_LPSC_UART2 }, /* console */
94 { DAVINCI_LPSC_GPIO },
97 void board_init_f(ulong bootflag)
100 * Kick Registers need to be set to allow access to Pin Mux registers
102 writel(HAWKBOARD_KICK0_UNLOCK, &davinci_syscfg_regs->kick0);
103 writel(HAWKBOARD_KICK1_UNLOCK, &davinci_syscfg_regs->kick1);
105 /* setup the SUSPSRC for ARM to control emulation suspend */
106 writel(readl(&davinci_syscfg_regs->suspsrc) &
107 ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
108 DAVINCI_SYSCFG_SUSPSRC_SPI1 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
109 DAVINCI_SYSCFG_SUSPSRC_UART2), &davinci_syscfg_regs->suspsrc);
111 /* Power on required peripherals
112 * ARM does not have acess by default to PSC0 and PSC1
113 * assuming here that the DSP bootloader has set the IOPU
114 * such that PSC access is available to ARM
116 da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc));
118 /* configure pinmux settings */
119 davinci_configure_pin_mux_items(pinmuxes,
120 ARRAY_SIZE(pinmuxes));
122 writel(readl(&davinci_uart2_ctrl_regs->pwremu_mgmt) |
123 (DAVINCI_UART_PWREMU_MGMT_FREE) |
124 (DAVINCI_UART_PWREMU_MGMT_URRST) |
125 (DAVINCI_UART_PWREMU_MGMT_UTRST),
126 &davinci_uart2_ctrl_regs->pwremu_mgmt);
128 NS16550_init((NS16550_t)(DAVINCI_UART2_BASE),
129 CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
131 puts("Nand boot...\n");
136 void puts(const char *str)
144 if (gd->flags & GD_FLG_SILENT)
148 NS16550_putc((NS16550_t)(DAVINCI_UART2_BASE), '\r');
150 NS16550_putc((NS16550_t)(DAVINCI_UART2_BASE), c);
155 puts("### ERROR ### Please RESET the board ###\n");