Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp4778377ima; Tue, 5 Feb 2019 00:54:10 -0800 (PST) X-Google-Smtp-Source: AHgI3IZoohNExXxtQfdAjE/XYacT1aleZD1pSRVWEE20FcWMXhDvtKjnaAvMImmdJ5OqJckTE+Fu X-Received: by 2002:a63:374e:: with SMTP id g14mr3576012pgn.59.1549356850808; Tue, 05 Feb 2019 00:54:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549356850; cv=none; d=google.com; s=arc-20160816; b=NO/BXPtHOChxmqbXlCxKtm/SgRsORb+TN8UrcnEU7b9mOo+o+rL5ciw8TNKXJvEZGR 33iICTJA98qrvp69tVXwb6EJxTN4CIECdggMl5He9UzJd36DHd2lEc+exQxz2v9Xfa2b JK6MVF6/JaXjYGeU1QLhQiy8NhKHrdtsDHl6Noi08/LLTwBm7cQsdg/a5yprHR9ih2L8 RphbxspuVVgbFUCaCn4IM13D/SLelrlpZd/0MJwRGYDcgUJMcpr/vU2hbHNvNO6pjXwl hHqNjxDyOlDNMre0PKx2UnhX6gMnuX8a8jKk7XeDsEBCatGpKOlcxkRfeUrQoK9nRLKO US6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=yM5AiY4Kql0x8pFeQ04aeXZdE40bZkN2azCCM/k1d5E=; b=kMsMkrEfLywRfVr84pTCjg04rXH+V6VUrboeC1hr64z6KVYbLZbelvKBo/e/P0RgMV lsOUUjPFloqHvciBR83CtqaUY+I9Bfh5spjnjeXiv+sFa9EJjd66RJAxmG8arYhyoa+Z XTdS0elcuCvREp1Ism8r9jTzRyay8YtJokyryahya5TZly8erVCAp8AoYzUeuebiQSSj IvBr2wc4kmhUWcvngy/46kAhZ2qFaRHrdKu4QDgHS/78PrNzW9IGHbksaYm8RM+XkevJ OIooHi7q0Vynq42OCk9hgb0cdiV/5bAdAN7oXN0KUUs5oV3WjcAPC08o8eujXeRPmyKm W+IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JGrERZNp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 27si2656709pgp.135.2019.02.05.00.53.54; Tue, 05 Feb 2019 00:54:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=JGrERZNp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728158AbfBEIw3 (ORCPT + 99 others); Tue, 5 Feb 2019 03:52:29 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:45286 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725898AbfBEIw3 (ORCPT ); Tue, 5 Feb 2019 03:52:29 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x158pJx8072836; Tue, 5 Feb 2019 02:51:19 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1549356679; bh=yM5AiY4Kql0x8pFeQ04aeXZdE40bZkN2azCCM/k1d5E=; h=Subject:To:References:CC:From:Date:In-Reply-To; b=JGrERZNpGrB/pLe0/fQ0VgIqP0bkJMOc4T7Z7hDdfPXCz/YJJKpX8DU5/RswSm/HX f25hMCtZ6OFe3bap9NiNBfht91O0hlqH0ya6Tsd1EWrb4jGN8loDcsHfha+YF4LoWI L34Yk1nkGZ9oCipQCKlSL6zosG1EvSL6+MSFxb3g= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x158pJ7l003705 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 5 Feb 2019 02:51:19 -0600 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Tue, 5 Feb 2019 02:51:19 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Tue, 5 Feb 2019 02:51:18 -0600 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id x158pE1N017956; Tue, 5 Feb 2019 02:51:15 -0600 Subject: Re: [PATCH v2 04/14] irqchip: pruss: Add a PRUSS irqchip driver for PRUSS interrupts To: "Andrew F. Davis" , , , , Rob Herring References: <1549290167-876-1-git-send-email-rogerq@ti.com> <1549290167-876-5-git-send-email-rogerq@ti.com> <57e5b54e-430e-daa1-4b5d-f61827095606@ti.com> <5C585B33.4030505@ti.com> CC: , , , , , , , , , , , , Thomas Gleixner , Jason Cooper , Marc Zyngier From: Roger Quadros Message-ID: <5C594E82.8040601@ti.com> Date: Tue, 5 Feb 2019 10:51:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <5C585B33.4030505@ti.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Rob Andrew, On 04/02/19 17:33, Roger Quadros wrote: > On 04/02/19 17:11, Andrew F. Davis wrote: >> On 2/4/19 8:22 AM, Roger Quadros wrote: >>> From: "Andrew F. Davis" >>> >> >> [...] >> >>> +static const struct pruss_intc_match_data am437x_pruss_intc_data = { >>> + .no_host7_intr = true, >> >> Like done for the PRUSS driver with 'has_no_sharedram' becoming a DT >> flag the same could be done here, then all this match data stuff could >> be dropped. > > Agreed. > Going back and looking at code here is a different perspective. The has_no_sharedram case was a an odd duck because the 2 ICSSG instances within the same SoC (AM437x) had differences. So we couldn't use the compatible to differentiate there. The DT flag makes sense there. In the no_host7_intr case, it SoC specific so we can use the compatible to differentiate. And AM6 SoC has different number of system_events and host_interrupts so that could come in macth_data as well. See below. static const struct pruss_intc_match_data am335x_am57xx_pruss_intc_data = { .num_system_events = 64, .num_host_intrs = 10, .no_host7_intr = false, }; static const struct pruss_intc_match_data am437x_k2g_pruss_intc_data = { .num_system_events = 64, .num_host_intrs = 10, .no_host7_intr = true, }; static const struct pruss_intc_match_data am6x_icssg_intc_data = { .num_system_events = 160, .num_host_intrs = 20, .no_host7_intr = false, }; Alternatively, we add a DT property each for all 3 of them and get rid of match_data entirely. Which is a better approach? cheers, -roger >> >>> +}; >>> + >>> +static const struct of_device_id pruss_intc_of_match[] = { >>> + { >>> + .compatible = "ti,am3356-pruss-intc", >>> + .data = NULL, >>> + }, >>> + { >>> + .compatible = "ti,am4376-pruss-intc", >>> + .data = &am437x_pruss_intc_data, >>> + }, >>> + { >>> + .compatible = "ti,am5728-pruss-intc", >>> + .data = NULL, >>> + }, >>> + { /* sentinel */ }, >>> +}; >>> +MODULE_DEVICE_TABLE(of, pruss_intc_of_match); >>> + >>> +static struct platform_driver pruss_intc_driver = { >>> + .driver = { >>> + .name = "pruss-intc", >>> + .of_match_table = pruss_intc_of_match, >>> + }, >>> + .probe = pruss_intc_probe, >>> + .remove = pruss_intc_remove, >>> +}; >>> +module_platform_driver(pruss_intc_driver); >>> + >>> +MODULE_AUTHOR("Andrew F. Davis "); >>> +MODULE_AUTHOR("Suman Anna "); >>> +MODULE_DESCRIPTION("PRU-ICSS INTC Driver"); >>> +MODULE_LICENSE("GPL v2"); >>> diff --git a/include/linux/irqchip/irq-pruss-intc.h b/include/linux/irqchip/irq-pruss-intc.h >>> new file mode 100644 >>> index 0000000..4538a0b >>> --- /dev/null >>> +++ b/include/linux/irqchip/irq-pruss-intc.h >>> @@ -0,0 +1,94 @@ >>> +/* SPDX-License-Identifier: GPL-2.0 */ >>> +/** >>> + * irq-pruss-intc.h - PRU-ICSS INTC management >> >> Filename not needed. > > OK. > > cheers, > -roger > >> >> Andrew >> >>> + * >>> + * Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com >>> + */ >>> + >>> +#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_PRUSS_INTC_H >>> +#define __INCLUDE_LINUX_IRQCHIP_IRQ_PRUSS_INTC_H >>> + >>> +/* maximum number of system events */ >>> +#define MAX_PRU_SYS_EVENTS 64 >>> + >>> +/* maximum number of interrupt channels */ >>> +#define MAX_PRU_CHANNELS 10 >>> + >>> +/** >>> + * struct pruss_intc_config - INTC configuration info >>> + * @sysev_to_ch: system events to channel mapping information >>> + * @ch_to_host: interrupt channel to host interrupt information >>> + */ >>> +struct pruss_intc_config { >>> + s8 sysev_to_ch[MAX_PRU_SYS_EVENTS]; >>> + s8 ch_to_host[MAX_PRU_CHANNELS]; >>> +}; >>> + >>> +#if IS_ENABLED(CONFIG_TI_PRUSS) >>> + >>> +/** >>> + * pruss_intc_configure() - configure the PRUSS INTC >>> + * @dev: device >>> + * @intc_config: PRU core-specific INTC configuration >>> + * >>> + * Configures the PRUSS INTC with the provided configuration from >>> + * a PRU core. Any existing event to channel mappings or channel to >>> + * host interrupt mappings are checked to make sure there are no >>> + * conflicting configuration between both the PRU cores. The function >>> + * is intended to be used only by the PRU remoteproc driver. >>> + * >>> + * Returns 0 on success, or a suitable error code otherwise >>> + */ >>> +int pruss_intc_configure(struct device *dev, >>> + struct pruss_intc_config *intc_config); >>> + >>> +/** >>> + * pruss_intc_unconfigure() - unconfigure the PRUSS INTC >>> + * @dev: device >>> + * @intc_config: PRU core specific INTC configuration >>> + * >>> + * Undo whatever was done in pruss_intc_configure() for a PRU core. >>> + * It should be sufficient to just mark the resources free in the >>> + * global map and disable the host interrupts and sysevents. >>> + */ >>> +int pruss_intc_unconfigure(struct device *dev, >>> + struct pruss_intc_config *intc_config); >>> +/** >>> + * pruss_intc_trigger() - trigger a PRU system event >>> + * @irq: linux IRQ number associated with a PRU system event >>> + * >>> + * Trigger an interrupt by signalling a specific PRU system event. >>> + * This can be used by PRUSS client users to raise/send an event to >>> + * a PRU or any other core that is listening on the host interrupt >>> + * mapped to that specific PRU system event. The @irq variable is the >>> + * Linux IRQ number associated with a specific PRU system event that >>> + * a client user/application uses. The interrupt mappings for this is >>> + * provided by the PRUSS INTC irqchip instance. >>> + * >>> + * Returns 0 on success, or an error value upon failure. >>> + */ >>> +int pruss_intc_trigger(unsigned int irq); >>> + >>> +#else >>> + >>> +static inline int pruss_intc_configure(struct device *dev, >>> + struct pruss_intc_config *intc_config) >>> +{ >>> + return -ENOTSUPP; >>> +} >>> + >>> +static inline int pruss_intc_unconfigure(struct device *dev, >>> + struct pruss_intc_config *intc_config) >>> +{ >>> + return -ENOTSUPP; >>> +} >>> + >>> +static inline int pruss_intc_trigger(unsigned int irq) >>> +{ >>> + return -ENOTSUPP; >>> +} >>> + >>> +#endif /* CONFIG_TI_PRUSS */ >>> + >>> +#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_OMAP_INTC_H */ >>> + >>> > -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki