cpu_init.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. * Copyright (C) 2004-2006 Freescale Semiconductor, Inc.
  3. * (C) Copyright 2007 DENX Software Engineering
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  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. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. *
  23. * Derived from the MPC83xx code.
  24. *
  25. */
  26. #include <common.h>
  27. #include <mpc512x.h>
  28. DECLARE_GLOBAL_DATA_PTR;
  29. /*
  30. * Set up the memory map, initialize registers,
  31. */
  32. void cpu_init_f (volatile immap_t * im)
  33. {
  34. u32 ips_div;
  35. /* Pointer is writable since we allocated a register for it */
  36. gd = (gd_t *) (CFG_INIT_RAM_ADDR + CFG_GBL_DATA_OFFSET);
  37. /* Clear initial global data */
  38. memset ((void *) gd, 0, sizeof (gd_t));
  39. /* system performance tweaking */
  40. #ifdef CFG_ACR_PIPE_DEP
  41. /* Arbiter pipeline depth */
  42. im->arbiter.acr = (im->arbiter.acr & ~ACR_PIPE_DEP) |
  43. (CFG_ACR_PIPE_DEP << ACR_PIPE_DEP_SHIFT);
  44. #endif
  45. #ifdef CFG_ACR_RPTCNT
  46. /* Arbiter repeat count */
  47. im->arbiter.acr = ((im->arbiter.acr & ~(ACR_RPTCNT)) |
  48. (CFG_ACR_RPTCNT << ACR_RPTCNT_SHIFT));
  49. #endif
  50. /* RSR - Reset Status Register - clear all status */
  51. gd->reset_status = im->reset.rsr;
  52. im->reset.rsr = ~(RSR_RES);
  53. /*
  54. * RMR - Reset Mode Register - enable checkstop reset
  55. */
  56. im->reset.rmr = (RMR_CSRE & (1 << RMR_CSRE_SHIFT));
  57. /* Set IPS-CSB divider: IPS = 1/2 CSB */
  58. ips_div = im->clk.scfr[0];
  59. ips_div &= ~(SCFR1_IPS_DIV_MASK);
  60. ips_div |= SCFR1_IPS_DIV << SCFR1_IPS_DIV_SHIFT;
  61. im->clk.scfr[0] = ips_div;
  62. /*
  63. * Enable Time Base/Decrementer
  64. *
  65. * NOTICE: TB needs to be enabled as early as possible in order to
  66. * have udelay() working; if not enabled, usually leads to a hang, like
  67. * during FLASH chip identification etc.
  68. */
  69. im->sysconf.spcr |= SPCR_TBEN;
  70. }
  71. int cpu_init_r (void)
  72. {
  73. return 0;
  74. }