| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Renesas INTC External IRQ Pin Driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2013 Magnus Damm |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program; if not, write to the Free Software |
|---|
| 17 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | 6 | */ |
|---|
| 19 | 7 | |
|---|
| 20 | 8 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 83 | 71 | }; |
|---|
| 84 | 72 | |
|---|
| 85 | 73 | struct intc_irqpin_config { |
|---|
| 86 | | - unsigned int irlm_bit; |
|---|
| 87 | | - unsigned needs_irlm:1; |
|---|
| 74 | + int irlm_bit; /* -1 if non-existent */ |
|---|
| 88 | 75 | }; |
|---|
| 89 | 76 | |
|---|
| 90 | 77 | static unsigned long intc_irqpin_read32(void __iomem *iomem) |
|---|
| .. | .. |
|---|
| 361 | 348 | |
|---|
| 362 | 349 | static const struct intc_irqpin_config intc_irqpin_irlm_r8a777x = { |
|---|
| 363 | 350 | .irlm_bit = 23, /* ICR0.IRLM0 */ |
|---|
| 364 | | - .needs_irlm = 1, |
|---|
| 365 | 351 | }; |
|---|
| 366 | 352 | |
|---|
| 367 | 353 | static const struct intc_irqpin_config intc_irqpin_rmobile = { |
|---|
| 368 | | - .needs_irlm = 0, |
|---|
| 354 | + .irlm_bit = -1, |
|---|
| 369 | 355 | }; |
|---|
| 370 | 356 | |
|---|
| 371 | 357 | static const struct of_device_id intc_irqpin_dt_ids[] = { |
|---|
| .. | .. |
|---|
| 401 | 387 | int k; |
|---|
| 402 | 388 | |
|---|
| 403 | 389 | p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL); |
|---|
| 404 | | - if (!p) { |
|---|
| 405 | | - dev_err(dev, "failed to allocate driver data\n"); |
|---|
| 390 | + if (!p) |
|---|
| 406 | 391 | return -ENOMEM; |
|---|
| 407 | | - } |
|---|
| 408 | 392 | |
|---|
| 409 | 393 | /* deal with driver instance configuration */ |
|---|
| 410 | 394 | of_property_read_u32(dev->of_node, "sense-bitfield-width", |
|---|
| .. | .. |
|---|
| 474 | 458 | goto err0; |
|---|
| 475 | 459 | } |
|---|
| 476 | 460 | |
|---|
| 477 | | - i->iomem = devm_ioremap_nocache(dev, io[k]->start, |
|---|
| 478 | | - resource_size(io[k])); |
|---|
| 461 | + i->iomem = devm_ioremap(dev, io[k]->start, |
|---|
| 462 | + resource_size(io[k])); |
|---|
| 479 | 463 | if (!i->iomem) { |
|---|
| 480 | 464 | dev_err(dev, "failed to remap IOMEM\n"); |
|---|
| 481 | 465 | ret = -ENXIO; |
|---|
| .. | .. |
|---|
| 484 | 468 | } |
|---|
| 485 | 469 | |
|---|
| 486 | 470 | /* configure "individual IRQ mode" where needed */ |
|---|
| 487 | | - if (config && config->needs_irlm) { |
|---|
| 471 | + if (config && config->irlm_bit >= 0) { |
|---|
| 488 | 472 | if (io[INTC_IRQPIN_REG_IRLM]) |
|---|
| 489 | 473 | intc_irqpin_read_modify_write(p, INTC_IRQPIN_REG_IRLM, |
|---|
| 490 | 474 | config->irlm_bit, 1, 1); |
|---|
| .. | .. |
|---|
| 522 | 506 | } |
|---|
| 523 | 507 | |
|---|
| 524 | 508 | irq_chip = &p->irq_chip; |
|---|
| 525 | | - irq_chip->name = name; |
|---|
| 509 | + irq_chip->name = "intc-irqpin"; |
|---|
| 510 | + irq_chip->parent_device = dev; |
|---|
| 526 | 511 | irq_chip->irq_mask = disable_fn; |
|---|
| 527 | 512 | irq_chip->irq_unmask = enable_fn; |
|---|
| 528 | 513 | irq_chip->irq_set_type = intc_irqpin_irq_set_type; |
|---|