0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/io.h>
0010 #include <linux/clk.h>
0011 #include <linux/export.h>
0012 #include <linux/init.h>
0013 #include <linux/sizes.h>
0014 #include <linux/of_fdt.h>
0015 #include <linux/kernel.h>
0016 #include <linux/memblock.h>
0017 #include <linux/of_platform.h>
0018 #include <linux/of_address.h>
0019
0020 #include <asm/reboot.h>
0021 #include <asm/bootinfo.h>
0022 #include <asm/addrspace.h>
0023 #include <asm/prom.h>
0024
0025 #include "common.h"
0026
0027 __iomem void *rt_sysc_membase;
0028 __iomem void *rt_memc_membase;
0029 EXPORT_SYMBOL_GPL(rt_sysc_membase);
0030
0031 __iomem void *plat_of_remap_node(const char *node)
0032 {
0033 struct resource res;
0034 struct device_node *np;
0035
0036 np = of_find_compatible_node(NULL, NULL, node);
0037 if (!np)
0038 panic("Failed to find %s node", node);
0039
0040 if (of_address_to_resource(np, 0, &res))
0041 panic("Failed to get resource for %s", node);
0042
0043 of_node_put(np);
0044
0045 if (!request_mem_region(res.start,
0046 resource_size(&res),
0047 res.name))
0048 panic("Failed to request resources for %s", node);
0049
0050 return ioremap(res.start, resource_size(&res));
0051 }
0052
0053 void __init plat_mem_setup(void)
0054 {
0055 void *dtb;
0056
0057 set_io_port_base(KSEG1);
0058
0059
0060
0061
0062
0063 dtb = get_fdt();
0064 __dt_setup_arch(dtb);
0065
0066 if (!early_init_dt_scan_memory())
0067 return;
0068
0069 if (soc_info.mem_detect)
0070 soc_info.mem_detect();
0071 else if (soc_info.mem_size)
0072 memblock_add(soc_info.mem_base, soc_info.mem_size * SZ_1M);
0073 else
0074 detect_memory_region(soc_info.mem_base,
0075 soc_info.mem_size_min * SZ_1M,
0076 soc_info.mem_size_max * SZ_1M);
0077 }
0078
0079 static int __init plat_of_setup(void)
0080 {
0081 __dt_register_buses(soc_info.compatible, "palmbus");
0082
0083
0084 ralink_rst_init();
0085
0086 return 0;
0087 }
0088
0089 arch_initcall(plat_of_setup);