pb1x00.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2003
  4. * Thomas.Lange@corelatus.se
  5. */
  6. #include <common.h>
  7. #include <command.h>
  8. #include <mach/au1x00.h>
  9. #include <asm/mipsregs.h>
  10. #include <asm/io.h>
  11. DECLARE_GLOBAL_DATA_PTR;
  12. int dram_init(void)
  13. {
  14. /* Sdram is setup by assembler code */
  15. /* If memory could be changed, we should return the true value here */
  16. gd->ram_size = 64 * 1024 * 1024;
  17. return 0;
  18. }
  19. #define BCSR_PCMCIA_PC0DRVEN 0x0010
  20. #define BCSR_PCMCIA_PC0RST 0x0080
  21. /* In arch/mips/cpu/cpu.c */
  22. void write_one_tlb( int index, u32 pagemask, u32 hi, u32 low0, u32 low1 );
  23. int checkboard (void)
  24. {
  25. #if defined(CONFIG_IDE_PCMCIA) && 0
  26. u16 status;
  27. #endif
  28. /* volatile u32 *pcmcia_bcsr = (u32*)(DB1000_BCSR_ADDR+0x10); */
  29. volatile u32 *sys_counter = (volatile u32*)SYS_COUNTER_CNTRL;
  30. u32 proc_id;
  31. *sys_counter = 0x100; /* Enable 32 kHz oscillator for RTC/TOY */
  32. proc_id = read_c0_prid();
  33. switch (proc_id >> 24) {
  34. case 0:
  35. puts ("Board: Pb1000\n");
  36. printf ("CPU: Au1000 396 MHz, id: 0x%02x, rev: 0x%02x\n",
  37. (proc_id >> 8) & 0xFF, proc_id & 0xFF);
  38. break;
  39. case 1:
  40. puts ("Board: Pb1500\n");
  41. printf ("CPU: Au1500, id: 0x%02x, rev: 0x%02x\n",
  42. (proc_id >> 8) & 0xFF, proc_id & 0xFF);
  43. break;
  44. case 2:
  45. puts ("Board: Pb1100\n");
  46. printf ("CPU: Au1100, id: 0x%02x, rev: 0x%02x\n",
  47. (proc_id >> 8) & 0xFF, proc_id & 0xFF);
  48. break;
  49. default:
  50. printf ("Unsupported cpu %d, proc_id=0x%x\n", proc_id >> 24, proc_id);
  51. }
  52. set_io_port_base(0);
  53. #if defined(CONFIG_IDE_PCMCIA) && 0
  54. /* Enable 3.3 V on slot 0 ( VCC )
  55. No 5V */
  56. status = 4;
  57. *pcmcia_bcsr = status;
  58. status |= BCSR_PCMCIA_PC0DRVEN;
  59. *pcmcia_bcsr = status;
  60. au_sync();
  61. udelay(300*1000);
  62. status |= BCSR_PCMCIA_PC0RST;
  63. *pcmcia_bcsr = status;
  64. au_sync();
  65. udelay(100*1000);
  66. /* PCMCIA is on a 36 bit physical address.
  67. We need to map it into a 32 bit addresses */
  68. #if 0
  69. /* We dont need theese unless we run whole pcmcia package */
  70. write_one_tlb(20, /* index */
  71. 0x01ffe000, /* Pagemask, 16 MB pages */
  72. CONFIG_SYS_PCMCIA_IO_BASE, /* Hi */
  73. 0x3C000017, /* Lo0 */
  74. 0x3C200017); /* Lo1 */
  75. write_one_tlb(21, /* index */
  76. 0x01ffe000, /* Pagemask, 16 MB pages */
  77. CONFIG_SYS_PCMCIA_ATTR_BASE, /* Hi */
  78. 0x3D000017, /* Lo0 */
  79. 0x3D200017); /* Lo1 */
  80. #endif /* 0 */
  81. write_one_tlb(22, /* index */
  82. 0x01ffe000, /* Pagemask, 16 MB pages */
  83. CONFIG_SYS_PCMCIA_MEM_ADDR, /* Hi */
  84. 0x3E000017, /* Lo0 */
  85. 0x3E200017); /* Lo1 */
  86. #endif /* CONFIG_IDE_PCMCIA */
  87. return 0;
  88. }