spi: nxp_fspi: Fix error reporting
PATCH 1/2 spi: nxp_fspi: Fix error reporting
On the i.MX8M Mini, ret = clk_set_rate() sets ret to the value of the rate the clock was able to set. When checking for errors, it only checks that it is not NULL. Since positive numbers are not errors, only check for negative numbers when handling errors.
drivers/spi/nxp_fspi.c +2 -2
@@ -815,7 +815,7 @@ static int nxp_fspi_default_setup(struct nxp_fspi *f)/* the default frequency, we will change it later if necessary. */ ret =clk_set_rate (&f->clk,20000000 ); -if (ret) +if (ret <0 )return ret; ret =nxp_fspi_clk_prep_enable (f);
@@ -906,7 +906,7 @@ static int nxp_fspi_set_speed(struct udevice *bus, uint speed)nxp_fspi_clk_disable_unprep (f); ret =clk_set_rate (&f->clk, speed); -if (ret) +if (ret <0 )return ret; ret =nxp_fspi_clk_prep_enable (f);
Signature · 1 line
2.25.1
PATCH 2/2 spi: nxp_fspi: Enable support for nxp,imx8mm-fspi
The i.MX8M Mini can use the FlexSPI driver. Add support for it to the driver.
drivers/spi/nxp_fspi.c +9 -0
@@ -320,6 +320,14 @@ static const struct nxp_fspi_devtype_data lx2160a_data = { .little_endian = true, /* little-endian */ }; +static const struct nxp_fspi_devtype_data imx8mm_data = { + .rxfifo =SZ_512 ,/* (64 * 64 bits) */ + .txfifo =SZ_1K ,/* (128 * 64 bits) */ + .ahb_buf_size =SZ_2K ,/* (256 * 64 bits) */ + .quirks =0 , + .little_endian = true,/* little-endian */ +}; +struct nxp_fspi {struct udevice *dev;void __iomem *iobase;
@@ -985,6 +993,7 @@ static const struct dm_spi_ops nxp_fspi_ops = {static const struct udevice_id nxp_fspi_ids[] = { { .compatible ="nxp,lx2160a-fspi" , .data = (ulong)&lx2160a_data, }, + { .compatible ="nxp,imx8mm-fspi" , .data = (ulong)&imx8mm_data, }, { } };
Signature · 1 line
2.25.1
PATCH 2/2 spi: nxp_fspi: Enable support for nxp,imx8mm-fspi
Quoted 23 lines
The i.MX8M Mini can use the FlexSPI driver. Add support for it to the driver.
Signed-off-by Adam Ford <[email protected]>drivers/spi/nxp_fspi.c +8
-0@@ -320,6 +320,14 @@ static const struct nxp_fspi_devtype_data lx2160a_data = { .little_endian = true, /* little-endian */ }; +static const struct nxp_fspi_devtype_data imx8mm_data = { + .rxfifo =SZ_512 ,/* (64 * 64 bits) */ + .txfifo =SZ_1K ,/* (128 * 64 bits) */ + .ahb_buf_size =SZ_2K ,/* (256 * 64 bits) */ + .quirks =0 , + .little_endian = true,/* little-endian */ +}; +struct nxp_fspi {struct udevice *dev;void __iomem *iobase;
drivers/spi/nxp_fspi.c static const struct dm_spi_ops nxp_fspi_ops = { · line 999
Quoted 7 lines
drivers/spi/nxp_fspi.c +1
-0@@ -985,6 +993,7 @@ static const struct dm_spi_ops nxp_fspi_ops = {static const struct udevice_id nxp_fspi_ids[] = { { .compatible ="nxp,lx2160a-fspi" , .data = (ulong)&lx2160a_data, }, + { .compatible ="nxp,imx8mm-fspi" , .data = (ulong)&imx8mm_data, }, { } };
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================
PATCH 1/2 spi: nxp_fspi: Fix error reporting
In reply to Adam FordQuoted 7 lines · Adam Ford
On the i.MX8M Mini, ret =
clk_set_rate()sets ret to the value of the rate the clock was able to set. When checking for errors, it only checks that it is not NULL. Since positive numbers are not errors, only check for negative numbers when handling errors.Fixes 383fded70c4f ("spi: nxp_fspi: new driver for the FlexSPI controller")Signed-off-by Adam Ford <[email protected]>
Signature · 3 lines
Regards, Pratyush Yadav Texas Instruments India
PATCH 1/2 spi: nxp_fspi: Fix error reporting
Quoted 7 lines · Pratyush Yadav
Quoted 5 lines · Adam Ford
On the i.MX8M Mini, ret =
clk_set_rate()sets ret to the value of the rate the clock was able to set. When checking for errors, it only checks that it is not NULL. Since positive numbers are not errors, only check for negative numbers when handling errors.
Quoted 5 lines
Quoted 2 lines
Fixes 383fded70c4f ("spi: nxp_fspi: new driver for the FlexSPI controller")Signed-off-by Adam Ford <[email protected]>Reviewed-by Pratyush Yadav <[email protected]>
Jagan,
Is this something you can take, or do I need to add someone to the CC list? It's been nearly a month, and it's holding up the ability for a QSPI driver on two boards.
thanks,
adam
Quoted 4 lines
--
Regards,
Pratyush Yadav
Texas Instruments India
PATCH 1/2 spi: nxp_fspi: Fix error reporting
Quoted 12 lines · Adam Ford
Quoted 10 lines · Pratyush Yadav
Quoted 7 lines · Adam Ford
On the i.MX8M Mini, ret =
clk_set_rate()sets ret to the value of the rate the clock was able to set. When checking for errors, it only checks that it is not NULL. Since positive numbers are not errors, only check for negative numbers when handling errors.Fixes 383fded70c4f ("spi: nxp_fspi: new driver for the FlexSPI controller")Signed-off-by Adam Ford <[email protected]>
Quoted 7 lines
Quoted 2 lines
Reviewed-by Pratyush Yadav <[email protected]>Jagan,
Is this something you can take, or do I need to add someone to the CC list? It's been nearly a month, and it's holding up the ability for a QSPI driver on two boards.
Didn't find it via patchwork before, thanks for notifying me.
Applied to u-boot-spi/master