All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Marc Zyngier <marc.zyngier@arm.com>
Cc: Benoit Cousson <bcousson@baylibre.com>,
	Nishanth Menon <nm@ti.com>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Felipe Balbi <balbi@ti.com>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Jason Cooper <jason@lakedaemon.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org
Subject: Re: [PATCH] ARM: OMAP: Work around hardcoded interrupts
Date: Thu, 15 Jan 2015 08:20:23 -0800	[thread overview]
Message-ID: <20150115162022.GD18552@atomide.com> (raw)
In-Reply-To: <1421335212-4115-1-git-send-email-marc.zyngier@arm.com>

* Marc Zyngier <marc.zyngier@arm.com> [150115 07:24]:
> --- a/arch/arm/mach-omap2/omap4-common.c
> +++ b/arch/arm/mach-omap2/omap4-common.c
> @@ -256,6 +256,38 @@ static int __init omap4_sar_ram_init(void)
>  }
>  omap_early_initcall(omap4_sar_ram_init);
>  
> +static struct of_device_id gic_match[] = {
> +	{ .compatible = "arm,cortex-a9-gic", },
> +	{ .compatible = "arm,cortex-a15-gic", },
> +	{ },
> +};
> +
> +static struct device_node *gic_node;
> +
> +unsigned int omap4_xlate_irq(unsigned int hwirq)
> +{
> +	struct of_phandle_args irq_data;
> +	unsigned int irq;
> +
> +	if (!gic_node)
> +		gic_node = of_find_matching_node(NULL, gic_match);
> +
> +	if (WARN_ON(!gic_node))
> +		return hwirq;
> +
> +	irq_data.np = gic_node;
> +	irq_data.args_count = 3;
> +	irq_data.args[0] = 0;
> +	irq_data.args[1] = hwirq - OMAP44XX_IRQ_GIC_START;
> +	irq_data.args[2] = IRQ_TYPE_LEVEL_HIGH;
> +
> +	irq = irq_create_of_mapping(&irq_data);
> +	if (WARN_ON(!irq))
> +		irq = hwirq;
> +
> +	return irq;
> +}
> +
>  void __init omap_gic_of_init(void)
>  {
>  	struct device_node *np;

Thanks for the quick fix, this is is fine with me as long as we
don't have other legacy users. At least I did not find any other
legacy users based on a quick grep.

> --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
> @@ -288,6 +288,7 @@ static struct omap_hwmod omap54xx_dma_system_hwmod = {
>  	.class		= &omap54xx_dma_hwmod_class,
>  	.clkdm_name	= "dma_clkdm",
>  	.mpu_irqs	= omap54xx_dma_system_irqs,
> +	.xlate_irq	= omap4_xlate_irq,
>  	.main_clk	= "l3_iclk_div",
>  	.prcm = {
>  		.omap4 = {

We could now drop the legacy DMA init completely for omap4 and later.
But that would require patching the legacy DMA for the exported
functions.. So probably not doable for the -rc series and does not
solve the issue with other legacy IRQ users.

> --- a/arch/arm/mach-omap2/twl-common.c
> +++ b/arch/arm/mach-omap2/twl-common.c
> @@ -71,9 +71,12 @@ void __init omap4_pmic_init(const char *pmic_type,
>  		    struct i2c_board_info *devices, int nr_devices)
>  {
>  	/* PMIC part*/
> +	unsigned int irq;
> +
>  	omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
>  	omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
> -	omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
> +	irq = omap4_xlate_irq(7 + OMAP44XX_IRQ_GIC_START);
> +	omap_pmic_init(1, 400, pmic_type, irq, pmic_data);
>  
>  	/* Register additional devices on i2c1 bus if needed */
>  	if (devices)

FYI, I posted a patch yesterday to drop the legacy init code
for twl6040 as the legacy omap4_pmic_init() is no longer used.
No need to change this patch though.

So unless somebody has better ideas for the fix for -rc series,
I'll queue this with the twl6040 code removal patch.

Regards,

Tony

WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: OMAP: Work around hardcoded interrupts
Date: Thu, 15 Jan 2015 08:20:23 -0800	[thread overview]
Message-ID: <20150115162022.GD18552@atomide.com> (raw)
In-Reply-To: <1421335212-4115-1-git-send-email-marc.zyngier@arm.com>

* Marc Zyngier <marc.zyngier@arm.com> [150115 07:24]:
> --- a/arch/arm/mach-omap2/omap4-common.c
> +++ b/arch/arm/mach-omap2/omap4-common.c
> @@ -256,6 +256,38 @@ static int __init omap4_sar_ram_init(void)
>  }
>  omap_early_initcall(omap4_sar_ram_init);
>  
> +static struct of_device_id gic_match[] = {
> +	{ .compatible = "arm,cortex-a9-gic", },
> +	{ .compatible = "arm,cortex-a15-gic", },
> +	{ },
> +};
> +
> +static struct device_node *gic_node;
> +
> +unsigned int omap4_xlate_irq(unsigned int hwirq)
> +{
> +	struct of_phandle_args irq_data;
> +	unsigned int irq;
> +
> +	if (!gic_node)
> +		gic_node = of_find_matching_node(NULL, gic_match);
> +
> +	if (WARN_ON(!gic_node))
> +		return hwirq;
> +
> +	irq_data.np = gic_node;
> +	irq_data.args_count = 3;
> +	irq_data.args[0] = 0;
> +	irq_data.args[1] = hwirq - OMAP44XX_IRQ_GIC_START;
> +	irq_data.args[2] = IRQ_TYPE_LEVEL_HIGH;
> +
> +	irq = irq_create_of_mapping(&irq_data);
> +	if (WARN_ON(!irq))
> +		irq = hwirq;
> +
> +	return irq;
> +}
> +
>  void __init omap_gic_of_init(void)
>  {
>  	struct device_node *np;

Thanks for the quick fix, this is is fine with me as long as we
don't have other legacy users. At least I did not find any other
legacy users based on a quick grep.

> --- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
> @@ -288,6 +288,7 @@ static struct omap_hwmod omap54xx_dma_system_hwmod = {
>  	.class		= &omap54xx_dma_hwmod_class,
>  	.clkdm_name	= "dma_clkdm",
>  	.mpu_irqs	= omap54xx_dma_system_irqs,
> +	.xlate_irq	= omap4_xlate_irq,
>  	.main_clk	= "l3_iclk_div",
>  	.prcm = {
>  		.omap4 = {

We could now drop the legacy DMA init completely for omap4 and later.
But that would require patching the legacy DMA for the exported
functions.. So probably not doable for the -rc series and does not
solve the issue with other legacy IRQ users.

> --- a/arch/arm/mach-omap2/twl-common.c
> +++ b/arch/arm/mach-omap2/twl-common.c
> @@ -71,9 +71,12 @@ void __init omap4_pmic_init(const char *pmic_type,
>  		    struct i2c_board_info *devices, int nr_devices)
>  {
>  	/* PMIC part*/
> +	unsigned int irq;
> +
>  	omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
>  	omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
> -	omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
> +	irq = omap4_xlate_irq(7 + OMAP44XX_IRQ_GIC_START);
> +	omap_pmic_init(1, 400, pmic_type, irq, pmic_data);
>  
>  	/* Register additional devices on i2c1 bus if needed */
>  	if (devices)

FYI, I posted a patch yesterday to drop the legacy init code
for twl6040 as the legacy omap4_pmic_init() is no longer used.
No need to change this patch though.

So unless somebody has better ideas for the fix for -rc series,
I'll queue this with the twl6040 code removal patch.

Regards,

Tony

  reply	other threads:[~2015-01-15 16:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-15 15:20 [PATCH] ARM: OMAP: Work around hardcoded interrupts Marc Zyngier
2015-01-15 15:20 ` Marc Zyngier
2015-01-15 16:20 ` Tony Lindgren [this message]
2015-01-15 16:20   ` Tony Lindgren
2015-01-15 16:45 ` Nishanth Menon
2015-01-15 16:45   ` Nishanth Menon

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=20150115162022.GD18552@atomide.com \
    --to=tony@atomide.com \
    --cc=balbi@ti.com \
    --cc=bcousson@baylibre.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=marc.zyngier@arm.com \
    --cc=nm@ti.com \
    --cc=ssantosh@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=yingjoe.chen@mediatek.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.