da850evm.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. #include <common.h>
  24. #include <i2c.h>
  25. #include <asm/arch/hardware.h>
  26. #include <asm/io.h>
  27. #include "../common/misc.h"
  28. #include "common.h"
  29. DECLARE_GLOBAL_DATA_PTR;
  30. #define pinmux (&davinci_syscfg_regs->pinmux)
  31. /* SPI0 pin muxer settings */
  32. static const struct pinmux_config spi1_pins[] = {
  33. { pinmux[5], 1, 1 },
  34. { pinmux[5], 1, 2 },
  35. { pinmux[5], 1, 4 },
  36. { pinmux[5], 1, 5 }
  37. };
  38. /* UART pin muxer settings */
  39. static const struct pinmux_config uart_pins[] = {
  40. { pinmux[0], 4, 6 },
  41. { pinmux[0], 4, 7 },
  42. { pinmux[4], 2, 4 },
  43. { pinmux[4], 2, 5 }
  44. };
  45. /* I2C pin muxer settings */
  46. static const struct pinmux_config i2c_pins[] = {
  47. { pinmux[4], 2, 2 },
  48. { pinmux[4], 2, 3 }
  49. };
  50. static const struct pinmux_resource pinmuxes[] = {
  51. #ifdef CONFIG_SPI_FLASH
  52. PINMUX_ITEM(spi1_pins),
  53. #endif
  54. PINMUX_ITEM(uart_pins),
  55. PINMUX_ITEM(i2c_pins),
  56. };
  57. static const struct lpsc_resource lpsc[] = {
  58. { DAVINCI_LPSC_AEMIF }, /* NAND, NOR */
  59. { DAVINCI_LPSC_SPI1 }, /* Serial Flash */
  60. { DAVINCI_LPSC_EMAC }, /* image download */
  61. { DAVINCI_LPSC_UART2 }, /* console */
  62. { DAVINCI_LPSC_GPIO },
  63. };
  64. int board_init(void)
  65. {
  66. #ifndef CONFIG_USE_IRQ
  67. irq_init();
  68. #endif
  69. /* arch number of the board */
  70. gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_DA850_EVM;
  71. /* address of boot parameters */
  72. gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
  73. /*
  74. * Power on required peripherals
  75. * ARM does not have access by default to PSC0 and PSC1
  76. * assuming here that the DSP bootloader has set the IOPU
  77. * such that PSC access is available to ARM
  78. */
  79. if (da8xx_configure_lpsc_items(lpsc, ARRAY_SIZE(lpsc)))
  80. return 1;
  81. /* setup the SUSPSRC for ARM to control emulation suspend */
  82. writel(readl(&davinci_syscfg_regs->suspsrc) &
  83. ~(DAVINCI_SYSCFG_SUSPSRC_EMAC | DAVINCI_SYSCFG_SUSPSRC_I2C |
  84. DAVINCI_SYSCFG_SUSPSRC_SPI1 | DAVINCI_SYSCFG_SUSPSRC_TIMER0 |
  85. DAVINCI_SYSCFG_SUSPSRC_UART2),
  86. &davinci_syscfg_regs->suspsrc);
  87. /* configure pinmux settings */
  88. if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
  89. return 1;
  90. /* enable the console UART */
  91. writel((DAVINCI_UART_PWREMU_MGMT_FREE | DAVINCI_UART_PWREMU_MGMT_URRST |
  92. DAVINCI_UART_PWREMU_MGMT_UTRST),
  93. &davinci_uart2_ctrl_regs->pwremu_mgmt);
  94. return 0;
  95. }