irqchip: Renesas INTC External IRQ pin v2 update
Subsystems (2)
cover irqchip: Renesas INTC External IRQ pin v2 update
irqchip: Renesas INTC External IRQ pin v2 update
[PATCH 01/05] irqchip: intc-irqpin: Whitespace fixes [PATCH 02/05] irqchip: intc-irqpin: Cache mapped IRQ [PATCH 03/05] irqchip: intc-irqpin: Add force comments [PATCH 04/05] irqchip: intc-irqpin: Make use of devm functions [PATCH 05/05] irqchip: intc-irqpin: GPL header for platform data
These patches update the v1 of the INTC External IRQ pin driver in various ways based on feedback kindly received from:
- Simon Horman
- Kuninori Morimoto
- Thomas Gleixner
With the series applied I see the driver as "v2", but I prefer to keep these changes as incremental ones instead of redoing a single "v2" patch for the driver. The reason behind this is that there are on-going back porting efforts that are better dealt with using incremental patches.
---
Depends on:
[PATCH] irqchip: Renesas INTC External IRQ pin driver
drivers/irqchip/irq-renesas-intc-irqpin.c | 88 ++++++++--------- include/linux/platform_data/irq-renesas-intc-irqpin.h | 19 +++ 2 files changed, 62 insertions(+), 45 deletions(-)
PATCH 1/5 irqchip: intc-irqpin: Whitespace fixes
From: Magnus Damm <[email protected]>
Remove whitespace damage and add newline
between variables and code.
---
Thanks to Simon Horman and Thomas Gleixner for feedback.
drivers/irqchip/irq-renesas-intc-irqpin.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/irqchip/irq-renesas-intc-irqpin.c +5 -3
@@ -57,13 +57,13 @@ struct intc_irqpin_iomem {unsigned long (*read)(void __iomem *iomem);void (*write)(void __iomem *iomem,unsigned long data);int width; -}; +};struct intc_irqpin_irq {int hw_irq;int irq;struct intc_irqpin_priv *p; -}; +};struct intc_irqpin_priv {struct intc_irqpin_iomem iomem[INTC_IRQPIN_REG_NR ];
@@ -99,6 +99,7 @@ static inline unsigned long intc_irqpin_ int reg) {struct intc_irqpin_iomem *i = &p->iomem[reg]; +return i->read (i->iomem); }
@@ -106,6 +107,7 @@ static inline void intc_irqpin_write(str int reg, unsigned long data) {struct intc_irqpin_iomem *i = &p->iomem[reg]; + i->write (i->iomem, data); }
@@ -405,7 +407,7 @@ static int intc_irqpin_probe(struct platdev_warn (&pdev->dev,"irq base mismatch (%d/%d)\n" , p->config.irq_base, k); } - +return 0 ; err3:
PATCH 2/5 irqchip: intc-irqpin: Cache mapped IRQ
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Cache IRQ in domain_irq variable instead of
making use of irq_find_mapping(). While at it
rename the irq variable to requested_irq.
---
Thanks to Thomas Gleixner for this suggestion.
drivers/irqchip/irq-renesas-intc-irqpin.c | 30 +++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/irqchip/irq-renesas-intc-irqpin.c +16 -14
@@ -61,7 +61,8 @@ struct intc_irqpin_iomem {struct intc_irqpin_irq {int hw_irq; -int irq; +int requested_irq; +int domain_irq;struct intc_irqpin_priv *p; };
@@ -171,8 +172,7 @@ static int intc_irqpin_set_sense(structstatic void intc_irqpin_dbg (struct intc_irqpin_irq *i,char *str) {dev_dbg (&i->p->pdev->dev,"%s (%d:%d:%d)\n" , - str, i->irq, i->hw_irq, -irq_find_mapping (i->p->irq_domain, i->hw_irq)); + str, i->requested_irq, i->hw_irq, i->domain_irq); }static void intc_irqpin_irq_enable (struct irq_data *d)
@@ -196,7 +196,7 @@ static void intc_irqpin_irq_disable(strustatic void intc_irqpin_irq_enable_force (struct irq_data *d) {struct intc_irqpin_priv *p =irq_data_get_irq_chip_data (d); -int irq = p->irq[irqd_to_hwirq (d)].irq; +int irq = p->irq[irqd_to_hwirq (d)].requested_irq;intc_irqpin_irq_enable (d);irq_get_chip (irq)->irq_unmask (irq_get_irq_data (irq));
@@ -205,7 +205,7 @@ static void intc_irqpin_irq_enable_forcestatic void intc_irqpin_irq_disable_force (struct irq_data *d) {struct intc_irqpin_priv *p =irq_data_get_irq_chip_data (d); -int irq = p->irq[irqd_to_hwirq (d)].irq; +int irq = p->irq[irqd_to_hwirq (d)].requested_irq;irq_get_chip (irq)->irq_mask (irq_get_irq_data (irq));intc_irqpin_irq_disable (d);
@@ -246,7 +246,7 @@ static irqreturn_t intc_irqpin_irq_handlif (intc_irqpin_read (p,INTC_IRQPIN_REG_SOURCE ) & bit) {intc_irqpin_write (p,INTC_IRQPIN_REG_SOURCE , ~bit);intc_irqpin_dbg (i,"demux2" ); -generic_handle_irq (irq_find_mapping (p->irq_domain, i->hw_irq)); +generic_handle_irq (i->domain_irq);return IRQ_HANDLED ; }return IRQ_NONE ;
@@ -257,6 +257,9 @@ static int intc_irqpin_irq_domain_map(st {struct intc_irqpin_priv *p = h->host_data; + p->irq[hw].domain_irq = virq; + p->irq[hw].hw_irq = hw; +intc_irqpin_dbg (&p->irq[hw],"map" );irq_set_chip_data (virq, h->host_data);irq_set_chip_and_handler (virq, &p->irq_chip, handle_level_irq);
@@ -314,9 +317,8 @@ static int intc_irqpin_probe(struct platif (!irq)break ; - p->irq[k].hw_irq = k; p->irq[k].p = p; - p->irq[k].irq = irq->start; + p->irq[k].requested_irq = irq->start; } p->number_of_irqs = k;
@@ -389,7 +391,8 @@ static int intc_irqpin_probe(struct plat/* request and set priority on interrupts one by one */ for (k =0 ; k < p->number_of_irqs; k++) { -if (request_irq (p->irq[k].irq, intc_irqpin_irq_handler, +if (request_irq (p->irq[k].requested_irq, + intc_irqpin_irq_handler,0 , name, &p->irq[k])) {dev_err (&pdev->dev,"failed to request low IRQ\n" ); ret = -ENOENT ;
@@ -402,17 +405,16 @@ static int intc_irqpin_probe(struct plat/* warn in case of mismatch if irq base is specified */ if (p->config.irq_base) { - k =irq_find_mapping (p->irq_domain,0 ); -if (p->config.irq_base != k) +if (p->config.irq_base != p->irq[0 ].domain_irq)dev_warn (&pdev->dev,"irq base mismatch (%d/%d)\n" , - p->config.irq_base, k); + p->config.irq_base, p->irq[0 ].domain_irq); }return 0 ; err3:for (; k >=0 ; k--) -free_irq (p->irq[k -1 ].irq, &p->irq[k -1 ]); +free_irq (p->irq[k -1 ].requested_irq, &p->irq[k -1 ]);irq_domain_remove (p->irq_domain); err2:
@@ -430,7 +432,7 @@ static int intc_irqpin_remove(struct plaint k;for (k =0 ; k < p->number_of_irqs; k++) -free_irq (p->irq[k].irq, &p->irq[k]); +free_irq (p->irq[k].requested_irq, &p->irq[k]);irq_domain_remove (p->irq_domain);
PATCH 3/5 irqchip: intc-irqpin: Add force comments
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Add comments to describe the special case for
"force" versions of enable and disable functions.
---
Thanks to Thomas Gleixner for this suggestion.
drivers/irqchip/irq-renesas-intc-irqpin.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/irqchip/irq-renesas-intc-irqpin.c +9 -0
@@ -199,6 +199,11 @@ static void intc_irqpin_irq_enable_forceint irq = p->irq[irqd_to_hwirq (d)].requested_irq;intc_irqpin_irq_enable (d); + +/* enable interrupt through parent interrupt controller, +* assumes non-shared interrupt with 1:1 mapping +* needed for busted IRQs on some SoCs like sh73a0 +*/ irq_get_chip (irq)->irq_unmask (irq_get_irq_data (irq)); }
@@ -207,6 +212,10 @@ static void intc_irqpin_irq_disable_forcstruct intc_irqpin_priv *p =irq_data_get_irq_chip_data (d);int irq = p->irq[irqd_to_hwirq (d)].requested_irq; +/* disable interrupt through parent interrupt controller, +* assumes non-shared interrupt with 1:1 mapping +* needed for busted IRQs on some SoCs like sh73a0 +*/ irq_get_chip (irq)->irq_mask (irq_get_irq_data (irq));intc_irqpin_irq_disable (d); }
PATCH 4/5 irqchip: intc-irqpin: Make use of devm functions
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Use devm_kzalloc(), devm_ioremap_nocache()
and devm_request_irq() to simplify error
handling.
---
Thanks to Kuninori Morimoto for this suggestion.
drivers/irqchip/irq-renesas-intc-irqpin.c | 41 +++++++++-------------------- 1 file changed, 13 insertions(+), 28 deletions(-)
drivers/irqchip/irq-renesas-intc-irqpin.c +13 -28
@@ -294,7 +294,7 @@ static int intc_irqpin_probe(struct platint ret;int k; - p =kzalloc (sizeof (*p),GFP_KERNEL ); + p =devm_kzalloc (&pdev->dev,sizeof (*p),GFP_KERNEL );if (!p) {dev_err (&pdev->dev,"failed to allocate driver data\n" ); ret = -ENOMEM ;
@@ -316,7 +316,7 @@ static int intc_irqpin_probe(struct platif (!io[k]) {dev_err (&pdev->dev,"not enough IOMEM resources\n" ); ret = -EINVAL ; - goto err1; + goto err0; } }
@@ -334,7 +334,7 @@ static int intc_irqpin_probe(struct platif (p->number_of_irqs <1 ) {dev_err (&pdev->dev,"not enough IRQ resources\n" ); ret = -EINVAL ; - goto err1; + goto err0; }/* ioremap IOMEM and setup read/write callbacks */
@@ -355,14 +355,15 @@ static int intc_irqpin_probe(struct platdefault :dev_err (&pdev->dev,"IOMEM size mismatch\n" ); ret = -EINVAL ; - goto err2; + goto err0; } - i->iomem =ioremap_nocache (io[k]->start,resource_size (io[k])); + i->iomem =devm_ioremap_nocache (&pdev->dev, io[k]->start, +resource_size (io[k]));if (!i->iomem) {dev_err (&pdev->dev,"failed to remap IOMEM\n" ); ret = -ENXIO ; - goto err2; + goto err0; } }
@@ -395,17 +396,17 @@ static int intc_irqpin_probe(struct platif (!p->irq_domain) { ret = -ENXIO ;dev_err (&pdev->dev,"cannot initialize irq domain\n" ); - goto err2; + goto err0; }/* request and set priority on interrupts one by one */ for (k =0 ; k < p->number_of_irqs; k++) { -if (request_irq (p->irq[k].requested_irq, - intc_irqpin_irq_handler, -0 , name, &p->irq[k])) { +if (devm_request_irq (&pdev->dev, p->irq[k].requested_irq, + intc_irqpin_irq_handler, +0 , name, &p->irq[k])) {dev_err (&pdev->dev,"failed to request low IRQ\n" ); ret = -ENOENT ; - goto err3; + goto err1; }intc_irqpin_mask_unmask_prio (p, k,0 ); }
@@ -421,16 +422,8 @@ static int intc_irqpin_probe(struct platreturn 0 ; -err3: -for (; k >=0 ; k--) -free_irq (p->irq[k -1 ].requested_irq, &p->irq[k -1 ]); - -irq_domain_remove (p->irq_domain); -err2: -for (k =0 ; k <INTC_IRQPIN_REG_NR ; k++) -iounmap (p->iomem[k].iomem); err1: -kfree (p); +irq_domain_remove (p->irq_domain); err0:return ret; }
@@ -438,17 +431,9 @@ err0:static int intc_irqpin_remove (struct platform_device *pdev) {struct intc_irqpin_priv *p =platform_get_drvdata (pdev); -int k; - -for (k =0 ; k < p->number_of_irqs; k++) -free_irq (p->irq[k].requested_irq, &p->irq[k]);irq_domain_remove (p->irq_domain); -for (k =0 ; k <INTC_IRQPIN_REG_NR ; k++) -iounmap (p->iomem[k].iomem); - -kfree (p);return 0 ; }
PATCH 5/5 irqchip: intc-irqpin: GPL header for platform data
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Add GPL header to platform data include file.
---
Thanks to Kuninori Morimoto for this suggestion.
include/linux/platform_data/irq-renesas-intc-irqpin.h | 19 +++++++++++++++++ 1 file changed, 19 insertions(+)
include/linux/platform_data/irq-renesas-intc-irqpin.h +19 -0
@@ -1,3 +1,22 @@ +/* +* Renesas INTC External IRQ Pin Driver +* +* Copyright (C) 2013 Magnus Damm +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ +#ifndef __IRQ_RENESAS_INTC_IRQPIN_H__#define __IRQ_RENESAS_INTC_IRQPIN_H__
Quoted 14 lines · Magnus Damm
irqchip: Renesas INTC External IRQ pin v2 update
[PATCH 01/05] irqchip: intc-irqpin: Whitespace fixes [PATCH 02/05] irqchip: intc-irqpin: Cache mapped IRQ [PATCH 03/05] irqchip: intc-irqpin: Add force comments [PATCH 04/05] irqchip: intc-irqpin: Make use of devm functions [PATCH 05/05] irqchip: intc-irqpin: GPL header for platform data
These patches update the v1 of the INTC External IRQ pin driver in various ways based on feedback kindly received from:
- Simon Horman
- Kuninori Morimoto
- Thomas Gleixner
Quoted 5 lines
With the series applied I see the driver as "v2", but I prefer to keep these changes as incremental ones instead of redoing a single "v2" patch for the driver. The reason behind this is that there are on-going back porting efforts that are better dealt with using incremental patches.
I have added these to the topic/intc-external-irq branch of the renesas tree, although at this stage I anticipate that the code will be merged through a different tree.
Quoted 14 lines · Magnus Damm
irqchip: Renesas INTC External IRQ pin v2 update
[PATCH 01/05] irqchip: intc-irqpin: Whitespace fixes [PATCH 02/05] irqchip: intc-irqpin: Cache mapped IRQ [PATCH 03/05] irqchip: intc-irqpin: Add force comments [PATCH 04/05] irqchip: intc-irqpin: Make use of devm functions [PATCH 05/05] irqchip: intc-irqpin: GPL header for platform data
These patches update the v1 of the INTC External IRQ pin driver in various ways based on feedback kindly received from:
- Simon Horman
- Kuninori Morimoto
- Thomas Gleixner
Quoted 7 lines
With the series applied I see the driver as "v2", but I prefer to keep these changes as incremental ones instead of redoing a single "v2" patch for the driver. The reason behind this is that there are on-going back porting efforts that are better dealt with using incremental patches.
Signed-off-by Magnus Damm <[email protected]>
For the full series:
Quoted 9 lines
---
Depends on:
[PATCH] irqchip: Renesas INTC External IRQ pin driverdrivers/irqchip/irq-renesas-intc-irqpin.c | 88 ++++++++--------- include/linux/platform_data/irq-renesas-intc-irqpin.h | 19 +++ 2 files changed, 62 insertions(+), 45 deletions(-)
Quoted 14 lines · Magnus Damm
irqchip: Renesas INTC External IRQ pin v2 update
[PATCH 01/05] irqchip: intc-irqpin: Whitespace fixes [PATCH 02/05] irqchip: intc-irqpin: Cache mapped IRQ [PATCH 03/05] irqchip: intc-irqpin: Add force comments [PATCH 04/05] irqchip: intc-irqpin: Make use of devm functions [PATCH 05/05] irqchip: intc-irqpin: GPL header for platform data
These patches update the v1 of the INTC External IRQ pin driver in various ways based on feedback kindly received from:
- Simon Horman
- Kuninori Morimoto
- Thomas Gleixner
Quoted 5 lines
With the series applied I see the driver as "v2", but I prefer to keep these changes as incremental ones instead of redoing a single "v2" patch for the driver. The reason behind this is that there are on-going back porting efforts that are better dealt with using incremental patches.
Hi Magnus, Hi all,
I do not expect this code to go through the renesas tree. However, in order to provide a basis for work on renesas SoCs I have added this series to the topic/intc-external-irq topic branch in the reneas tree on kernel.org and merged it into topic/all+next.
In other words, I am not picking this series up to merge it or add it to linux-next, rather I am storing it for reference.
Quoted 14 lines · Magnus Damm
irqchip: Renesas INTC External IRQ pin v2 update
[PATCH 01/05] irqchip: intc-irqpin: Whitespace fixes [PATCH 02/05] irqchip: intc-irqpin: Cache mapped IRQ [PATCH 03/05] irqchip: intc-irqpin: Add force comments [PATCH 04/05] irqchip: intc-irqpin: Make use of devm functions [PATCH 05/05] irqchip: intc-irqpin: GPL header for platform data
These patches update the v1 of the INTC External IRQ pin driver in various ways based on feedback kindly received from:
- Simon Horman
- Kuninori Morimoto
- Thomas Gleixner
Quoted 7 lines
With the series applied I see the driver as "v2", but I prefer to keep these changes as incremental ones instead of redoing a single "v2" patch for the driver. The reason behind this is that there are on-going back porting efforts that are better dealt with using incremental patches.
Signed-off-by Magnus Damm <[email protected]>
tested on kzm9g in topic/all+next branch of
https://git.kernel.org/cgit/linux/kernel/git/horms/renesas.git/
Thanks
Guennadi
Quoted 5 lines
---
Depends on:
[PATCH] irqchip: Renesas INTC External IRQ pin driver
Quoted 8 lines
drivers/irqchip/irq-renesas-intc-irqpin.c | 88 ++++++++--------- include/linux/platform_data/irq-renesas-intc-irqpin.h | 19 +++ 2 files changed, 62 insertions(+), 45 deletions(-)--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/