boot-common.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. DECLARE_GLOBAL_DATA_PTR;
  25. #ifdef CONFIG_SPL_BUILD
  26. u32 spl_boot_device(void)
  27. {
  28. return (u32) (gd->arch.omap_boot_params.omap_bootdevice);
  29. }
  30. u32 spl_boot_mode(void)
  31. {
  32. return gd->arch.omap_boot_params.omap_bootmode;
  33. }
  34. void spl_board_init(void)
  35. {
  36. #ifdef CONFIG_SPL_NAND_SUPPORT
  37. gpmc_init();
  38. #endif
  39. #if defined(CONFIG_AM33XX) && defined(CONFIG_SPL_MUSB_NEW_SUPPORT)
  40. arch_misc_init();
  41. #endif
  42. }
  43. int board_mmc_init(bd_t *bis)
  44. {
  45. switch (spl_boot_device()) {
  46. case BOOT_DEVICE_MMC1:
  47. omap_mmc_init(0, 0, 0, -1, -1);
  48. break;
  49. case BOOT_DEVICE_MMC2:
  50. case BOOT_DEVICE_MMC2_2:
  51. omap_mmc_init(1, 0, 0, -1, -1);
  52. break;
  53. }
  54. return 0;
  55. }
  56. void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
  57. {
  58. typedef void __noreturn (*image_entry_noargs_t)(u32 *);
  59. image_entry_noargs_t image_entry =
  60. (image_entry_noargs_t) spl_image->entry_point;
  61. debug("image entry point: 0x%X\n", spl_image->entry_point);
  62. /* Pass the saved boot_params from rom code */
  63. image_entry((u32 *)&gd->arch.omap_boot_params);
  64. }
  65. #endif