blob: 7cf601301b68f0e382b58f43fcfed33f577c0167 [file] [log] [blame]
Sekhar Noribdc9c6c2009-11-12 11:08:39 -05001/*
2 * Copyright (C) 2009 Nick Thompson, GE Fanuc, Ltd. <nick.thompson@gefanuc.com>
3 *
4 * Base on code from TI. Original Notices follow:
5 *
6 * (C) Copyright 2008, Texas Instruments, Inc. http://www.ti.com/
7 *
8 * Modified for DA8xx EVM.
9 *
10 * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
11 *
12 * Parts are shamelessly stolen from various TI sources, original copyright
13 * follows:
14 * -----------------------------------------------------------------
15 *
16 * Copyright (C) 2004 Texas Instruments.
17 *
18 * ----------------------------------------------------------------------------
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
32 * ----------------------------------------------------------------------------
33 */
34
35#include <common.h>
36#include <i2c.h>
37#include <asm/arch/hardware.h>
38#include <asm/io.h>
39#include "../common/misc.h"
40
41DECLARE_GLOBAL_DATA_PTR;
42
43#define pinmux &davinci_syscfg_regs->pinmux
44
45#ifdef CONFIG_SPI_FLASH
46/* SPI0 pin muxer settings */
47const struct pinmux_config spi0_pins[] = {
48 { pinmux[7], 1, 3 },
49 { pinmux[7], 1, 4 },
50 { pinmux[7], 1, 5 },
51 { pinmux[7], 1, 6 },
52 { pinmux[7], 1, 7 }
53};
54#endif
55
56/* UART pin muxer settings */
57const struct pinmux_config uart_pins[] = {
58 { pinmux[8], 2, 7 },
59 { pinmux[9], 2, 0 }
60};
61
62/* I2C pin muxer settings */
63const struct pinmux_config i2c_pins[] = {
64 { pinmux[9], 2, 3 },
65 { pinmux[9], 2, 4 }
66};
67
Ajay Kumar Gupta82a821f2009-12-22 10:56:11 +053068/* USB0_DRVVBUS pin muxer settings */
69const struct pinmux_config usb_pins[] = {
70 { pinmux[9], 1, 1 }
71};
72
Sekhar Noribdc9c6c2009-11-12 11:08:39 -050073int board_init(void)
74{
75#ifndef CONFIG_USE_IRQ
76 /*
77 * Mask all IRQs by clearing the global enable and setting
78 * the enable clear for all the 90 interrupts.
79 */
80
81 writel(0, &davinci_aintc_regs->ger);
82
83 writel(0, &davinci_aintc_regs->hier);
84
85 writel(0xffffffff, &davinci_aintc_regs->ecr1);
86 writel(0xffffffff, &davinci_aintc_regs->ecr2);
87 writel(0xffffffff, &davinci_aintc_regs->ecr3);
88#endif
89
90 /* arch number of the board */
91 gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DA830_EVM;
92
93 /* address of boot parameters */
94 gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
95
96 /*
97 * Power on required peripherals
98 * ARM does not have access by default to PSC0 and PSC1
99 * assuming here that the DSP bootloader has set the IOPU
100 * such that PSC access is available to ARM
101 */
102 lpsc_on(DAVINCI_LPSC_AEMIF); /* NAND, NOR */
103 lpsc_on(DAVINCI_LPSC_SPI0); /* Serial Flash */
104 lpsc_on(DAVINCI_LPSC_EMAC); /* image download */
105 lpsc_on(DAVINCI_LPSC_UART2); /* console */
106 lpsc_on(DAVINCI_LPSC_GPIO);
107
108 /* setup the SUSPSRC for ARM to control emulation suspend */
109 writel(readl(&davinci_syscfg_regs->suspsrc) &
110 ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
111 DAVINCI_SYSCFG_SUSPSRC_SPI0 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
112 DAVINCI_SYSCFG_SUSPSRC_UART2),
113 &davinci_syscfg_regs->suspsrc);
114
115#ifdef CONFIG_SPI_FLASH
116 if (davinci_configure_pin_mux(spi0_pins, ARRAY_SIZE(spi0_pins)) != 0)
117 return 1;
118#endif
119
120 if (davinci_configure_pin_mux(uart_pins, ARRAY_SIZE(uart_pins)) != 0)
121 return 1;
122
123 if (davinci_configure_pin_mux(i2c_pins, ARRAY_SIZE(i2c_pins)) != 0)
124 return 1;
125
Ajay Kumar Gupta82a821f2009-12-22 10:56:11 +0530126 if (davinci_configure_pin_mux(usb_pins, ARRAY_SIZE(usb_pins)) != 0)
127 return 1;
128
Sekhar Noribdc9c6c2009-11-12 11:08:39 -0500129 /* enable the console UART */
130 writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
131 DAVINCI_UART_PWREMU_MGMT_UTRST),
132 &davinci_uart2_ctrl_regs->pwremu_mgmt);
133
134 return(0);
135}