All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Irq/Mbigen: fix the IO remap problem in mbigen driver.
@ 2016-03-14  6:45 ` MaJun
  0 siblings, 0 replies; 12+ messages in thread
From: MaJun @ 2016-03-14  6:45 UTC (permalink / raw)
  To: Catalin.Marinas, linux-kernel, linux-arm-kernel, Will.Deacon,
	mark.rutland, marc.zyngier, jason, tglx, lizefan, huxinwei,
	dingtianhong, liguozhu, guohanjun, majun258, zhaojunhua

From: Ma Jun <majun258@huawei.com>

This patch set is used to fix the problem of remap a set of registers
repeatedly.

Changes in v2:
--- Change the mbigen device node definition
--- Change the mbigen driver based on the new mbigen dts structure.

Ma Jun (2):
  Irq/mbigen:Change the mbigen node definition in dt binding file
  Irq/mbigen:Change the mbigen driver based on the new mbigen node definition

 .../interrupt-controller/hisilicon,mbigen-v2.txt   |   22 +++++++++++---
 drivers/irqchip/irq-mbigen.c                       |   30 ++++++++++++++------
 2 files changed, 38 insertions(+), 14 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 0/2] Irq/Mbigen: fix the IO remap problem in mbigen driver.
@ 2016-03-14  6:45 ` MaJun
  0 siblings, 0 replies; 12+ messages in thread
From: MaJun @ 2016-03-14  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ma Jun <majun258@huawei.com>

This patch set is used to fix the problem of remap a set of registers
repeatedly.

Changes in v2:
--- Change the mbigen device node definition
--- Change the mbigen driver based on the new mbigen dts structure.

Ma Jun (2):
  Irq/mbigen:Change the mbigen node definition in dt binding file
  Irq/mbigen:Change the mbigen driver based on the new mbigen node definition

 .../interrupt-controller/hisilicon,mbigen-v2.txt   |   22 +++++++++++---
 drivers/irqchip/irq-mbigen.c                       |   30 ++++++++++++++------
 2 files changed, 38 insertions(+), 14 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] Irq/mbigen:Change the mbigen node definition in dt binding file
  2016-03-14  6:45 ` MaJun
@ 2016-03-14  6:45   ` MaJun
  -1 siblings, 0 replies; 12+ messages in thread
From: MaJun @ 2016-03-14  6:45 UTC (permalink / raw)
  To: Catalin.Marinas, linux-kernel, linux-arm-kernel, Will.Deacon,
	mark.rutland, marc.zyngier, jason, tglx, lizefan, huxinwei,
	dingtianhong, liguozhu, guohanjun, majun258, zhaojunhua

From: Ma Jun <majun258@huawei.com>

For mbigen module, there is a special case that more than one mbigen
device nodes use the same reg definition in DTS when these devices
exist in the same mbigen hardware module.

To fix the mbigen IO remap problem, the mbigen node definition and
structure are changed based on Mark Rutland's suggestion.

Signed-off-by: Ma Jun <majun258@huawei.com>
---
 .../interrupt-controller/hisilicon,mbigen-v2.txt   |   22 +++++++++++++++----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt b/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt
index 720f7c9..3b2f4c4 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt
@@ -21,6 +21,8 @@ Mbigen main node required properties:
 - reg: Specifies the base physical address and size of the Mbigen
   registers.
 
+Mbigen sub node required properties:
+------------------------------------------
 - interrupt controller: Identifies the node as an interrupt controller
 
 - msi-parent: Specifies the MSI controller this mbigen use.
@@ -45,13 +47,23 @@ Mbigen main node required properties:
 
 Examples:
 
