diff mbox

[U-Boot,v4] dm: core: implement dev_map_phsymem()

Message ID 1462507105-28131-1-git-send-email-vigneshr@ti.com
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Commit Message

Vignesh Raghavendra May 6, 2016, 3:58 a.m. UTC
This API helps to map physical register addresss pace of device to
virtual address space easily. Its just a wrapper around map_physmem()
with MAP_NOCACHE flag.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Suggested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jagan Teki <jteki@openedev.com>

---

v4: Reorder include files to avoid build warning on dra7xx.

 drivers/core/device.c | 6 ++++++
 include/dm/device.h   | 9 +++++++++
 2 files changed, 15 insertions(+)

Comments

Jagan Teki May 6, 2016, 3:30 p.m. UTC | #1
On 6 May 2016 at 09:28, Vignesh R <vigneshr@ti.com> wrote:
> This API helps to map physical register addresss pace of device to
> virtual address space easily. Its just a wrapper around map_physmem()
> with MAP_NOCACHE flag.
>
> Signed-off-by: Vignesh R <vigneshr@ti.com>
> Suggested-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Jagan Teki <jteki@openedev.com>
>
> ---
>
> v4: Reorder include files to avoid build warning on dra7xx.
>
>  drivers/core/device.c | 6 ++++++
>  include/dm/device.h   | 9 +++++++++
>  2 files changed, 15 insertions(+)
>
> diff --git a/drivers/core/device.c b/drivers/core/device.c
> index 1322991d6c7b..6b19b4b8c7a0 100644
> --- a/drivers/core/device.c
> +++ b/drivers/core/device.c
> @@ -10,6 +10,7 @@
>   */
>
>  #include <common.h>
> +#include <asm/io.h>

I think this look same as v3 [1] please check?

>  #include <fdtdec.h>
>  #include <fdt_support.h>
>  #include <malloc.h>

[1] https://patchwork.ozlabs.org/patch/618361/
Vignesh Raghavendra May 6, 2016, 3:46 p.m. UTC | #2
On 5/6/2016 9:00 PM, Jagan Teki wrote:
> On 6 May 2016 at 09:28, Vignesh R <vigneshr@ti.com> wrote:
>> This API helps to map physical register addresss pace of device to
>> virtual address space easily. Its just a wrapper around map_physmem()
>> with MAP_NOCACHE flag.
>>
>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>> Suggested-by: Simon Glass <sjg@chromium.org>
>> Reviewed-by: Jagan Teki <jteki@openedev.com>
>>
>> ---
>>
>> v4: Reorder include files to avoid build warning on dra7xx.
>>
>>  drivers/core/device.c | 6 ++++++
>>  include/dm/device.h   | 9 +++++++++
>>  2 files changed, 15 insertions(+)
>>
>> diff --git a/drivers/core/device.c b/drivers/core/device.c
>> index 1322991d6c7b..6b19b4b8c7a0 100644
>> --- a/drivers/core/device.c
>> +++ b/drivers/core/device.c
>> @@ -10,6 +10,7 @@
>>   */
>>
>>  #include <common.h>
>> +#include <asm/io.h>
> 
> I think this look same as v3 [1] please check?

Yeah, v3 has the include files in correct. Please ignore this patch.
Sorry for the spam.

Regards
Vignesh.
Jagan Teki May 6, 2016, 4:30 p.m. UTC | #3
On 6 May 2016 at 21:16, R, Vignesh <vigneshr@ti.com> wrote:
>
>
> On 5/6/2016 9:00 PM, Jagan Teki wrote:
>> On 6 May 2016 at 09:28, Vignesh R <vigneshr@ti.com> wrote:
>>> This API helps to map physical register addresss pace of device to
>>> virtual address space easily. Its just a wrapper around map_physmem()
>>> with MAP_NOCACHE flag.
>>>
>>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>>> Suggested-by: Simon Glass <sjg@chromium.org>
>>> Reviewed-by: Jagan Teki <jteki@openedev.com>
>>>
>>> ---
>>>
>>> v4: Reorder include files to avoid build warning on dra7xx.
>>>
>>>  drivers/core/device.c | 6 ++++++
>>>  include/dm/device.h   | 9 +++++++++
>>>  2 files changed, 15 insertions(+)
>>>
>>> diff --git a/drivers/core/device.c b/drivers/core/device.c
>>> index 1322991d6c7b..6b19b4b8c7a0 100644
>>> --- a/drivers/core/device.c
>>> +++ b/drivers/core/device.c
>>> @@ -10,6 +10,7 @@
>>>   */
>>>
>>>  #include <common.h>
>>> +#include <asm/io.h>
>>
>> I think this look same as v3 [1] please check?
>
> Yeah, v3 has the include files in correct. Please ignore this patch.
> Sorry for the spam.

