From patchwork Fri Sep 13 21:07:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13804085 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 54B25FC6172 for ; Fri, 13 Sep 2024 21:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sAjACoXEQLr1atqs9UhLWXIc4G0i3McHVmSBjmDAMHg=; b=zdrdY7Z/rLdqsRO30yqz7UdlLo 0IdAtKvC6kjQUN5aRR7UyOWLT0fym9eERl+zht0CJpWFLGdfKnvvaAdLY7qUFyc40zu/wTheUc8X9 H9kw2v6tu3DeTWWyy72C4yXz2iZb6Tgtwdd+3jvPiKLjPpHg2tkPEnrDt3EMvH2xr3LYkDTBssHp8 Fac9Ql9FFneaZOLPD0a1lSb5S2/mRpI5qlgeNFz+3n9sCLQSMNaP7MHGDuDrObnq+Y8yFbTsn04B0 940KD0G/i3L3rvh+YwBsL7t4TtLOeeO0ImIlIFq1NplHrFoP2VuaCfJG+5LQTZw4o3gjj+yMGvqsf B5/zCCQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1spDbO-0000000H8fi-1FAf; Fri, 13 Sep 2024 21:13:14 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1spDW4-0000000H8BI-20N0 for linux-arm-kernel@lists.infradead.org; Fri, 13 Sep 2024 21:07:45 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 0789BA459E0; Fri, 13 Sep 2024 21:07:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B147C4CEC0; Fri, 13 Sep 2024 21:07:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726261663; bh=sVwfHoXKnb1nvxGo5YmthEsmu41bkHDt+t3Z3PhqUGE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=JS+XAp+31Rumk0g/OvmlItf9smz0FHGU4JFHhh1P3nu+vUE6acVYjApB7WR/jbHpx m8ztuNp8mOBCVKZqFnJaY35+52V+AJix8fqYKNXD5DVkXxhdTmpE2GLpkirht1tWMC i9bUmUu65YR94wp6E6w0tckMccPCx/q7lnAjZHbuOeHbj9mSYZO4d1iU+LFRgxkljq oQDcAFMyxCUyDp93+PFB8BuXNWmJpB5T5lHV8o7nJOwNgvs4oehguHGopF5frj6yy9 lG+TyBaRoAGf990xFbLJts7GDHimhqpsEPlkXWPqavUuMrgPI8/Q8zW1Sf36aBiaCj e+ab6yRQ9W9Cw== From: Lorenzo Bianconi Date: Fri, 13 Sep 2024 23:07:15 +0200 Subject: [PATCH 3/4] spi: airoha: remove read cache in airoha_snand_dirmap_read MIME-Version: 1.0 Message-Id: <20240913-airoha-spi-fixes-v1-3-de2e74ed4664@kernel.org> References: <20240913-airoha-spi-fixes-v1-0-de2e74ed4664@kernel.org> In-Reply-To: <20240913-airoha-spi-fixes-v1-0-de2e74ed4664@kernel.org> To: Lorenzo Bianconi , Ray Liu , Mark Brown , AngeloGioacchino Del Regno , Andy Shevchenko Cc: Christian Marangi , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, upstream@airoha.com X-Mailer: b4 0.14.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240913_140744_615304_3728B0FF X-CRM114-Status: GOOD ( 12.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Get rid of read cache in airoha_snand_dirmap_read routine since it introduces errors in mtd_oobtest kernel module test and it does not add any performance improvements in mtd_speedtest kernel module test. Fixes: a403997c1201 ("spi: airoha: add SPI-NAND Flash controller driver") Tested-by: Christian Marangi Signed-off-by: Lorenzo Bianconi --- drivers/spi/spi-airoha-snfi.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/drivers/spi/spi-airoha-snfi.c b/drivers/spi/spi-airoha-snfi.c index c71be702cf6f..94458df53eae 100644 --- a/drivers/spi/spi-airoha-snfi.c +++ b/drivers/spi/spi-airoha-snfi.c @@ -211,9 +211,6 @@ struct airoha_snand_dev { u8 *txrx_buf; dma_addr_t dma_addr; - - u64 cur_page_num; - bool data_need_update; }; struct airoha_snand_ctrl { @@ -644,11 +641,6 @@ static ssize_t airoha_snand_dirmap_read(struct spi_mem_dirmap_desc *desc, u32 val, rd_mode; int err; - if (!as_dev->data_need_update) - return len; - - as_dev->data_need_update = false; - switch (op->cmd.opcode) { case SPI_NAND_OP_READ_FROM_CACHE_DUAL: rd_mode = 1; @@ -895,23 +887,11 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc, static int airoha_snand_exec_op(struct spi_mem *mem, const struct spi_mem_op *op) { - struct airoha_snand_dev *as_dev = spi_get_ctldata(mem->spi); u8 data[8], cmd, opcode = op->cmd.opcode; struct airoha_snand_ctrl *as_ctrl; int i, err; as_ctrl = spi_controller_get_devdata(mem->spi->controller); - if (opcode == SPI_NAND_OP_PROGRAM_EXECUTE && - op->addr.val == as_dev->cur_page_num) { - as_dev->data_need_update = true; - } else if (opcode == SPI_NAND_OP_PAGE_READ) { - if (!as_dev->data_need_update && - op->addr.val == as_dev->cur_page_num) - return 0; - - as_dev->data_need_update = true; - as_dev->cur_page_num = op->addr.val; - } /* switch to manual mode */ err = airoha_snand_set_mode(as_ctrl, SPI_MODE_MANUAL); @@ -996,7 +976,6 @@ static int airoha_snand_setup(struct spi_device *spi) if (dma_mapping_error(as_ctrl->dev, as_dev->dma_addr)) return -ENOMEM; - as_dev->data_need_update = true; spi_set_ctldata(spi, as_dev); return 0;