cm41xx.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * (C) Copyright 2005
  3. * Greg Ungerer, OpenGear Inc, <greg.ungerer@opengear.com>
  4. *
  5. * (C) Copyright 2002
  6. * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
  7. *
  8. * (C) Copyright 2002
  9. * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
  10. * Marius Groeger <mgroeger@sysgo.de>
  11. *
  12. * See file CREDITS for list of people who contributed to this
  13. * project.
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License as
  17. * published by the Free Software Foundation; either version 2 of
  18. * the License, or (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  28. * MA 02111-1307 USA
  29. */
  30. #include <common.h>
  31. #include <asm/arch/platform.h>
  32. DECLARE_GLOBAL_DATA_PTR;
  33. /* ------------------------------------------------------------------------- */
  34. #define ks8695_read(a) *((volatile unsigned int *) (KS8695_IO_BASE+(a)))
  35. #define ks8695_write(a,b) *((volatile unsigned int *) (KS8695_IO_BASE+(a))) = (b)
  36. /* ------------------------------------------------------------------------- */
  37. /*
  38. * Miscelaneous platform dependent initialisations
  39. */
  40. int env_flash_cmdline (void)
  41. {
  42. unsigned char *sp = (unsigned char *) 0x0201c020;
  43. unsigned char *ep;
  44. int len;
  45. /* Check if "erase" push button is depressed */
  46. if ((ks8695_read(KS8695_GPIO_DATA) & 0x8) == 0) {
  47. printf("### Entering network recovery mode...\n");
  48. setenv("bootargs", "console=ttyAM0,115200 mem=32M initrd=0x400000,8M root=/dev/ram0");
  49. setenv("bootcmd", "bootp 0x400000; gofsk 0x400000");
  50. setenv("bootdelay", "2");
  51. return 0;
  52. }
  53. /* Check for flash based kernel boot args to use as default */
  54. for (ep = sp, len = 0; ((len < 1024) && (*ep != 0)); ep++, len++)
  55. ;
  56. if ((len > 0) && (len <1024))
  57. setenv("bootargs", sp);
  58. return 0;
  59. }
  60. int board_late_init (void)
  61. {
  62. return 0;
  63. }
  64. int board_init (void)
  65. {
  66. /* arch number of CM41xx */
  67. gd->bd->bi_arch_number = 672;
  68. /* adress of boot parameters */
  69. gd->bd->bi_boot_params = 0x00000100;
  70. /* power down all but port 0 on the switch */
  71. ks8695_write(KS8695_SWITCH_LPPM12, 0x00000005);
  72. ks8695_write(KS8695_SWITCH_LPPM34, 0x00050005);
  73. return 0;
  74. }
  75. int dram_init (void)
  76. {
  77. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  78. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  79. return (0);
  80. }