* [PATCH 1/3] of/pci: Add dma-ranges parsing support
[not found] <f10055cc-4430-ff30-f892-3d3d6f24354c@sigmadesigns.com>
@ 2017-08-29 14:25 ` Marc Gonzalez
2017-08-31 11:55 ` Linus Walleij
2017-09-01 18:27 ` Rob Herring
0 siblings, 2 replies; 3+ messages in thread
From: Marc Gonzalez @ 2017-08-29 14:25 UTC (permalink / raw)
To: Rob Herring, Frank Rowand, Mark Rutland
Cc: Bjorn Helgaas, Marc Zyngier, linux-pci, Linux ARM, Robin Murphy,
Liviu Dudau, Thibaud Cornic, Mason, Andrew Murray,
Thomas Petazzoni, Linus Walleij, Jason Cooper, DT
Several host bridge drivers duplicate of_pci_range_parser_init()
in order to parse their dma-ranges property.
Provide of_pci_dma_range_parser_init() for that use-case.
Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
---
drivers/of/address.c | 19 ++++++++++++++++---
include/linux/of_address.h | 10 +++++++++-
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 580bbf6ca2b1..4cfd29e4ee1b 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -232,8 +232,8 @@ int of_pci_address_to_resource(struct device_node *dev, int bar,
}
EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
-int of_pci_range_parser_init(struct of_pci_range_parser *parser,
- struct device_node *node)
+static int parser_init(struct of_pci_range_parser *parser,
+ struct device_node *node, const char *name)
{
const int na = 3, ns = 2;
int rlen;
@@ -242,7 +242,7 @@ int of_pci_range_parser_init(struct of_pci_range_parser *parser,
parser->pna = of_n_addr_cells(node);
parser->np = parser->pna + na + ns;
- parser->range = of_get_property(node, "ranges", &rlen);
+ parser->range = of_get_property(node, name, &rlen);
if (parser->range == NULL)
return -ENOENT;
@@ -250,8 +250,21 @@ int of_pci_range_parser_init(struct of_pci_range_parser *parser,
return 0;
}
+
+int of_pci_range_parser_init(struct of_pci_range_parser *parser,
+ struct device_node *node)
+{
+ return parser_init(parser, node, "ranges");
+}
EXPORT_SYMBOL_GPL(of_pci_range_parser_init);
+int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser,
+ struct device_node *node)
+{
+ return parser_init(parser, node, "dma-ranges");
+}
+EXPORT_SYMBOL_GPL(of_pci_dma_range_parser_init);
+
struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser,
struct of_pci_range *range)
{
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 37864734ca50..8beed2de98e9 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -49,6 +49,8 @@ extern const __be32 *of_get_address(struct device_node *dev, int index,
extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
struct device_node *node);
+extern int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser,
+ struct device_node *node);
extern struct of_pci_range *of_pci_range_parser_one(
struct of_pci_range_parser *parser,
struct of_pci_range *range);
@@ -85,7 +87,13 @@ static inline const __be32 *of_get_address(struct device_node *dev, int index,
static inline int of_pci_range_parser_init(struct of_pci_range_parser *parser,
struct device_node *node)
{
- return -1;
+ return -ENOSYS;
+}
+
+static inline int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser,
+ struct device_node *node)
+{
+ return -ENOSYS;
}
static inline struct of_pci_range *of_pci_range_parser_one(
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] of/pci: Add dma-ranges parsing support
2017-08-29 14:25 ` [PATCH 1/3] of/pci: Add dma-ranges parsing support Marc Gonzalez
@ 2017-08-31 11:55 ` Linus Walleij
2017-09-01 18:27 ` Rob Herring
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-08-31 11:55 UTC (permalink / raw)
To: Marc Gonzalez
Cc: Rob Herring, Frank Rowand, Mark Rutland, Bjorn Helgaas,
Marc Zyngier, linux-pci, Linux ARM, Robin Murphy, Liviu Dudau,
Thibaud Cornic, Mason, Andrew Murray, Thomas Petazzoni,
Jason Cooper, DT
On Tue, Aug 29, 2017 at 4:25 PM, Marc Gonzalez
<marc_gonzalez@sigmadesigns.com> wrote:
> Several host bridge drivers duplicate of_pci_range_parser_init()
> in order to parse their dma-ranges property.
>
> Provide of_pci_dma_range_parser_init() for that use-case.
>
> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Looks good to me.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/3] of/pci: Add dma-ranges parsing support
2017-08-29 14:25 ` [PATCH 1/3] of/pci: Add dma-ranges parsing support Marc Gonzalez
2017-08-31 11:55 ` Linus Walleij
@ 2017-09-01 18:27 ` Rob Herring
1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2017-09-01 18:27 UTC (permalink / raw)
To: Marc Gonzalez
Cc: Frank Rowand, Mark Rutland, Thomas Petazzoni, DT, Jason Cooper,
Mason, Marc Zyngier, linux-pci, Thibaud Cornic, Andrew Murray,
Liviu Dudau, Bjorn Helgaas, Robin Murphy, Linus Walleij,
Linux ARM
On Tue, Aug 29, 2017 at 9:25 AM, Marc Gonzalez
<marc_gonzalez@sigmadesigns.com> wrote:
> Several host bridge drivers duplicate of_pci_range_parser_init()
> in order to parse their dma-ranges property.
>
> Provide of_pci_dma_range_parser_init() for that use-case.
>
> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
> ---
> drivers/of/address.c | 19 ++++++++++++++++---
> include/linux/of_address.h | 10 +++++++++-
> 2 files changed, 25 insertions(+), 4 deletions(-)
Reviewed-by: Rob Herring <robh@kernel.org>
I'm assuming this will go thru the PCI tree.
Rob
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-01 18:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <f10055cc-4430-ff30-f892-3d3d6f24354c@sigmadesigns.com>
2017-08-29 14:25 ` [PATCH 1/3] of/pci: Add dma-ranges parsing support Marc Gonzalez
2017-08-31 11:55 ` Linus Walleij
2017-09-01 18:27 ` Rob Herring
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).