| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * R-Car Generation 2 Power management support |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2013 - 2015 Renesas Electronics Corporation |
|---|
| 5 | 6 | * Copyright (C) 2011 Renesas Solutions Corp. |
|---|
| 6 | 7 | * Copyright (C) 2011 Magnus Damm |
|---|
| 7 | | - * |
|---|
| 8 | | - * This file is subject to the terms and conditions of the GNU General Public |
|---|
| 9 | | - * License. See the file "COPYING" in the main directory of this archive |
|---|
| 10 | | - * for more details. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 50 | 47 | void __iomem *p; |
|---|
| 51 | 48 | u32 bar; |
|---|
| 52 | 49 | static int once; |
|---|
| 53 | | - struct device_node *np, *cpus; |
|---|
| 50 | + struct device_node *np; |
|---|
| 54 | 51 | bool has_a7 = false; |
|---|
| 55 | 52 | bool has_a15 = false; |
|---|
| 56 | 53 | struct resource res; |
|---|
| .. | .. |
|---|
| 59 | 56 | if (once++) |
|---|
| 60 | 57 | return; |
|---|
| 61 | 58 | |
|---|
| 62 | | - cpus = of_find_node_by_path("/cpus"); |
|---|
| 63 | | - if (!cpus) |
|---|
| 64 | | - return; |
|---|
| 65 | | - |
|---|
| 66 | | - for_each_child_of_node(cpus, np) { |
|---|
| 59 | + for_each_of_cpu_node(np) { |
|---|
| 67 | 60 | if (of_device_is_compatible(np, "arm,cortex-a15")) |
|---|
| 68 | 61 | has_a15 = true; |
|---|
| 69 | 62 | else if (of_device_is_compatible(np, "arm,cortex-a7")) |
|---|
| .. | .. |
|---|
| 79 | 72 | } |
|---|
| 80 | 73 | |
|---|
| 81 | 74 | error = of_address_to_resource(np, 0, &res); |
|---|
| 75 | + of_node_put(np); |
|---|
| 82 | 76 | if (error) { |
|---|
| 83 | 77 | pr_err("Failed to get smp-sram address: %d\n", error); |
|---|
| 84 | 78 | return; |
|---|
| .. | .. |
|---|
| 109 | 103 | iounmap(p); |
|---|
| 110 | 104 | |
|---|
| 111 | 105 | /* setup reset vectors */ |
|---|
| 112 | | - p = ioremap_nocache(RST, 0x63); |
|---|
| 106 | + p = ioremap(RST, 0x63); |
|---|
| 113 | 107 | bar = phys_to_sbar(res.start); |
|---|
| 114 | 108 | if (has_a15) { |
|---|
| 115 | 109 | writel_relaxed(bar, p + CA15BAR); |
|---|