linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: "Andrew F. Davis" <afd@ti.com>, <tony@atomide.com>,
	<ohad@wizery.com>, <bjorn.andersson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>
Cc: <s-anna@ti.com>, <david@lechnology.com>, <nsekhar@ti.com>,
	<t-kristo@ti.com>, <nsaulnier@ti.com>, <jreeder@ti.com>,
	<m-karicheri2@ti.com>, <woods.technical@gmail.com>,
	<linux-omap@vger.kernel.org>, <linux-remoteproc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <marc.zyngier@arm.com>
Subject: Re: [PATCH v2 04/14] irqchip: pruss: Add a PRUSS irqchip driver for PRUSS interrupts
Date: Tue, 5 Feb 2019 10:51:14 +0200	[thread overview]
Message-ID: <5C594E82.8040601@ti.com> (raw)
In-Reply-To: <5C585B33.4030505@ti.com>

+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" <afd@ti.com>
>>>
>>
>> [...]
>>
>>> +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 <afd@ti.com>");
>>> +MODULE_AUTHOR("Suman Anna <s-anna@ti.com>");
>>> +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

  reply	other threads:[~2019-02-05  8:52 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04 14:22 [PATCH v2 00/14] Add support for TI PRU ICSS Roger Quadros
2019-02-04 14:22 ` [PATCH v2 01/14] dt-bindings: remoteproc: Add TI PRUSS bindings Roger Quadros
2019-02-04 16:33   ` Tony Lindgren
2019-02-05  9:39     ` Roger Quadros
2019-02-05 15:08       ` Murali Karicheri
2019-02-05 15:41         ` Roger Quadros
2019-02-05 16:15           ` Murali Karicheri
2019-02-05 16:19             ` Tony Lindgren
2019-02-06 15:04               ` Roger Quadros
2019-02-14  2:47                 ` Suman Anna
2019-02-05 16:41       ` Tony Lindgren
2019-02-14  3:01         ` Suman Anna
2019-02-08 13:51   ` Linus Walleij
2019-02-14  3:12     ` Suman Anna
2019-02-14  8:37       ` Linus Walleij
2019-02-14 10:55         ` Roger Quadros
     [not found]           ` <86ef8asfap.wl-marc.zyngier@arm.com>
2019-02-14 15:44             ` Roger Quadros
2019-02-14 15:48               ` Roger Quadros
2019-02-15  0:59                 ` Suman Anna
2019-02-20  9:51                   ` Linus Walleij
2019-02-14 15:51               ` Marc Zyngier
2019-02-14 16:50                 ` Roger Quadros
2019-02-14  2:52   ` Suman Anna
2019-02-14 11:08     ` Roger Quadros
2019-02-14 15:56       ` Tony Lindgren
2019-02-15  1:22         ` Suman Anna
2019-02-15  1:08       ` Suman Anna
2019-02-15 13:43       ` Matthijs van Duin
2019-02-04 14:22 ` [PATCH v2 02/14] soc: ti: pruss: Add a platform driver for PRUSS in TI SoCs Roger Quadros
2019-02-04 14:52   ` Andrew F. Davis
2019-02-04 15:32     ` Roger Quadros
2019-02-04 16:35     ` Tony Lindgren
2019-02-04 14:22 ` [PATCH v2 03/14] dt-binding: irqchip: Add pruss-intc-irq driver for PRUSS interrupts Roger Quadros
2019-02-04 16:36   ` Tony Lindgren
2019-02-14  2:40   ` Suman Anna
2019-02-18 19:32   ` Rob Herring
2019-02-04 14:22 ` [PATCH v2 04/14] irqchip: pruss: Add a PRUSS irqchip " Roger Quadros
2019-02-04 15:11   ` Andrew F. Davis
2019-02-04 15:33     ` Roger Quadros
2019-02-05  8:51       ` Roger Quadros [this message]
2019-02-14  2:15         ` Suman Anna
2019-02-04 18:15   ` Tony Lindgren
2019-02-05 10:35     ` Roger Quadros
2019-02-05 11:04       ` Marc Zyngier
2019-02-14  2:16         ` Suman Anna
2019-02-04 14:22 ` [PATCH v2 05/14] remoteproc: add map parameter to da_to_va Roger Quadros
2019-02-04 14:22 ` [PATCH v2 06/14] remoteproc: add page lookup for TI PRU to ELF loader Roger Quadros
2019-02-04 15:19   ` Andrew F. Davis
2019-02-14  2:22     ` Suman Anna
2019-02-04 14:22 ` [PATCH v2 07/14] remoteproc: Add a rproc_set_firmware() API Roger Quadros
2019-02-04 14:22 ` [PATCH v2 08/14] remoteproc: Add support to handle device specific resource types Roger Quadros
2019-02-04 14:22 ` [PATCH v2 09/14] dt-binding: remoteproc: Add binding doc for PRU Cores in the PRU-ICSS Roger Quadros
2019-02-18 19:36   ` Rob Herring
2019-02-04 14:22 ` [PATCH v2 10/14] remoteproc/pru: Add PRU remoteproc driver Roger Quadros
2019-02-14  2:35   ` Suman Anna
2019-02-14  3:44     ` Suman Anna
2019-02-04 14:22 ` [PATCH v2 11/14] remoteproc/pru: Add pru_rproc_set_ctable() and pru_rproc_set_gpimode() Roger Quadros
2019-02-04 14:22 ` [PATCH v2 12/14] remoteproc/pru: Add support for virtio rpmsg stack Roger Quadros
2019-02-04 14:22 ` [PATCH v2 13/14] rpmsg: virtio_rpmsg_bus: move back rpmsg_hdr into a public header Roger Quadros
2019-02-04 14:22 ` [PATCH v2 14/14] rpmsg: pru: add a PRU RPMsg driver Roger Quadros
2019-02-04 15:26   ` Andrew F. Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5C594E82.8040601@ti.com \
    --to=rogerq@ti.com \
    --cc=afd@ti.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=david@lechnology.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jason@lakedaemon.net \
    --cc=jreeder@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=marc.zyngier@arm.com \
    --cc=nsaulnier@ti.com \
    --cc=nsekhar@ti.com \
    --cc=ohad@wizery.com \
    --cc=robh+dt@kernel.org \
    --cc=s-anna@ti.com \
    --cc=t-kristo@ti.com \
    --cc=tglx@linutronix.de \
    --cc=tony@atomide.com \
    --cc=woods.technical@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).