[{"id":1783543,"web_url":"http://patchwork.ozlabs.org/comment/1783543/","msgid":"<deae5a9f-4301-c7de-b265-b09292f8da15@gmail.com>","list_archive_url":null,"date":"2017-10-10T09:24:03","subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","submitter":{"id":1124,"url":"http://patchwork.ozlabs.org/api/people/1124/","name":"Marek Vasut","email":"marek.vasut@gmail.com"},"content":"On 09/20/2017 08:28 PM, matthew.gerlach@linux.intel.com wrote:\n> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n> \n> This patch adds support for a spi-nor, platform driver for the\n> Altera ASMI Parallel II IP Core.  The intended use case is to be able\n> to update the flash used to load a FPGA at power up with mtd-utils.\n> \n> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n> ---\n> v2:\n>     minor checkpatch fixing by Wu Hao <hao.wu@intel.com>\n>     Use read_dummy value as suggested by Cyrille Pitchen.\n>     Don't assume 4 byte addressing (Cryille Pichecn and Marek Vasut).\n>     Fixed #define indenting as suggested by Marek Vasut.\n>     Added units to timer values as suggested by Marek Vasut.\n>     Use io(read|write)8_rep() as suggested by Marek Vasut.\n>     Renamed function prefixed with __ as suggested by Marek Vasut.\n\n[...]\n\n> +#define QSPI_ACTION_REG\t\t\t0\n> +#define QSPI_ACTION_RST\t\t\tBIT(0)\n> +#define QSPI_ACTION_EN\t\t\tBIT(1)\n> +#define QSPI_ACTION_SC\t\t\tBIT(2)\n> +#define QSPI_ACTION_CHIP_SEL_SFT\t4\n> +#define QSPI_ACTION_DUMMY_SFT\t\t8\n> +#define QSPI_ACTION_READ_BACK_SFT\t16\n> +\n> +#define QSPI_FIFO_CNT_REG\t\t4\n> +#define QSPI_FIFO_DEPTH\t\t\t0x200\n> +#define QSPI_FIFO_CNT_MSK\t\t0x3ff\n> +#define QSPI_FIFO_CNT_RX_SFT\t\t0\n> +#define QSPI_FIFO_CNT_TX_SFT\t\t12\n> +\n> +#define QSPI_DATA_REG\t\t\t0x8\n> +\n> +#define QSPI_POLL_TIMEOUT_US\t\t10000000\n\n10 s poll timeout ? :)\n\n> +#define QSPI_POLL_INTERVAL_US\t\t5\n> +\n> +struct altera_asmip2 {\n\n[...]\n\nOtherwise looks good","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=\"udi+SR4I\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"TgUi3cso\"; 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 3yBBX800P3z9t6Y\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 10 Oct 2017 20:24:39 +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 1e1qmA-0003DV-Iv; Tue, 10 Oct 2017 09:24:34 +0000","from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1e1qm6-000378-Ag\n\tfor linux-mtd@lists.infradead.org; Tue, 10 Oct 2017 09:24:32 +0000","by mail-wm0-x241.google.com with SMTP id q132so3321375wmd.2\n\tfor <linux-mtd@lists.infradead.org>;\n\tTue, 10 Oct 2017 02:24:09 -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\to14sm4011376wra.54.2017.10.10.02.24.06\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 10 Oct 2017 02:24:07 -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: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:Cc:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Owner;\n\tbh=dn9HcGySMbttxOkxL/i2fJX4F/5JYDZzeAD/o+ZEZ/A=;\n\tb=udi+SR4IAO36o5NoVgNmG/xL77\n\tcMMLtE9T1W9MBL/ZorDfv6sGxGw/SwAXwiAIHpql43/MOjCoFDeoVexGHtLPhUdybD8AfaK8vuI9B\n\t+p9bO1LPcK+hjy2bh4UoOyvKFhb/DdTF/Z8EgOQ4caLGrNPkyhPYFG4h/KRd+MKtpZix8aEzVstCL\n\tSHKL+R+xNZPm8tSkn5CajioEeslYbPTjR/+/F+eOBxwq7Mqr+qOIzjgN9CuSnfCvYPXzOu8UR5+eU\n\tWlzpH5vQZHKV/KTZnhv+0zYOlebY4T1XhbbPS/M34rWmqgeZQm9P9gsDzi5xSXmYWOFUaAu4eHka5\n\tq+8rRWyg==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=subject:to:references:from:message-id:date:user-agent:mime-version\n\t:in-reply-to:content-language:content-transfer-encoding;\n\tbh=W9YIIPl6KTlBnHVLDXkLjcOtDBp3GD7RvcimrguVdF4=;\n\tb=TgUi3csooIFvsNieh30jBBJOmStaoUML74qV4TAZtxldJHvbxXjRUMs36U4+ifF2Cg\n\tLay7OuEzulVCH6zI42IKwzQuYedD2beOyKXU8PYIi6sAKLWUklf4sWK7KIWFgk9x1NoE\n\tIw2p+NX0AHYhN+uhTfZhmZa3D2tJI74G+ihHp+eUtNK8oB8EPBMRzaV5cH2NMJ2IdDpj\n\tY1MtXecSmjISSsUBpeouaoYsN6aoKUf+bT5oBWZy24y0UBvIO4Rew+x3SzPgFdfhLc57\n\tir3/XoV+Y4eo1nOTEme8nY68oBmpK+NNZ3HUwqoDi2YEKsqldr/yP4enelXkvAMtrmvp\n\tnSWQ=="],"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:references:from:message-id:date\n\t:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=W9YIIPl6KTlBnHVLDXkLjcOtDBp3GD7RvcimrguVdF4=;\n\tb=QKczDbI5uwOfLzu8fIk5NBakYmiSkSCjNhrjcDHEUEB/fg+4iVBjuef6PmkePochQB\n\tjPpuiVkFydOOpbpYB37AUJYAEu9JQf71Pa9o0H7O92kNKNRHfB0Z4+1OxkaBu2vVJKmf\n\tKZpSSDzOVIF+BPV/ho4sgkoUcNWFMQ5kLtpyDfHJtxAP/aHX4vmqusGN0RoWOsED6Ex+\n\tSDeozZlpvo/n+Zfbe8oo6aOnC7mYI9N/UMh0TZysBWziQb1rrPf3GsOPr8m573LIg2LH\n\tweQbUmmtQlKB4o59iXAg+tJdxwa+X0tdzLojqAwrqUkiknf74UaCqP4Du0Um6affSZzJ\n\t4tKQ==","X-Gm-Message-State":"AMCzsaXqXy0oDpMYcEhHSr8CLb8PX5FdSirYrsa8irLi225sBM2KDob3\n\t4kEw6W0yU2ps9so0fm7T6pg=","X-Google-Smtp-Source":"AOwi7QBBxC6mZBsg0XNpCYdq6V6O20SRFyNt85zegxBx5WG8gE2/Hcd/HsgYjdOGunxFmGsmn4efAw==","X-Received":"by 10.28.150.195 with SMTP id y186mr11091338wmd.52.1507627448143;\n\tTue, 10 Oct 2017 02:24:08 -0700 (PDT)","Subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","To":"matthew.gerlach@linux.intel.com, vndao@altera.com, dwmw2@infradead.org, \n\tcomputersforpeace@gmail.com, boris.brezillon@free-electrons.com,\n\trichard@nod.at, cyrille.pitchen@wedev4u.fr, robh+dt@kernel.org,\n\tmark.rutland@arm.com, linux-mtd@lists.infradead.org,\n\tdevicetree@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tgregkh@linuxfoundation.org, davem@davemloft.net, mchehab@kernel.org, \n\tlinux-fpga@vger.kernel.org, tien.hock.loh@intel.com,\n\thean.loong.ong@intel.com","References":"<1505932139-2905-1-git-send-email-matthew.gerlach@linux.intel.com>\n\t<1505932139-2905-3-git-send-email-matthew.gerlach@linux.intel.com>","From":"Marek Vasut <marek.vasut@gmail.com>","Message-ID":"<deae5a9f-4301-c7de-b265-b09292f8da15@gmail.com>","Date":"Tue, 10 Oct 2017 11:24:03 +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":"<1505932139-2905-3-git-send-email-matthew.gerlach@linux.intel.com>","Content-Language":"en-US","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171010_022430_620208_A6F98782 ","X-CRM114-Status":"GOOD (  12.34  )","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 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>","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":1784822,"web_url":"http://patchwork.ozlabs.org/comment/1784822/","msgid":"<alpine.DEB.2.20.1710110956260.2194@mgerlach-VirtualBox>","list_archive_url":null,"date":"2017-10-11T17:00:37","subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","submitter":{"id":70992,"url":"http://patchwork.ozlabs.org/api/people/70992/","name":"Matthew Gerlach","email":"matthew.gerlach@linux.intel.com"},"content":"On Tue, 10 Oct 2017, Marek Vasut wrote:\n\n> On 09/20/2017 08:28 PM, matthew.gerlach@linux.intel.com wrote:\n>> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n>>\n>> This patch adds support for a spi-nor, platform driver for the\n>> Altera ASMI Parallel II IP Core.  The intended use case is to be able\n>> to update the flash used to load a FPGA at power up with mtd-utils.\n>>\n>> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n>> ---\n>> v2:\n>>     minor checkpatch fixing by Wu Hao <hao.wu@intel.com>\n>>     Use read_dummy value as suggested by Cyrille Pitchen.\n>>     Don't assume 4 byte addressing (Cryille Pichecn and Marek Vasut).\n>>     Fixed #define indenting as suggested by Marek Vasut.\n>>     Added units to timer values as suggested by Marek Vasut.\n>>     Use io(read|write)8_rep() as suggested by Marek Vasut.\n>>     Renamed function prefixed with __ as suggested by Marek Vasut.\n>\n> [...]\n>\n>> +#define QSPI_ACTION_REG\t\t\t0\n>> +#define QSPI_ACTION_RST\t\t\tBIT(0)\n>> +#define QSPI_ACTION_EN\t\t\tBIT(1)\n>> +#define QSPI_ACTION_SC\t\t\tBIT(2)\n>> +#define QSPI_ACTION_CHIP_SEL_SFT\t4\n>> +#define QSPI_ACTION_DUMMY_SFT\t\t8\n>> +#define QSPI_ACTION_READ_BACK_SFT\t16\n>> +\n>> +#define QSPI_FIFO_CNT_REG\t\t4\n>> +#define QSPI_FIFO_DEPTH\t\t\t0x200\n>> +#define QSPI_FIFO_CNT_MSK\t\t0x3ff\n>> +#define QSPI_FIFO_CNT_RX_SFT\t\t0\n>> +#define QSPI_FIFO_CNT_TX_SFT\t\t12\n>> +\n>> +#define QSPI_DATA_REG\t\t\t0x8\n>> +\n>> +#define QSPI_POLL_TIMEOUT_US\t\t10000000\n>\n> 10 s poll timeout ? :)\n\nHi Marek,\n\nThe 10s timeout is fairly arbitrary.  In other words, I pulled it out of \nthin air.  Can you suggest a better timeout?  From a practical standpoint 10s \nseemed to be much better than no timeout when I was debugging bad FPGA \nimages.  Without a timeout I was hanging the system when the FPGA image \nfailed.  With this timeout, we get a nice message and Linux keeps running \nhappily.\n\nThanks for the feedback,\n\nMatthew Gerlach\n\n>\n>> +#define QSPI_POLL_INTERVAL_US\t\t 5 >> + >> +struct \naltera_asmip2 { >\n> [...]\n>\n> Otherwise looks good\n>\n> -- \n> Best regards,\n> Marek Vasut\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=\"rdNIj9i4\"; \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 3yC0d60QMzz9s4q\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 12 Oct 2017 04:01:45 +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 1e2KNx-0004c4-B1; Wed, 11 Oct 2017 17:01:33 +0000","from mga14.intel.com ([192.55.52.115])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1e2KNS-0004MH-TY\n\tfor linux-mtd@lists.infradead.org; Wed, 11 Oct 2017 17:01:10 +0000","from orsmga004.jf.intel.com ([10.7.209.38])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t11 Oct 2017 10:00:41 -0700","from mgerlach-mobl.amr.corp.intel.com (HELO [10.0.2.15])\n\t([10.254.126.215])\n\tby orsmga004.jf.intel.com with ESMTP; 11 Oct 2017 10:00:39 -0700"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:\n\tContent-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive:\n\tList-Unsubscribe:List-Id:MIME-Version:References:Message-ID:In-Reply-To:\n\tSubject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner;\n\tbh=nIt9oc1qZ6le1KSqJSaD5RrT+E6b9iWpI2kZ684CNKI=;\n\tb=rdNIj9i4Bu+0fbcknWmOrtKnl\n\tK8pNMMgFu4ngojzFTSGSfVMVenj6NinwsU2ORXYscVkLilApsrVwdcczUKlNNuDYd5ztMO9sOoLM6\n\tgpJuD6Thuedksv6RptUl3Qx9rrT6H5MPS04qWt7ogKSQOeJ8iXMegzAjUSIJgNdSNWcLeyRWTdgYL\n\tet1h1wAmzgJIi/5JCG7qevVRNmjNwQINHancUOtP/cJb+dPEdkL5LXpOTYjqkRv7YIFXTf4n1DMm0\n\tvUtYnZK4amz7TlgMU2Qvk+Uge/GjF2Ylge0UXjRJw2Femw8m1LCk8Ne1f6ZVaEcOvyONS4NDNz55j\n\tRTCLZBHdw==;","X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos;i=\"5.43,362,1503385200\"; d=\"scan'208\";a=\"137512805\"","Date":"Wed, 11 Oct 2017 10:00:37 -0700 (PDT)","From":"matthew.gerlach@linux.intel.com","X-X-Sender":"mgerlach@mgerlach-VirtualBox","To":"Marek Vasut <marek.vasut@gmail.com>","Subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","In-Reply-To":"<deae5a9f-4301-c7de-b265-b09292f8da15@gmail.com>","Message-ID":"<alpine.DEB.2.20.1710110956260.2194@mgerlach-VirtualBox>","References":"<1505932139-2905-1-git-send-email-matthew.gerlach@linux.intel.com>\n\t<1505932139-2905-3-git-send-email-matthew.gerlach@linux.intel.com>\n\t<deae5a9f-4301-c7de-b265-b09292f8da15@gmail.com>","User-Agent":"Alpine 2.20 (DEB 67 2015-01-07)","MIME-Version":"1.0","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171011_100103_011988_45B01718 ","X-CRM114-Status":"GOOD (  10.12  )","X-Spam-Score":"-6.9 (------)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-6.9 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/,\n\thigh trust [192.55.52.115 listed in list.dnswl.org]\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]","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":"vndao@altera.com, boris.brezillon@free-electrons.com, mchehab@kernel.org,\n\tdevicetree@vger.kernel.org, hean.loong.ong@intel.com, richard@nod.at, \n\tlinux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tgregkh@linuxfoundation.org, robh+dt@kernel.org,\n\tlinux-mtd@lists.infradead.org, \n\tcyrille.pitchen@wedev4u.fr, mark.rutland@arm.com,\n\tcomputersforpeace@gmail.com, \n\tdwmw2@infradead.org, davem@davemloft.net, tien.hock.loh@intel.com","Content-Transfer-Encoding":"7bit","Content-Type":"text/plain; charset=\"us-ascii\"; Format=\"flowed\"","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}},{"id":1784971,"web_url":"http://patchwork.ozlabs.org/comment/1784971/","msgid":"<ca36c177-0e7c-647d-f821-ab4bb7d85b10@gmail.com>","list_archive_url":null,"date":"2017-10-11T21:06:02","subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","submitter":{"id":1124,"url":"http://patchwork.ozlabs.org/api/people/1124/","name":"Marek Vasut","email":"marek.vasut@gmail.com"},"content":"On 10/11/2017 07:00 PM, matthew.gerlach@linux.intel.com wrote:\n> \n> \n> On Tue, 10 Oct 2017, Marek Vasut wrote:\n> \n>> On 09/20/2017 08:28 PM, matthew.gerlach@linux.intel.com wrote:\n>>> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n>>>\n>>> This patch adds support for a spi-nor, platform driver for the\n>>> Altera ASMI Parallel II IP Core.  The intended use case is to be able\n>>> to update the flash used to load a FPGA at power up with mtd-utils.\n>>>\n>>> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n>>> ---\n>>> v2:\n>>>     minor checkpatch fixing by Wu Hao <hao.wu@intel.com>\n>>>     Use read_dummy value as suggested by Cyrille Pitchen.\n>>>     Don't assume 4 byte addressing (Cryille Pichecn and Marek Vasut).\n>>>     Fixed #define indenting as suggested by Marek Vasut.\n>>>     Added units to timer values as suggested by Marek Vasut.\n>>>     Use io(read|write)8_rep() as suggested by Marek Vasut.\n>>>     Renamed function prefixed with __ as suggested by Marek Vasut.\n>>\n>> [...]\n>>\n>>> +#define QSPI_ACTION_REG            0\n>>> +#define QSPI_ACTION_RST            BIT(0)\n>>> +#define QSPI_ACTION_EN            BIT(1)\n>>> +#define QSPI_ACTION_SC            BIT(2)\n>>> +#define QSPI_ACTION_CHIP_SEL_SFT    4\n>>> +#define QSPI_ACTION_DUMMY_SFT        8\n>>> +#define QSPI_ACTION_READ_BACK_SFT    16\n>>> +\n>>> +#define QSPI_FIFO_CNT_REG        4\n>>> +#define QSPI_FIFO_DEPTH            0x200\n>>> +#define QSPI_FIFO_CNT_MSK        0x3ff\n>>> +#define QSPI_FIFO_CNT_RX_SFT        0\n>>> +#define QSPI_FIFO_CNT_TX_SFT        12\n>>> +\n>>> +#define QSPI_DATA_REG            0x8\n>>> +\n>>> +#define QSPI_POLL_TIMEOUT_US        10000000\n>>\n>> 10 s poll timeout ? :)\n> \n> Hi Marek,\n> \n> The 10s timeout is fairly arbitrary.  In other words, I pulled it out of\n> thin air.  Can you suggest a better timeout?  From a practical\n> standpoint 10s seemed to be much better than no timeout when I was\n> debugging bad FPGA images.  Without a timeout I was hanging the system\n> when the FPGA image failed.  With this timeout, we get a nice message\n> and Linux keeps running happily.\nAFAIK the SPI subsystem has a timeout which is adaptive to the bus\nclock, maybe that's what you want to use here ?","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=\"pYfJRzoj\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"rF3cz5fO\"; 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 3yC63y0n3Lz9t2W\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 12 Oct 2017 08:06:54 +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 1e2ODL-0006FH-9n; Wed, 11 Oct 2017 21:06:51 +0000","from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1e2OCw-0006A3-N8\n\tfor linux-mtd@lists.infradead.org; Wed, 11 Oct 2017 21:06:28 +0000","by mail-wm0-x22f.google.com with SMTP id m72so21495783wmc.0\n\tfor <linux-mtd@lists.infradead.org>;\n\tWed, 11 Oct 2017 14:06:05 -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\tc37sm33047638wra.73.2017.10.11.14.06.02\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 11 Oct 2017 14:06:03 -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=JWWv8KeRZZyH7qcPb0vvYS38qAPN3wTVFsxG4wob6Z0=;\n\tb=pYfJRzoj72O7gb\n\tGrQTgsR5pyv1x5Fmf0+UMyPt2sipSeRm2h/h9q8Sq4/liqw7l4Q5eLX5lpZEfj62SKrVuqrU9E5hW\n\tExwXqi/kUPcyOsOsgOpVDdRSC7TWoq7zKZ9DaWXjbl8h7SckkP0OJ+ZHjBoTp6WSfGJJKV2O6eNAX\n\t29txIFijg5dS0yOTTUSKPWrv17AbZzF9QwYhX3a+OuCzUdgi5MD4kTUTMo9O0m8t4hoGbvU6O8uO7\n\tG4Geq5vylJcsMEv/bwCVF1B/5qZM8wgAIMs3Ggbt7IdzO4niqkYymyvHQMQjzJ5HBlLGuT94XbpcZ\n\tEZRjQZyF5zsl3cVJNEPw==;","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=Kse5GkseBYMVCxZkwML4m765E9TJmQQ7albYTlXfRRs=;\n\tb=rF3cz5fOCqHUpvYFoavBb51KeFljbMxyY6zyyeZsIGN40bNuvrKRmDrvqBymvFL930\n\tw4JqcNi2pwMjfO2g4+6b2Bf2XHiCo29OSnmLST6C1jytOBlpKAH3oRFZ7XX+7lnbHFvZ\n\t+a22reWx2DOx2UO/26g9xNK/AwqRlhFSdkZsuJOIimnn0/NLcj21kCLFmQ8MgyCcKSZ3\n\tZSgRduL5BB/ZjY2/SsGn3cWR5NjJOogQ+ElQSTUisabUtza6e7/mKVhKXvo+U4JA+3P3\n\taHCITq0vLAKVWHXBdgxgd7YX7YY4JmQt8snI37YpPctt/BNncjpWWQkFARcfMUDuLjfN\n\ty2AQ=="],"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=Kse5GkseBYMVCxZkwML4m765E9TJmQQ7albYTlXfRRs=;\n\tb=MfvRBjnfMghZtI91ICLE19DQwvFR0OE3+tg3fF2HJpuv5ptdujSPIprS9DTnUciCbT\n\tcqFQ/Zc8LP8Lu+2naVtr540MBrEz8Ik3TaNXIe3hbo/Y3Wy0Zafp0DhtBZ4hKBLDvF30\n\tNblI+w86Gw87o1jKC6D2Re1FsIzY/MKNTDKoqkxa/g6zN7NTX/z8C/bii71K2I4o+dqt\n\t+oVPHRc70MXGmjCsidIQDxydrdqi775gekMpkelY4Fl20PCEO/3GhuX9d1OgbQy7qKUO\n\tM1cNEDTK90PdiWYDsB8V7/UJFWmTxRweZSpaXdXqgGNKvEcIhJ6b/k/zGdpfAPRbL6yM\n\tdMsA==","X-Gm-Message-State":"AMCzsaVUHducLpzfMiRat1/7FQm/bt0wMPovzLQwvC0WdHVNhegDx33t\n\twcsVzMFX03//1uz/tKWZdTY=","X-Google-Smtp-Source":"AOwi7QBqnIQsX+BuQZh3VA2ugx0gN8C3L5ABG3pCjjx10nxXHJ5CXkpXua051VR572kfxVR+ZP5tOw==","X-Received":"by 10.28.209.200 with SMTP id i191mr146392wmg.156.1507755964419; \n\tWed, 11 Oct 2017 14:06:04 -0700 (PDT)","Subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","To":"matthew.gerlach@linux.intel.com","References":"<1505932139-2905-1-git-send-email-matthew.gerlach@linux.intel.com>\n\t<1505932139-2905-3-git-send-email-matthew.gerlach@linux.intel.com>\n\t<deae5a9f-4301-c7de-b265-b09292f8da15@gmail.com>\n\t<alpine.DEB.2.20.1710110956260.2194@mgerlach-VirtualBox>","From":"Marek Vasut <marek.vasut@gmail.com>","Message-ID":"<ca36c177-0e7c-647d-f821-ab4bb7d85b10@gmail.com>","Date":"Wed, 11 Oct 2017 23:06:02 +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":"<alpine.DEB.2.20.1710110956260.2194@mgerlach-VirtualBox>","Content-Language":"en-US","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171011_140626_930383_50A08C18 ","X-CRM114-Status":"GOOD (  14.34  )","X-Spam-Score":"-2.7 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\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-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow\n\ttrust [2a00:1450:400c:c09:0:0:0:22f listed in] [list.dnswl.org]\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":"vndao@altera.com, boris.brezillon@free-electrons.com, mchehab@kernel.org,\n\tdevicetree@vger.kernel.org, hean.loong.ong@intel.com, richard@nod.at, \n\tlinux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tgregkh@linuxfoundation.org, robh+dt@kernel.org,\n\tlinux-mtd@lists.infradead.org, \n\tcyrille.pitchen@wedev4u.fr, mark.rutland@arm.com,\n\tcomputersforpeace@gmail.com, \n\tdwmw2@infradead.org, davem@davemloft.net, tien.hock.loh@intel.com","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}},{"id":1786595,"web_url":"http://patchwork.ozlabs.org/comment/1786595/","msgid":"<alpine.DEB.2.20.1710131215370.1541@mgerlach-VirtualBox>","list_archive_url":null,"date":"2017-10-13T19:24:29","subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","submitter":{"id":70992,"url":"http://patchwork.ozlabs.org/api/people/70992/","name":"Matthew Gerlach","email":"matthew.gerlach@linux.intel.com"},"content":"On Wed, 11 Oct 2017, Marek Vasut wrote:\n\n> On 10/11/2017 07:00 PM, matthew.gerlach@linux.intel.com wrote:\n>>\n>>\n>> On Tue, 10 Oct 2017, Marek Vasut wrote:\n>>\n>>> On 09/20/2017 08:28 PM, matthew.gerlach@linux.intel.com wrote:\n>>>> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n>>>>\n>>>> This patch adds support for a spi-nor, platform driver for the\n>>>> Altera ASMI Parallel II IP Core.  The intended use case is to be able\n>>>> to update the flash used to load a FPGA at power up with mtd-utils.\n>>>>\n>>>> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n>>>> ---\n>>>> v2:\n>>>>     minor checkpatch fixing by Wu Hao <hao.wu@intel.com>\n>>>>     Use read_dummy value as suggested by Cyrille Pitchen.\n>>>>     Don't assume 4 byte addressing (Cryille Pichecn and Marek Vasut).\n>>>>     Fixed #define indenting as suggested by Marek Vasut.\n>>>>     Added units to timer values as suggested by Marek Vasut.\n>>>>     Use io(read|write)8_rep() as suggested by Marek Vasut.\n>>>>     Renamed function prefixed with __ as suggested by Marek Vasut.\n>>>\n>>> [...]\n>>>\n>>>> +#define QSPI_ACTION_REG            0\n>>>> +#define QSPI_ACTION_RST            BIT(0)\n>>>> +#define QSPI_ACTION_EN            BIT(1)\n>>>> +#define QSPI_ACTION_SC            BIT(2)\n>>>> +#define QSPI_ACTION_CHIP_SEL_SFT    4\n>>>> +#define QSPI_ACTION_DUMMY_SFT        8\n>>>> +#define QSPI_ACTION_READ_BACK_SFT    16\n>>>> +\n>>>> +#define QSPI_FIFO_CNT_REG        4\n>>>> +#define QSPI_FIFO_DEPTH            0x200\n>>>> +#define QSPI_FIFO_CNT_MSK        0x3ff\n>>>> +#define QSPI_FIFO_CNT_RX_SFT        0\n>>>> +#define QSPI_FIFO_CNT_TX_SFT        12\n>>>> +\n>>>> +#define QSPI_DATA_REG            0x8\n>>>> +\n>>>> +#define QSPI_POLL_TIMEOUT_US        10000000\n>>>\n>>> 10 s poll timeout ? :)\n>>\n>> Hi Marek,\n>>\n>> The 10s timeout is fairly arbitrary.  In other words, I pulled it out of\n>> thin air.  Can you suggest a better timeout?  From a practical\n>> standpoint 10s seemed to be much better than no timeout when I was\n>> debugging bad FPGA images.  Without a timeout I was hanging the system\n>> when the FPGA image failed.  With this timeout, we get a nice message\n>> and Linux keeps running happily.\n> AFAIK the SPI subsystem has a timeout which is adaptive to the bus\n> clock, maybe that's what you want to use here ?\n\nHi Marek,\n\nI looked in spi-nor.c, and I see the following two macros:\n#define DEFAULT_READY_WAIT_JIFFIES\t\t(40UL * HZ)\n#define CHIP_ERASE_2MB_READY_WAIT_JIFFIES\t(40UL * HZ)\n\nThese timers values are used at the spi-nor layer for waiting for an\noperation to complete.  It is the time spent waiting for Work In Progress\nto clear.\n\nThe timer value I'm using, QSPI_POLL_TIMEOUT_US, is used at a lower layer.\nThis timer value is used for the time it takes to send the opcode and tx \ndata and receive any bytes from the flash.  While 10 seconds may seem \nlong, I am just trying to avoid a system hang when there is a catastrophic\nfailure with the flash controller in the FPGA or the flash part itself.\n\nI certainly could be missing something with regards to the timeouts, but I \nthink 10s for QSPI_POLL_TIMEOUT_US doesn't hurt, and it definately helps \nwhen something goes wrong.\n\nThanks for the feedback,\nMatthew Gerlach\n\n>\n> -- \n> Best regards,\n> Marek Vasut\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=\"RRl/kcOz\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=infradead.org header.i=@infradead.org\n\theader.b=\"jpcxlkhx\"; 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 3yDHjq3LDLz9sRW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 14 Oct 2017 06:25:17 +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 1e35Zu-0001zY-3g; Fri, 13 Oct 2017 19:25:02 +0000","from casper.infradead.org ([2001:8b0:10b:1236::1])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1e35Zq-0001zO-CL\n\tfor linux-mtd@bombadil.infradead.org; Fri, 13 Oct 2017 19:24:58 +0000","from mga09.intel.com ([134.134.136.24])\n\tby casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1e35Zm-0005rd-I0\n\tfor linux-mtd@lists.infradead.org; Fri, 13 Oct 2017 19:24:56 +0000","from orsmga003.jf.intel.com ([10.7.209.27])\n\tby orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Oct 2017 12:24:32 -0700","from mgerlach-mobl.amr.corp.intel.com (HELO [10.0.2.15])\n\t([10.254.126.215])\n\tby orsmga003.jf.intel.com with ESMTP; 13 Oct 2017 12:24:30 -0700"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209;\n\th=Sender:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:\n\tMIME-Version:References:Message-ID:In-Reply-To:Subject:To:From:Date:Reply-To:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner;\n\tbh=ZCTnJ302HD3FOqujXy/C44DVtBycfyQ7fZE60n6c820=;\n\tb=RRl/kcOzQGtUWsfoBCIFUA/Sc\n\tBkDPgfwDp3A51wOlwkIyrPnk6zq9J45hnBdMMlzV7kaCT1EvHNrfdFO65NyRg86JmlKOsaeydBHi6\n\tprQ4v2rfPDsF9T4nUPcqV4bmjqOkMxDxIYEe38vAW4hJ+ZJ61XRxodSyLZKvvPpQFgN+kOHTg1Zxk\n\tu87zrhEJ0iihiKiqZYDN87vPSA8l8aUj3K7ErObdAL4QLmGZbrkGRSX4SesxbUdpKpr76GGARokMi\n\tk8xjYYZF7KMBnGertfsuhDFLON/PuzWdXGunuwySMK686LH8BZfi27N40g8HlTtEW4BCdBEBFTr0N\n\tNOua+EQqA==;","v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=infradead.org; s=casper.20170209;\n\th=Content-Type:MIME-Version:References:\n\tMessage-ID:In-Reply-To:Subject:cc:To:From:Date:Sender:Reply-To:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:\n\tList-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;\n\tbh=BE+VwAm/zok9Pdu2Dw7fueo7XDrdraFwjhRPGl17ZjM=;\n\tb=jpcxlkhxAE2F1k5eVi1mMM+yD\n\tVyvql6vEwlfyXwBN8TLEw63sdpG6+8v4XEPBc0lka+ljOqtxpIS1HMjLZQEVAOBpzbbzlKA0ZTTLH\n\tGl+0KqzApfmfm1GOqkjQLM7CpaqVIAtJjJLUcGq5wKvsRcpIgRwEohrNM3Ut1Yqp/qUqx8I6GXEV7\n\t1zCg8v2n6PqC1Bb73l8y8IhJkhP/52Vdy+YLHVrLUD0C6hkOmkeavcKUlBhzlDamP9FFrm1hjK9r8\n\totY8lNzI5NaiJOb+9Y2Tennu6FaZKsKtWw778Mo4R9GcEDm/+kYc3KVJsmhVh5A+Mre59KBHf0Ttf\n\tAIEMRkCgA==;"],"X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos; i=\"5.43,372,1503385200\"; d=\"scan'208\";\n\ta=\"1024963784\"","Date":"Fri, 13 Oct 2017 12:24:29 -0700 (PDT)","From":"matthew.gerlach@linux.intel.com","X-X-Sender":"mgerlach@mgerlach-VirtualBox","To":"Marek Vasut <marek.vasut@gmail.com>","Subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","In-Reply-To":"<ca36c177-0e7c-647d-f821-ab4bb7d85b10@gmail.com>","Message-ID":"<alpine.DEB.2.20.1710131215370.1541@mgerlach-VirtualBox>","References":"<1505932139-2905-1-git-send-email-matthew.gerlach@linux.intel.com>\n\t<1505932139-2905-3-git-send-email-matthew.gerlach@linux.intel.com>\n\t<deae5a9f-4301-c7de-b265-b09292f8da15@gmail.com>\n\t<alpine.DEB.2.20.1710110956260.2194@mgerlach-VirtualBox>\n\t<ca36c177-0e7c-647d-f821-ab4bb7d85b10@gmail.com>","User-Agent":"Alpine 2.20 (DEB 67 2015-01-07)","MIME-Version":"1.0","Content-Type":"multipart/mixed; BOUNDARY=\"8323329-241464664-1507922672=:1541\"","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171013_202455_089346_3570EBBB ","X-CRM114-Status":"GOOD (  25.27  )","X-Spam-Score":"-6.9 (------)","X-Spam-Report":"SpamAssassin version 3.4.1 on casper.infradead.org summary:\n\tContent analysis details:   (-6.9 points, 5.0 required)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_MSPIKE_H3      RBL: Good reputation (+3)\n\t[134.134.136.24 listed in wl.mailspike.net]\n\t-5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/,\n\thigh trust [134.134.136.24 listed in list.dnswl.org]\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.0 RCVD_IN_MSPIKE_WL      Mailspike good senders","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":"vndao@altera.com, boris.brezillon@free-electrons.com, mchehab@kernel.org,\n\tdevicetree@vger.kernel.org, hean.loong.ong@intel.com, richard@nod.at, \n\tlinux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tgregkh@linuxfoundation.org, robh+dt@kernel.org,\n\tlinux-mtd@lists.infradead.org, \n\tcyrille.pitchen@wedev4u.fr, mark.rutland@arm.com,\n\tcomputersforpeace@gmail.com, \n\tdwmw2@infradead.org, davem@davemloft.net, tien.hock.loh@intel.com","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}},{"id":1786648,"web_url":"http://patchwork.ozlabs.org/comment/1786648/","msgid":"<089bb472-f824-26d7-0d72-66e64c2f24c4@gmail.com>","list_archive_url":null,"date":"2017-10-13T20:34:27","subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","submitter":{"id":1124,"url":"http://patchwork.ozlabs.org/api/people/1124/","name":"Marek Vasut","email":"marek.vasut@gmail.com"},"content":"On 10/13/2017 09:24 PM, matthew.gerlach@linux.intel.com wrote:\n\n[ culling the ridiculous cc list ]\n\n> On Wed, 11 Oct 2017, Marek Vasut wrote:\n> \n>> On 10/11/2017 07:00 PM, matthew.gerlach@linux.intel.com wrote:\n>>>\n>>>\n>>> On Tue, 10 Oct 2017, Marek Vasut wrote:\n>>>\n>>>> On 09/20/2017 08:28 PM, matthew.gerlach@linux.intel.com wrote:\n>>>>> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n>>>>>\n>>>>> This patch adds support for a spi-nor, platform driver for the\n>>>>> Altera ASMI Parallel II IP Core.  The intended use case is to be able\n>>>>> to update the flash used to load a FPGA at power up with mtd-utils.\n>>>>>\n>>>>> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>\n>>>>> ---\n>>>>> v2:\n>>>>>     minor checkpatch fixing by Wu Hao <hao.wu@intel.com>\n>>>>>     Use read_dummy value as suggested by Cyrille Pitchen.\n>>>>>     Don't assume 4 byte addressing (Cryille Pichecn and Marek Vasut).\n>>>>>     Fixed #define indenting as suggested by Marek Vasut.\n>>>>>     Added units to timer values as suggested by Marek Vasut.\n>>>>>     Use io(read|write)8_rep() as suggested by Marek Vasut.\n>>>>>     Renamed function prefixed with __ as suggested by Marek Vasut.\n>>>>\n>>>> [...]\n>>>>\n>>>>> +#define QSPI_ACTION_REG            0\n>>>>> +#define QSPI_ACTION_RST            BIT(0)\n>>>>> +#define QSPI_ACTION_EN            BIT(1)\n>>>>> +#define QSPI_ACTION_SC            BIT(2)\n>>>>> +#define QSPI_ACTION_CHIP_SEL_SFT    4\n>>>>> +#define QSPI_ACTION_DUMMY_SFT        8\n>>>>> +#define QSPI_ACTION_READ_BACK_SFT    16\n>>>>> +\n>>>>> +#define QSPI_FIFO_CNT_REG        4\n>>>>> +#define QSPI_FIFO_DEPTH            0x200\n>>>>> +#define QSPI_FIFO_CNT_MSK        0x3ff\n>>>>> +#define QSPI_FIFO_CNT_RX_SFT        0\n>>>>> +#define QSPI_FIFO_CNT_TX_SFT        12\n>>>>> +\n>>>>> +#define QSPI_DATA_REG            0x8\n>>>>> +\n>>>>> +#define QSPI_POLL_TIMEOUT_US        10000000\n>>>>\n>>>> 10 s poll timeout ? :)\n>>>\n>>> Hi Marek,\n>>>\n>>> The 10s timeout is fairly arbitrary.  In other words, I pulled it out of\n>>> thin air.  Can you suggest a better timeout?  From a practical\n>>> standpoint 10s seemed to be much better than no timeout when I was\n>>> debugging bad FPGA images.  Without a timeout I was hanging the system\n>>> when the FPGA image failed.  With this timeout, we get a nice message\n>>> and Linux keeps running happily.\n>> AFAIK the SPI subsystem has a timeout which is adaptive to the bus\n>> clock, maybe that's what you want to use here ?\n> \n> Hi Marek,\n> \n> I looked in spi-nor.c, and I see the following two macros:\n> #define DEFAULT_READY_WAIT_JIFFIES        (40UL * HZ)\n> #define CHIP_ERASE_2MB_READY_WAIT_JIFFIES    (40UL * HZ)\n> \n> These timers values are used at the spi-nor layer for waiting for an\n> operation to complete.  It is the time spent waiting for Work In Progress\n> to clear.\n> \n> The timer value I'm using, QSPI_POLL_TIMEOUT_US, is used at a lower layer.\n> This timer value is used for the time it takes to send the opcode and tx\n> data and receive any bytes from the flash.  While 10 seconds may seem\n> long, I am just trying to avoid a system hang when there is a catastrophic\n> failure with the flash controller in the FPGA or the flash part itself.\n\nIt takes 10s to detect catastrophic failure ? I'd expect you can scale\nthat timeout value by the bus clock speed.\n\nWe have ie. this in drivers/spi/spi.c:\n\n9                                 ret = 0;\n1040                                 ms = 8LL * 1000LL * xfer->len;\n1041                                 do_div(ms, xfer->speed_hz);\n1042                                 ms += ms + 200; /* some tolerance */\n1043\n1044                                 if (ms > UINT_MAX)\n1045                                         ms = UINT_MAX;\n1046\n1047                                 ms =\nwait_for_completion_timeout(&master->xfer_completion,\n1048\nmsecs_to_jiffies(ms));\n\n> I certainly could be missing something with regards to the timeouts, but\n> I think 10s for QSPI_POLL_TIMEOUT_US doesn't hurt, and it definately\n> helps when something goes wrong.\n> \n> Thanks for the feedback,\n> Matthew Gerlach\n> \n>>\n>> -- \n>> Best regards,\n>> Marek Vasut\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=\"oUPnQ74W\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"m6pxufLr\"; 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 3yDKGQ3Rs8z9sRm\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 14 Oct 2017 07:35:10 +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 1e36fX-0004tk-0F; Fri, 13 Oct 2017 20:34:55 +0000","from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1e36fT-0004sa-JB\n\tfor linux-mtd@lists.infradead.org; Fri, 13 Oct 2017 20:34:53 +0000","by mail-wm0-x232.google.com with SMTP id 196so29198617wma.1\n\tfor <linux-mtd@lists.infradead.org>;\n\tFri, 13 Oct 2017 13:34:30 -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\td82sm1231243wmd.14.2017.10.13.13.34.27\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 13 Oct 2017 13:34:28 -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=YuTRsfQKltPhH0xxP3f45Ig3GMyZkdgb2H3yHngVgN0=;\n\tb=oUPnQ74WD4uccK\n\tK+ycovTh3uWv0mzgzU/sGSgT26SIGl1ClEDSq4FuV/4D3vI9owylBJIdIeov5pa5bGLZk3Hh8cZPw\n\twe05V70vo1jejlrcmj4mttgQfux/IEHaBXgbmBl40ZdAhUpQGjZZeLatrzCeQvgCWeon4znkTtVOQ\n\tw0OMsAQIHq+P/oqypFif102cCqt0Aw2IfALQCneOgmzCzaEiziU8XvdRLhWflTdPqceWSe9+aZaKV\n\tYeBrlEsFhpCS7bcfIckz1pP//zRjINQTqLEWRoeqVgu6gWXF8zLT7DLtj0w4ENpdfcpwSFeWIKxSr\n\tpc76Zw87QV1irG7ubqKw==;","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=GgBmqoi25LF2MqEgQe6VM/rBpmFKSiN5UkYCCZFfXiE=;\n\tb=m6pxufLr5LfowHD1gcBDfwtLweH4rWhTylN0djaW0b0zWl0yNsdn0XAomsOpfMaeEQ\n\tXIsBLrJKyCmiF6cl3XxrOMVOBkQ9HpAqoPhStNkf+e/bVwU3wZD7PJ17xQtFuqJjmaxn\n\tjYLwJtNVtkwCkWfUZvUVlk9F58WH+jzEngoC41HUXmBx6BqmpBuZdB0WHwi/VIQfuFED\n\tlSqWrDyoyQKLdr8Aw3BeA70DFRZdA5hrAeZQiX8ABQqO/ZdH7UbebIEwGlmOzwCKnwWq\n\t+jkpqpWLkSPBTHZj+NEvajB+FnlzTbkaIFbOIjCDDoenQ4U54DHM3Nsyx3gghUjvZnaj\n\tQjDQ=="],"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=GgBmqoi25LF2MqEgQe6VM/rBpmFKSiN5UkYCCZFfXiE=;\n\tb=TDm8q/xjEs7pHTWs9Ua7N/Pqh3KMiFbT8EUkKK9WhrcKY2dpduxT90Ftre7Q7ddqLR\n\tWx+xg7TpPGOF2BONYZFhKkeRag8qWRtzM7oH/8kMzv5L33iSQCn4FJ4fTLP50PY0W79Y\n\tPljEWkKMnmDgp/wC59CjWMMVrcR8khIjD+u+gRNM9fzLLo62btgiF1bw+O2fxJfC6TF+\n\tv9jk33LPrKqrUV/Rqc40L5s7/pFZAT7mPvPvx85N8SP40UGiLEcOHjN2OvdiWN4Xp+G2\n\tjARxOIZFRJBOGGPmzxDlbhYGa3kdNItCjypXRrvdg14edB/8xrTdWqWHOqa65xSAy26Y\n\tZbXA==","X-Gm-Message-State":"AMCzsaVWCIKAhyTixD0Wls0uQNDWn6yakWJYywBQcuTCmBokWIl1el4L\n\tzkovwmkArZUs9Fv0OOPO6+U=","X-Google-Smtp-Source":"ABhQp+R6QQC0K6Ykf0BR7Qu0q31kxGudhbD9Hyi/ryX8uSf2UVzVXxVZ/mlQtp6LYmYXwiH8gsDWYA==","X-Received":"by 10.28.66.16 with SMTP id p16mr2535466wma.11.1507926868831;\n\tFri, 13 Oct 2017 13:34:28 -0700 (PDT)","Subject":"Re: [PATCH v2 2/3] mtd: spi-nor: Altera ASMI Parallel II IP Core","To":"matthew.gerlach@linux.intel.com","References":"<1505932139-2905-1-git-send-email-matthew.gerlach@linux.intel.com>\n\t<1505932139-2905-3-git-send-email-matthew.gerlach@linux.intel.com>\n\t<deae5a9f-4301-c7de-b265-b09292f8da15@gmail.com>\n\t<alpine.DEB.2.20.1710110956260.2194@mgerlach-VirtualBox>\n\t<ca36c177-0e7c-647d-f821-ab4bb7d85b10@gmail.com>\n\t<alpine.DEB.2.20.1710131215370.1541@mgerlach-VirtualBox>","From":"Marek Vasut <marek.vasut@gmail.com>","Message-ID":"<089bb472-f824-26d7-0d72-66e64c2f24c4@gmail.com>","Date":"Fri, 13 Oct 2017 22:34:27 +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":"<alpine.DEB.2.20.1710131215370.1541@mgerlach-VirtualBox>","Content-Language":"en-US","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20171013_133451_790739_406B7DCB ","X-CRM114-Status":"GOOD (  20.21  )","X-Spam-Score":"-2.7 (--)","X-Spam-Report":"SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-2.7 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/,\n\tlow\n\ttrust [2a00:1450:400c:c09:0:0:0:232 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":"vndao@altera.com, boris.brezillon@free-electrons.com,\n\tdevicetree@vger.kernel.org, richard@nod.at,\n\tlinux-mtd@lists.infradead.org, \n\tCyrille Pitchen <cyrille.pitchen@wedev4u.fr>, computersforpeace@gmail.com","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"}}]