mcx.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Copyright (C) 2011 Ilya Yanok, Emcraft Systems
  3. *
  4. * Based on ti/evm/evm.c
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc.
  19. */
  20. #include <common.h>
  21. #include <asm/io.h>
  22. #include <asm/arch/mem.h>
  23. #include <asm/arch/mmc_host_def.h>
  24. #include <asm/arch/mux.h>
  25. #include <asm/arch/sys_proto.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/gpio.h>
  28. #include <asm/omap_gpio.h>
  29. #include "errno.h"
  30. #include <i2c.h>
  31. #ifdef CONFIG_USB_EHCI
  32. #include <usb.h>
  33. #include <asm/ehci-omap.h>
  34. #endif
  35. #include "mcx.h"
  36. DECLARE_GLOBAL_DATA_PTR;
  37. #ifdef CONFIG_USB_EHCI
  38. static struct omap_usbhs_board_data usbhs_bdata = {
  39. .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
  40. .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
  41. .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
  42. };
  43. int ehci_hcd_init(void)
  44. {
  45. return omap_ehci_hcd_init(&usbhs_bdata);
  46. }
  47. int ehci_hcd_stop(void)
  48. {
  49. return omap_ehci_hcd_stop();
  50. }
  51. #endif
  52. /*
  53. * Routine: board_init
  54. * Description: Early hardware init.
  55. */
  56. int board_init(void)
  57. {
  58. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  59. /* boot param addr */
  60. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  61. return 0;
  62. }
  63. /*
  64. * Routine: misc_init_r
  65. * Description: late init.
  66. */
  67. int misc_init_r(void)
  68. {
  69. dieid_num_r();
  70. return 0;
  71. }
  72. /*
  73. * Routine: set_muxconf_regs
  74. * Description: Setting up the configuration Mux registers specific to the
  75. * hardware. Many pins need to be moved from protect to primary
  76. * mode.
  77. */
  78. void set_muxconf_regs(void)
  79. {
  80. MUX_MCX();
  81. }
  82. #if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
  83. int board_mmc_init(bd_t *bis)
  84. {
  85. return omap_mmc_init(0, 0, 0);
  86. }
  87. #endif
  88. #ifdef CONFIG_USB_EHCI_OMAP
  89. #define USB_HOST_PWR_EN 132
  90. int board_usb_init(void)
  91. {
  92. if (gpio_request(USB_HOST_PWR_EN, "USB_HOST_PWR_EN") < 0) {
  93. puts("Failed to get USB_HOST_PWR_EN pin\n");
  94. return -ENODEV;
  95. }
  96. gpio_direction_output(USB_HOST_PWR_EN, 1);
  97. return 0;
  98. }
  99. #endif