hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/c6x/kernel/setup.c
....@@ -1,17 +1,13 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Port on Texas Instruments TMS320C6x architecture
34 *
45 * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated
56 * Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
107 */
118 #include <linux/dma-mapping.h>
129 #include <linux/memblock.h>
1310 #include <linux/seq_file.h>
14
-#include <linux/bootmem.h>
1511 #include <linux/clkdev.h>
1612 #include <linux/initrd.h>
1713 #include <linux/kernel.h>
....@@ -96,7 +92,7 @@
9692 unsigned long core_khz;
9793 u64 tmp;
9894 struct cpuinfo_c6x *p;
99
- struct device_node *node, *np;
95
+ struct device_node *node;
10096
10197 p = &per_cpu(cpu_data, smp_processor_id());
10298
....@@ -190,13 +186,8 @@
190186
191187 p->core_id = get_coreid();
192188
193
- node = of_find_node_by_name(NULL, "cpus");
194
- if (node) {
195
- for_each_child_of_node(node, np)
196
- if (!strcmp("cpu", np->name))
197
- ++c6x_num_cores;
198
- of_node_put(node);
199
- }
189
+ for_each_of_cpu_node(node)
190
+ ++c6x_num_cores;
200191
201192 node = of_find_node_by_name(NULL, "soc");
202193 if (node) {
....@@ -270,7 +261,7 @@
270261 notrace void __init machine_init(unsigned long dt_ptr)
271262 {
272263 void *dtb = __va(dt_ptr);
273
- void *fdt = _fdt_start;
264
+ void *fdt = __dtb_start;
274265
275266 /* interrupts must be masked */
276267 set_creg(IER, 2);
....@@ -296,8 +287,8 @@
296287
297288 void __init setup_arch(char **cmdline_p)
298289 {
299
- int bootmap_size;
300
- struct memblock_region *reg;
290
+ phys_addr_t start, end;
291
+ u64 i;
301292
302293 printk(KERN_INFO "Initializing kernel\n");
303294
....@@ -353,17 +344,7 @@
353344 init_mm.end_data = memory_start;
354345 init_mm.brk = memory_start;
355346
356
- /*
357
- * Give all the memory to the bootmap allocator, tell it to put the
358
- * boot mem_map at the start of memory
359
- */
360
- bootmap_size = init_bootmem_node(NODE_DATA(0),
361
- memory_start >> PAGE_SHIFT,
362
- PAGE_OFFSET >> PAGE_SHIFT,
363
- memory_end >> PAGE_SHIFT);
364
- memblock_reserve(memory_start, bootmap_size);
365
-
366
- unflatten_device_tree();
347
+ unflatten_and_copy_device_tree();
367348
368349 c6x_cache_init();
369350
....@@ -371,9 +352,9 @@
371352 disable_caching(ram_start, ram_end - 1);
372353
373354 /* Set caching of external RAM used by Linux */
374
- for_each_memblock(memory, reg)
375
- enable_caching(CACHE_REGION_START(reg->base),
376
- CACHE_REGION_START(reg->base + reg->size - 1));
355
+ for_each_mem_range(i, &start, &end)
356
+ enable_caching(CACHE_REGION_START(start),
357
+ CACHE_REGION_START(end - 1));
377358
378359 #ifdef CONFIG_BLK_DEV_INITRD
379360 /*
....@@ -397,22 +378,9 @@
397378 /* Initialize the coherent memory allocator */
398379 coherent_mem_init(dma_start, dma_size);
399380
400
- /*
401
- * Free all memory as a starting point.
402
- */
403
- free_bootmem(PAGE_OFFSET, memory_end - PAGE_OFFSET);
404
-
405
- /*
406
- * Then reserve memory which is already being used.
407
- */
408
- for_each_memblock(reserved, reg) {
409
- pr_debug("reserved - 0x%08x-0x%08x\n",
410
- (u32) reg->base, (u32) reg->size);
411
- reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT);
412
- }
413
-
414381 max_low_pfn = PFN_DOWN(memory_end);
415382 min_low_pfn = PFN_UP(memory_start);
383
+ max_pfn = max_low_pfn;
416384 max_mapnr = max_low_pfn - min_low_pfn;
417385
418386 /* Get kmalloc into gear */