pandora.c 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * (C) Copyright 2008
  3. * Grazvydas Ignotas <notasas@gmail.com>
  4. *
  5. * Derived from Beagle Board, 3430 SDP, and OMAP3EVM code by
  6. * Richard Woodruff <r-woodruff2@ti.com>
  7. * Syed Mohammed Khasim <khasim@ti.com>
  8. * Sunil Kumar <sunilsaini05@gmail.com>
  9. * Shashi Ranjan <shashiranjanmca05@gmail.com>
  10. *
  11. * (C) Copyright 2004-2008
  12. * Texas Instruments, <www.ti.com>
  13. *
  14. * See file CREDITS for list of people who contributed to this
  15. * project.
  16. *
  17. * This program is free software; you can redistribute it and/or
  18. * modify it under the terms of the GNU General Public License as
  19. * published by the Free Software Foundation; either version 2 of
  20. * the License, or (at your option) any later version.
  21. *
  22. * This program is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with this program; if not, write to the Free Software
  29. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  30. * MA 02111-1307 USA
  31. */
  32. #include <common.h>
  33. #include <twl4030.h>
  34. #include <asm/io.h>
  35. #include <asm/gpio.h>
  36. #include <asm/arch/mmc_host_def.h>
  37. #include <asm/arch/mux.h>
  38. #include <asm/arch/gpio.h>
  39. #include <asm/arch/sys_proto.h>
  40. #include <asm/mach-types.h>
  41. #include "pandora.h"
  42. DECLARE_GLOBAL_DATA_PTR;
  43. #define TWL4030_BB_CFG_BBCHEN (1 << 4)
  44. #define TWL4030_BB_CFG_BBSEL_3200MV (3 << 2)
  45. #define TWL4030_BB_CFG_BBISEL_500UA 2
  46. #define CONTROL_WKUP_CTRL 0x48002a5c
  47. #define GPIO_IO_PWRDNZ (1 << 6)
  48. #define PBIASLITEVMODE1 (1 << 8)
  49. /*
  50. * Routine: board_init
  51. * Description: Early hardware init.
  52. */
  53. int board_init(void)
  54. {
  55. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  56. /* board id for Linux */
  57. gd->bd->bi_arch_number = MACH_TYPE_OMAP3_PANDORA;
  58. /* boot param addr */
  59. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  60. return 0;
  61. }
  62. static void set_output_gpio(unsigned int gpio, int value)
  63. {
  64. int ret;
  65. ret = gpio_request(gpio, "");
  66. if (ret != 0) {
  67. printf("could not request GPIO %u\n", gpio);
  68. return;
  69. }
  70. ret = gpio_direction_output(gpio, value);
  71. if (ret != 0)
  72. printf("could not set GPIO %u to %d\n", gpio, value);
  73. }
  74. /*
  75. * Routine: misc_init_r
  76. * Description: Configure board specific parts
  77. */
  78. int misc_init_r(void)
  79. {
  80. t2_t *t2_base = (t2_t *)T2_BASE;
  81. u32 pbias_lite;
  82. twl4030_led_init(TWL4030_LED_LEDEN_LEDBON);
  83. /* set up dual-voltage GPIOs to 1.8V */
  84. pbias_lite = readl(&t2_base->pbias_lite);
  85. pbias_lite &= ~PBIASLITEVMODE1;
  86. pbias_lite |= PBIASLITEPWRDNZ1;
  87. writel(pbias_lite, &t2_base->pbias_lite);
  88. if (get_cpu_family() == CPU_OMAP36XX)
  89. writel(readl(CONTROL_WKUP_CTRL) | GPIO_IO_PWRDNZ,
  90. CONTROL_WKUP_CTRL);
  91. /* make sure audio and BT chips are in powerdown state */
  92. set_output_gpio(14, 0);
  93. set_output_gpio(15, 0);
  94. set_output_gpio(118, 0);
  95. /* enable USB supply */
  96. set_output_gpio(164, 1);
  97. /* wifi needs a short pulse to enter powersave state */
  98. set_output_gpio(23, 1);
  99. udelay(5000);
  100. gpio_direction_output(23, 0);
  101. /* Enable battery backup capacitor (3.2V, 0.5mA charge current) */
  102. twl4030_i2c_write_u8(TWL4030_CHIP_PM_RECEIVER,
  103. TWL4030_PM_RECEIVER_BB_CFG,
  104. TWL4030_BB_CFG_BBCHEN | TWL4030_BB_CFG_BBSEL_3200MV |
  105. TWL4030_BB_CFG_BBISEL_500UA);
  106. dieid_num_r();
  107. return 0;
  108. }
  109. /*
  110. * Routine: set_muxconf_regs
  111. * Description: Setting up the configuration Mux registers specific to the
  112. * hardware. Many pins need to be moved from protect to primary
  113. * mode.
  114. */
  115. void set_muxconf_regs(void)
  116. {
  117. MUX_PANDORA();
  118. if (get_cpu_family() == CPU_OMAP36XX) {
  119. MUX_PANDORA_3730();
  120. }
  121. }
  122. #ifdef CONFIG_GENERIC_MMC
  123. int board_mmc_init(bd_t *bis)
  124. {
  125. return omap_mmc_init(0, 0, 0, -1, -1);
  126. }
  127. #endif