Sudhakar Rajashekhara | 6892181 | 2010-06-10 15:18:15 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ |
| 3 | * |
| 4 | * Based on da830evm.c. Original Copyrights follow: |
| 5 | * |
| 6 | * Copyright (C) 2009 Nick Thompson, GE Fanuc, Ltd. <nick.thompson@gefanuc.com> |
| 7 | * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net> |
| 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. |
| 13 | * |
| 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. |
| 18 | * |
| 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 | */ |
| 23 | |
| 24 | #include <common.h> |
| 25 | #include <i2c.h> |
| 26 | #include <asm/arch/hardware.h> |
| 27 | #include <asm/io.h> |
| 28 | #include "../common/misc.h" |
| 29 | #include "common.h" |
| 30 | |
| 31 | DECLARE_GLOBAL_DATA_PTR; |
| 32 | |
Prakash PM | 0dab150 | 2010-07-15 16:08:38 -0400 | [diff] [blame] | 33 | #define pinmux(x) (&davinci_syscfg_regs->pinmux[x]) |
Sudhakar Rajashekhara | 6892181 | 2010-06-10 15:18:15 +0530 | [diff] [blame] | 34 | |
| 35 | /* SPI0 pin muxer settings */ |
| 36 | static const struct pinmux_config spi1_pins[] = { |
Prakash PM | 0dab150 | 2010-07-15 16:08:38 -0400 | [diff] [blame] | 37 | { pinmux(5), 1, 1 }, |
| 38 | { pinmux(5), 1, 2 }, |
| 39 | { pinmux(5), 1, 4 }, |
| 40 | { pinmux(5), 1, 5 } |
Sudhakar Rajashekhara | 6892181 | 2010-06-10 15:18:15 +0530 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | /* UART pin muxer settings */ |
| 44 | static const struct pinmux_config uart_pins[] = { |
Prakash PM | 0dab150 | 2010-07-15 16:08:38 -0400 | [diff] [blame] | 45 | { pinmux(0), 4, 6 }, |
| 46 | { pinmux(0), 4, 7 }, |
| 47 | { pinmux(4), 2, 4 }, |
| 48 | { pinmux(4), 2, 5 } |
Sudhakar Rajashekhara | 6892181 | 2010-06-10 15:18:15 +0530 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | /* I2C pin muxer settings */ |
| 52 | static const struct pinmux_config i2c_pins[] = { |
Prakash PM | 0dab150 | 2010-07-15 16:08:38 -0400 | [diff] [blame] | 53 | { pinmux(4), 2, 2 }, |
| 54 | { pinmux(4), 2, 3 } |
Sudhakar Rajashekhara | 6892181 | 2010-06-10 15:18:15 +0530 | [diff] [blame] | 55 | }; |
| 56 | |
Ben Gardiner | f522c1b | 2010-10-14 17:26:19 -0400 | [diff] [blame^] | 57 | #ifdef CONFIG_NAND_DAVINCI |
| 58 | const struct pinmux_config nand_pins[] = { |
| 59 | { pinmux(7), 1, 1 }, |
| 60 | { pinmux(7), 1, 2 }, |
| 61 | { pinmux(7), 1, 4 }, |
| 62 | { pinmux(7), 1, 5 }, |
| 63 | { pinmux(9), 1, 0 }, |
| 64 | { pinmux(9), 1, 1 }, |
| 65 | { pinmux(9), 1, 2 }, |
| 66 | { pinmux(9), 1, 3 }, |
| 67 | { pinmux(9), 1, 4 }, |
| 68 | { pinmux(9), 1, 5 }, |
| 69 | { pinmux(9), 1, 6 }, |
| 70 | { pinmux(9), 1, 7 }, |
| 71 | { pinmux(12), 1, 5 }, |
| 72 | { pinmux(12), 1, 6 } |
| 73 | }; |
| 74 | #endif |
| 75 | |
Sudhakar Rajashekhara | 6892181 | 2010-06-10 15:18:15 +0530 | [diff] [blame] | 76 | static const struct pinmux_resource pinmuxes[] = { |
| 77 | #ifdef CONFIG_SPI_FLASH |
| 78 | PINMUX_ITEM(spi1_pins), |
| 79 | #endif |
| 80 | PINMUX_ITEM(uart_pins), |
| 81 | PINMUX_ITEM(i2c_pins), |
Ben Gardiner | f522c1b | 2010-10-14 17:26:19 -0400 | [diff] [blame^] | 82 | #ifdef CONFIG_NAND_DAVINCI |
| 83 | PINMUX_ITEM(nand_pins), |
| 84 | #endif |
Sudhakar Rajashekhara | 6892181 | 2010-06-10 15:18:15 +0530 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | static const struct lpsc_resource lpsc[] = { |
| 88 | { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */ |
| 89 | { DAVINCI_LPSC_SPI1 }, /* Serial Flash */ |
| 90 | { DAVINCI_LPSC_EMAC }, /* image download */ |
| 91 | { DAVINCI_LPSC_UART2 }, /* console */ |
| 92 | { DAVINCI_LPSC_GPIO }, |
| 93 | }; |
| 94 | |
| 95 | int board_init(void) |
| 96 | { |
| 97 | #ifndef CONFIG_USE_IRQ |
| 98 | irq_init(); |
| 99 | #endif |
| 100 | |
| 101 | /* arch number of the board */ |
| 102 | gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DA850_EVM; |
| 103 | |
| 104 | /* address of boot parameters */ |
| 105 | gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR; |
| 106 | |
| 107 | /* |
| 108 | * Power on required peripherals |
| 109 | * ARM does not have access by default to PSC0 and PSC1 |
| 110 | * assuming here that the DSP bootloader has set the IOPU |
| 111 | * such that PSC access is available to ARM |
| 112 | */ |
| 113 | if (da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc))) |
| 114 | return 1; |
| 115 | |
| 116 | /* setup the SUSPSRC for ARM to control emulation suspend */ |
| 117 | writel(readl(&davinci_syscfg_regs->suspsrc) & |
| 118 | ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C | |
| 119 | DAVINCI_SYSCFG_SUSPSRC_SPI1 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 | |
| 120 | DAVINCI_SYSCFG_SUSPSRC_UART2), |
| 121 | &davinci_syscfg_regs->suspsrc); |
| 122 | |
| 123 | /* configure pinmux settings */ |
| 124 | if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes))) |
| 125 | return 1; |
| 126 | |
| 127 | /* enable the console UART */ |
| 128 | writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST | |
| 129 | DAVINCI_UART_PWREMU_MGMT_UTRST), |
| 130 | &davinci_uart2_ctrl_regs->pwremu_mgmt); |
| 131 | |
| 132 | return 0; |
| 133 | } |