Did you test this series on top of master?
Vignesh Raghavendra May 9, 2016, 4:09 a.m. UTC | #4
On 05/06/2016 10:00 PM, Jagan Teki wrote:
> On 6 May 2016 at 21:16, R, Vignesh <vigneshr@ti.com> wrote:
>>
>>
>> On 5/6/2016 9:00 PM, Jagan Teki wrote:
>>> On 6 May 2016 at 09:28, Vignesh R <vigneshr@ti.com> wrote:
>>>> This API helps to map physical register addresss pace of device to
>>>> virtual address space easily. Its just a wrapper around map_physmem()
>>>> with MAP_NOCACHE flag.
>>>>
>>>> Signed-off-by: Vignesh R <vigneshr@ti.com>
>>>> Suggested-by: Simon Glass <sjg@chromium.org>
>>>> Reviewed-by: Jagan Teki <jteki@openedev.com>
>>>>
>>>> ---
>>>>
>>>> v4: Reorder include files to avoid build warning on dra7xx.
>>>>
>>>>  drivers/core/device.c | 6 ++++++
>>>>  include/dm/device.h   | 9 +++++++++
>>>>  2 files changed, 15 insertions(+)
>>>>
>>>> diff --git a/drivers/core/device.c b/drivers/core/device.c
>>>> index 1322991d6c7b..6b19b4b8c7a0 100644
>>>> --- a/drivers/core/device.c
>>>> +++ b/drivers/core/device.c
>>>> @@ -10,6 +10,7 @@
>>>>   */
>>>>
>>>>  #include <common.h>
>>>> +#include <asm/io.h>
>>>
>>> I think this look same as v3 [1] please check?
>>
>> Yeah, v3 has the include files in correct. Please ignore this patch.
>> Sorry for the spam.
> 
> Did you test this series on top of master?

Yes, this is tested on top of 2016.05-rc3
diff mbox

Patch

diff --git a/drivers/core/device.c b/drivers/core/device.c
index 1322991d6c7b..6b19b4b8c7a0 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -10,6 +10,7 @@ 
  */
 
 #include <common.h>
+#include <asm/io.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
 #include <malloc.h>
@@ -678,6 +679,11 @@  void *dev_get_addr_ptr(struct udevice *dev)
 	return (void *)(uintptr_t)dev_get_addr_index(dev, 0);
 }
 
+void *dev_map_physmem(struct udevice *dev, unsigned long size)
+{
+	return map_physmem(dev_get_addr(dev), size, MAP_NOCACHE);
+}
+
 bool device_has_children(struct udevice *dev)
 {
 	return !list_empty(&dev->child_head);
diff --git a/include/dm/device.h b/include/dm/device.h
index 8970fc015c7e..5253b5410d9a 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -463,6 +463,15 @@  fdt_addr_t dev_get_addr(struct udevice *dev);
  */
 void *dev_get_addr_ptr(struct udevice *dev);
 
+/* * dev_map_physmem() - Map bus memory into CPU space
+ *
+ * @dev: Pointer to device
+ * @size: size of the memory to map
+ *
+ * @return addr
+ */
+void *dev_map_physmem(struct udevice *dev, unsigned long size);
+
 /**
  * dev_get_addr_index() - Get the indexed reg property of a device
  *