-	mbigen_device_gmac:intc {
+	mbigen_chip_dsa {
 			compatible = "hisilicon,mbigen-v2";
 			reg = <0x0 0xc0080000 0x0 0x10000>;
-			interrupt-controller;
-			msi-parent = <&its_dsa 0x40b1c>;
-			num-pins = <9>;
-			#interrupt-cells = <2>;
+
+			mbigen_gmac:intc_gmac {
+				interrupt-controller;
+				msi-parent = <&its_dsa 0x40b1c>;
+				num-pins = <9>;
+				#interrupt-cells = <2>;
+			};
+
+			mbigen_i2c:intc_i2c {
+				interrupt-controller;
+				msi-parent = <&its_dsa 0x40b0e>;
+				num-pins = <2>;
+				#interrupt-cells = <2>;
+			};
 	};
 
 Devices connect to mbigen required properties:
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] Irq/mbigen:Change the mbigen node definition in dt binding file
@ 2016-03-14  6:45   ` MaJun
  0 siblings, 0 replies; 12+ messages in thread
From: MaJun @ 2016-03-14  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ma Jun <majun258@huawei.com>

For mbigen module, there is a special case that more than one mbigen
device nodes use the same reg definition in DTS when these devices
exist in the same mbigen hardware module.

To fix the mbigen IO remap problem, the mbigen node definition and
structure are changed based on Mark Rutland's suggestion.

Signed-off-by: Ma Jun <majun258@huawei.com>
---
 .../interrupt-controller/hisilicon,mbigen-v2.txt   |   22 +++++++++++++++----
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt b/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt
index 720f7c9..3b2f4c4 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/hisilicon,mbigen-v2.txt
@@ -21,6 +21,8 @@ Mbigen main node required properties:
 - reg: Specifies the base physical address and size of the Mbigen
   registers.
 
+Mbigen sub node required properties:
+------------------------------------------
 - interrupt controller: Identifies the node as an interrupt controller
 
 - msi-parent: Specifies the MSI controller this mbigen use.
@@ -45,13 +47,23 @@ Mbigen main node required properties:
 
 Examples:
 
-	mbigen_device_gmac:intc {
+	mbigen_chip_dsa {
 			compatible = "hisilicon,mbigen-v2";
 			reg = <0x0 0xc0080000 0x0 0x10000>;
-			interrupt-controller;
-			msi-parent = <&its_dsa 0x40b1c>;
-			num-pins = <9>;
-			#interrupt-cells = <2>;
+
+			mbigen_gmac:intc_gmac {
+				interrupt-controller;
+				msi-parent = <&its_dsa 0x40b1c>;
+				num-pins = <9>;
+				#interrupt-cells = <2>;
+			};
+
+			mbigen_i2c:intc_i2c {
+				interrupt-controller;
+				msi-parent = <&its_dsa 0x40b0e>;
+				num-pins = <2>;
+				#interrupt-cells = <2>;
+			};
 	};
 
 Devices connect to mbigen required properties:
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.
  2016-03-14  6:45 ` MaJun
