boot-common.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /*
  2. * boot-common.c
  3. *
  4. * Common bootmode functions for omap based boards
  5. *
  6. * Copyright (C) 2011, Texas Instruments, Incorporated - http://www.ti.com/
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the
  16. * GNU General Public License for more details.
  17. */
  18. #include <common.h>
  19. #include <spl.h>
  20. #include <asm/omap_common.h>
  21. #include <asm/arch/omap.h>
  22. #include <asm/arch/mmc_host_def.h>
  23. #include <asm/arch/sys_proto.h>
  24. /*
  25. * This is used to verify if the configuration header
  26. * was executed by rom code prior to control of transfer
  27. * to the bootloader. SPL is responsible for saving and
  28. * passing the boot_params pointer to the u-boot.
  29. */
  30. struct omap_boot_parameters boot_params __attribute__ ((section(".data")));
  31. #ifdef CONFIG_SPL_BUILD
  32. /*
  33. * We use static variables because global data is not ready yet.
  34. * Initialized data is available in SPL right from the beginning.
  35. * We would not typically need to save these parameters in regular
  36. * U-Boot. This is needed only in SPL at the moment.
  37. */
  38. u32 omap_bootmode = MMCSD_MODE_FAT;
  39. u32 spl_boot_device(void)
  40. {
  41. return (u32) (boot_params.omap_bootdevice);
  42. }
  43. u32 spl_boot_mode(void)
  44. {
  45. return omap_bootmode;
  46. }
  47. void spl_board_init(void)
  48. {
  49. #ifdef CONFIG_SPL_NAND_SUPPORT
  50. gpmc_init();
  51. #endif
  52. #if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW_SUPPORT)
  53. arch_misc_init();
  54. #endif
  55. }
  56. int board_mmc_init(bd_t *bis)
  57. {
  58. switch (spl_boot_device()) {
  59. case BOOT_DEVICE_MMC1:
  60. omap_mmc_init(0, 0, 0, -1, -1);
  61. break;
  62. case BOOT_DEVICE_MMC2:
  63. case BOOT_DEVICE_MMC2_2:
  64. omap_mmc_init(1, 0, 0, -1, -1);
  65. break;
  66. }
  67. return 0;
  68. }
  69. #endif