u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
@ 2023-03-13  0:23 Johan Jonker
  2023-03-13  0:28 ` [PATCH v8 01/24] mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr Johan Jonker
                   ` (24 more replies)
  0 siblings, 25 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:23 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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.
Extended with tree wide function cleanup needed for 64bit DT parsing.

Fixed are:
  64bit FDT parsing
  compatible string removal
  add missing layout structure
  add missing flash_node pointer
  add missing chip ID

Changed V8:
  change comments
  use uintptr_t size instead of phys_addr_t
  add another fdt_addr_t fix

Changed V7:
  add proof of concept for syscon node with variable reg size handling
  use another map_sysmem() function as cast
  remove cast

Changed V6:
  use -EINVAL on return
  drop cast
  use map_sysmem() function as cast
  add and rename patch

Changed V5:
  sort patch order
  add more fixes with pointer functions
  add debug text fixes
  test with binman for ARM only due to limited resources

Changed V4:
  fix cast and divider in syscon-uclass.c

Changed V3:
  use dev_read_addr_ptr
  fix oobfree

Johan Jonker (23):
  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
  rockchip: adc: rockchip-saradc: use dev_read_addr_ptr
  rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size
  rockchip: pwm: rk_pwm: use base variable with uintptr_t size
  rockchip: spi: rk_spi: use base variable with uintptr_t size
  include: dm: ofnode: fix headers
  core: remap: fix regmap_init_mem_plat() reg size handeling
  rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
  core: fdtaddr: add devfdt_get_addr_size_index_ptr function
  core: read: add dev_read_addr_index_ptr function
  spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr
  drivers: use dev_read_addr_index_ptr when cast to pointer
  drivers: use dev_read_addr_ptr when cast to pointer
  drivers: use devfdt_get_addr_size_index_ptr when cast to pointer
  drivers: use devfdt_get_addr_index_ptr when cast to pointer
  drivers: use devfdt_get_addr_ptr when cast to pointer
  drivers: fix debug string with fdt_addr_t input
  arm: stm32mp: spl: fix function with fdt_addr_t input
  include: fdtdec: decouple fdt_addr_t and phys_addr_t size

Paweł Jarosz (1):
  mtd: nand: add support for the Sandisk SDTNQGAMA chip

 Kconfig                                       |   8 ++
 arch/arm/mach-mvebu/cpu.c                     |   2 +-
 arch/arm/mach-mvebu/system-controller.c       |   4 +-
 arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 121 ++++++++++++++++++
 arch/arm/mach-stm32mp/spl.c                   |   2 +-
 doc/develop/driver-model/livetree.rst         |   2 +-
 drivers/adc/rockchip-saradc.c                 |   6 +-
 drivers/ata/dwc_ahsata.c                      |   2 +-
 drivers/cache/cache-l2x0.c                    |   2 +-
 drivers/cache/cache-v5l2.c                    |   2 +-
 drivers/clk/at91/sama7g5.c                    |   2 +-
 drivers/clk/at91/sckc.c                       |   2 +-
 drivers/clk/clk-hsdk-cgu.c                    |   4 +-
 drivers/clk/ti/clk-ctrl.c                     |   9 +-
 drivers/core/fdtaddr.c                        |  17 ++-
 drivers/core/read.c                           |  15 ++-
 drivers/core/regmap.c                         |  23 +++-
 drivers/core/syscon-uclass.c                  |  23 +++-
 drivers/ddr/altera/sdram_gen5.c               |   4 +-
 drivers/gpio/mscc_sgpio.c                     |   2 +-
 drivers/gpio/tegra_gpio.c                     |   4 +-
 drivers/gpio/xilinx_gpio.c                    |   2 +-
 drivers/i2c/i2c-cdns.c                        |   4 +-
 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/xenon_sdhci.c                     |   2 +-
 drivers/mmc/zynq_sdhci.c                      |   6 +-
 drivers/mtd/nand/raw/arasan_nfc.c             |   2 +-
 drivers/mtd/nand/raw/cortina_nand.c           |   6 +-
 drivers/mtd/nand/raw/mxic_nand.c              |   2 +-
 drivers/mtd/nand/raw/nand_ids.c               |   3 +
 drivers/mtd/nand/raw/rockchip_nfc.c           |  78 ++++-------
 drivers/mtd/nand/raw/tegra_nand.c             |   2 +-
 drivers/mtd/nand/raw/zynq_nand.c              |   2 +-
 drivers/net/dm9000x.c                         |   2 +-
 drivers/net/dwmac_meson8b.c                   |   4 +-
 drivers/net/mvmdio.c                          |   2 +-
 drivers/net/mvpp2.c                           |  24 ++--
 drivers/net/qe/dm_qe_uec_phy.c                |   2 +-
 drivers/pci/pci-aardvark.c                    |   4 +-
 drivers/pci/pcie_dw_meson.c                   |   8 +-
 drivers/pci/pcie_dw_mvebu.c                   |  10 +-
 drivers/pci/pcie_dw_rockchip.c                |   8 +-
 drivers/pci/pcie_imx.c                        |   4 +-
 drivers/pci/pcie_layerscape_ep.c              |   8 +-
 drivers/phy/allwinner/phy-sun50i-usb3.c       |   6 +-
 drivers/phy/marvell/comphy_core.c             |  12 +-
 drivers/phy/phy-stm32-usbphyc.c               |   4 +-
 drivers/phy/qcom/phy-qcom-usb-hs-28nm.c       |   4 +-
 drivers/phy/qcom/phy-qcom-usb-ss.c            |   4 +-
 .../phy/rockchip/phy-rockchip-snps-pcie3.c    |   4 +-
 drivers/phy/rockchip/phy-rockchip-typec.c     |   6 +-
 drivers/pwm/rk_pwm.c                          |   2 +-
 drivers/pwm/tegra_pwm.c                       |   2 +-
 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/serial/serial_zynq.c                  |   6 +-
 drivers/spi/cadence_qspi.c                    |   5 +-
 drivers/spi/mpc8xxx_spi.c                     |   2 +-
 drivers/spi/mscc_bb_spi.c                     |   2 +-
 drivers/spi/mtk_snor.c                        |   2 +-
 drivers/spi/mtk_spim.c                        |   2 +-
 drivers/spi/rk_spi.c                          |   2 +-
 drivers/spi/sh_qspi.c                         |   2 +-
 drivers/spi/spi-aspeed-smc.c                  |  17 ++-
 drivers/spi/spi-mxic.c                        |   2 +-
 drivers/spi/xilinx_spi.c                      |   2 +-
 drivers/timer/dw-apb-timer.c                  |   2 +-
 drivers/ufs/ufs.c                             |   2 +-
 drivers/usb/host/ehci-tegra.c                 |   2 +-
 drivers/usb/musb-new/ti-musb.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/video/ti/tilcdc.c                     |   4 +-
 drivers/watchdog/cdns_wdt.c                   |   6 +-
 drivers/watchdog/sbsa_gwdt.c                  |  12 +-
 drivers/watchdog/sp805_wdt.c                  |   6 +-
 drivers/watchdog/xilinx_tb_wdt.c              |   6 +-
 include/dm/fdtaddr.h                          |  17 ++-
 include/dm/ofnode.h                           |  16 +--
 include/fdtdec.h                              |  13 +-
 include/regmap.h                              |   5 +-
 include/syscon.h                              |  13 --
 94 files changed, 426 insertions(+), 255 deletions(-)

--
2.20.1


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v8 01/24] mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
@ 2023-03-13  0:28 ` Johan Jonker
  2023-03-13  0:28 ` [PATCH v8 02/24] mtd: nand: raw: rockchip_nfc: remove the compatible string "rockchip,rk3308-nfc" Johan Jonker
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:28 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

The 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.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
---

Changed V6:
  use -EINVAL on return
---
 drivers/mtd/nand/raw/rockchip_nfc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
index d016d255..9f424a25 100644
--- a/drivers/mtd/nand/raw/rockchip_nfc.c
+++ b/drivers/mtd/nand/raw/rockchip_nfc.c
@@ -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 = -EINVAL;
 		goto release_nfc;
 	}

--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 02/24] mtd: nand: raw: rockchip_nfc: remove the compatible string "rockchip,rk3308-nfc"
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
  2023-03-13  0:28 ` [PATCH v8 01/24] mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr Johan Jonker
@ 2023-03-13  0:28 ` Johan Jonker
  2023-03-13  0:28 ` [PATCH v8 03/24] mtd: nand: raw: rockchip_nfc: add layout structure Johan Jonker
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:28 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

The 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.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/mtd/nand/raw/rockchip_nfc.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
index 9f424a25..021e7ef7 100644
--- a/drivers/mtd/nand/raw/rockchip_nfc.c
+++ b/drivers/mtd/nand/raw/rockchip_nfc.c
@@ -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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 03/24] mtd: nand: raw: rockchip_nfc: add layout structure
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
  2023-03-13  0:28 ` [PATCH v8 01/24] mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr Johan Jonker
  2023-03-13  0:28 ` [PATCH v8 02/24] mtd: nand: raw: rockchip_nfc: remove the compatible string "rockchip,rk3308-nfc" Johan Jonker
@ 2023-03-13  0:28 ` Johan Jonker
  2023-03-13  0:28 ` [PATCH v8 04/24] mtd: nand: raw: rockchip_nfc: add flash_node to chip structure Johan Jonker
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:28 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

The 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.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/mtd/nand/raw/rockchip_nfc.c | 61 ++++++++++-------------------
 1 file changed, 20 insertions(+), 41 deletions(-)

diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
index 021e7ef7..90cd86a2 100644
--- a/drivers/mtd/nand/raw/rockchip_nfc.c
+++ b/drivers/mtd/nand/raw/rockchip_nfc.c
@@ -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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 04/24] mtd: nand: raw: rockchip_nfc: add flash_node to chip structure
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (2 preceding siblings ...)
  2023-03-13  0:28 ` [PATCH v8 03/24] mtd: nand: raw: rockchip_nfc: add layout structure Johan Jonker
@ 2023-03-13  0:28 ` Johan Jonker
  2023-03-13  0:29 ` [PATCH v8 05/24] mtd: nand: raw: rockchip_nfc: fix oobfree offset and description Johan Jonker
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:28 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

Add flash_node to the rockchip_nfc driver chip structure in order
to find the partitions in the add_mtd_partitions_of() function.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/mtd/nand/raw/rockchip_nfc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
index 90cd86a2..25e04974 100644
--- a/drivers/mtd/nand/raw/rockchip_nfc.c
+++ b/drivers/mtd/nand/raw/rockchip_nfc.c
@@ -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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 05/24] mtd: nand: raw: rockchip_nfc: fix oobfree offset and description
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (3 preceding siblings ...)
  2023-03-13  0:28 ` [PATCH v8 04/24] mtd: nand: raw: rockchip_nfc: add flash_node to chip structure Johan Jonker
@ 2023-03-13  0:29 ` Johan Jonker
  2023-03-13  0:29 ` [PATCH v8 06/24] mtd: nand: add support for the Sandisk SDTNQGAMA chip Johan Jonker
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:29 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

The 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.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
 drivers/mtd/nand/raw/rockchip_nfc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/rockchip_nfc.c b/drivers/mtd/nand/raw/rockchip_nfc.c
index 25e04974..5fcf6a6b 100644
--- a/drivers/mtd/nand/raw/rockchip_nfc.c
+++ b/drivers/mtd/nand/raw/rockchip_nfc.c
@@ -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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 06/24] mtd: nand: add support for the Sandisk SDTNQGAMA chip
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (4 preceding siblings ...)
  2023-03-13  0:29 ` [PATCH v8 05/24] mtd: nand: raw: rockchip_nfc: fix oobfree offset and description Johan Jonker
@ 2023-03-13  0:29 ` Johan Jonker
  2023-03-13  0:29 ` [PATCH v8 07/24] rockchip: adc: rockchip-saradc: use dev_read_addr_ptr Johan Jonker
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:29 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

Sandisk SDTNQGAMA is a 8GB size, 3.3V 8 bit chip with 16KB page size,
1KB write size and 40 bit ecc support

Signed-off-by: Paweł Jarosz <paweljarosz3691@gmail.com>
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 drivers/mtd/nand/raw/nand_ids.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/nand/raw/nand_ids.c b/drivers/mtd/nand/raw/nand_ids.c
index d0cfacc6..22ea5e2f 100644
--- a/drivers/mtd/nand/raw/nand_ids.c
+++ b/drivers/mtd/nand/raw/nand_ids.c
@@ -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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 07/24] rockchip: adc: rockchip-saradc: use dev_read_addr_ptr
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (5 preceding siblings ...)
  2023-03-13  0:29 ` [PATCH v8 06/24] mtd: nand: add support for the Sandisk SDTNQGAMA chip Johan Jonker
@ 2023-03-13  0:29 ` Johan Jonker
  2023-03-13  0:29 ` [PATCH v8 08/24] rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size Johan Jonker
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:29 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

The 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.
As we are there also streamline the error response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---

Changed V6:
  use -EINVAL on return
  drop cast
---
 drivers/adc/rockchip-saradc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/adc/rockchip-saradc.c b/drivers/adc/rockchip-saradc.c
index 760f8fe6..809486eb 100644
--- a/drivers/adc/rockchip-saradc.c
+++ b/drivers/adc/rockchip-saradc.c
@@ -145,10 +145,10 @@ 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 = dev_read_addr_ptr(dev);
+	if (!priv->regs) {
 		pr_err("Dev: %s - can't get address!", dev->name);
-		return -ENODATA;
+		return -EINVAL;
 	}

 	priv->data = data;
--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 08/24] rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (6 preceding siblings ...)
  2023-03-13  0:29 ` [PATCH v8 07/24] rockchip: adc: rockchip-saradc: use dev_read_addr_ptr Johan Jonker
@ 2023-03-13  0:29 ` Johan Jonker
  2023-03-13  3:10   ` Simon Glass
  2023-03-13  0:30 ` [PATCH v8 09/24] rockchip: pwm: rk_pwm: use base " Johan Jonker
                   ` (16 subsequent siblings)
  24 siblings, 1 reply; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:29 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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 a regs variable with uintptr_t size in the
dw-apb-timer.c file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

Changed V8:
  use uintptr_t instead of phys_addr_t

Changed V6:
  remove cast
  change title
---
 drivers/timer/dw-apb-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/timer/dw-apb-timer.c b/drivers/timer/dw-apb-timer.c
index 10f0a9f6..b171232c 100644
--- a/drivers/timer/dw-apb-timer.c
+++ b/drivers/timer/dw-apb-timer.c
@@ -23,7 +23,7 @@
 #define DW_APB_CTRL		0x8

 struct dw_apb_timer_priv {
-	fdt_addr_t regs;
+	uintptr_t regs;
 	struct reset_ctl_bulk resets;
 };

--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 09/24] rockchip: pwm: rk_pwm: use base variable with uintptr_t size
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (7 preceding siblings ...)
  2023-03-13  0:29 ` [PATCH v8 08/24] rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size Johan Jonker
@ 2023-03-13  0:30 ` Johan Jonker
  2023-03-13  3:10   ` Simon Glass
  2023-03-13  0:30 ` [PATCH v8 10/24] rockchip: spi: rk_spi: " Johan Jonker
                   ` (15 subsequent siblings)
  24 siblings, 1 reply; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:30 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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 a base variable with uintptr_t size in the
rk_pwm.c file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

Changed V8:
  use uintptr_t instead of phys_addr_t

Changed V6:
  new patch
---
 drivers/pwm/rk_pwm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pwm/rk_pwm.c b/drivers/pwm/rk_pwm.c
index 071eb04f..1858d597 100644
--- a/drivers/pwm/rk_pwm.c
+++ b/drivers/pwm/rk_pwm.c
@@ -30,7 +30,7 @@ struct rockchip_pwm_data {
 };

 struct rk_pwm_priv {
-	fdt_addr_t base;
+	uintptr_t base;
 	ulong freq;
 	u32 conf_polarity;
 	const struct rockchip_pwm_data *data;
--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 10/24] rockchip: spi: rk_spi: use base variable with uintptr_t size
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (8 preceding siblings ...)
  2023-03-13  0:30 ` [PATCH v8 09/24] rockchip: pwm: rk_pwm: use base " Johan Jonker
@ 2023-03-13  0:30 ` Johan Jonker
  2023-03-13  3:10   ` Simon Glass
  2023-03-13  0:30 ` [PATCH v8 11/24] include: dm: ofnode: fix headers Johan Jonker
                   ` (14 subsequent siblings)
  24 siblings, 1 reply; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:30 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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 a base variable with uintptr_t size in the
rk_spi.c file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

Changed V8:
  new patch
---
 drivers/spi/rk_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index 66b20fce..7de94335 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -45,7 +45,7 @@ struct rockchip_spi_plat {
 	struct dtd_rockchip_rk3288_spi of_plat;
 #endif
 	s32 frequency;		/* Default clock frequency, -1 for none */
-	fdt_addr_t base;
+	uintptr_t base;
 	uint deactivate_delay_us;	/* Delay to wait after deactivate */
 	uint activate_delay_us;		/* Delay to wait after activate */
 };
--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 11/24] include: dm: ofnode: fix headers
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (9 preceding siblings ...)
  2023-03-13  0:30 ` [PATCH v8 10/24] rockchip: spi: rk_spi: " Johan Jonker
@ 2023-03-13  0:30 ` Johan Jonker
  2023-03-13  0:30 ` [PATCH v8 12/24] core: remap: fix regmap_init_mem_plat() reg size handeling Johan Jonker
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:30 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

When fdt_addr_t and phys_addr_t are split it turns out that
the header don't match the functions, so fix the headers.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---
 include/dm/ofnode.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 3f6b0843..cd966f6a 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -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
@@ -1067,8 +1067,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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 12/24] core: remap: fix regmap_init_mem_plat() reg size handeling
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (10 preceding siblings ...)
  2023-03-13  0:30 ` [PATCH v8 11/24] include: dm: ofnode: fix headers Johan Jonker
@ 2023-03-13  0:30 ` Johan Jonker
  2023-03-13  3:10   ` Simon Glass
  2023-03-13  0:30 ` [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap Johan Jonker
                   ` (12 subsequent siblings)
  24 siblings, 1 reply; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:30 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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 regmap_init_mem_plat() input to handel both. The
syscon class driver also makes use of the regmap_init_mem_plat()
function, but has no way of knowing the format of the
device-specific platform data. In case of odd reg structures other
then that the syscon class driver assumes the regmap must be
filled in the individual syscon driver before pre-probe.
Also fix the ARRAY_SIZE divider in the syscon class driver.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

Changed V8:
  fix comment

Changed V7:
  changed title
  add reg size input
  rework function calls
---
 drivers/core/regmap.c               | 23 +++++++++++++++++++----
 drivers/core/syscon-uclass.c        | 23 ++++++++++++++++++-----
 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                    |  5 +++--
 include/syscon.h                    | 13 -------------
 10 files changed, 46 insertions(+), 30 deletions(-)

diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index e33bb9d7..dd323280 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -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, void *reg, int size, int count,
 			 struct regmap **mapp)
 {
 	struct regmap_range *range;
@@ -89,9 +89,24 @@ int regmap_init_mem_plat(struct udevice *dev, fdt_val_t *reg, int count,
 	if (!map)
 		return -ENOMEM;

-	for (range = map->ranges; count > 0; reg += 2, range++, count--) {
-		range->start = *reg;
-		range->size = reg[1];
+	if (size == sizeof(fdt32_t)) {
+		fdt32_t *ptr = (fdt32_t *)reg;
+
+		for (range = map->ranges; count > 0;
+		     ptr += 2, range++, count--) {
+			range->start = *ptr;
+			range->size = ptr[1];
+		}
+	} else if (size == sizeof(fdt64_t)) {
+		fdt64_t *ptr = (fdt64_t *)reg;
+
+		for (range = map->ranges; count > 0;
+		     ptr += 2, range++, count--) {
+			range->start = *ptr;
+			range->size = ptr[1];
+		}
+	} else {
+		return -EINVAL;
 	}

 	*mapp = map;
diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c
index 25fdb66e..a47b8bd3 100644
--- a/drivers/core/syscon-uclass.c
+++ b/drivers/core/syscon-uclass.c
@@ -49,17 +49,30 @@ static int syscon_pre_probe(struct udevice *dev)
 	if (device_get_uclass_id(dev->parent) == UCLASS_PCI)
 		return 0;

+#if CONFIG_IS_ENABLED(OF_PLATDATA)
 	/*
 	 * With OF_PLATDATA we really have no way of knowing the format of
 	 * the device-specific platform data. So we assume that it starts with
-	 * a 'reg' member, and this holds a single address and size. Drivers
-	 * using OF_PLATDATA will need to ensure that this is true.
+	 * a 'reg' member that holds a single address and size. Drivers
+	 * using OF_PLATDATA will need to ensure that this is true. In case of
+	 * odd reg structures other then the syscon_base_plat structure
+	 * below the regmap must be defined in the individual syscon driver.
 	 */
-#if CONFIG_IS_ENABLED(OF_PLATDATA)
+	struct syscon_base_plat {
+		phys_addr_t reg[2];
+	};
+
 	struct syscon_base_plat *plat = dev_get_plat(dev);

-	return regmap_init_mem_plat(dev, plat->reg, ARRAY_SIZE(plat->reg),
-					&priv->regmap);
+	/*
+	 * Return if the regmap is already defined in the individual
+	 * syscon driver.
+	 */
+	if (priv->regmap)
+		return 0;
+
+	return regmap_init_mem_plat(dev, plat->reg, sizeof(plat->reg[0]),
+				    ARRAY_SIZE(plat->reg) / 2, &priv->regmap);
 #else
 	return regmap_init_mem(dev_ofnode(dev), &priv->regmap);
 #endif
diff --git a/drivers/ram/rockchip/sdram_rk3066.c b/drivers/ram/rockchip/sdram_rk3066.c
index a2425f22..39c0be56 100644
--- a/drivers/ram/rockchip/sdram_rk3066.c
+++ b/drivers/ram/rockchip/sdram_rk3066.c
@@ -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, of_plat->reg, sizeof(of_plat->reg[0]),
 				   ARRAY_SIZE(of_plat->reg) / 2, &plat->map);
 	if (ret)
 		return ret;
diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c
index 272b1b2d..ad9f936d 100644
--- a/drivers/ram/rockchip/sdram_rk3188.c
+++ b/drivers/ram/rockchip/sdram_rk3188.c
@@ -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, of_plat->reg, sizeof(of_plat->reg[0]),
 				   ARRAY_SIZE(of_plat->reg) / 2, &plat->map);
 	if (ret)
 		return ret;
diff --git a/drivers/ram/rockchip/sdram_rk322x.c b/drivers/ram/rockchip/sdram_rk322x.c
index 1b204fb5..892766a8 100644
--- a/drivers/ram/rockchip/sdram_rk322x.c
+++ b/drivers/ram/rockchip/sdram_rk322x.c
@@ -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, of_plat->reg, sizeof(of_plat->reg[0]),
 				   ARRAY_SIZE(of_plat->reg) / 2, &plat->map);
 	if (ret)
 		return ret;
diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c
index 83778ad1..c99118fd 100644
--- a/drivers/ram/rockchip/sdram_rk3288.c
+++ b/drivers/ram/rockchip/sdram_rk3288.c
@@ -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, of_plat->reg, sizeof(of_plat->reg[0]),
 				   ARRAY_SIZE(of_plat->reg) / 2, &plat->map);
 	if (ret)
 		return ret;
diff --git a/drivers/ram/rockchip/sdram_rk3328.c b/drivers/ram/rockchip/sdram_rk3328.c
index 184c93f7..b5ca8ca4 100644
--- a/drivers/ram/rockchip/sdram_rk3328.c
+++ b/drivers/ram/rockchip/sdram_rk3328.c
@@ -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, dtplat->reg, sizeof(dtplat->reg[0]),
 				   ARRAY_SIZE(dtplat->reg) / 2, &plat->map);
 	if (ret)
 		return ret;
diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
index b1fea04e..ec9baddd 100644
--- a/drivers/ram/rockchip/sdram_rk3399.c
+++ b/drivers/ram/rockchip/sdram_rk3399.c
@@ -3048,7 +3048,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, dtplat->reg, sizeof(dtplat->reg[0]),
 				   ARRAY_SIZE(dtplat->reg) / 2, &plat->map);
 	if (ret)
 		return ret;
diff --git a/include/regmap.h b/include/regmap.h
index e81a3602..22b04340 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -378,17 +378,18 @@ int regmap_init_mem(ofnode node, struct regmap **mapp);
  *
  * @dev:	Device that uses this map
  * @reg:	List of address, size pairs
+ * @size:	Size of one reg array item
  * @count:	Number of pairs (e.g. 1 if the regmap has a single entry)
  * @mapp:	Returns allocated map
  * Return: 0 if OK, -ve on error
  *
  * This creates a new regmap with a list of regions passed in, rather than
- * using the device tree. It only supports 32-bit machines.
+ * using the device tree.
  *
  * 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, void *reg, int size, int count,
 			 struct regmap **mapp);

 int regmap_init_mem_index(ofnode node, struct regmap **mapp, int index);
diff --git a/include/syscon.h b/include/syscon.h
index f5e6cc1a..7a5ee3fa 100644
--- a/include/syscon.h
+++ b/include/syscon.h
@@ -25,19 +25,6 @@ struct syscon_ops {

 #define syscon_get_ops(dev)        ((struct syscon_ops *)(dev)->driver->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.
- */
-struct syscon_base_plat {
-	fdt_val_t reg[2];
-};
-#endif
-
 /**
  * syscon_get_regmap() - Get access to a register map
  *
--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (11 preceding siblings ...)
  2023-03-13  0:30 ` [PATCH v8 12/24] core: remap: fix regmap_init_mem_plat() reg size handeling Johan Jonker
@ 2023-03-13  0:30 ` Johan Jonker
  2023-03-13  3:10   ` Simon Glass
  2023-03-13 13:26   ` John Keeping
  2023-03-13  0:31 ` [PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function Johan Jonker
                   ` (11 subsequent siblings)
  24 siblings, 2 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:30 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

The Rockchip SoC rk3288 has 2 types of device trees floating around.
A 64bit reg size when synced from Linux and a 32bit for U-boot.
A pre-probe function in the syscon class driver assumes only 32bit.
For other odd reg structures the regmap must be defined in the individual
syscon driver. Store rk3288 platdata in a regmap before pre-probe
during bind.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

Note:
  Proof of concept not tested with rk3288 hardware,
  but with rk3066.

Changed V7:
  new patch
---
 arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 121 ++++++++++++++++++
 1 file changed, 121 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3288/syscon_rk3288.c b/arch/arm/mach-rockchip/rk3288/syscon_rk3288.c
index 9c1ae880..8b2c2f32 100644
--- a/arch/arm/mach-rockchip/rk3288/syscon_rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/syscon_rk3288.c
@@ -6,7 +6,10 @@

 #include <common.h>
 #include <dm.h>
+#include <dt-structs.h>
 #include <log.h>
+#include <malloc.h>
+#include <regmap.h>
 #include <syscon.h>
 #include <asm/arch-rockchip/clock.h>

@@ -25,6 +28,103 @@ U_BOOT_DRIVER(syscon_rk3288) = {
 };

 #if CONFIG_IS_ENABLED(OF_PLATDATA)
+#if IS_ENABLED(CONFIG_FDT_64BIT)
+struct rockchip_rk3288_noc_plat {
+	struct dtd_rockchip_rk3288_noc dtplat;
+};
+
+struct rockchip_rk3288_grf_plat {
+	struct dtd_rockchip_rk3288_grf dtplat;
+};
+
+struct rockchip_rk3288_sgrf_plat {
+	struct dtd_rockchip_rk3288_sgrf dtplat;
+};
+
+struct rockchip_rk3288_pmu_plat {
+	struct dtd_rockchip_rk3288_pmu dtplat;
+};
+
+static int rk3288_noc_bind_of_plat(struct udevice *dev)
+{
+	struct rockchip_rk3288_noc_plat *plat = dev_get_plat(dev);
+	struct syscon_uc_info *priv = dev_get_uclass_priv(dev);
+	int size = dev->uclass->uc_drv->per_device_auto;
+
+	if (size && !priv) {
+		priv = calloc(1, size);
+		if (!priv)
+			return -ENOMEM;
+		dev_set_uclass_priv(dev, priv);
+	}
+
+	dev->driver_data = dev->driver->of_match->data;
+	debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
+
+	return regmap_init_mem_plat(dev, plat->dtplat.reg, sizeof(plat->dtplat.reg[0]),
+				    ARRAY_SIZE(plat->dtplat.reg) / 2, &priv->regmap);
+}
+
+static int rk3288_grf_bind_of_plat(struct udevice *dev)
+{
+	struct rockchip_rk3288_grf_plat *plat = dev_get_plat(dev);
+	struct syscon_uc_info *priv = dev_get_uclass_priv(dev);
+	int size = dev->uclass->uc_drv->per_device_auto;
+
+	if (size && !priv) {
+		priv = calloc(1, size);
+		if (!priv)
+			return -ENOMEM;
+		dev_set_uclass_priv(dev, priv);
+	}
+
+	dev->driver_data = dev->driver->of_match->data;
+	debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
+
+	return regmap_init_mem_plat(dev, plat->dtplat.reg, sizeof(plat->dtplat.reg[0]),
+				    ARRAY_SIZE(plat->dtplat.reg) / 2, &priv->regmap);
+}
+
+static int rk3288_sgrf_bind_of_plat(struct udevice *dev)
+{
+	struct rockchip_rk3288_sgrf_plat *plat = dev_get_plat(dev);
+	struct syscon_uc_info *priv = dev_get_uclass_priv(dev);
+	int size = dev->uclass->uc_drv->per_device_auto;
+
+	if (size && !priv) {
+		priv = calloc(1, size);
+		if (!priv)
+			return -ENOMEM;
+		dev_set_uclass_priv(dev, priv);
+	}
+
+	dev->driver_data = dev->driver->of_match->data;
+	debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
+
+	return regmap_init_mem_plat(dev, plat->dtplat.reg, sizeof(plat->dtplat.reg[0]),
+				    ARRAY_SIZE(plat->dtplat.reg) / 2, &priv->regmap);
+}
+
+static int rk3288_pmu_bind_of_plat(struct udevice *dev)
+{
+	struct rockchip_rk3288_pmu_plat *plat = dev_get_plat(dev);
+	struct syscon_uc_info *priv = dev_get_uclass_priv(dev);
+	int size = dev->uclass->uc_drv->per_device_auto;
+
+	if (size && !priv) {
+		priv = calloc(1, size);
+		if (!priv)
+			return -ENOMEM;
+		dev_set_uclass_priv(dev, priv);
+	}
+
+	dev->driver_data = dev->driver->of_match->data;
+	debug("syscon: %s %d\n", dev->name, (uint)dev->driver_data);
+
+	return regmap_init_mem_plat(dev, plat->dtplat.reg, sizeof(plat->dtplat.reg[0]),
+				    ARRAY_SIZE(plat->dtplat.reg) / 2, &priv->regmap);
+}
+#else
 static int rk3288_syscon_bind_of_plat(struct udevice *dev)
 {
 	dev->driver_data = dev->driver->of_match->data;
@@ -32,32 +132,53 @@ static int rk3288_syscon_bind_of_plat(struct udevice *dev)

 	return 0;
 }
+#endif

 U_BOOT_DRIVER(rockchip_rk3288_noc) = {
 	.name = "rockchip_rk3288_noc",
 	.id = UCLASS_SYSCON,
 	.of_match = rk3288_syscon_ids,
+#if IS_ENABLED(CONFIG_FDT_64BIT)
+	.bind = rk3288_noc_bind_of_plat,
+	.plat_auto = sizeof(struct rockchip_rk3288_noc_plat),
+#else
 	.bind = rk3288_syscon_bind_of_plat,
+#endif
 };

 U_BOOT_DRIVER(rockchip_rk3288_grf) = {
 	.name = "rockchip_rk3288_grf",
 	.id = UCLASS_SYSCON,
 	.of_match = rk3288_syscon_ids + 1,
+#if IS_ENABLED(CONFIG_FDT_64BIT)
+	.bind = rk3288_grf_bind_of_plat,
+	.plat_auto = sizeof(struct rockchip_rk3288_grf_plat),
+#else
 	.bind = rk3288_syscon_bind_of_plat,
+#endif
 };

 U_BOOT_DRIVER(rockchip_rk3288_sgrf) = {
 	.name = "rockchip_rk3288_sgrf",
 	.id = UCLASS_SYSCON,
 	.of_match = rk3288_syscon_ids + 2,
+#if IS_ENABLED(CONFIG_FDT_64BIT)
+	.bind = rk3288_sgrf_bind_of_plat,
+	.plat_auto = sizeof(struct rockchip_rk3288_sgrf_plat),
+#else
 	.bind = rk3288_syscon_bind_of_plat,
+#endif
 };

 U_BOOT_DRIVER(rockchip_rk3288_pmu) = {
 	.name = "rockchip_rk3288_pmu",
 	.id = UCLASS_SYSCON,
 	.of_match = rk3288_syscon_ids + 3,
+#if IS_ENABLED(CONFIG_FDT_64BIT)
+	.bind = rk3288_pmu_bind_of_plat,
+	.plat_auto = sizeof(struct rockchip_rk3288_pmu_plat),
+#else
 	.bind = rk3288_syscon_bind_of_plat,
+#endif
 };
 #endif
--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (12 preceding siblings ...)
  2023-03-13  0:30 ` [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap Johan Jonker
@ 2023-03-13  0:31 ` Johan Jonker
  2023-03-13  0:31 ` [PATCH v8 15/24] core: read: add dev_read_addr_index_ptr function Johan Jonker
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:31 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

Add devfdt_get_addr_size_index_ptr function with the same
functionality as devfdt_get_addr_size_index, but instead
a return pointer is given.
Use map_sysmem() function as cast for the return.
Make same fix for devfdt_get_addr_index_ptr() function.

Suggested-by: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changed V7:
  use map_sysmem()

Changed V5:
  fix spelling
  use tabs
---
 drivers/core/fdtaddr.c | 17 ++++++++++++++++-
 include/dm/fdtaddr.h   | 17 ++++++++++++++++-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 91bcd1a2..546db675 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <fdt_support.h>
 #include <log.h>
+#include <mapmem.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <dm/device-internal.h>
@@ -97,7 +98,10 @@ void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index)
 {
 	fdt_addr_t addr = devfdt_get_addr_index(dev, index);

-	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
+	if (addr == FDT_ADDR_T_NONE)
+		return NULL;
+
+	return map_sysmem(addr, 0);
 }

 fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,
@@ -122,6 +126,17 @@ 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);
+
+	if (addr == FDT_ADDR_T_NONE)
+		return NULL;
+
+	return map_sysmem(addr, 0);
+}
+
 fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name)
 {
 #if CONFIG_IS_ENABLED(OF_CONTROL)
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index c9d2b27b..dcdc1913 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -111,7 +111,7 @@ void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index);
  * @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
+ * @size: Pointer to size variable - this function returns the size
  *        specified in the 'reg' property here
  *
  * Return: addr
@@ -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 variable - 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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 15/24] core: read: add dev_read_addr_index_ptr function
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (13 preceding siblings ...)
  2023-03-13  0:31 ` [PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function Johan Jonker
@ 2023-03-13  0:31 ` Johan Jonker
  2023-03-13  0:31 ` [PATCH v8 16/24] spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr Johan Jonker
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:31 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

Add dev_read_addr_index_ptr function with the
same functionality as dev_read_addr_index,
but instead a return pointer is given.
Use map_sysmem() function as cast for the return.
Make same fix for dev_read_addr_ptr() function.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changed V6:
  use map_sysmem()

Changed V5:
  new patch
---
 drivers/core/read.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/core/read.c b/drivers/core/read.c
index e0543bba..0289a2ed 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -131,6 +131,16 @@ fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index)
 		return devfdt_get_addr_index(dev, index);
 }

+void *dev_read_addr_index_ptr(const struct udevice *dev, int index)
+{
+	fdt_addr_t addr = dev_read_addr_index(dev, index);
+
+	if (addr == FDT_ADDR_T_NONE)
+		return NULL;
+
+	return map_sysmem(addr, 0);
+}
+
 fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index,
 				    fdt_size_t *size)
 {
@@ -190,7 +200,10 @@ void *dev_read_addr_ptr(const struct udevice *dev)
 {
 	fdt_addr_t addr = dev_read_addr(dev);

-	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
+	if (addr == FDT_ADDR_T_NONE)
+		return NULL;
+
+	return map_sysmem(addr, 0);
 }

 void *dev_remap_addr(const struct udevice *dev)
--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 16/24] spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (14 preceding siblings ...)
  2023-03-13  0:31 ` [PATCH v8 15/24] core: read: add dev_read_addr_index_ptr function Johan Jonker
@ 2023-03-13  0:31 ` Johan Jonker
  2023-03-13  0:31 ` [PATCH v8 17/24] drivers: use dev_read_addr_index_ptr when cast to pointer Johan Jonker
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:31 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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. As we are there also streamline the error
response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
---

Changed V6:
  use -EINVAL on return
---
 drivers/spi/spi-aspeed-smc.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-aspeed-smc.c b/drivers/spi/spi-aspeed-smc.c
index 4b6ea9f8..39620310 100644
--- a/drivers/spi/spi-aspeed-smc.c
+++ b/drivers/spi/spi-aspeed-smc.c
@@ -1125,17 +1125,16 @@ 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;
+		return -EINVAL;
 	}

-	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;
+		return -EINVAL;
 	}

 	plat->max_cs = dev_read_u32_default(bus, "num-cs", ASPEED_SPI_MAX_CS);
@@ -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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 17/24] drivers: use dev_read_addr_index_ptr when cast to pointer
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (15 preceding siblings ...)
  2023-03-13  0:31 ` [PATCH v8 16/24] spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr Johan Jonker
@ 2023-03-13  0:31 ` Johan Jonker
  2023-03-13  3:10   ` Simon Glass
  2023-03-13  0:32 ` [PATCH v8 18/24] drivers: use dev_read_addr_ptr " Johan Jonker
                   ` (7 subsequent siblings)
  24 siblings, 1 reply; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:31 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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_index_ptr instead of the dev_read_addr_index function
in the various files in the drivers directory that cast to a pointer.
As we are there also streamline the error response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
---

Changed V6:
  use -EINVAL on return
  drop cast
---
 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         |  8 ++++----
 drivers/pci/pcie_dw_rockchip.c      |  8 ++++----
 drivers/watchdog/sbsa_gwdt.c        | 12 ++++++------
 6 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/mtd/nand/raw/cortina_nand.c b/drivers/mtd/nand/raw/cortina_nand.c
index 88798f23..8de35731 100644
--- a/drivers/mtd/nand/raw/cortina_nand.c
+++ b/drivers/mtd/nand/raw/cortina_nand.c
@@ -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 = dev_read_addr_index_ptr(dev, 1);
+	info->dma_nand = 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 =
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index b46bdeb2..bec8d67d 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -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 = dev_read_addr_index_ptr(dev, 1);

 	return 0;
 }
diff --git a/drivers/net/dwmac_meson8b.c b/drivers/net/dwmac_meson8b.c
index ddbaa87d..871171e1 100644
--- a/drivers/net/dwmac_meson8b.c
+++ b/drivers/net/dwmac_meson8b.c
@@ -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);
diff --git a/drivers/pci/pcie_dw_meson.c b/drivers/pci/pcie_dw_meson.c
index 07da9fa5..f9537979 100644
--- a/drivers/pci/pcie_dw_meson.c
+++ b/drivers/pci/pcie_dw_meson.c
@@ -337,15 +337,15 @@ 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;
+		return -EINVAL;

 	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;
+		return -EINVAL;

 	dev_dbg(dev, "CFG address is 0x%p\n", priv->meson_cfg_base);

diff --git a/drivers/pci/pcie_dw_rockchip.c b/drivers/pci/pcie_dw_rockchip.c
index 9322e735..624ca1cb 100644
--- a/drivers/pci/pcie_dw_rockchip.c
+++ b/drivers/pci/pcie_dw_rockchip.c
@@ -353,15 +353,15 @@ 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;
+		return -EINVAL;

 	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;
+		return -EINVAL;

 	dev_dbg(dev, "APB address is 0x%p\n", priv->apb_base);

diff --git a/drivers/watchdog/sbsa_gwdt.c b/drivers/watchdog/sbsa_gwdt.c
index f43cd3fd..96d04665 100644
--- a/drivers/watchdog/sbsa_gwdt.c
+++ b/drivers/watchdog/sbsa_gwdt.c
@@ -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 = 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 = dev_read_addr_index_ptr(dev, 1);
+	if (!priv->reg_refresh)
+		return -EINVAL;

 	return 0;
 }
--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 18/24] drivers: use dev_read_addr_ptr when cast to pointer
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (16 preceding siblings ...)
  2023-03-13  0:31 ` [PATCH v8 17/24] drivers: use dev_read_addr_index_ptr when cast to pointer Johan Jonker
@ 2023-03-13  0:32 ` Johan Jonker
  2023-03-13  0:32 ` [PATCH v8 19/24] drivers: use devfdt_get_addr_size_index_ptr " Johan Jonker
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:32 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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.
As we are there also streamline the error response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changed V6:
  use -EINVAL on return
  drop cast

Changed V5:
  rebase
  fix typo
  fix more files
---
 arch/arm/mach-mvebu/system-controller.c        | 4 ++--
 doc/develop/driver-model/livetree.rst          | 2 +-
 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                         | 4 ++--
 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/video/ti/tilcdc.c                      | 4 ++--
 drivers/watchdog/cdns_wdt.c                    | 6 +++---
 drivers/watchdog/sp805_wdt.c                   | 6 +++---
 drivers/watchdog/xilinx_tb_wdt.c               | 6 +++---
 47 files changed, 75 insertions(+), 75 deletions(-)

diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index e90aff0c..7cdde11c 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -71,8 +71,8 @@ static int mvebu_reset_of_to_plat(struct udevice *dev)
 {
 	struct mvebu_reset_data *data = dev_get_priv(dev);

-	data->base = (void *)dev_read_addr(dev);
-	if ((fdt_addr_t)data->base == FDT_ADDR_T_NONE)
+	data->base = dev_read_addr_ptr(dev);
+	if (!data->base)
 		return -EINVAL;

 	return 0;
diff --git a/doc/develop/driver-model/livetree.rst b/doc/develop/driver-model/livetree.rst
index 579eef5c..20055d55 100644
--- a/doc/develop/driver-model/livetree.rst
+++ b/doc/develop/driver-model/livetree.rst
@@ -103,7 +103,7 @@ The new code is:

     struct udevice *bus;

-    i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr(dev);
+    i2c_bus->regs = dev_read_addr_ptr(dev);
     plat->frequency = dev_read_u32_default(bus, "spi-max-frequency", 500000);

 The dev_read\_...() interface is more convenient and works with both the
diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c
index 167b5a39..6a4d861b 100644
--- a/drivers/ata/dwc_ahsata.c
+++ b/drivers/ata/dwc_ahsata.c
@@ -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 = dev_read_addr_ptr(dev);

 	/* initialize adapter */
 	ret = ahci_host_init(uc_priv);
diff --git a/drivers/cache/cache-l2x0.c b/drivers/cache/cache-l2x0.c
index a1556fbf..560f4c94 100644
--- a/drivers/cache/cache-l2x0.c
+++ b/drivers/cache/cache-l2x0.c
@@ -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 = dev_read_addr_ptr(dev);

 	/* Disable the L2 Cache */
 	clrbits_le32(&regs->pl310_ctrl, L2X0_CTRL_EN);
diff --git a/drivers/cache/cache-v5l2.c b/drivers/cache/cache-v5l2.c
index eda07d3f..fe3f9392 100644
--- a/drivers/cache/cache-v5l2.c
+++ b/drivers/cache/cache-v5l2.c
@@ -119,7 +119,7 @@ static int v5l2_of_to_plat(struct udevice *dev)
 	struct v5l2_plat *plat = dev_get_plat(dev);
 	struct l2cache *regs;

-	regs = (struct l2cache *)(uintptr_t)dev_read_addr(dev);
+	regs = dev_read_addr_ptr(dev);
 	plat->regs = regs;

 	plat->iprefetch = -EINVAL;
diff --git a/drivers/gpio/mscc_sgpio.c b/drivers/gpio/mscc_sgpio.c
index 1cbcc434..c97e4400 100644
--- a/drivers/gpio/mscc_sgpio.c
+++ b/drivers/gpio/mscc_sgpio.c
@@ -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 = dev_read_addr_ptr(dev);
 	uc_priv->bank_name = "sgpio";

 	sgpio_clrsetbits(priv, REG_SIO_CONFIG, 0,
diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c
index 4291e496..55105f28 100644
--- a/drivers/gpio/tegra_gpio.c
+++ b/drivers/gpio/tegra_gpio.c
@@ -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 = dev_read_addr_ptr(parent);
+	if (!ctlr)
 		return -EINVAL;
 	}
 #endif
diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c
index 510838d2..fa8d630b 100644
--- a/drivers/gpio/xilinx_gpio.c
+++ b/drivers/gpio/xilinx_gpio.c
@@ -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 = 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);
diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c
index c1672ca1..1a892072 100644
--- a/drivers/i2c/i2c-cdns.c
+++ b/drivers/i2c/i2c-cdns.c
@@ -479,9 +479,9 @@ 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 = dev_read_addr_ptr(dev);
 	if (!i2c_bus->regs)
