dbau1x00.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * (C) Copyright 2003
  3. * Thomas.Lange@corelatus.se
  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 <command.h>
  25. #include <asm/au1x00.h>
  26. #include <asm/mipsregs.h>
  27. long int initdram(int board_type)
  28. {
  29. /* Sdram is setup by assembler code */
  30. /* If memory could be changed, we should return the true value here */
  31. return 64*1024*1024;
  32. }
  33. #define BCSR_PCMCIA_PC0DRVEN 0x0010
  34. #define BCSR_PCMCIA_PC0RST 0x0080
  35. /* In cpu/mips/cpu.c */
  36. void write_one_tlb( int index, u32 pagemask, u32 hi, u32 low0, u32 low1 );
  37. #ifdef CONFIG_DBAU1100
  38. #warning "FIXME Check that bcsr is the same as dbau1000 board!"
  39. #endif
  40. #ifdef CONFIG_DBAU1500
  41. #warning "FIXME Check that bcsr is the same as dbau1000 board!"
  42. #endif
  43. int checkboard (void)
  44. {
  45. u16 status;
  46. volatile u32 *pcmcia_bcsr = (u32*)(DB1000_BCSR_ADDR+0x10);
  47. volatile u32 *phy = (u32*)(DB1000_BCSR_ADDR+0xC);
  48. volatile u32 *sys_counter = (volatile u32*)SYS_COUNTER_CNTRL;
  49. u32 proc_id;
  50. *sys_counter = 0x100; /* Enable 32 kHz oscillator for RTC/TOY */
  51. proc_id = read_32bit_cp0_register(CP0_PRID);
  52. switch (proc_id >> 24) {
  53. case 0:
  54. puts ("Board: Merlot (DbAu1000)\n");
  55. printf ("CPU: Au1000 396 MHz, id: 0x%02x, rev: 0x%02x\n",
  56. (proc_id >> 8) & 0xFF, proc_id & 0xFF);
  57. break;
  58. case 1:
  59. puts ("Board: DbAu1500\n");
  60. printf ("CPU: Au1500, id: 0x%02x, rev: 0x%02x\n",
  61. (proc_id >> 8) & 0xFF, proc_id & 0xFF);
  62. break;
  63. case 2:
  64. puts ("Board: DbAu1100\n");
  65. printf ("CPU: Au1100, id: 0x%02x, rev: 0x%02x\n",
  66. (proc_id >> 8) & 0xFF, proc_id & 0xFF);
  67. break;
  68. default:
  69. printf ("Unsupported cpu %d, proc_id=0x%x\n", proc_id >> 24, proc_id);
  70. }
  71. #ifdef CONFIG_IDE_PCMCIA
  72. /* Enable 3.3 V on slot 0 ( VCC )
  73. No 5V */
  74. status = 4;
  75. *pcmcia_bcsr = status;
  76. status |= BCSR_PCMCIA_PC0DRVEN;
  77. *pcmcia_bcsr = status;
  78. au_sync();
  79. udelay(300*1000);
  80. status |= BCSR_PCMCIA_PC0RST;
  81. *pcmcia_bcsr = status;
  82. au_sync();
  83. udelay(100*1000);
  84. /* PCMCIA is on a 36 bit physical address.
  85. We need to map it into a 32 bit addresses */
  86. #if 0
  87. /* We dont need theese unless we run whole pcmcia package */
  88. write_one_tlb(20, /* index */
  89. 0x01ffe000, /* Pagemask, 16 MB pages */
  90. CFG_PCMCIA_IO_BASE, /* Hi */
  91. 0x3C000017, /* Lo0 */
  92. 0x3C200017); /* Lo1 */
  93. write_one_tlb(21, /* index */
  94. 0x01ffe000, /* Pagemask, 16 MB pages */
  95. CFG_PCMCIA_ATTR_BASE, /* Hi */
  96. 0x3D000017, /* Lo0 */
  97. 0x3D200017); /* Lo1 */
  98. #endif
  99. write_one_tlb(22, /* index */
  100. 0x01ffe000, /* Pagemask, 16 MB pages */
  101. CFG_PCMCIA_MEM_ADDR, /* Hi */
  102. 0x3E000017, /* Lo0 */
  103. 0x3E200017); /* Lo1 */
  104. /* Release reset of ethernet PHY chips */
  105. /* Always do this, because linux does not know about it */
  106. *phy = 3;
  107. return 0;
  108. #endif
  109. }