@ 2016-03-14  6:45   ` MaJun
  -1 siblings, 0 replies; 12+ messages in thread
From: MaJun @ 2016-03-14  6:45 UTC (permalink / raw)
  To: Catalin.Marinas, linux-kernel, linux-arm-kernel, Will.Deacon,
	mark.rutland, marc.zyngier, jason, tglx, lizefan, huxinwei,
	dingtianhong, liguozhu, guohanjun, majun258, zhaojunhua

From: Ma Jun <majun258@huawei.com>

To fix the IO remap problem, change the mbigen driver based on the
new mbigen node definition.

Signed-off-by: Ma Jun <majun258@huawei.com>
---
 drivers/irqchip/irq-mbigen.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index 4dd3eb8..4d413bc 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -242,6 +242,8 @@ static int mbigen_device_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct irq_domain *domain;
 	u32 num_pins;
+	struct platform_device *child_pdev;
+	struct device_node *np;
 
 	mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL);
 	if (!mgn_chip)
@@ -251,25 +253,35 @@ static int mbigen_device_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	mgn_chip->base = devm_ioremap_resource(&pdev->dev, res);
+
 	if (IS_ERR(mgn_chip->base))
 		return PTR_ERR(mgn_chip->base);
 
-	if (of_property_read_u32(pdev->dev.of_node, "num-pins", &num_pins) < 0) {
-		dev_err(&pdev->dev, "No num-pins property\n");
-		return -EINVAL;
-	}
+	for_each_child_of_node(pdev->dev.of_node, np) {
+		if (!of_property_read_bool(np, "interrupt-controller"))
+			continue;
+
+		child_pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root);
+		if (IS_ERR(child_pdev))
+			return PTR_ERR(child_pdev);
+
+		if (of_property_read_u32(child_pdev->dev.of_node, "num-pins", &num_pins) < 0) {
+			dev_err(&pdev->dev, "No num-pins property\n");
+			return -EINVAL;
+		}
 
-	domain = platform_msi_create_device_domain(&pdev->dev, num_pins,
+		domain = platform_msi_create_device_domain(&child_pdev->dev, num_pins,
 							mbigen_write_msg,
 							&mbigen_domain_ops,
 							mgn_chip);
 
-	if (!domain)
-		return -ENOMEM;
+		if (!domain)
+			return -ENOMEM;
 
-	platform_set_drvdata(pdev, mgn_chip);
+		dev_info(&child_pdev->dev, "Allocated %d MSIs\n", num_pins);
+	}
 
-	dev_info(&pdev->dev, "Allocated %d MSIs\n", num_pins);
+	platform_set_drvdata(pdev, mgn_chip);
 
 	return 0;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.
@ 2016-03-14  6:45   ` MaJun
  0 siblings, 0 replies; 12+ messages in thread
From: MaJun @ 2016-03-14  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Ma Jun <majun258@huawei.com>

To fix the IO remap problem, change the mbigen driver based on the
new mbigen node definition.

Signed-off-by: Ma Jun <majun258@huawei.com>
---
 drivers/irqchip/irq-mbigen.c |   30 +++++++++++++++++++++---------
 1 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index 4dd3eb8..4d413bc 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -242,6 +242,8 @@ static int mbigen_device_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct irq_domain *domain;
 	u32 num_pins;
+	struct platform_device *child_pdev;
+	struct device_node *np;
 
 	mgn_chip = devm_kzalloc(&pdev->dev, sizeof(*mgn_chip), GFP_KERNEL);
 	if (!mgn_chip)
@@ -251,25 +253,35 @@ static int mbigen_device_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	mgn_chip->base = devm_ioremap_resource(&pdev->dev, res);
+
 	if (IS_ERR(mgn_chip->base))
 		return PTR_ERR(mgn_chip->base);
 
-	if (of_property_read_u32(pdev->dev.of_node, "num-pins", &num_pins) < 0) {
-		dev_err(&pdev->dev, "No num-pins property\n");
-		return -EINVAL;
-	}
+	for_each_child_of_node(pdev->dev.of_node, np) {
+		if (!of_property_read_bool(np, "interrupt-controller"))
+			continue;
+
+		child_pdev = of_platform_device_create(np, NULL, platform_bus_type.dev_root);
+		if (IS_ERR(child_pdev))
+			return PTR_ERR(child_pdev);
+
+		if (of_property_read_u32(child_pdev->dev.of_node, "num-pins", &num_pins) < 0) {
+			dev_err(&pdev->dev, "No num-pins property\n");
+			return -EINVAL;
+		}
 
-	domain = platform_msi_create_device_domain(&pdev->dev, num_pins,
+		domain = platform_msi_create_device_domain(&child_pdev->dev, num_pins,
 							mbigen_write_msg,
 							&mbigen_domain_ops,
 							mgn_chip);
 
-	if (!domain)
-		return -ENOMEM;
+		if (!domain)
+			return -ENOMEM;
 
-	platform_set_drvdata(pdev, mgn_chip);
+		dev_info(&child_pdev->dev, "Allocated %d MSIs\n", num_pins);
+	}
 
-	dev_info(&pdev->dev, "Allocated %d MSIs\n", num_pins);
+	platform_set_drvdata(pdev, mgn_chip);
 
 	return 0;
 }
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.
  2016-03-14  6:45   ` MaJun
@ 2016-03-14  7:44     ` Thomas Gleixner
  -1 siblings, 0 replies; 12+ messages in thread
