From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751395AbdAYIyh (ORCPT ); Wed, 25 Jan 2017 03:54:37 -0500 Received: from mail-bl2nam02on0047.outbound.protection.outlook.com ([104.47.38.47]:60128 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751304AbdAYIye (ORCPT ); Wed, 25 Jan 2017 03:54:34 -0500 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=bestguesspass action=none header.from=xilinx.com;arm.com; dkim=none (message not signed) header.d=none; From: Bharat Kumar Gogada To: , , , , , CC: , , , , , "Bharat Kumar Gogada" Subject: [PATCH v2 1/2] PCI: Xilinx NWL: Modifying irq chip for legacy interrupts Date: Wed, 25 Jan 2017 14:22:32 +0530 Message-ID: <1485334353-26815-1-git-send-email-bharatku@xilinx.com> X-Mailer: git-send-email 2.1.1 X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-22842.006 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(7916002)(2980300002)(438002)(3190300001)(199003)(189002)(47776003)(5003940100001)(356003)(52956003)(5001770100001)(107886002)(189998001)(2906002)(4326007)(33646002)(92566002)(90966002)(103686003)(42186005)(63266004)(106466001)(6666003)(5660300001)(36386004)(4001430100002)(50986999)(38730400001)(8936002)(626004)(8676002)(81166006)(81156014)(2201001)(54906002)(48376002)(50466002)(36756003)(45336002)(46386002)(50226002)(305945005)(107986001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR02MB1384;H:xsj-pvapsmtpgw01;FPR:;SPF:Pass;PTR:unknown-60-83.xilinx.com;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;SN1NAM02FT037;1:Lv2aIW4eUyPlwGtmKTTvMZrGX/CUx6/27WGSTURJZC6IMhglDoaKo8XULY+zjE6EcuV7eeN+CkWtXH41GcoF1ZNE520kx9uPiOg7QeOrC7YJH93heAuJOZppm2Y1r2gnWnRU2XWyYZcAkPOCCiKAb7rlt1c0FHjPifPc21+Gi6ZSUnXJJ//bdrNCx3D4s3jmV/Ql2E3t19U3EN7/ykUDpb97aboqOYpE0I3FPWCuDzxxST234qjrneB40Mln58/v9rHG6qmXBGYBnIwmCTWO0j4gPcr5udRsHJmHLGWVsrr6Hx+H3HdKDQXq8z8uuUhIp8UhfVZJ91z5BsDDR2K6lYIWdYLGGhdqH718PhfJ+fqxgs3XuAsVuPpbq1ifXjT2w3ENjNY6pHyGtX+6L6ipPAjdt+6jebv/ybr+4bTYQnBhL1iEu35bfL7NE/lmPu7rCVwBacEkvoZtyvZ0z8PGP+tF8FNO579M5YwbmQAZ6SxyPWg1vo4vwcm0hxSFZYRW0So8uN+fH3xpgEHrA+6uRdWy5Gal0fCY/LoJH+kYaZK5/UBdOAVePpLiMf09iDLWEriLeUFkWbMVP6D45/A3RHAbSeQBeYdsmfyV00aQB0o9UvnmWN5oPBzXOO9mqIkP MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 003e37d4-79fa-4eea-9790-08d444ffc741 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002);SRVR:CY1PR02MB1384; X-Microsoft-Exchange-Diagnostics: 1;CY1PR02MB1384;3:JKMlzhlRiFtLjfbAC+OAO3z/oOhSje3hJ6y2335Kt7gPYXzQNs6s18mLq5a8wbIUo7wVVhKLlRZodJhIjZPnBEXcja+0A142AFPTGRHgGhiPXXQMv1CWssy84nTRLmtnOuzVHr4P9FswOYRSnJ0X20fbriUeZDXCWCZ0V5uRDWj9UWh9D5q0UIYOx/XyRO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4/38jy7prkwUd0d3XuBWg/khcG8H+JURRNkVC2fVnA3DESdZziwSIkTYc3KFX3K2PFOPOO8TRKhazXeC4iNrUtQg53xvxYuDDFpZuSQJW16KW0vzl0TdKdQRYT3KOkYM/GelNHLUutrwPLriksF5oZ4en7Ag4wQT9ab2TKhW7kkzANNBdYa/MHYrOnZ+ZW1V4tU6Mw0qFa61ES4aRTU30DmW3a7imtAVXB621XC3MZLkmOI8lV1Rd3OaZwPRPH9oMkj+A9vWOzBRe9Adkh8jBW/cMu6RT5A0P+f9yiA+4PmyxFiVjlC1d1W3pYD+ABrC3U32Hs4ewXlBJm2ibVEW7mvbz1I6uuh9Ys3kfDfoau24HJEmncGnrBfKWzmlM/N4Ri6r5Ysh8VqdgfJlx4CVsOl2zu34BbZ7d7S0OvyphLbNpv3bFQRL64Tf7Mn X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592)(154291594099940); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(13015025)(13017025)(13023025)(13018025)(13024025)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(6072148)(6042181);SRVR:CY1PR02MB1384;BCL:0;PCL:0;RULEID:;SRVR:CY1PR02MB1384; X-Microsoft-Exchange-Diagnostics: 1;CY1PR02MB1384;4:IAUkFpCA58tfgI6F7kM/oyWVugofLmpXDMiJiiMbw0llFK2JTF8Dyq2xXm6Y+hYJMjNiAJJeiEhSg23k2soyir4kVIyS1ErLWhlY82XWjCh9jMgxMW4atImMqRvbjORRlHgkruwIsNaELlb/MCqUJW8bMH110bIo8ThQJyfNi5aznOTL51r533hJN+d5WL7uSWg8e1xIisJuKlGdGWPUC5x4QKcAyNOwuk9ZQsnzSPoDDV0v5LhocbFYKJwusF5wl824TkbnMtErZDApsHzd1mqdtVV3u6hQ0i7jy0jwwXIUSKPpRYTKcT64q0h/OakCZFjae4knMvhw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pDAIHsJ3ieK0f5PEKFdHq15liisHv8eK8RORYYNC6KvilYDKjuSw1nadfKLojkLM+Tue3eog3H+eiZmp14qld+NTKXsHly+gNAyMNCRoovURSbX5vDrxq5Vg+ihet/HzPz7LrhUKydt3T6U/OKa5DRl6jJPKCo4Jc86PqfqJP/0pWxbfvRc4BmmA3OHnS24kXDlHJBEMSNLvkndq/J4vv0lWImUC2oXpoc9PpiSgRJPRxHx0PtHA==;5:XExzErmUxd5NjnmPvZ8yso+53niZ0i18fxiLJyxrRXbbbBfzVjxlllR9irnCpHnW1wAAip5l6GPetlRjspPmxaJHKCOWcPXPs7YNsEnkbA9r+0hm7RpNtgf4z9MzMVPEi1H4On6FD1N2/qd/04iovw==;24:p2EN/6AWQlpS0qdDldz9EMAjWX4MP+pJ8JlDGnV2HR+JxVzKaOjLP0z+AH9HPDywfhym2bjrDKfrY2aEQDzWgitzbtgEnyaqfqfqBnT3W88= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR02MB1384;7:+6xS8N+scwilTZckTnkZyJM1c4GpQTrES24H+J2qfWuTjs852vyiYE3NBlg5Cr2qfygwZh2kT//lFIXJbl0gAwSGnxiN6slVumtyjNgMnTd+mlQDoHvFFE2A86ocA4B9EkAEYvyzetzQpoygbkUHs5BYA0jnXr6yF94JvkR72jwRh91oNjmKrTpfnoaioAKmVi3UKcfYIDLFcEj6VdM3WOIDrSQje4VFpiRFSBTL6sAyb2GQckoaa1Tq9KhY2k792bA1Oxvd8L1UjCTf+dVXOM8paF/Vnt9eZgGKp55mdEdrgUG8aNk9KguI+Y+FcIP+vi0Vy7TEiqLXEGPmeE609zdHdf3Sr5BNgWResOqoAg2Edm8CgZlHLyA8lt2NvEqhYn22ldqvzGu0YOp+l3upityqvx2gZe5EaEa2Uolh6h8ZLQ9CBmg3iUTFhwj6AD8SVFPz48HXrB+qAUeSN8aoNg== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2017 08:54:31.2646 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c;Ip=[149.199.60.83];Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR02MB1384 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - Few wifi end points which only support legacy interrupts, performs hardware reset functionalities after disabling interrupts by invoking disable_irq and then re-enable using enable_irq, they enable hardware interrupts first and then virtual irq line later. - The legacy irq line goes low only after DEASSERT_INTx is received.As the legacy irq line is high immediately after hardware interrupts are enabled but virq of EP is still in disabled state and EP handler is never executed resulting no DEASSERT_INTx.If dummy irq chip is used, interrutps are not masked and system is hanging with CPU stall. - Adding irq chip functions instead of dummy irq chip for legacy interrupts. - Legacy interrupts are level sensitive, so using handle_level_irq is more appropriate as it is masks interrupts until End point handles interrupts and unmasks interrutps after End point handler is executed. Signed-off-by: Bharat Kumar Gogada --- drivers/pci/host/pcie-xilinx-nwl.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c index 43eaa4a..6ac3e1d 100644 --- a/drivers/pci/host/pcie-xilinx-nwl.c +++ b/drivers/pci/host/pcie-xilinx-nwl.c @@ -395,10 +395,44 @@ static void nwl_pcie_msi_handler_low(struct irq_desc *desc) chained_irq_exit(chip, desc); } +static void nwl_mask_leg_irq(struct irq_data *data) +{ + struct irq_desc *desc = irq_to_desc(data->irq); + struct nwl_pcie *pcie; + u32 mask; + u32 val; + + pcie = irq_desc_get_chip_data(desc); + mask = 1 << (data->hwirq - 1); + val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); + nwl_bridge_writel(pcie, (val & (~mask)), MSGF_LEG_MASK); +} + +static void nwl_unmask_leg_irq(struct irq_data *data) +{ + struct irq_desc *desc = irq_to_desc(data->irq); + struct nwl_pcie *pcie; + u32 mask; + u32 val; + + pcie = irq_desc_get_chip_data(desc); + mask = 1 << (data->hwirq - 1); + val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); + nwl_bridge_writel(pcie, (val | mask), MSGF_LEG_MASK); +} + +static struct irq_chip nwl_leg_irq_chip = { + .name = "nwl_pcie:legacy", + .irq_enable = nwl_unmask_leg_irq, + .irq_disable = nwl_mask_leg_irq, + .irq_mask = nwl_mask_leg_irq, + .irq_unmask = nwl_unmask_leg_irq, +}; + static int nwl_legacy_map(struct irq_domain *domain, unsigned int irq, irq_hw_number_t hwirq) { - irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); + irq_set_chip_and_handler(irq, &nwl_leg_irq_chip, handle_level_irq); irq_set_chip_data(irq, domain->host_data); return 0; -- 2.1.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: bharat.kumar.gogada@xilinx.com (Bharat Kumar Gogada) Date: Wed, 25 Jan 2017 14:22:32 +0530 Subject: [PATCH v2 1/2] PCI: Xilinx NWL: Modifying irq chip for legacy interrupts Message-ID: <1485334353-26815-1-git-send-email-bharatku@xilinx.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org - Few wifi end points which only support legacy interrupts, performs hardware reset functionalities after disabling interrupts by invoking disable_irq and then re-enable using enable_irq, they enable hardware interrupts first and then virtual irq line later. - The legacy irq line goes low only after DEASSERT_INTx is received.As the legacy irq line is high immediately after hardware interrupts are enabled but virq of EP is still in disabled state and EP handler is never executed resulting no DEASSERT_INTx.If dummy irq chip is used, interrutps are not masked and system is hanging with CPU stall. - Adding irq chip functions instead of dummy irq chip for legacy interrupts. - Legacy interrupts are level sensitive, so using handle_level_irq is more appropriate as it is masks interrupts until End point handles interrupts and unmasks interrutps after End point handler is executed. Signed-off-by: Bharat Kumar Gogada --- drivers/pci/host/pcie-xilinx-nwl.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c index 43eaa4a..6ac3e1d 100644 --- a/drivers/pci/host/pcie-xilinx-nwl.c +++ b/drivers/pci/host/pcie-xilinx-nwl.c @@ -395,10 +395,44 @@ static void nwl_pcie_msi_handler_low(struct irq_desc *desc) chained_irq_exit(chip, desc); } +static void nwl_mask_leg_irq(struct irq_data *data) +{ + struct irq_desc *desc = irq_to_desc(data->irq); + struct nwl_pcie *pcie; + u32 mask; + u32 val; + + pcie = irq_desc_get_chip_data(desc); + mask = 1 << (data->hwirq - 1); + val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); + nwl_bridge_writel(pcie, (val & (~mask)), MSGF_LEG_MASK); +} + +static void nwl_unmask_leg_irq(struct irq_data *data) +{ + struct irq_desc *desc = irq_to_desc(data->irq); + struct nwl_pcie *pcie; + u32 mask; + u32 val; + + pcie = irq_desc_get_chip_data(desc); + mask = 1 << (data->hwirq - 1); + val = nwl_bridge_readl(pcie, MSGF_LEG_MASK); + nwl_bridge_writel(pcie, (val | mask), MSGF_LEG_MASK); +} + +static struct irq_chip nwl_leg_irq_chip = { + .name = "nwl_pcie:legacy", + .irq_enable = nwl_unmask_leg_irq, + .irq_disable = nwl_mask_leg_irq, + .irq_mask = nwl_mask_leg_irq, + .irq_unmask = nwl_unmask_leg_irq, +}; + static int nwl_legacy_map(struct irq_domain *domain, unsigned int irq, irq_hw_number_t hwirq) { - irq_set_chip_and_handler(irq, &dummy_irq_chip, handle_simple_irq); + irq_set_chip_and_handler(irq, &nwl_leg_irq_chip, handle_level_irq); irq_set_chip_data(irq, domain->host_data); return 0; -- 2.1.1