spl.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-License-Identifier: GPL-2.0+
  2. #include <asm/io.h>
  3. #include <asm/arch/mem.h>
  4. #include <asm/arch/sys_proto.h>
  5. #include <jffs2/load_kernel.h>
  6. #include <linux/mtd/rawnand.h>
  7. #include "igep00x0.h"
  8. /*
  9. * Routine: get_board_mem_timings
  10. * Description: If we use SPL then there is no x-loader nor config header
  11. * so we have to setup the DDR timings ourself on both banks.
  12. */
  13. void get_board_mem_timings(struct board_sdrc_timings *timings)
  14. {
  15. int mfr, id, err = identify_nand_chip(&mfr, &id);
  16. timings->mr = MICRON_V_MR_165;
  17. if (!err) {
  18. switch (mfr) {
  19. case NAND_MFR_HYNIX:
  20. timings->mcfg = HYNIX_V_MCFG_200(256 << 20);
  21. timings->ctrla = HYNIX_V_ACTIMA_200;
  22. timings->ctrlb = HYNIX_V_ACTIMB_200;
  23. break;
  24. case NAND_MFR_MICRON:
  25. timings->mcfg = MICRON_V_MCFG_200(256 << 20);
  26. timings->ctrla = MICRON_V_ACTIMA_200;
  27. timings->ctrlb = MICRON_V_ACTIMB_200;
  28. break;
  29. default:
  30. /* Should not happen... */
  31. break;
  32. }
  33. timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
  34. gpmc_cs0_flash = MTD_DEV_TYPE_NAND;
  35. } else {
  36. if (get_cpu_family() == CPU_OMAP34XX) {
  37. timings->mcfg = NUMONYX_V_MCFG_165(256 << 20);
  38. timings->ctrla = NUMONYX_V_ACTIMA_165;
  39. timings->ctrlb = NUMONYX_V_ACTIMB_165;
  40. timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz;
  41. } else {
  42. timings->mcfg = NUMONYX_V_MCFG_200(256 << 20);
  43. timings->ctrla = NUMONYX_V_ACTIMA_200;
  44. timings->ctrlb = NUMONYX_V_ACTIMB_200;
  45. timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_200MHz;
  46. }
  47. gpmc_cs0_flash = MTD_DEV_TYPE_ONENAND;
  48. }
  49. }
  50. #ifdef CONFIG_SPL_OS_BOOT
  51. int spl_start_uboot(void)
  52. {
  53. /* break into full u-boot on 'c' */
  54. if (serial_tstc() && serial_getc() == 'c')
  55. return 1;
  56. return 0;
  57. }
  58. #endif