onenand.c 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Voipac PXA270 OneNAND SPL
  3. *
  4. * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #include <common.h>
  25. #include <config.h>
  26. #include <asm/io.h>
  27. #include <onenand_uboot.h>
  28. #include <asm/arch/pxa.h>
  29. void board_init_f(unsigned long unused)
  30. {
  31. extern uint32_t _end;
  32. uint32_t tmp;
  33. asm volatile("mov %0, pc" : "=r"(tmp));
  34. tmp >>= 24;
  35. /* The code runs from OneNAND RAM, copy SPL to SRAM and execute it. */
  36. if (tmp == 0) {
  37. tmp = (uint32_t)&_end - CONFIG_SPL_TEXT_BASE;
  38. onenand_spl_load_image(0, tmp, (void *)CONFIG_SPL_TEXT_BASE);
  39. asm volatile("mov pc, %0" : : "r"(CONFIG_SPL_TEXT_BASE));
  40. }
  41. /* Hereby, the code runs from (S)RAM, copy U-Boot and execute it. */
  42. arch_cpu_init();
  43. pxa2xx_dram_init();
  44. onenand_spl_load_image(CONFIG_SPL_ONENAND_LOAD_ADDR,
  45. CONFIG_SPL_ONENAND_LOAD_SIZE,
  46. (void *)CONFIG_SYS_TEXT_BASE);
  47. asm volatile("mov pc, %0" : : "r"(CONFIG_SYS_TEXT_BASE));
  48. for (;;)
  49. ;
  50. }
  51. void __attribute__((noreturn)) hang(void)
  52. {
  53. for (;;)
  54. ;
  55. }
  56. void icache_disable(void) {}
  57. void dcache_disable(void) {}