From patchwork Thu May 14 12:11:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1201 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id A8AD840C9E for ; Thu, 14 May 2020 14:12:00 +0200 (CEST) Received: by mail-pg1-f197.google.com with SMTP id g1sf2128978pgk.10 for ; Thu, 14 May 2020 05:12:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589458318; cv=pass; d=google.com; s=arc-20160816; b=lNhYs9VHyN7rLUcuVP7F1eo8pvfjsQCkNo2ne+VgYFo+4lhH+FJifHAjKKu/0GBNjQ qU8RL69zp3ykC+AiiVaeZrSGknf05++C1lXd9wm3t0RPfWpT1h2e2S+fGQVIdyoAY7zh 99ZI9qFC6N0d4j1oTT25r744ow+c6D+ZvgBfPPwPRHGmM3gJEyiD2LJjPpZ6mvolAnrm Dt5rlr+WhnNrVvq2Np8eOSwDUiLSVq3QmqFrwLLBMHQfA4q+AAybe3kPMWiko52oWBR6 zgj+aSurzNIy/r7eX1jx0tk1AA7kRZVP6rEDCcA3ENAfyWqi5Wym2etJZWw4EOzDRTjq 710g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GrPyqYnwVNtcFreh6YkO1HOjQLKCGIlV5ptmuadth6k=; b=Uk83IVZq581gol0igCyy7S0e8QkmWOQgfJGaplKb3UVQAiVNrrJYvwSGe6+CzCire9 FJjABWoBK43XjD140deANXaDm1zG5R3nADceSmoZgeiOxz+g1J3eCgqSeOBCN2Fk0iLe nEfwXT+NlgXVb7Gdq2IV5CkonxoTADoucJGl9RAjkyajZOaokRX75iJl/jL46y0HpPbL mwNRkt42EkN+EvyFWKMSJGX5ftxCLIDFd2+XzR1J3fhB+U0p/Lw5Rkyn+Hf7hcbuCQgi BePXxbeIq+HRAyr7AXfyTsn1YtQHMOP+7+oUyySADa306O+7Ra1iasnakEExc4dGNxh7 279w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qTXWXgoV; 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:in-reply-to:references :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=GrPyqYnwVNtcFreh6YkO1HOjQLKCGIlV5ptmuadth6k=; b=rqWX4yHWIekjIK0nUkan3806U3eaOAaP2VU5FOe9frDly1yLyvLWExFlBVxCuAEP+b VDsW/ITKQvcd7w16WCGn6dBo3QYwjjlssyD5ay++ajztPNiJEnBuaW8lSlrGbTJY7ECU 2H1r5hsDFU30V6xgG507pm06mAepCxd/yN81k= 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:in-reply-to :references: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=GrPyqYnwVNtcFreh6YkO1HOjQLKCGIlV5ptmuadth6k=; b=XMuzifQ5pe0NyskKHdzOwP0MaTAxIv0gMjci9sN2K89zsu3gYByu1XVTuSjR/ZyEXY 0Zm27t1h4JJuYBawSThXwyyMaaDm+72cbJ1NWvqBiUjQeJLjDnHTlFghrTKrli5LXAUa Dda738B4ukXt/llipi6C/RmzYrga4LWQOXg9Yc+TOlUsdcr9TEMmOWrxpreX3SBa+6W4 mhNv5Pz7tIcQIUlhE68S7AxAtuHJMdFwOVVYmkFyCqgpRSL/Bhc8ys77YdTrLbsHjshU lL8NHBfiuk/ksP/baphiSspWF1Z4ky0HnUhtoirMAPCkVS5QnIzHhRhHgl0+KKGk+53F fxbQ== X-Gm-Message-State: AGi0PubBYoxloPPYu9C8C4a27Au7RNUwS5+/zMhZqGVKP/yYsFyAVt85 31EL+YNCzWffRtbubeBrznmdy4+2 X-Google-Smtp-Source: APiQypLKB/1Jr2Uw2JdYBuWcvRbSW+zOG+C5TDlaWySjBFD9cL9y4UxffIUQJQwNHWbXQBIOHZJm/A== X-Received: by 2002:a17:90a:d78e:: with SMTP id z14mr40550979pju.125.1589458318695; Thu, 14 May 2020 05:11:58 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:7203:: with SMTP id ba3ls1017623plb.4.gmail; Thu, 14 May 2020 05:11:58 -0700 (PDT) X-Received: by 2002:a17:902:ee15:: with SMTP id z21mr3666336plb.71.1589458318169; Thu, 14 May 2020 05:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589458318; cv=none; d=google.com; s=arc-20160816; b=G3NEo5NPEmIJz75SeOWiqWMWOUHTY6YIe9+JG3T7uVH9OLxwfQ2PHsBrapL4IbpbUY ExmoqGTHp0VNNIc5972Ksbd/a1ErvtNtPDSdrn7dLA2J+ZBtkwJwEqhNrxvHheoIsMU/ 2PAK2Uj7EMoyix9OBaZurObvPFlmr5trULtbQNPbMmqgzI8YYWeCVnApE1nY+54jBEML rssE3qUyUsyMGTmvs2Kz5yjA+FP/GUzOotl7NoG9WVJVf0L1+5SyvMHBOfcnqvKsgWNa Cvvpz1uj906QZ2rFVMCL51peVQ1xISlopBhNQijHjPuszmbzeO2bXfgIIMjMLVMchiah NedQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=3EtaQu+lUTFRz7anrsLS4t0oW9LtJlbhHWEedwvpEDc=; b=XbhxSucnvUnj7eis7LQb6kDUANi8zHqW4xML7Lf+LwTMk+ayeRlZqXpEXPntCuFj4v P4weixrQXMqeUppEnq2u1bJlAi0o8hDBnvja0uL+i0b8z2xmmRdfXGC7m5sjv/aDr+Aw wqBskUVmDquNhdn3MEAF22xSAV5WdymGOK8IaxnWKgx3nXkWYliZmEjyP9JQEQ9VOGIg gCAr/j0nC/VxrlD/XuYbZFkHnVpBZ7SOIDqClr3FtCmS/H8Cd+0q9BidTMO9iW6hR0iD q4tT8IwH1PHhV4dAYmV5X9JZEIRWFVTp4HFTyVvYOx1L5SXpvlDteGxYNTQO50sw7wCx H2vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qTXWXgoV; 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 w15sor3660066plp.7.2020.05.14.05.11.58 for (Google Transport Security); Thu, 14 May 2020 05:11:58 -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:902:8d8d:: with SMTP id v13mr3812536plo.67.1589458317864; Thu, 14 May 2020 05:11:57 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:713c:4a0a:47eb:ffcd]) by smtp.gmail.com with ESMTPSA id r31sm2091050pgl.86.2020.05.14.05.11.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 05:11:57 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Jagan Teki , Simon Glass , Vignesh R Subject: [PATCH 1/5] mtd: spi: Call sst_write in _write ops Date: Thu, 14 May 2020 17:41:41 +0530 Message-Id: <20200514121145.28737-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200514121145.28737-1-jagan@amarulasolutions.com> References: <20200514121145.28737-1-jagan@amarulasolutions.com> 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=qTXWXgoV; 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: , Currently spi-nor code is assigning _write ops for SST and other flashes separately.  Just call the sst_write from generic write ops and return if SST flash found, this way it avoids the confusion of multiple write ops assignment during the scan and makes it more feasible for code readability. No functionality changes. Cc: Simon Glass Cc: Vignesh R Signed-off-by: Jagan Teki --- drivers/mtd/spi/spi-nor-core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 3d4361493e..984cece0b0 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -1233,6 +1233,12 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, size_t page_offset, page_remain, i; ssize_t ret; +#ifdef CONFIG_SPI_FLASH_SST + /* sst nor chips use AAI word program */ + if (nor->info->flags & SST_WRITE) + return sst_write(mtd, to, len, retlen, buf); +#endif + dev_dbg(nor->dev, "to 0x%08x, len %zd\n", (u32)to, len); if (!len) @@ -2528,6 +2534,7 @@ int spi_nor_scan(struct spi_nor *nor) mtd->size = params.size; mtd->_erase = spi_nor_erase; mtd->_read = spi_nor_read; + mtd->_write = spi_nor_write; #if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST) /* NOR protection support for STmicro/Micron chips and similar */ @@ -2551,13 +2558,7 @@ int spi_nor_scan(struct spi_nor *nor) nor->flash_unlock = sst26_unlock; nor->flash_is_locked = sst26_is_locked; } - - /* sst nor chips use AAI word program */ - if (info->flags & SST_WRITE) - mtd->_write = sst_write; - else #endif - mtd->_write = spi_nor_write; if (info->flags & USE_FSR) nor->flags |= SNOR_F_USE_FSR;