Fixes for Rockchip NFC driver part 1
Subsystems (29)
v4 cover Fixes for Rockchip NFC driver part 1
This serie contains fixes for the Rockchip NFC driver, which was ported to U-boot and merged with little review and testing it seems.
Part 1 aims at passing the probe function without errors.
Fixed are:
64bit FDT parsing
compatible string removal
add missing layout structure
add missing flash_node pointer
add missing chip ID
Changed V4:
fix cast and divider in syscon-uclass.c
Changed V3:
use dev_read_addr_ptr
fix oobfree
Johan Jonker (10):
include: fdtdec: decouple fdt_addr_t and phys_addr_t size
include: dm: ofnode: fix headers
core: remap: convert regmap_init_mem_plat() input to phys_addr_t
rockchip: adc: rockchip-saradc: use dev_read_addr_ptr
rockchip: timer: dw-apb-timer: convert dev_read_addr output to
phys_addr_t
mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr
mtd: nand: raw: rockchip_nfc: remove the compatible string
"rockchip,rk3308-nfc"
mtd: nand: raw: rockchip_nfc: add layout structure
mtd: nand: raw: rockchip_nfc: add flash_node to chip structure
mtd: nand: raw: rockchip_nfc: fix oobfree offset and description
Paweł Jarosz (1):
mtd: nand: add support for the Sandisk SDTNQGAMA chip
Kconfig | 8 +++ drivers/adc/rockchip-saradc.c | 4 +- drivers/core/regmap.c | 2 +- drivers/core/syscon-uclass.c | 4 +- drivers/mtd/nand/raw/nand_ids.c | 3 ++ drivers/mtd/nand/raw/rockchip_nfc.c | 78 ++++++++++------------------- drivers/ram/rockchip/sdram_rk3066.c | 2 +- drivers/ram/rockchip/sdram_rk3188.c | 2 +- drivers/ram/rockchip/sdram_rk322x.c | 2 +- drivers/ram/rockchip/sdram_rk3288.c | 2 +- drivers/ram/rockchip/sdram_rk3328.c | 2 +- drivers/ram/rockchip/sdram_rk3399.c | 2 +- drivers/timer/dw-apb-timer.c | 4 +- include/dm/ofnode.h | 16 +++--- include/fdtdec.h | 13 +++-- include/regmap.h | 2 +- include/syscon.h | 13 ++--- 17 files changed, 76 insertions(+), 83 deletions(-)
--
2.20.1
PATCH v4 1/11 include: fdtdec: decouple fdt_addr_t and phys_addr_t size
The DT specification supports CPUs with both 32-bit and 64-bit addressing capabilities. In U-boot the fdt_addr_t and phys_addr_t size are coupled by a typedef. The MTD NAND drivers for 32-bit CPU's can describe partitions with a 64-bit reg property. These partitions synced from Linux end up with the wrong offset and sizes when only the lower 32-bit is passed. Decouple the fdt_addr_t and phys_addr_t size as they don't necessary match.
---
Changed V2:
reword
---
Note:
Most drivers still assume that FDT and CPU capabilities are identical. In order to use these variables a cast is needed.
--- Kconfig | 8 ++++++++ include/fdtdec.h | 13 +++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-)
Kconfig +8 -0
@@ -422,11 +422,19 @@ endif # EXPERT config PHYS_64BIT bool "64bit physical address support" + select FDT_64BIT help Say Y here to support 64bit physical memory address. This can be used not only for 64bit SoCs, but also for large physical address extension on 32bit SoCs. +config FDT_64BIT + bool "64bit fdt address support" + help + Say Y here to support 64bit fdt addresses. + This can be used not only for 64bit SoCs, but also + for large address extensions on 32bit SoCs. + config HAS_ROM bool select BINMAN
include/fdtdec.h +9 -4
@@ -18,15 +18,18 @@#include <pci.h> /* -* A typedef for a physical address. Note that fdt data is always big +* Support for 64bit fdt addresses. +* This can be used not only for 64bit SoCs, but also +* for large address extensions on 32bit SoCs. +* Note that fdt data is always big * endian even on a litle endian machine. */ -typedef phys_addr_t fdt_addr_t ; -typedef phys_size_t fdt_size_t ;#define FDT_SIZE_T_NONE (-1U) -#ifdef CONFIG_PHYS_64BIT +#ifdef CONFIG_FDT_64BIT +typedef u64 fdt_addr_t ; +typedef u64 fdt_size_t ;#define FDT_ADDR_T_NONE ((ulong)(-1))#define fdt_addr_to_cpu (reg) be64_to_cpu(reg)
@@ -35,6 +38,8 @@ typedef phys_size_t fdt_size_t;#define cpu_to_fdt_size (reg) cpu_to_be64(reg)typedef fdt64_t fdt_val_t ;#else +typedef u32 fdt_addr_t ; +typedef u32 fdt_size_t ;#define FDT_ADDR_T_NONE (-1U)#define fdt_addr_to_cpu (reg) be32_to_cpu(reg)
--
2.20.1
Re: [PATCH v4 01/11] include: fdtdec: decouple fdt_addr_t and phys_addr_t size
Hi Johan,
This update will cause below error on evb-ast2500/2600:
$ tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE}
Building current source for 1 boards (1 thread, 24 jobs per thread)
arm: + evb-ast2600
+drivers/spi/spi-aspeed-smc.c: In function 'apseed_spi_of_to_plat':
+drivers/spi/spi-aspeed-smc.c:1154:22: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=]
+ 1154 | dev_dbg(bus, "ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n",
+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 1155 | (u32)priv->regs, plat->ahb_base, plat->ahb_sz);
+ | ~~~~~~~~~~~~
+ | |
+ | fdt_size_t {aka unsigned int}
+include/dm/device_compat.h:50:24: note: in definition of macro 'dev_printk_emit'
+ 50 | printf(fmt, ##__VA_ARGS__); \
+ | ^~~
+include/dm/device_compat.h:117:9: note: in expansion of macro '__dev_printk'
+ 117 | __dev_printk(LOGL_DEBUG, dev, fmt, ##__VA_ARGS__)
+ | ^~~~~~~~~~~~
+drivers/spi/spi-aspeed-smc.c:1154:9: note: in expansion of macro 'dev_dbg'
+ | ^~~~~~~
+drivers/spi/spi-aspeed-smc.c:1154:69: note: format string is defined here
+ | ~~^
+ | |
+ | long unsigned int
+ | %x
+In file included from include/linux/printk.h:4,
+ from include/linux/kernel.h:5,
+ from arch/arm/include/asm/io.h:14,
+ from drivers/spi/spi-aspeed-smc.c:13:
+include/log.h:222:24: note: in definition of macro 'log'
+ 222 | printf(_fmt, ##_args); \
+ | ^~~~
+include/dm/device_compat.h:85:17: note: in expansion of macro 'dev_printk_emit'
+ 85 | dev_printk_emit(LOG_CATEGORY, level, fmt, ##__VA_ARGS__); \
+ | ^~~~~~~~~~~~~~~
+include/dm/device_compat.h:54:24: note: in definition of macro 'dev_printk_emit'
+ 54 | printf(fmt, ##__VA_ARGS__); \
+include/dm/device_compat.h:91:41: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=]
+ 91 | "%s %s: " fmt, \
+ | ^~~~~~~~~
+include/dm/device_compat.h:90:25: note: in expansion of macro 'dev_printk_emit'
+ 90 | dev_printk_emit(__dev->driver->id, level, \
+ | ^~~~~~~~~~~~~~~
+include/dm/device_compat.h:96:41: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=]
+ 96 | "%s %s: " fmt, \
+include/dm/device_compat.h:95:25: note: in expansion of macro 'dev_printk_emit'
+ 95 | dev_printk_emit(LOG_CATEGORY, level, \
+cc1: all warnings being treated as errors
+make[3]: *** [scripts/Makefile.build:256: drivers/spi/spi-aspeed-smc.o] Error 1
+make[2]: *** [scripts/Makefile.build:397: drivers/spi] Error 2
+make[1]: *** [Makefile:1846: drivers] Error 2
+make: *** [Makefile:177: sub-make] Error 2
0 0 1 /1 evb-ast2600Thanks,
- Kever
Quoted 89 lines · Johan Jonker
The DT specification supports CPUs with both 32-bit and 64-bit addressing capabilities. In U-boot the
fdt_addr_tandphys_addr_tsize are coupled by a typedef. The MTD NAND drivers for 32-bit CPU's can describe partitions with a 64-bit reg property. These partitions synced from Linux end up with the wrong offset and sizes when only the lower 32-bit is passed. Decouple thefdt_addr_tandphys_addr_tsize as they don't necessary match.Signed-off-by Johan Jonker <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Kever Yang <[email protected]>---
Changed V2:
reword---
Note:
Most drivers still assume that FDT and CPU capabilities are identical. In order to use these variables a cast is needed.--- Kconfig | 8 ++++++++ include/fdtdec.h | 13 +++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-)Kconfig +8
-0@@ -422,11 +422,19 @@ endif # EXPERT config PHYS_64BIT bool "64bit physical address support" + select FDT_64BIT help Say Y here to support 64bit physical memory address. This can be used not only for 64bit SoCs, but also for large physical address extension on 32bit SoCs. +config FDT_64BIT + bool "64bit fdt address support" + help + Say Y here to support 64bit fdt addresses. + This can be used not only for 64bit SoCs, but also + for large address extensions on 32bit SoCs. + config HAS_ROM bool select BINMANinclude/fdtdec.h +9
-5@@ -18,15 +18,18 @@#include <pci.h> /* -* A typedef for a physical address. Note that fdt data is always big +* Support for 64bit fdt addresses. +* This can be used not only for 64bit SoCs, but also +* for large address extensions on 32bit SoCs. +* Note that fdt data is always big * endian even on a litle endian machine. */ -typedef phys_addr_t fdt_addr_t ; -typedef phys_size_t fdt_size_t ;#define FDT_SIZE_T_NONE (-1U) -#ifdef CONFIG_PHYS_64BIT +#ifdef CONFIG_FDT_64BIT +typedef u64 fdt_addr_t ; +typedef u64 fdt_size_t ;#define FDT_ADDR_T_NONE ((ulong)(-1))#define fdt_addr_to_cpu (reg) be64_to_cpu(reg)@@ -35,6 +38,8 @@ typedef phys_size_t fdt_size_t;#define cpu_to_fdt_size (reg) cpu_to_be64(reg)typedef fdt64_t fdt_val_t ;#else +typedef u32 fdt_addr_t ; +typedef u32 fdt_size_t ;#define FDT_ADDR_T_NONE (-1U)#define fdt_addr_to_cpu (reg) be32_to_cpu(reg) --2.20.1
PATCH 1/1 spi: spi-aspeed-smc: convert devfdt_get_addr_index output to phys_addr_t
The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convert devfdt_get_addr_index output to phys_addr_t in the spi-aspeed-smc.c file. Also fix dev_dbg to be able to handle both sizes.
---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/
Request for hardware test by Aspeed people.
--- drivers/spi/spi-aspeed-smc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi-aspeed-smc.c +4 -4
@@ -1125,14 +1125,14 @@ static int apseed_spi_of_to_plat(struct udevice *bus)int ret;struct clk hclk; - priv->regs = (void __iomem *)devfdt_get_addr_index (bus,0 ); + priv->regs = (void __iomem *)((phys_addr_t )devfdt_get_addr_index (bus,0 ));if ((u32 )priv->regs ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong ctrl base\n" );return -ENODEV ; } plat->ahb_base = - (void __iomem *)devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz); + (void __iomem *)((phys_addr_t )devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz));if ((u32 )plat->ahb_base ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong AHB base\n" );return -ENODEV ;
@@ -1151,8 +1151,8 @@ static int apseed_spi_of_to_plat(struct udevice *bus) plat->hclk_rate =clk_get_rate (&hclk);clk_free (&hclk); -dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n" , - (u32 )priv->regs, plat->ahb_base, plat->ahb_sz); +dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%llx\n" , + (u32 )priv->regs, plat->ahb_base, (fdt64_t )plat->ahb_sz);dev_dbg (bus,"hclk = %dMHz, max_cs = %d\n" , plat->hclk_rate /1000000 , plat->max_cs);
--
2.20.1
Re: [PATCH v1] spi: spi-aspeed-smc: convert devfdt_get_addr_index output to phys_addr_t
Hi Johan
Quoted 28 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convertdevfdt_get_addr_indexoutput tophys_addr_tin thespi-aspeed-smc.cfile. Also fixdev_dbgto be able to handle both sizes.Signed-off-by Johan Jonker <[email protected]>---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Request for hardware test by Aspeed people.
--- drivers/spi/spi-aspeed-smc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/spi/spi-aspeed-smc.c +0
-0
drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus) · line 1128
Quoted 5 lines
drivers/spi/spi-aspeed-smc.c +1
-1@@ -1125,14 +1125,14 @@ static int apseed_spi_of_to_plat(struct udevice *bus)int ret;struct clk hclk; - priv->regs = (void __iomem *)devfdt_get_addr_index (bus,0 ); + priv->regs = (void __iomem *)((phys_addr_t )devfdt_get_addr_index (bus,0 ));
devfdt_get_addr_index_ptr is not the right way?
drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus) · line 1135
Quoted 8 lines
drivers/spi/spi-aspeed-smc.c +1
-1if ((u32 )priv->regs ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong ctrl base\n" );return -ENODEV ; } plat->ahb_base = - (void __iomem *)devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz); + (void __iomem *)((phys_addr_t )devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz));
devfdt_get_addr_index_ptr, same here
Quoted 5 lines
drivers/spi/spi-aspeed-smc.c +0
-0if ((u32 )plat->ahb_base ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong AHB base\n" );return -ENODEV ;@@ -1151,8 +1151,8 @@ static int apseed_spi_of_to_plat(struct udevice *bus) plat->hclk_rate =clk_get_rate (&hclk);
drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus)
Quoted 10 lines
drivers/spi/spi-aspeed-smc.c +2
-3clk_free (&hclk); -dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n" , - (u32 )priv->regs, plat->ahb_base, plat->ahb_sz); +dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%llx\n" , + (u32 )priv->regs, plat->ahb_base, (fdt64_t )plat->ahb_sz);dev_dbg (bus,"hclk = %dMHz, max_cs = %d\n" , plat->hclk_rate /1000000 , plat->max_cs); --
Michael
Quoted 2 lines
2.20.1
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v1] spi: spi-aspeed-smc: convert devfdt_get_addr_index output to phys_addr_t
Quoted 34 lines · Michael Nazzareno Trimarchi
Hi Johan
Quoted 31 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convertdevfdt_get_addr_indexoutput tophys_addr_tin thespi-aspeed-smc.cfile. Also fixdev_dbgto be able to handle both sizes.Signed-off-by Johan Jonker <[email protected]>---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Request for hardware test by Aspeed people.
--- drivers/spi/spi-aspeed-smc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/spi/spi-aspeed-smc.c +0
-0@@ -1125,14 +1125,14 @@ static int apseed_spi_of_to_plat(struct udevice *bus)int ret;struct clk hclk;
Quoted 5 lines
drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus) · line 1128
Quoted 2 lines
drivers/spi/spi-aspeed-smc.c +1
-1- priv->regs = (void __iomem *)devfdt_get_addr_index (bus,0 ); + priv->regs = (void __iomem *)((phys_addr_t )devfdt_get_addr_index (bus,0 ));
devfdt_get_addr_index_ptris not the right way?
That may work.
Quoted 6 lines
Quoted 6 lines
drivers/spi/spi-aspeed-smc.c +0
-0if ((u32 )priv->regs ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong ctrl base\n" );return -ENODEV ; }
Quoted 6 lines
drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus) · line 1135
Quoted 3 lines
drivers/spi/spi-aspeed-smc.c +1
-1plat->ahb_base = - (void __iomem *)devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz); + (void __iomem *)((phys_addr_t )devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz));
devfdt_get_addr_index_ptr, same here
fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,
fdt_size_t *size)
vs
void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index)
===
devfdt_get_addr_index_ptr does not offer the ahb_sz size.
https://elixir.bootlin.com/u-boot/latest/source/drivers/core/fdtaddr.c#L112
This function is used for that in devfdt_get_addr_size_index:
fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev_of_offset(dev),
"reg", index, size, false);
What would you suggest? Keep the cast or use fdtdec_get_addr_size_auto_noparent ?
I'm a little bit "reluctant" to poke in code that I don't have hardware for.
Johan
Quoted 23 lines
Quoted 6 lines
drivers/spi/spi-aspeed-smc.c +0
-0if ((u32 )plat->ahb_base ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong AHB base\n" );return -ENODEV ;@@ -1151,8 +1151,8 @@ static int apseed_spi_of_to_plat(struct udevice *bus) plat->hclk_rate =clk_get_rate (&hclk);drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus)
Quoted 10 lines
drivers/spi/spi-aspeed-smc.c +2
-3clk_free (&hclk); -dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n" , - (u32 )priv->regs, plat->ahb_base, plat->ahb_sz); +dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%llx\n" , + (u32 )priv->regs, plat->ahb_base, (fdt64_t )plat->ahb_sz);dev_dbg (bus,"hclk = %dMHz, max_cs = %d\n" , plat->hclk_rate /1000000 , plat->max_cs); --Michael
Quoted 2 lines
2.20.1
Re: [PATCH v1] spi: spi-aspeed-smc: convert devfdt_get_addr_index output to phys_addr_t
Hi Johan
Quoted 71 lines · Johan Jonker
Quoted 34 lines · Michael Nazzareno Trimarchi
Hi Johan
Quoted 31 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convertdevfdt_get_addr_indexoutput tophys_addr_tin thespi-aspeed-smc.cfile. Also fixdev_dbgto be able to handle both sizes.Signed-off-by Johan Jonker <[email protected]>---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Request for hardware test by Aspeed people.
--- drivers/spi/spi-aspeed-smc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/spi/spi-aspeed-smc.c +0
-0@@ -1125,14 +1125,14 @@ static int apseed_spi_of_to_plat(struct udevice *bus)int ret;struct clk hclk;Quoted 5 lines
drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus) · line 1128
Quoted 2 lines
drivers/spi/spi-aspeed-smc.c +1
-1- priv->regs = (void __iomem *)devfdt_get_addr_index (bus,0 ); + priv->regs = (void __iomem *)((phys_addr_t )devfdt_get_addr_index (bus,0 ));
devfdt_get_addr_index_ptris not the right way?That may work.
Quoted 6 lines
Quoted 6 lines
drivers/spi/spi-aspeed-smc.c +0
-0if ((u32 )priv->regs ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong ctrl base\n" );return -ENODEV ; }Quoted 6 lines
drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus) · line 1135
Quoted 3 lines
drivers/spi/spi-aspeed-smc.c +1
-1plat->ahb_base = - (void __iomem *)devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz); + (void __iomem *)((phys_addr_t )devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz));
devfdt_get_addr_index_ptr, same here
fdt_addr_tdevfdt_get_addr_size_index(const struct udevice *dev, int index,
fdt_size_t*size)
vsvoid *devfdt_get_addr_index_ptr(const struct udevice *dev, int index)
===
devfdt_get_addr_index_ptrdoes not offer theahb_szsize.https://elixir.bootlin.com/u-boot/latest/source/drivers/core/fdtaddr.c#L112
Quoted 9 lines
This function is used for that in
devfdt_get_addr_size_index:fdtdec_get_addr_size_auto_noparent(gd->fdt_blob,
dev_of_offset(dev),"reg", index, size, false);What would you suggest? Keep the cast or use
fdtdec_get_addr_size_auto_noparent?I'm a little bit "reluctant" to poke in code that I don't have hardware for.
Something like this
drivers/core/fdtaddr.c +0 -0
@@ -122,6 +122,14 @@ fdt_addr_t devfdt_get_addr_size_index(const
struct udevice *dev, int index,
#endif
}
+void *devfdt_get_addr_size_index_ptr(const struct udevice *dev, int index,
+ fdt_size_t *size)
+{
+ fdt_addr_t addr = devfdt_get_addr_size_index(dev, index, size);
+
+ return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
+}
+
Michael
Quoted 25 lines
Johan
Quoted 23 lines
Quoted 6 lines
drivers/spi/spi-aspeed-smc.c +0
-0if ((u32 )plat->ahb_base ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong AHB base\n" );return -ENODEV ;@@ -1151,8 +1151,8 @@ static int apseed_spi_of_to_plat(struct udevice *bus) plat->hclk_rate =clk_get_rate (&hclk);drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus)
Quoted 10 lines
drivers/spi/spi-aspeed-smc.c +2
-3clk_free (&hclk); -dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n" , - (u32 )priv->regs, plat->ahb_base, plat->ahb_sz); +dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%llx\n" , + (u32 )priv->regs, plat->ahb_base, (fdt64_t )plat->ahb_sz);dev_dbg (bus,"hclk = %dMHz, max_cs = %d\n" , plat->hclk_rate /1000000 , plat->max_cs); --Michael
Quoted 2 lines
2.20.1
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v1] spi: spi-aspeed-smc: convert devfdt_get_addr_index output to phys_addr_t
Hi Johan
Quoted 105 lines · Michael Nazzareno Trimarchi
Hi Johan
Quoted 71 lines · Johan Jonker
Quoted 34 lines · Michael Nazzareno Trimarchi
Hi Johan
Quoted 31 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convertdevfdt_get_addr_indexoutput tophys_addr_tin thespi-aspeed-smc.cfile. Also fixdev_dbgto be able to handle both sizes.Signed-off-by Johan Jonker <[email protected]>---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Request for hardware test by Aspeed people.
--- drivers/spi/spi-aspeed-smc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/spi/spi-aspeed-smc.c +0
-0@@ -1125,14 +1125,14 @@ static int apseed_spi_of_to_plat(struct udevice *bus)int ret;struct clk hclk;Quoted 5 lines
drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus) · line 1128
Quoted 2 lines
drivers/spi/spi-aspeed-smc.c +1
-1- priv->regs = (void __iomem *)devfdt_get_addr_index (bus,0 ); + priv->regs = (void __iomem *)((phys_addr_t )devfdt_get_addr_index (bus,0 ));
devfdt_get_addr_index_ptris not the right way?That may work.
Quoted 6 lines
Quoted 6 lines
drivers/spi/spi-aspeed-smc.c +0
-0if ((u32 )priv->regs ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong ctrl base\n" );return -ENODEV ; }Quoted 6 lines
drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus) · line 1135
Quoted 3 lines
drivers/spi/spi-aspeed-smc.c +1
-1plat->ahb_base = - (void __iomem *)devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz); + (void __iomem *)((phys_addr_t )devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz));
devfdt_get_addr_index_ptr, same here
fdt_addr_tdevfdt_get_addr_size_index(const struct udevice *dev, int index,
fdt_size_t*size)
vsvoid *devfdt_get_addr_index_ptr(const struct udevice *dev, int index)
===
devfdt_get_addr_index_ptrdoes not offer theahb_szsize.https://elixir.bootlin.com/u-boot/latest/source/drivers/core/fdtaddr.c#L112
Quoted 9 lines
This function is used for that in
devfdt_get_addr_size_index:fdtdec_get_addr_size_auto_noparent(gd->fdt_blob,
dev_of_offset(dev),"reg", index, size, false);What would you suggest? Keep the cast or use
fdtdec_get_addr_size_auto_noparent?I'm a little bit "reluctant" to poke in code that I don't have hardware for.
Something like this
drivers/core/fdtaddr.c +8
-0@@ -122,6 +122,14 @@ fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index, #endif } +void *devfdt_get_addr_size_index_ptr(const struct udevice *dev, int index, + fdt_size_t *size) +{ + fdt_addr_t addr = devfdt_get_addr_size_index(dev, index, size); + + return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr; +} +
Quoted 2 lines
Michael
Is this ok? if so you can repost with changes
Michael
Quoted 41 lines
Quoted 26 lines
Johan
Quoted 23 lines
Quoted 6 lines
drivers/spi/spi-aspeed-smc.c +0
-0if ((u32 )plat->ahb_base ==FDT_ADDR_T_NONE ) {dev_err (bus,"wrong AHB base\n" );return -ENODEV ;@@ -1151,8 +1151,8 @@ static int apseed_spi_of_to_plat(struct udevice *bus) plat->hclk_rate =clk_get_rate (&hclk);drivers/spi/spi-aspeed-smc.c static int apseed_spi_of_to_plat(struct udevice *bus)
Quoted 10 lines
drivers/spi/spi-aspeed-smc.c +2
-3clk_free (&hclk); -dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n" , - (u32 )priv->regs, plat->ahb_base, plat->ahb_sz); +dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%llx\n" , + (u32 )priv->regs, plat->ahb_base, (fdt64_t )plat->ahb_sz);dev_dbg (bus,"hclk = %dMHz, max_cs = %d\n" , plat->hclk_rate /1000000 , plat->max_cs); --Michael
Quoted 2 lines
2.20.1
--
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v4 01/11] include: fdtdec: decouple fdt_addr_t and phys_addr_t size
In reply to Kever YangQuoted 3 lines · Kever Yang
Hi Johan,
This update will cause below error on evb-ast2500/2600:
Hi Kever, Simon,
For "spi-aspeed-smc.c" I have submitted a patch proposal.
The changes in patch 1 possible involves a lot more boards that might need a change to which the external MAINTAINERS may or may not respond to. As that becomes a lengthy time consuming process. Is it maybe possible to skip patch 1 for now and get at least the more essential patches 2-11 merged? Please advise what's the best option here to get forward.
Johan
Quoted 149 lines
$ tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE} Building current source for 1 boards (1 thread, 24 jobs per thread) arm: + evb-ast2600(quoted diff) +48
-0+drivers/spi/spi-aspeed-smc.c: In function 'apseed_spi_of_to_plat': +drivers/spi/spi-aspeed-smc.c:1154:22: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=] + 1154 | dev_dbg(bus, "ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n", + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1155 | (u32)priv->regs, plat->ahb_base, plat->ahb_sz); + | ~~~~~~~~~~~~ + | | + | fdt_size_t {aka unsigned int} +include/dm/device_compat.h:50:24: note: in definition of macro 'dev_printk_emit' + 50 | printf(fmt, ##__VA_ARGS__); \ + | ^~~ +include/dm/device_compat.h:117:9: note: in expansion of macro '__dev_printk' + 117 | __dev_printk(LOGL_DEBUG, dev, fmt, ##__VA_ARGS__) + | ^~~~~~~~~~~~ +drivers/spi/spi-aspeed-smc.c:1154:9: note: in expansion of macro 'dev_dbg' + | ^~~~~~~ +drivers/spi/spi-aspeed-smc.c:1154:69: note: format string is defined here + | ~~^ + | | + | long unsigned int + | %x +In file included from include/linux/printk.h:4, + from include/linux/kernel.h:5, + from arch/arm/include/asm/io.h:14, + from drivers/spi/spi-aspeed-smc.c:13: +include/log.h:222:24: note: in definition of macro 'log' + 222 | printf(_fmt, ##_args); \ + | ^~~~ +include/dm/device_compat.h:85:17: note: in expansion of macro 'dev_printk_emit' + 85 | dev_printk_emit(LOG_CATEGORY, level, fmt, ##__VA_ARGS__); \ + | ^~~~~~~~~~~~~~~ +include/dm/device_compat.h:54:24: note: in definition of macro 'dev_printk_emit' + 54 | printf(fmt, ##__VA_ARGS__); \ +include/dm/device_compat.h:91:41: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=] + 91 | "%s %s: " fmt, \ + | ^~~~~~~~~ +include/dm/device_compat.h:90:25: note: in expansion of macro 'dev_printk_emit' + 90 | dev_printk_emit(__dev->driver->id, level, \ + | ^~~~~~~~~~~~~~~ +include/dm/device_compat.h:96:41: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=] + 96 | "%s %s: " fmt, \ +include/dm/device_compat.h:95:25: note: in expansion of macro 'dev_printk_emit' + 95 | dev_printk_emit(LOG_CATEGORY, level, \ +cc1: all warnings being treated as errors +make[3]: *** [scripts/Makefile.build:256: drivers/spi/spi-aspeed-smc.o] Error 1 +make[2]: *** [scripts/Makefile.build:397: drivers/spi] Error 2 +make[1]: *** [Makefile:1846: drivers] Error 2 +make: *** [Makefile:177: sub-make] Error 20 0 1 /1 evb-ast2600
Thanks,
- Kever
Quoted 89 lines · Johan Jonker
The DT specification supports CPUs with both 32-bit and 64-bit addressing capabilities. In U-boot the
fdt_addr_tandphys_addr_tsize are coupled by a typedef. The MTD NAND drivers for 32-bit CPU's can describe partitions with a 64-bit reg property. These partitions synced from Linux end up with the wrong offset and sizes when only the lower 32-bit is passed. Decouple thefdt_addr_tandphys_addr_tsize as they don't necessary match.Signed-off-by Johan Jonker <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Kever Yang <[email protected]>---
Changed V2:
reword---
Note:
Most drivers still assume that FDT and CPU capabilities are identical. In order to use these variables a cast is needed.
---
Kconfig | 8 ++++++++
include/fdtdec.h| 13 +++++++++----2 files changed, 17 insertions(+), 4 deletions(-)Kconfig +0
-0@@ -422,11 +422,19 @@ endif # EXPERTconfig
PHYS_64BIT
bool "64bit physical address support"
+ selectFDT_64BIT
help
Say Y here to support 64bit physical memory address. This can be used not only for 64bit SoCs, but also for large physical address extension on 32bit SoCs.Kconfig +7
-0+config FDT_64BIT + bool "64bit fdt address support" + help + Say Y here to support 64bit fdt addresses. + This can be used not only for 64bit SoCs, but also + for large address extensions on 32bit SoCs. +config
HAS_ROM
bool
select BINMANinclude/fdtdec.h +9
-4@@ -18,15 +18,18 @@ #include <pci.h> /* -* A typedef for a physical address. Note that fdt data is always big + * Support for 64bit fdt addresses. + * This can be used not only for 64bit SoCs, but also + * for large address extensions on 32bit SoCs. + * Note that fdt data is always big * endian even on a litle endian machine. */ -typedef phys_addr_t fdt_addr_t ; -typedef phys_size_t fdt_size_t ; #define FDT_SIZE_T_NONE (-1U) -#ifdef CONFIG_PHYS_64BIT +#ifdef CONFIG_FDT_64BIT +typedef u64 fdt_addr_t ; +typedef u64 fdt_size_t ; #define FDT_ADDR_T_NONE ((ulong)(-1)) #define fdt_addr_to_cpu(reg) be64_to_cpu(reg)@@ -35,6 +38,8 @@ typedef phys_size_t fdt_size_t; #define cpu_to_fdt_size(reg) cpu_to_be64(reg) typedef fdt64_t fdt_val_t; #else +typedef u32 fdt_addr_t ; +typedef u32 fdt_size_t ; #define FDT_ADDR_T_NONE (-1U) #define fdt_addr_to_cpu(reg) be32_to_cpu(reg)Signature · 1 line
2.20.1
Re: [PATCH v4 01/11] include: fdtdec: decouple fdt_addr_t and phys_addr_t size
Hi Johan
Quoted 8 lines · Johan Jonker
Quoted 3 lines · Kever Yang
Hi Johan,
This update will cause below error on evb-ast2500/2600:
Quoted 8 lines
Hi Kever, Simon,
For "
spi-aspeed-smc.c" I have submitted a patch proposal.
The changes in patch 1 possible involves a lot more boards that might need a change to which the externalMAINTAINERSmay or may not respond to. As that becomes a lengthy time consuming process. Is it maybe possible to skip patch 1 for now and get at least the more essential patches 2-11 merged? Please advise what's the best option here to get forward.Johan
Please point to the patch you mentioned.
Kever if you are going to pick the nand patches part let me know
Michael
Quoted 151 lines
Quoted 151 lines
$ tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE} Building current source for 1 boards (1 thread, 24 jobs per thread) arm: + evb-ast2600(quoted diff) +48
-0+drivers/spi/spi-aspeed-smc.c: In function 'apseed_spi_of_to_plat': +drivers/spi/spi-aspeed-smc.c:1154:22: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=] + 1154 | dev_dbg(bus, "ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n", + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1155 | (u32)priv->regs, plat->ahb_base, plat->ahb_sz); + | ~~~~~~~~~~~~ + | | + | fdt_size_t {aka unsigned int} +include/dm/device_compat.h:50:24: note: in definition of macro 'dev_printk_emit' + 50 | printf(fmt, ##__VA_ARGS__); \ + | ^~~ +include/dm/device_compat.h:117:9: note: in expansion of macro '__dev_printk' + 117 | __dev_printk(LOGL_DEBUG, dev, fmt, ##__VA_ARGS__) + | ^~~~~~~~~~~~ +drivers/spi/spi-aspeed-smc.c:1154:9: note: in expansion of macro 'dev_dbg' + | ^~~~~~~ +drivers/spi/spi-aspeed-smc.c:1154:69: note: format string is defined here + | ~~^ + | | + | long unsigned int + | %x +In file included from include/linux/printk.h:4, + from include/linux/kernel.h:5, + from arch/arm/include/asm/io.h:14, + from drivers/spi/spi-aspeed-smc.c:13: +include/log.h:222:24: note: in definition of macro 'log' + 222 | printf(_fmt, ##_args); \ + | ^~~~ +include/dm/device_compat.h:85:17: note: in expansion of macro 'dev_printk_emit' + 85 | dev_printk_emit(LOG_CATEGORY, level, fmt, ##__VA_ARGS__); \ + | ^~~~~~~~~~~~~~~ +include/dm/device_compat.h:54:24: note: in definition of macro 'dev_printk_emit' + 54 | printf(fmt, ##__VA_ARGS__); \ +include/dm/device_compat.h:91:41: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=] + 91 | "%s %s: " fmt, \ + | ^~~~~~~~~ +include/dm/device_compat.h:90:25: note: in expansion of macro 'dev_printk_emit' + 90 | dev_printk_emit(__dev->driver->id, level, \ + | ^~~~~~~~~~~~~~~ +include/dm/device_compat.h:96:41: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=] + 96 | "%s %s: " fmt, \ +include/dm/device_compat.h:95:25: note: in expansion of macro 'dev_printk_emit' + 95 | dev_printk_emit(LOG_CATEGORY, level, \ +cc1: all warnings being treated as errors +make[3]: *** [scripts/Makefile.build:256: drivers/spi/spi-aspeed-smc.o] Error 1 +make[2]: *** [scripts/Makefile.build:397: drivers/spi] Error 2 +make[1]: *** [Makefile:1846: drivers] Error 2 +make: *** [Makefile:177: sub-make] Error 2 0 0 1 /1 evb-ast2600Thanks,
- Kever
Quoted 89 lines · Johan Jonker
The DT specification supports CPUs with both 32-bit and 64-bit addressing capabilities. In U-boot the
fdt_addr_tandphys_addr_tsize are coupled by a typedef. The MTD NAND drivers for 32-bit CPU's can describe partitions with a 64-bit reg property. These partitions synced from Linux end up with the wrong offset and sizes when only the lower 32-bit is passed. Decouple thefdt_addr_tandphys_addr_tsize as they don't necessary match.Signed-off-by Johan Jonker <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Kever Yang <[email protected]>---
Changed V2:
reword---
Note:
Most drivers still assume that FDT and CPU capabilities are identical. In order to use these variables a cast is needed.--- Kconfig | 8 ++++++++ include/fdtdec.h | 13 +++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-)Kconfig +8
-0@@ -422,11 +422,19 @@ endif # EXPERT config PHYS_64BIT bool "64bit physical address support" + select FDT_64BIT help Say Y here to support 64bit physical memory address. This can be used not only for 64bit SoCs, but also for large physical address extension on 32bit SoCs. +config FDT_64BIT + bool "64bit fdt address support" + help + Say Y here to support 64bit fdt addresses. + This can be used not only for 64bit SoCs, but also + for large address extensions on 32bit SoCs. + config HAS_ROM bool select BINMANinclude/fdtdec.h +9
-5@@ -18,15 +18,18 @@#include <pci.h> /* -* A typedef for a physical address. Note that fdt data is always big +* Support for 64bit fdt addresses. +* This can be used not only for 64bit SoCs, but also +* for large address extensions on 32bit SoCs. +* Note that fdt data is always big * endian even on a litle endian machine. */ -typedef phys_addr_t fdt_addr_t ; -typedef phys_size_t fdt_size_t ;#define FDT_SIZE_T_NONE (-1U) -#ifdef CONFIG_PHYS_64BIT +#ifdef CONFIG_FDT_64BIT +typedef u64 fdt_addr_t ; +typedef u64 fdt_size_t ;#define FDT_ADDR_T_NONE ((ulong)(-1))#define fdt_addr_to_cpu (reg) be64_to_cpu(reg)@@ -35,6 +38,8 @@ typedef phys_size_t fdt_size_t;#define cpu_to_fdt_size (reg) cpu_to_be64(reg)typedef fdt64_t fdt_val_t ;#else +typedef u32 fdt_addr_t ; +typedef u32 fdt_size_t ;#define FDT_ADDR_T_NONE (-1U)#define fdt_addr_to_cpu (reg) be32_to_cpu(reg) --2.20.1
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v4 01/11] include: fdtdec: decouple fdt_addr_t and phys_addr_t size
Quoted 18 lines · Michael Nazzareno Trimarchi
Hi Johan
Quoted 15 lines · Johan Jonker
Quoted 3 lines · Kever Yang
Hi Johan,
This update will cause below error on evb-ast2500/2600:
Hi Kever, Simon,
For "
spi-aspeed-smc.c" I have submitted a patch proposal.
The changes in patch 1 possible involves a lot more boards that might need a change to which the externalMAINTAINERSmay or may not respond to. As that becomes a lengthy time consuming process. Is it maybe possible to skip patch 1 for now and get at least the more essential patches 2-11 merged? Please advise what's the best option here to get forward.
Quoted 4 lines
Quoted 1 line
Johan
Please point to the patch you mentioned.
[PATCH v1] spi: spi-aspeed-smc: convert devfdt_get_addr_index output to phys_addr_t
https://lore.kernel.org/u-boot/[email protected]/T/#m167646537956e20dc9ae60957f6d54f8a00866d7
Quoted 159 lines
Kever if you are going to pick the nand patches part let me know
Michael
Quoted 151 lines
Quoted 151 lines
$ tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board ${TEST_PY_BD} ${OVERRIDE} Building current source for 1 boards (1 thread, 24 jobs per thread) arm: + evb-ast2600(quoted diff) +48
-0+drivers/spi/spi-aspeed-smc.c: In function 'apseed_spi_of_to_plat': +drivers/spi/spi-aspeed-smc.c:1154:22: error: format '%lx' expects argument of type 'long unsigned int', but argument 4 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=] + 1154 | dev_dbg(bus, "ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n", + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1155 | (u32)priv->regs, plat->ahb_base, plat->ahb_sz); + | ~~~~~~~~~~~~ + | | + | fdt_size_t {aka unsigned int} +include/dm/device_compat.h:50:24: note: in definition of macro 'dev_printk_emit' + 50 | printf(fmt, ##__VA_ARGS__); \ + | ^~~ +include/dm/device_compat.h:117:9: note: in expansion of macro '__dev_printk' + 117 | __dev_printk(LOGL_DEBUG, dev, fmt, ##__VA_ARGS__) + | ^~~~~~~~~~~~ +drivers/spi/spi-aspeed-smc.c:1154:9: note: in expansion of macro 'dev_dbg' + | ^~~~~~~ +drivers/spi/spi-aspeed-smc.c:1154:69: note: format string is defined here + | ~~^ + | | + | long unsigned int + | %x +In file included from include/linux/printk.h:4, + from include/linux/kernel.h:5, + from arch/arm/include/asm/io.h:14, + from drivers/spi/spi-aspeed-smc.c:13: +include/log.h:222:24: note: in definition of macro 'log' + 222 | printf(_fmt, ##_args); \ + | ^~~~ +include/dm/device_compat.h:85:17: note: in expansion of macro 'dev_printk_emit' + 85 | dev_printk_emit(LOG_CATEGORY, level, fmt, ##__VA_ARGS__); \ + | ^~~~~~~~~~~~~~~ +include/dm/device_compat.h:54:24: note: in definition of macro 'dev_printk_emit' + 54 | printf(fmt, ##__VA_ARGS__); \ +include/dm/device_compat.h:91:41: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=] + 91 | "%s %s: " fmt, \ + | ^~~~~~~~~ +include/dm/device_compat.h:90:25: note: in expansion of macro 'dev_printk_emit' + 90 | dev_printk_emit(__dev->driver->id, level, \ + | ^~~~~~~~~~~~~~~ +include/dm/device_compat.h:96:41: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'fdt_size_t' {aka 'unsigned int'} [-Werror=format=] + 96 | "%s %s: " fmt, \ +include/dm/device_compat.h:95:25: note: in expansion of macro 'dev_printk_emit' + 95 | dev_printk_emit(LOG_CATEGORY, level, \ +cc1: all warnings being treated as errors +make[3]: *** [scripts/Makefile.build:256: drivers/spi/spi-aspeed-smc.o] Error 1 +make[2]: *** [scripts/Makefile.build:397: drivers/spi] Error 2 +make[1]: *** [Makefile:1846: drivers] Error 2 +make: *** [Makefile:177: sub-make] Error 2 0 0 1 /1 evb-ast2600Thanks,
- Kever
Quoted 89 lines · Johan Jonker
The DT specification supports CPUs with both 32-bit and 64-bit addressing capabilities. In U-boot the
fdt_addr_tandphys_addr_tsize are coupled by a typedef. The MTD NAND drivers for 32-bit CPU's can describe partitions with a 64-bit reg property. These partitions synced from Linux end up with the wrong offset and sizes when only the lower 32-bit is passed. Decouple thefdt_addr_tandphys_addr_tsize as they don't necessary match.Signed-off-by Johan Jonker <[email protected]>Reviewed-by Simon Glass <[email protected]>Reviewed-by Kever Yang <[email protected]>---
Changed V2:
reword---
Note:
Most drivers still assume that FDT and CPU capabilities are identical. In order to use these variables a cast is needed.--- Kconfig | 8 ++++++++ include/fdtdec.h | 13 +++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-)Kconfig +8
-0@@ -422,11 +422,19 @@ endif # EXPERT config PHYS_64BIT bool "64bit physical address support" + select FDT_64BIT help Say Y here to support 64bit physical memory address. This can be used not only for 64bit SoCs, but also for large physical address extension on 32bit SoCs. +config FDT_64BIT + bool "64bit fdt address support" + help + Say Y here to support 64bit fdt addresses. + This can be used not only for 64bit SoCs, but also + for large address extensions on 32bit SoCs. + config HAS_ROM bool select BINMANinclude/fdtdec.h +9
-5@@ -18,15 +18,18 @@#include <pci.h> /* -* A typedef for a physical address. Note that fdt data is always big +* Support for 64bit fdt addresses. +* This can be used not only for 64bit SoCs, but also +* for large address extensions on 32bit SoCs. +* Note that fdt data is always big * endian even on a litle endian machine. */ -typedef phys_addr_t fdt_addr_t ; -typedef phys_size_t fdt_size_t ;#define FDT_SIZE_T_NONE (-1U) -#ifdef CONFIG_PHYS_64BIT +#ifdef CONFIG_FDT_64BIT +typedef u64 fdt_addr_t ; +typedef u64 fdt_size_t ;#define FDT_ADDR_T_NONE ((ulong)(-1))#define fdt_addr_to_cpu (reg) be64_to_cpu(reg)@@ -35,6 +38,8 @@ typedef phys_size_t fdt_size_t;#define cpu_to_fdt_size (reg) cpu_to_be64(reg)typedef fdt64_t fdt_val_t ;#else +typedef u32 fdt_addr_t ; +typedef u32 fdt_size_t ;#define FDT_ADDR_T_NONE (-1U)#define fdt_addr_to_cpu (reg) be32_to_cpu(reg) --2.20.1
PATCH v2 1/2 core: fdtaddr: add devfdt_get_addr_size_index_ptr function
In reply to Kever YangAdd devfdt_get_addr_size_index_ptr function with the same functionality as devfdt_get_addr_size_index, but instead a return pointer is given.
--- drivers/core/fdtaddr.c | 8 ++++++++ include/dm/fdtaddr.h | 15 +++++++++++++++ 2 files changed, 23 insertions(+)
drivers/core/fdtaddr.c +8 -0
@@ -122,6 +122,14 @@ fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,#endif } +void *devfdt_get_addr_size_index_ptr (const struct udevice *dev,int index, +fdt_size_t *size) +{ +fdt_addr_t addr =devfdt_get_addr_size_index (dev, index, size); + +return (addr ==FDT_ADDR_T_NONE ) ?NULL : (void *)(uintptr_t )addr; +} +fdt_addr_t devfdt_get_addr_name (const struct udevice *dev,const char *name) {#if CONFIG_IS_ENABLED (OF_CONTROL )
include/dm/fdtaddr.h +15 -0
@@ -119,6 +119,21 @@ void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index);fdt_addr_t devfdt_get_addr_size_index (const struct udevice *dev,int index,fdt_size_t *size); +/** +* devfdt_get_addr_size_index_ptr() - Return indexed pointer to the address of the +* reg property of a device +* +* @dev: Pointer to a device +* @index: the 'reg' property can hold a list of <addr, size> pairs +* and @index is used to select which one is required +* @size: Pointer to size varible - this function returns the size +* specified in the 'reg' property here +* +* Return: Pointer to addr, or NULL if there is no such property +*/ +void *devfdt_get_addr_size_index_ptr (const struct udevice *dev,int index, +fdt_size_t *size); +/** * devfdt_get_addr_name() - Get the reg property of a device, indexed by name *
--
2.20.1
PATCH v2 2/2 spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr
The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use devfdt_get_addr_index_ptr and devfdt_get_addr_size_index_ptr function in the spi-aspeed-smc.c file. Also fix dev_dbg to be able to handle both sizes.
---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/
Changed V2:
Use devfdt_get_addr_index_ptr and devfdt_get_addr_size_index_ptr
--- drivers/spi/spi-aspeed-smc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/spi/spi-aspeed-smc.c +6 -7
@@ -1125,15 +1125,14 @@ static int apseed_spi_of_to_plat(struct udevice *bus)int ret;struct clk hclk; - priv->regs = (void __iomem *)devfdt_get_addr_index (bus,0 ); -if ((u32 )priv->regs ==FDT_ADDR_T_NONE ) { + priv->regs =devfdt_get_addr_index_ptr (bus,0 ); +if (!priv->regs) {dev_err (bus,"wrong ctrl base\n" );return -ENODEV ; } - plat->ahb_base = - (void __iomem *)devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz); -if ((u32 )plat->ahb_base ==FDT_ADDR_T_NONE ) { + plat->ahb_base =devfdt_get_addr_size_index_ptr (bus,1 , &plat->ahb_sz); +if (!plat->ahb_base) {dev_err (bus,"wrong AHB base\n" );return -ENODEV ; }
@@ -1151,8 +1150,8 @@ static int apseed_spi_of_to_plat(struct udevice *bus) plat->hclk_rate =clk_get_rate (&hclk);clk_free (&hclk); -dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n" , - (u32 )priv->regs, plat->ahb_base, plat->ahb_sz); +dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%llx\n" , + (u32 )priv->regs, plat->ahb_base, (fdt64_t )plat->ahb_sz);dev_dbg (bus,"hclk = %dMHz, max_cs = %d\n" , plat->hclk_rate /1000000 , plat->max_cs);
--
2.20.1
Re: [PATCH v2 2/2] spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr
Hi
Quoted 60 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so usedevfdt_get_addr_index_ptranddevfdt_get_addr_size_index_ptrfunction in thespi-aspeed-smc.cfile. Also fixdev_dbgto be able to handle both sizes.Signed-off-by Johan Jonker <[email protected]>---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Changed V2:
Usedevfdt_get_addr_index_ptranddevfdt_get_addr_size_index_ptr--- drivers/spi/spi-aspeed-smc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)drivers/spi/spi-aspeed-smc.c +6
-8@@ -1125,15 +1125,14 @@ static int apseed_spi_of_to_plat(struct udevice *bus)int ret;struct clk hclk; - priv->regs = (void __iomem *)devfdt_get_addr_index (bus,0 ); -if ((u32 )priv->regs ==FDT_ADDR_T_NONE ) { + priv->regs =devfdt_get_addr_index_ptr (bus,0 ); +if (!priv->regs) {dev_err (bus,"wrong ctrl base\n" );return -ENODEV ; } - plat->ahb_base = - (void __iomem *)devfdt_get_addr_size_index (bus,1 , &plat->ahb_sz); -if ((u32 )plat->ahb_base ==FDT_ADDR_T_NONE ) { + plat->ahb_base =devfdt_get_addr_size_index_ptr (bus,1 , &plat->ahb_sz); +if (!plat->ahb_base) {dev_err (bus,"wrong AHB base\n" );return -ENODEV ; }@@ -1151,8 +1150,8 @@ static int apseed_spi_of_to_plat(struct udevice *bus) plat->hclk_rate =clk_get_rate (&hclk);clk_free (&hclk); -dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%lx\n" , - (u32 )priv->regs, plat->ahb_base, plat->ahb_sz); +dev_dbg (bus,"ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%llx\n" , + (u32 )priv->regs, plat->ahb_base, (fdt64_t )plat->ahb_sz);dev_dbg (bus,"hclk = %dMHz, max_cs = %d\n" , plat->hclk_rate /1000000 , plat->max_cs); --
Quoted 2 lines
2.20.1
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v2 1/2] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
In reply to Johan JonkerHi
Quoted 58 lines · Johan Jonker
Add
devfdt_get_addr_size_index_ptrfunction with the same functionality asdevfdt_get_addr_size_index, but instead a return pointer is given.Suggested-by Michael Nazzareno Trimarchi <[email protected]>Signed-off-by Johan Jonker <[email protected]>--- drivers/core/fdtaddr.c | 8 ++++++++ include/dm/fdtaddr.h | 15 +++++++++++++++ 2 files changed, 23 insertions(+)drivers/core/fdtaddr.c +8
-0@@ -122,6 +122,14 @@ fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,#endif } +void *devfdt_get_addr_size_index_ptr (const struct udevice *dev,int index, +fdt_size_t *size) +{ +fdt_addr_t addr =devfdt_get_addr_size_index (dev, index, size); + +return (addr ==FDT_ADDR_T_NONE ) ?NULL : (void *)(uintptr_t )addr; +} +fdt_addr_t devfdt_get_addr_name (const struct udevice *dev,const char *name) {#if CONFIG_IS_ENABLED (OF_CONTROL )include/dm/fdtaddr.h +15
-1@@ -119,6 +119,21 @@ void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index);fdt_addr_t devfdt_get_addr_size_index (const struct udevice *dev,int index,fdt_size_t *size); +/** +* devfdt_get_addr_size_index_ptr() - Return indexed pointer to the address of the +* reg property of a device +* +* @dev: Pointer to a device +* @index: the 'reg' property can hold a list of <addr, size> pairs +* and @index is used to select which one is required +* @size: Pointer to size varible - this function returns the size +* specified in the 'reg' property here +* +* Return: Pointer to addr, or NULL if there is no such property +*/ +void *devfdt_get_addr_size_index_ptr (const struct udevice *dev,int index, +fdt_size_t *size); +/** * devfdt_get_addr_name() - Get the reg property of a device, indexed by name * --
Quoted 2 lines
2.20.1
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [PATCH v2 1/2] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
Hi Johan
Quoted 18 lines · Michael Nazzareno Trimarchi
Hi
Quoted 14 lines · Johan Jonker
Add
devfdt_get_addr_size_index_ptrfunction with the same functionality asdevfdt_get_addr_size_index, but instead a return pointer is given.Suggested-by Michael Nazzareno Trimarchi <[email protected]>Signed-off-by Johan Jonker <[email protected]>--- drivers/core/fdtaddr.c | 8 ++++++++ include/dm/fdtaddr.h | 15 +++++++++++++++ 2 files changed, 23 insertions(+)drivers/core/fdtaddr.c +0
-0
[snip]
Quoted 13 lines
Quoted 13 lines
drivers/core/fdtaddr.c +13
-0+/** +* devfdt_get_addr_size_index_ptr() - Return indexed pointer to the address of the +* reg property of a device +* +* @dev: Pointer to a device +* @index: the 'reg' property can hold a list of <addr, size> pairs +* and @index is used to select which one is required +* @size: Pointer to size varible - this function returns the size +* specified in the 'reg' property here +* +* Return: Pointer to addr, or NULL if there is no such property +*/ +void *devfdt_get_addr_size_index_ptr(const struct udevice *dev, int index,
Quoted 8 lines
Quoted 8 lines
drivers/core/fdtaddr.c +2
-1+ fdt_size_t *size); +/** * devfdt_get_addr_name() - Get the reg property of a device, indexed by name * -- 2.20.1
git grep "== FDT_ADDR_T_NONE"
I think using both function some of use cases can be rewritten now
MIchael
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
RFC PATCH 1/4 drivers: use dev_read_addr_index_ptr when cast to pointer
In reply to Kever YangThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use dev_read_addr_index_ptr instead of the dev_read_addr_index function in the various files in the drivers directory that cast to a pointer.
---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/
Replacement command used:
find . -type f -exec sed -i 's/*)dev_read_addr_index(/
*)dev_read_addr_index_ptr(/g' {} +
---
drivers/mtd/nand/raw/cortina_nand.c | 4 ++--
drivers/net/dm9000x.c | 2 +-
drivers/net/dwmac_meson8b.c | 4 ++--
drivers/pci/pcie_dw_meson.c | 4 ++--
drivers/pci/pcie_dw_rockchip.c | 4 ++--
drivers/watchdog/sbsa_gwdt.c | 12 ++++++------
6 files changed, 15 insertions(+), 15 deletions(-)drivers/mtd/nand/raw/cortina_nand.c +2 -2
@@ -1175,8 +1175,8 @@ static int fdt_decode_nand(struct udevice *dev, struct nand_drv *info)int ecc_strength; info->reg = (struct nand_ctlr *)dev_read_addr (dev); - info->dma_glb = (struct dma_global *)dev_read_addr_index (dev,1 ); - info->dma_nand = (struct dma_ssp *)dev_read_addr_index (dev,2 ); + info->dma_glb = (struct dma_global *)dev_read_addr_index_ptr (dev,1 ); + info->dma_nand = (struct dma_ssp *)dev_read_addr_index_ptr (dev,2 ); info->config.enabled =dev_read_enabled (dev); ecc_strength =dev_read_u32_default (dev,"nand-ecc-strength" ,16 ); info->flash_base =
drivers/net/dm9000x.c +1 -1
@@ -651,7 +651,7 @@ static int dm9000_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr_index (dev,0 ); db->base_io = (void __iomem *)pdata->iobase; - db->base_data = (void __iomem *)dev_read_addr_index (dev,1 ); + db->base_data = (void __iomem *)dev_read_addr_index_ptr (dev,1 );return 0 ; }
drivers/net/dwmac_meson8b.c +2 -2
@@ -41,8 +41,8 @@ static int dwmac_meson8b_of_to_plat(struct udevice *dev) {struct dwmac_meson8b_plat *pdata =dev_get_plat (dev); - pdata->regs = (void *)dev_read_addr_index (dev,1 ); -if ((fdt_addr_t )pdata->regs ==FDT_ADDR_T_NONE ) + pdata->regs =dev_read_addr_index_ptr (dev,1 ); +if (!pdata->regs)return -EINVAL ; pdata->dwmac_setup = (void *)dev_get_driver_data (dev);
drivers/pci/pcie_dw_meson.c +2 -2
@@ -337,13 +337,13 @@ static int meson_pcie_parse_dt(struct udevice *dev)struct meson_pcie *priv =dev_get_priv (dev);int ret; - priv->dw.dbi_base = (void *)dev_read_addr_index (dev,0 ); + priv->dw.dbi_base =dev_read_addr_index_ptr (dev,0 );if (!priv->dw.dbi_base)return -ENODEV ;dev_dbg (dev,"ELBI address is 0x%p\n" , priv->dw.dbi_base); - priv->meson_cfg_base = (void *)dev_read_addr_index (dev,1 ); + priv->meson_cfg_base =dev_read_addr_index_ptr (dev,1 );if (!priv->meson_cfg_base)return -ENODEV ;
drivers/pci/pcie_dw_rockchip.c +2 -2
@@ -353,13 +353,13 @@ static int rockchip_pcie_parse_dt(struct udevice *dev)struct rk_pcie *priv =dev_get_priv (dev);int ret; - priv->dw.dbi_base = (void *)dev_read_addr_index (dev,0 ); + priv->dw.dbi_base =dev_read_addr_index_ptr (dev,0 );if (!priv->dw.dbi_base)return -ENODEV ;dev_dbg (dev,"DBI address is 0x%p\n" , priv->dw.dbi_base); - priv->apb_base = (void *)dev_read_addr_index (dev,1 ); + priv->apb_base =dev_read_addr_index_ptr (dev,1 );if (!priv->apb_base)return -ENODEV ;
drivers/watchdog/sbsa_gwdt.c +6 -6
@@ -98,13 +98,13 @@ static int sbsa_gwdt_of_to_plat(struct udevice *dev) {struct sbsa_gwdt_priv *priv =dev_get_priv (dev); - priv->reg_control = (void __iomem *)dev_read_addr_index (dev,0 ); -if (IS_ERR (priv->reg_control)) -return PTR_ERR (priv->reg_control); + priv->reg_control = (void __iomem *)dev_read_addr_index_ptr (dev,0 ); +if (!priv->reg_control) +return -EINVAL ; - priv->reg_refresh = (void __iomem *)dev_read_addr_index (dev,1 ); -if (IS_ERR (priv->reg_refresh)) -return PTR_ERR (priv->reg_refresh); + priv->reg_refresh = (void __iomem *)dev_read_addr_index_ptr (dev,1 ); +if (!priv->reg_refresh) +return -EINVAL ;return 0 ; }
--
2.20.1
RFC PATCH 2/4 drivers: use dev_read_addr_ptr when cast to pointer
The fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use dev_read_addr_ptr instead of the dev_read_addr function in the various files in the drivers directory that cast to a pointer.
---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/
Replacement command used:
find . -type f -exec sed -i 's/*)dev_read_addr(/
*)dev_read_addr_ptr(/g' {} +
---
drivers/ata/dwc_ahsata.c | 2 +-
drivers/cache/cache-l2x0.c | 2 +-
drivers/cache/cache-v5l2.c | 2 +-
drivers/gpio/mscc_sgpio.c | 2 +-
drivers/gpio/tegra_gpio.c | 4 ++--
drivers/gpio/xilinx_gpio.c | 2 +-
drivers/i2c/i2c-cdns.c | 2 +-
drivers/i2c/tegra_i2c.c | 4 ++--
drivers/mmc/am654_sdhci.c | 2 +-
drivers/mmc/davinci_mmc.c | 2 +-
drivers/mmc/piton_mmc.c | 2 +-
drivers/mmc/tegra_mmc.c | 2 +-
drivers/mmc/zynq_sdhci.c | 6 +++---
drivers/mtd/nand/raw/arasan_nfc.c | 2 +-
drivers/mtd/nand/raw/cortina_nand.c | 2 +-
drivers/mtd/nand/raw/mxic_nand.c | 2 +-
drivers/mtd/nand/raw/tegra_nand.c | 2 +-
drivers/mtd/nand/raw/zynq_nand.c | 2 +-
drivers/net/mvmdio.c | 2 +-
drivers/net/qe/dm_qe_uec_phy.c | 2 +-
drivers/pci/pci-aardvark.c | 4 ++--
drivers/phy/allwinner/phy-sun50i-usb3.c | 6 +++---
drivers/phy/qcom/phy-qcom-usb-hs-28nm.c | 4 ++--
drivers/phy/qcom/phy-qcom-usb-ss.c | 4 ++--
drivers/phy/rockchip/phy-rockchip-snps-pcie3.c | 4 ++--
drivers/phy/rockchip/phy-rockchip-typec.c | 6 +++---
drivers/pwm/tegra_pwm.c | 2 +-
drivers/serial/serial_zynq.c | 6 +++---
drivers/spi/mpc8xxx_spi.c | 2 +-
drivers/spi/mscc_bb_spi.c | 2 +-
drivers/spi/sh_qspi.c | 2 +-
drivers/spi/spi-mxic.c | 2 +-
drivers/spi/xilinx_spi.c | 2 +-
drivers/ufs/ufs.c | 2 +-
drivers/usb/host/ehci-tegra.c | 2 +-
drivers/video/dw_mipi_dsi.c | 4 ++--
drivers/video/rockchip/rk_vop.c | 2 +-
drivers/video/stm32/stm32_dsi.c | 4 ++--
drivers/video/stm32/stm32_ltdc.c | 4 ++--
drivers/video/tegra124/display.c | 2 +-
drivers/video/tegra124/sor.c | 6 +++---
drivers/watchdog/cdns_wdt.c | 6 +++---
drivers/watchdog/sp805_wdt.c | 6 +++---
drivers/watchdog/xilinx_tb_wdt.c | 6 +++---
44 files changed, 69 insertions(+), 69 deletions(-)drivers/ata/dwc_ahsata.c +1 -1
@@ -912,7 +912,7 @@ int dwc_ahsata_probe(struct udevice *dev)#endif uc_priv->host_flags =ATA_FLAG_SATA |ATA_FLAG_NO_LEGACY |ATA_FLAG_MMIO |ATA_FLAG_PIO_DMA |ATA_FLAG_NO_ATAPI ; - uc_priv->mmio_base = (void __iomem *)dev_read_addr (dev); + uc_priv->mmio_base = (void __iomem *)dev_read_addr_ptr (dev);/* initialize adapter */ ret =ahci_host_init (uc_priv);
drivers/cache/cache-l2x0.c +1 -1
@@ -13,7 +13,7 @@ static void l2c310_of_parse_and_init(struct udevice *dev) {u32 tag[3 ] = {0 ,0 ,0 };u32 saved_reg, prefetch; -struct pl310_regs *regs = (struct pl310_regs *)dev_read_addr (dev); +struct pl310_regs *regs = (struct pl310_regs *)dev_read_addr_ptr (dev);/* Disable the L2 Cache */ clrbits_le32 (®s->pl310_ctrl,L2X0_CTRL_EN );
drivers/cache/cache-v5l2.c +1 -1
@@ -110,7 +110,7 @@ static int v5l2_of_to_plat(struct udevice *dev)struct v5l2_plat *plat =dev_get_plat (dev);struct l2cache *regs; - regs = (struct l2cache *)dev_read_addr (dev); + regs = (struct l2cache *)dev_read_addr_ptr (dev); plat->regs = regs; plat->iprefetch = -EINVAL ;
drivers/gpio/mscc_sgpio.c +1 -1
@@ -232,7 +232,7 @@ static int mscc_sgpio_probe(struct udevice *dev)debug ("probe: gpios = %d, bit-count = %d\n" , uc_priv->gpio_count, priv->bitcount); - priv->regs = (u32 __iomem *)dev_read_addr (dev); + priv->regs = (u32 __iomem *)dev_read_addr_ptr (dev); uc_priv->bank_name ="sgpio" ; sgpio_clrsetbits(priv, REG_SIO_CONFIG, 0,
drivers/gpio/tegra_gpio.c +2 -2
@@ -339,8 +339,8 @@ static int gpio_tegra_bind(struct udevice *parent)if (len <0 )return len; bank_count = len /3 /sizeof (u32); - ctlr = (struct gpio_ctlr *)dev_read_addr (parent); -if ((ulong )ctlr ==FDT_ADDR_T_NONE ) + ctlr = (struct gpio_ctlr *)dev_read_addr_ptr (parent); +if (!ctlr) return -EINVAL; }#endif
drivers/gpio/xilinx_gpio.c +1 -1
@@ -268,7 +268,7 @@ static int xilinx_gpio_of_to_plat(struct udevice *dev)struct xilinx_gpio_plat *plat =dev_get_plat (dev);int is_dual; - plat->regs = (struct gpio_regs *)dev_read_addr (dev); + plat->regs = (struct gpio_regs *)dev_read_addr_ptr (dev); plat->bank_max[0 ] =dev_read_u32_default (dev,"xlnx,gpio-width" ,0 ); plat->bank_input[0 ] =dev_read_u32_default (dev,"xlnx,all-inputs" ,0 );
drivers/i2c/i2c-cdns.c +1 -1
@@ -477,7 +477,7 @@ static int cdns_i2c_of_to_plat(struct udevice *dev)struct clk clk;int ret; - i2c_bus->regs = (struct cdns_i2c_regs *)dev_read_addr (dev); + i2c_bus->regs = (struct cdns_i2c_regs *)dev_read_addr_ptr (dev);if (!i2c_bus->regs)return -ENOMEM ;
drivers/i2c/tegra_i2c.c +2 -2
@@ -364,8 +364,8 @@ static int tegra_i2c_probe(struct udevice *dev) i2c_bus->id =dev_seq (dev); i2c_bus->type =dev_get_driver_data (dev); - i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr (dev); -if ((ulong )i2c_bus->regs ==FDT_ADDR_T_NONE ) { + i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr_ptr (dev); +if (!i2c_bus->regs) {debug ("%s: Cannot get regs address\n" , __func__);return -EINVAL ; }
drivers/mmc/am654_sdhci.c +1 -1
@@ -584,7 +584,7 @@ static int am654_sdhci_of_to_plat(struct udevice *dev)int ret; host->name = dev->name; - host->ioaddr = (void *)dev_read_addr (dev); + host->ioaddr =dev_read_addr_ptr (dev); plat->non_removable =dev_read_bool (dev,"non-removable" );if (plat->flags &DLL_PRESENT ) {
drivers/mmc/davinci_mmc.c +1 -1
@@ -506,7 +506,7 @@ static int davinci_mmc_of_to_plat(struct udevice *dev)struct davinci_mmc_plat *plat =dev_get_plat (dev);struct mmc_config *cfg = &plat->cfg; - plat->reg_base = (struct davinci_mmc_regs *)dev_read_addr (dev); + plat->reg_base = (struct davinci_mmc_regs *)dev_read_addr_ptr (dev); cfg->f_min =200000 ; cfg->f_max =25000000 ; cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
drivers/mmc/piton_mmc.c +1 -1
@@ -74,7 +74,7 @@ static int piton_mmc_ofdata_to_platdata(struct udevice *dev)struct mmc *mmc;struct blk_desc *bdesc; - priv->base_addr = (void *)dev_read_addr (dev); + priv->base_addr =dev_read_addr_ptr (dev); cfg = &plat->cfg; cfg->name ="PITON MMC" ; cfg->host_caps =MMC_MODE_8BIT ;
drivers/mmc/tegra_mmc.c +1 -1
@@ -708,7 +708,7 @@ static int tegra_mmc_probe(struct udevice *dev) cfg->b_max =CONFIG_SYS_MMC_MAX_BLK_COUNT ; - priv->reg = (void *)dev_read_addr (dev); + priv->reg =dev_read_addr_ptr (dev); ret =reset_get_by_name (dev,"sdhci" , &priv->reset_ctl);if (ret) {
drivers/mmc/zynq_sdhci.c +3 -3
@@ -910,9 +910,9 @@ static int arasan_sdhci_of_to_plat(struct udevice *dev)arasan_dt_parse_clk_phases (dev);#endif - priv->host->ioaddr = (void *)dev_read_addr (dev); -if (IS_ERR (priv->host->ioaddr)) -return PTR_ERR (priv->host->ioaddr); + priv->host->ioaddr =dev_read_addr_ptr (dev); +if (!priv->host->ioaddr) +return -EINVAL ; priv->bank =dev_read_u32_default (dev,"xlnx,mio-bank" ,0 ); priv->no_1p8 =dev_read_bool (dev,"no-1-8-v" );
drivers/mtd/nand/raw/arasan_nfc.c +1 -1
@@ -1232,7 +1232,7 @@ static int arasan_probe(struct udevice *dev)struct mtd_info *mtd;int err =-1 ; - info->reg = (struct nand_regs *)dev_read_addr (dev); + info->reg = (struct nand_regs *)dev_read_addr_ptr (dev); mtd =nand_to_mtd (nand_chip);nand_set_controller_data (nand_chip, &arasan->nand_ctrl);
drivers/mtd/nand/raw/cortina_nand.c +1 -1
@@ -1174,7 +1174,7 @@ static int fdt_decode_nand(struct udevice *dev, struct nand_drv *info) {int ecc_strength; - info->reg = (struct nand_ctlr *)dev_read_addr (dev); + info->reg = (struct nand_ctlr *)dev_read_addr_ptr (dev); info->dma_glb = (struct dma_global *)dev_read_addr_index_ptr (dev,1 ); info->dma_nand = (struct dma_ssp *)dev_read_addr_index_ptr (dev,2 ); info->config.enabled =dev_read_enabled (dev);
drivers/mtd/nand/raw/mxic_nand.c +1 -1
@@ -538,7 +538,7 @@ static int mxic_nfc_probe(struct udevice *dev)ofnode child;int err; - nfc->regs = (void *)dev_read_addr (dev); + nfc->regs =dev_read_addr_ptr (dev); nfc->send_clk =devm_clk_get (dev,"send" );if (IS_ERR (nfc->send_clk))
drivers/mtd/nand/raw/tegra_nand.c +1 -1
@@ -906,7 +906,7 @@ static int fdt_decode_nand(struct udevice *dev, struct fdt_nand *config) {int err; - config->reg = (struct nand_ctlr *)dev_read_addr (dev); + config->reg = (struct nand_ctlr *)dev_read_addr_ptr (dev); config->enabled =dev_read_enabled (dev); config->width =dev_read_u32_default (dev,"nvidia,nand-width" ,8 ); err = gpio_request_by_name(dev, "nvidia,wp-gpios", 0, &config->wp_gpio,
drivers/mtd/nand/raw/zynq_nand.c +1 -1
@@ -1085,7 +1085,7 @@ static int zynq_nand_probe(struct udevice *dev)int ondie_ecc_enabled =0 ;int is_16bit_bw; - smc->reg = (struct zynq_nand_smc_regs *)dev_read_addr (dev); + smc->reg = (struct zynq_nand_smc_regs *)dev_read_addr_ptr (dev); of_nand =dev_read_subnode (dev,"nand-controller@0,0" );if (!ofnode_valid (of_nand)) { of_nand =dev_read_subnode (dev,"flash@e1000000" );
drivers/net/mvmdio.c +1 -1
@@ -208,7 +208,7 @@ static int mvmdio_probe(struct udevice *dev) {struct mvmdio_priv *priv =dev_get_priv (dev); - priv->mdio_base = (void *)dev_read_addr (dev); + priv->mdio_base =dev_read_addr_ptr (dev); priv->type = (enum mvmdio_bus_type )dev_get_driver_data (dev);return 0 ;
drivers/net/qe/dm_qe_uec_phy.c +1 -1
@@ -97,7 +97,7 @@ static int qe_uec_mdio_probe(struct udevice *dev)u32 num =0 ;int ret = -ENODEV ; - priv->base = (struct ucc_mii_mng *)dev_read_addr (dev); + priv->base = (struct ucc_mii_mng *)dev_read_addr_ptr (dev); base = (fdt_size_t )priv->base;/*
drivers/pci/pci-aardvark.c +2 -2
@@ -983,8 +983,8 @@ static int pcie_advk_of_to_plat(struct udevice *dev)struct pcie_advk *pcie =dev_get_priv (dev);/* Get the register base address */ - pcie->base = (void *)dev_read_addr (dev); -if ((fdt_addr_t )pcie->base ==FDT_ADDR_T_NONE ) + pcie->base =dev_read_addr_ptr (dev); +if (!pcie->base)return -EINVAL ;return 0 ;
drivers/phy/allwinner/phy-sun50i-usb3.c +3 -3
@@ -149,9 +149,9 @@ static int sun50i_usb3_phy_probe(struct udevice *dev)return ret; } - priv->regs = (void __iomem *)dev_read_addr (dev); -if (IS_ERR (priv->regs)) -return PTR_ERR (priv->regs); + priv->regs = (void __iomem *)dev_read_addr_ptr (dev); +if (!priv->regs) +return -EINVAL ;return 0 ; }
drivers/phy/qcom/phy-qcom-usb-hs-28nm.c +2 -2
@@ -184,8 +184,8 @@ static int hsphy_probe(struct udevice *dev)struct hsphy_priv *priv =dev_get_priv (dev);int ret; - priv->base = (void *)dev_read_addr (dev); -if ((ulong )priv->base ==FDT_ADDR_T_NONE ) + priv->base =dev_read_addr_ptr (dev); +if (!priv->base)return -EINVAL ; ret =reset_get_by_name (dev,"phy" , &priv->phy_rst);
drivers/phy/qcom/phy-qcom-usb-ss.c +2 -2
@@ -115,8 +115,8 @@ static int ssphy_probe(struct udevice *dev)struct ssphy_priv *priv =dev_get_priv (dev);int ret; - priv->base = (void *)dev_read_addr (dev); -if ((ulong )priv->base ==FDT_ADDR_T_NONE ) + priv->base =dev_read_addr_ptr (dev); +if (!priv->base)return -EINVAL ; ret =ssphy_clk_init (dev, priv);
drivers/phy/rockchip/phy-rockchip-snps-pcie3.c +2 -2
@@ -93,8 +93,8 @@ static int rockchip_p3phy_probe(struct udevice *dev)struct udevice *syscon;int ret; - priv->mmio = (void __iomem *)dev_read_addr (dev); -if ((fdt_addr_t )priv->mmio ==FDT_ADDR_T_NONE ) + priv->mmio = (void __iomem *)dev_read_addr_ptr (dev); +if (!priv->mmio)return -EINVAL ; ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev,
drivers/phy/rockchip/phy-rockchip-typec.c +3 -3
@@ -674,9 +674,9 @@ static int rockchip_tcphy_probe(struct udevice *dev)unsigned int reg;int index, ret; - priv->reg_base = (void __iomem *)dev_read_addr (dev); -if (IS_ERR (priv->reg_base)) -return PTR_ERR (priv->reg_base); + priv->reg_base = (void __iomem *)dev_read_addr_ptr (dev); +if (!priv->reg_base) +return -EINVAL ; ret =dev_read_u32_index (dev,"reg" ,1 , ®);if (ret) {
drivers/pwm/tegra_pwm.c +1 -1
@@ -57,7 +57,7 @@ static int tegra_pwm_of_to_plat(struct udevice *dev) {struct tegra_pwm_priv *priv =dev_get_priv (dev); - priv->regs = (struct pwm_ctlr *)dev_read_addr (dev); + priv->regs = (struct pwm_ctlr *)dev_read_addr_ptr (dev);return 0 ; }
drivers/serial/serial_zynq.c +3 -3
@@ -259,9 +259,9 @@ static int zynq_serial_of_to_plat(struct udevice *dev) {struct zynq_uart_plat *plat =dev_get_plat (dev); - plat->regs = (struct uart_zynq *)dev_read_addr (dev); -if (IS_ERR (plat->regs)) -return PTR_ERR (plat->regs); + plat->regs = (struct uart_zynq *)dev_read_addr_ptr (dev); +if (!plat->regs) +return -EINVAL ;return 0 ; }
drivers/spi/mpc8xxx_spi.c +1 -1
@@ -54,7 +54,7 @@ static int mpc8xxx_spi_of_to_plat(struct udevice *dev)struct clk clk;int ret; - priv->spi = (spi8xxx_t *)dev_read_addr (dev); + priv->spi = (spi8xxx_t *)dev_read_addr_ptr (dev); ret =gpio_request_list_by_name (dev,"gpios" , priv->gpios,ARRAY_SIZE (priv->gpios),GPIOD_IS_OUT |GPIOD_ACTIVE_LOW );
drivers/spi/mscc_bb_spi.c +1 -1
@@ -217,7 +217,7 @@ static int mscc_bb_spi_probe(struct udevice *bus)debug ("%s: loaded, priv %p\n" , __func__, priv); - priv->regs = (void __iomem *)dev_read_addr (bus); + priv->regs = (void __iomem *)dev_read_addr_ptr (bus); priv->deactivate_delay_us =dev_read_u32_default (bus,"spi-deactivate-delay" ,0 );
drivers/spi/sh_qspi.c +1 -1
@@ -332,7 +332,7 @@ static int sh_qspi_of_to_plat(struct udevice *dev) {struct sh_qspi_slave *plat =dev_get_plat (dev); - plat->regs = (struct sh_qspi_regs *)dev_read_addr (dev); + plat->regs = (struct sh_qspi_regs *)dev_read_addr_ptr (dev);return 0 ; }
drivers/spi/spi-mxic.c +1 -1
@@ -508,7 +508,7 @@ static int mxic_spi_probe(struct udevice *bus) {struct mxic_spi_priv *priv =dev_get_priv (bus); - priv->regs = (void *)dev_read_addr (bus); + priv->regs =dev_read_addr_ptr (bus); priv->send_clk =devm_clk_get (bus,"send_clk" );if (IS_ERR (priv->send_clk))
drivers/spi/xilinx_spi.c +1 -1
@@ -114,7 +114,7 @@ static int xilinx_spi_probe(struct udevice *bus)struct xilinx_spi_priv *priv =dev_get_priv (bus);struct xilinx_spi_regs *regs = priv->regs; - priv->regs = (struct xilinx_spi_regs *)dev_read_addr (bus); + priv->regs = (struct xilinx_spi_regs *)dev_read_addr_ptr (bus); priv->fifo_depth =dev_read_u32_default (bus,"fifo-size" ,0 );
drivers/ufs/ufs.c +1 -1
@@ -1880,7 +1880,7 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops) hba->dev = ufs_dev; hba->ops = hba_ops; - hba->mmio_base = (void *)dev_read_addr (ufs_dev); + hba->mmio_base =dev_read_addr_ptr (ufs_dev);/* Set descriptor lengths to specification defaults */ ufshcd_def_desc_sizes (hba);
drivers/usb/host/ehci-tegra.c +1 -1
@@ -695,7 +695,7 @@ static int fdt_decode_usb(struct udevice *dev, struct fdt_usb *config) {const char *phy, *mode; - config->reg = (struct usb_ctlr *)dev_read_addr (dev); + config->reg = (struct usb_ctlr *)dev_read_addr_ptr (dev);debug ("reg=%p\n" , config->reg); mode =dev_read_string (dev,"dr_mode" );if (mode) {
drivers/video/dw_mipi_dsi.c +2 -2
@@ -800,8 +800,8 @@ static int dw_mipi_dsi_init(struct udevice *dev, dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; device->host = &dsi->dsi_host; - dsi->base = (void *)dev_read_addr (device->dev); -if ((fdt_addr_t )dsi->base ==FDT_ADDR_T_NONE ) { + dsi->base =dev_read_addr_ptr (device->dev); + if ((!dsi->base) {dev_err (device->dev,"dsi dt register address error\n" );return -EINVAL ; }
drivers/video/rockchip/rk_vop.c +1 -1
@@ -446,7 +446,7 @@ int rk_vop_probe(struct udevice *dev)efi_add_memory_map (plat->base, plat->size,EFI_RESERVED_MEMORY_TYPE );#endif - priv->regs = (struct rk3288_vop *)dev_read_addr (dev); + priv->regs = (struct rk3288_vop *)dev_read_addr_ptr (dev);/* * Try all the ports until we find one that works. In practice this
drivers/video/stm32/stm32_dsi.c +2 -2
@@ -427,8 +427,8 @@ static int stm32_dsi_probe(struct udevice *dev) device->dev = dev; - priv->base = (void *)dev_read_addr (dev); -if ((fdt_addr_t )priv->base ==FDT_ADDR_T_NONE ) { + priv->base =dev_read_addr_ptr (dev); +if (!priv->base) {dev_err (dev,"dsi dt register address error\n" );return -EINVAL ; }
drivers/video/stm32/stm32_ltdc.c +2 -2
@@ -507,8 +507,8 @@ static int stm32_ltdc_probe(struct udevice *dev)ulong rate;int ret; - priv->regs = (void *)dev_read_addr (dev); -if ((fdt_addr_t )priv->regs ==FDT_ADDR_T_NONE ) { + priv->regs =dev_read_addr_ptr (dev); +if (!priv->regs) {dev_err (dev,"ltdc dt register address error\n" );return -EINVAL ; }
drivers/video/tegra124/display.c +1 -1
@@ -361,7 +361,7 @@ static int display_init(struct udevice *dev, void *lcdbase,return ret; } - dc_ctlr = (struct dc_ctlr *)dev_read_addr (dev); + dc_ctlr = (struct dc_ctlr *)dev_read_addr_ptr (dev);if (ofnode_decode_display_timing (dev_ofnode (dev),0 , timing)) {debug ("%s: Failed to decode display timing\n" , __func__);return -EINVAL ;
drivers/video/tegra124/sor.c +3 -3
@@ -765,7 +765,7 @@ int tegra_dc_sor_attach(struct udevice *dc_dev, struct udevice *dev,/* Use the first display controller */ debug ("%s\n" , __func__); - disp_ctrl = (struct dc_ctlr *)dev_read_addr (dc_dev); + disp_ctrl = (struct dc_ctlr *)dev_read_addr_ptr (dc_dev);tegra_dc_sor_enable_dc (disp_ctrl);tegra_dc_sor_config_panel (sor,0 , link_cfg, timing);
@@ -978,7 +978,7 @@ int tegra_dc_sor_detach(struct udevice *dc_dev, struct udevice *dev)debug ("%s\n" , __func__);/* Use the first display controller */ - disp_ctrl = (struct dc_ctlr *)dev_read_addr (dev); + disp_ctrl = (struct dc_ctlr *)dev_read_addr_ptr (dev);/* Sleep mode */ tegra_sor_writel(sor, SUPER_STATE1, SUPER_STATE1_ASY_HEAD_OP_SLEEP |
@@ -1047,7 +1047,7 @@ static int tegra_sor_of_to_plat(struct udevice *dev)struct tegra_dc_sor_data *priv =dev_get_priv (dev);int ret; - priv->base = (void *)dev_read_addr (dev); + priv->base =dev_read_addr_ptr (dev); priv->pmc_base = (void *)syscon_get_first_range (TEGRA_SYSCON_PMC );if (IS_ERR (priv->pmc_base))
drivers/watchdog/cdns_wdt.c +3 -3
@@ -271,9 +271,9 @@ static int cdns_wdt_of_to_plat(struct udevice *dev) {struct cdns_wdt_priv *priv =dev_get_priv (dev); - priv->regs = (struct cdns_regs *)dev_read_addr (dev); -if (IS_ERR (priv->regs)) -return PTR_ERR (priv->regs); + priv->regs = (struct cdns_regs *)dev_read_addr_ptr (dev); +if (!priv->regs) +return -EINVAL ; priv->rst =dev_read_bool (dev,"reset-on-timeout" );
drivers/watchdog/sp805_wdt.c +3 -3
@@ -116,9 +116,9 @@ static int sp805_wdt_of_to_plat(struct udevice *dev)struct sp805_wdt_priv *priv =dev_get_priv (dev);struct clk clk; - priv->reg = (void __iomem *)dev_read_addr (dev); -if (IS_ERR (priv->reg)) -return PTR_ERR (priv->reg); + priv->reg = (void __iomem *)dev_read_addr_ptr (dev); +if (!priv->reg) +return -EINVAL ;if (!clk_get_by_index (dev,0 , &clk)) priv->clk_rate =clk_get_rate (&clk);
drivers/watchdog/xilinx_tb_wdt.c +3 -3
@@ -94,9 +94,9 @@ static int xlnx_wdt_of_to_plat(struct udevice *dev) {struct xlnx_wdt_plat *plat =dev_get_plat (dev); - plat->regs = (struct watchdog_regs *)dev_read_addr (dev); -if (IS_ERR (plat->regs)) -return PTR_ERR (plat->regs); + plat->regs = (struct watchdog_regs *)dev_read_addr_ptr (dev); +if (!plat->regs) +return -EINVAL ; plat->enable_once =dev_read_u32_default (dev,"xlnx,wdt-enable-once" ,0 );
--
2.20.1
Re: [RFC PATCH v1 2/4] drivers: use dev_read_addr_ptr when cast to pointer
Quoted 67 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so usedev_read_addr_ptrinstead of thedev_read_addrfunction in the various files in the drivers directory that cast to a pointer.Signed-off-by Johan Jonker <[email protected]>---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Replacement command used:
find . -type f -exec sed -i 's/*)dev_read_addr(/*)dev_read_addr_ptr(/g' {} + --- drivers/ata/dwc_ahsata.c | 2 +- drivers/cache/cache-l2x0.c | 2 +- drivers/cache/cache-v5l2.c | 2 +- drivers/gpio/mscc_sgpio.c | 2 +- drivers/gpio/tegra_gpio.c | 4 ++-- drivers/gpio/xilinx_gpio.c | 2 +- drivers/i2c/i2c-cdns.c | 2 +- drivers/i2c/tegra_i2c.c | 4 ++-- drivers/mmc/am654_sdhci.c | 2 +- drivers/mmc/davinci_mmc.c | 2 +- drivers/mmc/piton_mmc.c | 2 +- drivers/mmc/tegra_mmc.c | 2 +- drivers/mmc/zynq_sdhci.c | 6 +++--- drivers/mtd/nand/raw/arasan_nfc.c | 2 +- drivers/mtd/nand/raw/cortina_nand.c | 2 +- drivers/mtd/nand/raw/mxic_nand.c | 2 +- drivers/mtd/nand/raw/tegra_nand.c | 2 +- drivers/mtd/nand/raw/zynq_nand.c | 2 +- drivers/net/mvmdio.c | 2 +- drivers/net/qe/dm_qe_uec_phy.c | 2 +- drivers/pci/pci-aardvark.c | 4 ++-- drivers/phy/allwinner/phy-sun50i-usb3.c | 6 +++--- drivers/phy/qcom/phy-qcom-usb-hs-28nm.c | 4 ++-- drivers/phy/qcom/phy-qcom-usb-ss.c | 4 ++-- drivers/phy/rockchip/phy-rockchip-snps-pcie3.c | 4 ++-- drivers/phy/rockchip/phy-rockchip-typec.c | 6 +++--- drivers/pwm/tegra_pwm.c | 2 +- drivers/serial/serial_zynq.c | 6 +++--- drivers/spi/mpc8xxx_spi.c | 2 +- drivers/spi/mscc_bb_spi.c | 2 +- drivers/spi/sh_qspi.c | 2 +- drivers/spi/spi-mxic.c | 2 +- drivers/spi/xilinx_spi.c | 2 +- drivers/ufs/ufs.c | 2 +- drivers/usb/host/ehci-tegra.c | 2 +- drivers/video/dw_mipi_dsi.c | 4 ++-- drivers/video/rockchip/rk_vop.c | 2 +- drivers/video/stm32/stm32_dsi.c | 4 ++-- drivers/video/stm32/stm32_ltdc.c | 4 ++-- drivers/video/tegra124/display.c | 2 +- drivers/video/tegra124/sor.c | 6 +++--- drivers/watchdog/cdns_wdt.c | 6 +++--- drivers/watchdog/sp805_wdt.c | 6 +++--- drivers/watchdog/xilinx_tb_wdt.c | 6 +++--- 44 files changed, 69 insertions(+), 69 deletions(-)
[..]
drivers/video/dw_mipi_dsi.c static int dw_mipi_dsi_init(struct udevice *dev, · line 805
Quoted 13 lines
drivers/video/dw_mipi_dsi.c +2
-2@@ -800,8 +800,8 @@ static int dw_mipi_dsi_init(struct udevice *dev, dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; device->host = &dsi->dsi_host; - dsi->base = (void *)dev_read_addr (device->dev); -if ((fdt_addr_t )dsi->base ==FDT_ADDR_T_NONE ) { + dsi->base =dev_read_addr_ptr (device->dev); + if ((!dsi->base) {
if (!dsi->base) {
Oops typo, sorry..
Quoted 3 lines
drivers/video/dw_mipi_dsi.c +0
-0dev_err (device->dev,"dsi dt register address error\n" );return -EINVAL ;}
[..]
0);
Quoted 3 lines
--
2.20.1
RFC PATCH 3/4 drivers: use devfdt_get_addr_size_index_ptr when cast to pointer
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use devfdt_get_addr_size_index_ptr instead of
the devfdt_get_addr_size_index function in the various files in the drivers directory that cast to a pointer.
---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/
Replacement command used:
find . -type f -exec sed -i 's/*)devfdt_get_addr_size_index(/
*)devfdt_get_addr_size_index_ptr(/g' {} +
---
drivers/pci/pcie_dw_mvebu.c | 6 +++---
drivers/spi/cadence_qspi.c | 3 +--
2 files changed, 4 insertions(+), 5 deletions(-)drivers/pci/pcie_dw_mvebu.c +3 -3
@@ -569,9 +569,9 @@ static int pcie_dw_mvebu_of_to_plat(struct udevice *dev)return -EINVAL ;/* Get the config space base address and size */ - pcie->cfg_base = (void *)devfdt_get_addr_size_index (dev,1 , - &pcie->cfg_size); -if ((fdt_addr_t )pcie->cfg_base ==FDT_ADDR_T_NONE ) + pcie->cfg_base =devfdt_get_addr_size_index_ptr (dev,1 , + &pcie->cfg_size); +if (!pcie->cfg_base)return -EINVAL ;return 0 ;
drivers/spi/cadence_qspi.c +1 -2
@@ -378,8 +378,7 @@ static int cadence_spi_of_to_plat(struct udevice *bus)ofnode subnode; plat->regbase = (void *)devfdt_get_addr_index (bus,0 ); - plat->ahbbase = (void *)devfdt_get_addr_size_index (bus,1 , - &plat->ahbsize); + plat->ahbbase =devfdt_get_addr_size_index_ptr (bus,1 , &plat->ahbsize); plat->is_decoded_cs =dev_read_bool (bus,"cdns,is-decoded-cs" ); plat->fifo_depth =dev_read_u32_default (bus,"cdns,fifo-depth" ,128 ); plat->fifo_width =dev_read_u32_default (bus,"cdns,fifo-width" ,4 );
--
2.20.1
Re: [RFC PATCH v1 3/4] drivers: use devfdt_get_addr_size_index_ptr when cast to pointer
Hi
Quoted 7 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so usedevfdt_get_addr_size_index_ptrinstead of
thedevfdt_get_addr_size_indexfunction in the various files in the drivers directory that cast to a pointer.
Nice if you use more size for each line ;)
Quoted 41 lines
Signed-off-by Johan Jonker <[email protected]>---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Replacement command used:
find . -type f -exec sed -i 's/*)devfdt_get_addr_size_index(/*)devfdt_get_addr_size_index_ptr(/g' {} + --- drivers/pci/pcie_dw_mvebu.c | 6 +++--- drivers/spi/cadence_qspi.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-)drivers/pci/pcie_dw_mvebu.c +3
-3@@ -569,9 +569,9 @@ static int pcie_dw_mvebu_of_to_plat(struct udevice *dev)return -EINVAL ;/* Get the config space base address and size */ - pcie->cfg_base = (void *)devfdt_get_addr_size_index (dev,1 , - &pcie->cfg_size); -if ((fdt_addr_t )pcie->cfg_base ==FDT_ADDR_T_NONE ) + pcie->cfg_base =devfdt_get_addr_size_index_ptr (dev,1 , + &pcie->cfg_size); +if (!pcie->cfg_base)return -EINVAL ;return 0 ;drivers/spi/cadence_qspi.c +0
-0
drivers/spi/cadence_qspi.c static int cadence_spi_of_to_plat(struct udevice *bus) · line 381
Quoted 6 lines
drivers/spi/cadence_qspi.c +1
-2@@ -378,8 +378,7 @@ static int cadence_spi_of_to_plat(struct udevice *bus)ofnode subnode; plat->regbase = (void *)devfdt_get_addr_index (bus,0 ); - plat->ahbbase = (void *)devfdt_get_addr_size_index (bus,1 , - &plat->ahbsize); + plat->ahbbase =devfdt_get_addr_size_index_ptr (bus,1 , &plat->ahbsize);
hope that ahbbase then is checked if is NULL
drivers/spi/cadence_qspi.c static int cadence_spi_of_to_plat(struct udevice *bus) · line 384
Quoted 3 lines
drivers/spi/cadence_qspi.c +0
-0plat->is_decoded_cs =dev_read_bool (bus,"cdns,is-decoded-cs" ); plat->fifo_depth =dev_read_u32_default (bus,"cdns,fifo-depth" ,128 ); plat->fifo_width =dev_read_u32_default (bus,"cdns,fifo-width" ,4 );
Quoted 3 lines
--
2.20.1
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [RFC PATCH v1 3/4] drivers: use devfdt_get_addr_size_index_ptr when cast to pointer
In reply to Johan JonkerHi Johan,
Quoted 48 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so usedevfdt_get_addr_size_index_ptrinstead of
thedevfdt_get_addr_size_indexfunction in the various files in the drivers directory that cast to a pointer.Signed-off-by Johan Jonker <[email protected]>---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Replacement command used:
find . -type f -exec sed -i 's/*)devfdt_get_addr_size_index(/*)devfdt_get_addr_size_index_ptr(/g' {} + --- drivers/pci/pcie_dw_mvebu.c | 6 +++--- drivers/spi/cadence_qspi.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-)drivers/pci/pcie_dw_mvebu.c +3
-3@@ -569,9 +569,9 @@ static int pcie_dw_mvebu_of_to_plat(struct udevice *dev)return -EINVAL ;/* Get the config space base address and size */ - pcie->cfg_base = (void *)devfdt_get_addr_size_index (dev,1 , - &pcie->cfg_size); -if ((fdt_addr_t )pcie->cfg_base ==FDT_ADDR_T_NONE ) + pcie->cfg_base =devfdt_get_addr_size_index_ptr (dev,1 , + &pcie->cfg_size); +if (!pcie->cfg_base)return -EINVAL ;return 0 ;drivers/spi/cadence_qspi.c +0
-0
drivers/spi/cadence_qspi.c static int cadence_spi_of_to_plat(struct udevice *bus) · line 381
Quoted 6 lines
drivers/spi/cadence_qspi.c +1
-2@@ -378,8 +378,7 @@ static int cadence_spi_of_to_plat(struct udevice *bus)ofnode subnode; plat->regbase = (void *)devfdt_get_addr_index (bus,0 ); - plat->ahbbase = (void *)devfdt_get_addr_size_index (bus,1 , - &plat->ahbsize); + plat->ahbbase =devfdt_get_addr_size_index_ptr (bus,1 , &plat->ahbsize);
Please rebase the series on master (I have fixed a conflict) and test with buildman.
The CI pipeline outputs this error:
Building current source for 1 boards (1 thread, 64 jobs per thread) 52 aarch64: + xilinx_versal_virt 53+drivers/spi/cadence_qspi.c: In function 'cadence_spi_of_to_plat':54+drivers/spi/cadence_qspi.c:387:25: error: implicit declaration of function 'devfdt_get_addr_size_index_ptr'; did you mean 'devfdt_get_addr_size_index'? [-Werror=implicit-function-declaration] 55+ 387 | plat->ahbbase = devfdt_get_addr_size_index_ptr(bus, 1, &plat->ahbsize);
56+ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57+ | devfdt_get_addr_size_index 58+drivers/spi/cadence_qspi.c:387:23: error: assignment to 'void *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
Thanks and regards,
Dario
Quoted 6 lines
drivers/spi/cadence_qspi.c +0
-1plat->is_decoded_cs =dev_read_bool (bus,"cdns,is-decoded-cs" ); plat->fifo_depth =dev_read_u32_default (bus,"cdns,fifo-depth" ,128 ); plat->fifo_width =dev_read_u32_default (bus,"cdns,fifo-width" ,4 ); --2.20.1
Signature · 17 lines
Dario Binacchi Senior Embedded Linux Developer [email protected] __________________________________ Amarula Solutions SRL Via Le Canevare 30, 31100 Treviso, Veneto, IT T. +39 042 243 5310 [email protected] www.amarulasolutions.com
RFC PATCH 4/4 drivers: use devfdt_get_addr_index_ptr when cast to pointer
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use devfdt_get_addr_index_ptr instead of
the devfdt_get_addr_index function in the various files in the drivers directory that cast to a pointer.
---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/
Replacement command used:
find . -type f -exec sed -i 's/*)devfdt_get_addr_index(/
*)devfdt_get_addr_index_ptr(/g' {} +
---
drivers/clk/clk-hsdk-cgu.c | 4 ++--
drivers/ddr/altera/sdram_gen5.c | 2 +-
drivers/mmc/xenon_sdhci.c | 2 +-
drivers/net/mvpp2.c | 24 ++++++++++++------------
drivers/pci/pcie_dw_mvebu.c | 4 ++--
drivers/pci/pcie_imx.c | 4 ++--
drivers/pci/pcie_layerscape_ep.c | 4 ++--
drivers/phy/marvell/comphy_core.c | 12 ++++++------
drivers/spi/cadence_qspi.c | 2 +-
drivers/usb/musb-new/ti-musb.c | 2 +-
10 files changed, 30 insertions(+), 30 deletions(-)drivers/clk/clk-hsdk-cgu.c +2 -2
@@ -753,11 +753,11 @@ static int hsdk_cgu_clk_probe(struct udevice *dev)else hsdk_clk->map = hsdk_4xd_clk_map; - hsdk_clk->cgu_regs = (void __iomem *)devfdt_get_addr_index (dev,0 ); + hsdk_clk->cgu_regs = (void __iomem *)devfdt_get_addr_index_ptr (dev,0 );if (!hsdk_clk->cgu_regs)return -EINVAL ; - hsdk_clk->creg_regs = (void __iomem *)devfdt_get_addr_index (dev,1 ); + hsdk_clk->creg_regs = (void __iomem *)devfdt_get_addr_index_ptr (dev,1 );if (!hsdk_clk->creg_regs)return -EINVAL ;
drivers/ddr/altera/sdram_gen5.c +1 -1
@@ -567,7 +567,7 @@ static int altera_gen5_sdram_of_to_plat(struct udevice *dev) {struct altera_gen5_sdram_plat *plat =dev_get_plat (dev); - plat->sdr = (struct socfpga_sdr *)devfdt_get_addr_index (dev,0 ); + plat->sdr = (struct socfpga_sdr *)devfdt_get_addr_index_ptr (dev,0 );if (!plat->sdr)return -ENODEV ;
drivers/mmc/xenon_sdhci.c +1 -1
@@ -537,7 +537,7 @@ static int xenon_sdhci_of_to_plat(struct udevice *dev) host->ioaddr =dev_read_addr_ptr (dev);if (device_is_compatible (dev,"marvell,armada-3700-sdhci" )) - priv->pad_ctrl_reg = (void *)devfdt_get_addr_index (dev,1 ); + priv->pad_ctrl_reg =devfdt_get_addr_index_ptr (dev,1 ); name =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"marvell,pad-type" ,NULL );
drivers/net/mvpp2.c +12 -12
@@ -5351,18 +5351,18 @@ static int mvpp2_base_probe(struct udevice *dev) }/* Save base addresses for later use */ - priv->base = (void *)devfdt_get_addr_index (dev,0 ); -if (IS_ERR (priv->base)) -return PTR_ERR (priv->base); + priv->base =devfdt_get_addr_index_ptr (dev,0 ); +if (!priv->base) +return -EINVAL ;if (priv->hw_version ==MVPP21 ) { - priv->lms_base = (void *)devfdt_get_addr_index (dev,1 ); -if (IS_ERR (priv->lms_base)) -return PTR_ERR (priv->lms_base); + priv->lms_base =devfdt_get_addr_index_ptr (dev,1 ); +if (!priv->lms_base) +return -EINVAL ; }else { - priv->iface_base = (void *)devfdt_get_addr_index (dev,1 ); -if (IS_ERR (priv->iface_base)) -return PTR_ERR (priv->iface_base); + priv->iface_base =devfdt_get_addr_index_ptr (dev,1 ); +if (!priv->iface_base) +return -EINVAL ;/* Store common base addresses for all ports */ priv->mpcs_base = priv->iface_base +MVPP22_MPCS ;
@@ -5401,10 +5401,10 @@ static int mvpp2_probe(struct udevice *dev)if (priv->hw_version ==MVPP21 ) {int priv_common_regs_num =2 ; - port->base = (void __iomem *)devfdt_get_addr_index ( + port->base = (void __iomem *)devfdt_get_addr_index_ptr ( dev->parent, priv_common_regs_num + port->id); -if (IS_ERR (port->base)) -return PTR_ERR (port->base); +if (!port->base) +return -EINVAL ; }else { port->gop_id =fdtdec_get_int (gd->fdt_blob,dev_of_offset (dev),"gop-port-id" ,-1 );
drivers/pci/pcie_dw_mvebu.c +2 -2
@@ -564,8 +564,8 @@ static int pcie_dw_mvebu_of_to_plat(struct udevice *dev)struct pcie_dw_mvebu *pcie =dev_get_priv (dev);/* Get the controller base address */ - pcie->ctrl_base = (void *)devfdt_get_addr_index (dev,0 ); -if ((fdt_addr_t )pcie->ctrl_base ==FDT_ADDR_T_NONE ) + pcie->ctrl_base =devfdt_get_addr_index_ptr (dev,0 ); +if (!pcie->ctrl_base)return -EINVAL ;/* Get the config space base address and size */
drivers/pci/pcie_imx.c +2 -2
@@ -751,8 +751,8 @@ static int imx_pcie_of_to_plat(struct udevice *dev) {struct imx_pcie_priv *priv =dev_get_priv (dev); - priv->dbi_base = (void __iomem *)devfdt_get_addr_index (dev,0 ); - priv->cfg_base = (void __iomem *)devfdt_get_addr_index (dev,1 ); + priv->dbi_base = (void __iomem *)devfdt_get_addr_index_ptr (dev,0 ); + priv->cfg_base = (void __iomem *)devfdt_get_addr_index_ptr (dev,1 );if (!priv->dbi_base || !priv->cfg_base)return -EINVAL ;
drivers/pci/pcie_layerscape_ep.c +2 -2
@@ -250,11 +250,11 @@ static int ls_pcie_ep_probe(struct udevice *dev) pcie_ep->pcie = pcie; - pcie->dbi = (void __iomem *)devfdt_get_addr_index (dev,0 ); + pcie->dbi = (void __iomem *)devfdt_get_addr_index_ptr (dev,0 );if (!pcie->dbi)return -ENOMEM ; - pcie->ctrl = (void __iomem *)devfdt_get_addr_index (dev,1 ); + pcie->ctrl = (void __iomem *)devfdt_get_addr_index_ptr (dev,1 );if (!pcie->ctrl)return -ENOMEM ;
drivers/phy/marvell/comphy_core.c +6 -6
@@ -88,13 +88,13 @@ static int comphy_probe(struct udevice *dev)int res;/* Save base addresses for later use */ - chip_cfg->comphy_base_addr = (void *)devfdt_get_addr_index (dev,0 ); -if (IS_ERR (chip_cfg->comphy_base_addr)) -return PTR_ERR (chip_cfg->comphy_base_addr); + chip_cfg->comphy_base_addr =devfdt_get_addr_index_ptr (dev,0 ); +if (!chip_cfg->comphy_base_addr) +return -EINVAL ; - chip_cfg->hpipe3_base_addr = (void *)devfdt_get_addr_index (dev,1 ); -if (IS_ERR (chip_cfg->hpipe3_base_addr)) -return PTR_ERR (chip_cfg->hpipe3_base_addr); + chip_cfg->hpipe3_base_addr =devfdt_get_addr_index_ptr (dev,1 ); +if (!chip_cfg->hpipe3_base_addr) +return -EINVAL ;if (device_is_compatible (dev,"marvell,comphy-a3700" )) { chip_cfg->comphy_init_map = comphy_a3700_init_serdes_map;
drivers/spi/cadence_qspi.c +1 -1
@@ -377,7 +377,7 @@ static int cadence_spi_of_to_plat(struct udevice *bus)struct cadence_spi_priv *priv =dev_get_priv (bus);ofnode subnode; - plat->regbase = (void *)devfdt_get_addr_index (bus,0 ); + plat->regbase =devfdt_get_addr_index_ptr (bus,0 ); plat->ahbbase =devfdt_get_addr_size_index_ptr (bus,1 , &plat->ahbsize); plat->is_decoded_cs =dev_read_bool (bus,"cdns,is-decoded-cs" ); plat->fifo_depth =dev_read_u32_default (bus,"cdns,fifo-depth" ,128 );
drivers/usb/musb-new/ti-musb.c +1 -1
@@ -88,7 +88,7 @@ static int ti_musb_of_to_plat(struct udevice *dev)int usb_index;struct musb_hdrc_config *musb_config; - plat->base = (void *)devfdt_get_addr_index (dev,1 ); + plat->base =devfdt_get_addr_index_ptr (dev,1 ); phys =fdtdec_lookup_phandle (fdt, node,"phys" ); ctrl_mod =fdtdec_lookup_phandle (fdt, phys,"ti,ctrl_mod" );
--
2.20.1
Re: [RFC PATCH v1 4/4] drivers: use devfdt_get_addr_index_ptr when cast to pointer
Hi Johan
Quoted 10 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so usedevfdt_get_addr_index_ptrinstead of
thedevfdt_get_addr_indexfunction in the various files in the drivers directory that cast to a pointer.Signed-off-by Johan Jonker <[email protected]>---
Thank you. We should wait now Simon on those patches
Michael
Quoted 215 lines
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Replacement command used:
find . -type f -exec sed -i 's/*)devfdt_get_addr_index(/*)devfdt_get_addr_index_ptr(/g' {} + --- drivers/clk/clk-hsdk-cgu.c | 4 ++-- drivers/ddr/altera/sdram_gen5.c | 2 +- drivers/mmc/xenon_sdhci.c | 2 +- drivers/net/mvpp2.c | 24 ++++++++++++------------ drivers/pci/pcie_dw_mvebu.c | 4 ++-- drivers/pci/pcie_imx.c | 4 ++-- drivers/pci/pcie_layerscape_ep.c | 4 ++-- drivers/phy/marvell/comphy_core.c | 12 ++++++------ drivers/spi/cadence_qspi.c | 2 +- drivers/usb/musb-new/ti-musb.c | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-)drivers/clk/clk-hsdk-cgu.c +2
-2@@ -753,11 +753,11 @@ static int hsdk_cgu_clk_probe(struct udevice *dev)else hsdk_clk->map = hsdk_4xd_clk_map; - hsdk_clk->cgu_regs = (void __iomem *)devfdt_get_addr_index (dev,0 ); + hsdk_clk->cgu_regs = (void __iomem *)devfdt_get_addr_index_ptr (dev,0 );if (!hsdk_clk->cgu_regs)return -EINVAL ; - hsdk_clk->creg_regs = (void __iomem *)devfdt_get_addr_index (dev,1 ); + hsdk_clk->creg_regs = (void __iomem *)devfdt_get_addr_index_ptr (dev,1 );if (!hsdk_clk->creg_regs)return -EINVAL ;drivers/ddr/altera/sdram_gen5.c +1
-1@@ -567,7 +567,7 @@ static int altera_gen5_sdram_of_to_plat(struct udevice *dev) {struct altera_gen5_sdram_plat *plat =dev_get_plat (dev); - plat->sdr = (struct socfpga_sdr *)devfdt_get_addr_index (dev,0 ); + plat->sdr = (struct socfpga_sdr *)devfdt_get_addr_index_ptr (dev,0 );if (!plat->sdr)return -ENODEV ;drivers/mmc/xenon_sdhci.c +1
-1@@ -537,7 +537,7 @@ static int xenon_sdhci_of_to_plat(struct udevice *dev) host->ioaddr =dev_read_addr_ptr (dev);if (device_is_compatible (dev,"marvell,armada-3700-sdhci" )) - priv->pad_ctrl_reg = (void *)devfdt_get_addr_index (dev,1 ); + priv->pad_ctrl_reg =devfdt_get_addr_index_ptr (dev,1 ); name =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"marvell,pad-type" ,NULL );drivers/net/mvpp2.c +12
-12@@ -5351,18 +5351,18 @@ static int mvpp2_base_probe(struct udevice *dev) }/* Save base addresses for later use */ - priv->base = (void *)devfdt_get_addr_index (dev,0 ); -if (IS_ERR (priv->base)) -return PTR_ERR (priv->base); + priv->base =devfdt_get_addr_index_ptr (dev,0 ); +if (!priv->base) +return -EINVAL ;if (priv->hw_version ==MVPP21 ) { - priv->lms_base = (void *)devfdt_get_addr_index (dev,1 ); -if (IS_ERR (priv->lms_base)) -return PTR_ERR (priv->lms_base); + priv->lms_base =devfdt_get_addr_index_ptr (dev,1 ); +if (!priv->lms_base) +return -EINVAL ; }else { - priv->iface_base = (void *)devfdt_get_addr_index (dev,1 ); -if (IS_ERR (priv->iface_base)) -return PTR_ERR (priv->iface_base); + priv->iface_base =devfdt_get_addr_index_ptr (dev,1 ); +if (!priv->iface_base) +return -EINVAL ;/* Store common base addresses for all ports */ priv->mpcs_base = priv->iface_base +MVPP22_MPCS ;@@ -5401,10 +5401,10 @@ static int mvpp2_probe(struct udevice *dev)if (priv->hw_version ==MVPP21 ) {int priv_common_regs_num =2 ; - port->base = (void __iomem *)devfdt_get_addr_index ( + port->base = (void __iomem *)devfdt_get_addr_index_ptr ( dev->parent, priv_common_regs_num + port->id); -if (IS_ERR (port->base)) -return PTR_ERR (port->base); +if (!port->base) +return -EINVAL ; }else { port->gop_id =fdtdec_get_int (gd->fdt_blob,dev_of_offset (dev),"gop-port-id" ,-1 );drivers/pci/pcie_dw_mvebu.c +2
-2@@ -564,8 +564,8 @@ static int pcie_dw_mvebu_of_to_plat(struct udevice *dev)struct pcie_dw_mvebu *pcie =dev_get_priv (dev);/* Get the controller base address */ - pcie->ctrl_base = (void *)devfdt_get_addr_index (dev,0 ); -if ((fdt_addr_t )pcie->ctrl_base ==FDT_ADDR_T_NONE ) + pcie->ctrl_base =devfdt_get_addr_index_ptr (dev,0 ); +if (!pcie->ctrl_base)return -EINVAL ;/* Get the config space base address and size */ drivers/pci/pcie_imx.c +2
-2@@ -751,8 +751,8 @@ static int imx_pcie_of_to_plat(struct udevice *dev) {struct imx_pcie_priv *priv =dev_get_priv (dev); - priv->dbi_base = (void __iomem *)devfdt_get_addr_index (dev,0 ); - priv->cfg_base = (void __iomem *)devfdt_get_addr_index (dev,1 ); + priv->dbi_base = (void __iomem *)devfdt_get_addr_index_ptr (dev,0 ); + priv->cfg_base = (void __iomem *)devfdt_get_addr_index_ptr (dev,1 );if (!priv->dbi_base || !priv->cfg_base)return -EINVAL ;drivers/pci/pcie_layerscape_ep.c +2
-2@@ -250,11 +250,11 @@ static int ls_pcie_ep_probe(struct udevice *dev) pcie_ep->pcie = pcie; - pcie->dbi = (void __iomem *)devfdt_get_addr_index (dev,0 ); + pcie->dbi = (void __iomem *)devfdt_get_addr_index_ptr (dev,0 );if (!pcie->dbi)return -ENOMEM ; - pcie->ctrl = (void __iomem *)devfdt_get_addr_index (dev,1 ); + pcie->ctrl = (void __iomem *)devfdt_get_addr_index_ptr (dev,1 );if (!pcie->ctrl)return -ENOMEM ;drivers/phy/marvell/comphy_core.c +6
-6@@ -88,13 +88,13 @@ static int comphy_probe(struct udevice *dev)int res;/* Save base addresses for later use */ - chip_cfg->comphy_base_addr = (void *)devfdt_get_addr_index (dev,0 ); -if (IS_ERR (chip_cfg->comphy_base_addr)) -return PTR_ERR (chip_cfg->comphy_base_addr); + chip_cfg->comphy_base_addr =devfdt_get_addr_index_ptr (dev,0 ); +if (!chip_cfg->comphy_base_addr) +return -EINVAL ; - chip_cfg->hpipe3_base_addr = (void *)devfdt_get_addr_index (dev,1 ); -if (IS_ERR (chip_cfg->hpipe3_base_addr)) -return PTR_ERR (chip_cfg->hpipe3_base_addr); + chip_cfg->hpipe3_base_addr =devfdt_get_addr_index_ptr (dev,1 ); +if (!chip_cfg->hpipe3_base_addr) +return -EINVAL ;if (device_is_compatible (dev,"marvell,comphy-a3700" )) { chip_cfg->comphy_init_map = comphy_a3700_init_serdes_map;drivers/spi/cadence_qspi.c +1
-1@@ -377,7 +377,7 @@ static int cadence_spi_of_to_plat(struct udevice *bus)struct cadence_spi_priv *priv =dev_get_priv (bus);ofnode subnode; - plat->regbase = (void *)devfdt_get_addr_index (bus,0 ); + plat->regbase =devfdt_get_addr_index_ptr (bus,0 ); plat->ahbbase =devfdt_get_addr_size_index_ptr (bus,1 , &plat->ahbsize); plat->is_decoded_cs =dev_read_bool (bus,"cdns,is-decoded-cs" ); plat->fifo_depth =dev_read_u32_default (bus,"cdns,fifo-depth" ,128 );drivers/usb/musb-new/ti-musb.c +1
-2@@ -88,7 +88,7 @@ static int ti_musb_of_to_plat(struct udevice *dev)int usb_index;struct musb_hdrc_config *musb_config; - plat->base = (void *)devfdt_get_addr_index (dev,1 ); + plat->base =devfdt_get_addr_index_ptr (dev,1 ); phys =fdtdec_lookup_phandle (fdt, node,"phys" ); ctrl_mod =fdtdec_lookup_phandle (fdt, phys,"ti,ctrl_mod" ); --2.20.1
Signature · 11 lines
Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 [email protected] __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 [email protected] www.amarulasolutions.com
Re: [RFC PATCH v1 1/4] drivers: use dev_read_addr_index_ptr when cast to pointer
In reply to Johan JonkerQuoted 6 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so usedev_read_addr_index_ptrinstead of thedev_read_addr_indexfunction in the various files in the drivers directory that cast to a pointer.
I think you can use a bit more of 60 chars x line
Quoted 119 lines
Signed-off-by Johan Jonker <[email protected]>---
Note:
This is needed for a Rockchip patch serie to pass the test and must be merged before by Rockchip maintainers:
[PATCH v4 00/11] Fixes for Rockchip NFC driver part 1
https://lore.kernel.org/u-boot/[email protected]/Replacement command used:
find . -type f -exec sed -i 's/*)dev_read_addr_index(/*)dev_read_addr_index_ptr(/g' {} + --- drivers/mtd/nand/raw/cortina_nand.c | 4 ++-- drivers/net/dm9000x.c | 2 +- drivers/net/dwmac_meson8b.c | 4 ++-- drivers/pci/pcie_dw_meson.c | 4 ++-- drivers/pci/pcie_dw_rockchip.c | 4 ++-- drivers/watchdog/sbsa_gwdt.c | 12 ++++++------ 6 files changed, 15 insertions(+), 15 deletions(-)drivers/mtd/nand/raw/cortina_nand.c +2
-2@@ -1175,8 +1175,8 @@ static int fdt_decode_nand(struct udevice *dev, struct nand_drv *info)int ecc_strength; info->reg = (struct nand_ctlr *)dev_read_addr (dev); - info->dma_glb = (struct dma_global *)dev_read_addr_index (dev,1 ); - info->dma_nand = (struct dma_ssp *)dev_read_addr_index (dev,2 ); + info->dma_glb = (struct dma_global *)dev_read_addr_index_ptr (dev,1 ); + info->dma_nand = (struct dma_ssp *)dev_read_addr_index_ptr (dev,2 ); info->config.enabled =dev_read_enabled (dev); ecc_strength =dev_read_u32_default (dev,"nand-ecc-strength" ,16 ); info->flash_base =drivers/net/dm9000x.c +1
-1@@ -651,7 +651,7 @@ static int dm9000_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr_index (dev,0 ); db->base_io = (void __iomem *)pdata->iobase; - db->base_data = (void __iomem *)dev_read_addr_index (dev,1 ); + db->base_data = (void __iomem *)dev_read_addr_index_ptr (dev,1 );return 0 ; }drivers/net/dwmac_meson8b.c +2
-2@@ -41,8 +41,8 @@ static int dwmac_meson8b_of_to_plat(struct udevice *dev) {struct dwmac_meson8b_plat *pdata =dev_get_plat (dev); - pdata->regs = (void *)dev_read_addr_index (dev,1 ); -if ((fdt_addr_t )pdata->regs ==FDT_ADDR_T_NONE ) + pdata->regs =dev_read_addr_index_ptr (dev,1 ); +if (!pdata->regs)return -EINVAL ; pdata->dwmac_setup = (void *)dev_get_driver_data (dev);drivers/pci/pcie_dw_meson.c +2
-2@@ -337,13 +337,13 @@ static int meson_pcie_parse_dt(struct udevice *dev)struct meson_pcie *priv =dev_get_priv (dev);int ret; - priv->dw.dbi_base = (void *)dev_read_addr_index (dev,0 ); + priv->dw.dbi_base =dev_read_addr_index_ptr (dev,0 );if (!priv->dw.dbi_base)return -ENODEV ;dev_dbg (dev,"ELBI address is 0x%p\n" , priv->dw.dbi_base); - priv->meson_cfg_base = (void *)dev_read_addr_index (dev,1 ); + priv->meson_cfg_base =dev_read_addr_index_ptr (dev,1 );if (!priv->meson_cfg_base)return -ENODEV ;drivers/pci/pcie_dw_rockchip.c +2
-2@@ -353,13 +353,13 @@ static int rockchip_pcie_parse_dt(struct udevice *dev)struct rk_pcie *priv =dev_get_priv (dev);int ret; - priv->dw.dbi_base = (void *)dev_read_addr_index (dev,0 ); + priv->dw.dbi_base =dev_read_addr_index_ptr (dev,0 );if (!priv->dw.dbi_base)return -ENODEV ;dev_dbg (dev,"DBI address is 0x%p\n" , priv->dw.dbi_base); - priv->apb_base = (void *)dev_read_addr_index (dev,1 ); + priv->apb_base =dev_read_addr_index_ptr (dev,1 );if (!priv->apb_base)return -ENODEV ;drivers/watchdog/sbsa_gwdt.c +1
-3@@ -98,13 +98,13 @@ static int sbsa_gwdt_of_to_plat(struct udevice *dev) {struct sbsa_gwdt_priv *priv =dev_get_priv (dev); - priv->reg_control = (void __iomem *)dev_read_addr_index (dev,0 ); -if (IS_ERR (priv->reg_control)) -return PTR_ERR (priv->reg_control); + priv->reg_control = (void __iomem *)dev_read_addr_index_ptr (dev,0 );
drivers/watchdog/sbsa_gwdt.c static int sbsa_gwdt_of_to_plat(struct udevice *dev) · line 108
Quoted 10 lines
drivers/watchdog/sbsa_gwdt.c +5
-3+if (!priv->reg_control) +return -EINVAL ; - priv->reg_refresh = (void __iomem *)dev_read_addr_index (dev,1 ); -if (IS_ERR (priv->reg_refresh)) -return PTR_ERR (priv->reg_refresh); + priv->reg_refresh = (void __iomem *)dev_read_addr_index_ptr (dev,1 ); +if (!priv->reg_refresh) +return -EINVAL ;
Quoted 5 lines
drivers/watchdog/sbsa_gwdt.c +0
-1return 0 ; } --2.20.1
PATCH v4 2/11 include: dm: ofnode: fix headers
In reply to Johan JonkerWhen fdt_addr_t and phys_addr_t are split it turns out that the header don't match the functions, so fix the headers.
--- include/dm/ofnode.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
include/dm/ofnode.h +8 -8
@@ -678,8 +678,8 @@ int ofnode_read_size(ofnode node, const char *propname);* @size: Pointer to size of the address * Return: address, or FDT_ADDR_T_NONE if not present or invalid */ -phys_addr_t ofnode_get_addr_size_index (ofnode node,int index, -fdt_size_t *size); +fdt_addr_t ofnode_get_addr_size_index (ofnode node,int index, +fdt_size_t *size);/** * ofnode_get_addr_size_index_notrans() - get an address/size from a node
@@ -695,8 +695,8 @@ phys_addr_t ofnode_get_addr_size_index(ofnode node, int index,* @size: Pointer to size of the address * Return: address, or FDT_ADDR_T_NONE if not present or invalid */ -phys_addr_t ofnode_get_addr_size_index_notrans (ofnode node,int index, -fdt_size_t *size); +fdt_addr_t ofnode_get_addr_size_index_notrans (ofnode node,int index, +fdt_size_t *size);/** * ofnode_get_addr_index() - get an address from a node
@@ -707,7 +707,7 @@ phys_addr_t ofnode_get_addr_size_index_notrans(ofnode node, int index,* @index: Index of address to read (0 for first) * Return: address, or FDT_ADDR_T_NONE if not present or invalid */ -phys_addr_t ofnode_get_addr_index (ofnode node,int index); +fdt_addr_t ofnode_get_addr_index (ofnode node,int index);/** * ofnode_get_addr() - get an address from a node
@@ -717,7 +717,7 @@ phys_addr_t ofnode_get_addr_index(ofnode node, int index);* @node: node to read from * Return: address, or FDT_ADDR_T_NONE if not present or invalid */ -phys_addr_t ofnode_get_addr (ofnode node); +fdt_addr_t ofnode_get_addr (ofnode node);/** * ofnode_get_size() - get size from a node
@@ -1055,8 +1055,8 @@ const void *ofprop_get_property(const struct ofprop *prop,* @sizep: place to put size value (on success) * Return: address value, or FDT_ADDR_T_NONE on error */ -phys_addr_t ofnode_get_addr_size (ofnode node,const char *propname, -phys_size_t *sizep); +fdt_addr_t ofnode_get_addr_size (ofnode node,const char *propname, +fdt_size_t *sizep);/** * ofnode_read_u8_array_ptr() - find an 8-bit array
--
2.20.1
PATCH v4 3/11 core: remap: convert regmap_init_mem_plat() input to phys_addr_t
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convert regmap_init_mem_plat() input to phys_addr_t in files that use this function. Also correct struct syscon_base_plat depending on CONFIG_PHYS_64BIT setting and fix ARRAY_SIZE divider.
---
Changed V4:
Fix cast and divider in syscon-uclass.c
--- drivers/core/regmap.c | 2 +- drivers/core/syscon-uclass.c | 4 ++-- drivers/ram/rockchip/sdram_rk3066.c | 2 +- drivers/ram/rockchip/sdram_rk3188.c | 2 +- drivers/ram/rockchip/sdram_rk322x.c | 2 +- drivers/ram/rockchip/sdram_rk3288.c | 2 +- drivers/ram/rockchip/sdram_rk3328.c | 2 +- drivers/ram/rockchip/sdram_rk3399.c | 2 +- include/regmap.h | 2 +- include/syscon.h | 13 +++++++------ 10 files changed, 17 insertions(+), 16 deletions(-)
drivers/core/regmap.c +1 -1
@@ -79,7 +79,7 @@ static struct regmap *regmap_alloc(int count) }#if CONFIG_IS_ENABLED (OF_PLATDATA ) -int regmap_init_mem_plat (struct udevice *dev,fdt_val_t *reg,int count, +int regmap_init_mem_plat (struct udevice *dev,phys_addr_t *reg,int count,struct regmap **mapp) {struct regmap_range *range;
drivers/core/syscon-uclass.c +2 -2
@@ -58,8 +58,8 @@ static int syscon_pre_probe(struct udevice *dev)#if CONFIG_IS_ENABLED (OF_PLATDATA )struct syscon_base_plat *plat =dev_get_plat (dev); -return regmap_init_mem_plat (dev, plat->reg,ARRAY_SIZE (plat->reg), - &priv->regmap); +return regmap_init_mem_plat (dev, (phys_addr_t *)plat->reg, +ARRAY_SIZE (plat->reg) /2 , &priv->regmap);#else return regmap_init_mem (dev_ofnode (dev), &priv->regmap);#endif
drivers/ram/rockchip/sdram_rk3066.c +1 -1
@@ -801,7 +801,7 @@ static int rk3066_dmc_conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base));/* RK3066 supports dual-channel, set default channel num to 2. */ plat->num_channels =1 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)of_plat->reg,ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk3188.c +1 -1
@@ -867,7 +867,7 @@ static int conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base));/* rk3188 supports dual-channel, set default channel num to 2 */ plat->num_channels =1 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)of_plat->reg,ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk322x.c +1 -1
@@ -769,7 +769,7 @@ static int conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base)); plat->num_channels =1 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)of_plat->reg,ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk3288.c +1 -1
@@ -1029,7 +1029,7 @@ static int conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base));/* Rk3288 supports dual-channel, set default channel num to 2 */ plat->num_channels =2 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)of_plat->reg,ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk3328.c +1 -1
@@ -54,7 +54,7 @@ static int conv_of_plat(struct udevice *dev)struct dtd_rockchip_rk3328_dmc *dtplat = &plat->dtplat;int ret; - ret =regmap_init_mem_plat (dev, dtplat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)dtplat->reg,ARRAY_SIZE (dtplat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk3399.c +1 -1
@@ -3049,7 +3049,7 @@ static int conv_of_plat(struct udevice *dev)struct dtd_rockchip_rk3399_dmc *dtplat = &plat->dtplat;int ret; - ret =regmap_init_mem_plat (dev, dtplat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)dtplat->reg,ARRAY_SIZE (dtplat->reg) /2 , &plat->map);if (ret)return ret;
include/regmap.h +1 -1
@@ -388,7 +388,7 @@ int regmap_init_mem(ofnode node, struct regmap **mapp);* Use regmap_uninit() to free it. * */ -int regmap_init_mem_plat (struct udevice *dev,fdt_val_t *reg,int count, +int regmap_init_mem_plat (struct udevice *dev,phys_addr_t *reg,int count,struct regmap **mapp);int regmap_init_mem_index (ofnode node,struct regmap **mapp,int index);
include/syscon.h +7 -6
@@ -27,14 +27,15 @@ struct syscon_ops {#if CONFIG_IS_ENABLED (OF_PLATDATA )/* -* We don't support 64-bit machines. If they are so resource-contrained that -* they need to use OF_PLATDATA, something is horribly wrong with the -* education of our hardware engineers. -* -* Update: 64-bit is now supported and we have an education crisis. +* Support for 64bit or 32bit fdt addresses +* depending on the physical SoC properties. */ struct syscon_base_plat { -fdt_val_t reg[2 ]; +#ifdef CONFIG_PHYS_64BIT +fdt64_t reg[2 ]; +#else +fdt32_t reg[2 ]; +#endif };#endif
--
2.20.1
Re: [PATCH v4 03/11] core: remap: convert regmap_init_mem_plat() input to phys_addr_t
Quoted 8 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convertregmap_init_mem_plat()input tophys_addr_tin files that use this function. Also correct structsyscon_base_platdepending onCONFIG_PHYS_64BITsetting and fixARRAY_SIZEdivider.Signed-off-by Johan Jonker <[email protected]>
Thanks,
- Kever
Quoted 165 lines
---
Changed V4:
Fix cast and divider insyscon-uclass.c--- drivers/core/regmap.c | 2 +- drivers/core/syscon-uclass.c | 4 ++-- drivers/ram/rockchip/sdram_rk3066.c | 2 +- drivers/ram/rockchip/sdram_rk3188.c | 2 +- drivers/ram/rockchip/sdram_rk322x.c | 2 +- drivers/ram/rockchip/sdram_rk3288.c | 2 +- drivers/ram/rockchip/sdram_rk3328.c | 2 +- drivers/ram/rockchip/sdram_rk3399.c | 2 +- include/regmap.h | 2 +- include/syscon.h | 13 +++++++------ 10 files changed, 17 insertions(+), 16 deletions(-)drivers/core/regmap.c +1
-1@@ -79,7 +79,7 @@ static struct regmap *regmap_alloc(int count) }#if CONFIG_IS_ENABLED (OF_PLATDATA ) -int regmap_init_mem_plat (struct udevice *dev,fdt_val_t *reg,int count, +int regmap_init_mem_plat (struct udevice *dev,phys_addr_t *reg,int count,struct regmap **mapp) {struct regmap_range *range;drivers/core/syscon-uclass.c +2
-2@@ -58,8 +58,8 @@ static int syscon_pre_probe(struct udevice *dev)#if CONFIG_IS_ENABLED (OF_PLATDATA )struct syscon_base_plat *plat =dev_get_plat (dev); -return regmap_init_mem_plat (dev, plat->reg,ARRAY_SIZE (plat->reg), - &priv->regmap); +return regmap_init_mem_plat (dev, (phys_addr_t *)plat->reg, +ARRAY_SIZE (plat->reg) /2 , &priv->regmap);#else return regmap_init_mem (dev_ofnode (dev), &priv->regmap);#endif drivers/ram/rockchip/sdram_rk3066.c +1
-1@@ -801,7 +801,7 @@ static int rk3066_dmc_conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base));/* RK3066 supports dual-channel, set default channel num to 2. */ plat->num_channels =1 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)of_plat->reg,ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;drivers/ram/rockchip/sdram_rk3188.c +1
-1@@ -867,7 +867,7 @@ static int conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base));/* rk3188 supports dual-channel, set default channel num to 2 */ plat->num_channels =1 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)of_plat->reg,ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;drivers/ram/rockchip/sdram_rk322x.c +1
-1@@ -769,7 +769,7 @@ static int conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base)); plat->num_channels =1 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)of_plat->reg,ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;drivers/ram/rockchip/sdram_rk3288.c +1
-1@@ -1029,7 +1029,7 @@ static int conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base));/* Rk3288 supports dual-channel, set default channel num to 2 */ plat->num_channels =2 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)of_plat->reg,ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;drivers/ram/rockchip/sdram_rk3328.c +1
-1@@ -54,7 +54,7 @@ static int conv_of_plat(struct udevice *dev)struct dtd_rockchip_rk3328_dmc *dtplat = &plat->dtplat;int ret; - ret =regmap_init_mem_plat (dev, dtplat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)dtplat->reg,ARRAY_SIZE (dtplat->reg) /2 , &plat->map);if (ret)return ret;drivers/ram/rockchip/sdram_rk3399.c +1
-1@@ -3049,7 +3049,7 @@ static int conv_of_plat(struct udevice *dev)struct dtd_rockchip_rk3399_dmc *dtplat = &plat->dtplat;int ret; - ret =regmap_init_mem_plat (dev, dtplat->reg, + ret =regmap_init_mem_plat (dev, (phys_addr_t *)dtplat->reg,ARRAY_SIZE (dtplat->reg) /2 , &plat->map);if (ret)return ret;include/regmap.h +1
-1@@ -388,7 +388,7 @@ int regmap_init_mem(ofnode node, struct regmap **mapp);* Use regmap_uninit() to free it. * */ -int regmap_init_mem_plat (struct udevice *dev,fdt_val_t *reg,int count, +int regmap_init_mem_plat (struct udevice *dev,phys_addr_t *reg,int count,struct regmap **mapp);int regmap_init_mem_index (ofnode node,struct regmap **mapp,int index);include/syscon.h +7
-7@@ -27,14 +27,15 @@ struct syscon_ops {#if CONFIG_IS_ENABLED (OF_PLATDATA )/* -* We don't support 64-bit machines. If they are so resource-contrained that -* they need to use OF_PLATDATA, something is horribly wrong with the -* education of our hardware engineers. -* -* Update: 64-bit is now supported and we have an education crisis. +* Support for 64bit or 32bit fdt addresses +* depending on the physical SoC properties. */ struct syscon_base_plat { -fdt_val_t reg[2 ]; +#ifdef CONFIG_PHYS_64BIT +fdt64_t reg[2 ]; +#else +fdt32_t reg[2 ]; +#endif };#endif --2.20.1
PATCH v4 4/11 rockchip: adc: rockchip-saradc: use dev_read_addr_ptr
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expext 64-bit data from the device tree parser, so use dev_read_addr_ptr in the rockchip-saradc.c file.
--- drivers/adc/rockchip-saradc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/adc/rockchip-saradc.c +2 -2
@@ -145,8 +145,8 @@ int rockchip_saradc_of_to_plat(struct udevice *dev)struct rockchip_saradc_data *data; data = (struct rockchip_saradc_data *)dev_get_driver_data (dev); - priv->regs = (struct rockchip_saradc_regs *)dev_read_addr (dev); -if (priv->regs == (struct rockchip_saradc_regs *)FDT_ADDR_T_NONE ) { + priv->regs = (struct rockchip_saradc_regs *)dev_read_addr_ptr (dev); +if (!priv->regs) {pr_err ("Dev: %s - can't get address!" , dev->name);return -ENODATA ; }
--
2.20.1
Re: [PATCH v4 04/11] rockchip: adc: rockchip-saradc: use dev_read_addr_ptr
Quoted 5 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expext 64-bit data from the device tree parser, so usedev_read_addr_ptrin therockchip-saradc.cfile.Signed-off-by Johan Jonker <[email protected]>
Thanks,
- Kever
Quoted 22 lines
--- drivers/adc/rockchip-saradc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/adc/rockchip-saradc.c +2
-3@@ -145,8 +145,8 @@ int rockchip_saradc_of_to_plat(struct udevice *dev)struct rockchip_saradc_data *data; data = (struct rockchip_saradc_data *)dev_get_driver_data (dev); - priv->regs = (struct rockchip_saradc_regs *)dev_read_addr (dev); -if (priv->regs == (struct rockchip_saradc_regs *)FDT_ADDR_T_NONE ) { + priv->regs = (struct rockchip_saradc_regs *)dev_read_addr_ptr (dev); +if (!priv->regs) {pr_err ("Dev: %s - can't get address!" , dev->name);return -ENODATA ; } --2.20.1
PATCH v4 5/11 rockchip: timer: dw-apb-timer: convert dev_read_addr output to phys_addr_t
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convert dev_read_addr output to phys_addr_t in the dw-apb-timer.c file.
--- drivers/timer/dw-apb-timer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/timer/dw-apb-timer.c +2 -2
@@ -23,7 +23,7 @@#define DW_APB_CTRL 0x8struct dw_apb_timer_priv { -fdt_addr_t regs; +phys_addr_t regs;struct reset_ctl_bulk resets; };
@@ -92,7 +92,7 @@ static int dw_apb_timer_of_to_plat(struct udevice *dev)if (CONFIG_IS_ENABLED (OF_REAL )) {struct dw_apb_timer_priv *priv =dev_get_priv (dev); - priv->regs =dev_read_addr (dev); + priv->regs = (phys_addr_t )dev_read_addr (dev); }return 0 ;
--
2.20.1
PATCH v4 6/11 mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expext 64-bit data from the device tree parser, so use dev_read_addr_ptr in the rockchip_nfc.c file.
--- drivers/mtd/nand/raw/rockchip_nfc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/rockchip_nfc.c +3 -3
@@ -1180,9 +1180,9 @@ static int rk_nfc_probe(struct udevice *dev) nfc->cfg = (void *)dev_get_driver_data (dev); nfc->dev = dev; - nfc->regs = (void *)dev_read_addr (dev); -if (IS_ERR (nfc->regs)) { - ret =PTR_ERR (nfc->regs); + nfc->regs =dev_read_addr_ptr (dev); +if (!nfc->regs) { + ret = -ENODATA ; goto release_nfc; }
--
2.20.1
PATCH v4 7/11 mtd: nand: raw: rockchip_nfc: remove the compatible string "rockchip,rk3308-nfc"
In reply to Johan JonkerThe compatible string for rk3308 has as fallback string "rockchip,rv1108-nfc". As there is no logic in probe priority between the SoC orientated string and the fall back, so remove the compatible string "rockchip,rk3308-nfc" from the driver.
--- drivers/mtd/nand/raw/rockchip_nfc.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/mtd/nand/raw/rockchip_nfc.c +0 -4
@@ -1165,10 +1165,6 @@ static const struct udevice_id rk_nfc_id_table[] = { .compatible = "rockchip,rv1108-nfc", .data = (unsigned long)&nfc_v8_cfg }, - { - .compatible = "rockchip,rk3308-nfc", - .data = (unsigned long)&nfc_v8_cfg - }, {/* sentinel */ } };
--
2.20.1
PATCH v4 8/11 mtd: nand: raw: rockchip_nfc: add layout structure
In reply to Johan JonkerThe MTD framework in U-boot is not identical for drivers ported from Linux. The rockchip_nfc driver was ported with OOB ops functions while the framework expects a layout structure per chip. Fix by adding a structure with OOB data and remove unused functions.
--- drivers/mtd/nand/raw/rockchip_nfc.c | 61 ++++++++++------------------- 1 file changed, 20 insertions(+), 41 deletions(-)
drivers/mtd/nand/raw/rockchip_nfc.c +20 -41
@@ -814,47 +814,9 @@ static void rk_nfc_disable_clks(struct rk_nfc *nfc)clk_disable_unprepare (nfc->ahb_clk); } -static int rk_nfc_ooblayout_free (struct mtd_info *mtd,int section, -struct mtd_oob_region *oob_region) -{ -struct nand_chip *chip =mtd_to_nand (mtd); -struct rk_nfc_nand_chip *rknand =rk_nfc_to_rknand (chip); - -if (section) -return -ERANGE ; - -/* -* The beginning of the OOB area stores the reserved data for the NFC, -* the size of the reserved data is NFC_SYS_DATA_SIZE bytes. -*/ - oob_region->length = rknand->metadata_size -NFC_SYS_DATA_SIZE -2 ; - oob_region->offset =NFC_SYS_DATA_SIZE +2 ; - -return 0 ; -} - -static int rk_nfc_ooblayout_ecc (struct mtd_info *mtd,int section, -struct mtd_oob_region *oob_region) -{ -struct nand_chip *chip =mtd_to_nand (mtd); -struct rk_nfc_nand_chip *rknand =rk_nfc_to_rknand (chip); - -if (section) -return -ERANGE ; - - oob_region->length = mtd->oobsize - rknand->metadata_size; - oob_region->offset = rknand->metadata_size; - -return 0 ; -} - -static const struct mtd_ooblayout_ops rk_nfc_ooblayout_ops = { - .rfree = rk_nfc_ooblayout_free, - .ecc = rk_nfc_ooblayout_ecc, -}; -static int rk_nfc_ecc_init (struct rk_nfc *nfc,struct nand_chip *chip) { +struct rk_nfc_nand_chip *rknand =rk_nfc_to_rknand (chip);const u8 *strengths = nfc->cfg->ecc_strengths;struct mtd_info *mtd =nand_to_mtd (chip);struct nand_ecc_ctrl *ecc = &chip->ecc;
@@ -892,6 +854,21 @@ static int rk_nfc_ecc_init(struct rk_nfc *nfc, struct nand_chip *chip) ecc->steps = mtd->writesize / ecc->size; ecc->bytes =DIV_ROUND_UP (ecc->strength *fls (8 * chip->ecc.size),8 ); +if (ecc->bytes * ecc->steps > mtd->oobsize - rknand->metadata_size) +return -EINVAL ; + + ecc->layout =kzalloc (sizeof (*ecc->layout),GFP_KERNEL ); +if (!ecc->layout) +return -ENOMEM ; + + ecc->layout->eccbytes = ecc->bytes * ecc->steps; + +for (i =0 ; i < ecc->layout->eccbytes; i++) + ecc->layout->eccpos[i] = rknand->metadata_size + i; + + ecc->layout->oobfree[0 ].length = rknand->metadata_size -NFC_SYS_DATA_SIZE -2 ; + ecc->layout->oobfree[0 ].offset =NFC_SYS_DATA_SIZE +2 ; +return 0 ; }
@@ -969,7 +946,6 @@ static int rk_nfc_nand_chip_init(ofnode node, struct rk_nfc *nfc, int devnum) chip->bbt_options =NAND_BBT_USE_FLASH |NAND_BBT_NO_OOB ; chip->options |=NAND_NO_SUBPAGE_WRITE |NAND_USE_BOUNCE_BUFFER ; -mtd_set_ooblayout (mtd, &rk_nfc_ooblayout_ops);rk_nfc_hw_init (nfc); ret =nand_scan_ident (mtd, nsels,NULL );if (ret)
@@ -998,13 +974,16 @@ static int rk_nfc_nand_chip_init(ofnode node, struct rk_nfc *nfc, int devnum)if (!nfc->page_buf) { nfc->page_buf =kzalloc (NFC_MAX_PAGE_SIZE ,GFP_KERNEL ); -if (!nfc->page_buf) +if (!nfc->page_buf) { +kfree (ecc->layout);return -ENOMEM ; + } }if (!nfc->oob_buf) { nfc->oob_buf =kzalloc (NFC_MAX_OOB_SIZE ,GFP_KERNEL );if (!nfc->oob_buf) { +kfree (ecc->layout);kfree (nfc->page_buf); nfc->page_buf =NULL ;return -ENOMEM ;
--
2.20.1
PATCH v4 9/11 mtd: nand: raw: rockchip_nfc: add flash_node to chip structure
In reply to Johan JonkerAdd flash_node to the rockchip_nfc driver chip structure in order to find the partitions in the add_mtd_partitions_of() function.
--- drivers/mtd/nand/raw/rockchip_nfc.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/rockchip_nfc.c +1 -0
@@ -934,6 +934,7 @@ static int rk_nfc_nand_chip_init(ofnode node, struct rk_nfc *nfc, int devnum)nand_set_controller_data (chip, nfc); + chip->flash_node = node; chip->chip_delay =NFC_RB_DELAY_US ; chip->select_chip = rk_nfc_select_chip; chip->cmd_ctrl = rk_nfc_cmd;
--
2.20.1
PATCH v4 10/11 mtd: nand: add support for the Sandisk SDTNQGAMA chip
In reply to Johan JonkerSandisk SDTNQGAMA is a 8GB size, 3.3V 8 bit chip with 16KB page size, 1KB write size and 40 bit ecc support
--- drivers/mtd/nand/raw/nand_ids.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/nand/raw/nand_ids.c +3 -0
@@ -48,6 +48,9 @@ struct nand_flash_dev nand_flash_ids[] = { {"TC58NVG6D2 64G 3.3V 8-bit" , { .id = {0x98, 0xde, 0x94, 0x82, 0x76, 0x56, 0x04, 0x20} }, SZ_8K, SZ_8K, SZ_2M, 0, 8, 640, NAND_ECC_INFO(40, SZ_1K) }, + {"SDTNQGAMA 64G 3.3V 8-bit", + { .id = {0x45, 0xde, 0x94, 0x93, 0x76, 0x57} }, + SZ_16K, SZ_8K, SZ_4M, 0, 6, 1280, NAND_ECC_INFO(40, SZ_1K) }, {"SDTNRGAMA 64G 3.3V 8-bit", { .id = {0x45, 0xde, 0x94, 0x93, 0x76, 0x50} }, SZ_16K, SZ_8K, SZ_4M, 0, 6, 1280, NAND_ECC_INFO(40, SZ_1K) },
--
2.20.1
PATCH v4 11/11 mtd: nand: raw: rockchip_nfc: fix oobfree offset and description
In reply to Johan JonkerThe MTD framework reserves 1 or 2 bytes for the bad block marker depending on the bus size. The rockchip_nfc driver currently only supports a 8 bit bus, but reserves standard 2 bytes for the BBM. The first free OOB byte is therefore OOB2 at offset 2. Page address(PA) bytes are moved to the last 4 positions before ECC. Update the description for U-boot.
--- drivers/mtd/nand/raw/rockchip_nfc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/rockchip_nfc.c +4 -4
@@ -487,10 +487,10 @@ static int rk_nfc_write_page_raw(struct mtd_info *mtd,* * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3 * -* The rk_nfc_ooblayout_free() function already has reserved -* these 4 bytes with: +* The oobfree structure already has reserved these 4 bytes +* together with 2 bytes for BBM by reducing it's length: * -* oob_region->offset = NFC_SYS_DATA_SIZE + 2; +* oobfree[0].length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2; */ if (!i) memcpy(rk_nfc_oob_ptr(chip, i),
@@ -867,7 +867,7 @@ static int rk_nfc_ecc_init(struct rk_nfc *nfc, struct nand_chip *chip) ecc->layout->eccpos[i] = rknand->metadata_size + i; ecc->layout->oobfree[0 ].length = rknand->metadata_size -NFC_SYS_DATA_SIZE -2 ; - ecc->layout->oobfree[0 ].offset =NFC_SYS_DATA_SIZE +2 ; + ecc->layout->oobfree[0 ].offset =2 ;return 0 ; }
--
2.20.1
Re: [PATCH v4 11/11] mtd: nand: raw: rockchip_nfc: fix oobfree offset and description
Quoted 8 lines · Johan Jonker
The MTD framework reserves 1 or 2 bytes for the bad block marker depending on the bus size. The
rockchip_nfcdriver currently only supports a 8 bit bus, but reserves standard 2 bytes for the BBM. The first free OOB byte is therefore OOB2 at offset 2. Page address(PA) bytes are moved to the last 4 positions before ECC. Update the description for U-boot.Signed-off-by Johan Jonker <[email protected]>
Thanks,
- Kever
Quoted 34 lines
--- drivers/mtd/nand/raw/rockchip_nfc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/mtd/nand/raw/rockchip_nfc.c +4
-5@@ -487,10 +487,10 @@ static int rk_nfc_write_page_raw(struct mtd_info *mtd,* * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3 * -* The rk_nfc_ooblayout_free() function already has reserved -* these 4 bytes with: +* The oobfree structure already has reserved these 4 bytes +* together with 2 bytes for BBM by reducing it's length: * -* oob_region->offset = NFC_SYS_DATA_SIZE + 2; +* oobfree[0].length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2; */ if (!i) memcpy(rk_nfc_oob_ptr(chip, i),@@ -867,7 +867,7 @@ static int rk_nfc_ecc_init(struct rk_nfc *nfc, struct nand_chip *chip) ecc->layout->eccpos[i] = rknand->metadata_size + i; ecc->layout->oobfree[0 ].length = rknand->metadata_size -NFC_SYS_DATA_SIZE -2 ; - ecc->layout->oobfree[0 ].offset =NFC_SYS_DATA_SIZE +2 ; + ecc->layout->oobfree[0 ].offset =2 ;return 0 ; } --2.20.1