| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Port on Texas Instruments TMS320C6x architecture |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2004, 2006, 2009, 2010, 2011 Texas Instruments Incorporated |
|---|
| 5 | 6 | * 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. |
|---|
| 10 | 7 | */ |
|---|
| 11 | 8 | #include <linux/dma-mapping.h> |
|---|
| 12 | 9 | #include <linux/memblock.h> |
|---|
| 13 | 10 | #include <linux/seq_file.h> |
|---|
| 14 | | -#include <linux/bootmem.h> |
|---|
| 15 | 11 | #include <linux/clkdev.h> |
|---|
| 16 | 12 | #include <linux/initrd.h> |
|---|
| 17 | 13 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 96 | 92 | unsigned long core_khz; |
|---|
| 97 | 93 | u64 tmp; |
|---|
| 98 | 94 | struct cpuinfo_c6x *p; |
|---|
| 99 | | - struct device_node *node, *np; |
|---|
| 95 | + struct device_node *node; |
|---|
| 100 | 96 | |
|---|
| 101 | 97 | p = &per_cpu(cpu_data, smp_processor_id()); |
|---|
| 102 | 98 | |
|---|
| .. | .. |
|---|
| 190 | 186 | |
|---|
| 191 | 187 | p->core_id = get_coreid(); |
|---|
| 192 | 188 | |
|---|
| 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; |
|---|
| 200 | 191 | |
|---|
| 201 | 192 | node = of_find_node_by_name(NULL, "soc"); |
|---|
| 202 | 193 | if (node) { |
|---|
| .. | .. |
|---|
| 270 | 261 | notrace void __init machine_init(unsigned long dt_ptr) |
|---|
| 271 | 262 | { |
|---|
| 272 | 263 | void *dtb = __va(dt_ptr); |
|---|
| 273 | | - void *fdt = _fdt_start; |
|---|
| 264 | + void *fdt = __dtb_start; |
|---|
| 274 | 265 | |
|---|
| 275 | 266 | /* interrupts must be masked */ |
|---|
| 276 | 267 | set_creg(IER, 2); |
|---|
| .. | .. |
|---|
| 296 | 287 | |
|---|
| 297 | 288 | void __init setup_arch(char **cmdline_p) |
|---|
| 298 | 289 | { |
|---|
| 299 | | - int bootmap_size; |
|---|
| 300 | | - struct memblock_region *reg; |
|---|
| 290 | + phys_addr_t start, end; |
|---|
| 291 | + u64 i; |
|---|
| 301 | 292 | |
|---|
| 302 | 293 | printk(KERN_INFO "Initializing kernel\n"); |
|---|
| 303 | 294 | |
|---|
| .. | .. |
|---|
| 353 | 344 | init_mm.end_data = memory_start; |
|---|
| 354 | 345 | init_mm.brk = memory_start; |
|---|
| 355 | 346 | |
|---|
| 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(); |
|---|
| 367 | 348 | |
|---|
| 368 | 349 | c6x_cache_init(); |
|---|
| 369 | 350 | |
|---|
| .. | .. |
|---|
| 371 | 352 | disable_caching(ram_start, ram_end - 1); |
|---|
| 372 | 353 | |
|---|
| 373 | 354 | /* 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)); |
|---|
| 377 | 358 | |
|---|
| 378 | 359 | #ifdef CONFIG_BLK_DEV_INITRD |
|---|
| 379 | 360 | /* |
|---|
| .. | .. |
|---|
| 397 | 378 | /* Initialize the coherent memory allocator */ |
|---|
| 398 | 379 | coherent_mem_init(dma_start, dma_size); |
|---|
| 399 | 380 | |
|---|
| 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 | | - |
|---|
| 414 | 381 | max_low_pfn = PFN_DOWN(memory_end); |
|---|
| 415 | 382 | min_low_pfn = PFN_UP(memory_start); |
|---|
| 383 | + max_pfn = max_low_pfn; |
|---|
| 416 | 384 | max_mapnr = max_low_pfn - min_low_pfn; |
|---|
| 417 | 385 | |
|---|
| 418 | 386 | /* Get kmalloc into gear */ |
|---|