Re: [U-Boot] [PATCH v3 14/20] mtd: spi: Switch to new SPI NOR framework
On Thu, Jan 31, 2019 at 6:24 PM Vignesh R wrote: > > > > On 31/01/19 6:09 PM, Jagan Teki wrote: > > On Thu, Jan 31, 2019 at 6:08 PM Vignesh R wrote: > >> > >> > >> > >> On 31/01/19 5:53 PM, Jagan Teki wrote: > >>> On Tue, Jan 29, 2019 at 11:28 AM Vignesh R wrote: > > Switch spi_flash_* interfaces to call into new SPI NOR framework via MTD > layer. Fix up sf_dataflash to work in legacy way. And update sandbox to > use new interfaces/definitions > > Signed-off-by: Vignesh R > Tested-by: Simon Goldschmidt > Tested-by: Stefan Roese > Tested-by: Horatiu Vultur > --- > drivers/mtd/spi/Kconfig| 2 + > drivers/mtd/spi/Makefile | 4 +- > drivers/mtd/spi/sandbox.c | 36 +++--- > >>> > >>> Is this sanbox changes tested? > >>> > >> > >> Here is the travis ci test pass: > >> https://travis-ci.org/r-vignesh/u-boot/builds/485749118 > >> > >> I believe that covers sandbox test as well > > > > I'm referring about dm tests that run on sandbox[1] > > > > [1] http://www.openedev.com/wiki/U-Boot#Sandbox > > > > https://travis-ci.org/r-vignesh/u-boot/jobs/485749177 Job #35.59 > > Just ran it locally: > https://pastebin.ubuntu.com/p/hgbf2Nsryn/ > > All is well. done, thanks! ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 14/20] mtd: spi: Switch to new SPI NOR framework
On 31/01/19 6:09 PM, Jagan Teki wrote: > On Thu, Jan 31, 2019 at 6:08 PM Vignesh R wrote: >> >> >> >> On 31/01/19 5:53 PM, Jagan Teki wrote: >>> On Tue, Jan 29, 2019 at 11:28 AM Vignesh R wrote: Switch spi_flash_* interfaces to call into new SPI NOR framework via MTD layer. Fix up sf_dataflash to work in legacy way. And update sandbox to use new interfaces/definitions Signed-off-by: Vignesh R Tested-by: Simon Goldschmidt Tested-by: Stefan Roese Tested-by: Horatiu Vultur --- drivers/mtd/spi/Kconfig| 2 + drivers/mtd/spi/Makefile | 4 +- drivers/mtd/spi/sandbox.c | 36 +++--- >>> >>> Is this sanbox changes tested? >>> >> >> Here is the travis ci test pass: >> https://travis-ci.org/r-vignesh/u-boot/builds/485749118 >> >> I believe that covers sandbox test as well > > I'm referring about dm tests that run on sandbox[1] > > [1] http://www.openedev.com/wiki/U-Boot#Sandbox > https://travis-ci.org/r-vignesh/u-boot/jobs/485749177 Job #35.59 Just ran it locally: https://pastebin.ubuntu.com/p/hgbf2Nsryn/ All is well. -- Regards Vignesh ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 14/20] mtd: spi: Switch to new SPI NOR framework
On Thu, Jan 31, 2019 at 6:08 PM Vignesh R wrote: > > > > On 31/01/19 5:53 PM, Jagan Teki wrote: > > On Tue, Jan 29, 2019 at 11:28 AM Vignesh R wrote: > >> > >> Switch spi_flash_* interfaces to call into new SPI NOR framework via MTD > >> layer. Fix up sf_dataflash to work in legacy way. And update sandbox to > >> use new interfaces/definitions > >> > >> Signed-off-by: Vignesh R > >> Tested-by: Simon Goldschmidt > >> Tested-by: Stefan Roese > >> Tested-by: Horatiu Vultur > >> --- > >> drivers/mtd/spi/Kconfig| 2 + > >> drivers/mtd/spi/Makefile | 4 +- > >> drivers/mtd/spi/sandbox.c | 36 +++--- > > > > Is this sanbox changes tested? > > > > Here is the travis ci test pass: > https://travis-ci.org/r-vignesh/u-boot/builds/485749118 > > I believe that covers sandbox test as well I'm referring about dm tests that run on sandbox[1] [1] http://www.openedev.com/wiki/U-Boot#Sandbox ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 14/20] mtd: spi: Switch to new SPI NOR framework
On 31/01/19 5:53 PM, Jagan Teki wrote: > On Tue, Jan 29, 2019 at 11:28 AM Vignesh R wrote: >> >> Switch spi_flash_* interfaces to call into new SPI NOR framework via MTD >> layer. Fix up sf_dataflash to work in legacy way. And update sandbox to >> use new interfaces/definitions >> >> Signed-off-by: Vignesh R >> Tested-by: Simon Goldschmidt >> Tested-by: Stefan Roese >> Tested-by: Horatiu Vultur >> --- >> drivers/mtd/spi/Kconfig| 2 + >> drivers/mtd/spi/Makefile | 4 +- >> drivers/mtd/spi/sandbox.c | 36 +++--- > > Is this sanbox changes tested? > Here is the travis ci test pass: https://travis-ci.org/r-vignesh/u-boot/builds/485749118 I believe that covers sandbox test as well -- Regards Vignesh ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH v3 14/20] mtd: spi: Switch to new SPI NOR framework
On Tue, Jan 29, 2019 at 11:28 AM Vignesh R wrote: > > Switch spi_flash_* interfaces to call into new SPI NOR framework via MTD > layer. Fix up sf_dataflash to work in legacy way. And update sandbox to > use new interfaces/definitions > > Signed-off-by: Vignesh R > Tested-by: Simon Goldschmidt > Tested-by: Stefan Roese > Tested-by: Horatiu Vultur > --- > drivers/mtd/spi/Kconfig| 2 + > drivers/mtd/spi/Makefile | 4 +- > drivers/mtd/spi/sandbox.c | 36 +++--- Is this sanbox changes tested? ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 14/20] mtd: spi: Switch to new SPI NOR framework
Switch spi_flash_* interfaces to call into new SPI NOR framework via MTD layer. Fix up sf_dataflash to work in legacy way. And update sandbox to use new interfaces/definitions Signed-off-by: Vignesh R Tested-by: Simon Goldschmidt Tested-by: Stefan Roese Tested-by: Horatiu Vultur --- drivers/mtd/spi/Kconfig| 2 + drivers/mtd/spi/Makefile | 4 +- drivers/mtd/spi/sandbox.c | 36 +++--- drivers/mtd/spi/sf_dataflash.c | 11 +- drivers/mtd/spi/sf_internal.h | 225 ++--- drivers/mtd/spi/sf_probe.c | 32 +++-- drivers/mtd/spi/spi-nor-core.c | 59 + drivers/spi/stm32_qspi.c | 4 +- include/spi_flash.h| 105 --- 9 files changed, 113 insertions(+), 365 deletions(-) diff --git a/drivers/mtd/spi/Kconfig b/drivers/mtd/spi/Kconfig index 4ba95d58b371..e3b40fc157d6 100644 --- a/drivers/mtd/spi/Kconfig +++ b/drivers/mtd/spi/Kconfig @@ -27,6 +27,8 @@ config SPI_FLASH_SANDBOX config SPI_FLASH bool "Legacy SPI Flash Interface support" + depends on SPI + select SPI_MEM help Enable the legacy SPI flash support. This will include basic standard support for things like probing, read / write, and diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile index b4c7e1c98bd5..70058d3df2b9 100644 --- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile @@ -9,7 +9,7 @@ ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_SPI_BOOT) += fsl_espi_spl.o endif -obj-$(CONFIG_SPI_FLASH) += sf_probe.o spi_flash.o spi_flash_ids.o sf.o -obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o +obj-$(CONFIG_SPI_FLASH) += sf_probe.o spi-nor-core.o +obj-$(CONFIG_SPI_FLASH_DATAFLASH) += sf_dataflash.o sf.o obj-$(CONFIG_SPI_FLASH_MTD) += sf_mtd.o obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c index 7b9891cb981c..084c66e9840b 100644 --- a/drivers/mtd/spi/sandbox.c +++ b/drivers/mtd/spi/sandbox.c @@ -92,7 +92,7 @@ struct sandbox_spi_flash { /* The current flash status (see STAT_XXX defines above) */ u16 status; /* Data describing the flash we're emulating */ - const struct spi_flash_info *data; + const struct flash_info *data; /* The file on disk to serv up data from */ int fd; }; @@ -122,7 +122,7 @@ static int sandbox_sf_probe(struct udevice *dev) /* spec = idcode:file */ struct sandbox_spi_flash *sbsf = dev_get_priv(dev); size_t len, idname_len; - const struct spi_flash_info *data; + const struct flash_info *data; struct sandbox_spi_flash_plat_data *pdata = dev_get_platdata(dev); struct sandbox_state *state = state_get_current(); struct dm_spi_slave_platdata *slave_plat; @@ -155,7 +155,7 @@ static int sandbox_sf_probe(struct udevice *dev) idname_len = strlen(spec); debug("%s: device='%s'\n", __func__, spec); - for (data = spi_flash_ids; data->name; data++) { + for (data = spi_nor_ids; data->name; data++) { len = strlen(data->name); if (idname_len != len) continue; @@ -243,43 +243,43 @@ static int sandbox_sf_process_cmd(struct sandbox_spi_flash *sbsf, const u8 *rx, sbsf->cmd = rx[0]; switch (sbsf->cmd) { - case CMD_READ_ID: + case SPINOR_OP_RDID: sbsf->state = SF_ID; sbsf->cmd = SF_ID; break; - case CMD_READ_ARRAY_FAST: + case SPINOR_OP_READ_FAST: sbsf->pad_addr_bytes = 1; - case CMD_READ_ARRAY_SLOW: - case CMD_PAGE_PROGRAM: + case SPINOR_OP_READ: + case SPINOR_OP_PP: sbsf->state = SF_ADDR; break; - case CMD_WRITE_DISABLE: + case SPINOR_OP_WRDI: debug(" write disabled\n"); sbsf->status &= ~STAT_WEL; break; - case CMD_READ_STATUS: + case SPINOR_OP_RDSR: sbsf->state = SF_READ_STATUS; break; - case CMD_READ_STATUS1: + case SPINOR_OP_RDSR2: sbsf->state = SF_READ_STATUS1; break; - case CMD_WRITE_ENABLE: + case SPINOR_OP_WREN: debug(" write enabled\n"); sbsf->status |= STAT_WEL; break; - case CMD_WRITE_STATUS: + case SPINOR_OP_WRSR: sbsf->state = SF_WRITE_STATUS; break; default: { int flags = sbsf->data->flags; /* we only support erase here */ - if (sbsf->cmd == CMD_ERASE_CHIP) { + if (sbsf->cmd == SPINOR_OP_CHIP_ERASE) { sbsf->erase_size = sbsf->data->sector_size * sbsf->data->n_sectors; - } else if (sbsf->cmd == CMD_ERASE_4K && (flags & SECT_4K)) { + } else if (sbsf->cmd == SPINOR_