NXP/FSL SoC driver fixes for v5.14

QE interrupt controller driver
 - Convert it to platform_device driver to make it work with fw_devlink
 - Fix static analysis issue
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEhb3UXAyxp6UQ0v6khtxQDvusFVQFAmEW7oAACgkQhtxQDvus
 FVThVA//fIMVH7UkdvFT1ZsHlho6JJ6H3McVNVjYkIC8z9Rg0iboUFv6RSg3pF4a
 7SJLxboK0bHtLpioA2/e/dP/3MwDEj9OgQGmOa2GLWdgPl0/md27BIuu/VfhRne9
 3XKzcCKsQcnpPWHQ4Na7YvGsGD74uPxW3RAbwiOAk/JCC0a51N3Fmqwpxq4hIeop
 d23EwUo4ihafVRqzkx6NloiX0OfUQiGtjYHIgXKa9wnuOq5y/xKsCeJVMcA6jpfs
 U9zy5oChGxJpDTpnCJiWhIMM406WNPinlRJKeO+SmDkarax0d9MpUIIdcz2sOUX9
 Q0mfmHO4ZJNZKSYiIx0ZbCGLYNzCCtIslp75htIbM3baaBkBsi+QWYX9nLZ8F4Og
 fvetghv6pkz1jiVFOLss9FCyq9F2K+wGbMqu2teDDSvIn9F2e4owiT62aUtyEkXn
 eJCw0LRxUdDPsfxxU/WZZJ/O0tm1cOQF3guGXl5NPR+INPUwMmmFq8+S0bn1rJZr
 +WhW2+3B/RbS5BiHyY+FSRjaj6miOcv2qY1S70e1lOmvyIGuCVI5mUPAA+HG8E9p
 JIdqsX9Sj6s4CqjtGoWEREu7Cl0XTHPG2PM2MPb9HzTfLO7vSTj6zIm8eIuRHc8t
 JckcNPLD7v2b4H1HCMzMEpegmv6n0bNlZanz/X9Tj+j9dpFsXP8=
 =N7Ax
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmEazZoACgkQmmx57+YA
 GNlJFA/+NRXC6B2u9TmiTpdxNvtJLnLJB/uwDdQfnUKyS8K69IJ7V+qdia0xdM2C
 IHB+NvQ8+aU5o/F30x9ge2IICPLGetDjTl2Y7J8Xd3hbpj9DncoXiWXgnv5abfxo
 tPg5Wl1ttvskRFE+lVDJiZmy1dLnv8w2yObpBV7iUFaEDBf4vYtM1SPiLxfcxlcn
 U4IMf2qCTjFbozYuBz8/34dewOAktAgTe0inHAiJKfWqVy2ndxVhxIUEMJcLc8HW
 jyLUVzDqjYLP9FizgPlCK54NIgwP2PF+rfB/8eHhJQTXmqlJMig+9GVHPX3OaEN3
 dPBVoj/LxyDnmyU6O979LT5qMNtjy1WFOx8MCTcX2xgNs87AcAfY9tRN8HYLv5Ks
 rjQiTfCCC64VDmM92dnlS6h5C3Vr+ZG1BNM5mt4QF7mISKy8tLzFtBbXzrO31kI/
 xHimb6tgsDHsvmNf5mLTarPI6AS1ozkpsdXRxIjW3IXDLwT+QGE6D3aP3lgffiZu
 dxjQzND3sltR8EPK08/GzOGeShkC1HVcGF5tUXnHm/njBDidpU/0yTCdy37HLrL5
 xJl7cV71dfudlm1Bph3eU4p7FwUSDmRIma+4Qq8fPN4ePSjHumDwTCUcnhJtbyWl
 CD42Mbo6cpbh555U83sOD8fB0IxChAJGyY7cP2vRDeNcG7ZcYlQ=
 =NTE1
 -----END PGP SIGNATURE-----

Merge tag 'soc-fsl-fix-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/leo/linux into arm/fixes

NXP/FSL SoC driver fixes for v5.14

QE interrupt controller driver
- Convert it to platform_device driver to make it work with fw_devlink
- Fix static analysis issue

* tag 'soc-fsl-fix-v5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/leo/linux:
  soc: fsl: qe: fix static checker warning
  soc: fsl: qe: convert QE interrupt controller to platform_device

Link: https://lore.kernel.org/r/20210813222305.13663-1-leoyang.li@nxp.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2021-08-16 22:41:59 +02:00
commit df97e5f3b2
1 changed files with 50 additions and 38 deletions

