From patchwork Thu Jul 9 11:17:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 241118 List-Id: U-Boot discussion From: jagan at amarulasolutions.com (Jagan Teki) Date: Thu, 9 Jul 2020 16:47:04 +0530 Subject: [PATCH 0/5] mtd: Implement MTD UCLASS (use SPINOR) Message-ID: <20200709111709.68904-1-jagan@amarulasolutions.com> This was few years backlog work of mine, and it's been blocked to various reasons of having a priority to sync Linux MTD spinor code and most of the community developers are interested in feature-based Linux MTD sync/copy than full functional MTD driver model. As years passing on to the driver model support the actual migration still seems a myth. So, let us not wait for too long to implement the basic driver model structure to MTD. So, this series implement the MTD driver model in a fully functional way with all possible dm_mtd ops and necessary API to use SPINOR. absolute spinor flow: sf.c => sf uclass => sf driver => spi-nor-core - flash operations via dm_spi_flash_ops updated spinor flow: sf.c => mtd uclass => mtd driver => spi-nor-core - flash operations via mtd_ops (dm variant) Future work: - cleanup of spi_flash with spinor - renaming of CONFIG option changes - implement common mtd probe - implement mtd flash interface types so that the respective ? commands like sf, mtd can make use of dm-mtd in the proper way. Tested on real target with SPINOR test, and Boot. Repo available at: https://gitlab.denx.de/u-boot/custodians/u-boot-spi/-/tree/mtd Any inputs? Jagan. Jagan Teki (5): mtd: spi: Drop redundent SPI flash driver mtd: Add dm-mtd core ops mtd: Add SPL_DM_MTD option mtd: Build mtd-uclass as obj mtd: spi: Switch to MTD uclass (absolute UCLASS_SPI_FLASH) arch/arm/mach-rockchip/spl-boot-order.c | 4 +- arch/x86/cpu/apollolake/spl.c | 68 +----------- arch/x86/lib/fsp2/fsp_init.c | 2 +- arch/x86/lib/fsp2/fsp_support.c | 7 +- arch/x86/lib/mrccache.c | 8 +- board/atmel/common/mac-spi-nor.c | 4 +- drivers/mtd/Kconfig | 8 ++ drivers/mtd/Makefile | 4 +- drivers/mtd/mtd-uclass.c | 38 +++++++ drivers/mtd/spi/Kconfig | 2 + drivers/mtd/spi/sandbox.c | 2 +- drivers/mtd/spi/sf-uclass.c | 135 ++++++++++-------------- drivers/mtd/spi/sf_dataflash.c | 25 +++-- include/dm/uclass-id.h | 1 - include/mtd.h | 41 +++++++ include/spi_flash.h | 65 +----------- test/dm/sf.c | 12 +-- 17 files changed, 189 insertions(+), 237 deletions(-)