* [PATCH 00/14] irqchip: crossbar: driver fixes
@ 2014-06-03 7:29 Sricharan R
0 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:29 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
This series does some cleanup and provides support for
hardwired IRQ and crossbar definitions.
On certain platforms such as DRA7, SPIs 0, 1, 2, 3, 5, 6, 10,
131, 132, 133 are direct wired to hardware blocks bypassing
crossbar. This quirky implementation is *NOT* supposed to be the
expectation of crossbar hardware usage. This series adds support
to represent such hard-wired irqs through DT and avoid generic
allocation/programming of crossbar in the driver.
This way of supporting hard-wired irqs was a result of
the below discussions.
http://www.spinics.net/lists/arm-kernel/msg329946.html
Based on linux-next next-20140602 tag + Tony's omap-for-v3.16/crossbar branch.
Nishanth Menon (11):
irqchip: crossbar: remove IS_ERR_VALUE check
irqchip: crossbar: fix sparse warnings
irqchip: crossbar: fix checkpatch warning
irqchip: crossbar: fix kerneldoc warning
irqchip: crossbar: fix memory leak incase of invalid entry
irqchip: crossbar: return proper error value
irqchip: crossbar: change the goto naming
irqchip: crossbar: introduce ti,max-crossbar-sources to identify
valid crossbar mapping
irqchip: crossbar: introduce centralized check for crossbar write
Documentation: dt: OMAP: crossbar: add description for interrupt
consumer
irqchip: crossbar allow for quirky hardware with direct hardwiring of
GIC
Rajendra Nayak (1):
irqchip: crossbar: DRA7: Fix unused crossbar list
Sricharan R (2):
irqchip: crossbar: set cb pointer to null in case of error
irqchip: crossbar: Add kerneldoc for crossbar_domain_unmap callback
.../devicetree/bindings/arm/omap/crossbar.txt | 27 +++++
drivers/irqchip/irq-crossbar.c | 127 +++++++++++++++-----
2 files changed, 125 insertions(+), 29 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 00/14] irqchip: crossbar: driver fixes
@ 2014-06-03 7:42 Sricharan R
2014-06-03 7:42 ` [PATCH 01/14] irqchip: crossbar: remove IS_ERR_VALUE check Sricharan R
` (14 more replies)
0 siblings, 15 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:42 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
This series does some cleanup and provides support for
hardwired IRQ and crossbar definitions.
On certain platforms such as DRA7, SPIs 0, 1, 2, 3, 5, 6, 10,
131, 132, 133 are direct wired to hardware blocks bypassing
crossbar. This quirky implementation is *NOT* supposed to be the
expectation of crossbar hardware usage. This series adds support
to represent such hard-wired irqs through DT and avoid generic
allocation/programming of crossbar in the driver.
This way of supporting hard-wired irqs was a result of
the below discussions.
http://www.spinics.net/lists/arm-kernel/msg329946.html
Based on linux-next next-20140602 tag + Tony's omap-for-v3.16/crossbar branch.
The patches are available here
git@github.com:Sricharanti/sricharan.git crossbar_updates
Nishanth Menon (11):
irqchip: crossbar: remove IS_ERR_VALUE check
irqchip: crossbar: fix sparse warnings
irqchip: crossbar: fix checkpatch warning
irqchip: crossbar: fix kerneldoc warning
irqchip: crossbar: fix memory leak incase of invalid entry
irqchip: crossbar: return proper error value
irqchip: crossbar: change the goto naming
irqchip: crossbar: introduce ti,max-crossbar-sources to identify
valid crossbar mapping
irqchip: crossbar: introduce centralized check for crossbar write
Documentation: dt: OMAP: crossbar: add description for interrupt
consumer
irqchip: crossbar allow for quirky hardware with direct hardwiring of
GIC
Rajendra Nayak (1):
irqchip: crossbar: DRA7: Fix unused crossbar list
Sricharan R (2):
irqchip: crossbar: set cb pointer to null in case of error
irqchip: crossbar: Add kerneldoc for crossbar_domain_unmap callback
.../devicetree/bindings/arm/omap/crossbar.txt | 27 +++++
drivers/irqchip/irq-crossbar.c | 127 +++++++++++++++-----
2 files changed, 125 insertions(+), 29 deletions(-)
--
1.7.9.5
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 01/14] irqchip: crossbar: remove IS_ERR_VALUE check
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
@ 2014-06-03 7:42 ` Sricharan R
2014-06-03 7:42 ` [PATCH 02/14] irqchip: crossbar: fix sparse warnings Sricharan R
` (13 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:42 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
IS_ERR_VALUE makes sense only *if* there could be valid values in
negative error range. But in the cases that we do use it, there is no
such case. Just remove the same.
Signed-off-by: Nishanth Menon <nm@ti.com>
---
drivers/irqchip/irq-crossbar.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index de021638..c5415ae 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -110,15 +110,15 @@ static int crossbar_domain_xlate(struct irq_domain *d,
unsigned long *out_hwirq,
unsigned int *out_type)
{
- unsigned long ret;
+ int ret;
ret = get_prev_map_irq(intspec[1]);
- if (!IS_ERR_VALUE(ret))
+ if (ret >= 0)
goto found;
ret = allocate_free_irq(intspec[1]);
- if (IS_ERR_VALUE(ret))
+ if (ret < 0)
return ret;
found:
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/14] irqchip: crossbar: fix sparse warnings
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
2014-06-03 7:42 ` [PATCH 01/14] irqchip: crossbar: remove IS_ERR_VALUE check Sricharan R
@ 2014-06-03 7:42 ` Sricharan R
2014-06-03 7:42 ` [PATCH 03/14] irqchip: crossbar: fix checkpatch warning Sricharan R
` (12 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:42 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
There is absolutely no need for crossbar driver to expose functions and
variables into global namespace. So make them all static
Fixes sparse warnings:
drivers/irqchip/irq-crossbar.c:129:29: warning: symbol 'routable_irq_domain_ops' was not declared. Should it be static?
drivers/irqchip/irq-crossbar.c:252:5: warning: symbol 'dra_irqs_unused' was not declared. Should it be static?
drivers/irqchip/irq-crossbar.c:253:22: warning: symbol 'cb_dra_data' was not declared. Should it be static?
drivers/irqchip/irq-crossbar.c:261:12: warning: symbol 'irqcrossbar_init' was not declared. Should it be static?
Signed-off-by: Nishanth Menon <nm@ti.com>
---
drivers/irqchip/irq-crossbar.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index c5415ae..5da9d36 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -16,6 +16,7 @@
#include <linux/of_device.h>
#include <linux/slab.h>
#include <linux/irqchip/arm-gic.h>
+#include <linux/irqchip/irq-crossbar.h>
#define IRQ_FREE -1
#define IRQ_RESERVED -2
@@ -126,7 +127,7 @@ found:
return 0;
}
-const struct irq_domain_ops routable_irq_domain_ops = {
+static const struct irq_domain_ops routable_irq_domain_ops = {
.map = crossbar_domain_map,
.unmap = crossbar_domain_unmap,
.xlate = crossbar_domain_xlate
@@ -249,8 +250,8 @@ err1:
}
/* irq number 10 cannot be used because of hw bug */
-int dra_irqs_unused[] = { 10 };
-struct crossbar_data cb_dra_data = { dra_irqs_unused,
+static int dra_irqs_unused[] = { 10 };
+static struct crossbar_data cb_dra_data = { dra_irqs_unused,
ARRAY_SIZE(dra_irqs_unused), 0 };
static const struct of_device_id crossbar_match[] __initconst = {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/14] irqchip: crossbar: fix checkpatch warning
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
2014-06-03 7:42 ` [PATCH 01/14] irqchip: crossbar: remove IS_ERR_VALUE check Sricharan R
2014-06-03 7:42 ` [PATCH 02/14] irqchip: crossbar: fix sparse warnings Sricharan R
@ 2014-06-03 7:42 ` Sricharan R
2014-06-03 7:42 ` [PATCH 04/14] irqchip: crossbar: fix kerneldoc warning Sricharan R
` (11 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:42 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
remove un-necessary space in function pointer.
Fixes checkpatch warning:
WARNING: Unnecessary space before function pointer arguments
#37: FILE: drivers/irqchip/irq-crossbar.c:37:
+ void (*write) (int, int);
WARNING: Missing a blank line after declarations
+ int *register_offsets;
+ void (*write)(int, int);
WARNING: Prefer kcalloc over kzalloc with multiply
+ cb->irq_map = kzalloc(max * sizeof(int), GFP_KERNEL);
WARNING: Prefer kcalloc over kzalloc with multiply
+ cb->register_offsets = kzalloc(max * sizeof(int), GFP_KERNEL);
Signed-off-by: Nishanth Menon <nm@ti.com>
---
drivers/irqchip/irq-crossbar.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index 5da9d36..58790d4 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -34,7 +34,8 @@ struct crossbar_device {
uint *irq_map;
void __iomem *crossbar_base;
int *register_offsets;
- void (*write) (int, int);
+
+ void (*write)(int, int);
};
/**
@@ -150,7 +151,7 @@ static int __init crossbar_of_init(struct device_node *node,
goto err1;
of_property_read_u32(node, "ti,max-irqs", &max);
- cb->irq_map = kzalloc(max * sizeof(int), GFP_KERNEL);
+ cb->irq_map = kcalloc(max, sizeof(int), GFP_KERNEL);
if (!cb->irq_map)
goto err2;
@@ -176,7 +177,7 @@ static int __init crossbar_of_init(struct device_node *node,
}
}
- cb->register_offsets = kzalloc(max * sizeof(int), GFP_KERNEL);
+ cb->register_offsets = kcalloc(max, sizeof(int), GFP_KERNEL);
if (!cb->register_offsets)
goto err3;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/14] irqchip: crossbar: fix kerneldoc warning
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (2 preceding siblings ...)
2014-06-03 7:42 ` [PATCH 03/14] irqchip: crossbar: fix checkpatch warning Sricharan R
@ 2014-06-03 7:42 ` Sricharan R
2014-06-03 7:42 ` [PATCH 05/14] irqchip: crossbar: DRA7: Fix unused crossbar list Sricharan R
` (10 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:42 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
kernel doc style is wrong in code. fix it to squelch
kerneldoc warnings:
Warning(drivers/irqchip/irq-crossbar.c:27): missing initial short description on line:
* struct crossbar_device: crossbar device description
Info(drivers/irqchip/irq-crossbar.c:27): Scanning doc for struct
Warning(drivers/irqchip/irq-crossbar.c:39): No description found for parameter 'write'
Warning(drivers/irqchip/irq-crossbar.c:42): missing initial short description on line:
* struct crossbar_data: Platform specific data
Info(drivers/irqchip/irq-crossbar.c:42): Scanning doc for struct
Warning(drivers/irqchip/irq-crossbar.c:50): No description found for parameter 'safe_map'
4 warnings
Signed-off-by: Nishanth Menon <nm@ti.com>
---
drivers/irqchip/irq-crossbar.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index 58790d4..7d4db07 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -23,11 +23,13 @@
#define IRQ_SKIP -3
#define GIC_IRQ_START 32
-/*
+/**
+ * struct crossbar_device - crossbar device descriptio
* @int_max: maximum number of supported interrupts
* @irq_map: array of interrupts to crossbar number mapping
* @crossbar_base: crossbar base address
* @register_offsets: offsets for each irq number
+ * @write: register write function pointer
*/
struct crossbar_device {
uint int_max;
@@ -39,9 +41,10 @@ struct crossbar_device {
};
/**
- * struct crossbar_data: Platform specific data
+ * struct crossbar_data - Platform specific data
* @irqs_unused: array of irqs that cannot be used because of hw erratas
* @size: size of the irqs_unused array
+ * @safe_map: safe value to write to crossbar register
*/
struct crossbar_data {
const uint *irqs_unused;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/14] irqchip: crossbar: DRA7: Fix unused crossbar list
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (3 preceding siblings ...)
2014-06-03 7:42 ` [PATCH 04/14] irqchip: crossbar: fix kerneldoc warning Sricharan R
@ 2014-06-03 7:42 ` Sricharan R
2014-06-03 7:42 ` [PATCH 06/14] irqchip: crossbar: fix memory leak incase of invalid entry Sricharan R
` (9 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:42 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Rajendra Nayak <rnayak@ti.com>
On DRA7 compatible IRQ crossbar, IRQ 10 default mapped to L3_APP_IRQ,
IRQ133 is default mapped to NMI pin, 139 and 140 crossbars are
unused(not routed). Mark these as unused crossbar IRQs.
Technical Reference Manual documentation update expected
DRA72x-TRMINC00067 is being used to track the update.
Reported-by: Nishanth Menon <nm@ti.com>
Reported-by: Sricharan R <r.sricharan@ti.com>
Reported-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
---
drivers/irqchip/irq-crossbar.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index 7d4db07..42a2e62 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -253,8 +253,8 @@ err1:
return -ENOMEM;
}
-/* irq number 10 cannot be used because of hw bug */
-static int dra_irqs_unused[] = { 10 };
+/* irq number 10,133,139 and 140 cannot be used because of hw bug */
+static int dra_irqs_unused[] = { 10 , 133, 139, 140 };
static struct crossbar_data cb_dra_data = { dra_irqs_unused,
ARRAY_SIZE(dra_irqs_unused), 0 };
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/14] irqchip: crossbar: fix memory leak incase of invalid entry
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (4 preceding siblings ...)
2014-06-03 7:42 ` [PATCH 05/14] irqchip: crossbar: DRA7: Fix unused crossbar list Sricharan R
@ 2014-06-03 7:42 ` Sricharan R
2014-06-03 7:42 ` [PATCH 07/14] irqchip: crossbar: return proper error value Sricharan R
` (8 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:42 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
When the provided unused skip list entry is greater than max irqs
possible, we go to err3, but we fail to free register_offsets,
should have returned to err4 instead which ensures that allocated
register_offsets are freed as well.
Signed-off-by: Nishanth Menon <nm@ti.com>
---
drivers/irqchip/irq-crossbar.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index 42a2e62..fea3e5d 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -225,7 +225,7 @@ static int __init crossbar_of_init(struct device_node *node,
if (entry > max) {
pr_err("Invalid skip entry\n");
- goto err3;
+ goto err4;
}
cb->irq_map[entry] = IRQ_SKIP;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/14] irqchip: crossbar: return proper error value
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (5 preceding siblings ...)
2014-06-03 7:42 ` [PATCH 06/14] irqchip: crossbar: fix memory leak incase of invalid entry Sricharan R
@ 2014-06-03 7:42 ` Sricharan R
2014-06-03 7:43 ` [PATCH 08/14] irqchip: crossbar: change the goto naming Sricharan R
` (7 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:42 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
crossbar_of_init always returns -ENOMEM in case of errors, return proper
error results in case of failures.
Signed-off-by: Nishanth Menon <nm@ti.com>
---
drivers/irqchip/irq-crossbar.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index fea3e5d..524e6e9 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -140,20 +140,26 @@ static const struct irq_domain_ops routable_irq_domain_ops = {
static int __init crossbar_of_init(struct device_node *node,
const struct crossbar_data *data)
{
- int i, size, max, reserved = 0, entry, safe_map;
+ int i, size, max = 0, reserved = 0, entry, safe_map;
const __be32 *irqsr;
const int *irqsk = NULL;
+ int ret = -ENOMEM;
cb = kzalloc(sizeof(*cb), GFP_KERNEL);
if (!cb)
- return -ENOMEM;
+ return ret;
cb->crossbar_base = of_iomap(node, 0);
if (!cb->crossbar_base)
goto err1;
of_property_read_u32(node, "ti,max-irqs", &max);
+ if (!max) {
+ pr_err("missing 'ti,max-irqs' property\n");
+ ret = -EINVAL;
+ goto err2;
+ }
cb->irq_map = kcalloc(max, sizeof(int), GFP_KERNEL);
if (!cb->irq_map)
goto err2;
@@ -174,6 +180,7 @@ static int __init crossbar_of_init(struct device_node *node,
i, &entry);
if (entry > max) {
pr_err("Invalid reserved entry\n");
+ ret = -EINVAL;
goto err3;
}
cb->irq_map[entry] = IRQ_RESERVED;
@@ -198,6 +205,7 @@ static int __init crossbar_of_init(struct device_node *node,
break;
default:
pr_err("Invalid reg-size property\n");
+ ret = -EINVAL;
goto err4;
break;
}
@@ -225,6 +233,7 @@ static int __init crossbar_of_init(struct device_node *node,
if (entry > max) {
pr_err("Invalid skip entry\n");
+ ret = -EINVAL;
goto err4;
}
cb->irq_map[entry] = IRQ_SKIP;
@@ -250,7 +259,7 @@ err2:
iounmap(cb->crossbar_base);
err1:
kfree(cb);
- return -ENOMEM;
+ return ret;
}
/* irq number 10,133,139 and 140 cannot be used because of hw bug */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/14] irqchip: crossbar: change the goto naming
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (6 preceding siblings ...)
2014-06-03 7:42 ` [PATCH 07/14] irqchip: crossbar: return proper error value Sricharan R
@ 2014-06-03 7:43 ` Sricharan R
2014-06-03 7:43 ` [PATCH 09/14] irqchip: crossbar: set cb pointer to null in case of error Sricharan R
` (6 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:43 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
Using err1,2,3,4 etc makes it hard to ensure a new exit path in the
middle will not result in spurious changes, so rename the error paths
as per the function it does.
Signed-off-by: Nishanth Menon <nm@ti.com>
---
drivers/irqchip/irq-crossbar.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index 524e6e9..cf0d79f 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -152,17 +152,17 @@ static int __init crossbar_of_init(struct device_node *node,
cb->crossbar_base = of_iomap(node, 0);
if (!cb->crossbar_base)
- goto err1;
+ goto err_cb;
of_property_read_u32(node, "ti,max-irqs", &max);
if (!max) {
pr_err("missing 'ti,max-irqs' property\n");
ret = -EINVAL;
- goto err2;
+ goto err_base;
}
cb->irq_map = kcalloc(max, sizeof(int), GFP_KERNEL);
if (!cb->irq_map)
- goto err2;
+ goto err_base;
cb->int_max = max;
@@ -181,7 +181,7 @@ static int __init crossbar_of_init(struct device_node *node,
if (entry > max) {
pr_err("Invalid reserved entry\n");
ret = -EINVAL;
- goto err3;
+ goto err_irq_map;
}
cb->irq_map[entry] = IRQ_RESERVED;
}
@@ -189,7 +189,7 @@ static int __init crossbar_of_init(struct device_node *node,
cb->register_offsets = kcalloc(max, sizeof(int), GFP_KERNEL);
if (!cb->register_offsets)
- goto err3;
+ goto err_irq_map;
of_property_read_u32(node, "ti,reg-size", &size);
@@ -206,7 +206,7 @@ static int __init crossbar_of_init(struct device_node *node,
default:
pr_err("Invalid reg-size property\n");
ret = -EINVAL;
- goto err4;
+ goto err_reg_offset;
break;
}
@@ -234,7 +234,7 @@ static int __init crossbar_of_init(struct device_node *node,
if (entry > max) {
pr_err("Invalid skip entry\n");
ret = -EINVAL;
- goto err4;
+ goto err_reg_offset;
}
cb->irq_map[entry] = IRQ_SKIP;
}
@@ -251,13 +251,13 @@ static int __init crossbar_of_init(struct device_node *node,
register_routable_domain_ops(&routable_irq_domain_ops);
return 0;
-err4:
+err_reg_offset:
kfree(cb->register_offsets);
-err3:
+err_irq_map:
kfree(cb->irq_map);
-err2:
+err_base:
iounmap(cb->crossbar_base);
-err1:
+err_cb:
kfree(cb);
return ret;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/14] irqchip: crossbar: set cb pointer to null in case of error
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (7 preceding siblings ...)
2014-06-03 7:43 ` [PATCH 08/14] irqchip: crossbar: change the goto naming Sricharan R
@ 2014-06-03 7:43 ` Sricharan R
2014-06-03 7:43 ` [PATCH 10/14] irqchip: crossbar: Add kerneldoc for crossbar_domain_unmap callback Sricharan R
` (5 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:43 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
If crossbar_of_init returns with a error, then set the cb pointer
to null.
Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
drivers/irqchip/irq-crossbar.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index cf0d79f..5f3e75a 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -259,6 +259,8 @@ err_base:
iounmap(cb->crossbar_base);
err_cb:
kfree(cb);
+
+ cb = NULL;
return ret;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/14] irqchip: crossbar: Add kerneldoc for crossbar_domain_unmap callback
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (8 preceding siblings ...)
2014-06-03 7:43 ` [PATCH 09/14] irqchip: crossbar: set cb pointer to null in case of error Sricharan R
@ 2014-06-03 7:43 ` Sricharan R
2014-06-03 7:43 ` [PATCH 11/14] irqchip: crossbar: introduce ti,max-crossbar-sources to identify valid crossbar mapping Sricharan R
` (4 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:43 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
The crossbar_domain_map/unmap callbacks need not be called same number
of times for a particular irq. But still use counting is not needed
here, because unmap(irq) gets called when irq_desc(irq) is disposed.
After this the irq is anyways unusable and have to mapped again.
Adding the above kerneldoc for unmap callback clarity.
Signed-off-by: Sricharan R <r.sricharan@ti.com>
---
drivers/irqchip/irq-crossbar.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index 5f3e75a..2a73a66 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -101,6 +101,16 @@ static int crossbar_domain_map(struct irq_domain *d, unsigned int irq,
return 0;
}
+/**
+ * crossbar_domain_unmap - unmap a crossbar<->irq connection
+ * @d: domain of irq to unmap
+ * @irq: virq number
+ *
+ * The map/unmap callbacks need not be called same number of times for
+ * a particular irq. But still use counting is not needed here, because
+ * unmap(irq) gets called when irq_desc(irq) is disposed. After this the
+ * irq is anyways unusuable and have to be mapped again.
+ */
static void crossbar_domain_unmap(struct irq_domain *d, unsigned int irq)
{
irq_hw_number_t hw = irq_get_irq_data(irq)->hwirq;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/14] irqchip: crossbar: introduce ti,max-crossbar-sources to identify valid crossbar mapping
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (9 preceding siblings ...)
2014-06-03 7:43 ` [PATCH 10/14] irqchip: crossbar: Add kerneldoc for crossbar_domain_unmap callback Sricharan R
@ 2014-06-03 7:43 ` Sricharan R
2014-06-03 7:43 ` [PATCH 12/14] irqchip: crossbar: introduce centralized check for crossbar write Sricharan R
` (3 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:43 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
Currently we attempt to map any crossbar value to an IRQ, however,
this is not correct from hardware perspective. There is a max crossbar
event number upto which hardware supports. So describe the same in
device tree using 'ti,max-crossbar-sources' property and use it to
validate requests.
Signed-off-by: Nishanth Menon <nm@ti.com>
---
.../devicetree/bindings/arm/omap/crossbar.txt | 2 ++
drivers/irqchip/irq-crossbar.c | 21 ++++++++++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/omap/crossbar.txt b/Documentation/devicetree/bindings/arm/omap/crossbar.txt
index fb88585..6d2e2f5 100644
--- a/Documentation/devicetree/bindings/arm/omap/crossbar.txt
+++ b/Documentation/devicetree/bindings/arm/omap/crossbar.txt
@@ -10,6 +10,7 @@ Required properties:
- compatible : Should be "ti,irq-crossbar"
- reg: Base address and the size of the crossbar registers.
- ti,max-irqs: Total number of irqs available at the interrupt controller.
+- ti,max-crossbar-sources: Maximum number of crossbar sources that can be routed.
- ti,reg-size: Size of a individual register in bytes. Every individual
register is assumed to be of same size. Valid sizes are 1, 2, 4.
- ti,irqs-reserved: List of the reserved irq lines that are not muxed using
@@ -22,6 +23,7 @@ Examples:
compatible = "ti,irq-crossbar";
reg = <0x4a002a48 0x130>;
ti,max-irqs = <160>;
+ ti,max-crossbar-sources = <400>;
ti,reg-size = <2>;
ti,irqs-reserved = <0 1 2 3 5 6 131 132 139 140>;
};
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index 2a73a66..cf69c4d 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -26,6 +26,7 @@
/**
* struct crossbar_device - crossbar device descriptio
* @int_max: maximum number of supported interrupts
+ * @max_crossbar_sources: Maximum number of crossbar sources
* @irq_map: array of interrupts to crossbar number mapping
* @crossbar_base: crossbar base address
* @register_offsets: offsets for each irq number
@@ -33,6 +34,7 @@
*/
struct crossbar_device {
uint int_max;
+ uint max_crossbar_sources;
uint *irq_map;
void __iomem *crossbar_base;
int *register_offsets;
@@ -126,12 +128,19 @@ static int crossbar_domain_xlate(struct irq_domain *d,
unsigned int *out_type)
{
int ret;
+ int req_num = intspec[1];
- ret = get_prev_map_irq(intspec[1]);
+ if (req_num >= cb->max_crossbar_sources) {
+ pr_err("%s: requested crossbar number %d > max %d\n",
+ __func__, req_num, cb->max_crossbar_sources);
+ return -EINVAL;
+ }
+
+ ret = get_prev_map_irq(req_num);
if (ret >= 0)
goto found;
- ret = allocate_free_irq(intspec[1]);
+ ret = allocate_free_irq(req_num);
if (ret < 0)
return ret;
@@ -164,6 +173,14 @@ static int __init crossbar_of_init(struct device_node *node,
if (!cb->crossbar_base)
goto err_cb;
+ of_property_read_u32(node, "ti,max-crossbar-sources",
+ &cb->max_crossbar_sources);
+ if (!cb->max_crossbar_sources) {
+ pr_err("missing 'ti,max-crossbar-sources' property\n");
+ ret = -EINVAL;
+ goto err_base;
+ }
+
of_property_read_u32(node, "ti,max-irqs", &max);
if (!max) {
pr_err("missing 'ti,max-irqs' property\n");
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 12/14] irqchip: crossbar: introduce centralized check for crossbar write
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (10 preceding siblings ...)
2014-06-03 7:43 ` [PATCH 11/14] irqchip: crossbar: introduce ti,max-crossbar-sources to identify valid crossbar mapping Sricharan R
@ 2014-06-03 7:43 ` Sricharan R
2014-06-03 7:43 ` [PATCH 13/14] Documentation: dt: OMAP: crossbar: add description for interrupt consumer Sricharan R
` (2 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:43 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
This is a basic check to ensure that crossbar register needs to be
written. This ensures that we have a common check which is used in
both map and unmap logic.
Signed-off-by: Nishanth Menon <nm@ti.com>
---
drivers/irqchip/irq-crossbar.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index cf69c4d..745ad0a 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -96,10 +96,20 @@ static inline int allocate_free_irq(int cb_no)
return -ENODEV;
}
+static inline bool needs_crossbar_write(irq_hw_number_t hw)
+{
+ if (hw > GIC_IRQ_START)
+ return true;
+
+ return false;
+}
+
static int crossbar_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hw)
{
- cb->write(hw - GIC_IRQ_START, cb->irq_map[hw - GIC_IRQ_START]);
+ if (needs_crossbar_write(hw))
+ cb->write(hw - GIC_IRQ_START, cb->irq_map[hw - GIC_IRQ_START]);
+
return 0;
}
@@ -117,7 +127,7 @@ static void crossbar_domain_unmap(struct irq_domain *d, unsigned int irq)
{
irq_hw_number_t hw = irq_get_irq_data(irq)->hwirq;
- if (hw > GIC_IRQ_START)
+ if (needs_crossbar_write(hw))
cb->irq_map[hw - GIC_IRQ_START] = IRQ_FREE;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 13/14] Documentation: dt: OMAP: crossbar: add description for interrupt consumer
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (11 preceding siblings ...)
2014-06-03 7:43 ` [PATCH 12/14] irqchip: crossbar: introduce centralized check for crossbar write Sricharan R
@ 2014-06-03 7:43 ` Sricharan R
2014-06-03 7:43 ` [PATCH 14/14] irqchip: crossbar allow for quirky hardware with direct hardwiring of GIC Sricharan R
2014-06-03 18:28 ` [PATCH 00/14] irqchip: crossbar: driver fixes Thomas Gleixner
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:43 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
The current crossbar description does not include the description
required for the consumer of the crossbar, a.k.a devices whoes events
pass through the crossbar into the GIC interrupt controller.
So, provide documentation for the same.
Signed-off-by: Nishanth Menon <nm@ti.com>
---
.../devicetree/bindings/arm/omap/crossbar.txt | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/Documentation/devicetree/bindings/arm/omap/crossbar.txt b/Documentation/devicetree/bindings/arm/omap/crossbar.txt
index 6d2e2f5..816d11b 100644
--- a/Documentation/devicetree/bindings/arm/omap/crossbar.txt
+++ b/Documentation/devicetree/bindings/arm/omap/crossbar.txt
@@ -27,3 +27,20 @@ Examples:
ti,reg-size = <2>;
ti,irqs-reserved = <0 1 2 3 5 6 131 132 139 140>;
};
+
+Consumer:
+========
+See Documentation/devicetree/bindings/interrupt-controller/interrupts.txt and
+Documentation/devicetree/bindings/arm/gic.txt for further details.
+
+An interrupt consumer on an SoC using crossbar will use:
+ interrupts = <GIC_SPI request_number interrupt_level>
+request number shall be between 0 to that described by
+"ti,max-crossbar-sources"
+
+Example:
+ device_x@0x4a023000 {
+ /* Crossbar 8 used */
+ interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
+ ...
+ };
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 14/14] irqchip: crossbar allow for quirky hardware with direct hardwiring of GIC
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (12 preceding siblings ...)
2014-06-03 7:43 ` [PATCH 13/14] Documentation: dt: OMAP: crossbar: add description for interrupt consumer Sricharan R
@ 2014-06-03 7:43 ` Sricharan R
2014-06-03 18:28 ` [PATCH 00/14] irqchip: crossbar: driver fixes Thomas Gleixner
14 siblings, 0 replies; 17+ messages in thread
From: Sricharan R @ 2014-06-03 7:43 UTC (permalink / raw)
To: linux-omap, linux-arm-kernel, devicetree
Cc: tony, santosh.shilimkar, nm, rnayak, tglx, linux, r.sricharan
From: Nishanth Menon <nm@ti.com>
On certain platforms such as DRA7, SPIs 0, 1, 2, 3, 5, 6, 10, 131,
132, 133 are direct wired to hardware blocks bypassing crossbar.
This quirky implementation is *NOT* supposed to be the expectation
of crossbar hardware usage. However, these are already marked in our
description of the hardware with SKIP and RESERVED where appropriate.
Unfortunately, we need to be able to refer to these hardwired IRQs.
So, to request these, crossbar driver can use the existing information
from it's table that these SKIP/RESERVED maps are direct wired sources
and generic allocation/programming of crossbar should be avoided.
Signed-off-by: Nishanth Menon <nm@ti.com>
---
.../devicetree/bindings/arm/omap/crossbar.txt | 12 ++++++++++--
drivers/irqchip/irq-crossbar.c | 20 ++++++++++++++++++--
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/arm/omap/crossbar.txt b/Documentation/devicetree/bindings/arm/omap/crossbar.txt
index 816d11b..7476d9b 100644
--- a/Documentation/devicetree/bindings/arm/omap/crossbar.txt
+++ b/Documentation/devicetree/bindings/arm/omap/crossbar.txt
@@ -35,8 +35,10 @@ Documentation/devicetree/bindings/arm/gic.txt for further details.
An interrupt consumer on an SoC using crossbar will use:
interrupts = <GIC_SPI request_number interrupt_level>
-request number shall be between 0 to that described by
-"ti,max-crossbar-sources"
+When the request number is between 0 to that described by
+"ti,max-crossbar-sources", it is assumed to be a crossbar mapping. If the
+request_number is greater than "ti,max-crossbar-sources", then it is mapped as a
+quirky hardware mapping direct to GIC.
Example:
device_x@0x4a023000 {
@@ -44,3 +46,9 @@ Example:
interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>;
...
};
+
+ device_y@0x4a033000 {
+ /* Direct mapped GIC SPI 1 used */
+ interrupts = <GIC_SPI 401 IRQ_TYPE_LEVEL_HIGH>;
+ ...
+ };
diff --git a/drivers/irqchip/irq-crossbar.c b/drivers/irqchip/irq-crossbar.c
index 745ad0a..2b61bbb 100644
--- a/drivers/irqchip/irq-crossbar.c
+++ b/drivers/irqchip/irq-crossbar.c
@@ -98,8 +98,13 @@ static inline int allocate_free_irq(int cb_no)
static inline bool needs_crossbar_write(irq_hw_number_t hw)
{
- if (hw > GIC_IRQ_START)
- return true;
+ int cb_no;
+
+ if (hw > GIC_IRQ_START) {
+ cb_no = cb->irq_map[hw - GIC_IRQ_START];
+ if (cb_no != IRQ_RESERVED && cb_no != IRQ_SKIP)
+ return true;
+ }
return false;
}
@@ -139,8 +144,19 @@ static int crossbar_domain_xlate(struct irq_domain *d,
{
int ret;
int req_num = intspec[1];
+ int direct_map_num;
if (req_num >= cb->max_crossbar_sources) {
+ direct_map_num = req_num - cb->max_crossbar_sources;
+ if (direct_map_num < cb->int_max) {
+ ret = cb->irq_map[direct_map_num];
+ if (ret == IRQ_RESERVED || ret == IRQ_SKIP) {
+ /* We use the interrupt num as h/w irq num */
+ ret = direct_map_num;
+ goto found;
+ }
+ }
+
pr_err("%s: requested crossbar number %d > max %d\n",
__func__, req_num, cb->max_crossbar_sources);
return -EINVAL;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 00/14] irqchip: crossbar: driver fixes
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
` (13 preceding siblings ...)
2014-06-03 7:43 ` [PATCH 14/14] irqchip: crossbar allow for quirky hardware with direct hardwiring of GIC Sricharan R
@ 2014-06-03 18:28 ` Thomas Gleixner
14 siblings, 0 replies; 17+ messages in thread
From: Thomas Gleixner @ 2014-06-03 18:28 UTC (permalink / raw)
To: Sricharan R
Cc: linux-omap, LAK, devicetree, Tony Lindgren, santosh.shilimkar, nm,
rnayak, Russell King, Jason Cooper
On Tue, 3 Jun 2014, Sricharan R wrote:
Please Cc all maintainers on such changes plus the relevant
mailinglist. See MAINTAINERS.
Thanks,
tglx
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2014-06-03 18:28 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 7:42 [PATCH 00/14] irqchip: crossbar: driver fixes Sricharan R
2014-06-03 7:42 ` [PATCH 01/14] irqchip: crossbar: remove IS_ERR_VALUE check Sricharan R
2014-06-03 7:42 ` [PATCH 02/14] irqchip: crossbar: fix sparse warnings Sricharan R
2014-06-03 7:42 ` [PATCH 03/14] irqchip: crossbar: fix checkpatch warning Sricharan R
2014-06-03 7:42 ` [PATCH 04/14] irqchip: crossbar: fix kerneldoc warning Sricharan R
2014-06-03 7:42 ` [PATCH 05/14] irqchip: crossbar: DRA7: Fix unused crossbar list Sricharan R
2014-06-03 7:42 ` [PATCH 06/14] irqchip: crossbar: fix memory leak incase of invalid entry Sricharan R
2014-06-03 7:42 ` [PATCH 07/14] irqchip: crossbar: return proper error value Sricharan R
2014-06-03 7:43 ` [PATCH 08/14] irqchip: crossbar: change the goto naming Sricharan R
2014-06-03 7:43 ` [PATCH 09/14] irqchip: crossbar: set cb pointer to null in case of error Sricharan R
2014-06-03 7:43 ` [PATCH 10/14] irqchip: crossbar: Add kerneldoc for crossbar_domain_unmap callback Sricharan R
2014-06-03 7:43 ` [PATCH 11/14] irqchip: crossbar: introduce ti,max-crossbar-sources to identify valid crossbar mapping Sricharan R
2014-06-03 7:43 ` [PATCH 12/14] irqchip: crossbar: introduce centralized check for crossbar write Sricharan R
2014-06-03 7:43 ` [PATCH 13/14] Documentation: dt: OMAP: crossbar: add description for interrupt consumer Sricharan R
2014-06-03 7:43 ` [PATCH 14/14] irqchip: crossbar allow for quirky hardware with direct hardwiring of GIC Sricharan R
2014-06-03 18:28 ` [PATCH 00/14] irqchip: crossbar: driver fixes Thomas Gleixner
-- strict thread matches above, loose matches on Subject: below --
2014-06-03 7:29 Sricharan R
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).