-		return -ENOMEM;
+		return -EINVAL;

 	if (pdata)
 		i2c_bus->quirks = pdata->quirks;
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 2394e9d0..5864a1ad 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -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 = dev_read_addr_ptr(dev);
+	if (!i2c_bus->regs) {
 		debug("%s: Cannot get regs address\n", __func__);
 		return -EINVAL;
 	}
diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
index 42a61343..fd667aea 100644
--- a/drivers/mmc/am654_sdhci.c
+++ b/drivers/mmc/am654_sdhci.c
@@ -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) {
diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c
index 05ca3612..3a3d23ae 100644
--- a/drivers/mmc/davinci_mmc.c
+++ b/drivers/mmc/davinci_mmc.c
@@ -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 = dev_read_addr_ptr(dev);
 	cfg->f_min = 200000;
 	cfg->f_max = 25000000;
 	cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
diff --git a/drivers/mmc/piton_mmc.c b/drivers/mmc/piton_mmc.c
index 9f5da6d6..a330bbf8 100644
--- a/drivers/mmc/piton_mmc.c
+++ b/drivers/mmc/piton_mmc.c
@@ -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;
diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c
index 760eca40..f76fee3e 100644
--- a/drivers/mmc/tegra_mmc.c
+++ b/drivers/mmc/tegra_mmc.c
@@ -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) {
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 91e309d2..6e22aef4 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -1195,9 +1195,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");
diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c
index 4621bfb0..d5726351 100644
--- a/drivers/mtd/nand/raw/arasan_nfc.c
+++ b/drivers/mtd/nand/raw/arasan_nfc.c
@@ -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 = dev_read_addr_ptr(dev);
 	mtd = nand_to_mtd(nand_chip);
 	nand_set_controller_data(nand_chip, &arasan->nand_ctrl);

diff --git a/drivers/mtd/nand/raw/cortina_nand.c b/drivers/mtd/nand/raw/cortina_nand.c
index 8de35731..b7be6602 100644
--- a/drivers/mtd/nand/raw/cortina_nand.c
+++ b/drivers/mtd/nand/raw/cortina_nand.c
@@ -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 = dev_read_addr_ptr(dev);
 	info->dma_glb = dev_read_addr_index_ptr(dev, 1);
 	info->dma_nand = dev_read_addr_index_ptr(dev, 2);
 	info->config.enabled = dev_read_enabled(dev);
diff --git a/drivers/mtd/nand/raw/mxic_nand.c b/drivers/mtd/nand/raw/mxic_nand.c
index e54df461..6abdc24b 100644
--- a/drivers/mtd/nand/raw/mxic_nand.c
+++ b/drivers/mtd/nand/raw/mxic_nand.c
@@ -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))
diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c
index d2801d48..139d978a 100644
--- a/drivers/mtd/nand/raw/tegra_nand.c
+++ b/drivers/mtd/nand/raw/tegra_nand.c
@@ -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 = 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,
diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c
index 14cb2ba7..9e3ee741 100644
--- a/drivers/mtd/nand/raw/zynq_nand.c
+++ b/drivers/mtd/nand/raw/zynq_nand.c
@@ -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 = 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");
diff --git a/drivers/net/mvmdio.c b/drivers/net/mvmdio.c
index 6fb8a985..c0ebcdb1 100644
--- a/drivers/net/mvmdio.c
+++ b/drivers/net/mvmdio.c
@@ -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;
diff --git a/drivers/net/qe/dm_qe_uec_phy.c b/drivers/net/qe/dm_qe_uec_phy.c
index 038b8104..a0bcc8d3 100644
--- a/drivers/net/qe/dm_qe_uec_phy.c
+++ b/drivers/net/qe/dm_qe_uec_phy.c
@@ -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 = dev_read_addr_ptr(dev);
 	base = (fdt_size_t)priv->base;

 	/*
diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c
index b0fc9caa..af0e55cd 100644
--- a/drivers/pci/pci-aardvark.c
+++ b/drivers/pci/pci-aardvark.c
@@ -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;
diff --git a/drivers/phy/allwinner/phy-sun50i-usb3.c b/drivers/phy/allwinner/phy-sun50i-usb3.c
index e5a3d2d9..609d9d4e 100644
--- a/drivers/phy/allwinner/phy-sun50i-usb3.c
+++ b/drivers/phy/allwinner/phy-sun50i-usb3.c
@@ -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 = dev_read_addr_ptr(dev);
+	if (!priv->regs)
+		return -EINVAL;

 	return 0;
 }
diff --git a/drivers/phy/qcom/phy-qcom-usb-hs-28nm.c b/drivers/phy/qcom/phy-qcom-usb-hs-28nm.c
index 14c3d839..05a9a2cf 100644
--- a/drivers/phy/qcom/phy-qcom-usb-hs-28nm.c
+++ b/drivers/phy/qcom/phy-qcom-usb-hs-28nm.c
@@ -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);
diff --git a/drivers/phy/qcom/phy-qcom-usb-ss.c b/drivers/phy/qcom/phy-qcom-usb-ss.c
index 4e816879..1b03a3c4 100644
--- a/drivers/phy/qcom/phy-qcom-usb-ss.c
+++ b/drivers/phy/qcom/phy-qcom-usb-ss.c
@@ -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);
diff --git a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
index 5ae41fbe..66c75f98 100644
--- a/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
+++ b/drivers/phy/rockchip/phy-rockchip-snps-pcie3.c
@@ -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 = dev_read_addr_ptr(dev);
+	if (!priv->mmio)
 		return -EINVAL;

 	ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev,
diff --git a/drivers/phy/rockchip/phy-rockchip-typec.c b/drivers/phy/rockchip/phy-rockchip-typec.c
index ca63b856..47c69dd6 100644
--- a/drivers/phy/rockchip/phy-rockchip-typec.c
+++ b/drivers/phy/rockchip/phy-rockchip-typec.c
@@ -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 = dev_read_addr_ptr(dev);
+	if (!priv->reg_base)
+		return -EINVAL;

 	ret = dev_read_u32_index(dev, "reg", 1, &reg);
 	if (ret) {
diff --git a/drivers/pwm/tegra_pwm.c b/drivers/pwm/tegra_pwm.c
index 95fc2645..87034706 100644
--- a/drivers/pwm/tegra_pwm.c
+++ b/drivers/pwm/tegra_pwm.c
@@ -59,7 +59,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 = dev_read_addr_ptr(dev);

 	return 0;
 }
diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c
index 9bb9b7d3..1847d1f6 100644
--- a/drivers/serial/serial_zynq.c
+++ b/drivers/serial/serial_zynq.c
@@ -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 = dev_read_addr_ptr(dev);
+	if (!plat->regs)
+		return -EINVAL;

 	return 0;
 }
diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c
index 6869d60d..3990f003 100644
--- a/drivers/spi/mpc8xxx_spi.c
+++ b/drivers/spi/mpc8xxx_spi.c
@@ -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 = 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);
diff --git a/drivers/spi/mscc_bb_spi.c b/drivers/spi/mscc_bb_spi.c
index 2a01ea06..95bea0da 100644
--- a/drivers/spi/mscc_bb_spi.c
+++ b/drivers/spi/mscc_bb_spi.c
@@ -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 = dev_read_addr_ptr(bus);

 	priv->deactivate_delay_us =
 		dev_read_u32_default(bus, "spi-deactivate-delay", 0);
diff --git a/drivers/spi/sh_qspi.c b/drivers/spi/sh_qspi.c
index 861423be..7dd1fe75 100644
--- a/drivers/spi/sh_qspi.c
+++ b/drivers/spi/sh_qspi.c
@@ -334,7 +334,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 = dev_read_addr_ptr(dev);

 	return 0;
 }
diff --git a/drivers/spi/spi-mxic.c b/drivers/spi/spi-mxic.c
index 6aae9f79..f663b9dc 100644
--- a/drivers/spi/spi-mxic.c
+++ b/drivers/spi/spi-mxic.c
@@ -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))
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 4e9115da..7ff6d6e1 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -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 = dev_read_addr_ptr(bus);

 	priv->fifo_depth = dev_read_u32_default(bus, "fifo-size", 0);

diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c
index 13e730b8..8dd29edd 100644
--- a/drivers/ufs/ufs.c
+++ b/drivers/ufs/ufs.c
@@ -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);
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 76562bd7..2cf16256 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -723,7 +723,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 = dev_read_addr_ptr(dev);
 	debug("reg=%p\n", config->reg);
 	mode = dev_read_string(dev, "dr_mode");
 	if (mode) {
diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c
index 6d9c5a94..6146a0f0 100644
--- a/drivers/video/dw_mipi_dsi.c
+++ b/drivers/video/dw_mipi_dsi.c
@@ -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;
 	}
diff --git a/drivers/video/rockchip/rk_vop.c b/drivers/video/rockchip/rk_vop.c
index bc98ab68..e54bb277 100644
--- a/drivers/video/rockchip/rk_vop.c
+++ b/drivers/video/rockchip/rk_vop.c
@@ -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 = dev_read_addr_ptr(dev);

 	/*
 	 * Try all the ports until we find one that works. In practice this
diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c
index e6347bb8..a7420fb2 100644
--- a/drivers/video/stm32/stm32_dsi.c
+++ b/drivers/video/stm32/stm32_dsi.c
@@ -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;
 	}
diff --git a/drivers/video/stm32/stm32_ltdc.c b/drivers/video/stm32/stm32_ltdc.c
index 58b6434a..f48badc5 100644
--- a/drivers/video/stm32/stm32_ltdc.c
+++ b/drivers/video/stm32/stm32_ltdc.c
@@ -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;
 	}
diff --git a/drivers/video/tegra124/display.c b/drivers/video/tegra124/display.c
index 78ab3f99..9261cc93 100644
--- a/drivers/video/tegra124/display.c
+++ b/drivers/video/tegra124/display.c
@@ -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 = 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;
diff --git a/drivers/video/tegra124/sor.c b/drivers/video/tegra124/sor.c
index ef1a2e6d..f291db3d 100644
--- a/drivers/video/tegra124/sor.c
+++ b/drivers/video/tegra124/sor.c
@@ -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 = 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 = 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))
diff --git a/drivers/video/ti/tilcdc.c b/drivers/video/ti/tilcdc.c
index 88043fc1..2734754e 100644
--- a/drivers/video/ti/tilcdc.c
+++ b/drivers/video/ti/tilcdc.c
@@ -387,8 +387,8 @@ static int tilcdc_of_to_plat(struct udevice *dev)
 {
 	struct tilcdc_priv *priv = dev_get_priv(dev);

-	priv->regs = (struct tilcdc_regs *)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, "failed to get base address\n");
 		return -EINVAL;
 	}
diff --git a/drivers/watchdog/cdns_wdt.c b/drivers/watchdog/cdns_wdt.c
index 6dfdd31c..743ab648 100644
--- a/drivers/watchdog/cdns_wdt.c
+++ b/drivers/watchdog/cdns_wdt.c
@@ -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 = dev_read_addr_ptr(dev);
+	if (!priv->regs)
+		return -EINVAL;

 	priv->rst = dev_read_bool(dev, "reset-on-timeout");

diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index 0d6fb120..6d58fd3c 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -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 = 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);
diff --git a/drivers/watchdog/xilinx_tb_wdt.c b/drivers/watchdog/xilinx_tb_wdt.c
index 1687a459..0f9fb020 100644
--- a/drivers/watchdog/xilinx_tb_wdt.c
+++ b/drivers/watchdog/xilinx_tb_wdt.c
@@ -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 = 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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 19/24] drivers: use devfdt_get_addr_size_index_ptr when cast to pointer
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (17 preceding siblings ...)
  2023-03-13  0:32 ` [PATCH v8 18/24] drivers: use dev_read_addr_ptr " Johan Jonker
@ 2023-03-13  0:32 ` Johan Jonker
  2023-03-13  0:32 ` [PATCH v8 20/24] drivers: use devfdt_get_addr_index_ptr " Johan Jonker
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:32 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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_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.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
 drivers/pci/pcie_dw_mvebu.c | 6 +++---
 drivers/spi/cadence_qspi.c  | 3 +--
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pcie_dw_mvebu.c b/drivers/pci/pcie_dw_mvebu.c
index a0b82c78..3b2ada54 100644
--- a/drivers/pci/pcie_dw_mvebu.c
+++ b/drivers/pci/pcie_dw_mvebu.c
@@ -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;
diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index c7f10c50..6a52676a 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -384,8 +384,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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 20/24] drivers: use devfdt_get_addr_index_ptr when cast to pointer
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (18 preceding siblings ...)
  2023-03-13  0:32 ` [PATCH v8 19/24] drivers: use devfdt_get_addr_size_index_ptr " Johan Jonker
@ 2023-03-13  0:32 ` Johan Jonker
  2023-03-13  0:32 ` [PATCH v8 21/24] drivers: use devfdt_get_addr_ptr " Johan Jonker
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:32 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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 instead of the devfdt_get_addr_index function
in the various files in the drivers directory that cast to a pointer.
As we are there also streamline the error response to -EINVAL on return.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changed V6:
  use -EINVAL on return
  drop cast
---
 drivers/clk/clk-hsdk-cgu.c        |  4 ++--
 drivers/ddr/altera/sdram_gen5.c   |  4 ++--
 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  |  8 ++++----
 drivers/phy/marvell/comphy_core.c | 12 ++++++------
 drivers/spi/cadence_qspi.c        |  2 +-
 drivers/usb/musb-new/ti-musb.c    |  2 +-
 10 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/clk/clk-hsdk-cgu.c b/drivers/clk/clk-hsdk-cgu.c
index 26b0aa9a..e28543ef 100644
--- a/drivers/clk/clk-hsdk-cgu.c
+++ b/drivers/clk/clk-hsdk-cgu.c
@@ -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 = 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 = devfdt_get_addr_index_ptr(dev, 1);
 	if (!hsdk_clk->creg_regs)
 		return -EINVAL;

diff --git a/drivers/ddr/altera/sdram_gen5.c b/drivers/ddr/altera/sdram_gen5.c
index 8d3ce495..34d2a278 100644
--- a/drivers/ddr/altera/sdram_gen5.c
+++ b/drivers/ddr/altera/sdram_gen5.c
@@ -567,9 +567,9 @@ 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 = devfdt_get_addr_index_ptr(dev, 0);
 	if (!plat->sdr)
-		return -ENODEV;
+		return -EINVAL;

 	return 0;
 }
diff --git a/drivers/mmc/xenon_sdhci.c b/drivers/mmc/xenon_sdhci.c
index 2f880509..16ac84a2 100644
--- a/drivers/mmc/xenon_sdhci.c
+++ b/drivers/mmc/xenon_sdhci.c
@@ -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);
diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index 1bad50d3..a4be8497 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -5349,18 +5349,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;
@@ -5399,10 +5399,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 = 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);
diff --git a/drivers/pci/pcie_dw_mvebu.c b/drivers/pci/pcie_dw_mvebu.c
index 3b2ada54..c41f3f15 100644
--- a/drivers/pci/pcie_dw_mvebu.c
+++ b/drivers/pci/pcie_dw_mvebu.c
@@ -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 */
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index da484664..4a18b0e0 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -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 = devfdt_get_addr_index_ptr(dev, 0);
+	priv->cfg_base = devfdt_get_addr_index_ptr(dev, 1);
 	if (!priv->dbi_base || !priv->cfg_base)
 		return -EINVAL;