From: Thomas Gleixner @ 2016-03-14  7:44 UTC (permalink / raw)
  To: MaJun
  Cc: Catalin.Marinas, linux-kernel, linux-arm-kernel, Will.Deacon,
	mark.rutland, marc.zyngier, jason, lizefan, huxinwei,
	dingtianhong, liguozhu, guohanjun, zhaojunhua

On Mon, 14 Mar 2016, MaJun wrote:

> From: Ma Jun <majun258@huawei.com>
> 
> To fix the IO remap problem, change the mbigen driver based on the
> new mbigen node definition.

Please describe what the problem is. There is no way that anyone can figure
out why that patch is required, what it fixes and how the fix is done. The
'how' should be a high level description as we can see the actual changes in
the diff.

Thanks,

	tglx

 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition.
@ 2016-03-14  7:44     ` Thomas Gleixner
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Gleixner @ 2016-03-14  7:44 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 14 Mar 2016, MaJun wrote:

> From: Ma Jun <majun258@huawei.com>
> 
> To fix the IO remap problem, change the mbigen driver based on the
> new mbigen node definition.

Please describe what the problem is. There is no way that anyone can figure
out why that patch is required, what it fixes and how the fix is done. The
'how' should be a high level description as we can see the actual changes in
the diff.

Thanks,

	tglx

 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] Irq/mbigen:Change the mbigen node definition in dt binding file
  2016-03-14  6:45   ` MaJun
@ 2016-03-14  7:49     ` Thomas Gleixner
  -1 siblings, 0 replies; 12+ messages in thread
From: Thomas Gleixner @ 2016-03-14  7:49 UTC (permalink / raw)
  To: MaJun
  Cc: Catalin.Marinas, linux-kernel, linux-arm-kernel, Will.Deacon,
	mark.rutland, marc.zyngier, jason, lizefan, huxinwei,
	dingtianhong, liguozhu, guohanjun, zhaojunhua

Majun,

On Mon, 14 Mar 2016, MaJun wrote:

First of all the prefix for irq chip drivers is not "Irq/".

Hint: git log drivers/irqchip 

> From: Ma Jun <majun258@huawei.com>
> 
> For mbigen module, there is a special case that more than one mbigen
> device nodes use the same reg definition in DTS when these devices
> exist in the same mbigen hardware module.

There is a special case, so what?
 
> To fix the mbigen IO remap problem, the mbigen node definition and

Which problem?

> structure are changed based on Mark Rutland's suggestion.

That's really uselss. Nobody has any idea what Mark suggested and in which way
it fixes that unspecified problem you are talking about.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] Irq/mbigen:Change the mbigen node definition in dt binding file
@ 2016-03-14  7:49     ` Thomas Gleixner
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Gleixner @ 2016-03-14  7:49 UTC (permalink / raw)
  To: linux-arm-kernel

Majun,

On Mon, 14 Mar 2016, MaJun wrote:

First of all the prefix for irq chip drivers is not "Irq/".

Hint: git log drivers/irqchip 

> From: Ma Jun <majun258@huawei.com>
> 
> For mbigen module, there is a special case that more than one mbigen
> device nodes use the same reg definition in DTS when these devices
> exist in the same mbigen hardware module.

There is a special case, so what?
 
> To fix the mbigen IO remap problem, the mbigen node definition and

Which problem?

> structure are changed based on Mark Rutland's suggestion.

That's really uselss. Nobody has any idea what Mark suggested and in which way
it fixes that unspecified problem you are talking about.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v2 1/2] Irq/mbigen:Change the mbigen node definition in dt binding file
  2016-03-14  7:49     ` Thomas Gleixner
@ 2016-03-15  7:35       ` majun (F)
  -1 siblings, 0 replies; 12+ messages in thread
