diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/Kconfig | 1 | ||||
-rw-r--r-- | arch/mips/include/asm/mips-boards/generic.h | 4 | ||||
-rw-r--r-- | arch/mips/mti-sead3/Makefile | 10 | ||||
-rw-r--r-- | arch/mips/mti-sead3/sead3-init.c | 5 | ||||
-rw-r--r-- | arch/mips/mti-sead3/sead3-memory.c | 138 | ||||
-rw-r--r-- | arch/mips/mti-sead3/sead3-setup.c | 27 | ||||
-rw-r--r-- | arch/mips/mti-sead3/sead3.dts | 26 |
7 files changed, 70 insertions, 141 deletions
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 2ac626ab9d43..1110cd718ff5 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -353,6 +353,7 @@ config MIPS_SEAD3 | |||
353 | select USB_ARCH_HAS_EHCI | 353 | select USB_ARCH_HAS_EHCI |
354 | select USB_EHCI_BIG_ENDIAN_DESC | 354 | select USB_EHCI_BIG_ENDIAN_DESC |
355 | select USB_EHCI_BIG_ENDIAN_MMIO | 355 | select USB_EHCI_BIG_ENDIAN_MMIO |
356 | select USE_OF | ||
356 | help | 357 | help |
357 | This enables support for the MIPS Technologies SEAD3 evaluation | 358 | This enables support for the MIPS Technologies SEAD3 evaluation |
358 | board. | 359 | board. |
diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h index 6e23ceb0ba8c..c01e286394da 100644 --- a/arch/mips/include/asm/mips-boards/generic.h +++ b/arch/mips/include/asm/mips-boards/generic.h | |||
@@ -87,6 +87,10 @@ | |||
87 | 87 | ||
88 | extern int mips_revision_sconid; | 88 | extern int mips_revision_sconid; |
89 | 89 | ||
90 | #ifdef CONFIG_OF | ||
91 | extern struct boot_param_header __dtb_start; | ||
92 | #endif | ||
93 | |||
90 | #ifdef CONFIG_PCI | 94 | #ifdef CONFIG_PCI |
91 | extern void mips_pcibios_init(void); | 95 | extern void mips_pcibios_init(void); |
92 | #else | 96 | #else |
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile index 626afeac4386..10ec701ce6c7 100644 --- a/arch/mips/mti-sead3/Makefile +++ b/arch/mips/mti-sead3/Makefile | |||
@@ -5,10 +5,12 @@ | |||
5 | # Copyright (C) 2008 Wind River Systems, Inc. | 5 | # Copyright (C) 2008 Wind River Systems, Inc. |
6 | # written by Ralf Baechle <ralf@linux-mips.org> | 6 | # written by Ralf Baechle <ralf@linux-mips.org> |
7 | # | 7 | # |
8 | # Copyright (C) 2012 MIPS Technoligies, Inc. All rights reserved. | ||
9 | # Steven J. Hill <sjhill@mips.com> | ||
10 | # | ||
8 | obj-y := sead3-lcd.o sead3-cmdline.o \ | 11 | obj-y := sead3-lcd.o sead3-cmdline.o \ |
9 | sead3-display.o sead3-init.o sead3-int.o \ | 12 | sead3-display.o sead3-init.o sead3-int.o \ |
10 | sead3-mtd.o sead3-net.o \ | 13 | sead3-mtd.o sead3-net.o sead3-platform.o \ |
11 | sead3-memory.o sead3-platform.o \ | ||
12 | sead3-reset.o sead3-setup.o sead3-time.o | 14 | sead3-reset.o sead3-setup.o sead3-time.o |
13 | 15 | ||
14 | obj-y += sead3-i2c-dev.o sead3-i2c.o \ | 16 | obj-y += sead3-i2c-dev.o sead3-i2c.o \ |
@@ -17,3 +19,7 @@ obj-y += sead3-i2c-dev.o sead3-i2c.o \ | |||
17 | 19 | ||
18 | obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o | 20 | obj-$(CONFIG_EARLY_PRINTK) += sead3-console.o |
19 | obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o | 21 | obj-$(CONFIG_USB_EHCI_HCD) += sead3-ehci.o |
22 | obj-$(CONFIG_OF) += sead3.dtb.o | ||
23 | |||
24 | $(obj)/%.dtb: $(obj)/%.dts | ||
25 | $(call if_changed,dtc) | ||
diff --git a/arch/mips/mti-sead3/sead3-init.c b/arch/mips/mti-sead3/sead3-init.c index a958cad6fff6..f95abaa1aa5d 100644 --- a/arch/mips/mti-sead3/sead3-init.c +++ b/arch/mips/mti-sead3/sead3-init.c | |||
@@ -77,7 +77,6 @@ void __init prom_init(void) | |||
77 | board_ejtag_handler_setup = mips_ejtag_setup; | 77 | board_ejtag_handler_setup = mips_ejtag_setup; |
78 | 78 | ||
79 | prom_init_cmdline(); | 79 | prom_init_cmdline(); |
80 | prom_meminit(); | ||
81 | #ifdef CONFIG_EARLY_PRINTK | 80 | #ifdef CONFIG_EARLY_PRINTK |
82 | if ((strstr(prom_getcmdline(), "console=ttyS0")) != NULL) | 81 | if ((strstr(prom_getcmdline(), "console=ttyS0")) != NULL) |
83 | prom_init_early_console(0); | 82 | prom_init_early_console(0); |
@@ -89,3 +88,7 @@ void __init prom_init(void) | |||
89 | strcat(prom_getcmdline(), " console=ttyS0,38400n8r"); | 88 | strcat(prom_getcmdline(), " console=ttyS0,38400n8r"); |
90 | #endif | 89 | #endif |
91 | } | 90 | } |
91 | |||
92 | void prom_free_prom_memory(void) | ||
93 | { | ||
94 | } | ||
diff --git a/arch/mips/mti-sead3/sead3-memory.c b/arch/mips/mti-sead3/sead3-memory.c deleted file mode 100644 index da9244106f86..000000000000 --- a/arch/mips/mti-sead3/sead3-memory.c +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. | ||
7 | */ | ||
8 | #include <linux/bootmem.h> | ||
9 | |||
10 | #include <asm/bootinfo.h> | ||
11 | #include <asm/sections.h> | ||
12 | #include <asm/mips-boards/prom.h> | ||
13 | |||
14 | enum yamon_memtypes { | ||
15 | yamon_dontuse, | ||
16 | yamon_prom, | ||
17 | yamon_free, | ||
18 | }; | ||
19 | |||
20 | static struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS]; | ||
21 | |||
22 | /* determined physical memory size, not overridden by command line args */ | ||
23 | unsigned long physical_memsize = 0L; | ||
24 | |||
25 | struct prom_pmemblock * __init prom_getmdesc(void) | ||
26 | { | ||
27 | char *memsize_str, *ptr; | ||
28 | unsigned int memsize; | ||
29 | static char cmdline[COMMAND_LINE_SIZE] __initdata; | ||
30 | long val; | ||
31 | int tmp; | ||
32 | |||
33 | /* otherwise look in the environment */ | ||
34 | memsize_str = prom_getenv("memsize"); | ||
35 | if (!memsize_str) { | ||
36 | pr_warn("memsize not set in boot prom, set to default 32Mb\n"); | ||
37 | physical_memsize = 0x02000000; | ||
38 | } else { | ||
39 | tmp = kstrtol(memsize_str, 0, &val); | ||
40 | physical_memsize = (unsigned long)val; | ||
41 | } | ||
42 | |||
43 | #ifdef CONFIG_CPU_BIG_ENDIAN | ||
44 | /* SOC-it swaps, or perhaps doesn't swap, when DMA'ing the last | ||
45 | word of physical memory */ | ||
46 | physical_memsize -= PAGE_SIZE; | ||
47 | #endif | ||
48 | |||
49 | /* Check the command line for a memsize directive that overrides | ||
50 | the physical/default amount */ | ||
51 | strcpy(cmdline, arcs_cmdline); | ||
52 | ptr = strstr(cmdline, "memsize="); | ||
53 | if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' ')) | ||
54 | ptr = strstr(ptr, " memsize="); | ||
55 | |||
56 | if (ptr) | ||
57 | memsize = memparse(ptr + 8, &ptr); | ||
58 | else | ||
59 | memsize = physical_memsize; | ||
60 | |||
61 | memset(mdesc, 0, sizeof(mdesc)); | ||
62 | |||
63 | mdesc[0].type = yamon_dontuse; | ||
64 | mdesc[0].base = 0x00000000; | ||
65 | mdesc[0].size = 0x00001000; | ||
66 | |||
67 | mdesc[1].type = yamon_prom; | ||
68 | mdesc[1].base = 0x00001000; | ||
69 | mdesc[1].size = 0x000ef000; | ||
70 | |||
71 | /* | ||
72 | * The area 0x000f0000-0x000fffff is allocated for BIOS memory by the | ||
73 | * south bridge and PCI access always forwarded to the ISA Bus and | ||
74 | * BIOSCS# is always generated. | ||
75 | * This mean that this area can't be used as DMA memory for PCI | ||
76 | * devices. | ||
77 | */ | ||
78 | mdesc[2].type = yamon_dontuse; | ||
79 | mdesc[2].base = 0x000f0000; | ||
80 | mdesc[2].size = 0x00010000; | ||
81 | |||
82 | mdesc[3].type = yamon_dontuse; | ||
83 | mdesc[3].base = 0x00100000; | ||
84 | mdesc[3].size = CPHYSADDR(PFN_ALIGN((unsigned long)&_end)) - | ||
85 | mdesc[3].base; | ||
86 | |||
87 | mdesc[4].type = yamon_free; | ||
88 | mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end)); | ||
89 | mdesc[4].size = memsize - mdesc[4].base; | ||
90 | |||
91 | return &mdesc[0]; | ||
92 | } | ||
93 | |||
94 | static int __init prom_memtype_classify(unsigned int type) | ||
95 | { | ||
96 | switch (type) { | ||
97 | case yamon_free: | ||
98 | return BOOT_MEM_RAM; | ||
99 | case yamon_prom: | ||
100 | return BOOT_MEM_ROM_DATA; | ||
101 | default: | ||
102 | return BOOT_MEM_RESERVED; | ||
103 | } | ||
104 | } | ||
105 | |||
106 | void __init prom_meminit(void) | ||
107 | { | ||
108 | struct prom_pmemblock *p; | ||
109 | |||
110 | p = prom_getmdesc(); | ||
111 | |||
112 | while (p->size) { | ||
113 | long type; | ||
114 | unsigned long base, size; | ||
115 | |||
116 | type = prom_memtype_classify(p->type); | ||
117 | base = p->base; | ||
118 | size = p->size; | ||
119 | |||
120 | add_memory_region(base, size, type); | ||
121 | p++; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | void __init prom_free_prom_memory(void) | ||
126 | { | ||
127 | unsigned long addr; | ||
128 | int i; | ||
129 | |||
130 | for (i = 0; i < boot_mem_map.nr_map; i++) { | ||
131 | if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) | ||
132 | continue; | ||
133 | |||
134 | addr = boot_mem_map.map[i].addr; | ||
135 | free_init_pages("prom memory", | ||
136 | addr, addr + boot_mem_map.map[i].size); | ||
137 | } | ||
138 | } | ||
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c index 8ad46ad31b49..f012fd164cee 100644 --- a/arch/mips/mti-sead3/sead3-setup.c +++ b/arch/mips/mti-sead3/sead3-setup.c | |||
@@ -6,6 +6,12 @@ | |||
6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. | 6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. |
7 | */ | 7 | */ |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/of_platform.h> | ||
10 | #include <linux/of_fdt.h> | ||
11 | #include <linux/bootmem.h> | ||
12 | |||
13 | #include <asm/mips-boards/generic.h> | ||
14 | #include <asm/prom.h> | ||
9 | 15 | ||
10 | int coherentio; /* 0 => no DMA cache coherency (may be set by user) */ | 16 | int coherentio; /* 0 => no DMA cache coherency (may be set by user) */ |
11 | int hw_coherentio; /* 0 => no HW DMA cache coherency (reflects real HW) */ | 17 | int hw_coherentio; /* 0 => no HW DMA cache coherency (reflects real HW) */ |
@@ -17,4 +23,25 @@ const char *get_system_type(void) | |||
17 | 23 | ||
18 | void __init plat_mem_setup(void) | 24 | void __init plat_mem_setup(void) |
19 | { | 25 | { |
26 | /* | ||
27 | * Load the builtin devicetree. This causes the chosen node to be | ||
28 | * parsed resulting in our memory appearing | ||
29 | */ | ||
30 | __dt_setup_arch(&__dtb_start); | ||
31 | } | ||
32 | |||
33 | void __init device_tree_init(void) | ||
34 | { | ||
35 | unsigned long base, size; | ||
36 | |||
37 | if (!initial_boot_params) | ||
38 | return; | ||
39 | |||
40 | base = virt_to_phys((void *)initial_boot_params); | ||
41 | size = be32_to_cpu(initial_boot_params->totalsize); | ||
42 | |||
43 | /* Before we do anything, lets reserve the dt blob */ | ||
44 | reserve_bootmem(base, size, BOOTMEM_DEFAULT); | ||
45 | |||
46 | unflatten_device_tree(); | ||
20 | } | 47 | } |
diff --git a/arch/mips/mti-sead3/sead3.dts b/arch/mips/mti-sead3/sead3.dts new file mode 100644 index 000000000000..658f43787056 --- /dev/null +++ b/arch/mips/mti-sead3/sead3.dts | |||
@@ -0,0 +1,26 @@ | |||
1 | /dts-v1/; | ||
2 | |||
3 | /memreserve/ 0x00000000 0x00001000; // reserved | ||
4 | /memreserve/ 0x00001000 0x000ef000; // ROM data | ||
5 | /memreserve/ 0x000f0000 0x004cc000; // reserved | ||
6 | |||
7 | / { | ||
8 | #address-cells = <1>; | ||
9 | #size-cells = <1>; | ||
10 | compatible = "mti,sead-3"; | ||
11 | |||
12 | cpus { | ||
13 | cpu@0 { | ||
14 | compatible = "mti,mips14KEc", "mti,mips14Kc"; | ||
15 | }; | ||
16 | }; | ||
17 | |||
18 | chosen { | ||
19 | bootargs = "console=ttyS1,38400 rootdelay=10 root=/dev/sda3"; | ||
20 | }; | ||
21 | |||
22 | memory { | ||
23 | device_type = "memory"; | ||
24 | reg = <0x0 0x08000000>; | ||
25 | }; | ||
26 | }; | ||