Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * setup.c - boot time setup code
0004  */
0005 
0006 #include <linux/init.h>
0007 #include <linux/export.h>
0008 
0009 #include <asm/bootinfo.h>
0010 #include <asm/reboot.h>
0011 #include <asm/time.h>
0012 #include <linux/ioport.h>
0013 
0014 #include <asm/mach-rc32434/rb.h>
0015 #include <asm/mach-rc32434/pci.h>
0016 
0017 struct pci_reg __iomem *pci_reg;
0018 EXPORT_SYMBOL(pci_reg);
0019 
0020 static struct resource pci0_res[] = {
0021     {
0022         .name = "pci_reg0",
0023         .start = PCI0_BASE_ADDR,
0024         .end = PCI0_BASE_ADDR + sizeof(struct pci_reg),
0025         .flags = IORESOURCE_MEM,
0026     }
0027 };
0028 
0029 static void rb_machine_restart(char *command)
0030 {
0031     /* just jump to the reset vector */
0032     writel(0x80000001, IDT434_REG_BASE + RST);
0033     ((void (*)(void)) KSEG1ADDR(0x1FC00000u))();
0034 }
0035 
0036 static void rb_machine_halt(void)
0037 {
0038     for (;;)
0039         continue;
0040 }
0041 
0042 void __init plat_mem_setup(void)
0043 {
0044     u32 val;
0045 
0046     _machine_restart = rb_machine_restart;
0047     _machine_halt = rb_machine_halt;
0048     pm_power_off = rb_machine_halt;
0049 
0050     set_io_port_base(KSEG1);
0051 
0052     pci_reg = ioremap(pci0_res[0].start,
0053                 pci0_res[0].end - pci0_res[0].start);
0054     if (!pci_reg) {
0055         printk(KERN_ERR "Could not remap PCI registers\n");
0056         return;
0057     }
0058 
0059     val = __raw_readl(&pci_reg->pcic);
0060     val &= 0xFFFFFF7;
0061     __raw_writel(val, (void *)&pci_reg->pcic);
0062 
0063 #ifdef CONFIG_PCI
0064     /* Enable PCI interrupts in EPLD Mask register */
0065     *epld_mask = 0x0;
0066     *(epld_mask + 1) = 0x0;
0067 #endif
0068     write_c0_wired(0);
0069 }
0070 
0071 const char *get_system_type(void)
0072 {
0073     switch (mips_machtype) {
0074     case MACH_MIKROTIK_RB532A:
0075         return "Mikrotik RB532A";
0076         break;
0077     default:
0078         return "Mikrotik RB532";
0079         break;
0080     }
0081 }