View File

@ -23,6 +23,7 @@
#include <linux/signal.h>
#include <linux/device.h>
#include <linux/spinlock.h>
#include <linux/platform_device.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <soc/fsl/qe/qe.h>
@ -53,8 +54,8 @@ struct qe_ic {
struct irq_chip hc_irq;
/* VIRQ numbers of QE high/low irqs */
unsigned int virq_high;
unsigned int virq_low;
int virq_high;
int virq_low;
};
/*
@ -404,42 +405,40 @@ static void qe_ic_cascade_muxed_mpic(struct irq_desc *desc)
chip->irq_eoi(&desc->irq_data);
}
static void __init qe_ic_init(struct device_node *node)
static int qe_ic_init(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
void (*low_handler)(struct irq_desc *desc);
void (*high_handler)(struct irq_desc *desc);
struct qe_ic *qe_ic;
struct resource res;
u32 ret;
struct resource *res;
struct device_node *node = pdev->dev.of_node;
ret = of_address_to_resource(node, 0, &res);
if (ret)
return;
qe_ic = kzalloc(sizeof(*qe_ic), GFP_KERNEL);
if (qe_ic == NULL)
return;
qe_ic->irqhost = irq_domain_add_linear(node, NR_QE_IC_INTS,
&qe_ic_host_ops, qe_ic);
if (qe_ic->irqhost == NULL) {
kfree(qe_ic);
return;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(dev, "no memory resource defined\n");
return -ENODEV;
}
qe_ic->regs = ioremap(res.start, resource_size(&res));
qe_ic = devm_kzalloc(dev, sizeof(*qe_ic), GFP_KERNEL);
if (qe_ic == NULL)
return -ENOMEM;
qe_ic->regs = devm_ioremap(dev, res->start, resource_size(res));
if (qe_ic->regs == NULL) {
dev_err(dev, "failed to ioremap() registers\n");
return -ENODEV;
}
qe_ic->hc_irq = qe_ic_irq_chip;
qe_ic->virq_high = irq_of_parse_and_map(node, 0);
qe_ic->virq_low = irq_of_parse_and_map(node, 1);
qe_ic->virq_high = platform_get_irq(pdev, 0);
qe_ic->virq_low = platform_get_irq(pdev, 1);
if (!qe_ic->virq_low) {
printk(KERN_ERR "Failed to map QE_IC low IRQ\n");
kfree(qe_ic);
return;
}
if (qe_ic->virq_high != qe_ic->virq_low) {
if (qe_ic->virq_low <= 0)
return -ENODEV;
if (qe_ic->virq_high > 0 && qe_ic->virq_high != qe_ic->virq_low) {
low_handler = qe_ic_cascade_low;
high_handler = qe_ic_cascade_high;
} else {
@ -447,29 +446,42 @@ static void __init qe_ic_init(struct device_node *node)
high_handler = NULL;
}
qe_ic->irqhost = irq_domain_add_linear(node, NR_QE_IC_INTS,
&qe_ic_host_ops, qe_ic);
if (qe_ic->irqhost == NULL) {
dev_err(dev, "failed to add irq domain\n");
return -ENODEV;
}
qe_ic_write(qe_ic->regs, QEIC_CICR, 0);
irq_set_handler_data(qe_ic->virq_low, qe_ic);
irq_set_chained_handler(qe_ic->virq_low, low_handler);
if (qe_ic->virq_high && qe_ic->virq_high != qe_ic->virq_low) {
if (high_handler) {
irq_set_handler_data(qe_ic->virq_high, qe_ic);
irq_set_chained_handler(qe_ic->virq_high, high_handler);
}
return 0;
}
static const struct of_device_id qe_ic_ids[] = {
{ .compatible = "fsl,qe-ic"},
{ .type = "qeic"},
{},
};
static struct platform_driver qe_ic_driver =
{
.driver = {
.name = "qe-ic",
.of_match_table = qe_ic_ids,
},
.probe = qe_ic_init,
};
static int __init qe_ic_of_init(void)
{
struct device_node *np;
np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
if (!np) {
np = of_find_node_by_type(NULL, "qeic");
if (!np)
return -ENODEV;
}
qe_ic_init(np);
of_node_put(np);
platform_driver_register(&qe_ic_driver);
return 0;
}
subsys_initcall(qe_ic_of_init);