From patchwork Thu Jan 5 08:10:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "M.h. Lian" X-Patchwork-Id: 9498599 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 34650606DE for ; Thu, 5 Jan 2017 08:10:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22B9F28066 for ; Thu, 5 Jan 2017 08:10:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 178A828156; Thu, 5 Jan 2017 08:10:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 77E0428066 for ; Thu, 5 Jan 2017 08:10:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cP37r-0001Iw-7X; Thu, 05 Jan 2017 08:10:19 +0000 Received: from mail-dm3nam03on0067.outbound.protection.outlook.com ([104.47.41.67] helo=NAM03-DM3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cP36i-0006PI-TT for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2017 08:09:10 +0000 Received: from BN3PR0301CA0074.namprd03.prod.outlook.com (10.160.152.170) by CY4PR03MB2471.namprd03.prod.outlook.com (10.168.165.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10; Thu, 5 Jan 2017 08:08:46 +0000 Received: from BN1AFFO11FD018.protection.gbl (2a01:111:f400:7c10::126) by BN3PR0301CA0074.outlook.office365.com (2a01:111:e400:401e::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7 via Frontend Transport; Thu, 5 Jan 2017 08:08:46 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=fail action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD018.mail.protection.outlook.com (10.58.52.78) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.803.8 via Frontend Transport; Thu, 5 Jan 2017 08:08:46 +0000 Received: from lmh.ap.freescale.net (lmh.ap.freescale.net [10.193.20.69]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v0588CZo031372; Thu, 5 Jan 2017 01:08:42 -0700 From: Minghuan Lian To: , , Subject: [PATCH v2,8/9] irqchip/ls-scfg-msi: add LS1043a v1.1 MSI support Date: Thu, 5 Jan 2017 16:10:36 +0800 Message-ID: <1483603837-4629-8-git-send-email-Minghuan.Lian@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1483603837-4629-1-git-send-email-Minghuan.Lian@nxp.com> References: <1483603837-4629-1-git-send-email-Minghuan.Lian@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131280773262856019; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7916002)(39410400002)(39380400002)(39400400002)(39850400002)(39840400002)(39450400003)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(7416002)(104016004)(5660300001)(2906002)(6666003)(5003940100001)(47776003)(626004)(356003)(54906002)(2950100002)(2201001)(85426001)(4326007)(77096006)(8676002)(68736007)(81166006)(50226002)(50986999)(8936002)(38730400001)(81156014)(86362001)(48376002)(36756003)(8656002)(106466001)(76176999)(50466002)(92566002)(230783001)(105606002)(5001770100001)(97736004)(305945005)(189998001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2471; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD018; 1:ZnKIu8AKo5CfqaDQ50Eo4/Z/f/oiy9TiBAnP2dIsItQGyKQMuF0BH/DfTdM845rC3qwt5u4ViNR9Du4ppQ/PytPlz7IFC4HRIMKdS3lxHMUxwopOhFlWguDHzqXLcsCDAYoiMmID7cYeCJcVxzhtMhuW/9nTyJHsPWbJdBTxGu4G9I/zQC81lRtxPN3ayw79DbxKA3dVjzCNO/yx3M76xNpd7WT7eIm4F8jOeUugsjjrRIGOUtBSqej1q6k3q3qS8WlQcdSXFFtcj8sRbJIYzoc5+/NEQ2sAJMOj5t2lTPnWAMmxhvVoFHGozZJgr7DvKfC1isq8/7PQa5hBTYCeHibyGOHyK29fzcQSejD2vXbWQtgBIIhbBqn7t+MGok57qTJV03Xnmd9kXClCrp+Ul4w5AHTSd5FnLYy/Ue2TDu8i4EddIlIflPth6u1lhL3tCp/1tY6J0ODEOwSMls+FtVtgx/6+2OhH6numhlGF5W7idIhZ2nGvIMPI9/N6WDsPxcxXpj5PjBUPznQk7ItTvZEu4BxfT5q2/R1cVP3oXwjxFXiYUUaQCOg5fQ4fh4RL0HaulTx5efAmO7hlFdmfnnLcCcYcka54xuIVkZNlebSWm3HyEWBaDaYNOFF0T633J07duB3HLhgDUT+dPXiWaCqGI1QohLDFk3HX+bLlkokoQnEtYfV1cX3jiXXcd5c0gurWWdrgjyLYalUWvf+cshPfgJgoXPOq55XHg5C1KNQ= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 3b1b8baa-6085-4b26-6df7-08d4354212a0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:CY4PR03MB2471; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 3:yEaY3nmqRpJUTsUakafL4z9UYItvM0RzghCkWcl/OD+veXhJrBhdxxzYhlgTxJ1RRJPv3HE/bsbJpxZfrcsAGVLk7jRgnXgkuPpU9hA89ufbwuzmVOSsJ5G7suMbKCoukTupVx5v/jYj7CsDq6nd7nnZcHj2bK9dijOzc1ZiVB4Va9mMKv8b/hE9/Nq8Fi0iAcwELufP0YOCsX7CcAMT7IpAf0MoPlUXTsOLpKpDdX8neAKfS2M2IUx2Qx0kPnL4CLJRmsLIwHSiED5J5FruYRssKJvXpNvwLitjbAI3MfzZk3i5cDt6iMOlUQnwd8Fnv/hFDF4NpuQv0f6KOhf201TVxjK6gT/sq5jGDLpfe3vwQ/mB6k3jxrHwJQcFh+IL X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 25:NWIi5cKSZrKrLbd4VtQbtmInbbvUEfYMhV35a+TsByHKBj3bhSsVg7lnwHD5ghjWHMAMxkKvmIO1hWd/s6efJFUiu1FVE5gOdfWLtkyhrM6Yg4K+KAeBCKf8VjjX+m8/6s3d/QvERaAZ5JP6MnVaqFP1h5YJKb2mMZzoXKJfUTlTM6Y5UgPQZUFmWhCh0sQi7fA8JQT9fYTeBVgAOPje+DpMa/1YCUfnEatt0nFDJkaRpRTSfBfhQjAQRGhiElcaLbjoJpY0Vlkn6ZDtwDU9A5aHBU+w3hi7lCzgH02qndW/wmIjBOi9NbgvMIT7cMJ6akW2Sb9pRyXyZIlmNI9O0Wj5oxRpNz47XeSFuRPSQ3ohKIksbmHimFh6yW3ys99futM/cSxkg1RA7GlrCcshCUNn0BTs88Szl5LwCwmB03Sqst9ucXjk50JTf6cSrVpUXodf6zVcPF/xF1SZND5N1NOKbCUi6OFc6OLFJjID3RBgwxo7HO6An4FAVGstdEjETnJrs+GkFCDL2xrhUDkHXK9sgSriZS0a+EljrMG6c6kg2xpB/VzgXnCAtsjgT/mFP1yb+QdZ+NcB1jsqGual5PXG4g/1cbHUhxX8s6jfHJdHXAVCq2hrobPMp5R4WTuio/Oz/E2ARu4ev6+vehwsitOKM1jLQwOF1eb4ECew6YWrDOpJmKt6mfALMZI4FJDy3w9dxPId+j8das2Ls7eHW3Cj4ihWEBTsSyr3pq1aoPLOjpgs3l2BVEL5/LxPG9MPT4G3GBYZWH+2JkVPbAKvwA== X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 31:y8bYkMOzVJt2nSsEmVyqdLvFu+hin8AWnK0zixrBbjOMv6Qw/l4bNccltpo/cpbJQtf6doLEX68wcblZ4SoPQUzZJdBEARxNaGSzhhQrR3WCmVBvkcptLIDY2atL30iSmD8u6YuQneByQ5phtG/CcHH5svs8cke9gGrKtQQXXJWN8JYSgyqL6iH3ZRgFbhtBI/k+NkPPtzd2WdejRzMkluJJLtOLoJFD6OJ/v0GGpFddhKRfMklI5LiL5/s2wtq+fC308c/t3BaldtLjK4X8sg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(5005006)(8121501046)(13024025)(13023025)(13015025)(13017025)(13018025)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(20161123556025)(20161123559025)(20161123561025)(20161123565025); SRVR:CY4PR03MB2471; BCL:0; PCL:0; RULEID:(400006); SRVR:CY4PR03MB2471; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 4:uJ91IilDxGvV6k+dw8AxS72COtpPN+OBodOwZd/zQfZDRs7ShdYBXINSvaIA1sqqwaQcCcZXIjuZxGNhOqT4vTZxMqY3e92U9b8o2iakvh7mpiE2SobMb5iyXmsqzfDzimEmqwfAx3rAxFr+M8TxuK9sAISYFlShWQ9ncpI8niY5joaomA6g9oZK0a8OWDTWyTooE+3YDrF7ahpZJGABVpOmNRYmVrg0jjhnGRPqvgBEI7VryzOa+o8NpJ2rTir3jIdXcZgjopEKC/a9/Dvauny+h+UI3+F2B7+QoamxKag7i497/2zWuSFYfTDpWJyxlab1/Z08WEmU0PH+3qcPDvLUMQupE2duv87kdk6CjmHnbANuNCbgC9Fwmc75wFhCIAkpMXRsVYlFVvBGxpLEUyMj8MIx1YWRmSBVn0KPp9XjVP4eKid0ECD9W2uRFvt3n9wT5x/T5s+1dfy1NEJoo4iCJBCtGTjf2cptwECFHljHn9Sp+bDDxxYUIAPJsaplP0JNIqsING1XY+Zo3nhUsC6fQc/uKHS9FC0fuOEuDkqsHfzbT8qokKjqD/V1YPsRAj1aa3p5SujWUnomqrhbCY3ohdbD/DG28AIZamtqAp4APpkYTV1EVKA8ybznKqJWC5X/s1qZyNFAYTiihLHWLFNKD8i8mTh0OVilov8/VRw4vM3EXMDiIhrVnhRx1alt0b0g8nuMxrOexesLL+7j92Rexb0TeCWMzgF+neMjiMSs62t4LiUWijaVKHEM2aDi X-Forefront-PRVS: 0178184651 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2471; 23:0P/KhMGvyzGLr5NNclpu8+J/nfy6ePhlm0mNErWDI?= =?us-ascii?Q?TgQ8T8BPXQQBA7s4KszN5puicPws/24q47qWKXMGnNH846qNGUcNH59o5AZT?= =?us-ascii?Q?5r6yAiUW+6IxaRgKrwu+FmwFWKMByYrEr+JzuvSWPjezUFbZRSKdgpMiJ+Xo?=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/uDZnCRw6UTMvmod8w+rs/dhtbNNzJG2dLd37ueyt/7jmArHkj0/7X7+DGJrZOnsWncIiqDlvzP2TrK4+s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2471; 7:4Tb2Ekn8C754L2bs5AOHk0q7iX3EQHpfYjY/lBaMV9a4mQoFtFZGo9ky6nipb12wg4iq43R6qykG9V79J9SBG/5lPDW/0yLSMAEt3LfwAUdvqLufa/rY7SZFeOiRIs4M/CynsFRGxo4rmvW/QKFVStnloVacvcMzCUk51vnQksA3AGI/IwnW1KuPHzjECARU0XdvUEjIm6AC2KM01wtoOMKSRF7a/SK/pnY6tnGTvSW+tAipQ9IuPGi5P6mS5z126537E/rFDNVajSHUWMnRIWvilAGSyqyS2XSOLCq8zKPsDQg1+FJ0oMsVPgVZGZ4QbS/WgO4UWTp56uWTK21LHJeMVL4t5MDSeLTblnugguWnB4LXsh+iUbHjuJy4/LlwMUuz73tuOWWjxpqIaUWOSsXk5PyJcH3LQxmmYe4mhD6Yda91DnRrawPIVHy+KuL5RH48ulvqEFFu7yYJjxHV2Q== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2017 08:08:46.0516 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2471 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170105_000909_154267_1B78A464 X-CRM114-Status: GOOD ( 19.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Jason Cooper , Roy Zang , Marc Zyngier , Stuart Yoder , Yang-Leo Li , Minghuan Lian , Scott Wood , Mingkai Hu Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP A MSI controller of LS1043a v1.0 only includes one MSIR and is assigned one GIC interrupt. In order to support affinity, LS1043a v1.1 MSI is assigned 4 MSIRs and 4 GIC interrupts. But the MSIR has the different offset and only supports 8 MSIs. The bits between variable bit_start and bit_end in structure ls_scfg_msir are used to show 8 MSI interrupts. msir_irqs and msir_base are added to describe the difference of MSI between LS1043a v1.1 and other SoCs. Signed-off-by: Minghuan Lian Acked-by: Rob Herring --- v2-v1: - None .../interrupt-controller/fsl,ls-scfg-msi.txt | 1 + drivers/irqchip/irq-ls-scfg-msi.c | 45 +++++++++++++++++++--- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-scfg-msi.txt b/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-scfg-msi.txt index dde4552..49ccabb 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-scfg-msi.txt +++ b/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-scfg-msi.txt @@ -7,6 +7,7 @@ Required properties: "fsl,ls1021a-msi" "fsl,ls1043a-msi" "fsl,ls1046a-msi" + "fsl,ls1043a-v1.1-msi" - msi-controller: indicates that this is a PCIe MSI controller node - reg: physical base address of the controller and length of memory mapped. - interrupts: an interrupt to the parent interrupt controller. diff --git a/drivers/irqchip/irq-ls-scfg-msi.c b/drivers/irqchip/irq-ls-scfg-msi.c index 67547bd..dc19569 100644 --- a/drivers/irqchip/irq-ls-scfg-msi.c +++ b/drivers/irqchip/irq-ls-scfg-msi.c @@ -25,14 +25,21 @@ #define MSI_IRQS_PER_MSIR 32 #define MSI_MSIR_OFFSET 4 +#define MSI_LS1043V1_1_IRQS_PER_MSIR 8 +#define MSI_LS1043V1_1_MSIR_OFFSET 0x10 + struct ls_scfg_msi_cfg { u32 ibs_shift; /* Shift of interrupt bit select */ + u32 msir_irqs; /* The irq number per MSIR */ + u32 msir_base; /* The base address of MSIR */ }; struct ls_scfg_msir { struct ls_scfg_msi *msi_data; unsigned int index; unsigned int gic_irq; + unsigned int bit_start; + unsigned int bit_end; void __iomem *reg; }; @@ -140,13 +147,18 @@ static void ls_scfg_msi_irq_handler(struct irq_desc *desc) struct ls_scfg_msir *msir = irq_desc_get_handler_data(desc); struct ls_scfg_msi *msi_data = msir->msi_data; unsigned long val; - int pos, virq, hwirq; + int pos, size, virq, hwirq; chained_irq_enter(irq_desc_get_chip(desc), desc); val = ioread32be(msir->reg); - for_each_set_bit(pos, &val, MSI_IRQS_PER_MSIR) { - hwirq = ((31 - pos) << msi_data->cfg->ibs_shift) | msir->index; + + pos = msir->bit_start; + size = msir->bit_end + 1; + + for_each_set_bit_from(pos, &val, size) { + hwirq = ((msir->bit_end - pos) << msi_data->cfg->ibs_shift) | + msir->index; virq = irq_find_mapping(msi_data->parent, hwirq); if (virq) generic_handle_irq(virq); @@ -193,14 +205,24 @@ static int ls_scfg_msi_setup_hwirq(struct ls_scfg_msi *msi_data, int index) msir->index = index; msir->msi_data = msi_data; msir->gic_irq = virq; - msir->reg = msi_data->regs + MSI_MSIR_OFFSET + 4 * index; + msir->reg = msi_data->regs + msi_data->cfg->msir_base + 4 * index; + + if (msi_data->cfg->msir_irqs == MSI_LS1043V1_1_IRQS_PER_MSIR) { + msir->bit_start = 32 - ((msir->index + 1) * + MSI_LS1043V1_1_IRQS_PER_MSIR); + msir->bit_end = msir->bit_start + + MSI_LS1043V1_1_IRQS_PER_MSIR - 1; + } else { + msir->bit_start = 0; + msir->bit_end = msi_data->cfg->msir_irqs - 1; + } irq_set_chained_handler_and_data(msir->gic_irq, ls_scfg_msi_irq_handler, msir); /* Release the hwirqs corresponding to this MSIR */ - for (i = 0; i < MSI_IRQS_PER_MSIR; i++) { + for (i = 0; i < msi_data->cfg->msir_irqs; i++) { hwirq = i << msi_data->cfg->ibs_shift | msir->index; bitmap_clear(msi_data->used, hwirq, 1); } @@ -216,7 +238,7 @@ static int ls_scfg_msi_teardown_hwirq(struct ls_scfg_msir *msir) if (msir->gic_irq > 0) irq_set_chained_handler_and_data(msir->gic_irq, NULL, NULL); - for (i = 0; i < MSI_IRQS_PER_MSIR; i++) { + for (i = 0; i < msi_data->cfg->msir_irqs; i++) { hwirq = i << msi_data->cfg->ibs_shift | msir->index; bitmap_set(msi_data->used, hwirq, 1); } @@ -226,15 +248,26 @@ static int ls_scfg_msi_teardown_hwirq(struct ls_scfg_msir *msir) static struct ls_scfg_msi_cfg ls1021_msi_cfg = { .ibs_shift = 3, + .msir_irqs = MSI_IRQS_PER_MSIR, + .msir_base = MSI_MSIR_OFFSET, }; static struct ls_scfg_msi_cfg ls1046_msi_cfg = { .ibs_shift = 2, + .msir_irqs = MSI_IRQS_PER_MSIR, + .msir_base = MSI_MSIR_OFFSET, +}; + +static struct ls_scfg_msi_cfg ls1043_v1_1_msi_cfg = { + .ibs_shift = 2, + .msir_irqs = MSI_LS1043V1_1_IRQS_PER_MSIR, + .msir_base = MSI_LS1043V1_1_MSIR_OFFSET, }; static const struct of_device_id ls_scfg_msi_id[] = { { .compatible = "fsl,ls1021a-msi", .data = &ls1021_msi_cfg }, { .compatible = "fsl,ls1043a-msi", .data = &ls1021_msi_cfg }, + { .compatible = "fsl,ls1043a-v1.1-msi", .data = &ls1043_v1_1_msi_cfg }, { .compatible = "fsl,ls1046a-msi", .data = &ls1046_msi_cfg }, {}, };