setup.c 1.5 KB

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