mx23_olinuxino.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Olimex MX23 Olinuxino board
  4. *
  5. * Copyright (C) 2013 Marek Vasut <marex@denx.de>
  6. */
  7. #include <common.h>
  8. #include <init.h>
  9. #include <asm/gpio.h>
  10. #include <asm/io.h>
  11. #include <asm/arch/iomux-mx23.h>
  12. #include <asm/arch/imx-regs.h>
  13. #include <asm/arch/clock.h>
  14. #include <asm/arch/sys_proto.h>
  15. #ifdef CONFIG_LED_STATUS
  16. #include <status_led.h>
  17. #endif
  18. #include <linux/delay.h>
  19. DECLARE_GLOBAL_DATA_PTR;
  20. /*
  21. * Functions
  22. */
  23. int board_early_init_f(void)
  24. {
  25. /* IO0 clock at 480MHz */
  26. mxs_set_ioclk(MXC_IOCLK0, 480000);
  27. /* SSP0 clock at 96MHz */
  28. mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
  29. return 0;
  30. }
  31. #ifdef CONFIG_CMD_USB
  32. int board_ehci_hcd_init(int port)
  33. {
  34. /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
  35. gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
  36. udelay(100);
  37. return 0;
  38. }
  39. int board_ehci_hcd_exit(int port)
  40. {
  41. /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
  42. gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 0);
  43. return 0;
  44. }
  45. #endif
  46. int dram_init(void)
  47. {
  48. return mxs_dram_init();
  49. }
  50. #ifdef CONFIG_CMD_MMC
  51. static int mx23_olx_mmc_cd(int id)
  52. {
  53. return 1; /* Card always present */
  54. }
  55. int board_mmc_init(struct bd_info *bis)
  56. {
  57. return mxsmmc_initialize(bis, 0, NULL, mx23_olx_mmc_cd);
  58. }
  59. #endif
  60. int board_init(void)
  61. {
  62. /* Adress of boot parameters */
  63. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  64. #if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE)
  65. status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_STATE);
  66. #endif
  67. return 0;
  68. }