setup.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * setup.c - boot time setup code
  3. */
  4. #include <linux/init.h>
  5. #include <asm/bootinfo.h>
  6. #include <asm/reboot.h>
  7. #include <asm/time.h>
  8. #include <linux/ioport.h>
  9. #include <asm/mach-rc32434/rb.h>
  10. #include <asm/mach-rc32434/pci.h>
  11. struct pci_reg __iomem *pci_reg;
  12. EXPORT_SYMBOL(pci_reg);
  13. static struct resource pci0_res[] = {
  14. {
  15. .name = "pci_reg0",
  16. .start = PCI0_BASE_ADDR,
  17. .end = PCI0_BASE_ADDR + sizeof(struct pci_reg),
  18. .flags = IORESOURCE_MEM,
  19. }
  20. };
  21. static void rb_machine_restart(char *command)
  22. {
  23. /* just jump to the reset vector */
  24. writel(0x80000001, IDT434_REG_BASE + RST);
  25. ((void (*)(void)) KSEG1ADDR(0x1FC00000u))();
  26. }
  27. static void rb_machine_halt(void)
  28. {
  29. for (;;)
  30. continue;
  31. }
  32. void __init plat_mem_setup(void)
  33. {
  34. u32 val;
  35. _machine_restart = rb_machine_restart;
  36. _machine_halt = rb_machine_halt;
  37. pm_power_off = rb_machine_halt;
  38. set_io_port_base(KSEG1);
  39. pci_reg = ioremap_nocache(pci0_res[0].start,
  40. pci0_res[0].end - pci0_res[0].start);
  41. if (!pci_reg) {
  42. printk(KERN_ERR "Could not remap PCI registers\n");
  43. return;
  44. }
  45. val = __raw_readl(&pci_reg->pcic);
  46. val &= 0xFFFFFF7;
  47. __raw_writel(val, (void *)&pci_reg->pcic);
  48. #ifdef CONFIG_PCI
  49. /* Enable PCI interrupts in EPLD Mask register */
  50. *epld_mask = 0x0;
  51. *(epld_mask + 1) = 0x0;
  52. #endif
  53. write_c0_wired(0);
  54. }
  55. const char *get_system_type(void)
  56. {
  57. switch (mips_machtype) {
  58. case MACH_MIKROTIK_RB532A:
  59. return "Mikrotik RB532A";
  60. break;
  61. default:
  62. return "Mikrotik RB532";
  63. break;
  64. }
  65. }