Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965674AbbLPBMo (ORCPT ); Tue, 15 Dec 2015 20:12:44 -0500 Received: from mail-db3on0096.outbound.protection.outlook.com ([157.55.234.96]:21214 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932810AbbLPBMm (ORCPT ); Tue, 15 Dec 2015 20:12:42 -0500 Authentication-Results: spf=fail (sender IP is 212.179.42.66) smtp.mailfrom=ezchip.com; linutronix.de; dkim=none (message not signed) header.d=none;linutronix.de; dmarc=none action=none header.from=ezchip.com; From: Noam Camus To: CC: , , , Noam Camus , Thomas Gleixner , Jason Cooper , Marc Zyngier Subject: [PATCH v4 05/19] irqchip: add nps Internal and external irqchips Date: Wed, 16 Dec 2015 03:10:24 +0200 Message-ID: <1450228238-4499-6-git-send-email-noamc@ezchip.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1450228238-4499-1-git-send-email-noamc@ezchip.com> References: <1450228238-4499-1-git-send-email-noamc@ezchip.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-11.0.0.1191-8.000.1202-22004.003 X-TM-AS-Result: No--16.956900-8.000000-31 X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;DB3FFO11FD054;1:f+hEEm95nl3GggrhaADHtgzxdPblnXfkGb9sq0+5k4Luao1douDdegMiMDvaY4hLiPespndCXaTkJZvP78KghAd0Adg2vu8fXoIwJvh5LB0H2aTJLXEKpMceXU4E18S6nhAMrKe7zIbUY8j1piKLlWTmhxu9pIeguZ9sydP72I1WZf9zGj9g9xHhl1Sd9JsYSArZZd2ogcheSJJWEIea8edZbMXQhtHJNCYaUBJ9Bre4nmycso5kkGURDpcFbLkvyeGtwUoV+bAnkqcHoyirimuV2Ko0ub9PHRVEeu0itZWG9/Dkb8MNqvCE2DaFceKM0xBXs0gUv4vbOWyqq/AoGV93jjMYHpqfO4lL+yCyS2vwQM+G6PqH529fNn/VXTZzqmDR9Gx6q0xUfRMyQisaroMeeAZtwkF0UTrUc67S6xs= X-Forefront-Antispam-Report: CIP:212.179.42.66;CTRY:IL;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(105606002)(33646002)(85426001)(50986999)(5008740100001)(50466002)(1220700001)(2950100001)(36756003)(11100500001)(92566002)(77096005)(1096002)(50226001)(6806005)(586003)(48376002)(104016004)(2351001)(110136002)(5003940100001)(19580405001)(106466001)(76176999)(19580395003)(86362001)(189998001)(87936001)(47776003)(5001970100001)(229853001)(49486002)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR02MB1085;H:ezex10.ezchip.com;FPR:;SPF:Fail;PTR:ezmail.ezchip.com;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;VI1PR02MB1085;2:5fb3a+o3QpNZ26QOodHY3wYZjnJl0vaP6AiAh2CBAX3//6SlYMEa0sINX9JFfU3MkNkevMIISpBI7Pcx84PFEZ7sDfClUaTIufFe4QV0/r0omrNM0y2FQ50ZiQji0G1TrCk0KIIZMryKohvIEKrdDA==;3:M4nZGnqJIRSOoeCZy1+cZHDlr0w56M58lHXjL8J04JwIdt6OJDfnfl7uMcn3jJ4mE0QEgILGIU2I/bS9zR7MUN+4cHyU0Ah5fDEO4cpeymR00O+vjVA9WSHf+dC7gJPuUoQrdRvHKm8+Ypq1rKyr+p/Io0Yy4ZWxeDSMha5yubRoI0XOEq+cbapFLOswIR8E7rx71YrD6UEiRf6pcQBzhJO5lm/4j5eULUI/wQRtQ/o=;25:o1tztLnAXfU+NmJUba2NVESx4BFm7oQ3dzeast5mdQ1Ex3aCqNfz9ucT3CDQ05QtE5qMN6uTKNSdMSlZ4wbz+8CTBYhCKsVx6u3Bt0g57ASiDcEEClpvRHKDOFI3dHEENZA/ri2krAR4lnjzhm0OHB+l67pwCMFHtd6A87w87cKzEvGHXs8oVxGtlhosYCPwDjE682NIx0qMp4pPpmcu3t4by8ETkodXos9osfrgy7jiqlHhuEWVdjeyjnCzsj2XYavSRvikTCaR9nsPpnJ9uw==;20:De0d5P+Gp9uSUf92HGSPf6QieDanCyoWX5ovJ/VzUEv6dK9N6PhrVq9L77TFQcUoEcJrO8l1sLCB0oLUTQaMbNn06aA1InMtlfhAO5NrltNmYQ2l3VeD1V634+C+Un/28k0BTsr7uAbBWFooTxttLUSLvN7KAhWlnA12FLOmD8Q= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB1085; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872)(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(10201501046)(3002001);SRVR:VI1PR02MB1085;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB1085; X-Microsoft-Exchange-Diagnostics: 1;VI1PR02MB1085;4:Z6vhbW3nii7zgbpAJVwJDaTub0jZvBsrXf7SRwsqcHHXHb1Q6G0aheQDzO35H2Csn0N4yoxGGyDcLTP6LKfu7YpH815XlFT74ASPBG7QGPY3YxJ6PQZZ8F46E9NfqZKIosQxd+yyroZPScB3cdK7zbJj29GNx3TDuB/YgA8UXHJJepCOxBSDLA4F3unF1dqesOjc6Itfa00WhqaoUmIT3tTC+DwvV/NIqrgIFDPa6Ix+RmvhXn8b41HhBrqbddo/5KiAhbmz0U/ds6zKLr0F9xFHrTXR61JKkK1G9l0D9460QZs0Q6xrqkbjAs+/i1DYZ53BgeAbPC7yxz815I+XFI4dxO04vtIVkk8bT8/XJRFRCvjhkGqScG/AWFcFqjyxiVhCDAT1aFj7rPOw4xvilvq0mwv2kqth53O3+wtPgIiIKW+JWYmd/P1u/M8IDePWgVLGHGv99yVRzDueM7pa6g== X-Forefront-PRVS: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xNwJNw60oVFefH1MkRdM/d/YyR4sTA4q7auerV8E5I4GZZateKQIjb6mj?= =?us-ascii?Q?WX6vjaDHq3VGS/o0l5FsKCYunE44ZtjFViZhVvFJiB2ngaIDvDD/GAxTJEcp?= =?us-ascii?Q?O/YuWzftO3SdWZKZmb2dTDPlk9Sry95gYXF7OGBdT3hPlUaxVQhAfwNXEOOS?= =?us-ascii?Q?8xFvEagSfkxK7FNWbcLiOePPfwcRyE4wHDN0ly/pNuuFpRTmHVuAVyoPhUft?= =?us-ascii?Q?Kqypp4=3D?= X-Microsoft-Exchange-Diagnostics: 1;VI1PR02MB1085;5:tcDsI2fvjp2n3jWHzCG4iYUj5obUqWJJV+s96KA2UEUgZP/bU4OBGP62+eTNe0s/RB9Jn9mH+gBB7NrskJfIjYEYiOfzYb6YNeWEnByeT2dCXpnogQjr4HAFsgW49jaIqLTulDCSrk6ODne4esFNEg==;24:+uiSo8aI6+8U4t63PHrFaAJhqBun1DxtmF+3CaV7ficsCSTqDuZhwj3WUBsQ/JmcRi3be06SH9vMuAn5MdphFvPgbIlUcGYmRGa8gL+yLw0= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2015 01:12:37.4145 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3;Ip=[212.179.42.66];Helo=[ezex10.ezchip.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB1085 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5956 Lines: 198 From: Noam Camus Adding EZchip NPS400 support. NPS internal interrupts are internally handled at Multi Thread Manager (MTM) that is signaled for deactivating an interrupt. External interrupts is handled also at Global Interrupt Controller (GIC) e.g. serial and network devices. Signed-off-by: Noam Camus Cc: Thomas Gleixner Cc: Jason Cooper Cc: Marc Zyngier --- .../interrupt-controller/ezchip,nps400-ic.txt | 17 +++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-eznps.c | 131 ++++++++++++++++++++ 3 files changed, 149 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/ezchip,nps400-ic.txt create mode 100644 drivers/irqchip/irq-eznps.c diff --git a/Documentation/devicetree/bindings/interrupt-controller/ezchip,nps400-ic.txt b/Documentation/devicetree/bindings/interrupt-controller/ezchip,nps400-ic.txt new file mode 100644 index 0000000..888b2b9 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/ezchip,nps400-ic.txt @@ -0,0 +1,17 @@ +EZchip NPS Interrupt Controller + +Required properties: + +- compatible : should be "ezchip,nps400-ic" +- interrupt-controller : Identifies the node as an interrupt controller +- #interrupt-cells : Specifies the number of cells needed to encode an + interrupt source. The value shall be 1. + + +Example: + +intc: interrupt-controller { + compatible = "ezchip,nps400-ic"; + interrupt-controller; + #interrupt-cells = <1>; +}; diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 177f78f..b95b954 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -55,3 +55,4 @@ obj-$(CONFIG_RENESAS_H8S_INTC) += irq-renesas-h8s.o obj-$(CONFIG_ARCH_SA1100) += irq-sa11x0.o obj-$(CONFIG_INGENIC_IRQ) += irq-ingenic.o obj-$(CONFIG_IMX_GPCV2) += irq-imx-gpcv2.o +obj-$(CONFIG_ARC_PLAT_EZNPS) += irq-eznps.o diff --git a/drivers/irqchip/irq-eznps.c b/drivers/irqchip/irq-eznps.c new file mode 100644 index 0000000..fc6d59a --- /dev/null +++ b/drivers/irqchip/irq-eznps.c @@ -0,0 +1,131 @@ +/* + * Copyright(c) 2015 EZchip Technologies. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * The full GNU General Public License is included in this distribution in + * the file called "COPYING". + */ + +#include +#include +#include +#include +#include +#include + +/* + * NPS400 core includes a Interrupt Controller (IC) support. + * All cores can deactivate level irqs at first level control + * at cores mesh layer called MTM. + * For devices out side chip e.g. uart, network there is another + * level called Global Interrupt Manager (GIM). + * This second level can control level and edge interrupt. + * + * NOTE: AUX_IENABLE and CTOP_AUX_IACK are auxiliary registers + * with private HW copy per CPU. + */ + +static void nps400_irq_mask(struct irq_data *data) +{ + unsigned int ienb; + + ienb = read_aux_reg(AUX_IENABLE); + ienb &= ~(1 << data->hwirq); + write_aux_reg(AUX_IENABLE, ienb); +} + +static void nps400_irq_unmask(struct irq_data *data) +{ + unsigned int ienb; + + ienb = read_aux_reg(AUX_IENABLE); + ienb |= (1 << data->hwirq); + write_aux_reg(AUX_IENABLE, ienb); +} + +static void nps400_irq_eoi_global(struct irq_data *data) +{ + write_aux_reg(CTOP_AUX_IACK, 1 << data->hwirq); + + /* Don't ack before all device access is done */ + mb(); + + __asm__ __volatile__ ( + " .word %0\n" + : + : "i"(CTOP_INST_RSPI_GIC_0_R12) + : "memory"); +} + +static void nps400_irq_eoi(struct irq_data *data) +{ + write_aux_reg(CTOP_AUX_IACK, 1 << data->hwirq); +} + +static struct irq_chip nps400_irq_chip_fasteoi = { + .name = "NPS400 IC Global", + .irq_mask = nps400_irq_mask, + .irq_unmask = nps400_irq_unmask, + .irq_eoi = nps400_irq_eoi_global, +}; + +static struct irq_chip nps400_irq_chip_percpu = { + .name = "NPS400 IC", + .irq_mask = nps400_irq_mask, + .irq_unmask = nps400_irq_unmask, + .irq_eoi = nps400_irq_eoi, +}; + +static int nps400_irq_map(struct irq_domain *d, unsigned int virq, + irq_hw_number_t hw) +{ + switch (hw) { + case TIMER0_IRQ: +#if defined(CONFIG_SMP) + case IPI_IRQ: +#endif + irq_set_chip_and_handler(virq, &nps400_irq_chip_percpu, + handle_percpu_irq); + break; + default: + irq_set_chip_and_handler(virq, &nps400_irq_chip_fasteoi, + handle_fasteoi_irq); + break; + } + + return 0; +} + +static const struct irq_domain_ops nps400_irq_ops = { + .xlate = irq_domain_xlate_onecell, + .map = nps400_irq_map, +}; + +static struct irq_domain *nps400_root_domain; + +static int __init nps400_of_init(struct device_node *node, + struct device_node *parent) +{ + if (parent) + panic("DeviceTree incore ic not a root irq controller\n"); + + nps400_root_domain = irq_domain_add_linear(node, NR_CPU_IRQS, + &nps400_irq_ops, NULL); + + if (!nps400_root_domain) + panic("nps400 root irq domain not avail\n"); + + /* with this we don't need to export nps400_root_domain */ + irq_set_default_host(nps400_root_domain); + + return 0; +} +IRQCHIP_DECLARE(ezchip_nps400_ic, "ezchip,nps400-ic", nps400_of_init); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/