initcode.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /*
  2. * Code for early processor initialization
  3. *
  4. * Copyright (c) 2004-2011 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __BFIN_INITCODE_H__
  9. #define __BFIN_INITCODE_H__
  10. #include <asm/mach-common/bits/bootrom.h>
  11. #ifndef BFIN_IN_INITCODE
  12. # define serial_putc(c)
  13. #endif
  14. #ifndef __ADSPBF60x__
  15. #ifndef CONFIG_EBIU_RSTCTL_VAL
  16. # define CONFIG_EBIU_RSTCTL_VAL 0 /* only MDDRENABLE is useful */
  17. #endif
  18. #if ((CONFIG_EBIU_RSTCTL_VAL & 0xFFFFFFC4) != 0)
  19. # error invalid EBIU_RSTCTL value: must not set reserved bits
  20. #endif
  21. #ifndef CONFIG_EBIU_MBSCTL_VAL
  22. # define CONFIG_EBIU_MBSCTL_VAL 0
  23. #endif
  24. #if defined(CONFIG_EBIU_DDRQUE_VAL) && ((CONFIG_EBIU_DDRQUE_VAL & 0xFFFF8000) != 0)
  25. # error invalid EBIU_DDRQUE value: must not set reserved bits
  26. #endif
  27. #endif /* __ADSPBF60x__ */
  28. __attribute__((always_inline)) static inline void
  29. program_async_controller(ADI_BOOT_DATA *bs)
  30. {
  31. #ifdef BFIN_IN_INITCODE
  32. /*
  33. * We really only need to setup the async banks early if we're
  34. * booting out of it. Otherwise, do it later on in cpu_init.
  35. */
  36. if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_BYPASS &&
  37. CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_PARA)
  38. return;
  39. #endif
  40. serial_putc('a');
  41. #ifndef __ADSPBF60x__
  42. /* Program the async banks controller. */
  43. #ifdef EBIU_AMGCTL
  44. bfin_write_EBIU_AMBCTL0(CONFIG_EBIU_AMBCTL0_VAL);
  45. bfin_write_EBIU_AMBCTL1(CONFIG_EBIU_AMBCTL1_VAL);
  46. bfin_write_EBIU_AMGCTL(CONFIG_EBIU_AMGCTL_VAL);
  47. #endif
  48. serial_putc('b');
  49. /* Not all parts have these additional MMRs. */
  50. #ifdef EBIU_MBSCTL
  51. bfin_write_EBIU_MBSCTL(CONFIG_EBIU_MBSCTL_VAL);
  52. #endif
  53. #ifdef EBIU_MODE
  54. # ifdef CONFIG_EBIU_MODE_VAL
  55. bfin_write_EBIU_MODE(CONFIG_EBIU_MODE_VAL);
  56. # endif
  57. # ifdef CONFIG_EBIU_FCTL_VAL
  58. bfin_write_EBIU_FCTL(CONFIG_EBIU_FCTL_VAL);
  59. # endif
  60. #endif
  61. serial_putc('c');
  62. #else /* __ADSPBF60x__ */
  63. /* Program the static memory controller. */
  64. # ifdef CONFIG_SMC_GCTL_VAL
  65. bfin_write_SMC_GCTL(CONFIG_SMC_GCTL_VAL);
  66. # endif
  67. # ifdef CONFIG_SMC_B0CTL_VAL
  68. bfin_write_SMC_B0CTL(CONFIG_SMC_B0CTL_VAL);
  69. # endif
  70. # ifdef CONFIG_SMC_B0TIM_VAL
  71. bfin_write_SMC_B0TIM(CONFIG_SMC_B0TIM_VAL);
  72. # endif
  73. # ifdef CONFIG_SMC_B0ETIM_VAL
  74. bfin_write_SMC_B0ETIM(CONFIG_SMC_B0ETIM_VAL);
  75. # endif
  76. # ifdef CONFIG_SMC_B1CTL_VAL
  77. bfin_write_SMC_B1CTL(CONFIG_SMC_B1CTL_VAL);
  78. # endif
  79. # ifdef CONFIG_SMC_B1TIM_VAL
  80. bfin_write_SMC_B1TIM(CONFIG_SMC_B1TIM_VAL);
  81. # endif
  82. # ifdef CONFIG_SMC_B1ETIM_VAL
  83. bfin_write_SMC_B1ETIM(CONFIG_SMC_B1ETIM_VAL);
  84. # endif
  85. # ifdef CONFIG_SMC_B2CTL_VAL
  86. bfin_write_SMC_B2CTL(CONFIG_SMC_B2CTL_VAL);
  87. # endif
  88. # ifdef CONFIG_SMC_B2TIM_VAL
  89. bfin_write_SMC_B2TIM(CONFIG_SMC_B2TIM_VAL);
  90. # endif
  91. # ifdef CONFIG_SMC_B2ETIM_VAL
  92. bfin_write_SMC_B2ETIM(CONFIG_SMC_B2ETIM_VAL);
  93. # endif
  94. # ifdef CONFIG_SMC_B3CTL_VAL
  95. bfin_write_SMC_B3CTL(CONFIG_SMC_B3CTL_VAL);
  96. # endif
  97. # ifdef CONFIG_SMC_B3TIM_VAL
  98. bfin_write_SMC_B3TIM(CONFIG_SMC_B3TIM_VAL);
  99. # endif
  100. # ifdef CONFIG_SMC_B3ETIM_VAL
  101. bfin_write_SMC_B3ETIM(CONFIG_SMC_B3ETIM_VAL);
  102. # endif
  103. #endif /* __ADSPBF60x__ */
  104. serial_putc('d');
  105. }
  106. #endif