dvevm.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
  3. *
  4. * Parts are shamelessly stolen from various TI sources, original copyright
  5. * follows:
  6. * -----------------------------------------------------------------
  7. *
  8. * Copyright (C) 2004 Texas Instruments.
  9. *
  10. * ----------------------------------------------------------------------------
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24. * ----------------------------------------------------------------------------
  25. */
  26. #include <common.h>
  27. #include <i2c.h>
  28. #include <asm/arch/hardware.h>
  29. #include <asm/arch/emac_defs.h>
  30. #include "../common/psc.h"
  31. #include "../common/misc.h"
  32. DECLARE_GLOBAL_DATA_PTR;
  33. int board_init(void)
  34. {
  35. /* arch number of the board */
  36. gd->bd->bi_arch_number = MACH_TYPE_DAVINCI_EVM;
  37. /* address of boot parameters */
  38. gd->bd->bi_boot_params = LINUX_BOOT_PARAM_ADDR;
  39. /* Workaround for TMS320DM6446 errata 1.3.22 */
  40. REG(PSC_SILVER_BULLET) = 0;
  41. /* Power on required peripherals */
  42. lpsc_on(DAVINCI_LPSC_EMAC);
  43. lpsc_on(DAVINCI_LPSC_EMAC_WRAPPER);
  44. lpsc_on(DAVINCI_LPSC_MDIO);
  45. lpsc_on(DAVINCI_LPSC_I2C);
  46. lpsc_on(DAVINCI_LPSC_UART0);
  47. lpsc_on(DAVINCI_LPSC_TIMER1);
  48. lpsc_on(DAVINCI_LPSC_GPIO);
  49. #if !defined(CONFIG_SYS_USE_DSPLINK)
  50. /* Powerup the DSP */
  51. dsp_on();
  52. #endif /* CONFIG_SYS_USE_DSPLINK */
  53. /* Bringup UART0 out of reset */
  54. REG(UART0_PWREMU_MGMT) = 0x0000e003;
  55. /* Enable GIO3.3V cells used for EMAC */
  56. REG(VDD3P3V_PWDN) = 0;
  57. /* Enable UART0 MUX lines */
  58. REG(PINMUX1) |= 1;
  59. /* Enable EMAC and AEMIF pins */
  60. REG(PINMUX0) = 0x80000c1f;
  61. /* Enable I2C pin Mux */
  62. REG(PINMUX1) |= (1 << 7);
  63. /* Set the Bus Priority Register to appropriate value */
  64. REG(VBPR) = 0x20;
  65. timer_init();
  66. return(0);
  67. }
  68. int misc_init_r(void)
  69. {
  70. uint8_t video_mode;
  71. uint8_t eeprom_enetaddr[6];
  72. dv_display_clk_infos();
  73. /* Read Ethernet MAC address from EEPROM if available. */
  74. if (dvevm_read_mac_address(eeprom_enetaddr))
  75. dv_configure_mac_address(eeprom_enetaddr);
  76. if (!eth_hw_init())
  77. printf("ethernet init failed!\n");
  78. i2c_read(0x39, 0x00, 1, &video_mode, 1);
  79. setenv("videostd", ((video_mode & 0x80) ? "pal" : "ntsc"));
  80. return(0);
  81. }