[{"id":1774155,"web_url":"http://patchwork.ozlabs.org/comment/1774155/","msgid":"<94313cae-4805-0b13-a469-72aa7556b685@gmail.com>","list_archive_url":null,"date":"2017-09-24T11:59:45","subject":"Re: [PATCH v3 2/5] mtd: spi-nor: cadence-quadspi: add a delay in\n\twrite sequence","submitter":{"id":1124,"url":"http://patchwork.ozlabs.org/api/people/1124/","name":"Marek Vasut","email":"marek.vasut@gmail.com"},"content":"On 09/24/2017 12:59 PM, Vignesh R wrote:\n> As per 66AK2G02 TRM[1] SPRUHY8F section 11.15.5.3 Indirect Access\n> Controller programming sequence, a delay equal to couple of QSPI master\n> clock(~5ns) is required after setting CQSPI_REG_INDIRECTWR_START bit and\n> writing data to the flash. Introduce a quirk flag CQSPI_NEEDS_WR_DELAY\n> to handle this and set this flag for TI 66AK2G SoC.\n> \n> [1]http://www.ti.com/lit/ug/spruhy8f/spruhy8f.pdf\n> \n> Signed-off-by: Vignesh R <vigneshr@ti.com>\n\nIs this TI specific or is this controller property ? I wouldn't be\nsurprised of the later ...\n\n> ---\n> \n> v3:\n> Fix build warnings reported by kbuild test bot.\n> \n>  drivers/mtd/spi-nor/cadence-quadspi.c | 27 ++++++++++++++++++++++++++-\n>  1 file changed, 26 insertions(+), 1 deletion(-)\n> \n> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c\n> index 53c7d8e0327a..5cd5d6f7303f 100644\n> --- a/drivers/mtd/spi-nor/cadence-quadspi.c\n> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c\n> @@ -38,6 +38,9 @@\n>  #define CQSPI_NAME\t\t\t\"cadence-qspi\"\n>  #define CQSPI_MAX_CHIPSELECT\t\t16\n>  \n> +/* Quirks */\n> +#define CQSPI_NEEDS_WR_DELAY\t\tBIT(0)\n> +\n>  struct cqspi_st;\n>  \n>  struct cqspi_flash_pdata {\n> @@ -76,6 +79,7 @@ struct cqspi_st {\n>  \tu32\t\t\tfifo_depth;\n>  \tu32\t\t\tfifo_width;\n>  \tu32\t\t\ttrigger_address;\n> +\tu32\t\t\twr_delay;\n>  \tstruct cqspi_flash_pdata f_pdata[CQSPI_MAX_CHIPSELECT];\n>  };\n>  \n> @@ -608,6 +612,15 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor,\n>  \treinit_completion(&cqspi->transfer_complete);\n>  \twritel(CQSPI_REG_INDIRECTWR_START_MASK,\n>  \t       reg_base + CQSPI_REG_INDIRECTWR);\n> +\t/*\n> +\t * As per 66AK2G02 TRM SPRUHY8F section 11.15.5.3 Indirect Access\n> +\t * Controller programming sequence, couple of cycles of\n> +\t * QSPI_REF_CLK delay is required for the above bit to\n> +\t * be internally synchronized by the QSPI module. Provide 5\n> +\t * cycles of delay.\n> +\t */\n> +\tif (cqspi->wr_delay)\n> +\t\tndelay(cqspi->wr_delay);\n>  \n>  \twhile (remaining > 0) {\n>  \t\twrite_bytes = remaining > page_size ? page_size : remaining;\n> @@ -1156,6 +1169,7 @@ static int cqspi_probe(struct platform_device *pdev)\n>  \tstruct cqspi_st *cqspi;\n>  \tstruct resource *res;\n>  \tstruct resource *res_ahb;\n> +\tunsigned long data;\n>  \tint ret;\n>  \tint irq;\n>  \n> @@ -1213,6 +1227,10 @@ static int cqspi_probe(struct platform_device *pdev)\n>  \t}\n>  \n>  \tcqspi->master_ref_clk_hz = clk_get_rate(cqspi->clk);\n> +\tdata  = (unsigned long)of_device_get_match_data(dev);\n> +\tif (data & CQSPI_NEEDS_WR_DELAY)\n> +\t\tcqspi->wr_delay = 5 * DIV_ROUND_UP(NSEC_PER_SEC,\n> +\t\t\t\t\t\t   cqspi->master_ref_clk_hz);\n>  \n>  \tret = devm_request_irq(dev, irq, cqspi_irq_handler, 0,\n>  \t\t\t       pdev->name, cqspi);\n> @@ -1284,7 +1302,14 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {\n>  #endif\n>  \n>  static const struct of_device_id cqspi_dt_ids[] = {\n> -\t{.compatible = \"cdns,qspi-nor\",},\n> +\t{\n> +\t\t.compatible = \"cdns,qspi-nor\",\n> +\t\t.data = (void *)0,\n> +\t},\n> +\t{\n> +\t\t.compatible = \"ti,k2g-qspi\",\n> +\t\t.data = (void *)CQSPI_NEEDS_WR_DELAY,\n> +\t},\n>  \t{ /* end of table */ }\n>  };\n>  \n>","headers":{"Return-Path":"<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"lHHEkvrO\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"kepphnSI\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y0R7Q4gvZz9sRW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 24 Sep 2017 22:17:54 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dw5r5-0008AV-Nz; Sun, 24 Sep 2017 12:17:51 +0000","from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dw5lg-0004AV-0T; Sun, 24 Sep 2017 12:12:24 +0000","by mail-wm0-x243.google.com with SMTP id r136so4897610wmf.3;\n\tSun, 24 Sep 2017 05:11:55 -0700 (PDT)","from [192.168.1.4] (ip-86-49-107-50.net.upcbroadband.cz.\n\t[86.49.107.50]) by smtp.gmail.com with ESMTPSA id\n\t56sm2800145wrx.2.2017.09.24.05.11.52\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 24 Sep 2017 05:11:53 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:\n\tMessage-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description\n\t:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=Ca7hbLa/ESMI+Iz+bgy0CmoMrTF4dFlKO+xqLtgGQew=;\n\tb=lHHEkvrOFkSlnh\n\tycL+Oq50a5KrAtmbPQFoJBf/KzRqW8aC2iernsYUpXEEHyYvzeVTHunjU7cxue1V04x9Qg5ukaVCZ\n\t1WmEBv2uE++0wx8Q98ZApSL4oJUXDxU/JsKOCOrgd3ddI9yHpL4DnEiBhuqByqV6AlT82lSju+g6+\n\tvg4VCMfOHgqpvhxLAqAky+U7/LOrPff+Qr2YOosGzW2nbVVGagGvE2S707wxIpqbW5U0clSZCSt9/\n\tut8BRoUu1xosz1vyc5Z2V4HdLEE/xFCcWrA4IcswnyaRURtsW4iiAu9oV4TfuLTyVvGGsL0blmDqd\n\twUYH4CTNyfhRymHMPg8Q==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=g4v+zAPisbynwaZ/CIr7BX8KOi5X5/AUgrrh68sfAng=;\n\tb=kepphnSIOy+EsP2qLa3itH/dufiZfrtgzuSRhTEt2K02EFvHxwSIdese8M8kM1w2r8\n\ttLHAcgukfCOLOM9yF3tN+iAOv3I5pOGri430vWbEd7zuLX+aQ/3dz2eXfDwzLXO7Gabu\n\taAh3xmtIdNx3Rvg9ieiwUTRFYPihwPIcDw0nY2xrNZZCGL81CbqUwYduU0nFaiBvQuC5\n\tGqDoRzF9GOWgyoUDtZ2a/ndjqyTnGV4S7g/a6hTPXnXvdJ4ABc/kg9Gxyzwl1UgaYnav\n\t7T3Rwobv6PUchWpJdIpi1A7na0IrayBm8lf4ZQ6A+d22YUjBz+42iV/+QTS7kAUqsu0D\n\tYgNw=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:cc:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=g4v+zAPisbynwaZ/CIr7BX8KOi5X5/AUgrrh68sfAng=;\n\tb=hyjDPXiNDQfV9hXdV9vrk9uNig3vf3hAGz8D3AK+PyBtRv2HuXw6JSSuqV9pjovVqE\n\tgATo3rQPx4wi3VrEw2QF3goaYFMT2S5KxGq6O5MOXqxDniA2bZZyi7O5L8pnrgW5aLfA\n\t9oN0089XBheostZTYWk+3vHIh27KGZkRJIojvIYd+WAvB2EecrP1YXu+7XB9uCMr4Ci6\n\tJZBUlsGCwgt3/imU0ObjzYOYgDA2kUiLmO06mbnN/LDg8caJv5qD8n0pJgQnkPHo/vCi\n\tU5oWffCfY7Z065MnaPRO38UJWH0wJfQRkMGMEMjgFWtnomdrgAfuQIeFcchSZjKcbihu\n\t234Q==","X-Gm-Message-State":"AHPjjUiBL0ctMkpTvGCuGIu3vcCTKuN2ktJnm8Vwz8WxPeg201g7Vn9Z\n\tGlSv5kRzEVVSwCQ53viRiy6KfWww","X-Google-Smtp-Source":"AOwi7QAe4B5rOYCPQmR5fofos+9va0Rn644oDO8XxkPppX3Z0fR7z4yig/Ov2J/1BPvnOkudPNLXug==","X-Received":"by 10.28.139.208 with SMTP id n199mr1868800wmd.29.1506255113693; \n\tSun, 24 Sep 2017 05:11:53 -0700 (PDT)","Subject":"Re: [PATCH v3 2/5] mtd: spi-nor: cadence-quadspi: add a delay in\n\twrite sequence","To":"Vignesh R <vigneshr@ti.com>, Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>","References":"<20170924105924.23923-1-vigneshr@ti.com>\n\t<20170924105924.23923-3-vigneshr@ti.com>","From":"Marek Vasut <marek.vasut@gmail.com>","Message-ID":"<94313cae-4805-0b13-a469-72aa7556b685@gmail.com>","Date":"Sun, 24 Sep 2017 13:59:45 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170924105924.23923-3-vigneshr@ti.com>","Content-Language":"en-US","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170924_051216_715150_60AD11BD ","X-CRM114-Status":"GOOD (  19.23  )","X-Spam-Score":"-2.0 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.0 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno\n\ttrust [2a00:1450:400c:c09:0:0:0:243 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (marek.vasut[at]gmail.com)\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd/>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","Cc":"Boris Brezillon <boris.brezillon@free-electrons.com>,\n\tdevicetree@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tRob Herring <robh+dt@kernel.org>, linux-mtd@lists.infradead.org,\n\tBrian Norris <computersforpeace@gmail.com>,\n\tDavid Woodhouse <dwmw2@infradead.org>,\n\tlinux-arm-kernel <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}},{"id":1774158,"web_url":"http://patchwork.ozlabs.org/comment/1774158/","msgid":"<8990b971-91d5-747f-905b-5e24743e090d@ti.com>","list_archive_url":null,"date":"2017-09-24T12:33:51","subject":"Re: [PATCH v3 2/5] mtd: spi-nor: cadence-quadspi: add a delay in\n\twrite sequence","submitter":{"id":65039,"url":"http://patchwork.ozlabs.org/api/people/65039/","name":"Raghavendra, Vignesh","email":"vigneshr@ti.com"},"content":"On 9/24/2017 5:29 PM, Marek Vasut wrote:\n> On 09/24/2017 12:59 PM, Vignesh R wrote:\n>> As per 66AK2G02 TRM[1] SPRUHY8F section 11.15.5.3 Indirect Access\n>> Controller programming sequence, a delay equal to couple of QSPI master\n>> clock(~5ns) is required after setting CQSPI_REG_INDIRECTWR_START bit and\n>> writing data to the flash. Introduce a quirk flag CQSPI_NEEDS_WR_DELAY\n>> to handle this and set this flag for TI 66AK2G SoC.\n>>\n>> [1]http://www.ti.com/lit/ug/spruhy8f/spruhy8f.pdf\n>>\n>> Signed-off-by: Vignesh R <vigneshr@ti.com>\n> \n> Is this TI specific or is this controller property ? I wouldn't be\n> surprised of the later ...\n\nI am not sure, there is no generic public documentation by cadence for\nthis IP. TI TRM clearly states this delay is required and I have\nverified it practically that this delay is indeed needed.\nBut current user of this IP, socfpga does not seem to mention anything\nabout it. So, I guess its TI specific quirk.\n\n> \n>> ---\n>>\n>> v3:\n>> Fix build warnings reported by kbuild test bot.\n>>\n>>  drivers/mtd/spi-nor/cadence-quadspi.c | 27 ++++++++++++++++++++++++++-\n>>  1 file changed, 26 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c\n>> index 53c7d8e0327a..5cd5d6f7303f 100644\n>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c\n>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c\n>> @@ -38,6 +38,9 @@\n>>  #define CQSPI_NAME\t\t\t\"cadence-qspi\"\n>>  #define CQSPI_MAX_CHIPSELECT\t\t16\n>>  \n>> +/* Quirks */\n>> +#define CQSPI_NEEDS_WR_DELAY\t\tBIT(0)\n>> +\n>>  struct cqspi_st;\n>>  \n>>  struct cqspi_flash_pdata {\n>> @@ -76,6 +79,7 @@ struct cqspi_st {\n>>  \tu32\t\t\tfifo_depth;\n>>  \tu32\t\t\tfifo_width;\n>>  \tu32\t\t\ttrigger_address;\n>> +\tu32\t\t\twr_delay;\n>>  \tstruct cqspi_flash_pdata f_pdata[CQSPI_MAX_CHIPSELECT];\n>>  };\n>>  \n>> @@ -608,6 +612,15 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor,\n>>  \treinit_completion(&cqspi->transfer_complete);\n>>  \twritel(CQSPI_REG_INDIRECTWR_START_MASK,\n>>  \t       reg_base + CQSPI_REG_INDIRECTWR);\n>> +\t/*\n>> +\t * As per 66AK2G02 TRM SPRUHY8F section 11.15.5.3 Indirect Access\n>> +\t * Controller programming sequence, couple of cycles of\n>> +\t * QSPI_REF_CLK delay is required for the above bit to\n>> +\t * be internally synchronized by the QSPI module. Provide 5\n>> +\t * cycles of delay.\n>> +\t */\n>> +\tif (cqspi->wr_delay)\n>> +\t\tndelay(cqspi->wr_delay);\n>>  \n>>  \twhile (remaining > 0) {\n>>  \t\twrite_bytes = remaining > page_size ? page_size : remaining;\n>> @@ -1156,6 +1169,7 @@ static int cqspi_probe(struct platform_device *pdev)\n>>  \tstruct cqspi_st *cqspi;\n>>  \tstruct resource *res;\n>>  \tstruct resource *res_ahb;\n>> +\tunsigned long data;\n>>  \tint ret;\n>>  \tint irq;\n>>  \n>> @@ -1213,6 +1227,10 @@ static int cqspi_probe(struct platform_device *pdev)\n>>  \t}\n>>  \n>>  \tcqspi->master_ref_clk_hz = clk_get_rate(cqspi->clk);\n>> +\tdata  = (unsigned long)of_device_get_match_data(dev);\n>> +\tif (data & CQSPI_NEEDS_WR_DELAY)\n>> +\t\tcqspi->wr_delay = 5 * DIV_ROUND_UP(NSEC_PER_SEC,\n>> +\t\t\t\t\t\t   cqspi->master_ref_clk_hz);\n>>  \n>>  \tret = devm_request_irq(dev, irq, cqspi_irq_handler, 0,\n>>  \t\t\t       pdev->name, cqspi);\n>> @@ -1284,7 +1302,14 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {\n>>  #endif\n>>  \n>>  static const struct of_device_id cqspi_dt_ids[] = {\n>> -\t{.compatible = \"cdns,qspi-nor\",},\n>> +\t{\n>> +\t\t.compatible = \"cdns,qspi-nor\",\n>> +\t\t.data = (void *)0,\n>> +\t},\n>> +\t{\n>> +\t\t.compatible = \"ti,k2g-qspi\",\n>> +\t\t.data = (void *)CQSPI_NEEDS_WR_DELAY,\n>> +\t},\n>>  \t{ /* end of table */ }\n>>  };\n>>  \n>>\n> \n>","headers":{"Return-Path":"<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"HY6E1HWB\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"VZwIaZcC\";\n\tdkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y0RXM5hWQz9sRW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 24 Sep 2017 22:36:03 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dw68X-00027I-7q; Sun, 24 Sep 2017 12:35:53 +0000","from fllnx209.ext.ti.com ([198.47.19.16])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dw68S-0001yN-G3; Sun, 24 Sep 2017 12:35:51 +0000","from dflxv15.itg.ti.com ([128.247.5.124])\n\tby fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v8OCY2JI030858; \n\tSun, 24 Sep 2017 07:34:02 -0500","from DLEE107.ent.ti.com (dlee107.ent.ti.com [157.170.170.37])\n\tby dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8OCXv3U002604;\n\tSun, 24 Sep 2017 07:33:57 -0500","from DLEE110.ent.ti.com (157.170.170.21) by DLEE107.ent.ti.com\n\t(157.170.170.37) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34;\n\tSun, 24 Sep 2017 07:33:56 -0500","from dlep32.itg.ti.com (157.170.170.100) by DLEE110.ent.ti.com\n\t(157.170.170.21) with Microsoft SMTP Server (version=TLS1_0,\n\tcipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend\n\tTransport; Sun, 24 Sep 2017 07:33:56 -0500","from [172.22.218.57] (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id v8OCXpje000382;\n\tSun, 24 Sep 2017 07:33:52 -0500"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:\n\tMessage-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description\n\t:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=Xdf3Ze1ssCHM75CHElAlQyJVRgieAg7QGPPOE/a3EBM=;\n\tb=HY6E1HWB5BKNt6\n\t2/JD/1eSe6/mLaql4LqRH+cDLP48RwgBNWi8mTIQtY/FQHFBw0SJfkKZwtI8XQFG/tTBPDrspjcSI\n\tKucW5ugQxBGi+FVgRibT53Wwx0XgJCjA1xTMQuyRAlHnaeepkg94U9OwfLEeBIyzjRvsOK93Hzww2\n\t+2c6nxlQuhRKU/7Blo8tvzrreLbfDvTXqRFSRI5Xs1AYJRh29fQ8LqRYjgVB3rRc0/eLRrWGikyxS\n\tM8+ocPgKNr5GxbmzBERdWxs/pjKgCMr6t4wbO0cWWXyraeb5q/eidD47+UqFSwrLCGNFcgXBYosiQ\n\tt4Carsm7Fsj2ieWZDjzg==;","v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1506256442;\n\tbh=U4AJTVEHOBpMZFR+ml9l0XP4eWgkIYe3SIRgeYPWSug=;\n\th=Subject:To:CC:References:From:Date:In-Reply-To;\n\tb=VZwIaZcCdXBQKS0WQgHPqM0p/F0cotEwq5Mu0Zx2ulhMf6A2ZaNWbmrQPyxY3W3E6\n\tgkmkAeG/0leKwpDpE3M3kwHDYiYYGxsOxOZe/Pb4MSpifj56vCZH3Br0eMstnKBC9d\n\tcrtf3fGJB1ktIGI+Pkki74gpaVwSSr0pv/1OM9dI="],"Subject":"Re: [PATCH v3 2/5] mtd: spi-nor: cadence-quadspi: add a delay in\n\twrite sequence","To":"Marek Vasut <marek.vasut@gmail.com>, Cyrille Pitchen\n\t<cyrille.pitchen@wedev4u.fr>","References":"<20170924105924.23923-1-vigneshr@ti.com>\n\t<20170924105924.23923-3-vigneshr@ti.com>\n\t<94313cae-4805-0b13-a469-72aa7556b685@gmail.com>","From":"Vignesh R <vigneshr@ti.com>","Message-ID":"<8990b971-91d5-747f-905b-5e24743e090d@ti.com>","Date":"Sun, 24 Sep 2017 18:03:51 +0530","User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<94313cae-4805-0b13-a469-72aa7556b685@gmail.com>","Content-Language":"en-US","X-EXCLAIMER-MD-CONFIG":"e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170924_053548_664101_D8CE196C ","X-CRM114-Status":"GOOD (  13.58  )","X-Spam-Score":"-2.0 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.0 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno trust [198.47.19.16 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd/>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","Cc":"Boris Brezillon <boris.brezillon@free-electrons.com>,\n\tdevicetree@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tRob Herring <robh+dt@kernel.org>, linux-mtd@lists.infradead.org,\n\tBrian Norris <computersforpeace@gmail.com>,\n\tDavid Woodhouse <dwmw2@infradead.org>,\n\tlinux-arm-kernel <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}},{"id":1774185,"web_url":"http://patchwork.ozlabs.org/comment/1774185/","msgid":"<d35d0891-71b9-12df-9689-dc77f56453ab@gmail.com>","list_archive_url":null,"date":"2017-09-24T13:13:56","subject":"Re: [PATCH v3 2/5] mtd: spi-nor: cadence-quadspi: add a delay in\n\twrite sequence","submitter":{"id":1124,"url":"http://patchwork.ozlabs.org/api/people/1124/","name":"Marek Vasut","email":"marek.vasut@gmail.com"},"content":"On 09/24/2017 02:33 PM, Vignesh R wrote:\n> \n> \n> On 9/24/2017 5:29 PM, Marek Vasut wrote:\n>> On 09/24/2017 12:59 PM, Vignesh R wrote:\n>>> As per 66AK2G02 TRM[1] SPRUHY8F section 11.15.5.3 Indirect Access\n>>> Controller programming sequence, a delay equal to couple of QSPI master\n>>> clock(~5ns) is required after setting CQSPI_REG_INDIRECTWR_START bit and\n>>> writing data to the flash. Introduce a quirk flag CQSPI_NEEDS_WR_DELAY\n>>> to handle this and set this flag for TI 66AK2G SoC.\n>>>\n>>> [1]http://www.ti.com/lit/ug/spruhy8f/spruhy8f.pdf\n>>>\n>>> Signed-off-by: Vignesh R <vigneshr@ti.com>\n>>\n>> Is this TI specific or is this controller property ? I wouldn't be\n>> surprised of the later ...\n> \n> I am not sure, there is no generic public documentation by cadence for\n> this IP. TI TRM clearly states this delay is required and I have\n> verified it practically that this delay is indeed needed.\n> But current user of this IP, socfpga does not seem to mention anything\n> about it. So, I guess its TI specific quirk.\n\nOK, let's go with that then. I didn't observe any stability issues with\nSoCFPGA, but I didn't run the flash at 100s of MHz either. At what kind\nof frequencies does the quirk become relevant ?\n\n>>\n>>> ---\n>>>\n>>> v3:\n>>> Fix build warnings reported by kbuild test bot.\n>>>\n>>>  drivers/mtd/spi-nor/cadence-quadspi.c | 27 ++++++++++++++++++++++++++-\n>>>  1 file changed, 26 insertions(+), 1 deletion(-)\n>>>\n>>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c\n>>> index 53c7d8e0327a..5cd5d6f7303f 100644\n>>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c\n>>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c\n>>> @@ -38,6 +38,9 @@\n>>>  #define CQSPI_NAME\t\t\t\"cadence-qspi\"\n>>>  #define CQSPI_MAX_CHIPSELECT\t\t16\n>>>  \n>>> +/* Quirks */\n>>> +#define CQSPI_NEEDS_WR_DELAY\t\tBIT(0)\n>>> +\n>>>  struct cqspi_st;\n>>>  \n>>>  struct cqspi_flash_pdata {\n>>> @@ -76,6 +79,7 @@ struct cqspi_st {\n>>>  \tu32\t\t\tfifo_depth;\n>>>  \tu32\t\t\tfifo_width;\n>>>  \tu32\t\t\ttrigger_address;\n>>> +\tu32\t\t\twr_delay;\n>>>  \tstruct cqspi_flash_pdata f_pdata[CQSPI_MAX_CHIPSELECT];\n>>>  };\n>>>  \n>>> @@ -608,6 +612,15 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor,\n>>>  \treinit_completion(&cqspi->transfer_complete);\n>>>  \twritel(CQSPI_REG_INDIRECTWR_START_MASK,\n>>>  \t       reg_base + CQSPI_REG_INDIRECTWR);\n>>> +\t/*\n>>> +\t * As per 66AK2G02 TRM SPRUHY8F section 11.15.5.3 Indirect Access\n>>> +\t * Controller programming sequence, couple of cycles of\n>>> +\t * QSPI_REF_CLK delay is required for the above bit to\n>>> +\t * be internally synchronized by the QSPI module. Provide 5\n>>> +\t * cycles of delay.\n>>> +\t */\n>>> +\tif (cqspi->wr_delay)\n>>> +\t\tndelay(cqspi->wr_delay);\n>>>  \n>>>  \twhile (remaining > 0) {\n>>>  \t\twrite_bytes = remaining > page_size ? page_size : remaining;\n>>> @@ -1156,6 +1169,7 @@ static int cqspi_probe(struct platform_device *pdev)\n>>>  \tstruct cqspi_st *cqspi;\n>>>  \tstruct resource *res;\n>>>  \tstruct resource *res_ahb;\n>>> +\tunsigned long data;\n>>>  \tint ret;\n>>>  \tint irq;\n>>>  \n>>> @@ -1213,6 +1227,10 @@ static int cqspi_probe(struct platform_device *pdev)\n>>>  \t}\n>>>  \n>>>  \tcqspi->master_ref_clk_hz = clk_get_rate(cqspi->clk);\n>>> +\tdata  = (unsigned long)of_device_get_match_data(dev);\n>>> +\tif (data & CQSPI_NEEDS_WR_DELAY)\n>>> +\t\tcqspi->wr_delay = 5 * DIV_ROUND_UP(NSEC_PER_SEC,\n>>> +\t\t\t\t\t\t   cqspi->master_ref_clk_hz);\n>>>  \n>>>  \tret = devm_request_irq(dev, irq, cqspi_irq_handler, 0,\n>>>  \t\t\t       pdev->name, cqspi);\n>>> @@ -1284,7 +1302,14 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {\n>>>  #endif\n>>>  \n>>>  static const struct of_device_id cqspi_dt_ids[] = {\n>>> -\t{.compatible = \"cdns,qspi-nor\",},\n>>> +\t{\n>>> +\t\t.compatible = \"cdns,qspi-nor\",\n>>> +\t\t.data = (void *)0,\n>>> +\t},\n>>> +\t{\n>>> +\t\t.compatible = \"ti,k2g-qspi\",\n>>> +\t\t.data = (void *)CQSPI_NEEDS_WR_DELAY,\n>>> +\t},\n>>>  \t{ /* end of table */ }\n>>>  };\n>>>  \n>>>\n>>\n>>","headers":{"Return-Path":"<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"SpyIGq/k\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"DY+4UlnT\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y0SPk6dNVz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 24 Sep 2017 23:15:22 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dw6kX-0008FP-Dc; Sun, 24 Sep 2017 13:15:10 +0000","from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dw6jk-0007No-5w; Sun, 24 Sep 2017 13:14:35 +0000","by mail-wm0-x244.google.com with SMTP id r136so4976152wmf.3;\n\tSun, 24 Sep 2017 06:13:59 -0700 (PDT)","from [192.168.1.4] (ip-86-49-107-50.net.upcbroadband.cz.\n\t[86.49.107.50]) by smtp.gmail.com with ESMTPSA id\n\t110sm2051204wra.39.2017.09.24.06.13.56\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tSun, 24 Sep 2017 06:13:57 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:\n\tMessage-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description\n\t:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=8GqyWLzsktZ5Jcmm4lb+ni3Ca3wfUmUajHLyIaXI0U8=;\n\tb=SpyIGq/k55SrbN\n\tcd8JKTaXOBAUnJKCEL0Tz3ZN5KLXSaSDphVwQT/Zhi7OZH0AFgjmQ3gu3ZwVYfVx81o6BmzPfu5HT\n\ts+COnZM0QZCEQjFVNFCoBzvTmqg7glSQmzyf0DuariPrnkNWngdUsfFLnD3+tIOL5hJe0qNijVMkH\n\txgUBk/+t/URuiE8Ji4b8GDnrySxbpMFFItHZlHAcV6Dm3ltdMA+G9u4O6xNDjmd/bVu3SSFiht4kC\n\tQ8HIWxy7uIARQRVlWJMpSiBpvLiu+OJmf4TsceMLabybkoha0yuKdWxmZHl6q69r/rafK3Bm7Mml2\n\tV7HXL2tV30tQDekB8W1Q==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=/tF8OYxwbrn+JBs7FiSnF7t/PANt196Fhl1ETym3L1Q=;\n\tb=DY+4UlnTmZ3MpfLyptnfUkkAtvw62jQfFcsaeOHbGyICc1XaG+6ctRj++5uYKWuLut\n\tAI0jBQdUjKZxcmnEBbGcQn5v/lEpizofxp7za8Mma/BQ9roRoC7MWgsygF3KozB6XuDv\n\tHrvWxdBweMVaeU1PmtM+ALxOpBXw2/eFMIp1r/it9XKwdSvRd7VZApKwzgFPrf+aiv8V\n\tacCA5LGbpdbtxeTmxwAx0v1l/euXXnWCMpW/ZHaXpjQkG+KaTi7hxtcmonrOfoeSVhc9\n\tTxSfVU4UjWVhinxg0F1mjctEpw0V+V7SsGQu5eyZVJrD6qWqOyXLiIT6p0RSkTY1USB0\n\tnuzQ=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:subject:to:cc:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=/tF8OYxwbrn+JBs7FiSnF7t/PANt196Fhl1ETym3L1Q=;\n\tb=TtuV+xDP0f1c7aJ57EU0nwKUNCPbH60s0RShJWZRZuSzycs3rHSuQ6Rdnr9zSKw+k1\n\tjyWdrZWfP+ycrDJc4vRBtkIzPpzg3zNAAOkQ2oA4dJVroOWrLcHdSyaQyTEV1OKqPyEr\n\tR39NnOzry2enaFa2lKsMm5SJLXsy5QHtDqKekQu9jODpr/Zzvc/FoqzPymCZhm0uUJyv\n\t79d9oOCb64M1PIVHo4K0NASphe76jKgXqCQx5klKObLmTExkq7L2dyYDPj9JJpnaWTSu\n\toUzNqCHEU/aaT9vDE7ZnJX4cNMcaoQTqlNs7WORrYt9m6Ftba4lNIccioUyaCqPK8hlf\n\tQtjw==","X-Gm-Message-State":"AHPjjUgAzVxx624E35uNbU0nvaIHFaNfAnFn3xtbUbPgxa5We3TSiNRC\n\tPe8CWpBUqJbzrRpHVMfryLFrocIf","X-Google-Smtp-Source":"AOwi7QB1jBcv+PoFv8BHllzmk1Xm3wcnc0YnOVJoMd5z4MEUx3uCZwvkOM+/qUTVn/EUq/4F8TS3IQ==","X-Received":"by 10.28.135.209 with SMTP id j200mr7458074wmd.40.1506258837725; \n\tSun, 24 Sep 2017 06:13:57 -0700 (PDT)","Subject":"Re: [PATCH v3 2/5] mtd: spi-nor: cadence-quadspi: add a delay in\n\twrite sequence","To":"Vignesh R <vigneshr@ti.com>, Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>","References":"<20170924105924.23923-1-vigneshr@ti.com>\n\t<20170924105924.23923-3-vigneshr@ti.com>\n\t<94313cae-4805-0b13-a469-72aa7556b685@gmail.com>\n\t<8990b971-91d5-747f-905b-5e24743e090d@ti.com>","From":"Marek Vasut <marek.vasut@gmail.com>","Message-ID":"<d35d0891-71b9-12df-9689-dc77f56453ab@gmail.com>","Date":"Sun, 24 Sep 2017 15:13:56 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<8990b971-91d5-747f-905b-5e24743e090d@ti.com>","Content-Language":"en-US","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170924_061420_677765_F192154E ","X-CRM114-Status":"GOOD (  18.85  )","X-Spam-Score":"-2.0 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.0 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno\n\ttrust [2a00:1450:400c:c09:0:0:0:244 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (marek.vasut[at]gmail.com)\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd/>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","Cc":"Boris Brezillon <boris.brezillon@free-electrons.com>,\n\tdevicetree@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tRob Herring <robh+dt@kernel.org>, linux-mtd@lists.infradead.org,\n\tBrian Norris <computersforpeace@gmail.com>,\n\tDavid Woodhouse <dwmw2@infradead.org>,\n\tlinux-arm-kernel <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}},{"id":1778301,"web_url":"http://patchwork.ozlabs.org/comment/1778301/","msgid":"<07137a92-244b-e009-54ae-71f733860f28@ti.com>","list_archive_url":null,"date":"2017-10-02T12:46:40","subject":"Re: [PATCH v3 2/5] mtd: spi-nor: cadence-quadspi: add a delay in\n\twrite sequence","submitter":{"id":65039,"url":"http://patchwork.ozlabs.org/api/people/65039/","name":"Raghavendra, Vignesh","email":"vigneshr@ti.com"},"content":"On 9/24/2017 6:43 PM, Marek Vasut wrote:\n> On 09/24/2017 02:33 PM, Vignesh R wrote:\n>>\n>>\n>> On 9/24/2017 5:29 PM, Marek Vasut wrote:\n>>> On 09/24/2017 12:59 PM, Vignesh R wrote:\n>>>> As per 66AK2G02 TRM[1] SPRUHY8F section 11.15.5.3 Indirect Access\n>>>> Controller programming sequence, a delay equal to couple of QSPI master\n>>>> clock(~5ns) is required after setting CQSPI_REG_INDIRECTWR_START bit and\n>>>> writing data to the flash. Introduce a quirk flag CQSPI_NEEDS_WR_DELAY\n>>>> to handle this and set this flag for TI 66AK2G SoC.\n>>>>\n>>>> [1]http://www.ti.com/lit/ug/spruhy8f/spruhy8f.pdf\n>>>>\n>>>> Signed-off-by: Vignesh R <vigneshr@ti.com>\n>>>\n>>> Is this TI specific or is this controller property ? I wouldn't be\n>>> surprised of the later ...\n>>\n>> I am not sure, there is no generic public documentation by cadence for\n>> this IP. TI TRM clearly states this delay is required and I have\n>> verified it practically that this delay is indeed needed.\n>> But current user of this IP, socfpga does not seem to mention anything\n>> about it. So, I guess its TI specific quirk.\n> \n> OK, let's go with that then. I didn't observe any stability issues with\n> SoCFPGA, but I didn't run the flash at 100s of MHz either. At what kind\n> of frequencies does the quirk become relevant ?\n> \n\nActually, delay is tied to QSPI master clk rate(not SPI bus clk rate).\nIt runs at 384MHz. Changing SPI bus rate has no effect.\n\nRegards\nVignesh\n\n>>>\n>>>> ---\n>>>>\n>>>> v3:\n>>>> Fix build warnings reported by kbuild test bot.\n>>>>\n>>>>  drivers/mtd/spi-nor/cadence-quadspi.c | 27 ++++++++++++++++++++++++++-\n>>>>  1 file changed, 26 insertions(+), 1 deletion(-)\n>>>>\n>>>> diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c\n>>>> index 53c7d8e0327a..5cd5d6f7303f 100644\n>>>> --- a/drivers/mtd/spi-nor/cadence-quadspi.c\n>>>> +++ b/drivers/mtd/spi-nor/cadence-quadspi.c\n>>>> @@ -38,6 +38,9 @@\n>>>>  #define CQSPI_NAME\t\t\t\"cadence-qspi\"\n>>>>  #define CQSPI_MAX_CHIPSELECT\t\t16\n>>>>  \n>>>> +/* Quirks */\n>>>> +#define CQSPI_NEEDS_WR_DELAY\t\tBIT(0)\n>>>> +\n>>>>  struct cqspi_st;\n>>>>  \n>>>>  struct cqspi_flash_pdata {\n>>>> @@ -76,6 +79,7 @@ struct cqspi_st {\n>>>>  \tu32\t\t\tfifo_depth;\n>>>>  \tu32\t\t\tfifo_width;\n>>>>  \tu32\t\t\ttrigger_address;\n>>>> +\tu32\t\t\twr_delay;\n>>>>  \tstruct cqspi_flash_pdata f_pdata[CQSPI_MAX_CHIPSELECT];\n>>>>  };\n>>>>  \n>>>> @@ -608,6 +612,15 @@ static int cqspi_indirect_write_execute(struct spi_nor *nor,\n>>>>  \treinit_completion(&cqspi->transfer_complete);\n>>>>  \twritel(CQSPI_REG_INDIRECTWR_START_MASK,\n>>>>  \t       reg_base + CQSPI_REG_INDIRECTWR);\n>>>> +\t/*\n>>>> +\t * As per 66AK2G02 TRM SPRUHY8F section 11.15.5.3 Indirect Access\n>>>> +\t * Controller programming sequence, couple of cycles of\n>>>> +\t * QSPI_REF_CLK delay is required for the above bit to\n>>>> +\t * be internally synchronized by the QSPI module. Provide 5\n>>>> +\t * cycles of delay.\n>>>> +\t */\n>>>> +\tif (cqspi->wr_delay)\n>>>> +\t\tndelay(cqspi->wr_delay);\n>>>>  \n>>>>  \twhile (remaining > 0) {\n>>>>  \t\twrite_bytes = remaining > page_size ? page_size : remaining;\n>>>> @@ -1156,6 +1169,7 @@ static int cqspi_probe(struct platform_device *pdev)\n>>>>  \tstruct cqspi_st *cqspi;\n>>>>  \tstruct resource *res;\n>>>>  \tstruct resource *res_ahb;\n>>>> +\tunsigned long data;\n>>>>  \tint ret;\n>>>>  \tint irq;\n>>>>  \n>>>> @@ -1213,6 +1227,10 @@ static int cqspi_probe(struct platform_device *pdev)\n>>>>  \t}\n>>>>  \n>>>>  \tcqspi->master_ref_clk_hz = clk_get_rate(cqspi->clk);\n>>>> +\tdata  = (unsigned long)of_device_get_match_data(dev);\n>>>> +\tif (data & CQSPI_NEEDS_WR_DELAY)\n>>>> +\t\tcqspi->wr_delay = 5 * DIV_ROUND_UP(NSEC_PER_SEC,\n>>>> +\t\t\t\t\t\t   cqspi->master_ref_clk_hz);\n>>>>  \n>>>>  \tret = devm_request_irq(dev, irq, cqspi_irq_handler, 0,\n>>>>  \t\t\t       pdev->name, cqspi);\n>>>> @@ -1284,7 +1302,14 @@ static const struct dev_pm_ops cqspi__dev_pm_ops = {\n>>>>  #endif\n>>>>  \n>>>>  static const struct of_device_id cqspi_dt_ids[] = {\n>>>> -\t{.compatible = \"cdns,qspi-nor\",},\n>>>> +\t{\n>>>> +\t\t.compatible = \"cdns,qspi-nor\",\n>>>> +\t\t.data = (void *)0,\n>>>> +\t},\n>>>> +\t{\n>>>> +\t\t.compatible = \"ti,k2g-qspi\",\n>>>> +\t\t.data = (void *)CQSPI_NEEDS_WR_DELAY,\n>>>> +\t},\n>>>>  \t{ /* end of table */ }\n>>>>  };\n>>>>  \n>>>>\n>>>\n>>>\n> \n>","headers":{"Return-Path":"<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"fgcPp5es\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ti.com header.i=@ti.com header.b=\"AAPB58NZ\";\n\tdkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y5MQm5JgLz9sMN\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  2 Oct 2017 23:48:16 +1100 (AEDT)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dz08i-0007oB-AX; Mon, 02 Oct 2017 12:48:04 +0000","from lelnx194.ext.ti.com ([198.47.27.80])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dz08G-0007hd-TF; Mon, 02 Oct 2017 12:47:40 +0000","from dflxv15.itg.ti.com ([128.247.5.124])\n\tby lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v92CkkHJ016745; \n\tMon, 2 Oct 2017 07:46:46 -0500","from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34])\n\tby dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v92CkkNJ030849;\n\tMon, 2 Oct 2017 07:46:46 -0500","from DLEE107.ent.ti.com (157.170.170.37) by DLEE104.ent.ti.com\n\t(157.170.170.34) with Microsoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34;\n\tMon, 2 Oct 2017 07:46:46 -0500","from dflp33.itg.ti.com (10.64.6.16) by DLEE107.ent.ti.com\n\t(157.170.170.37) with Microsoft SMTP Server (version=TLS1_0,\n\tcipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend\n\tTransport; Mon, 2 Oct 2017 07:46:46 -0500","from [172.22.217.158] (ileax41-snat.itg.ti.com [10.172.224.153])\n\tby dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v92Cke3b030547;\n\tMon, 2 Oct 2017 07:46:41 -0500"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:\n\tMessage-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description\n\t:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=HuMopzXKowJpo5Kx2UMiCPkn78xEeGnSE93icHtFTPY=;\n\tb=fgcPp5esjZ1rky\n\tvYV7R8rz7CG45wJfuP9ijk2WA4eljA5/sKeybC6yC6PkvoyVDFGmG+RNDIr5y/ENsOfFynoINFNv7\n\tkPEAVgbSyeVBXzYwDZDigeXlJGzAGkflSKv7ERDjM6uqSwW79rvDWaLTq27x+6t6QnkkeORRlPkAv\n\tfuwpW6LQXqdt7RJ5UGIsffJEKc0rNgkgxmo1hfeTF38+ZsoxM9UQnLCFk6ZOTiXXRhzBNdBo5lkDD\n\tSG7aAUUSZ+neq/l9bjivpJ3EZq2RkOVCDtD1a2dVjb0geIGPVNOaGfJinc/NfQ6f8QV3Iv5LYp8VZ\n\tXM4R/MWl9OaJzeliTcPQ==;","v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com;\n\ts=ti-com-17Q1; t=1506948406;\n\tbh=H3RjL1kLx1KII/o+Hf+Lj5y45ctD3ttPK2l2O8fUDyg=;\n\th=Subject:To:CC:References:From:Date:In-Reply-To;\n\tb=AAPB58NZpVErvHLm8IQ6eDKd6KWUA12F6br2Ed3BbIH4SnKzHKxko1WcYnyJRZV0U\n\t15fJKX1b+4K1u5m5ad0R5lg6axwVQUvC0MOtcudBxJRWNq9Z2WR+XsgMRrzNURZkTw\n\tcUGoFd8dDFpl/EshQ57/YskQikfxRur6zZOFbbDM="],"Subject":"Re: [PATCH v3 2/5] mtd: spi-nor: cadence-quadspi: add a delay in\n\twrite sequence","To":"Marek Vasut <marek.vasut@gmail.com>, Cyrille Pitchen\n\t<cyrille.pitchen@wedev4u.fr>","References":"<20170924105924.23923-1-vigneshr@ti.com>\n\t<20170924105924.23923-3-vigneshr@ti.com>\n\t<94313cae-4805-0b13-a469-72aa7556b685@gmail.com>\n\t<8990b971-91d5-747f-905b-5e24743e090d@ti.com>\n\t<d35d0891-71b9-12df-9689-dc77f56453ab@gmail.com>","From":"Vignesh R <vigneshr@ti.com>","Message-ID":"<07137a92-244b-e009-54ae-71f733860f28@ti.com>","Date":"Mon, 2 Oct 2017 18:16:40 +0530","User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<d35d0891-71b9-12df-9689-dc77f56453ab@gmail.com>","Content-Language":"en-US","X-EXCLAIMER-MD-CONFIG":"e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171002_054737_052695_FF73DA73 ","X-CRM114-Status":"GOOD (  13.93  )","X-Spam-Score":"-2.0 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.0 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno trust [198.47.27.80 listed in list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t-0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay\n\tdomain\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd/>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","Cc":"Boris Brezillon <boris.brezillon@free-electrons.com>,\n\tdevicetree@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tRob Herring <robh+dt@kernel.org>, linux-mtd@lists.infradead.org,\n\tBrian Norris <computersforpeace@gmail.com>,\n\tDavid Woodhouse <dwmw2@infradead.org>,\n\tlinux-arm-kernel <linux-arm-kernel@lists.infradead.org>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}}]