Re: [PATCH 2/6] irqchip/irq-pruss-intc: Add a PRUSS irqchip driver for PRUSS interrupts
From: Suman Anna
Date: Wed Jul 17 2019 - 14:57:48 EST
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