dm: core: add functions to get/remap I/O addresses by name
PATCH 1/1 dm: core: add functions to get/remap I/O addresses by name
--- drivers/core/fdtaddr.c | 10 ++++++++++ drivers/core/read.c | 20 ++++++++++++++++++++ include/dm/fdtaddr.h | 13 +++++++++++++ include/dm/read.h | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+)
drivers/core/fdtaddr.c +10 -0
@@ -146,6 +146,16 @@ void *devfdt_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +void *devfdt_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =devfdt_get_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +void *devfdt_remap_addr (struct udevice *dev) {return devfdt_remap_addr_index (dev,0 );
drivers/core/read.c +20 -0
@@ -69,6 +69,26 @@ void *dev_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char *name) +{ +int index =dev_read_stringlist_search (dev,"reg-names" , name); + +if (index <0 ) +return FDT_ADDR_T_NONE ; +else +return dev_read_addr_index (dev, index); +} + +void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =dev_read_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +fdt_addr_t dev_read_addr (struct udevice *dev) {return dev_read_addr_index (dev,0 );
include/dm/fdtaddr.h +13 -0
@@ -56,6 +56,19 @@ void *devfdt_remap_addr(struct udevice *dev);void *devfdt_remap_addr_index (struct udevice *dev,int index);/** +* devfdt_remap_addr_name() - Get the reg property of a device, indexed by +* name, as a memory-mapped I/O pointer +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @dev: Pointer to a device +* +* @return Pointer to addr, or NULL if there is no such property +*/ +void *devfdt_remap_addr_name (struct udevice *dev,const char *name); + +/** * devfdt_map_physmem() - Read device address from reg property of the * device node and map the address into CPU address * space.
include/dm/read.h +36 -0
@@ -125,6 +125,31 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);void *dev_remap_addr_index (struct udevice *dev,int index);/** +* dev_read_addr_name() - Get the reg property of a device, indexed by name +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return address or FDT_ADDR_T_NONE if not found +*/ +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char * name); + +/** +* dev_remap_addr_name() - Get the reg property of a device, indexed by name, +* as a memory-mapped I/O pointer +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return pointer or NULL if not found +*/ +void *dev_remap_addr_name (struct udevice *dev,const char * name); + +/** * dev_read_addr() - Get the reg property of a device * * @dev: Device to read from
@@ -494,6 +519,12 @@ static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)return devfdt_get_addr_index (dev, index); } +static inline fdt_addr_t dev_read_addr_name (struct udevice *dev, +const char *name) +{ +return devfdt_get_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr (struct udevice *dev) {return devfdt_get_addr (dev);
@@ -514,6 +545,11 @@ static inline void *dev_remap_addr_index(struct udevice *dev, int index)return devfdt_remap_addr_index (dev, index); } +static inline void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +return devfdt_remap_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr_size (struct udevice *dev,const char *propname,fdt_size_t *sizep)
Signature · 1 line
2.11.0
PATCH 1/1 dm: core: add functions to get/remap I/O addresses by name
Am 29.11.18 um 20:57 schrieb Álvaro Fernández Rojas:
Quoted 7 lines
Signed-off-by Álvaro Fernández Rojas <[email protected]>--- drivers/core/fdtaddr.c | 10 ++++++++++ drivers/core/read.c | 20 ++++++++++++++++++++ include/dm/fdtaddr.h | 13 +++++++++++++ include/dm/read.h | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+)
nice, but I guess Simon will insist on some tests in test/dm/test-fdt.c.
You could copy and adapt dm_test_fdt_remap_addr_flat() and dm_test_fdt_remap_addr_live().
Quoted 139 lines
drivers/core/fdtaddr.c +10
-0@@ -146,6 +146,16 @@ void *devfdt_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +void *devfdt_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =devfdt_get_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +void *devfdt_remap_addr (struct udevice *dev) {return devfdt_remap_addr_index (dev,0 );drivers/core/read.c +20
-0@@ -69,6 +69,26 @@ void *dev_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char *name) +{ +int index =dev_read_stringlist_search (dev,"reg-names" , name); + +if (index <0 ) +return FDT_ADDR_T_NONE ; +else +return dev_read_addr_index (dev, index); +} + +void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =dev_read_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +fdt_addr_t dev_read_addr (struct udevice *dev) {return dev_read_addr_index (dev,0 );include/dm/fdtaddr.h +13
-0@@ -56,6 +56,19 @@ void *devfdt_remap_addr(struct udevice *dev);void *devfdt_remap_addr_index (struct udevice *dev,int index);/** +* devfdt_remap_addr_name() - Get the reg property of a device, indexed by +* name, as a memory-mapped I/O pointer +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @dev: Pointer to a device +* +* @return Pointer to addr, or NULL if there is no such property +*/ +void *devfdt_remap_addr_name (struct udevice *dev,const char *name); + +/** * devfdt_map_physmem() - Read device address from reg property of the * device node and map the address into CPU address * space. include/dm/read.h +36
-0@@ -125,6 +125,31 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);void *dev_remap_addr_index (struct udevice *dev,int index);/** +* dev_read_addr_name() - Get the reg property of a device, indexed by name +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return address or FDT_ADDR_T_NONE if not found +*/ +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char * name); + +/** +* dev_remap_addr_name() - Get the reg property of a device, indexed by name, +* as a memory-mapped I/O pointer +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return pointer or NULL if not found +*/ +void *dev_remap_addr_name (struct udevice *dev,const char * name); + +/** * dev_read_addr() - Get the reg property of a device * * @dev: Device to read from @@ -494,6 +519,12 @@ static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)return devfdt_get_addr_index (dev, index); } +static inline fdt_addr_t dev_read_addr_name (struct udevice *dev, +const char *name) +{ +return devfdt_get_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr (struct udevice *dev) {return devfdt_get_addr (dev);@@ -514,6 +545,11 @@ static inline void *dev_remap_addr_index(struct udevice *dev, int index)return devfdt_remap_addr_index (dev, index); } +static inline void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +return devfdt_remap_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr_size (struct udevice *dev,const char *propname,fdt_size_t *sizep)
Signature · 9 lines
- Daniel -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: OpenPGP digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181130/fefbd5df/attachment.sig>
PATCH 1/1 dm: core: add functions to get/remap I/O addresses by name
Hi Daniel,
Quoted 9 lines · Daniel Schwierzeck
Am 29.11.18 um 20:57 schrieb Álvaro Fernández Rojas:
Quoted 7 lines
Signed-off-by Álvaro Fernández Rojas <[email protected]>--- drivers/core/fdtaddr.c | 10 ++++++++++ drivers/core/read.c | 20 ++++++++++++++++++++ include/dm/fdtaddr.h | 13 +++++++++++++ include/dm/read.h | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+)
Quoted 4 lines
nice, but I guess Simon will insist on some tests in
test/dm/test-fdt.c.You could copy and adapt
dm_test_fdt_remap_addr_flat()anddm_test_fdt_remap_addr_live().
Ok, I will send a new version with the suggested test.
Quoted 139 lines
Quoted 139 lines
drivers/core/fdtaddr.c +10
-0@@ -146,6 +146,16 @@ void *devfdt_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +void *devfdt_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =devfdt_get_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +void *devfdt_remap_addr (struct udevice *dev) {return devfdt_remap_addr_index (dev,0 );drivers/core/read.c +20
-0@@ -69,6 +69,26 @@ void *dev_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char *name) +{ +int index =dev_read_stringlist_search (dev,"reg-names" , name); + +if (index <0 ) +return FDT_ADDR_T_NONE ; +else +return dev_read_addr_index (dev, index); +} + +void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =dev_read_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +fdt_addr_t dev_read_addr (struct udevice *dev) {return dev_read_addr_index (dev,0 );include/dm/fdtaddr.h +13
-0@@ -56,6 +56,19 @@ void *devfdt_remap_addr(struct udevice *dev);void *devfdt_remap_addr_index (struct udevice *dev,int index);/** +* devfdt_remap_addr_name() - Get the reg property of a device, indexed by +* name, as a memory-mapped I/O pointer +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @dev: Pointer to a device +* +* @return Pointer to addr, or NULL if there is no such property +*/ +void *devfdt_remap_addr_name (struct udevice *dev,const char *name); + +/** * devfdt_map_physmem() - Read device address from reg property of the * device node and map the address into CPU address * space. include/dm/read.h +36
-0@@ -125,6 +125,31 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);void *dev_remap_addr_index (struct udevice *dev,int index);/** +* dev_read_addr_name() - Get the reg property of a device, indexed by name +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return address or FDT_ADDR_T_NONE if not found +*/ +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char * name); + +/** +* dev_remap_addr_name() - Get the reg property of a device, indexed by name, +* as a memory-mapped I/O pointer +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return pointer or NULL if not found +*/ +void *dev_remap_addr_name (struct udevice *dev,const char * name); + +/** * dev_read_addr() - Get the reg property of a device * * @dev: Device to read from @@ -494,6 +519,12 @@ static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)return devfdt_get_addr_index (dev, index); } +static inline fdt_addr_t dev_read_addr_name (struct udevice *dev, +const char *name) +{ +return devfdt_get_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr (struct udevice *dev) {return devfdt_get_addr (dev);@@ -514,6 +545,11 @@ static inline void *dev_remap_addr_index(struct udevice *dev, int index)return devfdt_remap_addr_index (dev, index); } +static inline void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +return devfdt_remap_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr_size (struct udevice *dev,const char *propname,fdt_size_t *sizep)
PATCH v2 1/1 dm: core: add functions to get/remap I/O addresses by name
In reply to Álvaro Fernández Rojas---
v2: add remap tests
arch/sandbox/dts/test.dts | 1 + drivers/core/fdtaddr.c | 10 ++++++ drivers/core/read.c | 20 ++++++++++++ include/dm/fdtaddr.h | 13 ++++++++ include/dm/read.h | 36 +++++++++++++++++++++ test/dm/test-fdt.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 160 insertions(+), 2 deletions(-)
arch/sandbox/dts/test.dts +1 -0
@@ -680,6 +680,7 @@ dev at 0,0 { compatible = "denx,u-boot-fdt-dummy"; reg = <0 0x0 0x1000>; + reg-names = "sandbox-dummy-0"; }; dev at 1,100 {
drivers/core/fdtaddr.c +10 -0
@@ -146,6 +146,16 @@ void *devfdt_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +void *devfdt_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =devfdt_get_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +void *devfdt_remap_addr (struct udevice *dev) {return devfdt_remap_addr_index (dev,0 );
drivers/core/read.c +20 -0
@@ -69,6 +69,26 @@ void *dev_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char *name) +{ +int index =dev_read_stringlist_search (dev,"reg-names" , name); + +if (index <0 ) +return FDT_ADDR_T_NONE ; +else +return dev_read_addr_index (dev, index); +} + +void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =dev_read_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +fdt_addr_t dev_read_addr (struct udevice *dev) {return dev_read_addr_index (dev,0 );
include/dm/fdtaddr.h +13 -0
@@ -56,6 +56,19 @@ void *devfdt_remap_addr(struct udevice *dev);void *devfdt_remap_addr_index (struct udevice *dev,int index);/** +* devfdt_remap_addr_name() - Get the reg property of a device, indexed by +* name, as a memory-mapped I/O pointer +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @dev: Pointer to a device +* +* @return Pointer to addr, or NULL if there is no such property +*/ +void *devfdt_remap_addr_name (struct udevice *dev,const char *name); + +/** * devfdt_map_physmem() - Read device address from reg property of the * device node and map the address into CPU address * space.
include/dm/read.h +36 -0
@@ -125,6 +125,31 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);void *dev_remap_addr_index (struct udevice *dev,int index);/** +* dev_read_addr_name() - Get the reg property of a device, indexed by name +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return address or FDT_ADDR_T_NONE if not found +*/ +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char * name); + +/** +* dev_remap_addr_name() - Get the reg property of a device, indexed by name, +* as a memory-mapped I/O pointer +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return pointer or NULL if not found +*/ +void *dev_remap_addr_name (struct udevice *dev,const char * name); + +/** * dev_read_addr() - Get the reg property of a device * * @dev: Device to read from
@@ -494,6 +519,12 @@ static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)return devfdt_get_addr_index (dev, index); } +static inline fdt_addr_t dev_read_addr_name (struct udevice *dev, +const char *name) +{ +return devfdt_get_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr (struct udevice *dev) {return devfdt_get_addr (dev);
@@ -514,6 +545,11 @@ static inline void *dev_remap_addr_index(struct udevice *dev, int index)return devfdt_remap_addr_index (dev, index); } +static inline void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +return devfdt_remap_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr_size (struct udevice *dev,const char *propname,fdt_size_t *sizep)
test/dm/test-fdt.c +80 -2
100 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v2 1/1 dm: core: add functions to get/remap I/O addresses by name
Hi Alvaro,
Quoted 1 line · Álvaro Fernández Rojas
Please add a commit message here. It is important to describe the motivation and effect for each commit.
It should be the most enjoyable bit of each commit :-)
Looks good otherwise.
Quoted 4 lines
Signed-off-by Álvaro Fernández Rojas <[email protected]>---
v2: add remap tests
Quoted 8 lines
arch/sandbox/dts/test.dts | 1 + drivers/core/fdtaddr.c | 10 ++++++ drivers/core/read.c | 20 ++++++++++++ include/dm/fdtaddr.h | 13 ++++++++ include/dm/read.h | 36 +++++++++++++++++++++ test/dm/test-fdt.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 160 insertions(+), 2 deletions(-)
Regards,
Simon
PATCH v3 1/1 dm: core: add functions to get/remap I/O addresses by name
In reply to Álvaro Fernández RojasThis functions allow us to get and remap I/O addresses by name, which is useful when there are multiple reg addresses indexed by reg-names property. This is needed in bmips dma/eth patch series, but can also be used on many
other drivers.
---
v3: add commit message
v2: add remap tests
arch/sandbox/dts/test.dts | 1 + drivers/core/fdtaddr.c | 10 ++++++ drivers/core/read.c | 20 ++++++++++++ include/dm/fdtaddr.h | 13 ++++++++ include/dm/read.h | 36 +++++++++++++++++++++ test/dm/test-fdt.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 160 insertions(+), 2 deletions(-)
arch/sandbox/dts/test.dts +1 -0
@@ -690,6 +690,7 @@ dev at 0,0 { compatible = "denx,u-boot-fdt-dummy"; reg = <0 0x0 0x1000>; + reg-names = "sandbox-dummy-0"; }; dev at 1,100 {
drivers/core/fdtaddr.c +10 -0
@@ -146,6 +146,16 @@ void *devfdt_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +void *devfdt_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =devfdt_get_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +void *devfdt_remap_addr (struct udevice *dev) {return devfdt_remap_addr_index (dev,0 );
drivers/core/read.c +20 -0
@@ -69,6 +69,26 @@ void *dev_remap_addr_index(struct udevice *dev, int index)return map_physmem (addr,0 ,MAP_NOCACHE ); } +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char *name) +{ +int index =dev_read_stringlist_search (dev,"reg-names" , name); + +if (index <0 ) +return FDT_ADDR_T_NONE ; +else +return dev_read_addr_index (dev, index); +} + +void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +fdt_addr_t addr =dev_read_addr_name (dev, name); + +if (addr ==FDT_ADDR_T_NONE ) +return NULL ; + +return map_physmem (addr,0 ,MAP_NOCACHE ); +} +fdt_addr_t dev_read_addr (struct udevice *dev) {return dev_read_addr_index (dev,0 );
include/dm/fdtaddr.h +13 -0
@@ -56,6 +56,19 @@ void *devfdt_remap_addr(struct udevice *dev);void *devfdt_remap_addr_index (struct udevice *dev,int index);/** +* devfdt_remap_addr_name() - Get the reg property of a device, indexed by +* name, as a memory-mapped I/O pointer +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @dev: Pointer to a device +* +* @return Pointer to addr, or NULL if there is no such property +*/ +void *devfdt_remap_addr_name (struct udevice *dev,const char *name); + +/** * devfdt_map_physmem() - Read device address from reg property of the * device node and map the address into CPU address * space.
include/dm/read.h +36 -0
@@ -125,6 +125,31 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index);void *dev_remap_addr_index (struct udevice *dev,int index);/** +* dev_read_addr_name() - Get the reg property of a device, indexed by name +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return address or FDT_ADDR_T_NONE if not found +*/ +fdt_addr_t dev_read_addr_name (struct udevice *dev,const char * name); + +/** +* dev_remap_addr_name() - Get the reg property of a device, indexed by name, +* as a memory-mapped I/O pointer +* +* @dev: Device to read from +* @name: the 'reg' property can hold a list of <addr, size> pairs, with the +* 'reg-names' property providing named-based identification. @index +* indicates the value to search for in 'reg-names'. +* +* @return pointer or NULL if not found +*/ +void *dev_remap_addr_name (struct udevice *dev,const char * name); + +/** * dev_read_addr() - Get the reg property of a device * * @dev: Device to read from
@@ -494,6 +519,12 @@ static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index)return devfdt_get_addr_index (dev, index); } +static inline fdt_addr_t dev_read_addr_name (struct udevice *dev, +const char *name) +{ +return devfdt_get_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr (struct udevice *dev) {return devfdt_get_addr (dev);
@@ -514,6 +545,11 @@ static inline void *dev_remap_addr_index(struct udevice *dev, int index)return devfdt_remap_addr_index (dev, index); } +static inline void *dev_remap_addr_name (struct udevice *dev,const char *name) +{ +return devfdt_remap_addr_name (dev, name); +} +static inline fdt_addr_t dev_read_addr_size (struct udevice *dev,const char *propname,fdt_size_t *sizep)
test/dm/test-fdt.c +80 -2
100 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v3 1/1 dm: core: add functions to get/remap I/O addresses by name
Am 03.12.18 um 19:37 schrieb Álvaro Fernández Rojas:
Quoted 9 lines
This functions allow us to get and remap I/O addresses by name, which is useful when there are multiple reg addresses indexed by reg-names property. This is needed in bmips dma/eth patch series, but can also be used on many
other drivers.Signed-off-by Álvaro Fernández Rojas <[email protected]>---
v3: add commit message
v2: add remap tests
Quoted 8 lines
arch/sandbox/dts/test.dts | 1 + drivers/core/fdtaddr.c | 10 ++++++ drivers/core/read.c | 20 ++++++++++++ include/dm/fdtaddr.h | 13 ++++++++ include/dm/read.h | 36 +++++++++++++++++++++ test/dm/test-fdt.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 160 insertions(+), 2 deletions(-)
Signature · 1 line
- Daniel
PATCH v3 1/1 dm: core: add functions to get/remap I/O addresses by name
In reply to Álvaro Fernández RojasQuoted 10 lines · Álvaro Fernández Rojas
This functions allow us to get and remap I/O addresses by name, which is useful when there are multiple reg addresses indexed by reg-names property. This is needed in bmips dma/eth patch series, but can also be used on many
other drivers.Signed-off-by Álvaro Fernández Rojas <[email protected]>---
v3: add commit message
v2: add remap tests
Quoted 7 lines
arch/sandbox/dts/test.dts | 1 + drivers/core/fdtaddr.c | 10 ++++++ drivers/core/read.c | 20 ++++++++++++ include/dm/fdtaddr.h | 13 ++++++++ include/dm/read.h | 36 +++++++++++++++++++++ test/dm/test-fdt.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 160 insertions(+), 2 deletions(-)
PATCH v3 1/1 dm: core: add functions to get/remap I/O addresses by name
Quoted 10 lines · Álvaro Fernández Rojas
This functions allow us to get and remap I/O addresses by name, which is useful when there are multiple reg addresses indexed by reg-names property. This is needed in bmips dma/eth patch series, but can also be used on many
other drivers.Signed-off-by Álvaro Fernández Rojas <[email protected]>---
v3: add commit message
v2: add remap tests
Quoted 7 lines
arch/sandbox/dts/test.dts | 1 + drivers/core/fdtaddr.c | 10 ++++++ drivers/core/read.c | 20 ++++++++++++ include/dm/fdtaddr.h | 13 ++++++++ include/dm/read.h | 36 +++++++++++++++++++++ test/dm/test-fdt.c | 82 +++++++++++++++++++++++++++++++++++++++++++++-- 6 files changed, 160 insertions(+), 2 deletions(-)
Applied to u-boot-dm/master, thanks!