mbox series

[0/6] Add TI PRUSS Local Interrupt Controller IRQChip driver

Message ID 20190708035243.12170-1-s-anna@ti.com
Headers show
Series Add TI PRUSS Local Interrupt Controller IRQChip driver | expand

Message

Suman Anna July 8, 2019, 3:52 a.m. UTC
Hi All,

The following series adds an IRQChip driver for the local interrupt controller
present within a Programmable Real-Time Unit and Industrial Communication
Subsystem (PRU-ICSS) present on a number of TI SoCs including OMAP architecture
based AM335x, AM437x, AM57xx SoCs, Keystone 2 architecture based 66AK2G SoCs,
Davinci architecture based OMAP-L138/DA850 SoCs and the latest K3 architecture
based AM65x and J721E SoCs. This series splits out the INTC portions into a
separate stand-alone series from the previous PRUSS support patch series [1]
as requested by various maintainers. Patches are on top of latest master.

The PRUSS local INTC is a unique interrupt controller designed to map a number
of SoC-level device or internal PRUSS interrupt sources into a smaller set of
output interrupt lines that are connected to various SoC-level processors like
the host ARM, PRU cores themselves and optionally to some DSPs, other PRUSS,
DMA controllers etc. The following are some of the features:
 - Capture of 64 (160 on K3) System Events/input interrupt sources
 - Multiplexing of these system events onto 10 (20 on K3) output interrupt
   channels in a many-to-one fashion
 - Multiplexing of the output interrupt channels onto 10 (20 on K3) host
   interrupts split between multiple processors. Typical integration connects
   the first 2 host interrupts to PRU cores, and the next 8 host interrupts
   to ARM cores.
 - Independent enable and disable of system events and their mapping onto
   a channel
 - Independent enable and disable of host events and the mapping to host
   events per interrupt channel. 
 - Inherent hardward prioritization of events and channels (lower number
   indicates higher priority).
 - Additional input interrupt sources multiplexing using either a SoC-level
   CFG MMR or PRUSS CFG MMR (support will be added through PRU rproc client
   bindings).

More details can be found in any of the supported SoC TRMs.
Eg: Chapter 30.1.6 of AM5728 TRM [2]

Changes from previous series include:
 - Update bindings to move away from SoC-specific compatibles
 - Use new DT properties to add support for shared and exclusive ARM GIC
   interrupt lines 
 - Include support for Davinci OMAP-L138 and K3 AM65x & J721E SoCs
 - Split up the driver patch into granular incremental support patches

regards
Suman

[1] https://patchwork.kernel.org/cover/10795721/
[2] http://www.ti.com/lit/pdf/spruhz6


Andrew F. Davis (2):
  irqchip/irq-pruss-intc: Add a PRUSS irqchip driver for PRUSS
    interrupts
  irqchip/irq-pruss-intc: Add API to trigger a PRU sysevent

Suman Anna (4):
  dt-bindings: irqchip: Add PRUSS interrupt controller bindings
  irqchip/irq-pruss-intc: Add support for shared and invalid interrupts
  irqchip/irq-pruss-intc: Add helper functions to configure internal
    mapping
  irqchip/irq-pruss-intc: Add support for ICSSG INTC on K3 SoCs

 .../interrupt-controller/ti,pruss-intc.txt    |  92 +++
 drivers/irqchip/Kconfig                       |  10 +
 drivers/irqchip/Makefile                      |   1 +
 drivers/irqchip/irq-pruss-intc.c              | 749 ++++++++++++++++++
 include/linux/irqchip/irq-pruss-intc.h        |  33 +
 include/linux/pruss_intc.h                    |  26 +
 6 files changed, 911 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/ti,pruss-intc.txt
 create mode 100644 drivers/irqchip/irq-pruss-intc.c
 create mode 100644 include/linux/irqchip/irq-pruss-intc.h
 create mode 100644 include/linux/pruss_intc.h

-- 
2.22.0

Comments

Suman Anna July 17, 2019, 6:56 p.m. UTC | #1
On 7/17/19 12:21 PM, David Lechner wrote:
> On 7/16/19 12:21 PM, Suman Anna wrote:

>>>> +static int pruss_intc_probe(struct platform_device *pdev)

>>>> +{

>>>> +    static const char * const irq_names[] = {

>>>> +                "host0", "host1", "host2", "host3",

>>>> +                "host4", "host5", "host6", "host7", };

>>>> +    struct device *dev = &pdev->dev;

>>>> +    struct pruss_intc *intc;

>>>> +    struct resource *res;

>>>> +    struct irq_chip *irqchip;

>>>> +    int i, irq;

>>>> +

>>>> +    intc = devm_kzalloc(dev, sizeof(*intc), GFP_KERNEL);

>>>> +    if (!intc)

>>>> +        return -ENOMEM;

>>>> +    platform_set_drvdata(pdev, intc);

>>>> +

>>>> +    res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

>>>> +    intc->base = devm_ioremap_resource(dev, res);

>>>> +    if (IS_ERR(intc->base)) {

>>>> +        dev_err(dev, "failed to parse and map intc memory

>>>> resource\n");

>>>> +        return PTR_ERR(intc->base);

>>>> +    }

>>>> +

>>>> +    dev_dbg(dev, "intc memory: pa %pa size 0x%zx va %pK\n",

>>>> &res->start,

>>>> +        (size_t)resource_size(res), intc->base);

>>>> +

>>>> +    mutex_init(&intc->lock);

>>>> +

>>>> +    pruss_intc_init(intc);

>>>> +

>>>> +    irqchip = devm_kzalloc(dev, sizeof(*irqchip), GFP_KERNEL);

>>>> +    if (!irqchip)

>>>> +        return -ENOMEM;

>>>> +

>>>> +    irqchip->irq_ack = pruss_intc_irq_ack;

>>>> +    irqchip->irq_mask = pruss_intc_irq_mask;

>>>> +    irqchip->irq_unmask = pruss_intc_irq_unmask;

>>>> +    irqchip->irq_retrigger = pruss_intc_irq_retrigger;

>>>> +    irqchip->irq_request_resources = pruss_intc_irq_reqres;

>>>> +    irqchip->irq_release_resources = pruss_intc_irq_relres;

>>>> +    irqchip->name = dev_name(dev);

>>>

>>> Should we also set `irqchip->parent_device = dev;` here?

>>>

>>> I tried it and had to add pm runtime stuff as well, otherwise

>>> requesting irqs would fail.

>>

>> I haven't seen any during my local testing. What sort of failure are you

>> seeing?

>>

>> The clocking for the overall PRUSS module will be handled in either the

>> ti-sysc driver for OMAP SoCs or in the pruss platform driver.

>>

> I was getting -EACCESS bubbling up from rpm_resume() in drivers/base/

> power/runtime.c. It was probably a mix of how I set up the device tree

> and the dummy PRUSS bus driver I made.

> 

> I'm sure it will be fine with a proper PRUSS platform driver.


Yeah, ok. You just need to have the power-domains property added in the
pruss node, and the pm_runtime calls in the pruss platform driver which
are missing in Roger's series.

I have the following line on my da850 pruss node.
power-domains = <&psc0 13>;

regards
Suman