[PATCH 5/5] spi: ti_qspi: Use device APIs
Simon Glass
sjg at chromium.org
Fri May 29 09:00:47 CEST 2026
Hi Peng,
On 2026-05-27T02:35:23, Peng Fan (OSS) <peng.fan at oss.nxp.com> wrote:
> spi: ti_qspi: Use device APIs
>
> Convert the driver to use driver model APIs for phandle parsing and address
> handling instead of legacy FDT interfaces.
>
> Replace fdt_getprop() parsing of 'syscon-chipselects' with
> dev_read_phandle_with_args(), and switch address-related helpers
> from devfdt_*() to dev_read_*() variants.
>
> Also update 'num-cs' handling to use dev_read_u32_default().
>
> Remove direct dependencies on gd->fdt_blob and simplify the code while
> keeping the existing behavior.
>
> No functional changes.
>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
>
> drivers/spi/ti_qspi.c | 21 +++++++++------------
> 1 file changed, 9 insertions(+), 12 deletions(-)
> diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
> @@ -437,17 +437,16 @@ static void *map_syscon_chipselects(struct udevice *bus)
> return NULL;
> }
>
> - cell = fdt_getprop(gd->fdt_blob, dev_of_offset(bus),
> - 'syscon-chipselects', &len);
> - if (len < 2*sizeof(fdt32_t)) {
> + err = dev_read_phandle_with_args(bus, 'syscon-chipselects', NULL, 0, 0, &args);
> + if (err || args.args_count < 1) {
> debug("%s: offset not available\n", __func__);
> return NULL;
> }
>
> - return fdtdec_get_number(cell + 1, 1) + regmap_get_range(regmap, 0);
> + return args.args[0] + regmap_get_range(regmap, 0);
My reading is that passing cell_count=0 with cells_name=NULL tells the
parser there are no argument cells after the phandle, so
args.args_count comes back as 0 and the args.args_count < 1 check
always fails. Doesn't this need cell_count=1 ?:
err = dev_read_phandle_with_args(bus, 'syscon-chipselects', NULL,
1, 0, &args);
Also can you wrap to 80 columns?
Regards,
Simon
More information about the U-Boot
mailing list