am3517evm.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * am3517evm.c - board file for TI's AM3517 family of devices.
  3. *
  4. * Author: Vaibhav Hiremath <hvaibhav@ti.com>
  5. *
  6. * Based on ti/evm/evm.c
  7. *
  8. * Copyright (C) 2010
  9. * Texas Instruments Incorporated - http://www.ti.com/
  10. *
  11. * SPDX-License-Identifier: GPL-2.0+
  12. */
  13. #include <common.h>
  14. #include <asm/io.h>
  15. #include <asm/omap_musb.h>
  16. #include <asm/arch/am35x_def.h>
  17. #include <asm/arch/mem.h>
  18. #include <asm/arch/mux.h>
  19. #include <asm/arch/sys_proto.h>
  20. #include <asm/arch/mmc_host_def.h>
  21. #include <asm/arch/musb.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/errno.h>
  24. #include <linux/usb/ch9.h>
  25. #include <linux/usb/gadget.h>
  26. #include <linux/usb/musb.h>
  27. #include <i2c.h>
  28. #include <netdev.h>
  29. #include "am3517evm.h"
  30. DECLARE_GLOBAL_DATA_PTR;
  31. /*
  32. * Routine: board_init
  33. * Description: Early hardware init.
  34. */
  35. int board_init(void)
  36. {
  37. gpmc_init(); /* in SRAM or SDRAM, finish GPMC */
  38. /* board id for Linux */
  39. gd->bd->bi_arch_number = MACH_TYPE_OMAP3517EVM;
  40. /* boot param addr */
  41. gd->bd->bi_boot_params = (OMAP34XX_SDRC_CS0 + 0x100);
  42. return 0;
  43. }
  44. #ifdef CONFIG_USB_MUSB_AM35X
  45. static struct musb_hdrc_config musb_config = {
  46. .multipoint = 1,
  47. .dyn_fifo = 1,
  48. .num_eps = 16,
  49. .ram_bits = 12,
  50. };
  51. static struct omap_musb_board_data musb_board_data = {
  52. .set_phy_power = am35x_musb_phy_power,
  53. .clear_irq = am35x_musb_clear_irq,
  54. .reset = am35x_musb_reset,
  55. };
  56. static struct musb_hdrc_platform_data musb_plat = {
  57. #if defined(CONFIG_MUSB_HOST)
  58. .mode = MUSB_HOST,
  59. #elif defined(CONFIG_MUSB_GADGET)
  60. .mode = MUSB_PERIPHERAL,
  61. #else
  62. #error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET"
  63. #endif
  64. .config = &musb_config,
  65. .power = 250,
  66. .platform_ops = &am35x_ops,
  67. .board_data = &musb_board_data,
  68. };
  69. static void am3517_evm_musb_init(void)
  70. {
  71. /*
  72. * Set up USB clock/mode in the DEVCONF2 register.
  73. * USB2.0 PHY reference clock is 13 MHz
  74. */
  75. clrsetbits_le32(&am35x_scm_general_regs->devconf2,
  76. CONF2_REFFREQ | CONF2_OTGMODE | CONF2_PHY_GPIOMODE,
  77. CONF2_REFFREQ_13MHZ | CONF2_SESENDEN |
  78. CONF2_VBDTCTEN | CONF2_DATPOL);
  79. musb_register(&musb_plat, &musb_board_data,
  80. (void *)AM35XX_IPSS_USBOTGSS_BASE);
  81. }
  82. #else
  83. #define am3517_evm_musb_init() do {} while (0)
  84. #endif
  85. /*
  86. * Routine: misc_init_r
  87. * Description: Init i2c, ethernet, etc... (done here so udelay works)
  88. */
  89. int misc_init_r(void)
  90. {
  91. #ifdef CONFIG_DRIVER_OMAP34XX_I2C
  92. i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
  93. #endif
  94. dieid_num_r();
  95. am3517_evm_musb_init();
  96. return 0;
  97. }
  98. /*
  99. * Routine: set_muxconf_regs
  100. * Description: Setting up the configuration Mux registers specific to the
  101. * hardware. Many pins need to be moved from protect to primary
  102. * mode.
  103. */
  104. void set_muxconf_regs(void)
  105. {
  106. MUX_AM3517EVM();
  107. }
  108. #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
  109. int board_mmc_init(bd_t *bis)
  110. {
  111. return omap_mmc_init(0, 0, 0, -1, -1);
  112. }
  113. #endif
  114. #if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET)
  115. int board_eth_init(bd_t *bis)
  116. {
  117. int rv, n = 0;
  118. rv = cpu_eth_init(bis);
  119. if (rv > 0)
  120. n += rv;
  121. rv = usb_eth_initialize(bis);
  122. if (rv > 0)
  123. n += rv;
  124. return n;
  125. }
  126. #endif