pb1x00.c 2.6 KB

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