* [PATCH] of/address: Add of_iomap_nocache
@ 2011-08-04 9:53 David Brown
2011-08-04 10:12 ` David Miller
2011-08-04 10:36 ` [PATCH v2] " David Brown
0 siblings, 2 replies; 12+ messages in thread
From: David Brown @ 2011-08-04 9:53 UTC (permalink / raw)
To: Grant Likely; +Cc: David Brown, linux-kernel, linux-arm-msm, devicetree-discuss
Add uncached mappings from devicetree nodes similar to regular io
mappings.
Signed-off-by: David Brown <davidb@codeaurora.org>
---
drivers/of/address.c | 19 +++++++++++++++++++
include/linux/of_address.h | 1 +
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 72c33fb..9bee7f8 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -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);
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 3118623..3ce1277 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -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
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] of/address: Add of_iomap_nocache
2011-08-04 9:53 [PATCH] of/address: Add of_iomap_nocache David Brown
@ 2011-08-04 10:12 ` David Miller
2011-08-04 15:52 ` Rob Herring
2011-08-04 10:36 ` [PATCH v2] " David Brown
1 sibling, 1 reply; 12+ messages in thread
From: David Miller @ 2011-08-04 10:12 UTC (permalink / raw)
To: davidb; +Cc: grant.likely, linux-kernel, linux-arm-msm, devicetree-discuss
From: David Brown <davidb@codeaurora.org>
Date: Thu, 4 Aug 2011 02:53:49 -0700
> Add uncached mappings from devicetree nodes similar to regular io
> mappings.
>
> Signed-off-by: David Brown <davidb@codeaurora.org>
You'll need to add a sparc implementation.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2] of/address: Add of_iomap_nocache
2011-08-04 9:53 [PATCH] of/address: Add of_iomap_nocache David Brown
2011-08-04 10:12 ` David Miller
@ 2011-08-04 10:36 ` David Brown
[not found] ` <1312454196-31028-1-git-send-email-davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
` (2 more replies)
1 sibling, 3 replies; 12+ messages in thread
From: David Brown @ 2011-08-04 10:36 UTC (permalink / raw)
To: Grant Likely
Cc: David Brown, linux-kernel, linux-arm-msm, devicetree-discuss,
David Miller
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@davemloft.net>
Signed-off-by: David Brown <davidb@codeaurora.org>
---
v2 - Add implementation for SPARC
drivers/of/address.c | 19 +++++++++++++++++++
include/linux/of_address.h | 10 ++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/drivers/of/address.c b/drivers/of/address.c
index 72c33fb..9bee7f8 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -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);
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 3118623..0e4734b 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -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
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2] of/address: Add of_iomap_nocache
[not found] ` <1312454196-31028-1-git-send-email-davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2011-08-04 11:51 ` David Miller
2011-08-04 12:53 ` Grant Likely
0 siblings, 1 reply; 12+ messages in thread
From: David Miller @ 2011-08-04 11:51 UTC (permalink / raw)
To: davidb-sgV2jX0FEOL9JmXXK+q4OQ
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
From: David Brown <davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Date: Thu, 4 Aug 2011 03:36:36 -0700
> 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/mPfg9Q@public.gmane.org>
> Signed-off-by: David Brown <davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] of/address: Add of_iomap_nocache
2011-08-04 10:36 ` [PATCH v2] " David Brown
[not found] ` <1312454196-31028-1-git-send-email-davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2011-08-04 12:44 ` Kumar Gala
2011-08-04 13:10 ` David Brown
2011-08-04 16:56 ` Scott Wood
2 siblings, 1 reply; 12+ messages in thread
From: Kumar Gala @ 2011-08-04 12:44 UTC (permalink / raw)
To: David Brown
Cc: Grant Likely, devicetree-discuss, linux-arm-msm, linux-kernel,
David Miller
On Aug 4, 2011, at 5:36 AM, David Brown wrote:
> 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@davemloft.net>
> Signed-off-by: David Brown <davidb@codeaurora.org>
> ---
> v2 - Add implementation for SPARC
>
> drivers/of/address.c | 19 +++++++++++++++++++
> include/linux/of_address.h | 10 ++++++++++
> 2 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index 72c33fb..9bee7f8 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -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);
> diff --git a/include/linux/of_address.h b/include/linux/of_address.h
> index 3118623..0e4734b 100644
> --- a/include/linux/of_address.h
> +++ b/include/linux/of_address.h
> @@ -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
> +
What about adding an of_iomap_prot() to match ioremap_prot().
- k
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] of/address: Add of_iomap_nocache
2011-08-04 11:51 ` David Miller
@ 2011-08-04 12:53 ` Grant Likely
0 siblings, 0 replies; 12+ messages in thread
From: Grant Likely @ 2011-08-04 12:53 UTC (permalink / raw)
To: David Miller; +Cc: davidb, linux-kernel, linux-arm-msm, devicetree-discuss
On Thu, Aug 4, 2011 at 12:51 PM, David Miller <davem@davemloft.net> wrote:
> From: David Brown <davidb@codeaurora.org>
> Date: Thu, 4 Aug 2011 03:36:36 -0700
>
>> 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@davemloft.net>
>> Signed-off-by: David Brown <davidb@codeaurora.org>
>
> Acked-by: David S. Miller <davem@davemloft.net>
Okay, I'll pick it up when I see patches that use it.
g.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] of/address: Add of_iomap_nocache
2011-08-04 12:44 ` Kumar Gala
@ 2011-08-04 13:10 ` David Brown
0 siblings, 0 replies; 12+ messages in thread
From: David Brown @ 2011-08-04 13:10 UTC (permalink / raw)
To: Kumar Gala
Cc: David Brown, Grant Likely, devicetree-discuss, linux-arm-msm,
linux-kernel, David Miller
On Thu, Aug 04, 2011 at 07:44:07AM -0500, Kumar Gala wrote:
>
> On Aug 4, 2011, at 5:36 AM, David Brown wrote:
>
> > 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(struct device_node *device, int index);
>
> What about adding an of_iomap_prot() to match ioremap_prot().
It can be done, but I actually have a use for nocache. We can
probably add the prot version when first needed.
David
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] of/address: Add of_iomap_nocache
2011-08-04 10:12 ` David Miller
@ 2011-08-04 15:52 ` Rob Herring
2011-08-04 16:17 ` David Brown
2011-08-04 23:08 ` David Miller
0 siblings, 2 replies; 12+ messages in thread
From: Rob Herring @ 2011-08-04 15:52 UTC (permalink / raw)
To: David Miller; +Cc: davidb, linux-arm-msm, devicetree-discuss, linux-kernel
On 08/04/2011 05:12 AM, David Miller wrote:
> From: David Brown <davidb@codeaurora.org>
> Date: Thu, 4 Aug 2011 02:53:49 -0700
>
>> Add uncached mappings from devicetree nodes similar to regular io
>> mappings.
>>
>> Signed-off-by: David Brown <davidb@codeaurora.org>
>
> You'll need to add a sparc implementation.
Sparc just defines ioremap_nocache to ioremap, so is that really needed?
Rob
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] of/address: Add of_iomap_nocache
2011-08-04 15:52 ` Rob Herring
@ 2011-08-04 16:17 ` David Brown
2011-08-04 23:08 ` David Miller
1 sibling, 0 replies; 12+ messages in thread
From: David Brown @ 2011-08-04 16:17 UTC (permalink / raw)
To: Rob Herring
Cc: David Miller, davidb, linux-arm-msm, devicetree-discuss,
linux-kernel
On Thu, Aug 04, 2011 at 10:52:58AM -0500, Rob Herring wrote:
> On 08/04/2011 05:12 AM, David Miller wrote:
> > From: David Brown <davidb@codeaurora.org>
> > Date: Thu, 4 Aug 2011 02:53:49 -0700
> >
> >> Add uncached mappings from devicetree nodes similar to regular io
> >> mappings.
> >>
> >> Signed-off-by: David Brown <davidb@codeaurora.org>
> >
> > You'll need to add a sparc implementation.
>
> Sparc just defines ioremap_nocache to 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
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] of/address: Add of_iomap_nocache
2011-08-04 10:36 ` [PATCH v2] " David Brown
[not found] ` <1312454196-31028-1-git-send-email-davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-08-04 12:44 ` Kumar Gala
@ 2011-08-04 16:56 ` Scott Wood
2011-08-04 16:58 ` Grant Likely
2 siblings, 1 reply; 12+ messages in thread
From: Scott Wood @ 2011-08-04 16:56 UTC (permalink / raw)
To: David Brown
Cc: Grant Likely, devicetree-discuss, linux-arm-msm, linux-kernel,
David Miller
On 08/04/2011 05:36 AM, David Brown wrote:
> 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@davemloft.net>
> Signed-off-by: David Brown<davidb@codeaurora.org>
> ---
> v2 - Add implementation for SPARC
>
> drivers/of/address.c | 19 +++++++++++++++++++
> include/linux/of_address.h | 10 ++++++++++
> 2 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/of/address.c b/drivers/of/address.c
> index 72c33fb..9bee7f8 100644
> --- a/drivers/of/address.c
> +++ b/drivers/of/address.c
> @@ -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);
> +}
resource_size()?
> +EXPORT_SYMBOL(of_iomap_nocache);
> diff --git a/include/linux/of_address.h b/include/linux/of_address.h
> index 3118623..0e4734b 100644
> --- a/include/linux/of_address.h
> +++ b/include/linux/of_address.h
> @@ -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
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v2] of/address: Add of_iomap_nocache
2011-08-04 16:56 ` Scott Wood
@ 2011-08-04 16:58 ` Grant Likely
0 siblings, 0 replies; 12+ messages in thread
From: Grant Likely @ 2011-08-04 16:58 UTC (permalink / raw)
To: Scott Wood
Cc: David Brown, devicetree-discuss, linux-arm-msm, linux-kernel,
David Miller
On Thu, Aug 4, 2011 at 5:56 PM, Scott Wood <scottwood@freescale.com> wrote:
>> +#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?
No, the implementation is completely different. SPARC preparses all
the reg properties. Everyone else does not.
g.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] of/address: Add of_iomap_nocache
2011-08-04 15:52 ` Rob Herring
2011-08-04 16:17 ` David Brown
@ 2011-08-04 23:08 ` David Miller
1 sibling, 0 replies; 12+ messages in thread
From: David Miller @ 2011-08-04 23:08 UTC (permalink / raw)
To: robherring2; +Cc: davidb, linux-arm-msm, devicetree-discuss, linux-kernel
From: Rob Herring <robherring2@gmail.com>
Date: Thu, 04 Aug 2011 10:52:58 -0500
> On 08/04/2011 05:12 AM, David Miller wrote:
>> From: David Brown <davidb@codeaurora.org>
>> Date: Thu, 4 Aug 2011 02:53:49 -0700
>>
>>> Add uncached mappings from devicetree nodes similar to regular io
>>> mappings.
>>>
>>> Signed-off-by: David Brown <davidb@codeaurora.org>
>>
>> You'll need to add a sparc implementation.
>
> Sparc just defines ioremap_nocache to 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.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-08-04 23:08 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-04 9:53 [PATCH] of/address: Add of_iomap_nocache David Brown
2011-08-04 10:12 ` David Miller
2011-08-04 15:52 ` Rob Herring
2011-08-04 16:17 ` David Brown
2011-08-04 23:08 ` David Miller
2011-08-04 10:36 ` [PATCH v2] " David Brown
[not found] ` <1312454196-31028-1-git-send-email-davidb-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-08-04 11:51 ` David Miller
2011-08-04 12:53 ` Grant Likely
2011-08-04 12:44 ` Kumar Gala
2011-08-04 13:10 ` David Brown
2011-08-04 16:56 ` Scott Wood
2011-08-04 16:58 ` Grant Likely
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).