From patchwork Thu Jul 9 11:17:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1468 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id B1A1D3F062 for ; Thu, 9 Jul 2020 13:18:03 +0200 (CEST) Received: by mail-pj1-f71.google.com with SMTP id a6sf1278367pjd.4 for ; Thu, 09 Jul 2020 04:18:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1594293481; cv=pass; d=google.com; s=arc-20160816; b=xsKQk9bPgRogy3WAgoRkAmO8pDLTgerJfQTfg/ruqMetKVC9sCsRJtCtIo21Qbjd4o bOiEDl0oCtKY+qKW815UGvzKwmV7Yz0Rdph1tHuIIMP3AXUgBWQjreLGFprZS441DndQ D9MoSMR0qxPRLKAjr8VWEeds9/rn+BVLXU3rc2JqvNNLaI2EbWRSCsbZF4AkwIAiM9xm aAU6XkgbSrV/0tGqUCDnBZViuWI1yHl1vJJ4tViNPT+UaEE9xqs+D+3Z/KBR+SWyya6Q DmG1xm8Q82HF39fRgPGLeVlHtiSV6XG4VQJ4W6XaFGONM0K1FYTP/I1GHFsU2Cmd4oEB oEOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=O4oPFG0WzdV5+FoLX+CIztYpCOZ2Ztc6J8BR/xB8TZA=; b=fYAVhnDBfiPgdvb+cNgJl8tdCcA7JS+K9ZBSrDqdInurGlWwP0JB9I9+vxf94/bPwG m/DYb3ohV+Uh+jQWW9GVMoKfAMMprKlG7R5YWQajqiVjYqhn2oy0/wlbkirGMIyzCcvt yn5ihqxy+I0S8tqyYkxYpyx0no1YEu9MPr0JpJNynTLR70XdUleF2VmePPuegAzf4Ru/ PfJtM/pktpFL0mIKB8oq+0CdId/vMWNRec0GCq+0OeKPmn/XBpje3IQL9e4Z6d+KPiTM wdw/pNnfp5K65bnsieBZ5xVawmnCbbfrIVP4wIrM85ccZagCbko/J2DruZROQcc4Tpkl fMmQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZXJLM+kq; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=O4oPFG0WzdV5+FoLX+CIztYpCOZ2Ztc6J8BR/xB8TZA=; b=BmTHuqAjmoolgzvGwCE8/3gm9XLG5py++x9gih8fpWhLP66PQX9a4fqF790Y/xYF1u HfQIcwc20Y81dQrVmp5S1un5X55jnJd8POoh7gUO85oWubHgK1043PZSIa3IVg4hLi3a XiJ1rCW4ZFVfWoeCS+7WCU7de1hTrpoORGwFU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=O4oPFG0WzdV5+FoLX+CIztYpCOZ2Ztc6J8BR/xB8TZA=; b=FRpt/ODCUYJKTgCu1RzcUivwYVD4JYiwpT1Sp2/4vvuHdc/N3ria1dFHbg9sjWmxPT E3XDKQ3Wv3BW1wDregcsU3fMp6KwjYA6vbXXlBsR6qHx1Ti+2RiujGnDZrt2SK1/ufJZ Z7Glc1dFdvls9ZP8P6/F2H7CqfdpoHPHUcDLQY4wk3HN9DaC2RXwLP38+dpJcVswxbOi MI3ihs2zLM/s1NHEMMSHS2nqIryt3m9gNoGItWctRuzs5vw9Lj4bizSbDgnVG/C7HrgK bs+DV0h/kWIgm7CwEh5EtO32KKbrq4qpAIEl3BUV6kMhmA+3ZNU150cQc6z1qdmKsKN4 iWdg== X-Gm-Message-State: AOAM530FrLQ2NhACvey+Vews1LwpPaPcklacA12VvCMVctUpMcwFfFqc zKf7DlOd6JPnFaEAnIp0fAjlmPU7 X-Google-Smtp-Source: ABdhPJxJSOBoT5rZNDbL0QCgR7+UUOdbQW5HT4ec6X6m/K4fRKHzFURK/ALBi08YnfbZM09KQrnumQ== X-Received: by 2002:a63:6fc7:: with SMTP id k190mr50965575pgc.54.1594293481213; Thu, 09 Jul 2020 04:18:01 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:aa7:864e:: with SMTP id a14ls1820647pfo.7.gmail; Thu, 09 Jul 2020 04:18:00 -0700 (PDT) X-Received: by 2002:a63:cb03:: with SMTP id p3mr52765467pgg.444.1594293480707; Thu, 09 Jul 2020 04:18:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594293480; cv=none; d=google.com; s=arc-20160816; b=zJG5PvMB4J4/awZld38cOBnw+p/bEhnwRMz9FEYrOE3wZJjam+U0fuYzue/P8wLdwv ZyvyR1sTUuIuHbO4jmI4SLkPTQfTP7joy/YSGoAaMeS5yg7GmONFjMHZRy+tiBXhyXdK QoKiR187Ge2vP9eLKG1gQYfDrtChA5HzX9AI365cqc6UOsO1xNmdtyPY6AXjoqNtLfJu sX2eFsBIFP+7a4XvVblt+nQq5pne/gPfuNNhw1Utiz+Ka6GGNQSb9GZVVBrhmzK/m2v6 3ZB43BhdnzPcPWpC5oN0KhoPStEPWqP/KD70Ez9iES/BMAuJgy5FStkUBOe2mVj54+wt ei8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=SaXDm15HVkI3k49ezaHZvEGHrOL35XChnracu4sTQnI=; b=Qk5iUA04eAch1xhW8JTyRU5TRzJa+PUVF+dU92oG0IyZ8cw01hi+HPDR7EA4MSjdBk iLPVAf6U+NDdPicKHbyvckIX2VzHVi8tA98SgMJxnxU0uJVUXIhSmUvuhNjsCmcQQCUo HOOec1hwdT+kTwoukm+SWSWie1ybOK5dkpf6EjgO4bxwtjcTAF+PtjEGmOg6ROFg8813 EjtTLa26Wpd483foXot6M14KSTZ9SFNaLBX2yOio5eWBhyc0QybA1DFhizBc8YRhuMYh R/MC+rYUd7wonOl+CwZEz+7gxDc4DNwp6DNgqj9nS+2A1wvs5fRfcCdl1ylNtzXtaYBq YOAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZXJLM+kq; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 10sor3506359pjt.32.2020.07.09.04.18.00 for (Google Transport Security); Thu, 09 Jul 2020 04:18:00 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:90b:e8d:: with SMTP id fv13mr7009670pjb.128.1594293479834; Thu, 09 Jul 2020 04:17:59 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:24b9:69b0:e917:1d11]) by smtp.gmail.com with ESMTPSA id o23sm2608130pfd.126.2020.07.09.04.17.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 04:17:59 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: Simon Glass , Vignesh R , Tom Rini , Peng Fan , Daniel Schwierzeck , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 0/5] mtd: Implement MTD UCLASS (use SPINOR) Date: Thu, 9 Jul 2020 16:47:04 +0530 Message-Id: <20200709111709.68904-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ZXJLM+kq; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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(-)