Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1246908

Re: [PATCH v2 05/17] irqchip: Convert all alloc/xlate users from of_node to fwnode

From Tomasz Nowicki <tomasz.nowicki@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 05/17] irqchip: Convert all alloc/xlate users from of_node to fwnode
Date 2015-10-14 17:40 +0200
Message-ID <qjwjM-2JS-29@gated-at.bofh.it> (permalink)
References <qj6pj-5Fz-3@gated-at.bofh.it> <qj6pl-5Fz-39@gated-at.bofh.it> <qjwa6-2yi-7@gated-at.bofh.it> <qjwjM-2JS-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 14.10.2015 17:31, Marc Zyngier wrote:
> On 14/10/15 16:26, Tomasz Nowicki wrote:
>> Hi Marc,
>>
>> On 13.10.2015 13:51, Marc Zyngier wrote:
>>> Since we now have a generic data structure to express an
>>> interrupt specifier, convert all hierarchical irqchips that
>>> are OF based to use a fwnode_handle as part of their alloc
>>> and xlate (which becomes translate) callbacks.
>>>
>>> As most of these drivers have dependencies (they exchange IRQ
>>> specifiers), change them all in a single, massive patch...
>>>
>>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>>> ---
>>>    arch/arm/mach-exynos/suspend.c       | 55 ++++++++++++++++---------------
>>>    arch/arm/mach-imx/gpc.c              | 55 ++++++++++++++++---------------
>>>    arch/arm/mach-omap2/omap-wakeupgen.c | 55 ++++++++++++++++---------------
>>>    drivers/irqchip/irq-crossbar.c       | 62 ++++++++++++++++++----------------
>>>    drivers/irqchip/irq-gic-v2m.c        | 18 ++++++----
>>>    drivers/irqchip/irq-gic-v3-its.c     | 20 ++++++-----
>>>    drivers/irqchip/irq-gic-v3.c         | 49 +++++++++++++--------------
>>>    drivers/irqchip/irq-gic.c            | 33 ++++++++++++++++---
>>>    drivers/irqchip/irq-imx-gpcv2.c      | 64 ++++++++++++++++--------------------
>>>    drivers/irqchip/irq-mtk-sysirq.c     | 49 ++++++++++++++-------------
>>>    drivers/irqchip/irq-nvic.c           | 18 +++++++---
>>>    drivers/irqchip/irq-tegra.c          | 55 ++++++++++++++++---------------
>>>    drivers/irqchip/irq-vf610-mscm-ir.c  | 42 +++++++++++++++--------
>>>    13 files changed, 323 insertions(+), 252 deletions(-)
>>>
>>
>> [...]
>>
>>>
>>>    static int its_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
>>> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
>>> index 5793880..05d010b 100644
>>> --- a/drivers/irqchip/irq-gic-v3.c
>>> +++ b/drivers/irqchip/irq-gic-v3.c
>>> @@ -737,32 +737,30 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>>>    	return 0;
>>>    }
>>>
>>> -static int gic_irq_domain_xlate(struct irq_domain *d,
>>> -				struct device_node *controller,
>>> -				const u32 *intspec, unsigned int intsize,
>>> -				unsigned long *out_hwirq, unsigned int *out_type)
>>> +static int gic_irq_domain_translate(struct irq_domain *d,
>>> +				    struct irq_fwspec *fwspec,
>>> +				    unsigned long *hwirq,
>>> +				    unsigned int *type)
>>>    {
>>> -	if (irq_domain_get_of_node(d) != controller)
>>> -		return -EINVAL;
>>> -	if (intsize < 3)
>>> -		return -EINVAL;
>>> +	if (is_of_node(fwspec->fwnode)) {
>>> +		if (fwspec->param_count < 3)
>>> +			return -EINVAL;
>>>
>>> -	switch(intspec[0]) {
>>> -	case 0:			/* SPI */
>>> -		*out_hwirq = intspec[1] + 32;
>>> -		break;
>>> -	case 1:			/* PPI */
>>> -		*out_hwirq = intspec[1] + 16;
>>> -		break;
>>> -	case GIC_IRQ_TYPE_LPI:	/* LPI */
>>> -		*out_hwirq = intspec[1];
>>> -		break;
>>> -	default:
>>> -		return -EINVAL;
>>> +		/* Get the interrupt number and add 16 to skip over SGIs */
>>> +		*hwirq = fwspec->param[1] + 16;
>>> +
>>> +		/*
>>> +		 * For SPIs, we need to add 16 more to get the GIC irq
>>> +		 * ID number
>>> +		 */
>>> +		if (!fwspec->param[0])
>>> +			*hwirq += 16;
>>> +
>>> +		*type = fwspec->param[2] & IRQ_TYPE_SENSE_MASK;
>>> +		return 0;
>>>    	}
>>>
>>> -	*out_type = intspec[2] & IRQ_TYPE_SENSE_MASK;
>>> -	return 0;
>>> +	return -EINVAL;
>>>    }
>>
>> What about GIC_IRQ_TYPE_LPI type? Previously we leaved interrupt line nr
>> and now +32.
>
> Please see the patch I've posted earlier that address this particular issue:
>
> https://lkml.org/lkml/2015/10/14/272
>

Makes sense, thanks.

Tomasz
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 05/17] irqchip: Convert all alloc/xlate users from of_node to fwnode Marc Zyngier <marc.zyngier@arm.com> - 2015-10-13 14:00 +0200
  [tip:irq/core] irqchip: Convert all alloc/  xlate users from of_node to fwnode tip-bot for Marc Zyngier <tipbot@zytor.com> - 2015-10-13 20:00 +0200
  Re: [PATCH v2 05/17] irqchip: Convert all alloc/xlate users from  of_node to fwnode Tomasz Nowicki <tomasz.nowicki@linaro.org> - 2015-10-14 17:30 +0200
    Re: [PATCH v2 05/17] irqchip: Convert all alloc/xlate users from  of_node to fwnode Tomasz Nowicki <tomasz.nowicki@linaro.org> - 2015-10-14 17:40 +0200
    Re: [PATCH v2 05/17] irqchip: Convert all alloc/xlate users from  of_node to fwnode Marc Zyngier <marc.zyngier@arm.com> - 2015-10-14 17:40 +0200

csiph-web