forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-16 50a212ec906f7524620675f0c57357691c26c81f
kernel/arch/mips/cavium-octeon/setup.c
....@@ -16,6 +16,7 @@
1616 #include <linux/export.h>
1717 #include <linux/interrupt.h>
1818 #include <linux/io.h>
19
+#include <linux/memblock.h>
1920 #include <linux/serial.h>
2021 #include <linux/smp.h>
2122 #include <linux/types.h>
....@@ -36,7 +37,9 @@
3637 #include <asm/mipsregs.h>
3738 #include <asm/bootinfo.h>
3839 #include <asm/sections.h>
40
+#include <asm/fw/fw.h>
3941 #include <asm/setup.h>
42
+#include <asm/prom.h>
4043 #include <asm/time.h>
4144
4245 #include <asm/octeon/octeon.h>
....@@ -72,7 +75,7 @@
7275 DEFINE_SEMAPHORE(octeon_bootbus_sem);
7376 EXPORT_SYMBOL(octeon_bootbus_sem);
7477
75
-struct octeon_boot_descriptor *octeon_boot_desc_ptr;
78
+static struct octeon_boot_descriptor *octeon_boot_desc_ptr;
7679
7780 struct cvmx_bootinfo *octeon_bootinfo;
7881 EXPORT_SYMBOL(octeon_bootinfo);
....@@ -96,7 +99,7 @@
9699 " sync \n"
97100 " synci ($0) \n");
98101
99
- relocated_kexec_smp_wait(NULL);
102
+ kexec_reboot();
100103 }
101104 #endif
102105
....@@ -351,11 +354,11 @@
351354 *
352355 * @s: String to write
353356 */
354
-void octeon_write_lcd(const char *s)
357
+static void octeon_write_lcd(const char *s)
355358 {
356359 if (octeon_bootinfo->led_display_base_addr) {
357360 void __iomem *lcd_address =
358
- ioremap_nocache(octeon_bootinfo->led_display_base_addr,
361
+ ioremap(octeon_bootinfo->led_display_base_addr,
359362 8);
360363 int i;
361364 for (i = 0; i < 8; i++, s++) {
....@@ -373,7 +376,7 @@
373376 *
374377 * Returns uart (0 or 1)
375378 */
376
-int octeon_get_boot_uart(void)
379
+static int octeon_get_boot_uart(void)
377380 {
378381 return (octeon_boot_desc_ptr->flags & OCTEON_BL_FLAG_CONSOLE_UART1) ?
379382 1 : 0;
....@@ -842,7 +845,7 @@
842845 * BIST should always be enabled when doing a soft reset. L2
843846 * Cache locking for instance is not cleared unless BIST is
844847 * enabled. Unfortunately due to a chip errata G-200 for
845
- * Cn38XX and CN31XX, BIST msut be disabled on these parts.
848
+ * Cn38XX and CN31XX, BIST must be disabled on these parts.
846849 */
847850 if (OCTEON_IS_MODEL(OCTEON_CN38XX_PASS2) ||
848851 OCTEON_IS_MODEL(OCTEON_CN31XX))
....@@ -928,7 +931,7 @@
928931 {
929932 if (addr > *mem && addr < *mem + *size) {
930933 u64 inc = addr - *mem;
931
- add_memory_region(*mem, inc, BOOT_MEM_RAM);
934
+ memblock_add(*mem, inc);
932935 *mem += inc;
933936 *size -= inc;
934937 }
....@@ -990,23 +993,21 @@
990993
991994 /* Crashkernel ignores bootmem list. It relies on mem=X@Y option */
992995 #ifdef CONFIG_CRASH_DUMP
993
- add_memory_region(reserve_low_mem, max_memory, BOOT_MEM_RAM);
996
+ memblock_add(reserve_low_mem, max_memory);
994997 total += max_memory;
995998 #else
996999 #ifdef CONFIG_KEXEC
9971000 if (crashk_size > 0) {
998
- add_memory_region(crashk_base, crashk_size, BOOT_MEM_RAM);
1001
+ memblock_add(crashk_base, crashk_size);
9991002 crashk_end = crashk_base + crashk_size;
10001003 }
10011004 #endif
10021005 /*
1003
- * When allocating memory, we want incrementing addresses from
1004
- * bootmem_alloc so the code in add_memory_region can merge
1005
- * regions next to each other.
1006
+ * When allocating memory, we want incrementing addresses,
1007
+ * which is handled by memblock
10061008 */
10071009 cvmx_bootmem_lock();
1008
- while ((boot_mem_map.nr_map < BOOT_MEM_MAP_MAX)
1009
- && (total < max_memory)) {
1010
+ while (total < max_memory) {
10101011 memory = cvmx_bootmem_phy_alloc(mem_alloc_size,
10111012 __pa_symbol(&_end), -1,
10121013 0x100000,
....@@ -1038,13 +1039,9 @@
10381039 */
10391040 if (memory < crashk_base && end > crashk_end) {
10401041 /* region is fully in */
1041
- add_memory_region(memory,
1042
- crashk_base - memory,
1043
- BOOT_MEM_RAM);
1042
+ memblock_add(memory, crashk_base - memory);
10441043 total += crashk_base - memory;
1045
- add_memory_region(crashk_end,
1046
- end - crashk_end,
1047
- BOOT_MEM_RAM);
1044
+ memblock_add(crashk_end, end - crashk_end);
10481045 total += end - crashk_end;
10491046 continue;
10501047 }
....@@ -1072,7 +1069,7 @@
10721069 */
10731070 mem_alloc_size -= end - crashk_base;
10741071 #endif
1075
- add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM);
1072
+ memblock_add(memory, mem_alloc_size);
10761073 total += mem_alloc_size;
10771074 /* Recovering mem_alloc_size */
10781075 mem_alloc_size = 4 << 20;
....@@ -1087,7 +1084,7 @@
10871084
10881085 /* Adjust for physical offset. */
10891086 kernel_start &= ~0xffffffff80000000ULL;
1090
- add_memory_region(kernel_start, kernel_size, BOOT_MEM_RAM);
1087
+ memblock_add(kernel_start, kernel_size);
10911088 #endif /* CONFIG_CRASH_DUMP */
10921089
10931090 #ifdef CONFIG_CAVIUM_RESERVE32
....@@ -1125,7 +1122,7 @@
11251122
11261123 void __init prom_free_prom_memory(void)
11271124 {
1128
- if (CAVIUM_OCTEON_DCACHE_PREFETCH_WAR) {
1125
+ if (OCTEON_IS_MODEL(OCTEON_CN6XXX)) {
11291126 /* Check for presence of Core-14449 fix. */
11301127 u32 insn;
11311128 u32 *foo;