mx23evk.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Freescale MX23EVK board
  4. *
  5. * (C) Copyright 2013 O.S. Systems Software LTDA.
  6. *
  7. * Author: Otavio Salvador <otavio@ossystems.com.br>
  8. *
  9. * Based on m28evk.c:
  10. * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
  11. * on behalf of DENX Software Engineering GmbH
  12. */
  13. #include <common.h>
  14. #include <init.h>
  15. #include <asm/gpio.h>
  16. #include <asm/arch/imx-regs.h>
  17. #include <asm/arch/clock.h>
  18. #include <asm/arch/iomux-mx23.h>
  19. #include <asm/arch/sys_proto.h>
  20. DECLARE_GLOBAL_DATA_PTR;
  21. /*
  22. * Functions
  23. */
  24. int board_early_init_f(void)
  25. {
  26. /* IO0 clock at 480MHz */
  27. mxs_set_ioclk(MXC_IOCLK0, 480000);
  28. /* SSP0 clock at 96MHz */
  29. mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
  30. /* Power on LCD */
  31. gpio_direction_output(MX23_PAD_LCD_RESET__GPIO_1_18, 1);
  32. /* Set contrast to maximum */
  33. gpio_direction_output(MX23_PAD_PWM2__GPIO_1_28, 1);
  34. return 0;
  35. }
  36. int dram_init(void)
  37. {
  38. return mxs_dram_init();
  39. }
  40. int board_init(void)
  41. {
  42. /* Adress of boot parameters */
  43. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  44. return 0;
  45. }
  46. #ifdef CONFIG_CMD_MMC
  47. static int mx23evk_mmc_wp(int id)
  48. {
  49. if (id != 0) {
  50. printf("MXS MMC: Invalid card selected (card id = %d)\n", id);
  51. return 1;
  52. }
  53. return gpio_get_value(MX23_PAD_PWM4__GPIO_1_30);
  54. }
  55. int board_mmc_init(struct bd_info *bis)
  56. {
  57. /* Configure WP as input */
  58. gpio_direction_input(MX23_PAD_PWM4__GPIO_1_30);
  59. /* Configure MMC0 Power Enable */
  60. gpio_direction_output(MX23_PAD_PWM3__GPIO_1_29, 0);
  61. return mxsmmc_initialize(bis, 0, mx23evk_mmc_wp, NULL);
  62. }
  63. #endif