Fixes for Rockchip NFC driver part 1
Subsystems (35)
v8 cover Fixes for Rockchip NFC driver part 1
This serie contains fixes for the Rockchip NFC driver, which was ported to U-boot and merged with little review and testing it seems.
Part 1 aims at passing the probe function without errors. 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
PATCH v8 1/24 mtd: nand: raw: rockchip_nfc: use dev_read_addr_ptr
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.
---
Changed V6:
use -EINVAL on return
--- drivers/mtd/nand/raw/rockchip_nfc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/rockchip_nfc.c +3 -3
@@ -1180,9 +1180,9 @@ static int rk_nfc_probe(struct udevice *dev) nfc->cfg = (void *)dev_get_driver_data (dev); nfc->dev = dev; - nfc->regs = (void *)dev_read_addr (dev); -if (IS_ERR (nfc->regs)) { - ret =PTR_ERR (nfc->regs); + nfc->regs =dev_read_addr_ptr (dev); +if (!nfc->regs) { + ret = -EINVAL ; goto release_nfc; }
--
2.20.1
PATCH v8 2/24 mtd: nand: raw: rockchip_nfc: remove the compatible string "rockchip,rk3308-nfc"
In reply to Johan JonkerThe compatible string for rk3308 has as fallback string "rockchip,rv1108-nfc". As there is no logic in probe priority between the SoC orientated string and the fall back, so remove the compatible string "rockchip,rk3308-nfc" from the driver.
--- drivers/mtd/nand/raw/rockchip_nfc.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/mtd/nand/raw/rockchip_nfc.c +0 -4
@@ -1165,10 +1165,6 @@ static const struct udevice_id rk_nfc_id_table[] = { .compatible = "rockchip,rv1108-nfc", .data = (unsigned long)&nfc_v8_cfg }, - { - .compatible = "rockchip,rk3308-nfc", - .data = (unsigned long)&nfc_v8_cfg - }, {/* sentinel */ } };
--
2.20.1
PATCH v8 3/24 mtd: nand: raw: rockchip_nfc: add layout structure
In reply to Johan JonkerThe MTD framework in U-boot is not identical for drivers ported from Linux. The rockchip_nfc driver was ported with OOB ops functions while the framework expects a layout structure per chip. Fix by adding a structure with OOB data and remove unused functions.
--- drivers/mtd/nand/raw/rockchip_nfc.c | 61 ++++++++++------------------- 1 file changed, 20 insertions(+), 41 deletions(-)
drivers/mtd/nand/raw/rockchip_nfc.c +20 -41
@@ -814,47 +814,9 @@ static void rk_nfc_disable_clks(struct rk_nfc *nfc)clk_disable_unprepare (nfc->ahb_clk); } -static int rk_nfc_ooblayout_free (struct mtd_info *mtd,int section, -struct mtd_oob_region *oob_region) -{ -struct nand_chip *chip =mtd_to_nand (mtd); -struct rk_nfc_nand_chip *rknand =rk_nfc_to_rknand (chip); - -if (section) -return -ERANGE ; - -/* -* The beginning of the OOB area stores the reserved data for the NFC, -* the size of the reserved data is NFC_SYS_DATA_SIZE bytes. -*/ - oob_region->length = rknand->metadata_size -NFC_SYS_DATA_SIZE -2 ; - oob_region->offset =NFC_SYS_DATA_SIZE +2 ; - -return 0 ; -} - -static int rk_nfc_ooblayout_ecc (struct mtd_info *mtd,int section, -struct mtd_oob_region *oob_region) -{ -struct nand_chip *chip =mtd_to_nand (mtd); -struct rk_nfc_nand_chip *rknand =rk_nfc_to_rknand (chip); - -if (section) -return -ERANGE ; - - oob_region->length = mtd->oobsize - rknand->metadata_size; - oob_region->offset = rknand->metadata_size; - -return 0 ; -} - -static const struct mtd_ooblayout_ops rk_nfc_ooblayout_ops = { - .rfree = rk_nfc_ooblayout_free, - .ecc = rk_nfc_ooblayout_ecc, -}; -static int rk_nfc_ecc_init (struct rk_nfc *nfc,struct nand_chip *chip) { +struct rk_nfc_nand_chip *rknand =rk_nfc_to_rknand (chip);const u8 *strengths = nfc->cfg->ecc_strengths;struct mtd_info *mtd =nand_to_mtd (chip);struct nand_ecc_ctrl *ecc = &chip->ecc;
@@ -892,6 +854,21 @@ static int rk_nfc_ecc_init(struct rk_nfc *nfc, struct nand_chip *chip) ecc->steps = mtd->writesize / ecc->size; ecc->bytes =DIV_ROUND_UP (ecc->strength *fls (8 * chip->ecc.size),8 ); +if (ecc->bytes * ecc->steps > mtd->oobsize - rknand->metadata_size) +return -EINVAL ; + + ecc->layout =kzalloc (sizeof (*ecc->layout),GFP_KERNEL ); +if (!ecc->layout) +return -ENOMEM ; + + ecc->layout->eccbytes = ecc->bytes * ecc->steps; + +for (i =0 ; i < ecc->layout->eccbytes; i++) + ecc->layout->eccpos[i] = rknand->metadata_size + i; + + ecc->layout->oobfree[0 ].length = rknand->metadata_size -NFC_SYS_DATA_SIZE -2 ; + ecc->layout->oobfree[0 ].offset =NFC_SYS_DATA_SIZE +2 ; +return 0 ; }
@@ -969,7 +946,6 @@ static int rk_nfc_nand_chip_init(ofnode node, struct rk_nfc *nfc, int devnum) chip->bbt_options =NAND_BBT_USE_FLASH |NAND_BBT_NO_OOB ; chip->options |=NAND_NO_SUBPAGE_WRITE |NAND_USE_BOUNCE_BUFFER ; -mtd_set_ooblayout (mtd, &rk_nfc_ooblayout_ops);rk_nfc_hw_init (nfc); ret =nand_scan_ident (mtd, nsels,NULL );if (ret)
@@ -998,13 +974,16 @@ static int rk_nfc_nand_chip_init(ofnode node, struct rk_nfc *nfc, int devnum)if (!nfc->page_buf) { nfc->page_buf =kzalloc (NFC_MAX_PAGE_SIZE ,GFP_KERNEL ); -if (!nfc->page_buf) +if (!nfc->page_buf) { +kfree (ecc->layout);return -ENOMEM ; + } }if (!nfc->oob_buf) { nfc->oob_buf =kzalloc (NFC_MAX_OOB_SIZE ,GFP_KERNEL );if (!nfc->oob_buf) { +kfree (ecc->layout);kfree (nfc->page_buf); nfc->page_buf =NULL ;return -ENOMEM ;
--
2.20.1
PATCH v8 4/24 mtd: nand: raw: rockchip_nfc: add flash_node to chip structure
In reply to Johan JonkerAdd flash_node to the rockchip_nfc driver chip structure in order to find the partitions in the add_mtd_partitions_of() function.
--- drivers/mtd/nand/raw/rockchip_nfc.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/raw/rockchip_nfc.c +1 -0
@@ -934,6 +934,7 @@ static int rk_nfc_nand_chip_init(ofnode node, struct rk_nfc *nfc, int devnum)nand_set_controller_data (chip, nfc); + chip->flash_node = node; chip->chip_delay =NFC_RB_DELAY_US ; chip->select_chip = rk_nfc_select_chip; chip->cmd_ctrl = rk_nfc_cmd;
--
2.20.1
PATCH v8 5/24 mtd: nand: raw: rockchip_nfc: fix oobfree offset and description
In reply to Johan JonkerThe MTD framework reserves 1 or 2 bytes for the bad block marker depending on the bus size. The rockchip_nfc driver currently only supports a 8 bit bus, but reserves standard 2 bytes for the BBM. The first free OOB byte is therefore OOB2 at offset 2. Page address(PA) bytes are moved to the last 4 positions before ECC. Update the description for U-boot.
--- drivers/mtd/nand/raw/rockchip_nfc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mtd/nand/raw/rockchip_nfc.c +4 -4
@@ -487,10 +487,10 @@ static int rk_nfc_write_page_raw(struct mtd_info *mtd,* * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3 * -* The rk_nfc_ooblayout_free() function already has reserved -* these 4 bytes with: +* The oobfree structure already has reserved these 4 bytes +* together with 2 bytes for BBM by reducing it's length: * -* oob_region->offset = NFC_SYS_DATA_SIZE + 2; +* oobfree[0].length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2; */ if (!i) memcpy(rk_nfc_oob_ptr(chip, i),
@@ -867,7 +867,7 @@ static int rk_nfc_ecc_init(struct rk_nfc *nfc, struct nand_chip *chip) ecc->layout->eccpos[i] = rknand->metadata_size + i; ecc->layout->oobfree[0 ].length = rknand->metadata_size -NFC_SYS_DATA_SIZE -2 ; - ecc->layout->oobfree[0 ].offset =NFC_SYS_DATA_SIZE +2 ; + ecc->layout->oobfree[0 ].offset =2 ;return 0 ; }
--
2.20.1
PATCH v8 6/24 mtd: nand: add support for the Sandisk SDTNQGAMA chip
In reply to Johan JonkerSandisk SDTNQGAMA is a 8GB size, 3.3V 8 bit chip with 16KB page size, 1KB write size and 40 bit ecc support
--- drivers/mtd/nand/raw/nand_ids.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/nand/raw/nand_ids.c +3 -0
@@ -48,6 +48,9 @@ struct nand_flash_dev nand_flash_ids[] = { {"TC58NVG6D2 64G 3.3V 8-bit" , { .id = {0x98, 0xde, 0x94, 0x82, 0x76, 0x56, 0x04, 0x20} }, SZ_8K, SZ_8K, SZ_2M, 0, 8, 640, NAND_ECC_INFO(40, SZ_1K) }, + {"SDTNQGAMA 64G 3.3V 8-bit", + { .id = {0x45, 0xde, 0x94, 0x93, 0x76, 0x57} }, + SZ_16K, SZ_8K, SZ_4M, 0, 6, 1280, NAND_ECC_INFO(40, SZ_1K) }, {"SDTNRGAMA 64G 3.3V 8-bit", { .id = {0x45, 0xde, 0x94, 0x93, 0x76, 0x50} }, SZ_16K, SZ_8K, SZ_4M, 0, 6, 1280, NAND_ECC_INFO(40, SZ_1K) },
--
2.20.1
PATCH v8 7/24 rockchip: adc: rockchip-saradc: use dev_read_addr_ptr
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled.
A 32bit CPU can expext 64-bit data from the device tree parser, so use dev_read_addr_ptr in the rockchip-saradc.c file.
As we are there also streamline the error response to -EINVAL on return.
---
Changed V6:
use -EINVAL on return
drop cast
--- drivers/adc/rockchip-saradc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/adc/rockchip-saradc.c +3 -3
@@ -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
PATCH v8 8/24 rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use a regs variable with uintptr_t size in the dw-apb-timer.c file.
---
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(-)
drivers/timer/dw-apb-timer.c +1 -1
@@ -23,7 +23,7 @@#define DW_APB_CTRL 0x8struct dw_apb_timer_priv { -fdt_addr_t regs; +uintptr_t regs;struct reset_ctl_bulk resets; };
--
2.20.1
Re: [PATCH v8 08/24] rockchip: timer: dw-apb-timer: use regs variable with uintptr_t size
Quoted 12 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use a regs variable withuintptr_tsize in thedw-apb-timer.cfile.Signed-off-by Johan Jonker <[email protected]>---
Changed V8:
useuintptr_tinstead ofphys_addr_t
Quoted 6 lines
Changed V6:
remove cast
change title--- drivers/timer/dw-apb-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v8 9/24 rockchip: pwm: rk_pwm: use base variable with uintptr_t size
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use a base variable with uintptr_t size in the rk_pwm.c file.
---
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(-)
drivers/pwm/rk_pwm.c +1 -1
@@ -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
Re: [PATCH v8 09/24] rockchip: pwm: rk_pwm: use base variable with uintptr_t size
Quoted 9 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use a base variable withuintptr_tsize in therk_pwm.cfile.Signed-off-by Johan Jonker <[email protected]>---
Quoted 8 lines
Changed V8:
useuintptr_tinstead ofphys_addr_tChanged V6:
new patch--- drivers/pwm/rk_pwm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v8 10/24 rockchip: spi: rk_spi: use base variable with uintptr_t size
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use a base variable with uintptr_t size in the rk_spi.c file.
---
Changed V8:
new patch
--- drivers/spi/rk_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/rk_spi.c +1 -1
@@ -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
Re: [PATCH v8 10/24] rockchip: spi: rk_spi: use base variable with uintptr_t size
Quoted 6 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use a base variable withuintptr_tsize in therk_spi.cfile.
Quoted 8 lines
Signed-off-by Johan Jonker <[email protected]>---
Changed V8:
new patch--- drivers/spi/rk_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
PATCH v8 11/24 include: dm: ofnode: fix headers
In reply to Johan JonkerWhen fdt_addr_t and phys_addr_t are split it turns out that the header don't match the functions, so fix the headers.
--- include/dm/ofnode.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
include/dm/ofnode.h +8 -8
@@ -678,8 +678,8 @@ int ofnode_read_size(ofnode node, const char *propname);* @size: Pointer to size of the address * Return: address, or FDT_ADDR_T_NONE if not present or invalid */ -phys_addr_t ofnode_get_addr_size_index (ofnode node,int index, -fdt_size_t *size); +fdt_addr_t ofnode_get_addr_size_index (ofnode node,int index, +fdt_size_t *size);/** * ofnode_get_addr_size_index_notrans() - get an address/size from a node
@@ -695,8 +695,8 @@ phys_addr_t ofnode_get_addr_size_index(ofnode node, int index,* @size: Pointer to size of the address * Return: address, or FDT_ADDR_T_NONE if not present or invalid */ -phys_addr_t ofnode_get_addr_size_index_notrans (ofnode node,int index, -fdt_size_t *size); +fdt_addr_t ofnode_get_addr_size_index_notrans (ofnode node,int index, +fdt_size_t *size);/** * ofnode_get_addr_index() - get an address from a node
@@ -707,7 +707,7 @@ phys_addr_t ofnode_get_addr_size_index_notrans(ofnode node, int index,* @index: Index of address to read (0 for first) * Return: address, or FDT_ADDR_T_NONE if not present or invalid */ -phys_addr_t ofnode_get_addr_index (ofnode node,int index); +fdt_addr_t ofnode_get_addr_index (ofnode node,int index);/** * ofnode_get_addr() - get an address from a node
@@ -717,7 +717,7 @@ phys_addr_t ofnode_get_addr_index(ofnode node, int index);* @node: node to read from * Return: address, or FDT_ADDR_T_NONE if not present or invalid */ -phys_addr_t ofnode_get_addr (ofnode node); +fdt_addr_t ofnode_get_addr (ofnode node);/** * ofnode_get_size() - get size from a node
@@ -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
PATCH v8 12/24 core: remap: fix regmap_init_mem_plat() reg size handeling
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convert regmap_init_mem_plat() input to 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.
---
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(-)
drivers/core/regmap.c +19 -4
@@ -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;
drivers/core/syscon-uclass.c +18 -5
@@ -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
drivers/ram/rockchip/sdram_rk3066.c +1 -1
@@ -801,7 +801,7 @@ static int rk3066_dmc_conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base));/* RK3066 supports dual-channel, set default channel num to 2. */ plat->num_channels =1 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, of_plat->reg,sizeof (of_plat->reg[0 ]),ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk3188.c +1 -1
@@ -867,7 +867,7 @@ static int conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base));/* rk3188 supports dual-channel, set default channel num to 2 */ plat->num_channels =1 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, of_plat->reg,sizeof (of_plat->reg[0 ]),ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk322x.c +1 -1
@@ -769,7 +769,7 @@ static int conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base)); plat->num_channels =1 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, of_plat->reg,sizeof (of_plat->reg[0 ]),ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk3288.c +1 -1
@@ -1029,7 +1029,7 @@ static int conv_of_plat(struct udevice *dev)memcpy (&plat->base, of_plat->rockchip_sdram_params,sizeof (plat->base));/* Rk3288 supports dual-channel, set default channel num to 2 */ plat->num_channels =2 ; - ret =regmap_init_mem_plat (dev, of_plat->reg, + ret =regmap_init_mem_plat (dev, of_plat->reg,sizeof (of_plat->reg[0 ]),ARRAY_SIZE (of_plat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk3328.c +1 -1
@@ -54,7 +54,7 @@ static int conv_of_plat(struct udevice *dev)struct dtd_rockchip_rk3328_dmc *dtplat = &plat->dtplat;int ret; - ret =regmap_init_mem_plat (dev, dtplat->reg, + ret =regmap_init_mem_plat (dev, dtplat->reg,sizeof (dtplat->reg[0 ]),ARRAY_SIZE (dtplat->reg) /2 , &plat->map);if (ret)return ret;
drivers/ram/rockchip/sdram_rk3399.c +1 -1
@@ -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;
include/regmap.h +3 -2
@@ -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);
include/syscon.h +0 -13
@@ -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
Re: [PATCH v8 12/24] core: remap: fix regmap_init_mem_plat() reg size handeling
Quoted 21 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so convertregmap_init_mem_plat()input to handel both. The syscon class driver also makes use of theregmap_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 theARRAY_SIZEdivider in the syscon class driver.Signed-off-by Johan Jonker <[email protected]>---
Changed V8:
fix commentChanged V7:
changed title
add reg size input
rework function calls
Quoted 12 lines
--- 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(-)
PATCH v8 13/24 rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
In reply to Johan JonkerThe 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.
---
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(+)
arch/arm/mach-rockchip/rk3288/syscon_rk3288.c +121 -0
@@ -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
Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
Quoted 15 lines · Johan Jonker
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 <[email protected]>---
Note:
Proof of concept not tested with rk3288 hardware, but with rk3066.
Quoted 6 lines
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
Can we sync up with Linux on the DT?
Regards,
Simon
Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
Quoted 23 lines · Simon Glass
Quoted 15 lines · Johan Jonker
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 <[email protected]>---
Note:
Proof of concept not tested with rk3288 hardware, but with rk3066.Quoted 6 lines
Changed V7:
new patch--- arch/arm/mach-rockchip/rk3288/syscon_rk3288.c | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+)
Quoted 7 lines
I tested this on
chromebook_jerrywhich usesSPL_OF_PLATDATAReviewed-by Simon Glass <[email protected]>Tested-by Simon Glass <[email protected]>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.
Quoted 3 lines
Regards,
Simon
Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
In reply to Johan JonkerQuoted 9 lines · Johan Jonker
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 <[email protected]>---
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)
Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
Quoted 8 lines · John Keeping
Quoted 7 lines · Johan Jonker
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.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Johan Jonker <[email protected]>---
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.
Quoted 4 lines
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)
Quoted 6 lines
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.
Quoted 6 lines
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
Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
Quoted 21 lines · Johan Jonker
Quoted 8 lines · John Keeping
Quoted 7 lines · Johan Jonker
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.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Johan Jonker <[email protected]>---
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.
Quoted 1 line
Quoted 6 lines
Quoted 3 lines
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_infois not there yet in the bind fase. (ie. calloc)
What about non-Rockchip SoCs using the syscon uclass?
Quoted 9 lines
Quoted 6 lines
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_SIZEand 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).
Quoted 9 lines
Quoted 5 lines
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_SIZEvariable + 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.
Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
Quoted 22 lines · John Keeping
Quoted 21 lines · Johan Jonker
Quoted 8 lines · John Keeping
Quoted 7 lines · Johan Jonker
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.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Johan Jonker <[email protected]>---
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.
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
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_infois 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.
Quoted 10 lines
What about non-Rockchip SoCs using the syscon uclass?
Quoted 7 lines
Quoted 6 lines
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),
Quoted 7 lines
Quoted 2 lines
Driver flags might solve only the "reg" size part, but not the
ARRAY_SIZEand 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.
Quoted 23 lines
Quoted 10 lines
Quoted 6 lines
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_SIZEvariable + 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_PLATDATAis makes assumptions and I don't see why that needs to be any different for 32-bit platforms with #memory-cells = <2>. Fromsyscon-uclass.c:/*
* WithOF_PLATDATAwe 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
* usingOF_PLATDATAwill need to ensure that this is true. */
Quoted 4 lines
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.
Quoted 2 lines
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.
Re: [PATCH v8 13/24] rockchip: rk3288: syscon_rk3288: store syscon platdata in regmap
Quoted 99 lines · Johan Jonker
Quoted 22 lines · John Keeping
Quoted 21 lines · Johan Jonker
Quoted 8 lines · John Keeping
Quoted 7 lines · Johan Jonker
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.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Johan Jonker <[email protected]>---
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.
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines
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_infois not there yet in the bind phase. (ie. calloc)Currently
syscon_uc_infois 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.
Quoted 10 lines
What about non-Rockchip SoCs using the syscon uclass?
Quoted 7 lines
Quoted 6 lines
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),Quoted 7 lines
Quoted 2 lines
Driver flags might solve only the "reg" size part, but not the
ARRAY_SIZEand 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.
Quoted 23 lines
Quoted 10 lines
Quoted 6 lines
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_SIZEvariable + 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_PLATDATAis makes assumptions and I don't see why that needs to be any different for 32-bit platforms with #memory-cells = <2>. Fromsyscon-uclass.c:/*
* WithOF_PLATDATAwe 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
* usingOF_PLATDATAwill need to ensure that this is true. */Quoted 4 lines
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_tdescribes the parser capability and is not the same as the size in the dtd structure.Quoted 2 lines
and the uclass gets this right.
There's no guaranty that the dtd structure is going to be like
syscon_base_platand that the reg property is first.struct syscon_base_plat { phys_addr_t reg[2]; };From
syscon.yamland 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.
Quoted 6 lines
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?
PATCH v8 14/24 core: fdtaddr: add devfdt_get_addr_size_index_ptr function
In reply to Johan JonkerAdd 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.
---
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(-)
drivers/core/fdtaddr.c +16 -1
@@ -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 )
include/dm/fdtaddr.h +16 -1
@@ -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
PATCH v8 15/24 core: read: add dev_read_addr_index_ptr function
In reply to Johan JonkerAdd 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.
---
Changed V6:
use map_sysmem()
Changed V5:
new patch
--- drivers/core/read.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/core/read.c +14 -1
@@ -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
PATCH v8 16/24 spi: spi-aspeed-smc: use devfdt_get_addr_index_ptr
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use devfdt_get_addr_index_ptr 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.
---
Changed V6:
use -EINVAL on return
--- drivers/spi/spi-aspeed-smc.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
drivers/spi/spi-aspeed-smc.c +8 -9
@@ -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
PATCH v8 17/24 drivers: use dev_read_addr_index_ptr when cast to pointer
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use 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.
---
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(-)
drivers/mtd/nand/raw/cortina_nand.c +2 -2
@@ -1175,8 +1175,8 @@ static int fdt_decode_nand(struct udevice *dev, struct nand_drv *info)int ecc_strength; info->reg = (struct nand_ctlr *)dev_read_addr (dev); - info->dma_glb = (struct dma_global *)dev_read_addr_index (dev,1 ); - info->dma_nand = (struct dma_ssp *)dev_read_addr_index (dev,2 ); + info->dma_glb =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 =
drivers/net/dm9000x.c +1 -1
@@ -651,7 +651,7 @@ static int dm9000_of_to_plat(struct udevice *dev) pdata->iobase =dev_read_addr_index (dev,0 ); db->base_io = (void __iomem *)pdata->iobase; - db->base_data = (void __iomem *)dev_read_addr_index (dev,1 ); + db->base_data =dev_read_addr_index_ptr (dev,1 );return 0 ; }
drivers/net/dwmac_meson8b.c +2 -2
@@ -41,8 +41,8 @@ static int dwmac_meson8b_of_to_plat(struct udevice *dev) {struct dwmac_meson8b_plat *pdata =dev_get_plat (dev); - pdata->regs = (void *)dev_read_addr_index (dev,1 ); -if ((fdt_addr_t )pdata->regs ==FDT_ADDR_T_NONE ) + pdata->regs =dev_read_addr_index_ptr (dev,1 ); +if (!pdata->regs)return -EINVAL ; pdata->dwmac_setup = (void *)dev_get_driver_data (dev);
drivers/pci/pcie_dw_meson.c +4 -4
@@ -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);
drivers/pci/pcie_dw_rockchip.c +4 -4
@@ -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);
drivers/watchdog/sbsa_gwdt.c +6 -6
@@ -98,13 +98,13 @@ static int sbsa_gwdt_of_to_plat(struct udevice *dev) {struct sbsa_gwdt_priv *priv =dev_get_priv (dev); - priv->reg_control = (void __iomem *)dev_read_addr_index (dev,0 ); -if (IS_ERR (priv->reg_control)) -return PTR_ERR (priv->reg_control); + priv->reg_control =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
Re: [PATCH v8 17/24] drivers: use dev_read_addr_index_ptr when cast to pointer
Quoted 14 lines · Johan Jonker
The
fdt_addr_tandphys_addr_tsize have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so usedev_read_addr_index_ptrinstead of thedev_read_addr_indexfunction in the various files in the drivers directory that cast to a pointer. As we are there also streamline the error response to-EINVALon return.Signed-off-by Johan Jonker <[email protected]>Reviewed-by Michael Trimarchi <[email protected]>---
Changed V6:
use-EINVALon return
drop cast
Quoted 8 lines
--- 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(-)
PATCH v8 18/24 drivers: use dev_read_addr_ptr when cast to pointer
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use 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.
---
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(-)
arch/arm/mach-mvebu/system-controller.c +2 -2
@@ -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 ;
doc/develop/driver-model/livetree.rst +1 -1
@@ -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
drivers/ata/dwc_ahsata.c +1 -1
@@ -912,7 +912,7 @@ int dwc_ahsata_probe(struct udevice *dev)#endif uc_priv->host_flags =ATA_FLAG_SATA |ATA_FLAG_NO_LEGACY |ATA_FLAG_MMIO |ATA_FLAG_PIO_DMA |ATA_FLAG_NO_ATAPI ; - uc_priv->mmio_base = (void __iomem *)dev_read_addr (dev); + uc_priv->mmio_base =dev_read_addr_ptr (dev);/* initialize adapter */ ret =ahci_host_init (uc_priv);
drivers/cache/cache-l2x0.c +1 -1
@@ -13,7 +13,7 @@ static void l2c310_of_parse_and_init(struct udevice *dev) {u32 tag[3 ] = {0 ,0 ,0 };u32 saved_reg, prefetch; -struct pl310_regs *regs = (struct pl310_regs *)dev_read_addr (dev); +struct pl310_regs *regs =dev_read_addr_ptr (dev);/* Disable the L2 Cache */ clrbits_le32 (®s->pl310_ctrl,L2X0_CTRL_EN );
drivers/cache/cache-v5l2.c +1 -1
@@ -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 ;
drivers/gpio/mscc_sgpio.c +1 -1
@@ -232,7 +232,7 @@ static int mscc_sgpio_probe(struct udevice *dev)debug ("probe: gpios = %d, bit-count = %d\n" , uc_priv->gpio_count, priv->bitcount); - priv->regs = (u32 __iomem *)dev_read_addr (dev); + priv->regs =dev_read_addr_ptr (dev); uc_priv->bank_name ="sgpio" ; sgpio_clrsetbits(priv, REG_SIO_CONFIG, 0,
drivers/gpio/tegra_gpio.c +2 -2
@@ -339,8 +339,8 @@ static int gpio_tegra_bind(struct udevice *parent)if (len <0 )return len; bank_count = len /3 /sizeof (u32); - ctlr = (struct gpio_ctlr *)dev_read_addr (parent); -if ((ulong )ctlr ==FDT_ADDR_T_NONE ) + ctlr =dev_read_addr_ptr (parent); +if (!ctlr) return -EINVAL; }#endif
drivers/gpio/xilinx_gpio.c +1 -1
@@ -268,7 +268,7 @@ static int xilinx_gpio_of_to_plat(struct udevice *dev)struct xilinx_gpio_plat *plat =dev_get_plat (dev);int is_dual; - plat->regs = (struct gpio_regs *)dev_read_addr (dev); + plat->regs =dev_read_addr_ptr (dev); plat->bank_max[0 ] =dev_read_u32_default (dev,"xlnx,gpio-width" ,0 ); plat->bank_input[0 ] =dev_read_u32_default (dev,"xlnx,all-inputs" ,0 );
drivers/i2c/i2c-cdns.c +2 -2
@@ -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;
drivers/i2c/tegra_i2c.c +2 -2
@@ -364,8 +364,8 @@ static int tegra_i2c_probe(struct udevice *dev) i2c_bus->id =dev_seq (dev); i2c_bus->type =dev_get_driver_data (dev); - i2c_bus->regs = (struct i2c_ctlr *)dev_read_addr (dev); -if ((ulong )i2c_bus->regs ==FDT_ADDR_T_NONE ) { + i2c_bus->regs =dev_read_addr_ptr (dev); +if (!i2c_bus->regs) {debug ("%s: Cannot get regs address\n" , __func__);return -EINVAL ; }
drivers/mmc/am654_sdhci.c +1 -1
@@ -584,7 +584,7 @@ static int am654_sdhci_of_to_plat(struct udevice *dev)int ret; host->name = dev->name; - host->ioaddr = (void *)dev_read_addr (dev); + host->ioaddr =dev_read_addr_ptr (dev); plat->non_removable =dev_read_bool (dev,"non-removable" );if (plat->flags &DLL_PRESENT ) {
drivers/mmc/davinci_mmc.c +1 -1
@@ -506,7 +506,7 @@ static int davinci_mmc_of_to_plat(struct udevice *dev)struct davinci_mmc_plat *plat =dev_get_plat (dev);struct mmc_config *cfg = &plat->cfg; - plat->reg_base = (struct davinci_mmc_regs *)dev_read_addr (dev); + plat->reg_base =dev_read_addr_ptr (dev); cfg->f_min =200000 ; cfg->f_max =25000000 ; cfg->voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
drivers/mmc/piton_mmc.c +1 -1
@@ -74,7 +74,7 @@ static int piton_mmc_ofdata_to_platdata(struct udevice *dev)struct mmc *mmc;struct blk_desc *bdesc; - priv->base_addr = (void *)dev_read_addr (dev); + priv->base_addr =dev_read_addr_ptr (dev); cfg = &plat->cfg; cfg->name ="PITON MMC" ; cfg->host_caps =MMC_MODE_8BIT ;
drivers/mmc/tegra_mmc.c +1 -1
@@ -708,7 +708,7 @@ static int tegra_mmc_probe(struct udevice *dev) cfg->b_max =CONFIG_SYS_MMC_MAX_BLK_COUNT ; - priv->reg = (void *)dev_read_addr (dev); + priv->reg =dev_read_addr_ptr (dev); ret =reset_get_by_name (dev,"sdhci" , &priv->reset_ctl);if (ret) {
drivers/mmc/zynq_sdhci.c +3 -3
@@ -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" );
drivers/mtd/nand/raw/arasan_nfc.c +1 -1
@@ -1232,7 +1232,7 @@ static int arasan_probe(struct udevice *dev)struct mtd_info *mtd;int err =-1 ; - info->reg = (struct nand_regs *)dev_read_addr (dev); + info->reg =dev_read_addr_ptr (dev); mtd =nand_to_mtd (nand_chip);nand_set_controller_data (nand_chip, &arasan->nand_ctrl);
drivers/mtd/nand/raw/cortina_nand.c +1 -1
@@ -1174,7 +1174,7 @@ static int fdt_decode_nand(struct udevice *dev, struct nand_drv *info) {int ecc_strength; - info->reg = (struct nand_ctlr *)dev_read_addr (dev); + info->reg =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);
drivers/mtd/nand/raw/mxic_nand.c +1 -1
@@ -538,7 +538,7 @@ static int mxic_nfc_probe(struct udevice *dev)ofnode child;int err; - nfc->regs = (void *)dev_read_addr (dev); + nfc->regs =dev_read_addr_ptr (dev); nfc->send_clk =devm_clk_get (dev,"send" );if (IS_ERR (nfc->send_clk))
drivers/mtd/nand/raw/tegra_nand.c +1 -1
@@ -906,7 +906,7 @@ static int fdt_decode_nand(struct udevice *dev, struct fdt_nand *config) {int err; - config->reg = (struct nand_ctlr *)dev_read_addr (dev); + config->reg =dev_read_addr_ptr (dev); config->enabled =dev_read_enabled (dev); config->width =dev_read_u32_default (dev,"nvidia,nand-width" ,8 ); err = gpio_request_by_name(dev, "nvidia,wp-gpios", 0, &config->wp_gpio,
drivers/mtd/nand/raw/zynq_nand.c +1 -1
@@ -1085,7 +1085,7 @@ static int zynq_nand_probe(struct udevice *dev)int ondie_ecc_enabled =0 ;int is_16bit_bw; - smc->reg = (struct zynq_nand_smc_regs *)dev_read_addr (dev); + smc->reg =dev_read_addr_ptr (dev); of_nand =dev_read_subnode (dev,"nand-controller@0,0" );if (!ofnode_valid (of_nand)) { of_nand =dev_read_subnode (dev,"flash@e1000000" );
drivers/net/mvmdio.c +1 -1
@@ -208,7 +208,7 @@ static int mvmdio_probe(struct udevice *dev) {struct mvmdio_priv *priv =dev_get_priv (dev); - priv->mdio_base = (void *)dev_read_addr (dev); + priv->mdio_base =dev_read_addr_ptr (dev); priv->type = (enum mvmdio_bus_type )dev_get_driver_data (dev);return 0 ;
drivers/net/qe/dm_qe_uec_phy.c +1 -1
@@ -97,7 +97,7 @@ static int qe_uec_mdio_probe(struct udevice *dev)u32 num =0 ;int ret = -ENODEV ; - priv->base = (struct ucc_mii_mng *)dev_read_addr (dev); + priv->base =dev_read_addr_ptr (dev); base = (fdt_size_t )priv->base;/*
drivers/pci/pci-aardvark.c +2 -2
@@ -983,8 +983,8 @@ static int pcie_advk_of_to_plat(struct udevice *dev)struct pcie_advk *pcie =dev_get_priv (dev);/* Get the register base address */ - pcie->base = (void *)dev_read_addr (dev); -if ((fdt_addr_t )pcie->base ==FDT_ADDR_T_NONE ) + pcie->base =dev_read_addr_ptr (dev); +if (!pcie->base)return -EINVAL ;return 0 ;
drivers/phy/allwinner/phy-sun50i-usb3.c +3 -3
@@ -149,9 +149,9 @@ static int sun50i_usb3_phy_probe(struct udevice *dev)return ret; } - priv->regs = (void __iomem *)dev_read_addr (dev); -if (IS_ERR (priv->regs)) -return PTR_ERR (priv->regs); + priv->regs =dev_read_addr_ptr (dev); +if (!priv->regs) +return -EINVAL ;return 0 ; }
drivers/phy/qcom/phy-qcom-usb-hs-28nm.c +2 -2
@@ -184,8 +184,8 @@ static int hsphy_probe(struct udevice *dev)struct hsphy_priv *priv =dev_get_priv (dev);int ret; - priv->base = (void *)dev_read_addr (dev); -if ((ulong )priv->base ==FDT_ADDR_T_NONE ) + priv->base =dev_read_addr_ptr (dev); +if (!priv->base)return -EINVAL ; ret =reset_get_by_name (dev,"phy" , &priv->phy_rst);
drivers/phy/qcom/phy-qcom-usb-ss.c +2 -2
@@ -115,8 +115,8 @@ static int ssphy_probe(struct udevice *dev)struct ssphy_priv *priv =dev_get_priv (dev);int ret; - priv->base = (void *)dev_read_addr (dev); -if ((ulong )priv->base ==FDT_ADDR_T_NONE ) + priv->base =dev_read_addr_ptr (dev); +if (!priv->base)return -EINVAL ; ret =ssphy_clk_init (dev, priv);
drivers/phy/rockchip/phy-rockchip-snps-pcie3.c +2 -2
@@ -93,8 +93,8 @@ static int rockchip_p3phy_probe(struct udevice *dev)struct udevice *syscon;int ret; - priv->mmio = (void __iomem *)dev_read_addr (dev); -if ((fdt_addr_t )priv->mmio ==FDT_ADDR_T_NONE ) + priv->mmio =dev_read_addr_ptr (dev); +if (!priv->mmio)return -EINVAL ; ret = uclass_get_device_by_phandle(UCLASS_SYSCON, dev,
drivers/phy/rockchip/phy-rockchip-typec.c +3 -3
@@ -674,9 +674,9 @@ static int rockchip_tcphy_probe(struct udevice *dev)unsigned int reg;int index, ret; - priv->reg_base = (void __iomem *)dev_read_addr (dev); -if (IS_ERR (priv->reg_base)) -return PTR_ERR (priv->reg_base); + priv->reg_base =dev_read_addr_ptr (dev); +if (!priv->reg_base) +return -EINVAL ; ret =dev_read_u32_index (dev,"reg" ,1 , ®);if (ret) {
drivers/pwm/tegra_pwm.c +1 -1
@@ -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 ; }
drivers/serial/serial_zynq.c +3 -3
@@ -259,9 +259,9 @@ static int zynq_serial_of_to_plat(struct udevice *dev) {struct zynq_uart_plat *plat =dev_get_plat (dev); - plat->regs = (struct uart_zynq *)dev_read_addr (dev); -if (IS_ERR (plat->regs)) -return PTR_ERR (plat->regs); + plat->regs =dev_read_addr_ptr (dev); +if (!plat->regs) +return -EINVAL ;return 0 ; }
drivers/spi/mpc8xxx_spi.c +1 -1
@@ -54,7 +54,7 @@ static int mpc8xxx_spi_of_to_plat(struct udevice *dev)struct clk clk;int ret; - priv->spi = (spi8xxx_t *)dev_read_addr (dev); + priv->spi =dev_read_addr_ptr (dev); ret =gpio_request_list_by_name (dev,"gpios" , priv->gpios,ARRAY_SIZE (priv->gpios),GPIOD_IS_OUT |GPIOD_ACTIVE_LOW );
drivers/spi/mscc_bb_spi.c +1 -1
@@ -217,7 +217,7 @@ static int mscc_bb_spi_probe(struct udevice *bus)debug ("%s: loaded, priv %p\n" , __func__, priv); - priv->regs = (void __iomem *)dev_read_addr (bus); + priv->regs =dev_read_addr_ptr (bus); priv->deactivate_delay_us =dev_read_u32_default (bus,"spi-deactivate-delay" ,0 );
drivers/spi/sh_qspi.c +1 -1
@@ -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 ; }
drivers/spi/spi-mxic.c +1 -1
@@ -508,7 +508,7 @@ static int mxic_spi_probe(struct udevice *bus) {struct mxic_spi_priv *priv =dev_get_priv (bus); - priv->regs = (void *)dev_read_addr (bus); + priv->regs =dev_read_addr_ptr (bus); priv->send_clk =devm_clk_get (bus,"send_clk" );if (IS_ERR (priv->send_clk))
drivers/spi/xilinx_spi.c +1 -1
@@ -114,7 +114,7 @@ static int xilinx_spi_probe(struct udevice *bus)struct xilinx_spi_priv *priv =dev_get_priv (bus);struct xilinx_spi_regs *regs = priv->regs; - priv->regs = (struct xilinx_spi_regs *)dev_read_addr (bus); + priv->regs =dev_read_addr_ptr (bus); priv->fifo_depth =dev_read_u32_default (bus,"fifo-size" ,0 );
drivers/ufs/ufs.c +1 -1
@@ -1880,7 +1880,7 @@ int ufshcd_probe(struct udevice *ufs_dev, struct ufs_hba_ops *hba_ops) hba->dev = ufs_dev; hba->ops = hba_ops; - hba->mmio_base = (void *)dev_read_addr (ufs_dev); + hba->mmio_base =dev_read_addr_ptr (ufs_dev);/* Set descriptor lengths to specification defaults */ ufshcd_def_desc_sizes (hba);
drivers/usb/host/ehci-tegra.c +1 -1
@@ -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) {
drivers/video/dw_mipi_dsi.c +2 -2
@@ -800,8 +800,8 @@ static int dw_mipi_dsi_init(struct udevice *dev, dsi->dsi_host.ops = &dw_mipi_dsi_host_ops; device->host = &dsi->dsi_host; - dsi->base = (void *)dev_read_addr (device->dev); -if ((fdt_addr_t )dsi->base ==FDT_ADDR_T_NONE ) { + dsi->base =dev_read_addr_ptr (device->dev); +if (!dsi->base) {dev_err (device->dev,"dsi dt register address error\n" );return -EINVAL ; }
drivers/video/rockchip/rk_vop.c +1 -1
@@ -446,7 +446,7 @@ int rk_vop_probe(struct udevice *dev)efi_add_memory_map (plat->base, plat->size,EFI_RESERVED_MEMORY_TYPE );#endif - priv->regs = (struct rk3288_vop *)dev_read_addr (dev); + priv->regs =dev_read_addr_ptr (dev);/* * Try all the ports until we find one that works. In practice this
drivers/video/stm32/stm32_dsi.c +2 -2
@@ -427,8 +427,8 @@ static int stm32_dsi_probe(struct udevice *dev) device->dev = dev; - priv->base = (void *)dev_read_addr (dev); -if ((fdt_addr_t )priv->base ==FDT_ADDR_T_NONE ) { + priv->base =dev_read_addr_ptr (dev); +if (!priv->base) {dev_err (dev,"dsi dt register address error\n" );return -EINVAL ; }
drivers/video/stm32/stm32_ltdc.c +2 -2
@@ -507,8 +507,8 @@ static int stm32_ltdc_probe(struct udevice *dev)ulong rate;int ret; - priv->regs = (void *)dev_read_addr (dev); -if ((fdt_addr_t )priv->regs ==FDT_ADDR_T_NONE ) { + priv->regs =dev_read_addr_ptr (dev); +if (!priv->regs) {dev_err (dev,"ltdc dt register address error\n" );return -EINVAL ; }
drivers/video/tegra124/display.c +1 -1
@@ -361,7 +361,7 @@ static int display_init(struct udevice *dev, void *lcdbase,return ret; } - dc_ctlr = (struct dc_ctlr *)dev_read_addr (dev); + dc_ctlr =dev_read_addr_ptr (dev);if (ofnode_decode_display_timing (dev_ofnode (dev),0 , timing)) {debug ("%s: Failed to decode display timing\n" , __func__);return -EINVAL ;
drivers/video/tegra124/sor.c +3 -3
@@ -765,7 +765,7 @@ int tegra_dc_sor_attach(struct udevice *dc_dev, struct udevice *dev,/* Use the first display controller */ debug ("%s\n" , __func__); - disp_ctrl = (struct dc_ctlr *)dev_read_addr (dc_dev); + disp_ctrl =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))
drivers/video/ti/tilcdc.c +2 -2
@@ -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 ; }
drivers/watchdog/cdns_wdt.c +3 -3
@@ -271,9 +271,9 @@ static int cdns_wdt_of_to_plat(struct udevice *dev) {struct cdns_wdt_priv *priv =dev_get_priv (dev); - priv->regs = (struct cdns_regs *)dev_read_addr (dev); -if (IS_ERR (priv->regs)) -return PTR_ERR (priv->regs); + priv->regs =dev_read_addr_ptr (dev); +if (!priv->regs) +return -EINVAL ; priv->rst =dev_read_bool (dev,"reset-on-timeout" );
drivers/watchdog/sp805_wdt.c +3 -3
@@ -116,9 +116,9 @@ static int sp805_wdt_of_to_plat(struct udevice *dev)struct sp805_wdt_priv *priv =dev_get_priv (dev);struct clk clk; - priv->reg = (void __iomem *)dev_read_addr (dev); -if (IS_ERR (priv->reg)) -return PTR_ERR (priv->reg); + priv->reg =dev_read_addr_ptr (dev); +if (!priv->reg) +return -EINVAL ;if (!clk_get_by_index (dev,0 , &clk)) priv->clk_rate =clk_get_rate (&clk);
drivers/watchdog/xilinx_tb_wdt.c +3 -3
@@ -94,9 +94,9 @@ static int xlnx_wdt_of_to_plat(struct udevice *dev) {struct xlnx_wdt_plat *plat =dev_get_plat (dev); - plat->regs = (struct watchdog_regs *)dev_read_addr (dev); -if (IS_ERR (plat->regs)) -return PTR_ERR (plat->regs); + plat->regs =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
PATCH v8 19/24 drivers: use devfdt_get_addr_size_index_ptr when cast to pointer
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use devfdt_get_addr_size_index_ptr instead of the devfdt_get_addr_size_index function in the various files in the drivers directory that cast to a pointer.
--- drivers/pci/pcie_dw_mvebu.c | 6 +++--- drivers/spi/cadence_qspi.c | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/pci/pcie_dw_mvebu.c +3 -3
@@ -569,9 +569,9 @@ static int pcie_dw_mvebu_of_to_plat(struct udevice *dev)return -EINVAL ;/* Get the config space base address and size */ - pcie->cfg_base = (void *)devfdt_get_addr_size_index (dev,1 , - &pcie->cfg_size); -if ((fdt_addr_t )pcie->cfg_base ==FDT_ADDR_T_NONE ) + pcie->cfg_base =devfdt_get_addr_size_index_ptr (dev,1 , + &pcie->cfg_size); +if (!pcie->cfg_base)return -EINVAL ;return 0 ;
drivers/spi/cadence_qspi.c +1 -2
@@ -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
PATCH v8 20/24 drivers: use devfdt_get_addr_index_ptr when cast to pointer
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use devfdt_get_addr_index_ptr instead of the devfdt_get_addr_index function in the various files in the drivers directory that cast to a pointer. As we are there also streamline the error response to -EINVAL on return.
---
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(-)
drivers/clk/clk-hsdk-cgu.c +2 -2
@@ -753,11 +753,11 @@ static int hsdk_cgu_clk_probe(struct udevice *dev)else hsdk_clk->map = hsdk_4xd_clk_map; - hsdk_clk->cgu_regs = (void __iomem *)devfdt_get_addr_index (dev,0 ); + hsdk_clk->cgu_regs =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 ;
drivers/ddr/altera/sdram_gen5.c +2 -2
@@ -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 ; }
drivers/mmc/xenon_sdhci.c +1 -1
@@ -537,7 +537,7 @@ static int xenon_sdhci_of_to_plat(struct udevice *dev) host->ioaddr =dev_read_addr_ptr (dev);if (device_is_compatible (dev,"marvell,armada-3700-sdhci" )) - priv->pad_ctrl_reg = (void *)devfdt_get_addr_index (dev,1 ); + priv->pad_ctrl_reg =devfdt_get_addr_index_ptr (dev,1 ); name =fdt_getprop (gd->fdt_blob,dev_of_offset (dev),"marvell,pad-type" ,NULL );
drivers/net/mvpp2.c +12 -12
@@ -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 );
drivers/pci/pcie_dw_mvebu.c +2 -2
@@ -564,8 +564,8 @@ static int pcie_dw_mvebu_of_to_plat(struct udevice *dev)struct pcie_dw_mvebu *pcie =dev_get_priv (dev);/* Get the controller base address */ - pcie->ctrl_base = (void *)devfdt_get_addr_index (dev,0 ); -if ((fdt_addr_t )pcie->ctrl_base ==FDT_ADDR_T_NONE ) + pcie->ctrl_base =devfdt_get_addr_index_ptr (dev,0 ); +if (!pcie->ctrl_base)return -EINVAL ;/* Get the config space base address and size */
drivers/pci/pcie_imx.c +2 -2
@@ -751,8 +751,8 @@ static int imx_pcie_of_to_plat(struct udevice *dev) {struct imx_pcie_priv *priv =dev_get_priv (dev); - priv->dbi_base = (void __iomem *)devfdt_get_addr_index (dev,0 ); - priv->cfg_base = (void __iomem *)devfdt_get_addr_index (dev,1 ); + priv->dbi_base =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 ;
drivers/pci/pcie_layerscape_ep.c +4 -4
@@ -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",
drivers/phy/marvell/comphy_core.c +6 -6
@@ -88,13 +88,13 @@ static int comphy_probe(struct udevice *dev)int res;/* Save base addresses for later use */ - chip_cfg->comphy_base_addr = (void *)devfdt_get_addr_index (dev,0 ); -if (IS_ERR (chip_cfg->comphy_base_addr)) -return PTR_ERR (chip_cfg->comphy_base_addr); + chip_cfg->comphy_base_addr =devfdt_get_addr_index_ptr (dev,0 ); +if (!chip_cfg->comphy_base_addr) +return -EINVAL ; - chip_cfg->hpipe3_base_addr = (void *)devfdt_get_addr_index (dev,1 ); -if (IS_ERR (chip_cfg->hpipe3_base_addr)) -return PTR_ERR (chip_cfg->hpipe3_base_addr); + chip_cfg->hpipe3_base_addr =devfdt_get_addr_index_ptr (dev,1 ); +if (!chip_cfg->hpipe3_base_addr) +return -EINVAL ;if (device_is_compatible (dev,"marvell,comphy-a3700" )) { chip_cfg->comphy_init_map = comphy_a3700_init_serdes_map;
drivers/spi/cadence_qspi.c +1 -1
@@ -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 );
drivers/usb/musb-new/ti-musb.c +1 -1
@@ -88,7 +88,7 @@ static int ti_musb_of_to_plat(struct udevice *dev)int usb_index;struct musb_hdrc_config *musb_config; - plat->base = (void *)devfdt_get_addr_index (dev,1 ); + plat->base =devfdt_get_addr_index_ptr (dev,1 ); phys =fdtdec_lookup_phandle (fdt, node,"phys" ); ctrl_mod =fdtdec_lookup_phandle (fdt, phys,"ti,ctrl_mod" );
--
2.20.1
PATCH v8 21/24 drivers: use devfdt_get_addr_ptr when cast to pointer
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so use devfdt_get_addr_ptr instead of the devfdt_get_addr function in the various files in the drivers directory that cast to a pointer.
---
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(-)
drivers/clk/at91/sama7g5.c +1 -1
@@ -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 ];
drivers/clk/at91/sckc.c +1 -1
@@ -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;
drivers/spi/mtk_snor.c +1 -1
@@ -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 ;
drivers/spi/mtk_spim.c +1 -1
@@ -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
PATCH v8 22/24 drivers: fix debug string with fdt_addr_t input
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so fix some debug strings with fdt_addr_t to be able to handle both sizes.
---
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(-)
arch/arm/mach-mvebu/cpu.c +1 -1
@@ -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);
drivers/clk/ti/clk-ctrl.c +5 -4
@@ -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 ;
drivers/phy/phy-stm32-usbphyc.c +2 -2
@@ -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
PATCH v8 23/24 arm: stm32mp: spl: fix function with fdt_addr_t input
In reply to Johan JonkerThe fdt_addr_t and phys_addr_t size have been decoupled. A 32bit CPU can expect 64-bit data from the device tree parser, so 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.
---
Changed V7:
remove cast
--- arch/arm/mach-stm32mp/spl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-stm32mp/spl.c +1 -1
@@ -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
PATCH v8 24/24 include: fdtdec: decouple fdt_addr_t and phys_addr_t size
In reply to Johan JonkerThe 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.
---
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(-)
Kconfig +8 -0
@@ -422,11 +422,19 @@ endif # EXPERT config PHYS_64BIT bool "64bit physical address support" + select FDT_64BIT help Say Y here to support 64bit physical memory address. This can be used not only for 64bit SoCs, but also for large physical address extension on 32bit SoCs. +config FDT_64BIT + bool "64bit fdt address support" + help + Say Y here to support 64bit fdt addresses. + This can be used not only for 64bit SoCs, but also + for large address extensions on 32bit SoCs. + config HAS_ROM bool select BINMAN
include/fdtdec.h +9 -4
@@ -18,15 +18,18 @@#include <pci.h> /* -* A typedef for a physical address. Note that fdt data is always big +* Support for 64bit fdt addresses. +* This can be used not only for 64bit SoCs, but also +* for large address extensions on 32bit SoCs. +* Note that fdt data is always big * endian even on a litle endian machine. */ -typedef phys_addr_t fdt_addr_t ; -typedef phys_size_t fdt_size_t ;#define FDT_SIZE_T_NONE (-1U) -#ifdef CONFIG_PHYS_64BIT +#ifdef CONFIG_FDT_64BIT +typedef u64 fdt_addr_t ; +typedef u64 fdt_size_t ;#define FDT_ADDR_T_NONE ((ulong)(-1))#define fdt_addr_to_cpu (reg) be64_to_cpu(reg)
@@ -35,6 +38,8 @@ typedef phys_size_t fdt_size_t;#define cpu_to_fdt_size (reg) cpu_to_be64(reg)typedef fdt64_t fdt_val_t ;#else +typedef u32 fdt_addr_t ; +typedef u32 fdt_size_t ;#define FDT_ADDR_T_NONE (-1U)#define fdt_addr_to_cpu (reg) be32_to_cpu(reg)
--
2.20.1
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
Quoted 170 lines · Johan Jonker
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 missingflash_nodepointer
add missing chip IDChanged V8:
change comments
useuintptr_tsize instead ofphys_addr_t
add anotherfdt_addr_tfixChanged V7:
add proof of concept for syscon node with variable reg size handling use anothermap_sysmem()function as cast
remove castChanged V6:
use-EINVALon return
drop cast
usemap_sysmem()function as cast
add and rename patchChanged V5:
sort patch order
add more fixes with pointer functions
add debug text fixes
test with binman for ARM only due to limited resourcesChanged V4:
fix cast and divider insyscon-uclass.cChanged V3:
usedev_read_addr_ptr
fix oobfreeJohan Jonker (23):
mtd: nand: raw:rockchip_nfc: usedev_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: addflash_nodeto chip structure
mtd: nand: raw:rockchip_nfc: fix oobfree offset and description
rockchip: adc: rockchip-saradc: usedev_read_addr_ptr
rockchip: timer: dw-apb-timer: use regs variable withuintptr_tsize
rockchip: pwm:rk_pwm: use base variable withuintptr_tsize
rockchip: spi:rk_spi: use base variable withuintptr_tsize
include: dm: ofnode: fix headers
core: remap: fixregmap_init_mem_plat()reg size handeling
rockchip: rk3288:syscon_rk3288: store syscon platdata in regmap
core: fdtaddr: adddevfdt_get_addr_size_index_ptrfunction
core: read: adddev_read_addr_index_ptrfunction
spi: spi-aspeed-smc: usedevfdt_get_addr_index_ptr
drivers: usedev_read_addr_index_ptrwhen cast to pointer
drivers: usedev_read_addr_ptrwhen cast to pointer
drivers: usedevfdt_get_addr_size_index_ptrwhen cast to pointer
drivers: usedevfdt_get_addr_index_ptrwhen cast to pointer
drivers: usedevfdt_get_addr_ptrwhen cast to pointer
drivers: fix debug string withfdt_addr_tinput
arm: stm32mp: spl: fix function withfdt_addr_tinput
include: fdtdec: decouplefdt_addr_tandphys_addr_tsizePaweł Jarosz (1):
mtd: nand: add support for the Sandisk SDTNQGAMA chipKconfig | 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
PATCH v9 1/1 core: fdtaddr: add devfdt_get_addr_size_index_ptr function
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.
---
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(-)
drivers/core/fdtaddr.c +8 -0
@@ -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 )
include/dm/fdtaddr.h +16 -1
@@ -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
Quoted 11 lines · Kever Yang
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: intest_ut
1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assertoutput.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 at0x7f7089240c10> = '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
Quoted 175 lines
Thanks,
- KeverQuoted 170 lines · Johan Jonker
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 missingflash_nodepointer
add missing chip IDChanged V8:
change comments
useuintptr_tsize instead ofphys_addr_t
add anotherfdt_addr_tfixChanged V7:
add proof of concept for syscon node with variable reg size handling use anothermap_sysmem()function as cast
remove castChanged V6:
use-EINVALon return
drop cast
usemap_sysmem()function as cast
add and rename patchChanged V5:
sort patch order
add more fixes with pointer functions
add debug text fixes
test with binman for ARM only due to limited resourcesChanged V4:
fix cast and divider insyscon-uclass.cChanged V3:
usedev_read_addr_ptr
fix oobfreeJohan Jonker (23):
mtd: nand: raw:rockchip_nfc: usedev_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: addflash_nodeto chip structure
mtd: nand: raw:rockchip_nfc: fix oobfree offset and description
rockchip: adc: rockchip-saradc: usedev_read_addr_ptr
rockchip: timer: dw-apb-timer: use regs variable withuintptr_tsize
rockchip: pwm:rk_pwm: use base variable withuintptr_tsize
rockchip: spi:rk_spi: use base variable withuintptr_tsize
include: dm: ofnode: fix headers
core: remap: fixregmap_init_mem_plat()reg size handeling
rockchip: rk3288:syscon_rk3288: store syscon platdata in regmap
core: fdtaddr: adddevfdt_get_addr_size_index_ptrfunction
core: read: adddev_read_addr_index_ptrfunction
spi: spi-aspeed-smc: usedevfdt_get_addr_index_ptr
drivers: usedev_read_addr_index_ptrwhen cast to pointer
drivers: usedev_read_addr_ptrwhen cast to pointer
drivers: usedevfdt_get_addr_size_index_ptrwhen cast to pointer
drivers: usedevfdt_get_addr_index_ptrwhen cast to pointer
drivers: usedevfdt_get_addr_ptrwhen cast to pointer
drivers: fix debug string withfdt_addr_tinput
arm: stm32mp: spl: fix function withfdt_addr_tinput
include: fdtdec: decouplefdt_addr_tandphys_addr_tsizePaweł Jarosz (1):
mtd: nand: add support for the Sandisk SDTNQGAMA chipKconfig | 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
Quoted 23 lines · Johan Jonker
Quoted 11 lines · Kever Yang
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: intest_ut
1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assertoutput.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 at0x7f7089240c10> = '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_flatfailed 1 times\r\r\nFailures: 1'.endswithIt turns out that the suggestion by Simon to use
map_sysmem()doesn't work withdevfdt_get_addr_index_ptr()somehow.To reproduce with this serie:
makesandbox_defconfigall
./u-boot -T -c "ut dm fdt*"
Quoted 8 lines
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.
Quoted 1 line
+ 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);
Quoted 9 lines
Will send 1 patch to replace:
[PATCH v8 14/24] core: fdtaddr: adddevfdt_get_addr_size_index_ptrfunctionfor:
[PATCH v9] core: fdtaddr: add
devfdt_get_addr_size_index_ptrfunction
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??
Quoted 181 lines
Could Kever retest with the patch above replacement?
Johan
Quoted 175 lines
Thanks,
- KeverQuoted 170 lines · Johan Jonker
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 missingflash_nodepointer
add missing chip IDChanged V8:
change comments
useuintptr_tsize instead ofphys_addr_t
add anotherfdt_addr_tfixChanged V7:
add proof of concept for syscon node with variable reg size handling use anothermap_sysmem()function as cast
remove castChanged V6:
use-EINVALon return
drop cast
usemap_sysmem()function as cast
add and rename patchChanged V5:
sort patch order
add more fixes with pointer functions
add debug text fixes
test with binman for ARM only due to limited resourcesChanged V4:
fix cast and divider insyscon-uclass.cChanged V3:
usedev_read_addr_ptr
fix oobfreeJohan Jonker (23):
mtd: nand: raw:rockchip_nfc: usedev_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: addflash_nodeto chip structure
mtd: nand: raw:rockchip_nfc: fix oobfree offset and description
rockchip: adc: rockchip-saradc: usedev_read_addr_ptr
rockchip: timer: dw-apb-timer: use regs variable withuintptr_tsize
rockchip: pwm:rk_pwm: use base variable withuintptr_tsize
rockchip: spi:rk_spi: use base variable withuintptr_tsize
include: dm: ofnode: fix headers
core: remap: fixregmap_init_mem_plat()reg size handeling
rockchip: rk3288:syscon_rk3288: store syscon platdata in regmap
core: fdtaddr: adddevfdt_get_addr_size_index_ptrfunction
core: read: adddev_read_addr_index_ptrfunction
spi: spi-aspeed-smc: usedevfdt_get_addr_index_ptr
drivers: usedev_read_addr_index_ptrwhen cast to pointer
drivers: usedev_read_addr_ptrwhen cast to pointer
drivers: usedevfdt_get_addr_size_index_ptrwhen cast to pointer
drivers: usedevfdt_get_addr_index_ptrwhen cast to pointer
drivers: usedevfdt_get_addr_ptrwhen cast to pointer
drivers: fix debug string withfdt_addr_tinput
arm: stm32mp: spl: fix function withfdt_addr_tinput
include: fdtdec: decouplefdt_addr_tandphys_addr_tsizePaweł Jarosz (1):
mtd: nand: add support for the Sandisk SDTNQGAMA chipKconfig | 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
Hi Johan,
Quoted 29 lines · Johan Jonker
Quoted 11 lines · Kever Yang
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: intest_ut
1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assertoutput.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 at0x7f7089240c10> = '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_flatfailed 1 times\r\r\nFailures: 1'.endswithIt turns out that the suggestion by Simon to use
map_sysmem()doesn't work withdevfdt_get_addr_index_ptr()somehow.To reproduce with this serie:
makesandbox_defconfigall
./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?
Quoted 8 lines
Will send 1 patch to replace:
[PATCH v8 14/24] core: fdtaddr: adddevfdt_get_addr_size_index_ptrfunctionfor:
[PATCH v9] core: fdtaddr: add
devfdt_get_addr_size_index_ptrfunctionCould Kever retest with the patch above replacement?
The CI test pass with this replacement.
Thanks,
- Kever
Quoted 35 lines · Kever Yang
Hi Johan,
Quoted 32 lines · Johan Jonker
Quoted 11 lines · Kever Yang
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: intest_ut
1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assertoutput.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 at0x7f7089240c10> = '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_flatfailed 1 times\r\r\nFailures: 1'.endswithIt turns out that the suggestion by Simon to use
map_sysmem()doesn't work withdevfdt_get_addr_index_ptr()somehow.To reproduce with this serie:
makesandbox_defconfigall
./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: adddevfdt_get_addr_size_index_ptrfunction
Quoted 8 lines
Quoted 5 lines
for:
[PATCH v9] core: fdtaddr: add
devfdt_get_addr_size_index_ptrfunctionCould 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/[email protected]/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
Quoted 6 lines
Thanks,
- Kever
Hi Johan,
Quoted 53 lines · Johan Jonker
Quoted 35 lines · Kever Yang
Hi Johan,
Quoted 32 lines · Johan Jonker
Quoted 11 lines · Kever Yang
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: intest_ut
1109 <https://source.denx.de/u-boot/custodians/u-boot-rockchip/-/jobs/615291#L1109>assertoutput.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 at0x7f7089240c10> = '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_flatfailed 1 times\r\r\nFailures: 1'.endswithIt turns out that the suggestion by Simon to use
map_sysmem()doesn't work withdevfdt_get_addr_index_ptr()somehow.To reproduce with this serie:
makesandbox_defconfigall
./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: adddevfdt_get_addr_size_index_ptrfunctionQuoted 8 lines
Quoted 5 lines
for:
[PATCH v9] core: fdtaddr: add
devfdt_get_addr_size_index_ptrfunctionCould 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/[email protected]/T/#u
Quoted 6 lines
Apply after:
[PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
with replacement:
[PATCH v9] core: fdtaddr: adddevfdt_get_addr_size_index_ptrfunctionPlease 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
PATCH v9 1/1 core: fdtaddr: use map_sysmem() as cast for the return
In reply to Kever YangFor 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.
---
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(-)
drivers/core/fdtaddr.c +9 -2
@@ -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)
test/dm/test-fdt.c +4 -1
@@ -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
Re: [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return
Quoted 15 lines · Johan Jonker
For the
devfdt_get_addr_index_ptr()anddevfdt_get_addr_size_index_ptr()function usemap_sysmem()function as cast for the return for use in sandbox. Also fix sandbox test.Signed-off-by Johan Jonker <[email protected]>---
Apply after:
[PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
with replacement:
[PATCH v9] core: fdtaddr: adddevfdt_get_addr_size_index_ptrfunction---
Quoted 8 lines
Changed V9:
New patch.
Split use ofmap_sysmem()from previous series.--- drivers/core/fdtaddr.c | 11 +++++++++-- test/dm/test-fdt.c | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-)
Thanks for digging into this.
Simon Glass
Reviewed-byRe: [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return
Quoted 15 lines · Johan Jonker
For the
devfdt_get_addr_index_ptr()anddevfdt_get_addr_size_index_ptr()function usemap_sysmem()function as cast for the return for use in sandbox. Also fix sandbox test.Signed-off-by Johan Jonker <[email protected]>---
Apply after:
[PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
with replacement:
[PATCH v9] core: fdtaddr: adddevfdt_get_addr_size_index_ptrfunction---
Quoted 8 lines
Changed V9:
New patch.
Split use ofmap_sysmem()from previous series.--- drivers/core/fdtaddr.c | 11 +++++++++-- test/dm/test-fdt.c | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-)
Thanks for digging into this.
Applied to u-boot-dm, thanks!
Re: [PATCH v9] core: fdtaddr: use map_sysmem() as cast for the return
Hi Johan,
Quoted 26 lines · Simon Glass
Quoted 15 lines · Johan Jonker
For the
devfdt_get_addr_index_ptr()anddevfdt_get_addr_size_index_ptr()function usemap_sysmem()function as cast for the return for use in sandbox. Also fix sandbox test.Signed-off-by Johan Jonker <[email protected]>---
Apply after:
[PATCH v8 00/24] Fixes for Rockchip NFC driver part 1
with replacement:
[PATCH v9] core: fdtaddr: adddevfdt_get_addr_size_index_ptrfunction---
Quoted 8 lines
Changed V9:
New patch.
Split use ofmap_sysmem()from previous series.--- drivers/core/fdtaddr.c | 11 +++++++++-- test/dm/test-fdt.c | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-)
Quoted 5 lines
Reviewed-by Simon Glass <[email protected]>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
PATCH v10 1/1 core: fdtaddr: use map_sysmem() as cast for the return (part 2)
For the devfdt_get_addr_size_index_ptr() function use map_sysmem() function as cast for the return for use in sandbox.
--- drivers/core/fdtaddr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/core/fdtaddr.c +4 -1
@@ -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
Re: [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2)
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
Quoted 28 lines · Johan Jonker
For the
devfdt_get_addr_size_index_ptr()function usemap_sysmem()function as cast for the return for use in sandbox.Signed-off-by Johan Jonker <[email protected]>--- drivers/core/fdtaddr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/core/fdtaddr.c +4
-2@@ -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
Re: [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2)
Quoted 4 lines · Kever Yang
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/[email protected]/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
Quoted 37 lines
but not a v10 patch.
Thanks,
- Kever
Quoted 28 lines · Johan Jonker
For the
devfdt_get_addr_size_index_ptr()function usemap_sysmem()function as cast for the return for use in sandbox.Signed-off-by Johan Jonker <[email protected]>---
drivers/core/fdtaddr.c| 5 ++++-1 file changed, 4 insertions(+), 1 deletion(-)drivers/core/fdtaddr.c +4
-1@@ -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)Signature · 1 line
2.20.1
Re: [PATCH v10] core: fdtaddr: use map_sysmem() as cast for the return (part 2)
In reply to Johan JonkerQuoted 5 lines · Johan Jonker
For the
devfdt_get_addr_size_index_ptr()function usemap_sysmem()function as cast for the return for use in sandbox.Signed-off-by Johan Jonker <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom