forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/powerpc/platforms/cell/spu_manage.c
....@@ -1,22 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * spu management operations for of based platforms
34 *
45 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
56 * Copyright 2006 Sony Corp.
67 * (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.
208 */
219
2210 #include <linux/interrupt.h>
....@@ -180,35 +168,22 @@
180168
181169 static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
182170 {
183
- struct of_phandle_args oirq;
184
- int ret;
185171 int i;
186172
187173 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])
191176 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
- }
201177 }
202178 return 0;
203179
204180 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);
207182 for (; i >= 0; i--) {
208183 if (spu->irqs[i])
209184 irq_dispose_mapping(spu->irqs[i]);
210185 }
211
- return ret;
186
+ return -EINVAL;
212187 }
213188
214189 static int spu_map_resource(struct spu *spu, int nr,
....@@ -295,8 +270,8 @@
295270 for_each_node_by_type(node, "spe") {
296271 ret = fn(node);
297272 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);
300275 of_node_put(node);
301276 break;
302277 }
....@@ -471,7 +446,6 @@
471446 struct device_node *vic_dn, *last_spu_dn;
472447 phandle avoid_ph;
473448 const phandle *vic_handles;
474
- const char *name;
475449 int lenp, i, added;
476450
477451 last_spu = list_first_entry(&cbe_spu_info[cbe].spus, struct spu,
....@@ -493,12 +467,7 @@
493467 if (!vic_dn)
494468 continue;
495469
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") ) {
502471 spu = devnode_spu(cbe, vic_dn);
503472 avoid_ph = last_spu_dn->phandle;
504473 } else {
....@@ -511,7 +480,7 @@
511480 spu = neighbour_spu(cbe, vic_dn, last_spu_dn);
512481 if (!spu)
513482 continue;
514
- if (!strcmp(name, "mic-tm")) {
483
+ if (of_node_name_eq(vic_dn, "mic-tm")) {
515484 last_spu->has_mem_affinity = 1;
516485 spu->has_mem_affinity = 1;
517486 }