mx23evk.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 <asm/gpio.h>
  15. #include <asm/arch/imx-regs.h>
  16. #include <asm/arch/clock.h>
  17. #include <asm/arch/iomux-mx23.h>
  18. #include <asm/arch/sys_proto.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. /* Power on LCD */
  30. gpio_direction_output(MX23_PAD_LCD_RESET__GPIO_1_18, 1);
  31. /* Set contrast to maximum */
  32. gpio_direction_output(MX23_PAD_PWM2__GPIO_1_28, 1);
  33. return 0;
  34. }
  35. int dram_init(void)
  36. {
  37. return mxs_dram_init();
  38. }
  39. int board_init(void)
  40. {
  41. /* Adress of boot parameters */
  42. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  43. return 0;
  44. }
  45. #ifdef CONFIG_CMD_MMC
  46. static int mx23evk_mmc_wp(int id)
  47. {
  48. if (id != 0) {
  49. printf("MXS MMC: Invalid card selected (card id = %d)\n", id);
  50. return 1;
  51. }
  52. return gpio_get_value(MX23_PAD_PWM4__GPIO_1_30);
  53. }
  54. int board_mmc_init(bd_t *bis)
  55. {
  56. /* Configure WP as input */
  57. gpio_direction_input(MX23_PAD_PWM4__GPIO_1_30);
  58. /* Configure MMC0 Power Enable */
  59. gpio_direction_output(MX23_PAD_PWM3__GPIO_1_29, 0);
  60. return mxsmmc_initialize(bis, 0, mx23evk_mmc_wp, NULL);
  61. }
  62. #endif