From: majun (F) @ 2016-03-15  7:35 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Catalin.Marinas, linux-kernel, linux-arm-kernel, Will.Deacon,
	mark.rutland, marc.zyngier, jason, lizefan, huxinwei,
	dingtianhong, liguozhu, guohanjun, zhaojunhua

Hi Thomas:
	Thanks for pointing out the problems.
I'll make detail description about this problem and resend this patch set.


在 2016/3/14 15:49, Thomas Gleixner 写道:
> Majun,
> 
> On Mon, 14 Mar 2016, MaJun wrote:
> 
> First of all the prefix for irq chip drivers is not "Irq/".
> 
> Hint: git log drivers/irqchip 
> 
>> From: Ma Jun <majun258@huawei.com>
>>
>> For mbigen module, there is a special case that more than one mbigen
>> device nodes use the same reg definition in DTS when these devices
>> exist in the same mbigen hardware module.
> 
> There is a special case, so what?
>  

In current driver, the registers would be remapped repeatedly
and caused error when use the function "devm_ioremap_resource".

That's the problem I tried to fix.

>> To fix the mbigen IO remap problem, the mbigen node definition and
> 
> Which problem?
> 
>> structure are changed based on Mark Rutland's suggestion.
> 
> That's really uselss. Nobody has any idea what Mark suggested and in which way
> it fixes that unspecified problem you are talking about.
> 

Actually, I discussed this problem with Mark in v1.
He raised some questions and suggestions
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-February/403691.html

Thanks!
MaJun

> Thanks,
> 
> 	tglx
> 
> .
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2 1/2] Irq/mbigen:Change the mbigen node definition in dt binding file
@ 2016-03-15  7:35       ` majun (F)
  0 siblings, 0 replies; 12+ messages in thread
From: majun (F) @ 2016-03-15  7:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Thomas:
	Thanks for pointing out the problems.
I'll make detail description about this problem and resend this patch set.


? 2016/3/14 15:49, Thomas Gleixner ??:
> Majun,
> 
> On Mon, 14 Mar 2016, MaJun wrote:
> 
> First of all the prefix for irq chip drivers is not "Irq/".
> 
> Hint: git log drivers/irqchip 
> 
>> From: Ma Jun <majun258@huawei.com>
>>
>> For mbigen module, there is a special case that more than one mbigen
>> device nodes use the same reg definition in DTS when these devices
>> exist in the same mbigen hardware module.
> 
> There is a special case, so what?
>  

In current driver, the registers would be remapped repeatedly
and caused error when use the function "devm_ioremap_resource".

That's the problem I tried to fix.

>> To fix the mbigen IO remap problem, the mbigen node definition and
> 
> Which problem?
> 
>> structure are changed based on Mark Rutland's suggestion.
> 
> That's really uselss. Nobody has any idea what Mark suggested and in which way
> it fixes that unspecified problem you are talking about.
> 

Actually, I discussed this problem with Mark in v1.
He raised some questions and suggestions
http://lists.infradead.org/pipermail/linux-arm-kernel/2016-February/403691.html

Thanks!
MaJun

> Thanks,
> 
> 	tglx
> 
> .
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-03-15  7:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-14  6:45 [PATCH v2 0/2] Irq/Mbigen: fix the IO remap problem in mbigen driver MaJun
2016-03-14  6:45 ` MaJun
2016-03-14  6:45 ` [PATCH v2 1/2] Irq/mbigen:Change the mbigen node definition in dt binding file MaJun
2016-03-14  6:45   ` MaJun
2016-03-14  7:49   ` Thomas Gleixner
2016-03-14  7:49     ` Thomas Gleixner
2016-03-15  7:35     ` majun (F)
2016-03-15  7:35       ` majun (F)
2016-03-14  6:45 ` [PATCH v2 2/2] Irq/mbigen:Change the mbigen driver based on the new mbigen node definition MaJun
2016-03-14  6:45   ` MaJun
2016-03-14  7:44   ` Thomas Gleixner
2016-03-14  7:44     ` Thomas Gleixner

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.