Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2892357pxb; Tue, 24 Aug 2021 10:00:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+Il3KFZCaBBjIxV+QvMcAavw6+6zqqZmFna9QEExcfmHlsMx+F/XKr5w19HJokFeiBmMO X-Received: by 2002:a17:907:6297:: with SMTP id nd23mr40207357ejc.62.1629824459614; Tue, 24 Aug 2021 10:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629824459; cv=none; d=google.com; s=arc-20160816; b=H6ZqnsSifLqrcIjuj0MhJP9tpi3PQJ+aYK0BY2P8VL1qkWcrHx+GzlOqmVzaZLGZ+/ 2cB78V1IjDMSsIDlsZr8GYLdAF/i/2wfNO6nJ9sOTb24L2Tpq7BjpDhvJXWT853NMiGd dKUmGmpQfe57Ei4HhnMIFm6iNhklvvsT2fH/gWU9vCJCHxpqHFeiSsjTyi2qEPNqHWs1 bxdP068RE3vOLJpsCsw0BaD5BGrd1IuIJMhom0SIY+JUGwV+j6pVU8oU2YYYghNgsYZS sjTKkj/jfjc73leFkLWIhBMdHJwsv1zPn3xGlBk1hJ9kmopEeBUIKg0Ntq2fwkOaLlm/ 2IZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Q4HOXNqUxf7k//PfCAq/ma7Wt7eI0mhonc4ysBgLrKI=; b=cm8w0wVYsPbrIrnN+nRStccjiwIYRNbZzrhG8CxA2ARyYMO1lqSWvHiLYW/ElqlFlU UY3gn063GManaCfcAofriwOBC2/0Hx5YjbUn1/Rya4gCPFcNzEeOQDDnwh9XiKvxsvRe +UHMPRMOKDBHFHOdxyp4Mx4CBIFNySYKhsm0VzdQZxPcEW4vxose8cojLYOzfOc4JSnR WM9ocoJv2VARyUXnmzjWxD5eoy2vUWvEkN+FX+HhL+NI3OcASk/xuCa+rC/o6ABQzVWO FsncSOF/lp6J/g3LiQmqQre1Xeaqmjx8hWQkWS6yTwJbof7T6ZdKf0ROpVSlAygY/3BL Bitg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SU+rqDtI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k4si17370934ejx.135.2021.08.24.10.00.35; Tue, 24 Aug 2021 10:00:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SU+rqDtI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238684AbhHXQ6n (ORCPT + 99 others); Tue, 24 Aug 2021 12:58:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:39568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234198AbhHXQ52 (ORCPT ); Tue, 24 Aug 2021 12:57:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 05B39613BD; Tue, 24 Aug 2021 16:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824203; bh=t3noXGdLBRLRITPrJfjfQexRoeVHQQ0XyOD38fN0Ckk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SU+rqDtIL0F2DOszCouyWRzMG+2mtOchtSogxQAhB3OOgm7MKGIqEdeK9hJKFX+7w Alz2wDP3rkfkw1sZT7qrALkrUXXHlTTrIpyAg47m4fge3h4hgPmhb9JfdsgWEwlSsS X+H7plaTNEPlNeQ9dowNisCfLGezNhk4JcIjpYJAKvv6UhcnTLRbpfKsZ3Lfjl0Kea AMdtYbZWqaRSMyAcTTSjfqP7ipy8T84FVhKFtxLE+gL2ih3AQOgLSW2Iu57mo2VHiL 6pxMOblQ79wOYP4W151eaGr6XD+zi2zL9A7RqJuvBCJIj3bYR2vJE3cLQp3pKhUdah QosJIuWsoXAoQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Maxim Kochetkov , kernel test robot , Dan Carpenter , Saravana Kannan , Li Yang , Sasha Levin Subject: [PATCH 5.13 036/127] soc: fsl: qe: convert QE interrupt controller to platform_device Date: Tue, 24 Aug 2021 12:54:36 -0400 Message-Id: <20210824165607.709387-37-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824165607.709387-1-sashal@kernel.org> References: <20210824165607.709387-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.13.13-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.13.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.13.13-rc1 X-KernelTest-Deadline: 2021-08-26T16:55+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maxim Kochetkov [ Upstream commit be7ecbd240b2f9ec544d3ce6fccf4cec3cd15dca ] Since 5.13 QE's ucc nodes can't get interrupts from devicetree: ucc@2000 { cell-index = <1>; reg = <0x2000 0x200>; interrupts = <32>; interrupt-parent = <&qeic>; }; Now fw_devlink expects driver to create and probe a struct device for interrupt controller. So lets convert this driver to simple platform_device with probe(). Also use platform_get_ and devm_ family function to get/allocate resources and drop unused .compatible = "qeic". [1] - https://lore.kernel.org/lkml/CAGETcx9PiX==mLxB9PO8Myyk6u2vhPVwTMsA5NkD-ywH5xhusw@mail.gmail.com Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default") Fixes: ea718c699055 ("Revert "Revert "driver core: Set fw_devlink=on by default""") Signed-off-by: Maxim Kochetkov Reported-by: kernel test robot Reported-by: Dan Carpenter Acked-by: Saravana Kannan Signed-off-by: Li Yang Signed-off-by: Sasha Levin --- drivers/soc/fsl/qe/qe_ic.c | 75 ++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/drivers/soc/fsl/qe/qe_ic.c b/drivers/soc/fsl/qe/qe_ic.c index 3f711c1a0996..e710d554425d 100644 --- a/drivers/soc/fsl/qe/qe_ic.c +++ b/drivers/soc/fsl/qe/qe_ic.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -404,41 +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; + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (res == NULL) { + dev_err(dev, "no memory resource defined\n"); + return -ENODEV; + } - qe_ic = kzalloc(sizeof(*qe_ic), GFP_KERNEL); + qe_ic = devm_kzalloc(dev, sizeof(*qe_ic), GFP_KERNEL); if (qe_ic == NULL) - return; + return -ENOMEM; - 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; + 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->regs = ioremap(res.start, resource_size(&res)); - 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_low < 0) { + return -ENODEV; } + if (qe_ic->virq_high != qe_ic->virq_low) { low_handler = qe_ic_cascade_low; high_handler = qe_ic_cascade_high; @@ -447,6 +447,13 @@ 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); @@ -456,20 +463,26 @@ static void __init qe_ic_init(struct device_node *node) 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 int __init qe_ic_of_init(void) +static struct platform_driver qe_ic_driver = { - struct device_node *np; + .driver = { + .name = "qe-ic", + .of_match_table = qe_ic_ids, + }, + .probe = qe_ic_init, +}; - 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); +static int __init qe_ic_of_init(void) +{ + platform_driver_register(&qe_ic_driver); return 0; } subsys_initcall(qe_ic_of_init); -- 2.30.2