mx23evk.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Freescale MX23EVK board
  3. *
  4. * (C) Copyright 2013 O.S. Systems Software LTDA.
  5. *
  6. * Author: Otavio Salvador <otavio@ossystems.com.br>
  7. *
  8. * Based on m28evk.c:
  9. * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
  10. * on behalf of DENX Software Engineering GmbH
  11. *
  12. * See file CREDITS for list of people who contributed to this
  13. * project.
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License as
  17. * published by the Free Software Foundation; either version 2 of
  18. * the License, or (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. */
  25. #include <common.h>
  26. #include <asm/gpio.h>
  27. #include <asm/arch/imx-regs.h>
  28. #include <asm/arch/clock.h>
  29. #include <asm/arch/iomux-mx23.h>
  30. #include <asm/arch/sys_proto.h>
  31. DECLARE_GLOBAL_DATA_PTR;
  32. /*
  33. * Functions
  34. */
  35. int board_early_init_f(void)
  36. {
  37. /* IO0 clock at 480MHz */
  38. mxs_set_ioclk(MXC_IOCLK0, 480000);
  39. /* SSP0 clock at 96MHz */
  40. mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
  41. return 0;
  42. }
  43. int dram_init(void)
  44. {
  45. return mxs_dram_init();
  46. }
  47. int board_init(void)
  48. {
  49. /* Adress of boot parameters */
  50. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  51. return 0;
  52. }
  53. #ifdef CONFIG_CMD_MMC
  54. static int mx23evk_mmc_wp(int id)
  55. {
  56. if (id != 0) {
  57. printf("MXS MMC: Invalid card selected (card id = %d)\n", id);
  58. return 1;
  59. }
  60. return gpio_get_value(MX23_PAD_PWM4__GPIO_1_30);
  61. }
  62. int board_mmc_init(bd_t *bis)
  63. {
  64. /* Configure WP as input */
  65. gpio_direction_input(MX23_PAD_PWM4__GPIO_1_30);
  66. /* Configure MMC0 Power Enable */
  67. gpio_direction_output(MX23_PAD_PWM3__GPIO_1_29, 0);
  68. return mxsmmc_initialize(bis, 0, mx23evk_mmc_wp, NULL);
  69. }
  70. #endif