of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
PATCH v2 1/2 of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
'dma-ranges' frequently exists without parent nodes having 'dma-ranges'. While this is an error for 'ranges', this is fine because DMA capable devices always have a translatable DMA address. Also, with no 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with no restrictions unless perhaps the device itself has implicit restrictions.
This keeps in sync with Linux kernel commit:
81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
---
Changes in v2:
- rebase on top of Dario's revert patch:
http://patchwork.ozlabs.org/project/uboot/patch/20210425141746.19115-6-dariobin at libero.it/
- drop commit "of: addr: Abort address translation for parent nodes missing 'ranges'", as the revert patch restores the abort behavior
drivers/core/of_addr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/core/of_addr.c +5 -1
@@ -192,9 +192,13 @@ static int of_translate_one(const struct device_node *parent,* * As far as we know, this damage only exists on Apple machines, so * This code is only enabled on powerpc. --gcl +* +* This quirk also applies for 'dma-ranges' which frequently exist in +* child nodes without 'dma-ranges' in the parent nodes. --RobH */ ranges =of_get_property (parent, rprop, &rlen); -if (ranges ==NULL && !of_empty_ranges_quirk (parent)) { +if (ranges ==NULL && !of_empty_ranges_quirk (parent) && +strcmp (rprop,"dma-ranges" )) {debug ("no ranges; cannot translate\n" );return 1 ; }
Signature · 1 line
2.25.1
PATCH v2 1/2 of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
Hi Simon,
Quoted 12 lines · Bin Meng
'dma-ranges' frequently exists without parent nodes having 'dma-ranges'. While this is an error for 'ranges', this is fine because DMA capable devices always have a translatable DMA address. Also, with no 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with no restrictions unless perhaps the device itself has implicit restrictions.
This keeps in sync with Linux kernel commit:
81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
Quoted 8 lines
Signed-off-by Bin Meng <[email protected]>Reviewed-by Simon Glass <[email protected]>---
Changes in v2:
- rebase on top of Dario's revert patch:
http://patchwork.ozlabs.org/project/uboot/patch/20210425141746.19115-6-dariobin at libero.it/
The above dependent patch is now in u-boot/master.
Could you please apply this series?
Quoted 6 lines
- drop commit "of: addr: Abort address translation for parent nodes missing 'ranges'", as the revert patch restores the abort behavior
drivers/core/of_addr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Regards,
Bin
Quoted 21 lines · Bin Meng
Hi Simon,
Quoted 17 lines · Bin Meng
'dma-ranges' frequently exists without parent nodes having 'dma-ranges'. While this is an error for 'ranges', this is fine because DMA capable devices always have a translatable DMA address. Also, with no 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with no restrictions unless perhaps the device itself has implicit restrictions.
This keeps in sync with Linux kernel commit:
81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'Signed-off-by Bin Meng <[email protected]>Reviewed-by Simon Glass <[email protected]>---
Quoted 8 lines
Quoted 3 lines
Changes in v2:
- rebase on top of Dario's revert patch:
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/The above dependent patch is now in u-boot/master.
Could you please apply this series?
Ping?
Hi Bin,
Quoted 27 lines · Bin Meng
Quoted 25 lines · Bin Meng
Hi Simon,
Quoted 20 lines · Bin Meng
'dma-ranges' frequently exists without parent nodes having 'dma-ranges'. While this is an error for 'ranges', this is fine because DMA capable devices always have a translatable DMA address. Also, with no 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with no restrictions unless perhaps the device itself has implicit restrictions.
This keeps in sync with Linux kernel commit:
81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'Signed-off-by Bin Meng <[email protected]>Reviewed-by Simon Glass <[email protected]>---
Changes in v2:
- rebase on top of Dario's revert patch:
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 6 lines
Quoted 4 lines
The above dependent patch is now in u-boot/master.
Could you please apply this series?
Ping?
OK I am taking a look.
Regards,
Simon
Hi Bin,
Quoted 27 lines · Bin Meng
Quoted 25 lines · Bin Meng
Hi Simon,
Quoted 20 lines · Bin Meng
'dma-ranges' frequently exists without parent nodes having 'dma-ranges'. While this is an error for 'ranges', this is fine because DMA capable devices always have a translatable DMA address. Also, with no 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with no restrictions unless perhaps the device itself has implicit restrictions.
This keeps in sync with Linux kernel commit:
81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'Signed-off-by Bin Meng <[email protected]>Reviewed-by Simon Glass <[email protected]>---
Changes in v2:
- rebase on top of Dario's revert patch:
http://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Quoted 6 lines
Quoted 4 lines
The above dependent patch is now in u-boot/master.
Could you please apply this series?
Ping?
OK I am taking a look.
Regards,
Simon
Applied to u-boot-dm, thanks!
PATCH v2 2/2 of: addr: Remove call to dev_count_cells() in of_get_address()
In reply to Bin MengIn of_get_address(), there is:
dev_count_cells(dev, &na, &ns);
followed by:
bus->count_cells(dev, &na, &ns);
but no codes in between use na/ns, hence the first call is useless. By dropping the first call, dev_count_cells() is now useless too.
---
Changes in v2:
- new patch: of: addr: Remove call to dev_count_cells() in of_get_address()
drivers/core/of_addr.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/core/of_addr.c +0 -6
@@ -118,11 +118,6 @@ static struct of_bus *of_match_bus(struct device_node *np)return NULL ; } -static void dev_count_cells (const struct device_node *np,int *nap,int *nsp) -{ -of_bus_default_count_cells (np, nap, nsp); -} -const __be32 *of_get_address (const struct device_node *dev,int index,u64 *size,unsigned int *flags) {
@@ -136,7 +131,6 @@ const __be32 *of_get_address(const struct device_node *dev, int index, parent =of_get_parent (dev);if (parent ==NULL )return NULL ; -dev_count_cells (dev, &na, &ns); bus =of_match_bus (parent); bus->count_cells (dev, &na, &ns);of_node_put (parent);
Signature · 1 line
2.25.1
PATCH v2 2/2 of: addr: Remove call to dev_count_cells() in of_get_address()
Quoted 14 lines · Bin Meng
In
of_get_address(), there is:dev_count_cells(dev, &na, &ns);followed by:
bus->count_cells(dev, &na, &ns);but no codes in between use na/ns, hence the first call is useless. By dropping the first call,
dev_count_cells()is now useless too.Signed-off-by Bin Meng <[email protected]>
Quoted 7 lines
---
Changes in v2:
- new patch: of: addr: Remove call todev_count_cells()inof_get_address()drivers/core/of_addr.c | 6 ------ 1 file changed, 6 deletions(-)
I wonder why this is now different from linux?
PATCH v2 2/2 of: addr: Remove call to dev_count_cells() in of_get_address()
Hi Simon,
Quoted 21 lines · Simon Glass
Quoted 19 lines · Bin Meng
In
of_get_address(), there is:dev_count_cells(dev, &na, &ns);followed by:
bus->count_cells(dev, &na, &ns);but no codes in between use na/ns, hence the first call is useless. By dropping the first call,
dev_count_cells()is now useless too.Signed-off-by Bin Meng <[email protected]>---
Changes in v2:
- new patch: of: addr: Remove call todev_count_cells()inof_get_address()
Quoted 6 lines
Quoted 2 lines
drivers/core/of_addr.c | 6 ------ 1 file changed, 6 deletions(-)Reviewed-by Simon Glass <[email protected]>I wonder why this is now different from linux?
With this patch, the code flow is the same as Linux.
Regards,
Bin
Re: [PATCH v2 2/2] of: addr: Remove call to dev_count_cells() in of_get_address()
Hi Simon,
Quoted 21 lines · Simon Glass
Quoted 19 lines · Bin Meng
In
of_get_address(), there is:dev_count_cells(dev, &na, &ns);followed by:
bus->count_cells(dev, &na, &ns);but no codes in between use na/ns, hence the first call is useless. By dropping the first call,
dev_count_cells()is now useless too.Signed-off-by Bin Meng <[email protected]>---
Changes in v2:
- new patch: of: addr: Remove call todev_count_cells()inof_get_address()
Quoted 6 lines
Quoted 2 lines
drivers/core/of_addr.c | 6 ------ 1 file changed, 6 deletions(-)Reviewed-by Simon Glass <[email protected]>I wonder why this is now different from linux?
With this patch, the code flow is the same as Linux.
Regards,
Bin
Applied to u-boot-dm, thanks!