| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * spu management operations for of based platforms |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 |
|---|
| 5 | 6 | * Copyright 2006 Sony Corp. |
|---|
| 6 | 7 | * (C) Copyright 2007 TOSHIBA CORPORATION |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; version 2 of the License. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License along |
|---|
| 18 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
|---|
| 19 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|---|
| 20 | 8 | */ |
|---|
| 21 | 9 | |
|---|
| 22 | 10 | #include <linux/interrupt.h> |
|---|
| .. | .. |
|---|
| 180 | 168 | |
|---|
| 181 | 169 | static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) |
|---|
| 182 | 170 | { |
|---|
| 183 | | - struct of_phandle_args oirq; |
|---|
| 184 | | - int ret; |
|---|
| 185 | 171 | int i; |
|---|
| 186 | 172 | |
|---|
| 187 | 173 | for (i=0; i < 3; i++) { |
|---|
| 188 | | - ret = of_irq_parse_one(np, i, &oirq); |
|---|
| 189 | | - if (ret) { |
|---|
| 190 | | - pr_debug("spu_new: failed to get irq %d\n", i); |
|---|
| 174 | + spu->irqs[i] = irq_of_parse_and_map(np, i); |
|---|
| 175 | + if (!spu->irqs[i]) |
|---|
| 191 | 176 | goto err; |
|---|
| 192 | | - } |
|---|
| 193 | | - ret = -EINVAL; |
|---|
| 194 | | - pr_debug(" irq %d no 0x%x on %pOF\n", i, oirq.args[0], |
|---|
| 195 | | - oirq.np); |
|---|
| 196 | | - spu->irqs[i] = irq_create_of_mapping(&oirq); |
|---|
| 197 | | - if (!spu->irqs[i]) { |
|---|
| 198 | | - pr_debug("spu_new: failed to map it !\n"); |
|---|
| 199 | | - goto err; |
|---|
| 200 | | - } |
|---|
| 201 | 177 | } |
|---|
| 202 | 178 | return 0; |
|---|
| 203 | 179 | |
|---|
| 204 | 180 | err: |
|---|
| 205 | | - pr_debug("failed to map irq %x for spu %s\n", *oirq.args, |
|---|
| 206 | | - spu->name); |
|---|
| 181 | + pr_debug("failed to map irq %x for spu %s\n", i, spu->name); |
|---|
| 207 | 182 | for (; i >= 0; i--) { |
|---|
| 208 | 183 | if (spu->irqs[i]) |
|---|
| 209 | 184 | irq_dispose_mapping(spu->irqs[i]); |
|---|
| 210 | 185 | } |
|---|
| 211 | | - return ret; |
|---|
| 186 | + return -EINVAL; |
|---|
| 212 | 187 | } |
|---|
| 213 | 188 | |
|---|
| 214 | 189 | static int spu_map_resource(struct spu *spu, int nr, |
|---|
| .. | .. |
|---|
| 295 | 270 | for_each_node_by_type(node, "spe") { |
|---|
| 296 | 271 | ret = fn(node); |
|---|
| 297 | 272 | if (ret) { |
|---|
| 298 | | - printk(KERN_WARNING "%s: Error initializing %s\n", |
|---|
| 299 | | - __func__, node->name); |
|---|
| 273 | + printk(KERN_WARNING "%s: Error initializing %pOFn\n", |
|---|
| 274 | + __func__, node); |
|---|
| 300 | 275 | of_node_put(node); |
|---|
| 301 | 276 | break; |
|---|
| 302 | 277 | } |
|---|
| .. | .. |
|---|
| 471 | 446 | struct device_node *vic_dn, *last_spu_dn; |
|---|
| 472 | 447 | phandle avoid_ph; |
|---|
| 473 | 448 | const phandle *vic_handles; |
|---|
| 474 | | - const char *name; |
|---|
| 475 | 449 | int lenp, i, added; |
|---|
| 476 | 450 | |
|---|
| 477 | 451 | last_spu = list_first_entry(&cbe_spu_info[cbe].spus, struct spu, |
|---|
| .. | .. |
|---|
| 493 | 467 | if (!vic_dn) |
|---|
| 494 | 468 | continue; |
|---|
| 495 | 469 | |
|---|
| 496 | | - /* a neighbour might be spe, mic-tm, or bif0 */ |
|---|
| 497 | | - name = of_get_property(vic_dn, "name", NULL); |
|---|
| 498 | | - if (!name) |
|---|
| 499 | | - continue; |
|---|
| 500 | | - |
|---|
| 501 | | - if (strcmp(name, "spe") == 0) { |
|---|
| 470 | + if (of_node_name_eq(vic_dn, "spe") ) { |
|---|
| 502 | 471 | spu = devnode_spu(cbe, vic_dn); |
|---|
| 503 | 472 | avoid_ph = last_spu_dn->phandle; |
|---|
| 504 | 473 | } else { |
|---|
| .. | .. |
|---|
| 511 | 480 | spu = neighbour_spu(cbe, vic_dn, last_spu_dn); |
|---|
| 512 | 481 | if (!spu) |
|---|
| 513 | 482 | continue; |
|---|
| 514 | | - if (!strcmp(name, "mic-tm")) { |
|---|
| 483 | + if (of_node_name_eq(vic_dn, "mic-tm")) { |
|---|
| 515 | 484 | last_spu->has_mem_affinity = 1; |
|---|
| 516 | 485 | spu->has_mem_affinity = 1; |
|---|
| 517 | 486 | } |
|---|