of/address: Add of_iomap_nocache
Subsystems (2)
PATCH 1/1 of/address: Add of_iomap_nocache
Add uncached mappings from devicetree nodes similar to regular io mappings.
--- drivers/of/address.c | 19 +++++++++++++++++++ include/linux/of_address.h | 1 + 2 files changed, 20 insertions(+), 0 deletions(-)
drivers/of/address.c +19 -0
@@ -613,3 +613,22 @@ void __iomem *of_iomap(struct device_node *np, int index)return ioremap (res.start,resource_size (&res)); }EXPORT_SYMBOL (of_iomap); + +/** +* of_iomap_nocache - Maps the memory mapped IO for a given +* device_node, using ioremap_nocache. +* @device: the device whose io range will be mapped +* @index: index of the io range +* +* Returns a pointer to the mapped memory +*/ +void __iomem *of_iomap_nocache (struct device_node *np,int index) +{ +struct resource res; + +if (of_address_to_resource (np, index, &res)) +return NULL ; + +return ioremap_nocache (res.start,1 + res.end - res.start); +} +EXPORT_SYMBOL (of_iomap_nocache);
include/linux/of_address.h +1 -0
@@ -12,6 +12,7 @@ extern struct device_node *of_find_matching_node_by_address(const struct of_device_id *matches, u64 base_address);extern void __iomem *of_iomap (struct device_node *device,int index); +extern void __iomem *of_iomap_nocache (struct device_node *device,int index);/* Extract an address from a device, returns the region size and * the address space flags too. The PCI version uses a BAR number
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
From: David Brown <[email protected]>
Date: Thu, 4 Aug 2011 02:53:49 -0700
Quoted 4 lines
Add uncached mappings from devicetree nodes similar to regular io mappings.
Signed-off-by David Brown <[email protected]>
You'll need to add a sparc implementation.
PATCH v2 1/1 of/address: Add of_iomap_nocache
In reply to David BrownAdd uncached mappings from devicetree nodes similar to regular io mappings.
SPARC is coherent, so there this call is the same as regular of_iomap.
---
v2 - Add implementation for SPARC
drivers/of/address.c | 19 +++++++++++++++++++ include/linux/of_address.h | 10 ++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-)
drivers/of/address.c +19 -0
@@ -613,3 +613,22 @@ void __iomem *of_iomap(struct device_node *np, int index)return ioremap (res.start,resource_size (&res)); }EXPORT_SYMBOL (of_iomap); + +/** +* of_iomap_nocache - Maps the memory mapped IO for a given +* device_node, using ioremap_nocache. +* @device: the device whose io range will be mapped +* @index: index of the io range +* +* Returns a pointer to the mapped memory +*/ +void __iomem *of_iomap_nocache (struct device_node *np,int index) +{ +struct resource res; + +if (of_address_to_resource (np, index, &res)) +return NULL ; + +return ioremap_nocache (res.start,1 + res.end - res.start); +} +EXPORT_SYMBOL (of_iomap_nocache);
include/linux/of_address.h +10 -0
@@ -13,6 +13,16 @@ extern struct device_node *of_find_matching_node_by_address( u64 base_address);extern void __iomem *of_iomap (struct device_node *device,int index); +#ifndef SPARC +extern void __iomem *of_iomap_nocache (struct device_node *device,int index); +#else +static inline void __iomem *of_iomap_nocache (struct device_node *device, +int index) +{ +return of_iomap (device, index); +} +#endif +/* Extract an address from a device, returns the region size and * the address space flags too. The PCI version uses a BAR number * instead of an absolute index
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
From: David Brown <[email protected]>
Date: Thu, 4 Aug 2011 03:36:36 -0700
Quoted 7 lines
Add uncached mappings from devicetree nodes similar to regular io mappings.
SPARC is coherent, so there this call is the same as regular
of_iomap.Cc David Miller <davem-fT/PcQaiUtIeIZ0/[email protected]>Signed-off-by David Brown <[email protected]>
Quoted 49 lines · David Brown
Add uncached mappings from devicetree nodes similar to regular io mappings.
SPARC is coherent, so there this call is the same as regular
of_iomap.Cc David Miller <[email protected]>Signed-off-by David Brown <[email protected]>---
v2 - Add implementation for SPARCdrivers/of/address.c | 19 +++++++++++++++++++ include/linux/of_address.h | 10 ++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-)drivers/of/address.c +19
-0@@ -613,3 +613,22 @@ void __iomem *of_iomap(struct device_node *np, int index)return ioremap (res.start,resource_size (&res)); }EXPORT_SYMBOL (of_iomap); + +/** +* of_iomap_nocache - Maps the memory mapped IO for a given +* device_node, using ioremap_nocache. +* @device: the device whose io range will be mapped +* @index: index of the io range +* +* Returns a pointer to the mapped memory +*/ +void __iomem *of_iomap_nocache (struct device_node *np,int index) +{ +struct resource res; + +if (of_address_to_resource (np, index, &res)) +return NULL ; + +return ioremap_nocache (res.start,1 + res.end - res.start); +} +EXPORT_SYMBOL (of_iomap_nocache);include/linux/of_address.h +0
-0@@ -13,6 +13,16 @@ extern struct device_node *of_find_matching_node_by_address( u64 base_address);extern void __iomem *of_iomap (struct device_node *device,int index);
include/linux/of_address.h extern struct device_node *of_find_matching_node_by_address( · line 25
Quoted 10 lines
include/linux/of_address.h +10
-0+#ifndef SPARC +extern void __iomem *of_iomap_nocache (struct device_node *device,int index); +#else +static inline void __iomem *of_iomap_nocache (struct device_node *device, +int index) +{ +return of_iomap (device, index); +} +#endif +
What about adding an of_iomap_prot() to match ioremap_prot().
- k
Quoted 6 lines · David Miller
From: David Brown <[email protected]>
Date: Thu, 4 Aug 2011 03:36:36 -0700Quoted 3 lines
Add uncached mappings from devicetree nodes similar to regular io mappings.
Quoted 6 lines
Quoted 4 lines
SPARC is coherent, so there this call is the same as regular
of_iomap.Cc David Miller <[email protected]>Signed-off-by David Brown <[email protected]>Acked-by David S. Miller <[email protected]>
Okay, I'll pick it up when I see patches that use it.
g.
Quoted 11 lines · Kumar Gala
Quoted 6 lines · David Brown
Add uncached mappings from devicetree nodes similar to regular io mappings.
SPARC is coherent, so there this call is the same as regular
of_iomap.+extern void
__iomem*of_iomap_nocache(structdevice_node*device, int index);What about adding an
of_iomap_prot()to matchioremap_prot().
It can be done, but I actually have a use for nocache. We can probably add the prot version when first needed.
David
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 9 lines · David Miller
From: David Brown <[email protected]>
Date: Thu, 4 Aug 2011 02:53:49 -0700Quoted 4 lines
Add uncached mappings from devicetree nodes similar to regular io mappings.
Signed-off-by David Brown <[email protected]>You'll need to add a sparc implementation.
Sparc just defines ioremap_nocache to ioremap, so is that really needed?
Rob
Quoted 4 lines · Rob Herring
Quoted 3 lines · David Miller
From: David Brown <[email protected]>
Date: Thu, 4 Aug 2011 02:53:49 -0700
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Add uncached mappings from devicetree nodes similar to regular io mappings.
Signed-off-by David Brown <[email protected]>You'll need to add a sparc implementation.
Sparc just defines
ioremap_nocacheto ioremap, so is that really needed?
The first version of my patch only defines the new function in a file compiled on non-SPARC targets.
David
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 30 lines · David Brown
Add uncached mappings from devicetree nodes similar to regular io mappings.
SPARC is coherent, so there this call is the same as regular
of_iomap.Cc David Miller<[email protected]>Signed-off-by David Brown<[email protected]>---
v2 - Add implementation for SPARCdrivers/of/address.c | 19 +++++++++++++++++++ include/linux/of_address.h | 10 ++++++++++ 2 files changed, 29 insertions(+), 0 deletions(-)drivers/of/address.c +8
-0@@ -613,3 +613,22 @@ void __iomem *of_iomap(struct device_node *np, int index)return ioremap (res.start,resource_size (&res)); }EXPORT_SYMBOL (of_iomap); + +/** +* of_iomap_nocache - Maps the memory mapped IO for a given +* device_node, using ioremap_nocache. +* @device: the device whose io range will be mapped +* @index: index of the io range +* +* Returns a pointer to the mapped memory
drivers/of/address.c void __iomem *of_iomap(struct device_node *np, int index) · line 633
Quoted 10 lines
drivers/of/address.c +10
-0+*/ +void __iomem *of_iomap_nocache (struct device_node *np,int index) +{ +struct resource res; + +if (of_address_to_resource (np, index,&res)) +return NULL ; + +return ioremap_nocache (res.start,1 + res.end - res.start); +}
resource_size()?
Quoted 8 lines
drivers/of/address.c +1
-0+EXPORT_SYMBOL (of_iomap_nocache);include/linux/of_address.h +0
-0@@ -13,6 +13,16 @@ extern struct device_node *of_find_matching_node_by_address( u64 base_address);extern void __iomem *of_iomap (struct device_node *device,int index);
include/linux/of_address.h extern struct device_node *of_find_matching_node_by_address( · line 24
Quoted 10 lines
include/linux/of_address.h +9
-0+#ifndef SPARC +extern void __iomem *of_iomap_nocache (struct device_node *device,int index); +#else +static inline void __iomem *of_iomap_nocache (struct device_node *device, +int index) +{ +return of_iomap (device, index); +} +#endif
Why is sparc special? It looks like it defines ioremap_nocache() as ioremap() just like powerpc and some others, so shouldn't the normal of_iomap_nocache just work?
-Scott
Quoted 6 lines · Scott Wood
Quoted 6 lines
(quoted diff) +2
-0+#ifndef SPARC +extern void __iomem *of_iomap_nocache(struct device_node *device, intindex);
include/linux/of_address.h +3
-0+#else +static inline void __iomem *of_iomap_nocache (struct device_node *device, + int index)
Quoted 8 lines
include/linux/of_address.h extern struct device_node *of_find_matching_node_by_address( · line 24
Quoted 4 lines
include/linux/of_address.h +4
-0+{ + return of_iomap(device, index); +} +#endif Why is sparc special? It looks like it defines
ioremap_nocache()asioremap()just like powerpc and some others, so shouldn't the normalof_iomap_nocachejust work?
No, the implementation is completely different. SPARC preparses all the reg properties. Everyone else does not.
g.
From: Rob Herring <[email protected]>
Date: Thu, 04 Aug 2011 10:52:58 -0500
Quoted 12 lines · David Miller
Quoted 9 lines
From: David Brown <[email protected]>
Date: Thu, 4 Aug 2011 02:53:49 -0700Quoted 4 lines
Add uncached mappings from devicetree nodes similar to regular io mappings.
Signed-off-by David Brown <[email protected]>You'll need to add a sparc implementation.
Sparc just defines
ioremap_nocacheto ioremap, so is that really needed?
Yes because if someone uses this of_iomap_nocache() in a driver the sparc build is going to fail, we need as least the define to make it equal to of_iomap() as David did in his follow-on patch.