diff --git a/drivers/pci/pcie_layerscape_ep.c b/drivers/pci/pcie_layerscape_ep.c
index ff26a5cd..83f7eebd 100644
--- a/drivers/pci/pcie_layerscape_ep.c
+++ b/drivers/pci/pcie_layerscape_ep.c
@@ -250,13 +250,13 @@ 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 = devfdt_get_addr_index_ptr(dev, 0);
 	if (!pcie->dbi)
-		return -ENOMEM;
+		return -EINVAL;

-	pcie->ctrl = (void __iomem *)devfdt_get_addr_index(dev, 1);
+	pcie->ctrl = devfdt_get_addr_index_ptr(dev, 1);
 	if (!pcie->ctrl)
-		return -ENOMEM;
+		return -EINVAL;

 	ret = fdt_get_named_resource(gd->fdt_blob, dev_of_offset(dev),
 				     "reg", "reg-names",
diff --git a/drivers/phy/marvell/comphy_core.c b/drivers/phy/marvell/comphy_core.c
index df2460db..7272dfb9 100644
--- a/drivers/phy/marvell/comphy_core.c
+++ b/drivers/phy/marvell/comphy_core.c
@@ -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;
diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 6a52676a..92e80506 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -383,7 +383,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);
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index 91042935..3be3f93d 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 21/24] drivers: use devfdt_get_addr_ptr when cast to pointer
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (19 preceding siblings ...)
  2023-03-13  0:32 ` [PATCH v8 20/24] drivers: use devfdt_get_addr_index_ptr " Johan Jonker
@ 2023-03-13  0:32 ` Johan Jonker
  2023-03-13  0:32 ` [PATCH v8 22/24] drivers: fix debug string with fdt_addr_t input Johan Jonker
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:32 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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_ptr instead of the devfdt_get_addr function in
the various files in the drivers directory that cast to a pointer.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changed V6:
  drop cast
  skip livetree.rst

Changed V5:
  new patch
---
 drivers/clk/at91/sama7g5.c | 2 +-
 drivers/clk/at91/sckc.c    | 2 +-
 drivers/spi/mtk_snor.c     | 2 +-
 drivers/spi/mtk_spim.c     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/at91/sama7g5.c b/drivers/clk/at91/sama7g5.c
index d1ec3c82..7a5a2906 100644
--- a/drivers/clk/at91/sama7g5.c
+++ b/drivers/clk/at91/sama7g5.c
@@ -1114,7 +1114,7 @@ static const struct pmc_clk_setup {

 static int sama7g5_clk_probe(struct udevice *dev)
 {
-	void __iomem *base = (void *)devfdt_get_addr(dev);
+	void __iomem *base = devfdt_get_addr_ptr(dev);
 	unsigned int *clkmuxallocs[SAMA7G5_MAX_MUX_ALLOCS];
 	unsigned int *muxallocs[SAMA7G5_MAX_MUX_ALLOCS];
 	const char *p[10];
diff --git a/drivers/clk/at91/sckc.c b/drivers/clk/at91/sckc.c
index 34ce611a..43136ab2 100644
--- a/drivers/clk/at91/sckc.c
+++ b/drivers/clk/at91/sckc.c
@@ -123,7 +123,7 @@ U_BOOT_DRIVER(at91_sam9x60_td_slck) = {
 static int at91_sam9x60_sckc_probe(struct udevice *dev)
 {
 	struct sam9x60_sckc *sckc = dev_get_priv(dev);
-	void __iomem *base = (void *)devfdt_get_addr(dev);
+	void __iomem *base = devfdt_get_addr_ptr(dev);
 	const char *slow_rc_osc, *slow_osc;
 	const char *parents[2];
 	struct clk *clk, c;
diff --git a/drivers/spi/mtk_snor.c b/drivers/spi/mtk_snor.c
index 04f588a7..4b7d4a6e 100644
--- a/drivers/spi/mtk_snor.c
+++ b/drivers/spi/mtk_snor.c
@@ -470,7 +470,7 @@ static int mtk_snor_probe(struct udevice *bus)
 	int ret;
 	u32 reg;

-	priv->base = (void __iomem *)devfdt_get_addr(bus);
+	priv->base = devfdt_get_addr_ptr(bus);
 	if (!priv->base)
 		return -EINVAL;

diff --git a/drivers/spi/mtk_spim.c b/drivers/spi/mtk_spim.c
index a7c0fc59..ebb8ee8e 100644
--- a/drivers/spi/mtk_spim.c
+++ b/drivers/spi/mtk_spim.c
@@ -641,7 +641,7 @@ static int mtk_spim_probe(struct udevice *dev)
 	struct mtk_spim_priv *priv = dev_get_priv(dev);
 	int ret;

-	priv->base = (void __iomem *)devfdt_get_addr(dev);
+	priv->base = devfdt_get_addr_ptr(dev);
 	if (!priv->base)
 		return -EINVAL;

--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 22/24] drivers: fix debug string with fdt_addr_t input
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (20 preceding siblings ...)
  2023-03-13  0:32 ` [PATCH v8 21/24] drivers: use devfdt_get_addr_ptr " Johan Jonker
@ 2023-03-13  0:32 ` Johan Jonker
  2023-03-13  0:33 ` [PATCH v8 23/24] arm: stm32mp: spl: fix function " Johan Jonker
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:32 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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 fix some
debug strings with fdt_addr_t to be able to handle both sizes.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changed V5:
  new patch
---
 arch/arm/mach-mvebu/cpu.c       | 2 +-
 drivers/clk/ti/clk-ctrl.c       | 9 +++++----
 drivers/phy/phy-stm32-usbphyc.c | 4 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index 329d1369..f58689e1 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -631,7 +631,7 @@ int board_xhci_enable(fdt_addr_t base)
 {
 	const struct mbus_dram_target_info *dram;

-	printf("MVEBU XHCI INIT controller @ 0x%lx\n", base);
+	printf("MVEBU XHCI INIT controller @ 0x%llx\n", (fdt64_t)base);

 	dram = mvebu_mbus_dram_info();
 	xhci_mvebu_mbus_config((void __iomem *)base, dram);
diff --git a/drivers/clk/ti/clk-ctrl.c b/drivers/clk/ti/clk-ctrl.c
index 6cc02d2e..8926e57e 100644
--- a/drivers/clk/ti/clk-ctrl.c
+++ b/drivers/clk/ti/clk-ctrl.c
@@ -44,7 +44,7 @@ static int clk_ti_ctrl_disable(struct clk *clk)
 	offs = priv->offs[0].start + clk->id;
 	err = clk_ti_ctrl_check_offs(clk, offs);
 	if (err) {
-		dev_err(clk->dev, "invalid offset: 0x%lx\n", offs);
+		dev_err(clk->dev, "invalid offset: 0x%llx\n", (fdt64_t)offs);
 		return err;
 	}

@@ -64,7 +64,7 @@ static int clk_ti_ctrl_enable(struct clk *clk)
 	offs = priv->offs[0].start + clk->id;
 	err = clk_ti_ctrl_check_offs(clk, offs);
 	if (err) {
-		dev_err(clk->dev, "invalid offset: 0x%lx\n", offs);
+		dev_err(clk->dev, "invalid offset: 0x%llx\n", (fdt64_t)offs);
 		return err;
 	}

@@ -125,8 +125,9 @@ static int clk_ti_ctrl_of_to_plat(struct udevice *dev)
 		}

 		priv->offs[i].end = priv->offs[i].start + fdt_size;
-		dev_dbg(dev, "start=0x%08lx, end=0x%08lx\n",
-			priv->offs[i].start, priv->offs[i].end);
+		dev_dbg(dev, "start=0x%016llx, end=0x%016llx\n",
+			(fdt64_t)priv->offs[i].start,
+			(fdt64_t)priv->offs[i].end);
 	}

 	return 0;
diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
index dcf2194e..15bd60ca 100644
--- a/drivers/phy/phy-stm32-usbphyc.c
+++ b/drivers/phy/phy-stm32-usbphyc.c
@@ -583,8 +583,8 @@ static int stm32_usbphyc_probe(struct udevice *dev)

 		phy_id = ofnode_read_u32_default(node, "reg", FDT_ADDR_T_NONE);
 		if (phy_id >= MAX_PHYS) {
-			dev_err(dev, "invalid reg value %lx for %s\n",
-				phy_id, ofnode_get_name(node));
+			dev_err(dev, "invalid reg value %llx for %s\n",
+				(fdt64_t)phy_id, ofnode_get_name(node));
 			return -ENOENT;
 		}

--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 23/24] arm: stm32mp: spl: fix function with fdt_addr_t input
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (21 preceding siblings ...)
  2023-03-13  0:32 ` [PATCH v8 22/24] drivers: fix debug string with fdt_addr_t input Johan Jonker
@ 2023-03-13  0:33 ` Johan Jonker
  2023-03-13  0:33 ` [PATCH v8 24/24] include: fdtdec: decouple fdt_addr_t and phys_addr_t size Johan Jonker
  2023-04-21  3:15 ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Kever Yang
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:33 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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 fix ofnode_get_addr_size function with fdt_addr_t input to
be able to handle both sizes for stm32mp SoC in spl.c file.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changed V7:
  remove cast
---
 arch/arm/mach-stm32mp/spl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c
index 19d9fe04..6c79259b 100644
--- a/arch/arm/mach-stm32mp/spl.c
+++ b/arch/arm/mach-stm32mp/spl.c
@@ -112,7 +112,7 @@ uint32_t stm32mp_get_dram_size(void)

 static int optee_get_reserved_memory(uint32_t *start, uint32_t *size)
 {
-	phys_size_t fdt_mem_size;
+	fdt_addr_t fdt_mem_size;
 	fdt_addr_t fdt_start;
 	ofnode node;

--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* [PATCH v8 24/24] include: fdtdec: decouple fdt_addr_t and phys_addr_t size
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (22 preceding siblings ...)
  2023-03-13  0:33 ` [PATCH v8 23/24] arm: stm32mp: spl: fix function " Johan Jonker
@ 2023-03-13  0:33 ` Johan Jonker
  2023-04-21  3:15 ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Kever Yang
  24 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13  0:33 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

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.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
---

Note:
  Due to the large number of references to fdt_addr_t
  this patch serie fixes only some bugs, but not all.
  Apply only when all remaining errors and warnings
  due to this patch are fixed.
  Help with testing/debug appreciated.
---
 Kconfig          |  8 ++++++++
 include/fdtdec.h | 13 +++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Kconfig b/Kconfig
index a75cce7e..7697dade 100644
--- a/Kconfig
+++ b/Kconfig
@@ -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
diff --git a/include/fdtdec.h b/include/fdtdec.h
index aa61a0fc..6b768ed5 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 17/24] drivers: use dev_read_addr_index_ptr when cast to pointer
  2023-03-13  0:31 ` [PATCH v8 17/24] drivers: use dev_read_addr_index_ptr when cast to pointer Johan Jonker
