* [PATCH] of: Export of_irq_count for using in modules @ 2013-05-30 13:49 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-05-30 13:49 UTC (permalink / raw) To: linux-kernel Cc: Michal Simek, Michal Simek, Thomas Petazzoni, Grant Likely, Rob Herring, devicetree-discuss [-- Attachment #1: Type: text/plain, Size: 726 bytes --] Export of_irq_count for modules. Signed-off-by: Michal Simek <michal.simek@xilinx.com> --- We are using this function in remoteproc module drivers. There is also drivers/gpio/gpio-mvebu.c in the tree which use this function but this driver can't be compiled as module. This could be also the reason why is not this driver as module. --- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index a3c1c5a..c918dde 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -374,6 +374,7 @@ int of_irq_count(struct device_node *dev) return nr; } +EXPORT_SYMBOL_GPL(of_irq_count); /** * of_irq_to_resource_table - Fill in resource table with node's IRQ info -- 1.8.2.3 [-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH] of: Export of_irq_count for using in modules @ 2013-05-30 13:49 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-05-30 13:49 UTC (permalink / raw) To: linux-kernel-u79uwXL29TY76Z2rM5mHXA Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Michal Simek, Rob Herring, Grant Likely [-- Attachment #1.1: Type: text/plain, Size: 755 bytes --] Export of_irq_count for modules. Signed-off-by: Michal Simek <michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> --- We are using this function in remoteproc module drivers. There is also drivers/gpio/gpio-mvebu.c in the tree which use this function but this driver can't be compiled as module. This could be also the reason why is not this driver as module. --- drivers/of/irq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index a3c1c5a..c918dde 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -374,6 +374,7 @@ int of_irq_count(struct device_node *dev) return nr; } +EXPORT_SYMBOL_GPL(of_irq_count); /** * of_irq_to_resource_table - Fill in resource table with node's IRQ info -- 1.8.2.3 [-- Attachment #1.2: Type: application/pgp-signature, Size: 198 bytes --] [-- Attachment #2: Type: text/plain, Size: 192 bytes --] _______________________________________________ devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org https://lists.ozlabs.org/listinfo/devicetree-discuss ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-30 20:17 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 21+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-30 20:17 UTC (permalink / raw) To: Michal Simek; +Cc: linux-kernel, devicetree-discuss, Rob Herring, Grant Likely On 15:49 Thu 30 May , Michal Simek wrote: > Export of_irq_count for modules. can you explain why do you need to call of_irq_count Best Regards, J. > > Signed-off-by: Michal Simek <michal.simek@xilinx.com> > --- > We are using this function in remoteproc module drivers. > There is also drivers/gpio/gpio-mvebu.c in the tree > which use this function but this driver can't be compiled > as module. This could be also the reason why is not this driver as module. > --- > drivers/of/irq.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/of/irq.c b/drivers/of/irq.c > index a3c1c5a..c918dde 100644 > --- a/drivers/of/irq.c > +++ b/drivers/of/irq.c > @@ -374,6 +374,7 @@ int of_irq_count(struct device_node *dev) > > return nr; > } > +EXPORT_SYMBOL_GPL(of_irq_count); > > /** > * of_irq_to_resource_table - Fill in resource table with node's IRQ info > -- > 1.8.2.3 > > _______________________________________________ > devicetree-discuss mailing list > devicetree-discuss@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/devicetree-discuss ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-30 20:17 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 21+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-30 20:17 UTC (permalink / raw) To: Michal Simek Cc: Grant Likely, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Rob Herring On 15:49 Thu 30 May , Michal Simek wrote: > Export of_irq_count for modules. can you explain why do you need to call of_irq_count Best Regards, J. > > Signed-off-by: Michal Simek <michal.simek-gjFFaj9aHVfQT0dZR+AlfA@public.gmane.org> > --- > We are using this function in remoteproc module drivers. > There is also drivers/gpio/gpio-mvebu.c in the tree > which use this function but this driver can't be compiled > as module. This could be also the reason why is not this driver as module. > --- > drivers/of/irq.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/of/irq.c b/drivers/of/irq.c > index a3c1c5a..c918dde 100644 > --- a/drivers/of/irq.c > +++ b/drivers/of/irq.c > @@ -374,6 +374,7 @@ int of_irq_count(struct device_node *dev) > > return nr; > } > +EXPORT_SYMBOL_GPL(of_irq_count); > > /** > * of_irq_to_resource_table - Fill in resource table with node's IRQ info > -- > 1.8.2.3 > > _______________________________________________ > devicetree-discuss mailing list > devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org > https://lists.ozlabs.org/listinfo/devicetree-discuss ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-31 8:14 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-05-31 8:14 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Michal Simek, Grant Likely, devicetree-discuss, linux-kernel, Rob Herring [-- Attachment #1: Type: text/plain, Size: 1557 bytes --] Hi Jean-Christophe, On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 15:49 Thu 30 May , Michal Simek wrote: >> Export of_irq_count for modules. > > can you explain why do you need to call of_irq_count I need to count number of irq written in the DTS node. It is not fixed size that's why I need to proper way how to find it out. I am using this loop. count = of_irq_count(pdev->dev.of_node); /* Alloc IRQ based on DTS to be sure that no other driver will use it */ while (count--) { tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, dev_name(&pdev->dev), &pdev->dev); if (ret) { ... } } But of course if you think that this is incorrect to export it I can use what it is in of_irq_count body 368 int of_irq_count(struct device_node *dev) 369 { 370 int nr = 0; 371 372 while (of_irq_to_resource(dev, nr, NULL)) 373 nr++; 374 375 return nr; 376 } Because of_irq_to_resource is exported for modules. Or is there any better way how to loop over all interrupts in DT node? Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-31 8:14 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-05-31 8:14 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Grant Likely, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Michal Simek, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1.1: Type: text/plain, Size: 1557 bytes --] Hi Jean-Christophe, On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 15:49 Thu 30 May , Michal Simek wrote: >> Export of_irq_count for modules. > > can you explain why do you need to call of_irq_count I need to count number of irq written in the DTS node. It is not fixed size that's why I need to proper way how to find it out. I am using this loop. count = of_irq_count(pdev->dev.of_node); /* Alloc IRQ based on DTS to be sure that no other driver will use it */ while (count--) { tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, dev_name(&pdev->dev), &pdev->dev); if (ret) { ... } } But of course if you think that this is incorrect to export it I can use what it is in of_irq_count body 368 int of_irq_count(struct device_node *dev) 369 { 370 int nr = 0; 371 372 while (of_irq_to_resource(dev, nr, NULL)) 373 nr++; 374 375 return nr; 376 } Because of_irq_to_resource is exported for modules. Or is there any better way how to loop over all interrupts in DT node? Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] [-- Attachment #2: Type: text/plain, Size: 192 bytes --] _______________________________________________ devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org https://lists.ozlabs.org/listinfo/devicetree-discuss ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-31 11:00 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 21+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-31 11:00 UTC (permalink / raw) To: Michal Simek Cc: Michal Simek, Grant Likely, devicetree-discuss, linux-kernel, Rob Herring On 10:14 Fri 31 May , Michal Simek wrote: > Hi Jean-Christophe, > > On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > On 15:49 Thu 30 May , Michal Simek wrote: > >> Export of_irq_count for modules. > > > > can you explain why do you need to call of_irq_count > > I need to count number of irq written in the DTS node. > It is not fixed size that's why I need to proper way how to > find it out. > > I am using this loop. > count = of_irq_count(pdev->dev.of_node); > /* Alloc IRQ based on DTS to be sure that no other driver will use it */ > while (count--) { > tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); > dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); > ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, > dev_name(&pdev->dev), &pdev->dev); > if (ret) { > ... > } > } > > But of course if you think that this is incorrect to export it > I can use what it is in of_irq_count body > 368 int of_irq_count(struct device_node *dev) > 369 { > 370 int nr = 0; > 371 > 372 while (of_irq_to_resource(dev, nr, NULL)) > 373 nr++; > 374 > 375 return nr; > 376 } > > Because of_irq_to_resource is exported for modules. > Or is there any better way how to loop over all interrupts in DT node? can just explain me why you need to call irq_of_parse_and_map in your driver? as the irq will be provided in the resources normally Best Regards, J. > > Thanks, > Michal > > -- > Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 > w: www.monstr.eu p: +42-0-721842854 > Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ > Maintainer of Linux kernel - Xilinx Zynq ARM architecture > Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform > > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-31 11:00 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 21+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-31 11:00 UTC (permalink / raw) To: Michal Simek Cc: Grant Likely, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Michal Simek, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA On 10:14 Fri 31 May , Michal Simek wrote: > Hi Jean-Christophe, > > On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > On 15:49 Thu 30 May , Michal Simek wrote: > >> Export of_irq_count for modules. > > > > can you explain why do you need to call of_irq_count > > I need to count number of irq written in the DTS node. > It is not fixed size that's why I need to proper way how to > find it out. > > I am using this loop. > count = of_irq_count(pdev->dev.of_node); > /* Alloc IRQ based on DTS to be sure that no other driver will use it */ > while (count--) { > tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); > dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); > ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, > dev_name(&pdev->dev), &pdev->dev); > if (ret) { > ... > } > } > > But of course if you think that this is incorrect to export it > I can use what it is in of_irq_count body > 368 int of_irq_count(struct device_node *dev) > 369 { > 370 int nr = 0; > 371 > 372 while (of_irq_to_resource(dev, nr, NULL)) > 373 nr++; > 374 > 375 return nr; > 376 } > > Because of_irq_to_resource is exported for modules. > Or is there any better way how to loop over all interrupts in DT node? can just explain me why you need to call irq_of_parse_and_map in your driver? as the irq will be provided in the resources normally Best Regards, J. > > Thanks, > Michal > > -- > Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 > w: www.monstr.eu p: +42-0-721842854 > Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ > Maintainer of Linux kernel - Xilinx Zynq ARM architecture > Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform > > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-31 13:57 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-05-31 13:57 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Michal Simek, Grant Likely, devicetree-discuss, linux-kernel, Rob Herring [-- Attachment #1: Type: text/plain, Size: 2331 bytes --] On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 10:14 Fri 31 May , Michal Simek wrote: >> Hi Jean-Christophe, >> >> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>> On 15:49 Thu 30 May , Michal Simek wrote: >>>> Export of_irq_count for modules. >>> >>> can you explain why do you need to call of_irq_count >> >> I need to count number of irq written in the DTS node. >> It is not fixed size that's why I need to proper way how to >> find it out. >> >> I am using this loop. >> count = of_irq_count(pdev->dev.of_node); >> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ >> while (count--) { >> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); >> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); >> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, >> dev_name(&pdev->dev), &pdev->dev); >> if (ret) { >> ... >> } >> } >> >> But of course if you think that this is incorrect to export it >> I can use what it is in of_irq_count body >> 368 int of_irq_count(struct device_node *dev) >> 369 { >> 370 int nr = 0; >> 371 >> 372 while (of_irq_to_resource(dev, nr, NULL)) >> 373 nr++; >> 374 >> 375 return nr; >> 376 } >> >> Because of_irq_to_resource is exported for modules. >> Or is there any better way how to loop over all interrupts in DT node? > > can just explain me why you need to call irq_of_parse_and_map in your driver? > > as the irq will be provided in the resources normally It is quite a long time I have written this driver on v3.1 or 3.3. But is this better? struct resource *res; int i = 0; do { res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); if (res) do something } while(res); Also what about of_irq_to_resource()? Is it deprecated and all drivers shouldn't use it? I have no problem to rewrite the driver to use platform_get_resource. Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-31 13:57 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-05-31 13:57 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Grant Likely, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Michal Simek, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1.1: Type: text/plain, Size: 2331 bytes --] On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 10:14 Fri 31 May , Michal Simek wrote: >> Hi Jean-Christophe, >> >> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>> On 15:49 Thu 30 May , Michal Simek wrote: >>>> Export of_irq_count for modules. >>> >>> can you explain why do you need to call of_irq_count >> >> I need to count number of irq written in the DTS node. >> It is not fixed size that's why I need to proper way how to >> find it out. >> >> I am using this loop. >> count = of_irq_count(pdev->dev.of_node); >> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ >> while (count--) { >> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); >> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); >> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, >> dev_name(&pdev->dev), &pdev->dev); >> if (ret) { >> ... >> } >> } >> >> But of course if you think that this is incorrect to export it >> I can use what it is in of_irq_count body >> 368 int of_irq_count(struct device_node *dev) >> 369 { >> 370 int nr = 0; >> 371 >> 372 while (of_irq_to_resource(dev, nr, NULL)) >> 373 nr++; >> 374 >> 375 return nr; >> 376 } >> >> Because of_irq_to_resource is exported for modules. >> Or is there any better way how to loop over all interrupts in DT node? > > can just explain me why you need to call irq_of_parse_and_map in your driver? > > as the irq will be provided in the resources normally It is quite a long time I have written this driver on v3.1 or 3.3. But is this better? struct resource *res; int i = 0; do { res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); if (res) do something } while(res); Also what about of_irq_to_resource()? Is it deprecated and all drivers shouldn't use it? I have no problem to rewrite the driver to use platform_get_resource. Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] [-- Attachment #2: Type: text/plain, Size: 192 bytes --] _______________________________________________ devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org https://lists.ozlabs.org/listinfo/devicetree-discuss ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-31 15:16 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 21+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-31 15:16 UTC (permalink / raw) To: Michal Simek Cc: Michal Simek, Grant Likely, devicetree-discuss, linux-kernel, Rob Herring On 15:57 Fri 31 May , Michal Simek wrote: > On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > On 10:14 Fri 31 May , Michal Simek wrote: > >> Hi Jean-Christophe, > >> > >> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > >>> On 15:49 Thu 30 May , Michal Simek wrote: > >>>> Export of_irq_count for modules. > >>> > >>> can you explain why do you need to call of_irq_count > >> > >> I need to count number of irq written in the DTS node. > >> It is not fixed size that's why I need to proper way how to > >> find it out. > >> > >> I am using this loop. > >> count = of_irq_count(pdev->dev.of_node); > >> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ > >> while (count--) { > >> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); > >> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); > >> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, > >> dev_name(&pdev->dev), &pdev->dev); > >> if (ret) { > >> ... > >> } > >> } > >> > >> But of course if you think that this is incorrect to export it > >> I can use what it is in of_irq_count body > >> 368 int of_irq_count(struct device_node *dev) > >> 369 { > >> 370 int nr = 0; > >> 371 > >> 372 while (of_irq_to_resource(dev, nr, NULL)) > >> 373 nr++; > >> 374 > >> 375 return nr; > >> 376 } > >> > >> Because of_irq_to_resource is exported for modules. > >> Or is there any better way how to loop over all interrupts in DT node? > > > > can just explain me why you need to call irq_of_parse_and_map in your driver? > > > > as the irq will be provided in the resources normally > > It is quite a long time I have written this driver on v3.1 or 3.3. > But is this better? > > struct resource *res; > int i = 0; > do { > res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); > if (res) > do something > } while(res); > > Also what about of_irq_to_resource()? Is it deprecated and all drivers > shouldn't use it? > > I have no problem to rewrite the driver to use platform_get_resource. yeah it's better but be aware there is a but in DT that I'm working on to fix if you use irq that are registered by a pdev this will not work I hope to fix it for 3.11 and already send an RFC that fix it Best Regards, J. > > Thanks, > Michal > > -- > Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 > w: www.monstr.eu p: +42-0-721842854 > Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ > Maintainer of Linux kernel - Xilinx Zynq ARM architecture > Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform > > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-05-31 15:16 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 0 replies; 21+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-05-31 15:16 UTC (permalink / raw) To: Michal Simek Cc: Grant Likely, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Michal Simek, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA On 15:57 Fri 31 May , Michal Simek wrote: > On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > On 10:14 Fri 31 May , Michal Simek wrote: > >> Hi Jean-Christophe, > >> > >> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > >>> On 15:49 Thu 30 May , Michal Simek wrote: > >>>> Export of_irq_count for modules. > >>> > >>> can you explain why do you need to call of_irq_count > >> > >> I need to count number of irq written in the DTS node. > >> It is not fixed size that's why I need to proper way how to > >> find it out. > >> > >> I am using this loop. > >> count = of_irq_count(pdev->dev.of_node); > >> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ > >> while (count--) { > >> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); > >> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); > >> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, > >> dev_name(&pdev->dev), &pdev->dev); > >> if (ret) { > >> ... > >> } > >> } > >> > >> But of course if you think that this is incorrect to export it > >> I can use what it is in of_irq_count body > >> 368 int of_irq_count(struct device_node *dev) > >> 369 { > >> 370 int nr = 0; > >> 371 > >> 372 while (of_irq_to_resource(dev, nr, NULL)) > >> 373 nr++; > >> 374 > >> 375 return nr; > >> 376 } > >> > >> Because of_irq_to_resource is exported for modules. > >> Or is there any better way how to loop over all interrupts in DT node? > > > > can just explain me why you need to call irq_of_parse_and_map in your driver? > > > > as the irq will be provided in the resources normally > > It is quite a long time I have written this driver on v3.1 or 3.3. > But is this better? > > struct resource *res; > int i = 0; > do { > res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); > if (res) > do something > } while(res); > > Also what about of_irq_to_resource()? Is it deprecated and all drivers > shouldn't use it? > > I have no problem to rewrite the driver to use platform_get_resource. yeah it's better but be aware there is a but in DT that I'm working on to fix if you use irq that are registered by a pdev this will not work I hope to fix it for 3.11 and already send an RFC that fix it Best Regards, J. > > Thanks, > Michal > > -- > Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 > w: www.monstr.eu p: +42-0-721842854 > Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ > Maintainer of Linux kernel - Xilinx Zynq ARM architecture > Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform > > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules 2013-05-31 15:16 ` Jean-Christophe PLAGNIOL-VILLARD (?) @ 2013-05-31 16:45 ` Michal Simek 2013-06-06 8:29 ` Jean-Christophe PLAGNIOL-VILLARD -1 siblings, 1 reply; 21+ messages in thread From: Michal Simek @ 2013-05-31 16:45 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Michal Simek, Grant Likely, devicetree-discuss, linux-kernel, Rob Herring [-- Attachment #1: Type: text/plain, Size: 3010 bytes --] On 05/31/2013 05:16 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 15:57 Fri 31 May , Michal Simek wrote: >> On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>> On 10:14 Fri 31 May , Michal Simek wrote: >>>> Hi Jean-Christophe, >>>> >>>> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>>>> On 15:49 Thu 30 May , Michal Simek wrote: >>>>>> Export of_irq_count for modules. >>>>> >>>>> can you explain why do you need to call of_irq_count >>>> >>>> I need to count number of irq written in the DTS node. >>>> It is not fixed size that's why I need to proper way how to >>>> find it out. >>>> >>>> I am using this loop. >>>> count = of_irq_count(pdev->dev.of_node); >>>> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ >>>> while (count--) { >>>> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); >>>> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); >>>> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, >>>> dev_name(&pdev->dev), &pdev->dev); >>>> if (ret) { >>>> ... >>>> } >>>> } >>>> >>>> But of course if you think that this is incorrect to export it >>>> I can use what it is in of_irq_count body >>>> 368 int of_irq_count(struct device_node *dev) >>>> 369 { >>>> 370 int nr = 0; >>>> 371 >>>> 372 while (of_irq_to_resource(dev, nr, NULL)) >>>> 373 nr++; >>>> 374 >>>> 375 return nr; >>>> 376 } >>>> >>>> Because of_irq_to_resource is exported for modules. >>>> Or is there any better way how to loop over all interrupts in DT node? >>> >>> can just explain me why you need to call irq_of_parse_and_map in your driver? >>> >>> as the irq will be provided in the resources normally >> >> It is quite a long time I have written this driver on v3.1 or 3.3. >> But is this better? >> >> struct resource *res; >> int i = 0; >> do { >> res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); >> if (res) >> do something >> } while(res); >> >> Also what about of_irq_to_resource()? Is it deprecated and all drivers >> shouldn't use it? >> >> I have no problem to rewrite the driver to use platform_get_resource. > yeah it's better but be aware there is a but in DT that I'm working on to fix > if you use irq that are registered by a pdev this will not work > > I hope to fix it for 3.11 > and already send an RFC that fix it ok. good to know. Btw: Let's return to my origin point why not to export of_irq_count for modules? Or opposite question if platform_get_resource is correct way why to export of_irq_to_resource for modules? Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules 2013-05-31 16:45 ` Michal Simek @ 2013-06-06 8:29 ` Jean-Christophe PLAGNIOL-VILLARD 2013-06-06 8:39 ` Michal Simek 0 siblings, 1 reply; 21+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-06-06 8:29 UTC (permalink / raw) To: Michal Simek Cc: Michal Simek, Grant Likely, devicetree-discuss, linux-kernel, Rob Herring On 18:45 Fri 31 May , Michal Simek wrote: > On 05/31/2013 05:16 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > On 15:57 Fri 31 May , Michal Simek wrote: > >> On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > >>> On 10:14 Fri 31 May , Michal Simek wrote: > >>>> Hi Jean-Christophe, > >>>> > >>>> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > >>>>> On 15:49 Thu 30 May , Michal Simek wrote: > >>>>>> Export of_irq_count for modules. > >>>>> > >>>>> can you explain why do you need to call of_irq_count > >>>> > >>>> I need to count number of irq written in the DTS node. > >>>> It is not fixed size that's why I need to proper way how to > >>>> find it out. > >>>> > >>>> I am using this loop. > >>>> count = of_irq_count(pdev->dev.of_node); > >>>> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ > >>>> while (count--) { > >>>> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); > >>>> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); > >>>> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, > >>>> dev_name(&pdev->dev), &pdev->dev); > >>>> if (ret) { > >>>> ... > >>>> } > >>>> } > >>>> > >>>> But of course if you think that this is incorrect to export it > >>>> I can use what it is in of_irq_count body > >>>> 368 int of_irq_count(struct device_node *dev) > >>>> 369 { > >>>> 370 int nr = 0; > >>>> 371 > >>>> 372 while (of_irq_to_resource(dev, nr, NULL)) > >>>> 373 nr++; > >>>> 374 > >>>> 375 return nr; > >>>> 376 } > >>>> > >>>> Because of_irq_to_resource is exported for modules. > >>>> Or is there any better way how to loop over all interrupts in DT node? > >>> > >>> can just explain me why you need to call irq_of_parse_and_map in your driver? > >>> > >>> as the irq will be provided in the resources normally > >> > >> It is quite a long time I have written this driver on v3.1 or 3.3. > >> But is this better? > >> > >> struct resource *res; > >> int i = 0; > >> do { > >> res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); > >> if (res) > >> do something > >> } while(res); > >> > >> Also what about of_irq_to_resource()? Is it deprecated and all drivers > >> shouldn't use it? > >> > >> I have no problem to rewrite the driver to use platform_get_resource. > > yeah it's better but be aware there is a but in DT that I'm working on to fix > > if you use irq that are registered by a pdev this will not work > > > > I hope to fix it for 3.11 > > and already send an RFC that fix it > > ok. good to know. Btw: Let's return to my origin point why not to > export of_irq_count for modules? > Or opposite question if platform_get_resource is correct way > why to export of_irq_to_resource for modules? for old ppc drivers that are not converted yet to pdev if you can do so just use pdev resource I should have fix the pb or irq_domain hopefully for 3.11 Best Regards, J. > > Thanks, > Michal > > -- > Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 > w: www.monstr.eu p: +42-0-721842854 > Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ > Maintainer of Linux kernel - Xilinx Zynq ARM architecture > Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform > > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules 2013-06-06 8:29 ` Jean-Christophe PLAGNIOL-VILLARD @ 2013-06-06 8:39 ` Michal Simek 2013-06-06 11:55 ` Grant Likely 2013-06-06 14:49 ` Jean-Christophe PLAGNIOL-VILLARD 0 siblings, 2 replies; 21+ messages in thread From: Michal Simek @ 2013-06-06 8:39 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Michal Simek, Michal Simek, Grant Likely, devicetree-discuss, linux-kernel, Rob Herring [-- Attachment #1: Type: text/plain, Size: 3890 bytes --] On 06/06/2013 10:29 AM, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 18:45 Fri 31 May , Michal Simek wrote: >> On 05/31/2013 05:16 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>> On 15:57 Fri 31 May , Michal Simek wrote: >>>> On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>>>> On 10:14 Fri 31 May , Michal Simek wrote: >>>>>> Hi Jean-Christophe, >>>>>> >>>>>> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>>>>>> On 15:49 Thu 30 May , Michal Simek wrote: >>>>>>>> Export of_irq_count for modules. >>>>>>> >>>>>>> can you explain why do you need to call of_irq_count >>>>>> >>>>>> I need to count number of irq written in the DTS node. >>>>>> It is not fixed size that's why I need to proper way how to >>>>>> find it out. >>>>>> >>>>>> I am using this loop. >>>>>> count = of_irq_count(pdev->dev.of_node); >>>>>> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ >>>>>> while (count--) { >>>>>> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); >>>>>> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); >>>>>> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, >>>>>> dev_name(&pdev->dev), &pdev->dev); >>>>>> if (ret) { >>>>>> ... >>>>>> } >>>>>> } >>>>>> >>>>>> But of course if you think that this is incorrect to export it >>>>>> I can use what it is in of_irq_count body >>>>>> 368 int of_irq_count(struct device_node *dev) >>>>>> 369 { >>>>>> 370 int nr = 0; >>>>>> 371 >>>>>> 372 while (of_irq_to_resource(dev, nr, NULL)) >>>>>> 373 nr++; >>>>>> 374 >>>>>> 375 return nr; >>>>>> 376 } >>>>>> >>>>>> Because of_irq_to_resource is exported for modules. >>>>>> Or is there any better way how to loop over all interrupts in DT node? >>>>> >>>>> can just explain me why you need to call irq_of_parse_and_map in your driver? >>>>> >>>>> as the irq will be provided in the resources normally >>>> >>>> It is quite a long time I have written this driver on v3.1 or 3.3. >>>> But is this better? >>>> >>>> struct resource *res; >>>> int i = 0; >>>> do { >>>> res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); >>>> if (res) >>>> do something >>>> } while(res); >>>> >>>> Also what about of_irq_to_resource()? Is it deprecated and all drivers >>>> shouldn't use it? >>>> >>>> I have no problem to rewrite the driver to use platform_get_resource. >>> yeah it's better but be aware there is a but in DT that I'm working on to fix >>> if you use irq that are registered by a pdev this will not work >>> >>> I hope to fix it for 3.11 >>> and already send an RFC that fix it >> >> ok. good to know. Btw: Let's return to my origin point why not to >> export of_irq_count for modules? >> Or opposite question if platform_get_resource is correct way >> why to export of_irq_to_resource for modules? > > for old ppc drivers that are not converted yet to pdev > > if you can do so just use pdev resource I should have fix the pb or irq_domain > hopefully for 3.11 ok. It means it is currently deprecated. I just wanted to be sure that I understand it correctly. I have changed my drivers not to use this function and using resources as we discussed. btw: I have sent one email to device-tree ML about describing missing connection between cpu and the first interrupt controller. Can you please look at it and comment it? https://lists.ozlabs.org/pipermail/devicetree-discuss/2013-May/033955.html Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules 2013-06-06 8:39 ` Michal Simek @ 2013-06-06 11:55 ` Grant Likely 2013-06-06 13:26 ` Michal Simek 2013-06-06 14:49 ` Jean-Christophe PLAGNIOL-VILLARD 1 sibling, 1 reply; 21+ messages in thread From: Grant Likely @ 2013-06-06 11:55 UTC (permalink / raw) To: Michal Simek Cc: Jean-Christophe PLAGNIOL-VILLARD, Michal Simek, devicetree-discuss, Linux Kernel Mailing List, Rob Herring On Thu, Jun 6, 2013 at 9:39 AM, Michal Simek <monstr@monstr.eu> wrote: > On 06/06/2013 10:29 AM, Jean-Christophe PLAGNIOL-VILLARD wrote: >> On 18:45 Fri 31 May , Michal Simek wrote: >>> ok. good to know. Btw: Let's return to my origin point why not to >>> export of_irq_count for modules? >>> Or opposite question if platform_get_resource is correct way >>> why to export of_irq_to_resource for modules? >> >> for old ppc drivers that are not converted yet to pdev >> >> if you can do so just use pdev resource I should have fix the pb or irq_domain >> hopefully for 3.11 > > ok. It means it is currently deprecated. > I just wanted to be sure that I understand it correctly. It's deprecated for platform_devices, but should still be used for other bus types that don't provide the device driver with a list of irqs. For platform devices it is best to use the platform_bus irq table since that is portable regardless of how the device is instantiated. As for not exporting of_irq_count(), I don't have a problem with it, but only if there is a user. It sounds like with the rework you discussed with Jean-Christophe that it is no longer the case. g. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules 2013-06-06 11:55 ` Grant Likely @ 2013-06-06 13:26 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-06-06 13:26 UTC (permalink / raw) To: Grant Likely Cc: Michal Simek, Jean-Christophe PLAGNIOL-VILLARD, Michal Simek, devicetree-discuss, Linux Kernel Mailing List, Rob Herring On 06/06/2013 01:55 PM, Grant Likely wrote: > On Thu, Jun 6, 2013 at 9:39 AM, Michal Simek <monstr@monstr.eu> wrote: >> On 06/06/2013 10:29 AM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>> On 18:45 Fri 31 May , Michal Simek wrote: >>>> ok. good to know. Btw: Let's return to my origin point why not to >>>> export of_irq_count for modules? >>>> Or opposite question if platform_get_resource is correct way >>>> why to export of_irq_to_resource for modules? >>> >>> for old ppc drivers that are not converted yet to pdev >>> >>> if you can do so just use pdev resource I should have fix the pb or irq_domain >>> hopefully for 3.11 >> >> ok. It means it is currently deprecated. >> I just wanted to be sure that I understand it correctly. > > It's deprecated for platform_devices, but should still be used for > other bus types that don't provide the device driver with a list of > irqs. For platform devices it is best to use the platform_bus irq > table since that is portable regardless of how the device is > instantiated. > > As for not exporting of_irq_count(), I don't have a problem with it, > but only if there is a user. It sounds like with the rework you > discussed with Jean-Christophe that it is no longer the case. We have talked about out of tree driver anyway because it targets arm-arm remoteproc AMP which is not in mainline yet. I have changed my drivers and using resource tables. Interesting thing was that long interrupt list is translated to resource table entry per cell and res->end is not used to cover bigger ranges. interrupts = < 0 29 0 0 30 0 0 31 0 0 32 0 0 33 0 0 34 0 0 35 0 0 36 0 0 52 0 0 53 0 0 54 0 0 55 0 0 56 0 0 57 0 0 58 0 0 59 0 0 37 0 0 38 0 0 39 0>; BTW: can you please look at my microblaze email around interrupt handlers? Thanks, Michal ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules 2013-06-06 8:39 ` Michal Simek 2013-06-06 11:55 ` Grant Likely @ 2013-06-06 14:49 ` Jean-Christophe PLAGNIOL-VILLARD [not found] ` <20130606144929.GI19834-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org> 2013-07-18 7:02 ` Michal Simek 1 sibling, 2 replies; 21+ messages in thread From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-06-06 14:49 UTC (permalink / raw) To: Michal Simek Cc: Michal Simek, Grant Likely, devicetree-discuss, linux-kernel, Rob Herring On 10:39 Thu 06 Jun , Michal Simek wrote: > On 06/06/2013 10:29 AM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > On 18:45 Fri 31 May , Michal Simek wrote: > >> On 05/31/2013 05:16 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > >>> On 15:57 Fri 31 May , Michal Simek wrote: > >>>> On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > >>>>> On 10:14 Fri 31 May , Michal Simek wrote: > >>>>>> Hi Jean-Christophe, > >>>>>> > >>>>>> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > >>>>>>> On 15:49 Thu 30 May , Michal Simek wrote: > >>>>>>>> Export of_irq_count for modules. > >>>>>>> > >>>>>>> can you explain why do you need to call of_irq_count > >>>>>> > >>>>>> I need to count number of irq written in the DTS node. > >>>>>> It is not fixed size that's why I need to proper way how to > >>>>>> find it out. > >>>>>> > >>>>>> I am using this loop. > >>>>>> count = of_irq_count(pdev->dev.of_node); > >>>>>> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ > >>>>>> while (count--) { > >>>>>> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); > >>>>>> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); > >>>>>> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, > >>>>>> dev_name(&pdev->dev), &pdev->dev); > >>>>>> if (ret) { > >>>>>> ... > >>>>>> } > >>>>>> } > >>>>>> > >>>>>> But of course if you think that this is incorrect to export it > >>>>>> I can use what it is in of_irq_count body > >>>>>> 368 int of_irq_count(struct device_node *dev) > >>>>>> 369 { > >>>>>> 370 int nr = 0; > >>>>>> 371 > >>>>>> 372 while (of_irq_to_resource(dev, nr, NULL)) > >>>>>> 373 nr++; > >>>>>> 374 > >>>>>> 375 return nr; > >>>>>> 376 } > >>>>>> > >>>>>> Because of_irq_to_resource is exported for modules. > >>>>>> Or is there any better way how to loop over all interrupts in DT node? > >>>>> > >>>>> can just explain me why you need to call irq_of_parse_and_map in your driver? > >>>>> > >>>>> as the irq will be provided in the resources normally > >>>> > >>>> It is quite a long time I have written this driver on v3.1 or 3.3. > >>>> But is this better? > >>>> > >>>> struct resource *res; > >>>> int i = 0; > >>>> do { > >>>> res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); > >>>> if (res) > >>>> do something > >>>> } while(res); > >>>> > >>>> Also what about of_irq_to_resource()? Is it deprecated and all drivers > >>>> shouldn't use it? > >>>> > >>>> I have no problem to rewrite the driver to use platform_get_resource. > >>> yeah it's better but be aware there is a but in DT that I'm working on to fix > >>> if you use irq that are registered by a pdev this will not work > >>> > >>> I hope to fix it for 3.11 > >>> and already send an RFC that fix it > >> > >> ok. good to know. Btw: Let's return to my origin point why not to > >> export of_irq_count for modules? > >> Or opposite question if platform_get_resource is correct way > >> why to export of_irq_to_resource for modules? > > > > for old ppc drivers that are not converted yet to pdev > > > > if you can do so just use pdev resource I should have fix the pb or irq_domain > > hopefully for 3.11 > > ok. It means it is currently deprecated. > I just wanted to be sure that I understand it correctly. > > I have changed my drivers not to use this function and using resources as > we discussed. > > btw: I have sent one email to device-tree ML about describing missing > connection between cpu and the first interrupt controller. > Can you please look at it and comment it? > https://lists.ozlabs.org/pipermail/devicetree-discuss/2013-May/033955.html for the record as discussed with Grant I'm preparing to add a new property to handle interrupts so you will never have to use "interrupt-parent" any more and just do this interrupt-lines = <&aic 5 0 &pioA 4> it will be more like gpio and will allow to have irq from different interrupt-parent in the same node but wait a few I'll be really back next week as I'm half off this week Best Regards, J. > > Thanks, > Michal > > -- > Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 > w: www.monstr.eu p: +42-0-721842854 > Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ > Maintainer of Linux kernel - Xilinx Zynq ARM architecture > Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform > > ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <20130606144929.GI19834-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>]
* Re: [PATCH] of: Export of_irq_count for using in modules [not found] ` <20130606144929.GI19834-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org> @ 2013-06-06 17:16 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-06-06 17:16 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Grant Likely, devicetree-discuss, LKML, Rob Herring [-- Attachment #1.1: Type: text/plain, Size: 5109 bytes --] 2013/6/6 Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org> > On 10:39 Thu 06 Jun , Michal Simek wrote: > > On 06/06/2013 10:29 AM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > > On 18:45 Fri 31 May , Michal Simek wrote: > > >> On 05/31/2013 05:16 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > >>> On 15:57 Fri 31 May , Michal Simek wrote: > > >>>> On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > >>>>> On 10:14 Fri 31 May , Michal Simek wrote: > > >>>>>> Hi Jean-Christophe, > > >>>>>> > > >>>>>> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > > >>>>>>> On 15:49 Thu 30 May , Michal Simek wrote: > > >>>>>>>> Export of_irq_count for modules. > > >>>>>>> > > >>>>>>> can you explain why do you need to call of_irq_count > > >>>>>> > > >>>>>> I need to count number of irq written in the DTS node. > > >>>>>> It is not fixed size that's why I need to proper way how to > > >>>>>> find it out. > > >>>>>> > > >>>>>> I am using this loop. > > >>>>>> count = of_irq_count(pdev->dev.of_node); > > >>>>>> /* Alloc IRQ based on DTS to be sure that no other driver > will use it */ > > >>>>>> while (count--) { > > >>>>>> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, > count); > > >>>>>> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, > tmp->irq); > > >>>>>> ret = request_irq(tmp->irq, > zynq_remoteproc_interrupt, 0, > > >>>>>> dev_name(&pdev->dev), > &pdev->dev); > > >>>>>> if (ret) { > > >>>>>> ... > > >>>>>> } > > >>>>>> } > > >>>>>> > > >>>>>> But of course if you think that this is incorrect to export it > > >>>>>> I can use what it is in of_irq_count body > > >>>>>> 368 int of_irq_count(struct device_node *dev) > > >>>>>> 369 { > > >>>>>> 370 int nr = 0; > > >>>>>> 371 > > >>>>>> 372 while (of_irq_to_resource(dev, nr, NULL)) > > >>>>>> 373 nr++; > > >>>>>> 374 > > >>>>>> 375 return nr; > > >>>>>> 376 } > > >>>>>> > > >>>>>> Because of_irq_to_resource is exported for modules. > > >>>>>> Or is there any better way how to loop over all interrupts in DT > node? > > >>>>> > > >>>>> can just explain me why you need to call irq_of_parse_and_map in > your driver? > > >>>>> > > >>>>> as the irq will be provided in the resources normally > > >>>> > > >>>> It is quite a long time I have written this driver on v3.1 or 3.3. > > >>>> But is this better? > > >>>> > > >>>> struct resource *res; > > >>>> int i = 0; > > >>>> do { > > >>>> res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); > > >>>> if (res) > > >>>> do something > > >>>> } while(res); > > >>>> > > >>>> Also what about of_irq_to_resource()? Is it deprecated and all > drivers > > >>>> shouldn't use it? > > >>>> > > >>>> I have no problem to rewrite the driver to use > platform_get_resource. > > >>> yeah it's better but be aware there is a but in DT that I'm working > on to fix > > >>> if you use irq that are registered by a pdev this will not work > > >>> > > >>> I hope to fix it for 3.11 > > >>> and already send an RFC that fix it > > >> > > >> ok. good to know. Btw: Let's return to my origin point why not to > > >> export of_irq_count for modules? > > >> Or opposite question if platform_get_resource is correct way > > >> why to export of_irq_to_resource for modules? > > > > > > for old ppc drivers that are not converted yet to pdev > > > > > > if you can do so just use pdev resource I should have fix the pb or > irq_domain > > > hopefully for 3.11 > > > > ok. It means it is currently deprecated. > > I just wanted to be sure that I understand it correctly. > > > > I have changed my drivers not to use this function and using resources as > > we discussed. > > > > btw: I have sent one email to device-tree ML about describing missing > > connection between cpu and the first interrupt controller. > > Can you please look at it and comment it? > > > https://lists.ozlabs.org/pipermail/devicetree-discuss/2013-May/033955.html > > for the record as discussed with Grant I'm preparing to add a new property > to handle interrupts so you will never have to use "interrupt-parent" any > more > and just do this > > interrupt-lines = <&aic 5 0 &pioA 4> > > it will be more like gpio and will allow to have irq from different > interrupt-parent in the same node > > but wait a few I'll be really back next week as I'm half off this week > Good. I am definitely interested in this topic because we can connect and test this pretty easily. Also I hope there will be also description between interrupt controller and cpu. Anyway I will wait till you are back. thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #1.2: Type: text/html, Size: 7723 bytes --] [-- Attachment #2: Type: text/plain, Size: 192 bytes --] _______________________________________________ devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org https://lists.ozlabs.org/listinfo/devicetree-discuss ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules [not found] ` <20130606144929.GI19834-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org> @ 2013-07-18 7:02 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-07-18 7:02 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Michal Simek, Grant Likely, devicetree-discuss, linux-kernel, Rob Herring [-- Attachment #1: Type: text/plain, Size: 4636 bytes --] On 06/06/2013 04:49 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 10:39 Thu 06 Jun , Michal Simek wrote: >> On 06/06/2013 10:29 AM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>> On 18:45 Fri 31 May , Michal Simek wrote: >>>> On 05/31/2013 05:16 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>>>> On 15:57 Fri 31 May , Michal Simek wrote: >>>>>> On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>>>>>> On 10:14 Fri 31 May , Michal Simek wrote: >>>>>>>> Hi Jean-Christophe, >>>>>>>> >>>>>>>> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>>>>>>>> On 15:49 Thu 30 May , Michal Simek wrote: >>>>>>>>>> Export of_irq_count for modules. >>>>>>>>> >>>>>>>>> can you explain why do you need to call of_irq_count >>>>>>>> >>>>>>>> I need to count number of irq written in the DTS node. >>>>>>>> It is not fixed size that's why I need to proper way how to >>>>>>>> find it out. >>>>>>>> >>>>>>>> I am using this loop. >>>>>>>> count = of_irq_count(pdev->dev.of_node); >>>>>>>> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ >>>>>>>> while (count--) { >>>>>>>> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); >>>>>>>> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); >>>>>>>> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, >>>>>>>> dev_name(&pdev->dev), &pdev->dev); >>>>>>>> if (ret) { >>>>>>>> ... >>>>>>>> } >>>>>>>> } >>>>>>>> >>>>>>>> But of course if you think that this is incorrect to export it >>>>>>>> I can use what it is in of_irq_count body >>>>>>>> 368 int of_irq_count(struct device_node *dev) >>>>>>>> 369 { >>>>>>>> 370 int nr = 0; >>>>>>>> 371 >>>>>>>> 372 while (of_irq_to_resource(dev, nr, NULL)) >>>>>>>> 373 nr++; >>>>>>>> 374 >>>>>>>> 375 return nr; >>>>>>>> 376 } >>>>>>>> >>>>>>>> Because of_irq_to_resource is exported for modules. >>>>>>>> Or is there any better way how to loop over all interrupts in DT node? >>>>>>> >>>>>>> can just explain me why you need to call irq_of_parse_and_map in your driver? >>>>>>> >>>>>>> as the irq will be provided in the resources normally >>>>>> >>>>>> It is quite a long time I have written this driver on v3.1 or 3.3. >>>>>> But is this better? >>>>>> >>>>>> struct resource *res; >>>>>> int i = 0; >>>>>> do { >>>>>> res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); >>>>>> if (res) >>>>>> do something >>>>>> } while(res); >>>>>> >>>>>> Also what about of_irq_to_resource()? Is it deprecated and all drivers >>>>>> shouldn't use it? >>>>>> >>>>>> I have no problem to rewrite the driver to use platform_get_resource. >>>>> yeah it's better but be aware there is a but in DT that I'm working on to fix >>>>> if you use irq that are registered by a pdev this will not work >>>>> >>>>> I hope to fix it for 3.11 >>>>> and already send an RFC that fix it >>>> >>>> ok. good to know. Btw: Let's return to my origin point why not to >>>> export of_irq_count for modules? >>>> Or opposite question if platform_get_resource is correct way >>>> why to export of_irq_to_resource for modules? >>> >>> for old ppc drivers that are not converted yet to pdev >>> >>> if you can do so just use pdev resource I should have fix the pb or irq_domain >>> hopefully for 3.11 >> >> ok. It means it is currently deprecated. >> I just wanted to be sure that I understand it correctly. >> >> I have changed my drivers not to use this function and using resources as >> we discussed. >> >> btw: I have sent one email to device-tree ML about describing missing >> connection between cpu and the first interrupt controller. >> Can you please look at it and comment it? >> https://lists.ozlabs.org/pipermail/devicetree-discuss/2013-May/033955.html > > for the record as discussed with Grant I'm preparing to add a new property > to handle interrupts so you will never have to use "interrupt-parent" any more > and just do this > > interrupt-lines = <&aic 5 0 &pioA 4> > > it will be more like gpio and will allow to have irq from different > interrupt-parent in the same node > > but wait a few I'll be really back next week as I'm half off this week Any update on this? Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH] of: Export of_irq_count for using in modules @ 2013-07-18 7:02 ` Michal Simek 0 siblings, 0 replies; 21+ messages in thread From: Michal Simek @ 2013-07-18 7:02 UTC (permalink / raw) To: Jean-Christophe PLAGNIOL-VILLARD Cc: Grant Likely, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Michal Simek, Rob Herring, linux-kernel-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1.1: Type: text/plain, Size: 4636 bytes --] On 06/06/2013 04:49 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 10:39 Thu 06 Jun , Michal Simek wrote: >> On 06/06/2013 10:29 AM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>> On 18:45 Fri 31 May , Michal Simek wrote: >>>> On 05/31/2013 05:16 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>>>> On 15:57 Fri 31 May , Michal Simek wrote: >>>>>> On 05/31/2013 01:00 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>>>>>> On 10:14 Fri 31 May , Michal Simek wrote: >>>>>>>> Hi Jean-Christophe, >>>>>>>> >>>>>>>> On 05/30/2013 10:17 PM, Jean-Christophe PLAGNIOL-VILLARD wrote: >>>>>>>>> On 15:49 Thu 30 May , Michal Simek wrote: >>>>>>>>>> Export of_irq_count for modules. >>>>>>>>> >>>>>>>>> can you explain why do you need to call of_irq_count >>>>>>>> >>>>>>>> I need to count number of irq written in the DTS node. >>>>>>>> It is not fixed size that's why I need to proper way how to >>>>>>>> find it out. >>>>>>>> >>>>>>>> I am using this loop. >>>>>>>> count = of_irq_count(pdev->dev.of_node); >>>>>>>> /* Alloc IRQ based on DTS to be sure that no other driver will use it */ >>>>>>>> while (count--) { >>>>>>>> tmp->irq = irq_of_parse_and_map(pdev->dev.of_node, count); >>>>>>>> dev_info(&pdev->dev, "%d: Alloc irq: %d\n", count, tmp->irq); >>>>>>>> ret = request_irq(tmp->irq, zynq_remoteproc_interrupt, 0, >>>>>>>> dev_name(&pdev->dev), &pdev->dev); >>>>>>>> if (ret) { >>>>>>>> ... >>>>>>>> } >>>>>>>> } >>>>>>>> >>>>>>>> But of course if you think that this is incorrect to export it >>>>>>>> I can use what it is in of_irq_count body >>>>>>>> 368 int of_irq_count(struct device_node *dev) >>>>>>>> 369 { >>>>>>>> 370 int nr = 0; >>>>>>>> 371 >>>>>>>> 372 while (of_irq_to_resource(dev, nr, NULL)) >>>>>>>> 373 nr++; >>>>>>>> 374 >>>>>>>> 375 return nr; >>>>>>>> 376 } >>>>>>>> >>>>>>>> Because of_irq_to_resource is exported for modules. >>>>>>>> Or is there any better way how to loop over all interrupts in DT node? >>>>>>> >>>>>>> can just explain me why you need to call irq_of_parse_and_map in your driver? >>>>>>> >>>>>>> as the irq will be provided in the resources normally >>>>>> >>>>>> It is quite a long time I have written this driver on v3.1 or 3.3. >>>>>> But is this better? >>>>>> >>>>>> struct resource *res; >>>>>> int i = 0; >>>>>> do { >>>>>> res = platform_get_resource(pdev, IORESOURCE_IRQ, i++); >>>>>> if (res) >>>>>> do something >>>>>> } while(res); >>>>>> >>>>>> Also what about of_irq_to_resource()? Is it deprecated and all drivers >>>>>> shouldn't use it? >>>>>> >>>>>> I have no problem to rewrite the driver to use platform_get_resource. >>>>> yeah it's better but be aware there is a but in DT that I'm working on to fix >>>>> if you use irq that are registered by a pdev this will not work >>>>> >>>>> I hope to fix it for 3.11 >>>>> and already send an RFC that fix it >>>> >>>> ok. good to know. Btw: Let's return to my origin point why not to >>>> export of_irq_count for modules? >>>> Or opposite question if platform_get_resource is correct way >>>> why to export of_irq_to_resource for modules? >>> >>> for old ppc drivers that are not converted yet to pdev >>> >>> if you can do so just use pdev resource I should have fix the pb or irq_domain >>> hopefully for 3.11 >> >> ok. It means it is currently deprecated. >> I just wanted to be sure that I understand it correctly. >> >> I have changed my drivers not to use this function and using resources as >> we discussed. >> >> btw: I have sent one email to device-tree ML about describing missing >> connection between cpu and the first interrupt controller. >> Can you please look at it and comment it? >> https://lists.ozlabs.org/pipermail/devicetree-discuss/2013-May/033955.html > > for the record as discussed with Grant I'm preparing to add a new property > to handle interrupts so you will never have to use "interrupt-parent" any more > and just do this > > interrupt-lines = <&aic 5 0 &pioA 4> > > it will be more like gpio and will allow to have irq from different > interrupt-parent in the same node > > but wait a few I'll be really back next week as I'm half off this week Any update on this? Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 263 bytes --] [-- Attachment #2: Type: text/plain, Size: 192 bytes --] _______________________________________________ devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org https://lists.ozlabs.org/listinfo/devicetree-discuss ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2013-07-18 7:03 UTC | newest] Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-05-30 13:49 [PATCH] of: Export of_irq_count for using in modules Michal Simek 2013-05-30 13:49 ` Michal Simek 2013-05-30 20:17 ` Jean-Christophe PLAGNIOL-VILLARD 2013-05-30 20:17 ` Jean-Christophe PLAGNIOL-VILLARD 2013-05-31 8:14 ` Michal Simek 2013-05-31 8:14 ` Michal Simek 2013-05-31 11:00 ` Jean-Christophe PLAGNIOL-VILLARD 2013-05-31 11:00 ` Jean-Christophe PLAGNIOL-VILLARD 2013-05-31 13:57 ` Michal Simek 2013-05-31 13:57 ` Michal Simek 2013-05-31 15:16 ` Jean-Christophe PLAGNIOL-VILLARD 2013-05-31 15:16 ` Jean-Christophe PLAGNIOL-VILLARD 2013-05-31 16:45 ` Michal Simek 2013-06-06 8:29 ` Jean-Christophe PLAGNIOL-VILLARD 2013-06-06 8:39 ` Michal Simek 2013-06-06 11:55 ` Grant Likely 2013-06-06 13:26 ` Michal Simek 2013-06-06 14:49 ` Jean-Christophe PLAGNIOL-VILLARD [not found] ` <20130606144929.GI19834-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org> 2013-06-06 17:16 ` Michal Simek 2013-07-18 7:02 ` Michal Simek 2013-07-18 7:02 ` Michal Simek
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.