bmw.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * (C) Copyright 2002
  3. * James F. Dougherty, Broadcom Corporation, jfd@broadcom.com
  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. #include <common.h>
  24. #include <common.h>
  25. #include <watchdog.h>
  26. #include <command.h>
  27. #include <malloc.h>
  28. #include <devices.h>
  29. #include <net.h>
  30. #include <timestamp.h>
  31. #include <dtt.h>
  32. #include <mpc824x.h>
  33. #include <asm/processor.h>
  34. #include <linux/mtd/doc2000.h>
  35. #include "bmw.h"
  36. #include "m48t59y.h"
  37. #include <pci.h>
  38. int checkboard(void)
  39. {
  40. ulong busfreq = get_bus_freq(0);
  41. char buf[32];
  42. puts ("Board: BMW MPC8245/KAHLUA2 - CHRP (MAP B)\n");
  43. printf("Built: %s at %s\n", U_BOOT_DATE, U_BOOT_TIME);
  44. /* printf("MPLD: Revision %d\n", SYS_REVID_GET()); */
  45. printf("Local Bus at %s MHz\n", strmhz(buf, busfreq));
  46. return 0;
  47. }
  48. phys_size_t initdram(int board_type)
  49. {
  50. return 64*1024*1024;
  51. }
  52. void
  53. get_tod(void)
  54. {
  55. int year, month, day, hour, minute, second;
  56. m48_tod_get(&year,
  57. &month,
  58. &day,
  59. &hour,
  60. &minute,
  61. &second);
  62. printf(" Current date/time: %d/%d/%d %d:%d:%d \n",
  63. month, day, year, hour, minute, second);
  64. }
  65. /*
  66. * EPIC, PCI, and I/O devices.
  67. * Initialize Mousse Platform, probe for PCI devices,
  68. * Query configuration parameters if not set.
  69. */
  70. int misc_init_f (void)
  71. {
  72. #if 0
  73. m48_tod_init(); /* Init SGS M48T59Y TOD/NVRAM */
  74. printf("RTC: M48T589 TOD/NVRAM (%d) bytes\n",
  75. TOD_NVRAM_SIZE);
  76. get_tod();
  77. #endif
  78. sys_led_msg("BOOT");
  79. return 0;
  80. }
  81. /*
  82. * Initialize PCI Devices, report devices found.
  83. */
  84. struct pci_controller hose;
  85. void pci_init_board (void)
  86. {
  87. pci_mpc824x_init(&hose);
  88. /* pci_dev_init(0); */
  89. }
  90. /*
  91. * Write characters to LCD display.
  92. * Note that the bytes for the first character is the last address.
  93. */
  94. void
  95. sys_led_msg(char* msg)
  96. {
  97. LED_REG(0) = msg[3];
  98. LED_REG(1) = msg[2];
  99. LED_REG(2) = msg[1];
  100. LED_REG(3) = msg[0];
  101. }
  102. /*
  103. * Map onboard TSOP-16MB DOC FLASH chip.
  104. */
  105. void doc_init (void)
  106. {
  107. doc_probe(DOC_BASE_ADDR);
  108. }
  109. #define NV_ADDR ((volatile unsigned char *) CONFIG_ENV_ADDR)
  110. /* Read from NVRAM */
  111. void*
  112. nvram_read(void *dest, const long src, size_t count)
  113. {
  114. int i;
  115. volatile unsigned char* d = (unsigned char*)dest;
  116. volatile unsigned char* s = (unsigned char*)src;
  117. for( i = 0; i < count;i++)
  118. d[i] = s[i];
  119. return dest;
  120. }
  121. /* Write to NVRAM */
  122. void
  123. nvram_write(long dest, const void *src, size_t count)
  124. {
  125. int i;
  126. volatile unsigned char* d = (unsigned char*)dest;
  127. volatile unsigned char* s = (unsigned char*)src;
  128. SYS_TOD_UNPROTECT();
  129. for( i = 0; i < count;i++)
  130. d[i] = s[i];
  131. SYS_TOD_PROTECT();
  132. }