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; From patchwork Thu May 14 12:11:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1202 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 349DD3F077 for ; Thu, 14 May 2020 14:12:04 +0200 (CEST) Received: by mail-pf1-f200.google.com with SMTP id q5sf2483018pff.11 for ; Thu, 14 May 2020 05:12:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589458323; cv=pass; d=google.com; s=arc-20160816; b=wuX6D2+3hJTr/bz8QzdzwuZEOepuvoGXwxfjFtZVs11T9aQZ53i+AkB+WKlThMb3F4 JgQx9kOWG+pD/7Lzk5qT+qV3hA7kvzjlrQldWLRkxJvzxuW4enM/kHljEscYgmkYSdNX 3IrMuAFmVOlgt4oYoKDWmVcYSidjMzMoOiRtoacwga4TBs4ML/S6yqhJv9cd3XpBHQDW GN9v/qnthclPbhzwouYQuKrUqPG+xOpM21yWrTH8gvHFb2+hrc4FgjEnw8IEMdP2VH70 0zNtAOzmj58lFl5CeZhD2Xr4Lrqlwu1EmH6NhHcECBNL6ngzuamzyKIAcV+Tq8xLG4gh H/aw== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=0HWQx672JTmuIX2kTv0h6O3/OgxYptjsiWkrLwAfzSc=; b=hE+c8lUqV+72p3hLfZrnvNogND7t15mky7u4RuiFQNJf6k90gwmVb5kznH/S+L2IY7 ApT74ovFjNnVoE3vjbfuhvxDt1IceximHaqXdGgQ48y9d6EhKLNJnCSc1Y9U0Mwv0Gqg 9WCjaAyFsEvbovHgaJ0b4hBYc1fshXEWj+qcT8XGERtNfxPi4YEba7d8KuIc2rCK6Qow riOEYGStM0x8cocAvs081ldTFm1fB0Q6kZuTHZjFuU7CwQTpNjM9IiFcT7mvTztJZfAN z4+zYQc384NOmrUyp4cFUKbYw0NOX87PxY8lPRx9zOMR24WVslrJwlYmUyP5850e6K70 X3Bg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mxl0Kmua; 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=0HWQx672JTmuIX2kTv0h6O3/OgxYptjsiWkrLwAfzSc=; b=gwhJij05enfF3MjaETmkYE2kmk2XtezAW/7+L5TWMM/I9/G1VSN0Pjmf1r0kyNRqIn uv5K4hXwrzTKDlN/quF8S8TUSQGL0VASSJvm2aCuLB3NgFyMTxqrFGVyR0791GuaY47T 8SHS5W3RE7vI+AOB6nwsYYA+d572ZATYXLJVM= 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: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=0HWQx672JTmuIX2kTv0h6O3/OgxYptjsiWkrLwAfzSc=; b=USj+pIQmtZu3AZiUED0SbrSTHvWyGF+fiMjyytbWJuWkliOlT+X/X47P6i20PylxWo l/3PnPOIhTzMHLrTp6GEzCHSVrL5ZzT1KOWqY6fOTXeOXWKwXNCfG6BpJ5CxCUqBjs/b u885GmNGb01lgGgkOvSEXqoN+Di8BK2FOYkDAie0aRRQ1DXz74c7DjmQ4Fs3kzsXHqpW 7XCIZV5OtwVJ0XLQxrtkKxNcjFe9uNFdrRJ2yik+7Bg0jIYWu8CEbWH3n4/fMKB/sSaa enEeVKwngcxIW3a+7jifiCX37di1IkepNW+bl42GzBo3YLmVOZsVgrW/zQtHpT8U5X5v luwA== X-Gm-Message-State: AOAM531/irxEPp7BM/O33Hw1fIhIke90xQ1c9O4PvIXLr/lkiJjsuG96 q60Vb/g2+u2u6jzPhPXRQ+AhbqDD X-Google-Smtp-Source: ABdhPJx1zee+7e+FxIcqrtdd8vDpZhWkfZppryS83UIqrHP4AdbYKUCNRfT8wQokrk5kGTzx6AEeeA== X-Received: by 2002:a63:6d86:: with SMTP id i128mr3622019pgc.432.1589458322786; Thu, 14 May 2020 05:12:02 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:8f8f:: with SMTP id z15ls1010825plo.8.gmail; Thu, 14 May 2020 05:12:02 -0700 (PDT) X-Received: by 2002:a17:90a:d3d3:: with SMTP id d19mr228780pjw.42.1589458322287; Thu, 14 May 2020 05:12:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589458322; cv=none; d=google.com; s=arc-20160816; b=vVSz+v9sBN2VTHJkdT7rAXLMiHFA/UA1WC3Yx0dgvjDiOWTS+UCO3qgJpS6dbeHgCs 9t344Juo3sqSkfLzJ8T+KLu+pWbCn9iQRs0RlNxjkQiM7Ar7E1RxK1aa8Px1MzvYXDnq mJuAyCZAGrYxydoy5zHe1ntpaHwgauRTv8Obqbsl05fZFdyhSx819gxdEJLxq2qwbNxV Husi3zfaqU+aVHolfn4uIRqooKBHACgB0gfeUpvCRIqOeq1302xhjQeHuBg9wy9Z2KiF 3LHggN+rKeFJUosyhjmp7FmNBk1Yu2xjOwK2aiZ3BtnFzgyp8dIXVqq7/guBtuOAAl3B ILQg== 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=LQ+w0ttycYH9hAg5qVNcqFqTsm/FNMFFgTggHGQKRsw=; b=QpEEbigOWWVDrqoGz3LmonAd0ANbzjjY65nAf9xjQJxFWirHDeZZf05O9CrOi3zu4i 2ZbnzZqj+MRN+7PxIN4RMqcZidQiRkZR9qZHQCMNyhhw06UJvhg93Ymt+5l8ua+9nx0f yWH0seNcd7+m4K4kv2roqWnWqR+1Lm1ivmTUPz2vedMIXQ1bKgzG4chsy0fbORpxRDKB E35kmG8ugtpYd/O59Y8qTK3rkQnL9TTgdV3wtZXCnFZeP4KNH8aInfBDNa0fHwLCZMHc uWaIa6PBA1Ywqp0tUgtzSVzFd4B/13fD8vZ2lHVY8D6Tax5ZFZy9SyVvSU/QAm37iOxg /SWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mxl0Kmua; 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 j9sor27972173pjn.32.2020.05.14.05.12.02 for (Google Transport Security); Thu, 14 May 2020 05:12:02 -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:90a:ac05:: with SMTP id o5mr36931341pjq.184.1589458321968; Thu, 14 May 2020 05:12:01 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 05:11:59 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Jagan Teki , Simon Glass , Vignesh R Subject: [PATCH 2/5] cmd: sf Drop reassignment of new into flash Date: Thu, 14 May 2020 17:41:42 +0530 Message-Id: <20200514121145.28737-3-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 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mxl0Kmua; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" 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: , The new pointer points to flash found and that would assign it to global 'flash' pointer for further flash operations and also keep track of old flash pointer. This would happen if the probe is successful or even failed, but current code assigning new into flash before and after checking the new. So, drop the assignment after new checks so flash always latest new pointer even if probe failed or succeed. Cc: Simon Glass Cc: Vignesh R Signed-off-by: Jagan Teki --- cmd/sf.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmd/sf.c b/cmd/sf.c index e993b3e5ad..302201c2b0 100644 --- a/cmd/sf.c +++ b/cmd/sf.c @@ -141,13 +141,10 @@ static int do_spi_flash_probe(int argc, char * const argv[]) new = spi_flash_probe(bus, cs, speed, mode); flash = new; - if (!new) { printf("Failed to initialize SPI flash at %u:%u\n", bus, cs); return 1; } - - flash = new; #endif return 0; From patchwork Thu May 14 12:11:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1203 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D589E3F077 for ; Thu, 14 May 2020 14:12:06 +0200 (CEST) Received: by mail-pf1-f197.google.com with SMTP id 207sf2490898pfx.8 for ; Thu, 14 May 2020 05:12:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589458325; cv=pass; d=google.com; s=arc-20160816; b=y8jTDXwsjZ0DPZnHc+zxCPeucXP24+daa4WfrwF/Tms9d0L9kxMUFf4ka8+cDpt3Vk 2VHUJ1Gh4ggKcCTFwJY52/uufzzuVu9KsstQ9J5PXUAhCsvQiNC9TIcE6jy1v7PoNHpT sWob8MHLCatcpO09Ezmerwe8mGOTX094ERji7XKdMGhvF3l4OZwrNUhqI/yz1q673ugA s5wPGXlO7+xw/SVIEZA27l2Jye1n2Tix52POf0iZwiangUybh4tbnh6CJSqxCRTeaPAS BePYi0pKNg1lEXZkJGyXB6FRbVx+qIzYQ79sugurIHIpc6EM1DKdq5OxlPY+muYqAx4L bOZQ== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=A5I6s4zWlLAVE+zUT5R48cXlF5RS8qhlRWfi5AiI3V8=; b=igI4+srKYsAGNoEsKUsViqqsECdYAGFdeSHYIbL0amvocARGe7iOnTCrhbuFqF1o64 7kjIlHkXHSLufJA65OjrjgE47hgs9ABEUoNYAbbeeu4lI3MijthvGdddr2k82aQycKrq ykVm5bB93JtO0AXK4n74oRvcy88khoL/FDkJUAJvRqvTI2fnSK2jtZch+kd9MOIEYSQg W+aLx2cpUIypVI81PNoqHGDR/OwhC5z+bHfp9y/UI2ouxrHua9HjAPa1UZ6Y3RU3UfQY 4ruUYZL9Z/643Ddn26OyuyPQOguY2eWTmCaeQaCK0P8hT7b5xmU58Ij0E5/lVDxsBlSR Bg9Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="BmYcYDT/"; 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=A5I6s4zWlLAVE+zUT5R48cXlF5RS8qhlRWfi5AiI3V8=; b=pGnZIRx0gYhgWdgrcjH2pUdPxSyjbyz1M648GQQKrc3XwGTbQ3GbcEXp2IEysvCAaK HFbOGVs9mlRShz2GLBqKCiClpVkKtjGMFLT8f/MsFdcHKT3GE8gnHSKIO4XOBd5Ax9L0 8mu/4pXgNxXBX1H9jsOOVEQ2U3lUYEa6pn1bk= 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: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=A5I6s4zWlLAVE+zUT5R48cXlF5RS8qhlRWfi5AiI3V8=; b=kbp+cdtgVORMf0NBsD9daZMVbS3MuP7EccKpCQct52sdPIPhf7w3lmy00qHjXoujCI /yzYdljl35xnOQB+qxR/Qo8egP6AL0VTraLomKMx2P8cnyGX+t9yvq2WS0Fp+rkKwX7e Lnt0eCRhOg/IdzsYlhQpDUuOQf8Y+nShCgvMW5zqeYvL53515KF/FQKeEtW3YTWgJ9ju fiM3ZaH6tma/ZJxenZc9CE95NJsN8XcmlEmATkqz4QdBScrhgzzjfvWu+/sz14XM0MK6 4UHCdZdlQT9/c6VVGgk3xfH1VdeKMSbn6Y2bgOb6hMQ5Sp9yZN5icj16T8651TRsSHIT VNmA== X-Gm-Message-State: AOAM530Gc3OBWAgitXYAeEt8BCy+8RdJcCHS+P1Ii7kLUjRI59xTrQGh UdD0+dXIan5fe+RM/a+zVwQp3rA1 X-Google-Smtp-Source: ABdhPJxGsayfNqB80z6IR06nYasKwANzV0QDf9isacBkO+GULCcxkcvelQKTRFCWsVoYLCprjHAnoQ== X-Received: by 2002:a17:902:ea8b:: with SMTP id x11mr3728916plb.205.1589458325682; Thu, 14 May 2020 05:12:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:4b5c:: with SMTP id k28ls787831pgl.0.gmail; Thu, 14 May 2020 05:12:05 -0700 (PDT) X-Received: by 2002:a63:db57:: with SMTP id x23mr3587915pgi.94.1589458325167; Thu, 14 May 2020 05:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589458325; cv=none; d=google.com; s=arc-20160816; b=aA8a0BEdpOyxgCpdvIFRTMTMx0EpjLG1zSmqWrVA3PPGQdefrdyfC6QxwyBJoIVKkm JWFlf3B0db89htQUOY7xxIyniGggYIGU7FHKl0DXgcOkN7nZzktmc5+0WzbDrrqhD/48 Nzw35diONXcC0ZLJfbfTaN+HTGonmxjEXUUUwFBvjztDoSG+PUJIt4nZvw+e2/Frjqnf VCDPfa8j3Y+u4WEvSPb5sRgcMAJN02ooUb362nYyYqcbwu1YQVumpX5KxqCYcSL9OUCl fsBG6O3x4FzabdSu1HD9nGsn0OTpmxtWTxK1JtKGw8I8cDGrLAo4aOsgRwlEPKlm/QLj D5Sg== 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=3as/G8MDFlVSHYKrBALlSCc5olDPxr3FJahGP4bXV4A=; b=jmTOss+vOwJFBc7jPpC5qbs/Hc9YWGuKaOY6mPMYf9BFaN+ZB8Q0QosNRA4ul5EPHm 3/1w2oeFxLxZt9SKxrTNXHCikvti/Ozw8YYnzCOfmKkIocFl3AJz3mspCpYxnnd3yiY5 CJe+tPQvTqLf5nHBUWDLYxwYxMYGxiDgkycyHHN4OWMJRbaWtdZRIzUFM6V87alYeMny S+9Dkb9ZM90uo1keKm+d4Zf7XOx0EdAsoQkgWKkZQrQoDJuz5q3nJovcvSKyHpVuxal1 KnixnWnFcjFhs7jS+llhtxpfpm9lvQZ0USKlBYJunsQumt+qrBERn1dw+NCvLYscX6i6 9vNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="BmYcYDT/"; 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 x23sor3381363pgf.25.2020.05.14.05.12.05 for (Google Transport Security); Thu, 14 May 2020 05:12:05 -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:a65:480c:: with SMTP id h12mr3879182pgs.106.1589458324877; Thu, 14 May 2020 05:12:04 -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.12.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 05:12:04 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Jagan Teki , Simon Glass , Vignesh R Subject: [PATCH 3/5] env: sf: Preserve and free the previous flash Date: Thu, 14 May 2020 17:41:43 +0530 Message-Id: <20200514121145.28737-4-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 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="BmYcYDT/"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" 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: , env_flash is a global flash pointer, and the probe would happen only if env_flash is NULL, but there is no checking and free the pointer if is not NULL. So, this patch frees the env_flash if it's not NULL, and get the probed flash in new flash pointer and finally assign into env_flash. Note: Similar approach has been followed and tested in cmd/sf.c Cc: Simon Glass Cc: Vignesh R Signed-off-by: Jagan Teki --- env/sf.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/env/sf.c b/env/sf.c index 64c57f2cdf..af59c8375c 100644 --- a/env/sf.c +++ b/env/sf.c @@ -50,15 +50,17 @@ static int setup_flash_device(void) env_flash = dev_get_uclass_priv(new); #else + struct spi_flash *new; - if (!env_flash) { - env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, - CONFIG_ENV_SPI_CS, - CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); - if (!env_flash) { - env_set_default("spi_flash_probe() failed", 0); - return -EIO; - } + if (env_flash) + spi_flash_free(env_flash); + + new = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, + CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); + env_flash = new; + if (!new) { + env_set_default("spi_flash_probe() failed", 0); + return -EIO; } #endif return 0; From patchwork Thu May 14 12:11:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1204 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id DE9F03F077 for ; Thu, 14 May 2020 14:12:09 +0200 (CEST) Received: by mail-pf1-f198.google.com with SMTP id t9sf2477182pfq.14 for ; Thu, 14 May 2020 05:12:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589458328; cv=pass; d=google.com; s=arc-20160816; b=yBzoowC0p6VNtb57q9QHsn0ztkANEYMLAxAqJWdfcgGMbKBsT/Zg6A4s7RM3is4yq0 dwBT6KZ9VNU7P+N7QF0VEY68M5D0QP9PM7rqatGjgigylKNwH6qBx5FHuRzgheqvZVLg AHT5ASqhoMy7oLHvlKGyMH6iu2+72QdkTVqs8ALOA2gK9+l9D1cu8BBMyRwvhNLQ77w4 6EsDbqKIsu/Wp9n/MCCYpuAGO8v9zSxELgFx/Ld93b6aOSZh6bmnj9UpZCglM2KgPdM1 CyFcWvKPbrtxuZhwt7ypAEqeESFPXzfWOKDOCLt/e/fFxdofmUam6xI87H+Zd9Sa50XF y7Ng== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=aLuKK381MQqwwWmHcgPJRnVRFpKSI/1wUIE9QSf2cuk=; b=0CGiUcbFlKlTBD+EyAvNKRMvzfjQNN16I2OOgZ54JTZ+cVH/UJ5pN/gx/bfAdJJL8I AJ0QFe14VaHQSXTGhlcfjr7kqgK65hfQac8GTAx2FTGKGeofrIe/FjqwS0fqtHX/NqUJ luM9glbBngBftISs8+Js4uk9IAp6WTYY5ffe1crQtdBhjKfpKOMEexEl0WFMaQx9asXW uua0HfzujYMw2w72eovKPNopOZVNY6vFUSAGH4A/X301voNoqK4xGxCkU9tJSccBdHv2 T/h2PuiHnA6i5pP0wsy9csy/pDC6Z1jOPo1WDWyB5rxr0+jQtmnzfXIYHIlPgeqKtild 1vLw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kenfB3VB; 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=aLuKK381MQqwwWmHcgPJRnVRFpKSI/1wUIE9QSf2cuk=; b=l+7VzSU2O4j/YmePGljsYeDTMKr7l3J9546f4ZVwHRtvdRmBJPvygn1Vb1zfD8J1RF +HFOdZy1RiCzGEeEUk9TUWTdZV4/3gNWvrKABKOmSidK76OROBOnRXiDkjo0hL19OZ0Z FANwmm9Q3HTCv1IYKFLPwruqp1wdo6H82Lj58= 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: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=aLuKK381MQqwwWmHcgPJRnVRFpKSI/1wUIE9QSf2cuk=; b=adZHrHVvT9L57WmKWDzWEkESNTdWCF1DAbYzuLYPgrNmK5UC2G9Zmun38EWLjXugQ8 qEOVC99ioST6gJFJlCSVvFuuXr3KkVYIrNNMoCPmmnYu7bdPkeF6g0w4tty0oKTHu9kz HkUdk8km7bDHVd939QTpD23yXRoYdUiNt2NLAS6R4ws/6QvTOXrMdJP/9qr5nDNcuDrA ZqCkcW6bA1VVrMSggt1bH8eVGC2wp54+U8drqagfG2jD1Z0e61/1Tfg/wJszgbxAaOJs mYZNRsy3uuEBwOJDYMyNImsxoG4Dp8cTa1/UqPoM7vJDx2UIfTejS0WdYl39pPoiYnrR sFXQ== X-Gm-Message-State: AOAM532KOucgmCRjjcWqtKjuzHe4nxH+UngP93KcWJ9H+e58dGnepB1M mkZ7qdKT0dfPwijP6p7FYBJ7Bv4n X-Google-Smtp-Source: ABdhPJyHGbQg20L/3fC1UFbXTlqx+As6pvDuwxaeXeHE4SnGj+l03NsvarLFAVyK+cACswK3wy0KMg== X-Received: by 2002:aa7:81cf:: with SMTP id c15mr4266322pfn.211.1589458328669; Thu, 14 May 2020 05:12:08 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:3543:: with SMTP id lt3ls2682713pjb.3.gmail; Thu, 14 May 2020 05:12:08 -0700 (PDT) X-Received: by 2002:a17:902:32b:: with SMTP id 40mr3712632pld.73.1589458328227; Thu, 14 May 2020 05:12:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589458328; cv=none; d=google.com; s=arc-20160816; b=e1Yv9bRz91/gZMUzI3s61NEYDwbHJ5tZtsffiSkKmbYs2O2QLBhkMRXlocDIpxNr6+ +bkDHnzTJH4oiovBTWu6fKyQ5M9eacuCm3LO45TRxTp6/lG+Q/I1AB0OM5P0htYDASQs 6AApauWLQcMUCcMSVfKHZEtLDdPoyJZ169XpUHwWbxPup1jObVjwZCMwKzrIgZrPJ8rm 8r81Lp8i2JvXiRDIAQBSHRvRRvd4xHaDXOJ5Dtr7LH7Xilu8swS0Pap8htFNme32fgbf 0jFxaqyIoG7ata8uFhAipx2GsbNRAEkGZA3RmKCYcC68hOYmmoyBnHnWQeH+9OEytz/I NpDQ== 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=m/DH5RW0uF7WE0KGtRBItEntdC2YchSgP6szkh7SOLA=; b=vXnNPfNRKpiAviWevjUMtYj8UU17NpLMHtSDx/IGYAQQM/3nXGFUHvTlDCGVPF7CuE Ymfa3A9xQeEH2PSYPZ92+psr6hyu0MqgoLvQ+zopCMXvICxZ2WlJEAmYGziTL/fDpG5/ C4pKQ2WBYWKYvDOS6GaQvJGpPeiFGZ29ijZadMwOIwjoEGfK74bajeLVVr3StxyWVwmp 4XYfFkQJX2U9kxV78Y0hhC1PbV0iHmiCK8u77NYj4rVV6u6OpE1NevlSjMJz5U0olXQ2 0MfI3bkisnLESXfqGhELUwXa3QVBlrXzaBGuLYG2aqQaBc/ZbU7N4Di3PCuqtjGRzBzt +t4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kenfB3VB; 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 p13sor3462176pff.77.2020.05.14.05.12.07 for (Google Transport Security); Thu, 14 May 2020 05:12:07 -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:aa7:9ab6:: with SMTP id x22mr4137491pfi.136.1589458327619; Thu, 14 May 2020 05:12:07 -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.12.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 05:12:06 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Jagan Teki , Simon Glass , Vignesh R Subject: [PATCH 4/5] mtd: sf: Drop plat from sf_probe Date: Thu, 14 May 2020 17:41:44 +0530 Message-Id: <20200514121145.28737-5-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 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=kenfB3VB; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" 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: , dm_spi_slave_platdata used in sf_probe for printing plat->cs value and there is no relevant usage apart from this. We have enouch debug messages available in SPI and SF areas so drop this plat get and associated bug statement. Cc: Simon Glass Cc: Vignesh R Signed-off-by: Jagan Teki --- drivers/mtd/spi/sf_probe.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 72b6ee702d..89e384901c 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -140,13 +140,11 @@ static int spi_flash_std_get_sw_write_prot(struct udevice *dev) int spi_flash_std_probe(struct udevice *dev) { struct spi_slave *slave = dev_get_parent_priv(dev); - struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); struct spi_flash *flash; flash = dev_get_uclass_priv(dev); flash->dev = dev; flash->spi = slave; - debug("%s: slave=%p, cs=%d\n", __func__, slave, plat->cs); return spi_flash_probe_slave(flash); } From patchwork Thu May 14 12:11:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1205 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 99ECB3F077 for ; Thu, 14 May 2020 14:12:12 +0200 (CEST) Received: by mail-pf1-f197.google.com with SMTP id 126sf2490829pfd.10 for ; Thu, 14 May 2020 05:12:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589458331; cv=pass; d=google.com; s=arc-20160816; b=rfUEaR1+M2eptCNilpjji/h705t+umycqfg9xIc8k38izPGy3zOL1dENbsabvGV0CG CUFCP1IERBABY+XYoc0R46ULFE6PAK9d1iP5Jfx3lUI7ScYF1Rum2y3ZwRlOPIq7lp1m alphK5v/G4QTYnMX0z767MkZ1X7IRkPavuaAMVlXW6AlExqvW/XpazmhIzxX1+4MAGCz LGi1NplOJKrmtgTpM/eFslNG3ijnGK9V+3LpnEFoz5noXjBVZjjkrHTAI9uIRF17x6Zy 0swRESx1TJJ/Evppjhy/nCEBIV2tBXCXYscj2fxEV0wzhxJ5dvSOJUuxnZkt726/pWNi 9W/A== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=nNrVBg89mChOHSXJdWq/hb5PfNR4LZqDDTKog2xluRs=; b=gi6xxwcRMFfizcRVGUt8MwEFew9GwHgPsWGIq7L2e1EppPe5pHSvo6hukdwif9XjOE SzWcCVkMLczvMahumtw/zBkBZn5YGnFsj37P8CP1jYI26i46nJ9/a/2W8RPcC+sl/M7z yzbJ16njPPiT6gqPmu9xv9CsXQTo2bpEJsuVOkVrO1PgYV4KMEr+tGcYi6ch+iI2VMNK gm0yoGP2MvsQbODqDWsP4oIjJ9roCKcupnvf/197kuSwODKdKxMej1D75MR/yHrkTOUM tXkL/OSbUPz6CiQy91OCk6Dnq4mV/5ou2dYSYy5tFFpK/C7DSxo5JfjLzSfbbTM/05EJ KUOA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jb3r21E2; 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=nNrVBg89mChOHSXJdWq/hb5PfNR4LZqDDTKog2xluRs=; b=MGe0j93Dfxi6bH0Ak1K0NG/xwAHIhrV4ZSHE7gcnLZZ8RLTreANHFNaceFFEvPMCAB eJGeOwCFQy2Oyw6On22+c9Bz02V7crYCowC2WQFyDl/13Zce+ZLKNcZaa/d7G1Drywkc uiVWxcKFM3AnTN27GeJOSd3n/2OGYfQ3JT5U8= 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: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=nNrVBg89mChOHSXJdWq/hb5PfNR4LZqDDTKog2xluRs=; b=rkBAjiRrTXWtbewp7RTiCkkZrPx7KnFHzbc4R4ocAvsyeB1I6SyWdUm8pdgb7OCmEb WtgIbhwLbv3I133QimyPQ6Zj6biz7ZcajXNvCemG5vlpToWYCHB+hx5dAyb7XkSaw/u1 pwCtXN3YO/YhYVqk/K5hCVzhKme12qzh6xnijg/l7gOp1V5vJE6bg80BVfI9MZbuGAzY +T3mQJoTsCZsAuzAkR5rq4DGrtsJLpm3YSgSypMqn501Jvw2HNMDtv0y1V1rZi/HrowL dn4bMgGmn9d1raKyGplxZQTME+bViAKONJ8Un7YBODCuJKQifyVJhdefZqZjKJVIMl48 oLow== X-Gm-Message-State: AOAM532hIGEuWK6rU5AAx1Cw4sBBhW2yHACKPXffPvy5a/mcTQdmMjx6 kHqtBRjfzafg6X89igkn03DxBXXm X-Google-Smtp-Source: ABdhPJzZlsslMwNWqwLvEZiSlpvay7QtRZQIy2rdsb3Jos5e2NP5d5+UEjcA4bLkRkf/wCWN8eyHDQ== X-Received: by 2002:a17:902:74cc:: with SMTP id f12mr3594189plt.119.1589458331393; Thu, 14 May 2020 05:12:11 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:8a8a:: with SMTP id p10ls1004929plo.11.gmail; Thu, 14 May 2020 05:12:11 -0700 (PDT) X-Received: by 2002:a17:902:8e8c:: with SMTP id bg12mr3863080plb.279.1589458330937; Thu, 14 May 2020 05:12:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589458330; cv=none; d=google.com; s=arc-20160816; b=YbMqdfL9fKma3jux/hfkTGrK47bgondUfg4Tk/bZ5v6cUiF7R0c8kQaCXX1lh9XF4J E4D+qqIo51l1zCGgHyDs8hZ5M0ojWp+GcOPKo4BrSVMTeJCMULjj06bZEDbYUdHzI5G9 XX37XEP9C15tDtRSF2Z0X4gFGYi4NHs1KHDWUZoiNnCiiGxQf8AKK8okc1xoxzbg+QJQ P2sX1or8PUNYCUN2r/Hz9NEuARkK7Rbs6EUMohsgu06yJtmiSL+olmtFBEVc0xsrUol4 N9BGDqCTzMD2G2/Kq3OpxRhYM4wkutAYeeAyXdOnd77t3MOIZ2b4EypsXcFwpoAdtEDM Rhwg== 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=fxeerWO+ueh4IugH1YGq1cZPNbdvsKr2oC7ffVaVujI=; b=BNEXcJzoX7XmM7YDvpaWhoK8Xcd+IW5MgKfxdQqwKmHNsA+24iE8vaPHw0fU/p8AiT Ej6BkEAwGhee0Zrl2HxDidwrZq7wPiA9arsYhwd7KaesEy243DxOgU67Pe0OUdTWXIHB Na8pAeL7Zo1HUJVVl42KTV3NvhD91lYitx1cW8+MucDa1Ln+GZmnCIGmshXgaIgeVLHi Rn+RaN7JHyyHtR7ti5u6t2nwp3z0zFLbNksKgBKaZagrYgPgnRnq11yUM65J1f5yvTCl NJ2WtWnm93AJHuIbv0kuJ2efHUKB6PnYlGximkY72YPJvW7r2zAvJKAo5iArOv9/M9Iy 29QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jb3r21E2; 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 s2sor27921979pjp.29.2020.05.14.05.12.10 for (Google Transport Security); Thu, 14 May 2020 05:12:10 -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:90a:a893:: with SMTP id h19mr39474558pjq.138.1589458330671; Thu, 14 May 2020 05:12:10 -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.12.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2020 05:12:09 -0700 (PDT) From: Jagan Teki To: u-boot@lists.denx.de Cc: linux-amarula@amarulasolutions.com, Jagan Teki , Simon Glass , Vignesh R , Daniel Schwierzeck Subject: [PATCH 5/5] mtd: spi: Use IS_ENABLED to prevent ifdef Date: Thu, 14 May 2020 17:41:45 +0530 Message-Id: <20200514121145.28737-6-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 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=jb3r21E2; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" 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: , Use IS_ENABLED to prevent ifdef in sf_probe.c Cc: Simon Glass Cc: Vignesh R Cc: Daniel Schwierzeck Signed-off-by: Jagan Teki --- drivers/mtd/spi/sf_internal.h | 10 ++++++++++ drivers/mtd/spi/sf_probe.c | 17 ++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h index 940b2e4c9e..544ed74a5f 100644 --- a/drivers/mtd/spi/sf_internal.h +++ b/drivers/mtd/spi/sf_internal.h @@ -81,5 +81,15 @@ int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash); #if CONFIG_IS_ENABLED(SPI_FLASH_MTD) int spi_flash_mtd_register(struct spi_flash *flash); void spi_flash_mtd_unregister(void); +#else +static inline int spi_flash_mtd_register(struct spi_flash *flash) +{ + return 0; +} + +static inline void spi_flash_mtd_unregister(void) +{ +} #endif + #endif /* _SF_INTERNAL_H_ */ diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 89e384901c..1e8744896c 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -44,9 +44,8 @@ static int spi_flash_probe_slave(struct spi_flash *flash) if (ret) goto err_read_id; -#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) - ret = spi_flash_mtd_register(flash); -#endif + if (IS_ENABLED(CONFIG_SPI_FLASH_MTD)) + ret = spi_flash_mtd_register(flash); err_read_id: spi_release_bus(spi); @@ -83,9 +82,9 @@ struct spi_flash *spi_flash_probe(unsigned int busnum, unsigned int cs, void spi_flash_free(struct spi_flash *flash) { -#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) - spi_flash_mtd_unregister(); -#endif + if (IS_ENABLED(CONFIG_SPI_FLASH_MTD)) + spi_flash_mtd_unregister(); + spi_free_slave(flash->spi); free(flash); } @@ -150,9 +149,9 @@ int spi_flash_std_probe(struct udevice *dev) static int spi_flash_std_remove(struct udevice *dev) { -#if CONFIG_IS_ENABLED(SPI_FLASH_MTD) - spi_flash_mtd_unregister(); -#endif + if (IS_ENABLED(CONFIG_SPI_FLASH_MTD)) + spi_flash_mtd_unregister(); + return 0; }