@ 2023-03-13  3:10   ` Simon Glass
  0 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2023-03-13  3:10 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao

On Sun, 12 Mar 2023 at 18:31, Johan Jonker <jbx6244@gmail.com> wrote:
>
> 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_index_ptr instead of the dev_read_addr_index function
> in the various files in the drivers directory that cast to a pointer.
> As we are there also streamline the error response to -EINVAL on return.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
>
> Changed V6:
>   use -EINVAL on return
>   drop cast
> ---
>  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         |  8 ++++----
>  drivers/pci/pcie_dw_rockchip.c      |  8 ++++----
>  drivers/watchdog/sbsa_gwdt.c        | 12 ++++++------
>  6 files changed, 19 insertions(+), 19 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
  2023-03-13  0:30 ` [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap Johan Jonker
@ 2023-03-13  3:10   ` Simon Glass
  2023-03-13 12:15     ` Johan Jonker
  2023-03-13 13:26   ` John Keeping
  1 sibling, 1 reply; 52+ messages in thread
From: Simon Glass @ 2023-03-13  3:10 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao

On Sun, 12 Mar 2023 at 18:31, Johan Jonker <jbx6244@gmail.com> wrote:
>
> The Rockchip SoC rk3288 has 2 types of device trees floating around.
> A 64bit reg size when synced from Linux and a 32bit for U-boot.
> A pre-probe function in the syscon class driver assumes only 32bit.
> For other odd reg structures the regmap must be defined in the individual
> syscon driver. Store rk3288 platdata in a regmap before pre-probe
> during bind.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>
> Note:
>   Proof of concept not tested with rk3288 hardware,
>   but with rk3066.
>
> Changed V7:
>   new patch
> ---
>  arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 121 ++++++++++++++++++
>  1 file changed, 121 insertions(+)
>

I tested this on chromebook_jerry which uses SPL_OF_PLATDATA

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>

Can we sync up with Linux on the DT?

Regards,
Simon

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 12/24] core: remap: fix regmap_init_mem_plat() reg size handeling
  2023-03-13  0:30 ` [PATCH v8 12/24] core: remap: fix regmap_init_mem_plat() reg size handeling Johan Jonker
@ 2023-03-13  3:10   ` Simon Glass
  0 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2023-03-13  3:10 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao

On Sun, 12 Mar 2023 at 18:30, Johan Jonker <jbx6244@gmail.com> wrote:
>
> 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 regmap_init_mem_plat() input to handel both. The
> syscon class driver also makes use of the regmap_init_mem_plat()
> function, but has no way of knowing the format of the
> device-specific platform data. In case of odd reg structures other
> then that the syscon class driver assumes the regmap must be
> filled in the individual syscon driver before pre-probe.
> Also fix the ARRAY_SIZE divider in the syscon class driver.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>
> Changed V8:
>   fix comment
>
> Changed V7:
>   changed title
>   add reg size input
>   rework function calls
> ---
>  drivers/core/regmap.c               | 23 +++++++++++++++++++----
>  drivers/core/syscon-uclass.c        | 23 ++++++++++++++++++-----
>  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                    |  5 +++--
>  include/syscon.h                    | 13 -------------
>  10 files changed, 46 insertions(+), 30 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 10/24] rockchip: spi: rk_spi: use base variable with uintptr_t size
  2023-03-13  0:30 ` [PATCH v8 10/24] rockchip: spi: rk_spi: " Johan Jonker
@ 2023-03-13  3:10   ` Simon Glass
  0 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2023-03-13  3:10 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao

On Sun, 12 Mar 2023 at 18:30, Johan Jonker <jbx6244@gmail.com> wrote:
>
> 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 a base variable with uintptr_t size in the
> rk_spi.c file.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>
> Changed V8:
>   new patch
> ---
>  drivers/spi/rk_spi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 09/24] rockchip: pwm: rk_pwm: use base variable with uintptr_t size
  2023-03-13  0:30 ` [PATCH v8 09/24] rockchip: pwm: rk_pwm: use base " Johan Jonker
@ 2023-03-13  3:10   ` Simon Glass
  0 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2023-03-13  3:10 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao

On Sun, 12 Mar 2023 at 18:30, Johan Jonker <jbx6244@gmail.com> wrote:
>
> 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 a base variable with uintptr_t size in the
> rk_pwm.c file.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>
> Changed V8:
>   use uintptr_t instead of phys_addr_t
>
> Changed V6:
>   new patch
> ---
>  drivers/pwm/rk_pwm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 08/24] rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size
  2023-03-13  0:29 ` [PATCH v8 08/24] rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size Johan Jonker
@ 2023-03-13  3:10   ` Simon Glass
  0 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2023-03-13  3:10 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao

On Sun, 12 Mar 2023 at 18:29, Johan Jonker <jbx6244@gmail.com> wrote:
>
> 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 a regs variable with uintptr_t size in the
> dw-apb-timer.c file.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>
> Changed V8:
>   use uintptr_t instead of phys_addr_t
>
> Changed V6:
>   remove cast
>   change title
> ---
>  drivers/timer/dw-apb-timer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
  2023-03-13  3:10   ` Simon Glass
@ 2023-03-13 12:15     ` Johan Jonker
  0 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-03-13 12:15 UTC (permalink / raw)
  To: Simon Glass
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao



On 3/13/23 04:10, Simon Glass wrote:
> On Sun, 12 Mar 2023 at 18:31, Johan Jonker <jbx6244@gmail.com> wrote:
>>
>> The Rockchip SoC rk3288 has 2 types of device trees floating around.
>> A 64bit reg size when synced from Linux and a 32bit for U-boot.
>> A pre-probe function in the syscon class driver assumes only 32bit.
>> For other odd reg structures the regmap must be defined in the individual
>> syscon driver. Store rk3288 platdata in a regmap before pre-probe
>> during bind.
>>
>> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
>> ---
>>
>> Note:
>>   Proof of concept not tested with rk3288 hardware,
>>   but with rk3066.
>>
>> Changed V7:
>>   new patch
>> ---
>>  arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 121 ++++++++++++++++++
>>  1 file changed, 121 insertions(+)
>>
> 
> I tested this on chromebook_jerry which uses SPL_OF_PLATDATA
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested-by: Simon Glass <sjg@chromium.org>
> 

> Can we sync up with Linux on the DT?

Not right away.
Given that this serie has version 8 and 24 patches.
We start a new rk3288 sync serie for that. ;)

Also must work on serie: Fixes for Rockchip NFC driver part 2

Johan
===
1: Some boards with only SPL don't seem to fit with 64bit and should convert to TPL/SPL.

       arm:  +   popmetal-rk3288            
+binman: Error 1 running 'mkimage -d ./mkimage.simple-bin.mkimage -n rk3288 -T rksd ./idbloader.img': Error: SPL image is too large (size 0x8800 than 0x8000)

       arm:  +   phycore-rk3288                          
+binman: Error 1 running 'mkimage -d ./mkimage.simple-bin.mkimage -n rk3288 -T rksd ./idbloader.img': Error: SPL image is too large (size 0x8800 than 0x8000)

===
2: extra move/split of some nodes:
rk3288.dtsi

usbphy
power-controller
io-domains

rk3288-u-boot.dtsi

fix reg size
gpio node order

===
3: VOP/MIPI/LVDS/HDMI (TODO for Simon Glass)

The Linux nodes have different/more clocks and edp has phy nodes.
Some compatibles changes dp/edp/cdn-dp must be fixed for strstr() function.

-		compatible = "rockchip,rk3288-edp";
+		compatible = "rockchip,rk3288-dp";

	if (strstr(compat, "edp")) {
		vop_id = VOP_MODE_EDP;
	} else if (strstr(compat, "mipi")) {
		vop_id = VOP_MODE_MIPI;
	} else if (strstr(compat, "hdmi")) {
		vop_id = VOP_MODE_HDMI;
	} else if (strstr(compat, "cdn-dp")) {
		vop_id = VOP_MODE_DP;
	} else if (strstr(compat, "lvds")) {
		vop_id = VOP_MODE_LVDS;
	} else {
		debug("%s(%s): Failed to find vop mode for %s\n",
		      __func__, dev_read_name(dev), compat);
		return -EINVAL;
	}
===

4: Check if drivers still work after sync.(TODO for Simon Glass)

This has to be done with someone that has rk3288 hardware.

 	vopb: vop@ff930000 {
 		compatible = "rockchip,rk3288-vop";
-		reg = <0xff930000 0x19c>;
+		reg = <0x0 0xff930000 0x0 0x19c>, <0x0 0xff931000 0x0 0x1000>;
 		interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&cru ACLK_VOP0>, <&cru DCLK_VOP0>, <&cru HCLK_VOP0>;
 		clock-names = "aclk_vop", "dclk_vop", "hclk_vop";
@@ -862,31 +1032,31 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 
-			vopb_out_edp: endpoint@0 {
+			vopb_out_hdmi: endpoint@0 {
 				reg = <0>;
-				remote-endpoint = <&edp_in_vopb>;
+				remote-endpoint = <&hdmi_in_vopb>;
 			};
 
-			vopb_out_hdmi: endpoint@1 {
+			vopb_out_edp: endpoint@1 {
 				reg = <1>;
-				remote-endpoint = <&hdmi_in_vopb>;
+				remote-endpoint = <&edp_in_vopb>;
 			};
 
-			vopb_out_lvds: endpoint@2 {
+			vopb_out_mipi: endpoint@2 {
 				reg = <2>;
-				remote-endpoint = <&lvds_in_vopb>;
+				remote-endpoint = <&mipi_in_vopb>;
 			};
 
-			vopb_out_mipi: endpoint@3 {
+			vopb_out_lvds: endpoint@3 {
 				reg = <3>;
-				remote-endpoint = <&mipi_in_vopb>;
+				remote-endpoint = <&lvds_in_vopb>;
 			};
 		};
 	};
 
 	vopb_mmu: iommu@ff930300 {
 		compatible = "rockchip,iommu";
-		reg = <0xff930300 0x100>;
+		reg = <0x0 0xff930300 0x0 0x100>;
 		interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&cru ACLK_VOP0>, <&cru HCLK_VOP0>;
 		clock-names = "aclk", "iface";
@@ -897,7 +1067,7 @@
 
 	vopl: vop@ff940000 {
 		compatible = "rockchip,rk3288-vop";
-		reg = <0xff940000 0x19c>;
+		reg = <0x0 0xff940000 0x0 0x19c>, <0x0 0xff941000 0x0 0x1000>;
 		interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&cru ACLK_VOP1>, <&cru DCLK_VOP1>, <&cru HCLK_VOP1>;
 		clock-names = "aclk_vop", "dclk_vop", "hclk_vop";
@@ -911,31 +1081,31 @@
 			#address-cells = <1>;
 			#size-cells = <0>;
 
-			vopl_out_edp: endpoint@0 {
+			vopl_out_hdmi: endpoint@0 {
 				reg = <0>;
-				remote-endpoint = <&edp_in_vopl>;
+				remote-endpoint = <&hdmi_in_vopl>;
 			};
 
-			vopl_out_hdmi: endpoint@1 {
+			vopl_out_edp: endpoint@1 {
 				reg = <1>;
-				remote-endpoint = <&hdmi_in_vopl>;
+				remote-endpoint = <&edp_in_vopl>;
 			};
 
-			vopl_out_lvds: endpoint@2 {
+			vopl_out_mipi: endpoint@2 {
 				reg = <2>;
-				remote-endpoint = <&lvds_in_vopl>;
+				remote-endpoint = <&mipi_in_vopl>;
 			};
 
-			vopl_out_mipi: endpoint@3 {
+			vopl_out_lvds: endpoint@3 {
 				reg = <3>;
-				remote-endpoint = <&mipi_in_vopl>;
+				remote-endpoint = <&lvds_in_vopl>;
 			};
 		};
 	};
 
 	vopl_mmu: iommu@ff940300 {
 		compatible = "rockchip,iommu";
-		reg = <0xff940300 0x100>;
+		reg = <0x0 0xff940300 0x0 0x100>;
 		interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&cru ACLK_VOP1>, <&cru HCLK_VOP1>;
 		clock-names = "aclk", "iface";
@@ -945,11 +1115,11 @@
 	};
 
 	mipi_dsi: mipi@ff960000 {
-		compatible = "rockchip,rk3288_mipi_dsi";
-		reg = <0xff960000 0x4000>;
+		compatible = "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi";
+		reg = <0x0 0xff960000 0x0 0x4000>;
 		interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&cru PCLK_MIPI_DSI0>;
-		clock-names = "pclk_mipi";
+		clocks = <&cru SCLK_MIPIDSI_24M>, <&cru PCLK_MIPI_DSI0>;
+		clock-names = "ref", "pclk";
 		power-domains = <&power RK3288_PD_VIO>;
 		rockchip,grf = <&grf>;
 		status = "disabled";
@@ -972,10 +1142,10 @@
 
 	lvds: lvds@ff96c000 {
 		compatible = "rockchip,rk3288-lvds";
-		reg = <0xff96c000 0x4000>;
+		reg = <0x0 0xff96c000 0x0 0x4000>;
 		clocks = <&cru PCLK_LVDS_PHY>;
 		clock-names = "pclk_lvds";
-		pinctrl-names = "default";
+		pinctrl-names = "lcdc";
 		pinctrl-0 = <&lcdc_ctl>;
 		power-domains = <&power RK3288_PD_VIO>;
 		rockchip,grf = <&grf>;
@@ -1004,19 +1174,24 @@
 	};
 
 	edp: dp@ff970000 {
-		compatible = "rockchip,rk3288-edp";
-		reg = <0xff970000 0x4000>;
+		compatible = "rockchip,rk3288-dp";
+		reg = <0x0 0xff970000 0x0 0x4000>;
 		interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&cru SCLK_EDP>, <&cru SCLK_EDP_24M>, <&cru PCLK_EDP_CTRL>;
-		clock-names = "clk_edp", "clk_edp_24m", "pclk_edp";
+		clocks = <&cru SCLK_EDP>, <&cru PCLK_EDP_CTRL>;
+		clock-names = "dp", "pclk";
+		phys = <&edp_phy>;
+		phy-names = "dp";
+		power-domains = <&power RK3288_PD_VIO>;
 		resets = <&cru SRST_EDP>;
-		reset-names = "edp";
+		reset-names = "dp";
 		rockchip,grf = <&grf>;
-		power-domains = <&power RK3288_PD_VIO>;
 		status = "disabled";
 
 		ports {
-			edp_in: port {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			edp_in: port@0 {
+				reg = <0>;
 				#address-cells = <1>;
 				#size-cells = <0>;
 				edp_in_vopb: endpoint@0 {
@@ -1033,13 +1208,13 @@
 
 	hdmi: hdmi@ff980000 {
 		compatible = "rockchip,rk3288-dw-hdmi";
-		reg = <0xff980000 0x20000>;
+		reg = <0x0 0xff980000 0x0 0x20000>;
 		reg-io-width = <4>;
 		#sound-dai-cells = <0>;
 		rockchip,grf = <&grf>;
 		interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
-		clocks = <&cru  PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>;
-		clock-names = "iahb", "isfr";
+		clocks = <&cru  PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>, <&cru SCLK_HDMI_CEC>;
+		clock-names = "iahb", "isfr", "cec";
 		power-domains = <&power RK3288_PD_VIO>;
 		status = "disabled";
===

5: Update all defconfigs for rk3288.


> 
> Regards,
> Simon

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
  2023-03-13  0:30 ` [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap Johan Jonker
  2023-03-13  3:10   ` Simon Glass
@ 2023-03-13 13:26   ` John Keeping
  2023-03-13 16:53     ` Johan Jonker
  1 sibling, 1 reply; 52+ messages in thread
From: John Keeping @ 2023-03-13 13:26 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang,
	u-boot, yifeng.zhao

On Mon, Mar 13, 2023 at 01:30:57AM +0100, Johan Jonker wrote:
> The Rockchip SoC rk3288 has 2 types of device trees floating around.
> A 64bit reg size when synced from Linux and a 32bit for U-boot.
> A pre-probe function in the syscon class driver assumes only 32bit.
> For other odd reg structures the regmap must be defined in the individual
> syscon driver. Store rk3288 platdata in a regmap before pre-probe
> during bind.
> 
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---

What is special about the rk3288 syscon that means the driver needs this
handling?  Isn't this a general problem for DTs with 64-bit addresses on
32-bit systems that could be solved in syscon-uclass.c?

I suspect it's difficult to handle the general case since #memory-cells
may be difference for difference syscons so a global constant doesn't
work, but the approach in this patch seems incredibly verbose for
something that is likely to be needed for many platforms.

Could we use driver flags with something like:

	.flags = of_platdata_reg_size(struct rockchip_rk3288_noc_plat),

and this untested macro:

	#define of_platdata_reg_size(s) \
		((sizeof(((struct rockchip_rk3288_noc_plat *) 0)->reg) == 64) ? \
			DM_FLAGS_PLATDATA_REG_64BIT : 0)

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
  2023-03-13 13:26   ` John Keeping
@ 2023-03-13 16:53     ` Johan Jonker
  2023-03-13 17:46       ` John Keeping
  0 siblings, 1 reply; 52+ messages in thread
From: Johan Jonker @ 2023-03-13 16:53 UTC (permalink / raw)
  To: John Keeping
  Cc: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang,
	u-boot, yifeng.zhao



On 3/13/23 14:26, John Keeping wrote:
> On Mon, Mar 13, 2023 at 01:30:57AM +0100, Johan Jonker wrote:
>> The Rockchip SoC rk3288 has 2 types of device trees floating around.
>> A 64bit reg size when synced from Linux and a 32bit for U-boot.
>> A pre-probe function in the syscon class driver assumes only 32bit.
>> For other odd reg structures the regmap must be defined in the individual
>> syscon driver. Store rk3288 platdata in a regmap before pre-probe
>> during bind.
>>
>> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
>> ---
> 
> What is special about the rk3288 syscon that means the driver needs this
> handling?  Isn't this a general problem for DTs with 64-bit addresses on
> 32-bit systems that could be solved in syscon-uclass.c?

The dtd structure is only know to the driver with the SoC orientated compatible string.
I see guessing the "reg" size more as a legacy that we keep using for existing drivers
and should be deprecated.

> 
> I suspect it's difficult to handle the general case since #memory-cells
> may be difference for difference syscons so a global constant doesn't
> work, but the approach in this patch seems incredibly verbose for

You are right here, but other then rk3288 I don't see that happen for other 32bit Rockchip SoCs.
It's more verbose, because struct syscon_uc_info is not there yet in the bind fase. (ie. calloc)

> something that is likely to be needed for many platforms.
> 

> Could we use driver flags with something like:
> 
> 	.flags = of_platdata_reg_size(struct rockchip_rk3288_noc_plat),

Driver flags might solve only the "reg" size part, but not the ARRAY_SIZE and the unknown "reg" property location part.

> 
> and this untested macro:
> 
> 	#define of_platdata_reg_size(s) \
> 		((sizeof(((struct rockchip_rk3288_noc_plat *) 0)->reg) == 64) ? \
> 			DM_FLAGS_PLATDATA_REG_64BIT : 0)

This would create a parallel data flow of a "size flag and ARRAY_SIZE variable + data" in
a structure to the syscon class driver that also must be stored somewhere,
while we could do the thing correct in the regmap structure right away.

Johan

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
  2023-03-13 16:53     ` Johan Jonker
@ 2023-03-13 17:46       ` John Keeping
  2023-03-13 21:09         ` Johan Jonker
  0 siblings, 1 reply; 52+ messages in thread
From: John Keeping @ 2023-03-13 17:46 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang,
	u-boot, yifeng.zhao

On Mon, Mar 13, 2023 at 05:53:20PM +0100, Johan Jonker wrote:
> On 3/13/23 14:26, John Keeping wrote:
> > On Mon, Mar 13, 2023 at 01:30:57AM +0100, Johan Jonker wrote:
> >> The Rockchip SoC rk3288 has 2 types of device trees floating around.
> >> A 64bit reg size when synced from Linux and a 32bit for U-boot.
> >> A pre-probe function in the syscon class driver assumes only 32bit.
> >> For other odd reg structures the regmap must be defined in the individual
> >> syscon driver. Store rk3288 platdata in a regmap before pre-probe
> >> during bind.
> >>
> >> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> >> ---
> > 
> > What is special about the rk3288 syscon that means the driver needs this
> > handling?  Isn't this a general problem for DTs with 64-bit addresses on
> > 32-bit systems that could be solved in syscon-uclass.c?
> 
> The dtd structure is only know to the driver with the SoC orientated compatible string.
> I see guessing the "reg" size more as a legacy that we keep using for existing drivers
> and should be deprecated.
> 
> > 
> > I suspect it's difficult to handle the general case since #memory-cells
> > may be difference for difference syscons so a global constant doesn't
> > work, but the approach in this patch seems incredibly verbose for
> 
> You are right here, but other then rk3288 I don't see that happen for other 32bit Rockchip SoCs.
> It's more verbose, because struct syscon_uc_info is not there yet in the bind fase. (ie. calloc)

What about non-Rockchip SoCs using the syscon uclass?

> > something that is likely to be needed for many platforms.
> > 
> 
> > Could we use driver flags with something like:
> > 
> > 	.flags = of_platdata_reg_size(struct rockchip_rk3288_noc_plat),
> 
> Driver flags might solve only the "reg" size part, but not the
> ARRAY_SIZE and the unknown "reg" property location part.

Right - but the generic syscon-uclass code assumes a single range and
that reg is the first property (at least I think it should be assuming a
single range, but it looks like there might be a bug there now).

> > and this untested macro:
> > 
> > 	#define of_platdata_reg_size(s) \
> > 		((sizeof(((struct rockchip_rk3288_noc_plat *) 0)->reg) == 64) ? \
> > 			DM_FLAGS_PLATDATA_REG_64BIT : 0)
> 
> This would create a parallel data flow of a "size flag and ARRAY_SIZE variable + data" in
> a structure to the syscon class driver that also must be stored somewhere,
> while we could do the thing correct in the regmap structure right away.

But the syscon uclass doesn't need any of that extra info - for
OF_PLATDATA is makes assumptions and I don't see why that needs to be
any different for 32-bit platforms with #memory-cells = <2>.  From
syscon-uclass.c:

	/*
	 * With OF_PLATDATA we really have no way of knowing the format of
	 * the device-specific platform data. So we assume that it starts with
	 * a 'reg' member, and this holds a single address and size. Drivers
	 * using OF_PLATDATA will need to ensure that this is true.
	 */

In fact, for RK3288 we can just do:

	static_assert(sizeof(fdt_val_t) == FIELD_SIZEOF(struct dtd_rockchip_rk3288_grf, reg[0]));

and the uclass gets this right.

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
  2023-03-13 17:46       ` John Keeping
@ 2023-03-13 21:09         ` Johan Jonker
  2023-03-14 18:28           ` John Keeping
  0 siblings, 1 reply; 52+ messages in thread
From: Johan Jonker @ 2023-03-13 21:09 UTC (permalink / raw)
  To: John Keeping
  Cc: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang,
	u-boot, yifeng.zhao



On 3/13/23 18:46, John Keeping wrote:
> On Mon, Mar 13, 2023 at 05:53:20PM +0100, Johan Jonker wrote:
>> On 3/13/23 14:26, John Keeping wrote:
>>> On Mon, Mar 13, 2023 at 01:30:57AM +0100, Johan Jonker wrote:
>>>> The Rockchip SoC rk3288 has 2 types of device trees floating around.
>>>> A 64bit reg size when synced from Linux and a 32bit for U-boot.
>>>> A pre-probe function in the syscon class driver assumes only 32bit.
>>>> For other odd reg structures the regmap must be defined in the individual
>>>> syscon driver. Store rk3288 platdata in a regmap before pre-probe
>>>> during bind.
>>>>
>>>> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
>>>> ---
>>>
>>> What is special about the rk3288 syscon that means the driver needs this
>>> handling?  Isn't this a general problem for DTs with 64-bit addresses on
>>> 32-bit systems that could be solved in syscon-uclass.c?
>>
>> The dtd structure is only know to the driver with the SoC orientated compatible string.
>> I see guessing the "reg" size more as a legacy that we keep using for existing drivers
>> and should be deprecated.
>>
>>>
>>> I suspect it's difficult to handle the general case since #memory-cells
>>> may be difference for difference syscons so a global constant doesn't
>>> work, but the approach in this patch seems incredibly verbose for
>>
>> You are right here, but other then rk3288 I don't see that happen for other 32bit Rockchip SoCs.

>> It's more verbose, because struct syscon_uc_info is not there yet in the bind phase. (ie. calloc)

Currently syscon_uc_info is allocated/set after bind on in the probe phase.

device_probe()->device_of_to_plat()->device_alloc_priv()->dev_set_uclass_priv()

Not aware how to hookup to "struct uclass_driver",so no other option to do that then here.

> 
> What about non-Rockchip SoCs using the syscon uclass?
> 
>>> something that is likely to be needed for many platforms.
>>>
>>
>>> Could we use driver flags with something like:
>>>
>>> 	.flags = of_platdata_reg_size(struct rockchip_rk3288_noc_plat),
>>
>> Driver flags might solve only the "reg" size part, but not the
>> ARRAY_SIZE and the unknown "reg" property location part.
> 

> Right - but the generic syscon-uclass code assumes a single range and
> that reg is the first property (at least I think it should be assuming a
> single range, but it looks like there might be a bug there now).

I'm not aware that syscon nodes can have multiple reg ranges, but don't assume that in the future there won't be a binding that does.

> 
>>> and this untested macro:
>>>
>>> 	#define of_platdata_reg_size(s) \
>>> 		((sizeof(((struct rockchip_rk3288_noc_plat *) 0)->reg) == 64) ? \
>>> 			DM_FLAGS_PLATDATA_REG_64BIT : 0)
>>
>> This would create a parallel data flow of a "size flag and ARRAY_SIZE variable + data" in
>> a structure to the syscon class driver that also must be stored somewhere,
>> while we could do the thing correct in the regmap structure right away.
> 
> But the syscon uclass doesn't need any of that extra info - for
> OF_PLATDATA is makes assumptions and I don't see why that needs to be
> any different for 32-bit platforms with #memory-cells = <2>.  From
> syscon-uclass.c:
> 
> 	/*
> 	 * With OF_PLATDATA we really have no way of knowing the format of
> 	 * the device-specific platform data. So we assume that it starts with
> 	 * a 'reg' member, and this holds a single address and size. Drivers
> 	 * using OF_PLATDATA will need to ensure that this is true.
> 	 */
> 
> In fact, for RK3288 we can just do:
> 

> 	static_assert(sizeof(fdt_val_t) == FIELD_SIZEOF(struct dtd_rockchip_rk3288_grf, reg[0]));

fdt_val_t describes the parser capability and is not the same as the size in the dtd structure.

> 
> and the uclass gets this right.

There's no guaranty that the dtd structure is going to be like syscon_base_plat and that the reg property is first.

struct syscon_base_plat {
	phys_addr_t reg[2];
};

From syscon.yaml and other bindings we learn that there can be other properties then "reg" in syscon nodes.
Properties pop-up where ever they like in the dtd structure after combining various dtsi and dts files.

struct dtd_rockchip_rk3066_grf {
	bool		dummy_property;
	fdt64_t		reg[2];
};

Only passing a size flag is not enough.



^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
  2023-03-13 21:09         ` Johan Jonker
@ 2023-03-14 18:28           ` John Keeping
  0 siblings, 0 replies; 52+ messages in thread
From: John Keeping @ 2023-03-14 18:28 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang,
	u-boot, yifeng.zhao

On Mon, Mar 13, 2023 at 10:09:23PM +0100, Johan Jonker wrote:
> On 3/13/23 18:46, John Keeping wrote:
> > On Mon, Mar 13, 2023 at 05:53:20PM +0100, Johan Jonker wrote:
> >> On 3/13/23 14:26, John Keeping wrote:
> >>> On Mon, Mar 13, 2023 at 01:30:57AM +0100, Johan Jonker wrote:
> >>>> The Rockchip SoC rk3288 has 2 types of device trees floating around.
> >>>> A 64bit reg size when synced from Linux and a 32bit for U-boot.
> >>>> A pre-probe function in the syscon class driver assumes only 32bit.
> >>>> For other odd reg structures the regmap must be defined in the individual
> >>>> syscon driver. Store rk3288 platdata in a regmap before pre-probe
> >>>> during bind.
> >>>>
> >>>> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> >>>> ---
> >>>
> >>> What is special about the rk3288 syscon that means the driver needs this
> >>> handling?  Isn't this a general problem for DTs with 64-bit addresses on
> >>> 32-bit systems that could be solved in syscon-uclass.c?
> >>
> >> The dtd structure is only know to the driver with the SoC orientated compatible string.
> >> I see guessing the "reg" size more as a legacy that we keep using for existing drivers
> >> and should be deprecated.
> >>
> >>>
> >>> I suspect it's difficult to handle the general case since #memory-cells
> >>> may be difference for difference syscons so a global constant doesn't
> >>> work, but the approach in this patch seems incredibly verbose for
> >>
> >> You are right here, but other then rk3288 I don't see that happen for other 32bit Rockchip SoCs.
> 
> >> It's more verbose, because struct syscon_uc_info is not there yet in the bind phase. (ie. calloc)
> 
> Currently syscon_uc_info is allocated/set after bind on in the probe phase.
> 
> device_probe()->device_of_to_plat()->device_alloc_priv()->dev_set_uclass_priv()
> 
> Not aware how to hookup to "struct uclass_driver",so no other option to do that then here.
> 
> > 
> > What about non-Rockchip SoCs using the syscon uclass?
> > 
> >>> something that is likely to be needed for many platforms.
> >>>
> >>
> >>> Could we use driver flags with something like:
> >>>
> >>> 	.flags = of_platdata_reg_size(struct rockchip_rk3288_noc_plat),
> >>
> >> Driver flags might solve only the "reg" size part, but not the
> >> ARRAY_SIZE and the unknown "reg" property location part.
> > 
> 
> > Right - but the generic syscon-uclass code assumes a single range and
> > that reg is the first property (at least I think it should be assuming a
> > single range, but it looks like there might be a bug there now).
> 
> I'm not aware that syscon nodes can have multiple reg ranges, but don't assume that in the future there won't be a binding that does.
> 
> > 
> >>> and this untested macro:
> >>>
> >>> 	#define of_platdata_reg_size(s) \
> >>> 		((sizeof(((struct rockchip_rk3288_noc_plat *) 0)->reg) == 64) ? \
> >>> 			DM_FLAGS_PLATDATA_REG_64BIT : 0)
> >>
> >> This would create a parallel data flow of a "size flag and ARRAY_SIZE variable + data" in
> >> a structure to the syscon class driver that also must be stored somewhere,
> >> while we could do the thing correct in the regmap structure right away.
> > 
> > But the syscon uclass doesn't need any of that extra info - for
> > OF_PLATDATA is makes assumptions and I don't see why that needs to be
> > any different for 32-bit platforms with #memory-cells = <2>.  From
> > syscon-uclass.c:
> > 
> > 	/*
> > 	 * With OF_PLATDATA we really have no way of knowing the format of
> > 	 * the device-specific platform data. So we assume that it starts with
> > 	 * a 'reg' member, and this holds a single address and size. Drivers
> > 	 * using OF_PLATDATA will need to ensure that this is true.
> > 	 */
> > 
> > In fact, for RK3288 we can just do:
> > 
> 
> > 	static_assert(sizeof(fdt_val_t) == FIELD_SIZEOF(struct dtd_rockchip_rk3288_grf, reg[0]));
> 
> fdt_val_t describes the parser capability and is not the same as the size in the dtd structure.
> 
> > 
> > and the uclass gets this right.
> 
> There's no guaranty that the dtd structure is going to be like syscon_base_plat and that the reg property is first.
> 
> struct syscon_base_plat {
> 	phys_addr_t reg[2];
> };
> 
> From syscon.yaml and other bindings we learn that there can be other properties then "reg" in syscon nodes.
> Properties pop-up where ever they like in the dtd structure after combining various dtsi and dts files.
> 
> struct dtd_rockchip_rk3066_grf {
> 	bool		dummy_property;
> 	fdt64_t		reg[2];
> };
> 
> Only passing a size flag is not enough.

What I still don't understand is how any of that is different from the
current state - so why does this need to change to support 64-bit
addresses?

All of the constraints you discuss above are mentioned in the existing
uclass-syscon.c implementation, but that implementation is working today
for all of these platforms with 32-bit addresses.  So is there any need
to support all those other use cases as part of allowing 64-bit
addresses in device trees?

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
  2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
                   ` (23 preceding siblings ...)
  2023-03-13  0:33 ` [PATCH v8 24/24] include: fdtdec: decouple fdt_addr_t and phys_addr_t size Johan Jonker
@ 2023-04-21  3:15 ` Kever Yang
  2023-04-21 15:33   ` [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function Johan Jonker
                     ` (2 more replies)
  24 siblings, 3 replies; 52+ messages in thread
From: Kever Yang @ 2023-04-21  3:15 UTC (permalink / raw)
  To: Johan Jonker, dario.binacchi, michael, sjg, philipp.tomsich
  Cc: u-boot, yifeng.zhao

Hi Johan,

     I got below error report from CI test, I think it should be relate 
to this patch set.

=================================== FAILURES 
===================================
1107 
<https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1107>_________________ 
test_ut[ut_dm_dm_test_fdt_get_addr_ptr_flat] _________________
1108 
<https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1108>test/py/tests/test_ut.py:346: 
in test_ut
1109 
<https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assert 
output.endswith('Failures: 0')
1110 
<https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1110>E 
AssertionError: assert False
1111 
<https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1111>E 
+ where False = <built-in method endswith of str object at 
0x7f7089240c10>('Failures: 0')
1112 
<https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1112>E 
+ where <built-in method endswith of str object at 0x7f7089240c10> = 
'Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat 
tree)\r\r\ntest/dm/test-fdt.c:627, 
dm_test_fdt_get_addr_ptr_fla...xpected 0000000000008000, got 
0000000010009000\r\r\nTest dm_test_fdt_get_addr_ptr_flat failed 1 
times\r\r\nFailures: 1'.endswith


Thanks,
- Kever
On 2023/3/13 08:23, Johan Jonker wrote:
> 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.
> Extended with tree wide function cleanup needed for 64bit DT parsing.
>
> Fixed are:
>    64bit FDT parsing
>    compatible string removal
>    add missing layout structure
>    add missing flash_node pointer
>    add missing chip ID
>
> Changed V8:
>    change comments
>    use uintptr_t size instead of phys_addr_t
>    add another fdt_addr_t fix
>
> Changed V7:
>    add proof of concept for syscon node with variable reg size handling
>    use another map_sysmem() function as cast
>    remove cast
>
> Changed V6:
>    use -EINVAL on return
>    drop cast
>    use map_sysmem() function as cast
>    add and rename patch
>
> Changed V5:
>    sort patch order
>    add more fixes with pointer functions
>    add debug text fixes
>    test with binman for ARM only due to limited resources
>
> Changed V4:
>    fix cast and divider in syscon-uclass.c
>
> Changed V3:
>    use dev_read_addr_ptr
>    fix oobfree
>
> Johan Jonker (23):
>    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
>    rockchip: adc: rockchip-saradc: use dev_read_addr_ptr
>    rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size
>    rockchip: pwm: rk_pwm: use base variable with uintptr_t size
>    rockchip: spi: rk_spi: use base variable with uintptr_t size
>    include: dm: ofnode: fix headers
>    core: remap: fix regmap_init_mem_plat() reg size handeling
>    rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
>    core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>    core: read: add dev_read_addr_index_ptr function
>    spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr
>    drivers: use dev_read_addr_index_ptr when cast to pointer
>    drivers: use dev_read_addr_ptr when cast to pointer
>    drivers: use devfdt_get_addr_size_index_ptr when cast to pointer
>    drivers: use devfdt_get_addr_index_ptr when cast to pointer
>    drivers: use devfdt_get_addr_ptr when cast to pointer
>    drivers: fix debug string with fdt_addr_t input
>    arm: stm32mp: spl: fix function with fdt_addr_t input
>    include: fdtdec: decouple fdt_addr_t and phys_addr_t size
>
> Paweł Jarosz (1):
>    mtd: nand: add support for the Sandisk SDTNQGAMA chip
>
>   Kconfig                                       |   8 ++
>   arch/arm/mach-mvebu/cpu.c                     |   2 +-
>   arch/arm/mach-mvebu/system-controller.c       |   4 +-
>   arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 121 ++++++++++++++++++
>   arch/arm/mach-stm32mp/spl.c                   |   2 +-
>   doc/develop/driver-model/livetree.rst         |   2 +-
>   drivers/adc/rockchip-saradc.c                 |   6 +-
>   drivers/ata/dwc_ahsata.c                      |   2 +-
>   drivers/cache/cache-l2x0.c                    |   2 +-
>   drivers/cache/cache-v5l2.c                    |   2 +-
>   drivers/clk/at91/sama7g5.c                    |   2 +-
>   drivers/clk/at91/sckc.c                       |   2 +-
>   drivers/clk/clk-hsdk-cgu.c                    |   4 +-
>   drivers/clk/ti/clk-ctrl.c                     |   9 +-
>   drivers/core/fdtaddr.c                        |  17 ++-
>   drivers/core/read.c                           |  15 ++-
>   drivers/core/regmap.c                         |  23 +++-
>   drivers/core/syscon-uclass.c                  |  23 +++-
>   drivers/ddr/altera/sdram_gen5.c               |   4 +-
>   drivers/gpio/mscc_sgpio.c                     |   2 +-
>   drivers/gpio/tegra_gpio.c                     |   4 +-
>   drivers/gpio/xilinx_gpio.c                    |   2 +-
>   drivers/i2c/i2c-cdns.c                        |   4 +-
>   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/xenon_sdhci.c                     |   2 +-
>   drivers/mmc/zynq_sdhci.c                      |   6 +-
>   drivers/mtd/nand/raw/arasan_nfc.c             |   2 +-
>   drivers/mtd/nand/raw/cortina_nand.c           |   6 +-
>   drivers/mtd/nand/raw/mxic_nand.c              |   2 +-
>   drivers/mtd/nand/raw/nand_ids.c               |   3 +
>   drivers/mtd/nand/raw/rockchip_nfc.c           |  78 ++++-------
>   drivers/mtd/nand/raw/tegra_nand.c             |   2 +-
>   drivers/mtd/nand/raw/zynq_nand.c              |   2 +-
>   drivers/net/dm9000x.c                         |   2 +-
>   drivers/net/dwmac_meson8b.c                   |   4 +-
>   drivers/net/mvmdio.c                          |   2 +-
>   drivers/net/mvpp2.c                           |  24 ++--
>   drivers/net/qe/dm_qe_uec_phy.c                |   2 +-
>   drivers/pci/pci-aardvark.c                    |   4 +-
>   drivers/pci/pcie_dw_meson.c                   |   8 +-
>   drivers/pci/pcie_dw_mvebu.c                   |  10 +-
>   drivers/pci/pcie_dw_rockchip.c                |   8 +-
>   drivers/pci/pcie_imx.c                        |   4 +-
>   drivers/pci/pcie_layerscape_ep.c              |   8 +-
>   drivers/phy/allwinner/phy-sun50i-usb3.c       |   6 +-
>   drivers/phy/marvell/comphy_core.c             |  12 +-
>   drivers/phy/phy-stm32-usbphyc.c               |   4 +-
>   drivers/phy/qcom/phy-qcom-usb-hs-28nm.c       |   4 +-
>   drivers/phy/qcom/phy-qcom-usb-ss.c            |   4 +-
>   .../phy/rockchip/phy-rockchip-snps-pcie3.c    |   4 +-
>   drivers/phy/rockchip/phy-rockchip-typec.c     |   6 +-
>   drivers/pwm/rk_pwm.c                          |   2 +-
>   drivers/pwm/tegra_pwm.c                       |   2 +-
>   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/serial/serial_zynq.c                  |   6 +-
>   drivers/spi/cadence_qspi.c                    |   5 +-
>   drivers/spi/mpc8xxx_spi.c                     |   2 +-
>   drivers/spi/mscc_bb_spi.c                     |   2 +-
>   drivers/spi/mtk_snor.c                        |   2 +-
>   drivers/spi/mtk_spim.c                        |   2 +-
>   drivers/spi/rk_spi.c                          |   2 +-
>   drivers/spi/sh_qspi.c                         |   2 +-
>   drivers/spi/spi-aspeed-smc.c                  |  17 ++-
>   drivers/spi/spi-mxic.c                        |   2 +-
>   drivers/spi/xilinx_spi.c                      |   2 +-
>   drivers/timer/dw-apb-timer.c                  |   2 +-
>   drivers/ufs/ufs.c                             |   2 +-
>   drivers/usb/host/ehci-tegra.c                 |   2 +-
>   drivers/usb/musb-new/ti-musb.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/video/ti/tilcdc.c                     |   4 +-
>   drivers/watchdog/cdns_wdt.c                   |   6 +-
>   drivers/watchdog/sbsa_gwdt.c                  |  12 +-
>   drivers/watchdog/sp805_wdt.c                  |   6 +-
>   drivers/watchdog/xilinx_tb_wdt.c              |   6 +-
>   include/dm/fdtaddr.h                          |  17 ++-
>   include/dm/ofnode.h                           |  16 +--
>   include/fdtdec.h                              |  13 +-
>   include/regmap.h                              |   5 +-
>   include/syscon.h                              |  13 --
>   94 files changed, 426 insertions(+), 255 deletions(-)
>
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
  2023-04-21  3:15 ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Kever Yang
@ 2023-04-21 15:33   ` Johan Jonker
  2023-04-21 15:34   ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
  2023-04-23  9:19   ` [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return Johan Jonker
  2 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-04-21 15:33 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

Add devfdt_get_addr_size_index_ptr function with the same
functionality as devfdt_get_addr_size_index, but instead
a return pointer is given.

Suggested-by: Michael Nazzareno Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changed V9:
  remove map_sysmem()

Changed V7:
  use map_sysmem()

Changed V5:
  fix spelling
  use tabs
---
 drivers/core/fdtaddr.c |  8 ++++++++
 include/dm/fdtaddr.h   | 17 ++++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index a499f3b5..a68e31df 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -134,6 +134,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)
diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h
index c9d2b27b..dcdc1913 100644
--- a/include/dm/fdtaddr.h
+++ b/include/dm/fdtaddr.h
@@ -111,7 +111,7 @@ void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index);
  * @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
+ * @size: Pointer to size variable - this function returns the size
  *        specified in the 'reg' property here
  *
  * Return: addr
@@ -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 variable - 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


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
  2023-04-21  3:15 ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Kever Yang
  2023-04-21 15:33   ` [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function Johan Jonker
@ 2023-04-21 15:34   ` Johan Jonker
  2023-04-22 20:33     ` Johan Jonker
  2023-04-23  1:51     ` Kever Yang
  2023-04-23  9:19   ` [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return Johan Jonker
  2 siblings, 2 replies; 52+ messages in thread
From: Johan Jonker @ 2023-04-21 15:34 UTC (permalink / raw)
  To: Kever Yang, dario.binacchi, michael, sjg, philipp.tomsich
  Cc: u-boot, yifeng.zhao



On 4/21/23 05:15, Kever Yang wrote:
> Hi Johan,
> 
>     I got below error report from CI test, I think it should be relate to this patch set.
> 
> =================================== FAILURES ===================================
> 1107 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1107>_________________ test_ut[ut_dm_dm_test_fdt_get_addr_ptr_flat] _________________
> 1108 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1108>test/py/tests/test_ut.py:346: in test_ut
> 1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assert output.endswith('Failures: 0')
> 1110 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1110>E AssertionError: assert False
> 1111 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1111>E + where False = <built-in method endswith of str object at 0x7f7089240c10>('Failures: 0')
> 1112 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1112>E + where <built-in method endswith of str object at 0x7f7089240c10> = 'Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)\r\r\ntest/dm/test-fdt.c:627, 

dm_test_fdt_get_addr_ptr_fla...xpected 0000000000008000, got 0000000010009000\r\r\nTest dm_test_fdt_get_addr_ptr_flat failed 1 times\r\r\nFailures: 1'.endswith

It turns out that the suggestion by Simon to use map_sysmem() doesn't work with devfdt_get_addr_index_ptr() somehow.

To reproduce with this serie:
make sandbox_defconfig all
./u-boot -T -c "ut dm fdt*"

Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)
test/dm/test-fdt.c:627, dm_test_fdt_get_addr_ptr_flat(): (void *)0x8000 = ptr: Expected 0000000000008000, got 0000000010009000
Test fdt* failed 1 times

===

Could Simon have a look at the internal map_sysmem() stuff?

Will send 1 patch to replace:
[PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function

for:

[PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function

Could Kever retest with the patch above replacement?

Johan

> 
> 
> Thanks,
> - Kever
> On 2023/3/13 08:23, Johan Jonker wrote:
>> 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.
>> Extended with tree wide function cleanup needed for 64bit DT parsing.
>>
>> Fixed are:
>>   64bit FDT parsing
>>   compatible string removal
>>   add missing layout structure
>>   add missing flash_node pointer
>>   add missing chip ID
>>
>> Changed V8:
>>   change comments
>>   use uintptr_t size instead of phys_addr_t
>>   add another fdt_addr_t fix
>>
>> Changed V7:
>>   add proof of concept for syscon node with variable reg size handling
>>   use another map_sysmem() function as cast
>>   remove cast
>>
>> Changed V6:
>>   use -EINVAL on return
>>   drop cast
>>   use map_sysmem() function as cast
>>   add and rename patch
>>
>> Changed V5:
>>   sort patch order
>>   add more fixes with pointer functions
>>   add debug text fixes
>>   test with binman for ARM only due to limited resources
>>
>> Changed V4:
>>   fix cast and divider in syscon-uclass.c
>>
>> Changed V3:
>>   use dev_read_addr_ptr
>>   fix oobfree
>>
>> Johan Jonker (23):
>>   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
>>   rockchip: adc: rockchip-saradc: use dev_read_addr_ptr
>>   rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size
>>   rockchip: pwm: rk_pwm: use base variable with uintptr_t size
>>   rockchip: spi: rk_spi: use base variable with uintptr_t size
>>   include: dm: ofnode: fix headers
>>   core: remap: fix regmap_init_mem_plat() reg size handeling
>>   rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
>>   core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>>   core: read: add dev_read_addr_index_ptr function
>>   spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr
>>   drivers: use dev_read_addr_index_ptr when cast to pointer
>>   drivers: use dev_read_addr_ptr when cast to pointer
>>   drivers: use devfdt_get_addr_size_index_ptr when cast to pointer
>>   drivers: use devfdt_get_addr_index_ptr when cast to pointer
>>   drivers: use devfdt_get_addr_ptr when cast to pointer
>>   drivers: fix debug string with fdt_addr_t input
>>   arm: stm32mp: spl: fix function with fdt_addr_t input
>>   include: fdtdec: decouple fdt_addr_t and phys_addr_t size
>>
>> Paweł Jarosz (1):
>>   mtd: nand: add support for the Sandisk SDTNQGAMA chip
>>
>>  Kconfig                                       |   8 ++
>>  arch/arm/mach-mvebu/cpu.c                     |   2 +-
>>  arch/arm/mach-mvebu/system-controller.c       |   4 +-
>>  arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 121 ++++++++++++++++++
>>  arch/arm/mach-stm32mp/spl.c                   |   2 +-
>>  doc/develop/driver-model/livetree.rst         |   2 +-
>>  drivers/adc/rockchip-saradc.c                 |   6 +-
>>  drivers/ata/dwc_ahsata.c                      |   2 +-
>>  drivers/cache/cache-l2x0.c                    |   2 +-
>>  drivers/cache/cache-v5l2.c                    |   2 +-
>>  drivers/clk/at91/sama7g5.c                    |   2 +-
>>  drivers/clk/at91/sckc.c                       |   2 +-
>>  drivers/clk/clk-hsdk-cgu.c                    |   4 +-
>>  drivers/clk/ti/clk-ctrl.c                     |   9 +-
>>  drivers/core/fdtaddr.c                        |  17 ++-
>>  drivers/core/read.c                           |  15 ++-
>>  drivers/core/regmap.c                         |  23 +++-
>>  drivers/core/syscon-uclass.c                  |  23 +++-
>>  drivers/ddr/altera/sdram_gen5.c               |   4 +-
>>  drivers/gpio/mscc_sgpio.c                     |   2 +-
>>  drivers/gpio/tegra_gpio.c                     |   4 +-
>>  drivers/gpio/xilinx_gpio.c                    |   2 +-
>>  drivers/i2c/i2c-cdns.c                        |   4 +-
>>  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/xenon_sdhci.c                     |   2 +-
>>  drivers/mmc/zynq_sdhci.c                      |   6 +-
>>  drivers/mtd/nand/raw/arasan_nfc.c             |   2 +-
>>  drivers/mtd/nand/raw/cortina_nand.c           |   6 +-
>>  drivers/mtd/nand/raw/mxic_nand.c              |   2 +-
>>  drivers/mtd/nand/raw/nand_ids.c               |   3 +
>>  drivers/mtd/nand/raw/rockchip_nfc.c           |  78 ++++-------
>>  drivers/mtd/nand/raw/tegra_nand.c             |   2 +-
>>  drivers/mtd/nand/raw/zynq_nand.c              |   2 +-
>>  drivers/net/dm9000x.c                         |   2 +-
>>  drivers/net/dwmac_meson8b.c                   |   4 +-
>>  drivers/net/mvmdio.c                          |   2 +-
>>  drivers/net/mvpp2.c                           |  24 ++--
>>  drivers/net/qe/dm_qe_uec_phy.c                |   2 +-
>>  drivers/pci/pci-aardvark.c                    |   4 +-
>>  drivers/pci/pcie_dw_meson.c                   |   8 +-
>>  drivers/pci/pcie_dw_mvebu.c                   |  10 +-
>>  drivers/pci/pcie_dw_rockchip.c                |   8 +-
>>  drivers/pci/pcie_imx.c                        |   4 +-
>>  drivers/pci/pcie_layerscape_ep.c              |   8 +-
>>  drivers/phy/allwinner/phy-sun50i-usb3.c       |   6 +-
>>  drivers/phy/marvell/comphy_core.c             |  12 +-
>>  drivers/phy/phy-stm32-usbphyc.c               |   4 +-
>>  drivers/phy/qcom/phy-qcom-usb-hs-28nm.c       |   4 +-
>>  drivers/phy/qcom/phy-qcom-usb-ss.c            |   4 +-
>>  .../phy/rockchip/phy-rockchip-snps-pcie3.c    |   4 +-
>>  drivers/phy/rockchip/phy-rockchip-typec.c     |   6 +-
>>  drivers/pwm/rk_pwm.c                          |   2 +-
>>  drivers/pwm/tegra_pwm.c                       |   2 +-
>>  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/serial/serial_zynq.c                  |   6 +-
>>  drivers/spi/cadence_qspi.c                    |   5 +-
>>  drivers/spi/mpc8xxx_spi.c                     |   2 +-
>>  drivers/spi/mscc_bb_spi.c                     |   2 +-
>>  drivers/spi/mtk_snor.c                        |   2 +-
>>  drivers/spi/mtk_spim.c                        |   2 +-
>>  drivers/spi/rk_spi.c                          |   2 +-
>>  drivers/spi/sh_qspi.c                         |   2 +-
>>  drivers/spi/spi-aspeed-smc.c                  |  17 ++-
>>  drivers/spi/spi-mxic.c                        |   2 +-
>>  drivers/spi/xilinx_spi.c                      |   2 +-
>>  drivers/timer/dw-apb-timer.c                  |   2 +-
>>  drivers/ufs/ufs.c                             |   2 +-
>>  drivers/usb/host/ehci-tegra.c                 |   2 +-
>>  drivers/usb/musb-new/ti-musb.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/video/ti/tilcdc.c                     |   4 +-
>>  drivers/watchdog/cdns_wdt.c                   |   6 +-
>>  drivers/watchdog/sbsa_gwdt.c                  |  12 +-
>>  drivers/watchdog/sp805_wdt.c                  |   6 +-
>>  drivers/watchdog/xilinx_tb_wdt.c              |   6 +-
>>  include/dm/fdtaddr.h                          |  17 ++-
>>  include/dm/ofnode.h                           |  16 +--
>>  include/fdtdec.h                              |  13 +-
>>  include/regmap.h                              |   5 +-
>>  include/syscon.h                              |  13 --
>>  94 files changed, 426 insertions(+), 255 deletions(-)
>>
>> --
>> 2.20.1
>>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
  2023-04-21 15:34   ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
@ 2023-04-22 20:33     ` Johan Jonker
  2023-04-23  1:51     ` Kever Yang
  1 sibling, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-04-22 20:33 UTC (permalink / raw)
  To: Kever Yang, dario.binacchi, michael, sjg, philipp.tomsich
  Cc: u-boot, yifeng.zhao



On 4/21/23 17:34, Johan Jonker wrote:
> 
> 
> On 4/21/23 05:15, Kever Yang wrote:
>> Hi Johan,
>>
>>     I got below error report from CI test, I think it should be relate to this patch set.
>>
>> =================================== FAILURES ===================================
>> 1107 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1107>_________________ test_ut[ut_dm_dm_test_fdt_get_addr_ptr_flat] _________________
>> 1108 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1108>test/py/tests/test_ut.py:346: in test_ut
>> 1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assert output.endswith('Failures: 0')
>> 1110 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1110>E AssertionError: assert False
>> 1111 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1111>E + where False = <built-in method endswith of str object at 0x7f7089240c10>('Failures: 0')
>> 1112 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1112>E + where <built-in method endswith of str object at 0x7f7089240c10> = 'Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)\r\r\ntest/dm/test-fdt.c:627, 
> 
> dm_test_fdt_get_addr_ptr_fla...xpected 0000000000008000, got 0000000010009000\r\r\nTest dm_test_fdt_get_addr_ptr_flat failed 1 times\r\r\nFailures: 1'.endswith
> 
> It turns out that the suggestion by Simon to use map_sysmem() doesn't work with devfdt_get_addr_index_ptr() somehow.
> 
> To reproduce with this serie:
> make sandbox_defconfig all
> ./u-boot -T -c "ut dm fdt*"
> 
> Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)
> test/dm/test-fdt.c:627, dm_test_fdt_get_addr_ptr_flat(): (void *)0x8000 = ptr: Expected 0000000000008000, got 0000000010009000
> Test fdt* failed 1 times
> 
> ===
> 

> Could Simon have a look at the internal map_sysmem() stuff?

Question for Simon:

Comments:
Re: [PATCH v5 12/21] core: read: add dev_read_addr_index_ptr function
Please use map_sysmem() rather than a cast, so it can be used on sandbox.

Re: [PATCH v6 12/22] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
Shouldn't this use map_to_sysmem()? We should not cast addresses to pointers.

> +       return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;

Did you mean map_sysmem() instead of map_to_sysmem() as I used in [PATCH v8 14/24]??

===
The test is looking for "(void *)0x8000", while devfdt_get_addr_ptr() points to a map_physmem() pointer now.
Either "(void *)0x8000" needs to be mapped too.

Do you agree?
===

From /arch/sandbox/include/asm/io.h

/* For sandbox, we want addresses to point into our RAM buffer */
static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)
{
	return map_physmem(paddr, len, MAP_WRBACK);
}
===

From /test/dm/test-fdt.c:

static int dm_test_fdt_get_addr_ptr_flat(struct unit_test_state *uts)
{
	struct udevice *gpio, *dev;
	void *ptr;

	/* Test for missing reg property */
	ut_assertok(uclass_first_device_err(UCLASS_GPIO, &gpio));
	ut_assertnull(devfdt_get_addr_ptr(gpio));

	ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));

===
Change:

	ptr = devfdt_get_addr_ptr(dev);
	ut_asserteq_ptr((void *)0x8000, ptr);

To:
	paddr = map_physmem(0x8000, 0, MAP_NOCACHE); // ??
	ut_asserteq_ptr(paddr, ptr);                 // ??

Please advise what kind of test you like.

===
	return 0;
}
DM_TEST(dm_test_fdt_get_addr_ptr_flat,
	UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT | UT_TESTF_FLAT_TREE);


> 
> Will send 1 patch to replace:
> [PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
> 
> for:
> 

> [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
> 

The use of map_sysmem() in a devfdt_get_addr_size_index_ptr must change the test as well in the same patch.
Is there a need for "[patch v10] core: fdtaddr: add devfdt_get_addr_size_index_ptr function" or is [patch v9] enough for now??

> Could Kever retest with the patch above replacement?


> 
> Johan
> 
>>
>>
>> Thanks,
>> - Kever
>> On 2023/3/13 08:23, Johan Jonker wrote:
>>> 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.
>>> Extended with tree wide function cleanup needed for 64bit DT parsing.
>>>
>>> Fixed are:
>>>   64bit FDT parsing
>>>   compatible string removal
>>>   add missing layout structure
>>>   add missing flash_node pointer
>>>   add missing chip ID
>>>
>>> Changed V8:
>>>   change comments
>>>   use uintptr_t size instead of phys_addr_t
>>>   add another fdt_addr_t fix
>>>
>>> Changed V7:
>>>   add proof of concept for syscon node with variable reg size handling
>>>   use another map_sysmem() function as cast
>>>   remove cast
>>>
>>> Changed V6:
>>>   use -EINVAL on return
>>>   drop cast
>>>   use map_sysmem() function as cast
>>>   add and rename patch
>>>
>>> Changed V5:
>>>   sort patch order
>>>   add more fixes with pointer functions
>>>   add debug text fixes
>>>   test with binman for ARM only due to limited resources
>>>
>>> Changed V4:
>>>   fix cast and divider in syscon-uclass.c
>>>
>>> Changed V3:
>>>   use dev_read_addr_ptr
>>>   fix oobfree
>>>
>>> Johan Jonker (23):
>>>   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
>>>   rockchip: adc: rockchip-saradc: use dev_read_addr_ptr
>>>   rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size
>>>   rockchip: pwm: rk_pwm: use base variable with uintptr_t size
>>>   rockchip: spi: rk_spi: use base variable with uintptr_t size
>>>   include: dm: ofnode: fix headers
>>>   core: remap: fix regmap_init_mem_plat() reg size handeling
>>>   rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
>>>   core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>>>   core: read: add dev_read_addr_index_ptr function
>>>   spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr
>>>   drivers: use dev_read_addr_index_ptr when cast to pointer
>>>   drivers: use dev_read_addr_ptr when cast to pointer
>>>   drivers: use devfdt_get_addr_size_index_ptr when cast to pointer
>>>   drivers: use devfdt_get_addr_index_ptr when cast to pointer
>>>   drivers: use devfdt_get_addr_ptr when cast to pointer
>>>   drivers: fix debug string with fdt_addr_t input
>>>   arm: stm32mp: spl: fix function with fdt_addr_t input
>>>   include: fdtdec: decouple fdt_addr_t and phys_addr_t size
>>>
>>> Paweł Jarosz (1):
>>>   mtd: nand: add support for the Sandisk SDTNQGAMA chip
>>>
>>>  Kconfig                                       |   8 ++
>>>  arch/arm/mach-mvebu/cpu.c                     |   2 +-
>>>  arch/arm/mach-mvebu/system-controller.c       |   4 +-
>>>  arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 121 ++++++++++++++++++
>>>  arch/arm/mach-stm32mp/spl.c                   |   2 +-
>>>  doc/develop/driver-model/livetree.rst         |   2 +-
>>>  drivers/adc/rockchip-saradc.c                 |   6 +-
>>>  drivers/ata/dwc_ahsata.c                      |   2 +-
>>>  drivers/cache/cache-l2x0.c                    |   2 +-
>>>  drivers/cache/cache-v5l2.c                    |   2 +-
>>>  drivers/clk/at91/sama7g5.c                    |   2 +-
>>>  drivers/clk/at91/sckc.c                       |   2 +-
>>>  drivers/clk/clk-hsdk-cgu.c                    |   4 +-
>>>  drivers/clk/ti/clk-ctrl.c                     |   9 +-
>>>  drivers/core/fdtaddr.c                        |  17 ++-
>>>  drivers/core/read.c                           |  15 ++-
>>>  drivers/core/regmap.c                         |  23 +++-
>>>  drivers/core/syscon-uclass.c                  |  23 +++-
>>>  drivers/ddr/altera/sdram_gen5.c               |   4 +-
>>>  drivers/gpio/mscc_sgpio.c                     |   2 +-
>>>  drivers/gpio/tegra_gpio.c                     |   4 +-
>>>  drivers/gpio/xilinx_gpio.c                    |   2 +-
>>>  drivers/i2c/i2c-cdns.c                        |   4 +-
>>>  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/xenon_sdhci.c                     |   2 +-
>>>  drivers/mmc/zynq_sdhci.c                      |   6 +-
>>>  drivers/mtd/nand/raw/arasan_nfc.c             |   2 +-
>>>  drivers/mtd/nand/raw/cortina_nand.c           |   6 +-
>>>  drivers/mtd/nand/raw/mxic_nand.c              |   2 +-
>>>  drivers/mtd/nand/raw/nand_ids.c               |   3 +
>>>  drivers/mtd/nand/raw/rockchip_nfc.c           |  78 ++++-------
>>>  drivers/mtd/nand/raw/tegra_nand.c             |   2 +-
>>>  drivers/mtd/nand/raw/zynq_nand.c              |   2 +-
>>>  drivers/net/dm9000x.c                         |   2 +-
>>>  drivers/net/dwmac_meson8b.c                   |   4 +-
>>>  drivers/net/mvmdio.c                          |   2 +-
>>>  drivers/net/mvpp2.c                           |  24 ++--
>>>  drivers/net/qe/dm_qe_uec_phy.c                |   2 +-
>>>  drivers/pci/pci-aardvark.c                    |   4 +-
>>>  drivers/pci/pcie_dw_meson.c                   |   8 +-
>>>  drivers/pci/pcie_dw_mvebu.c                   |  10 +-
>>>  drivers/pci/pcie_dw_rockchip.c                |   8 +-
>>>  drivers/pci/pcie_imx.c                        |   4 +-
>>>  drivers/pci/pcie_layerscape_ep.c              |   8 +-
>>>  drivers/phy/allwinner/phy-sun50i-usb3.c       |   6 +-
>>>  drivers/phy/marvell/comphy_core.c             |  12 +-
>>>  drivers/phy/phy-stm32-usbphyc.c               |   4 +-
>>>  drivers/phy/qcom/phy-qcom-usb-hs-28nm.c       |   4 +-
>>>  drivers/phy/qcom/phy-qcom-usb-ss.c            |   4 +-
>>>  .../phy/rockchip/phy-rockchip-snps-pcie3.c    |   4 +-
>>>  drivers/phy/rockchip/phy-rockchip-typec.c     |   6 +-
>>>  drivers/pwm/rk_pwm.c                          |   2 +-
>>>  drivers/pwm/tegra_pwm.c                       |   2 +-
>>>  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/serial/serial_zynq.c                  |   6 +-
>>>  drivers/spi/cadence_qspi.c                    |   5 +-
>>>  drivers/spi/mpc8xxx_spi.c                     |   2 +-
>>>  drivers/spi/mscc_bb_spi.c                     |   2 +-
>>>  drivers/spi/mtk_snor.c                        |   2 +-
>>>  drivers/spi/mtk_spim.c                        |   2 +-
>>>  drivers/spi/rk_spi.c                          |   2 +-
>>>  drivers/spi/sh_qspi.c                         |   2 +-
>>>  drivers/spi/spi-aspeed-smc.c                  |  17 ++-
>>>  drivers/spi/spi-mxic.c                        |   2 +-
>>>  drivers/spi/xilinx_spi.c                      |   2 +-
>>>  drivers/timer/dw-apb-timer.c                  |   2 +-
>>>  drivers/ufs/ufs.c                             |   2 +-
>>>  drivers/usb/host/ehci-tegra.c                 |   2 +-
>>>  drivers/usb/musb-new/ti-musb.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/video/ti/tilcdc.c                     |   4 +-
>>>  drivers/watchdog/cdns_wdt.c                   |   6 +-
>>>  drivers/watchdog/sbsa_gwdt.c                  |  12 +-
>>>  drivers/watchdog/sp805_wdt.c                  |   6 +-
>>>  drivers/watchdog/xilinx_tb_wdt.c              |   6 +-
>>>  include/dm/fdtaddr.h                          |  17 ++-
>>>  include/dm/ofnode.h                           |  16 +--
>>>  include/fdtdec.h                              |  13 +-
>>>  include/regmap.h                              |   5 +-
>>>  include/syscon.h                              |  13 --
>>>  94 files changed, 426 insertions(+), 255 deletions(-)
>>>
>>> --
>>> 2.20.1
>>>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
  2023-04-21 15:34   ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
  2023-04-22 20:33     ` Johan Jonker
@ 2023-04-23  1:51     ` Kever Yang
  2023-04-23  9:24       ` Johan Jonker
  1 sibling, 1 reply; 52+ messages in thread
From: Kever Yang @ 2023-04-23  1:51 UTC (permalink / raw)
  To: Johan Jonker, dario.binacchi, michael, sjg, philipp.tomsich
  Cc: u-boot, yifeng.zhao

Hi Johan,

On 2023/4/21 23:34, Johan Jonker wrote:
>
> On 4/21/23 05:15, Kever Yang wrote:
>> Hi Johan,
>>
>>      I got below error report from CI test, I think it should be relate to this patch set.
>>
>> =================================== FAILURES ===================================
>> 1107 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1107>_________________ test_ut[ut_dm_dm_test_fdt_get_addr_ptr_flat] _________________
>> 1108 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1108>test/py/tests/test_ut.py:346: in test_ut
>> 1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assert output.endswith('Failures: 0')
>> 1110 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1110>E AssertionError: assert False
>> 1111 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1111>E + where False = <built-in method endswith of str object at 0x7f7089240c10>('Failures: 0')
>> 1112 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1112>E + where <built-in method endswith of str object at 0x7f7089240c10> = 'Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)\r\r\ntest/dm/test-fdt.c:627,
> dm_test_fdt_get_addr_ptr_fla...xpected 0000000000008000, got 0000000010009000\r\r\nTest dm_test_fdt_get_addr_ptr_flat failed 1 times\r\r\nFailures: 1'.endswith
>
> It turns out that the suggestion by Simon to use map_sysmem() doesn't work with devfdt_get_addr_index_ptr() somehow.
>
> To reproduce with this serie:
> make sandbox_defconfig all
> ./u-boot -T -c "ut dm fdt*"
>
> Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)
> test/dm/test-fdt.c:627, dm_test_fdt_get_addr_ptr_flat(): (void *)0x8000 = ptr: Expected 0000000000008000, got 0000000010009000
> Test fdt* failed 1 times
>
> ===
>
> Could Simon have a look at the internal map_sysmem() stuff?
>
> Will send 1 patch to replace:
> [PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>
> for:
>
> [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>
> Could Kever retest with the patch above replacement?

The CI test pass with this replacement.


Thanks,

- Kever


^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return
  2023-04-21  3:15 ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Kever Yang
  2023-04-21 15:33   ` [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function Johan Jonker
  2023-04-21 15:34   ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
@ 2023-04-23  9:19   ` Johan Jonker
  2023-04-24 19:42     ` Simon Glass
  2023-04-28 19:20     ` Simon Glass
  2 siblings, 2 replies; 52+ messages in thread
From: Johan Jonker @ 2023-04-23  9:19 UTC (permalink / raw)
  To: dario.binacchi, michael, sjg, philipp.tomsich, kever.yang
  Cc: u-boot, yifeng.zhao

For the devfdt_get_addr_index_ptr() and devfdt_get_addr_size_index_ptr()
function use map_sysmem() function as cast for the return for use in
sandbox. Also fix sandbox test.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

Apply after:
[PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
with replacement:
[PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function

---

Changed V9:
  New patch.
  Split use of map_sysmem() from previous series.
---
 drivers/core/fdtaddr.c | 11 +++++++++--
 test/dm/test-fdt.c     |  5 ++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index f5906ff9..546db675 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <fdt_support.h>
 #include <log.h>
+#include <mapmem.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
 #include <dm/device-internal.h>
@@ -97,7 +98,10 @@ void *devfdt_get_addr_index_ptr(const struct udevice *dev, int index)
 {
 	fdt_addr_t addr = devfdt_get_addr_index(dev, index);

-	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
+	if (addr == FDT_ADDR_T_NONE)
+		return NULL;
+
+	return map_sysmem(addr, 0);
 }

 fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index,
@@ -127,7 +131,10 @@ void *devfdt_get_addr_size_index_ptr(const struct udevice *dev, int index,
 {
 	fdt_addr_t addr = devfdt_get_addr_size_index(dev, index, size);

-	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
+	if (addr == FDT_ADDR_T_NONE)
+		return NULL;
+
+	return map_sysmem(addr, 0);
 }

 fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name)
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 8e6e42e4..eeecd1dc 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -617,6 +617,7 @@ static int dm_test_fdt_get_addr_ptr_flat(struct unit_test_state *uts)
 {
 	struct udevice *gpio, *dev;
 	void *ptr;
+	void *paddr;

 	/* Test for missing reg property */
 	ut_assertok(uclass_first_device_err(UCLASS_GPIO, &gpio));
@@ -624,7 +625,9 @@ static int dm_test_fdt_get_addr_ptr_flat(struct unit_test_state *uts)

 	ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, &dev));
 	ptr = devfdt_get_addr_ptr(dev);
-	ut_asserteq_ptr((void *)0x8000, ptr);
+
+	paddr = map_sysmem(0x8000, 0);
+	ut_asserteq_ptr(paddr, ptr);

 	return 0;
 }
--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
  2023-04-23  1:51     ` Kever Yang
@ 2023-04-23  9:24       ` Johan Jonker
  2023-04-24 23:33         ` Simon Glass
  0 siblings, 1 reply; 52+ messages in thread
From: Johan Jonker @ 2023-04-23  9:24 UTC (permalink / raw)
  To: Kever Yang, dario.binacchi, michael, sjg, philipp.tomsich
  Cc: u-boot, yifeng.zhao



On 4/23/23 03:51, Kever Yang wrote:
> Hi Johan,
> 
> On 2023/4/21 23:34, Johan Jonker wrote:
>>
>> On 4/21/23 05:15, Kever Yang wrote:
>>> Hi Johan,
>>>
>>>      I got below error report from CI test, I think it should be relate to this patch set.
>>>
>>> =================================== FAILURES ===================================
>>> 1107 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1107>_________________ test_ut[ut_dm_dm_test_fdt_get_addr_ptr_flat] _________________
>>> 1108 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1108>test/py/tests/test_ut.py:346: in test_ut
>>> 1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assert output.endswith('Failures: 0')
>>> 1110 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1110>E AssertionError: assert False
>>> 1111 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1111>E + where False = <built-in method endswith of str object at 0x7f7089240c10>('Failures: 0')
>>> 1112 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1112>E + where <built-in method endswith of str object at 0x7f7089240c10> = 'Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)\r\r\ntest/dm/test-fdt.c:627,
>> dm_test_fdt_get_addr_ptr_fla...xpected 0000000000008000, got 0000000010009000\r\r\nTest dm_test_fdt_get_addr_ptr_flat failed 1 times\r\r\nFailures: 1'.endswith
>>
>> It turns out that the suggestion by Simon to use map_sysmem() doesn't work with devfdt_get_addr_index_ptr() somehow.
>>
>> To reproduce with this serie:
>> make sandbox_defconfig all
>> ./u-boot -T -c "ut dm fdt*"
>>
>> Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)
>> test/dm/test-fdt.c:627, dm_test_fdt_get_addr_ptr_flat(): (void *)0x8000 = ptr: Expected 0000000000008000, got 0000000010009000
>> Test fdt* failed 1 times
>>
>> ===
>>
>> Could Simon have a look at the internal map_sysmem() stuff?
>>
>> Will send 1 patch to replace:
>> [PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>>
>> for:
>>
>> [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>>
>> Could Kever retest with the patch above replacement?
> 

> The CI test pass with this replacement.

I've sent a new separate patch that handles map_sysmem.

[PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return
https://lore.kernel.org/u-boot/4990a11d-638f-661d-a7c0-e0c5bf7ff863@gmail.com/T/#u

Apply after:
[PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
with replacement:
[PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function

Please have a look.

Johan

> 
> 
> Thanks,
> 
> - Kever
> 

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return
  2023-04-23  9:19   ` [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return Johan Jonker
@ 2023-04-24 19:42     ` Simon Glass
  2023-04-28 19:20     ` Simon Glass
  1 sibling, 0 replies; 52+ messages in thread
From: Simon Glass @ 2023-04-24 19:42 UTC (permalink / raw)
  To: Johan Jonker
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao

On Sun, 23 Apr 2023 at 03:19, Johan Jonker <jbx6244@gmail.com> wrote:
>
> For the devfdt_get_addr_index_ptr() and devfdt_get_addr_size_index_ptr()
> function use map_sysmem() function as cast for the return for use in
> sandbox. Also fix sandbox test.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>
> Apply after:
> [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
> with replacement:
> [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>
> ---
>
> Changed V9:
>   New patch.
>   Split use of map_sysmem() from previous series.
> ---
>  drivers/core/fdtaddr.c | 11 +++++++++--
>  test/dm/test-fdt.c     |  5 ++++-
>  2 files changed, 13 insertions(+), 3 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

Thanks for digging into this.

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
  2023-04-23  9:24       ` Johan Jonker
@ 2023-04-24 23:33         ` Simon Glass
  0 siblings, 0 replies; 52+ messages in thread
From: Simon Glass @ 2023-04-24 23:33 UTC (permalink / raw)
  To: Johan Jonker
  Cc: Kever Yang, dario.binacchi, michael, philipp.tomsich, u-boot,
	yifeng.zhao

Hi Johan,

On Sun, 23 Apr 2023 at 03:24, Johan Jonker <jbx6244@gmail.com> wrote:
>
>
>
> On 4/23/23 03:51, Kever Yang wrote:
> > Hi Johan,
> >
> > On 2023/4/21 23:34, Johan Jonker wrote:
> >>
> >> On 4/21/23 05:15, Kever Yang wrote:
> >>> Hi Johan,
> >>>
> >>>      I got below error report from CI test, I think it should be relate to this patch set.
> >>>
> >>> =================================== FAILURES ===================================
> >>> 1107 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1107>_________________ test_ut[ut_dm_dm_test_fdt_get_addr_ptr_flat] _________________
> >>> 1108 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1108>test/py/tests/test_ut.py:346: in test_ut
> >>> 1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assert output.endswith('Failures: 0')
> >>> 1110 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1110>E AssertionError: assert False
> >>> 1111 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1111>E + where False = <built-in method endswith of str object at 0x7f7089240c10>('Failures: 0')
> >>> 1112 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1112>E + where <built-in method endswith of str object at 0x7f7089240c10> = 'Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)\r\r\ntest/dm/test-fdt.c:627,
> >> dm_test_fdt_get_addr_ptr_fla...xpected 0000000000008000, got 0000000010009000\r\r\nTest dm_test_fdt_get_addr_ptr_flat failed 1 times\r\r\nFailures: 1'.endswith
> >>
> >> It turns out that the suggestion by Simon to use map_sysmem() doesn't work with devfdt_get_addr_index_ptr() somehow.
> >>
> >> To reproduce with this serie:
> >> make sandbox_defconfig all
> >> ./u-boot -T -c "ut dm fdt*"
> >>
> >> Test: dm_test_fdt_get_addr_ptr_flat: test-fdt.c (flat tree)
> >> test/dm/test-fdt.c:627, dm_test_fdt_get_addr_ptr_flat(): (void *)0x8000 = ptr: Expected 0000000000008000, got 0000000010009000
> >> Test fdt* failed 1 times
> >>
> >> ===
> >>
> >> Could Simon have a look at the internal map_sysmem() stuff?
> >>
> >> Will send 1 patch to replace:
> >> [PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
> >>
> >> for:
> >>
> >> [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
> >>
> >> Could Kever retest with the patch above replacement?
> >
>
> > The CI test pass with this replacement.
>
> I've sent a new separate patch that handles map_sysmem.
>
> [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return
> https://lore.kernel.org/u-boot/4990a11d-638f-661d-a7c0-e0c5bf7ff863@gmail.com/T/#u
>
> Apply after:
> [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
> with replacement:
> [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>
> Please have a look.

Yes it looks good, thanks.

Basically we try to use addresses (ulong) in U-Boot, rather than
pointers. We try to show addresses to the user as well (rather than
pointers). Same with tests.

Pointers are typically used locally, as needed, e.g. to access a
struct at that location. So in general we use map_sysmem() quite a bit
(to convert an address to a pointer), but map_to_sysmem() not very
often.

Regards,
Simon

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return
  2023-04-23  9:19   ` [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return Johan Jonker
  2023-04-24 19:42     ` Simon Glass
@ 2023-04-28 19:20     ` Simon Glass
  2023-04-28 19:26       ` Simon Glass
  1 sibling, 1 reply; 52+ messages in thread
From: Simon Glass @ 2023-04-28 19:20 UTC (permalink / raw)
  To: Simon Glass
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao, Johan Jonker

On Sun, 23 Apr 2023 at 03:19, Johan Jonker <jbx6244@gmail.com> wrote:
>
> For the devfdt_get_addr_index_ptr() and devfdt_get_addr_size_index_ptr()
> function use map_sysmem() function as cast for the return for use in
> sandbox. Also fix sandbox test.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>
> Apply after:
> [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
> with replacement:
> [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
>
> ---
>
> Changed V9:
>   New patch.
>   Split use of map_sysmem() from previous series.
> ---
>  drivers/core/fdtaddr.c | 11 +++++++++--
>  test/dm/test-fdt.c     |  5 ++++-
>  2 files changed, 13 insertions(+), 3 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

Thanks for digging into this.

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return
  2023-04-28 19:20     ` Simon Glass
@ 2023-04-28 19:26       ` Simon Glass
  2023-05-10 21:48         ` [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2) Johan Jonker
  0 siblings, 1 reply; 52+ messages in thread
From: Simon Glass @ 2023-04-28 19:26 UTC (permalink / raw)
  To: Simon Glass
  Cc: dario.binacchi, michael, philipp.tomsich, kever.yang, u-boot,
	yifeng.zhao, Johan Jonker

Hi Johan,

On Fri, 28 Apr 2023 at 13:20, Simon Glass <sjg@chromium.org> wrote:
>
> On Sun, 23 Apr 2023 at 03:19, Johan Jonker <jbx6244@gmail.com> wrote:
> >
> > For the devfdt_get_addr_index_ptr() and devfdt_get_addr_size_index_ptr()
> > function use map_sysmem() function as cast for the return for use in
> > sandbox. Also fix sandbox test.
> >
> > Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> > ---
> >
> > Apply after:
> > [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
> > with replacement:
> > [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function
> >
> > ---
> >
> > Changed V9:
> >   New patch.
> >   Split use of map_sysmem() from previous series.
> > ---
> >  drivers/core/fdtaddr.c | 11 +++++++++--
> >  test/dm/test-fdt.c     |  5 ++++-
> >  2 files changed, 13 insertions(+), 3 deletions(-)
> >
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Thanks for digging into this.
>
> Applied to u-boot-dm, thanks!

I had to drop the second hunk here since it conflicted and it looks
like it was already done upstream. Please take a look and send a
follow-up patch if needed.

Regards,
Simon

^ permalink raw reply	[flat|nested] 52+ messages in thread

* [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2)
  2023-04-28 19:26       ` Simon Glass
@ 2023-05-10 21:48         ` Johan Jonker
  2023-05-11  7:12           ` Kever Yang
  2023-05-16 15:19           ` Tom Rini
  0 siblings, 2 replies; 52+ messages in thread
From: Johan Jonker @ 2023-05-10 21:48 UTC (permalink / raw)
  To: sjg; +Cc: philipp.tomsich, kever.yang, u-boot

For the devfdt_get_addr_size_index_ptr() function use
map_sysmem() function as cast for the return for use in
sandbox.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---
 drivers/core/fdtaddr.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 3b59b70c..546db675 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -131,7 +131,10 @@ void *devfdt_get_addr_size_index_ptr(const struct udevice *dev, int index,
 {
 	fdt_addr_t addr = devfdt_get_addr_size_index(dev, index, size);

-	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
+	if (addr == FDT_ADDR_T_NONE)
+		return NULL;
+
+	return map_sysmem(addr, 0);
 }

 fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name)
--
2.20.1


^ permalink raw reply related	[flat|nested] 52+ messages in thread

* Re: [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2)
  2023-05-10 21:48         ` [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2) Johan Jonker
@ 2023-05-11  7:12           ` Kever Yang
  2023-05-11  8:03             ` Johan Jonker
  2023-05-16 15:19           ` Tom Rini
  1 sibling, 1 reply; 52+ messages in thread
From: Kever Yang @ 2023-05-11  7:12 UTC (permalink / raw)
  To: Johan Jonker, sjg; +Cc: philipp.tomsich, u-boot

Hi Johan,

     The patch v9 has merged, it will be better to send a new patch if 
more change needed,

but not a v10 patch.


Thanks,

- Kever

On 2023/5/11 05:48, Johan Jonker wrote:
> For the devfdt_get_addr_size_index_ptr() function use
> map_sysmem() function as cast for the return for use in
> sandbox.
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
>   drivers/core/fdtaddr.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
> index 3b59b70c..546db675 100644
> --- a/drivers/core/fdtaddr.c
> +++ b/drivers/core/fdtaddr.c
> @@ -131,7 +131,10 @@ void *devfdt_get_addr_size_index_ptr(const struct udevice *dev, int index,
>   {
>   	fdt_addr_t addr = devfdt_get_addr_size_index(dev, index, size);
>
> -	return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
> +	if (addr == FDT_ADDR_T_NONE)
> +		return NULL;
> +
> +	return map_sysmem(addr, 0);
>   }
>
>   fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name)
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2)
  2023-05-11  7:12           ` Kever Yang
@ 2023-05-11  8:03             ` Johan Jonker
  0 siblings, 0 replies; 52+ messages in thread
From: Johan Jonker @ 2023-05-11  8:03 UTC (permalink / raw)
  To: Kever Yang, sjg; +Cc: philipp.tomsich, u-boot



On 5/11/23 09:12, Kever Yang wrote:
> Hi Johan,
> 

>     The patch v9 has merged, it will be better to send a new patch if more change needed,

Merging logic with 2 maintainers...
This is a separate new patch for Simon.
He applied that (part 1) first, then the nfc serie was merged.
And now I must fix the lines that Simon removed to be complete.....

See comment:
https://lore.kernel.org/u-boot/11826a88-6d4a-20a1-0651-b7e2fe79cbe5@rock-chips.com/T/#mf603b1a5cdaa6612ff71674d76d4f7ff49c21a2a

Comment by Simon:
I had to drop the second hunk here since it conflicted and it looks
like it was already done upstream. Please take a look and send a
follow-up patch if needed.

Please have a look.

Johan

> 
> but not a v10 patch.
> 
> 
> Thanks,
> 
> - Kever
> 
> On 2023/5/11 05:48, Johan Jonker wrote:
>> For the devfdt_get_addr_size_index_ptr() function use
>> map_sysmem() function as cast for the return for use in
>> sandbox.
>>
>> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
>> ---
>>   drivers/core/fdtaddr.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
>> index 3b59b70c..546db675 100644
>> --- a/drivers/core/fdtaddr.c
>> +++ b/drivers/core/fdtaddr.c
>> @@ -131,7 +131,10 @@ void *devfdt_get_addr_size_index_ptr(const struct udevice *dev, int index,
>>   {
>>       fdt_addr_t addr = devfdt_get_addr_size_index(dev, index, size);
>>
>> -    return (addr == FDT_ADDR_T_NONE) ? NULL : (void *)(uintptr_t)addr;
>> +    if (addr == FDT_ADDR_T_NONE)
>> +        return NULL;
>> +
>> +    return map_sysmem(addr, 0);
>>   }
>>
>>   fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name)
>> -- 
>> 2.20.1
>>

^ permalink raw reply	[flat|nested] 52+ messages in thread

* Re: [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2)
  2023-05-10 21:48         ` [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2) Johan Jonker
  2023-05-11  7:12           ` Kever Yang
@ 2023-05-16 15:19           ` Tom Rini
  1 sibling, 0 replies; 52+ messages in thread
From: Tom Rini @ 2023-05-16 15:19 UTC (permalink / raw)
  To: Johan Jonker; +Cc: sjg, philipp.tomsich, kever.yang, u-boot

[-- Attachment #1: Type: text/plain, Size: 297 bytes --]

On Wed, May 10, 2023 at 11:48:44PM +0200, Johan Jonker wrote:

> For the devfdt_get_addr_size_index_ptr() function use
> map_sysmem() function as cast for the return for use in
> sandbox.
> 
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 52+ messages in thread

end of thread, other threads:[~2023-05-16 15:20 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13  0:23 [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
2023-03-13  0:28 ` [PATCH v8 01/24] mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr Johan Jonker
2023-03-13  0:28 ` [PATCH v8 02/24] mtd: nand: raw: rockchip_nfc: remove the compatible string "rockchip,rk3308-nfc" Johan Jonker
2023-03-13  0:28 ` [PATCH v8 03/24] mtd: nand: raw: rockchip_nfc: add layout structure Johan Jonker
2023-03-13  0:28 ` [PATCH v8 04/24] mtd: nand: raw: rockchip_nfc: add flash_node to chip structure Johan Jonker
2023-03-13  0:29 ` [PATCH v8 05/24] mtd: nand: raw: rockchip_nfc: fix oobfree offset and description Johan Jonker
2023-03-13  0:29 ` [PATCH v8 06/24] mtd: nand: add support for the Sandisk SDTNQGAMA chip Johan Jonker
2023-03-13  0:29 ` [PATCH v8 07/24] rockchip: adc: rockchip-saradc: use dev_read_addr_ptr Johan Jonker
2023-03-13  0:29 ` [PATCH v8 08/24] rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size Johan Jonker
2023-03-13  3:10   ` Simon Glass
2023-03-13  0:30 ` [PATCH v8 09/24] rockchip: pwm: rk_pwm: use base " Johan Jonker
2023-03-13  3:10   ` Simon Glass
2023-03-13  0:30 ` [PATCH v8 10/24] rockchip: spi: rk_spi: " Johan Jonker
2023-03-13  3:10   ` Simon Glass
2023-03-13  0:30 ` [PATCH v8 11/24] include: dm: ofnode: fix headers Johan Jonker
2023-03-13  0:30 ` [PATCH v8 12/24] core: remap: fix regmap_init_mem_plat() reg size handeling Johan Jonker
2023-03-13  3:10   ` Simon Glass
2023-03-13  0:30 ` [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap Johan Jonker
2023-03-13  3:10   ` Simon Glass
2023-03-13 12:15     ` Johan Jonker
2023-03-13 13:26   ` John Keeping
2023-03-13 16:53     ` Johan Jonker
2023-03-13 17:46       ` John Keeping
2023-03-13 21:09         ` Johan Jonker
2023-03-14 18:28           ` John Keeping
2023-03-13  0:31 ` [PATCH v8 14/24] core: fdtaddr: add devfdt_get_addr_size_index_ptr function Johan Jonker
2023-03-13  0:31 ` [PATCH v8 15/24] core: read: add dev_read_addr_index_ptr function Johan Jonker
2023-03-13  0:31 ` [PATCH v8 16/24] spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr Johan Jonker
2023-03-13  0:31 ` [PATCH v8 17/24] drivers: use dev_read_addr_index_ptr when cast to pointer Johan Jonker
2023-03-13  3:10   ` Simon Glass
2023-03-13  0:32 ` [PATCH v8 18/24] drivers: use dev_read_addr_ptr " Johan Jonker
2023-03-13  0:32 ` [PATCH v8 19/24] drivers: use devfdt_get_addr_size_index_ptr " Johan Jonker
2023-03-13  0:32 ` [PATCH v8 20/24] drivers: use devfdt_get_addr_index_ptr " Johan Jonker
2023-03-13  0:32 ` [PATCH v8 21/24] drivers: use devfdt_get_addr_ptr " Johan Jonker
2023-03-13  0:32 ` [PATCH v8 22/24] drivers: fix debug string with fdt_addr_t input Johan Jonker
2023-03-13  0:33 ` [PATCH v8 23/24] arm: stm32mp: spl: fix function " Johan Jonker
2023-03-13  0:33 ` [PATCH v8 24/24] include: fdtdec: decouple fdt_addr_t and phys_addr_t size Johan Jonker
2023-04-21  3:15 ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Kever Yang
2023-04-21 15:33   ` [PATCH v9] core: fdtaddr: add devfdt_get_addr_size_index_ptr function Johan Jonker
2023-04-21 15:34   ` [PATCH v8 00/24] Fixes for Rockchip NFC driver part 1 Johan Jonker
2023-04-22 20:33     ` Johan Jonker
2023-04-23  1:51     ` Kever Yang
2023-04-23  9:24       ` Johan Jonker
2023-04-24 23:33         ` Simon Glass
2023-04-23  9:19   ` [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return Johan Jonker
2023-04-24 19:42     ` Simon Glass
2023-04-28 19:20     ` Simon Glass
2023-04-28 19:26       ` Simon Glass
2023-05-10 21:48         ` [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2) Johan Jonker
2023-05-11  7:12           ` Kever Yang
2023-05-11  8:03             ` Johan Jonker
2023-05-16 15:19           ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).