{"id":808567,"url":"http://patchwork.ozlabs.org/api/1.0/patches/808567/?format=json","project":{"id":3,"url":"http://patchwork.ozlabs.org/api/1.0/projects/3/?format=json","name":"Linux MTD development","link_name":"linux-mtd","list_id":"linux-mtd.lists.infradead.org","list_email":"linux-mtd@lists.infradead.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<1504252841-2445-6-git-send-email-bmeng.cn@gmail.com>","date":"2017-09-01T08:00:36","name":"[05/10] spi-nor: intel-spi: Use SW sequencer for BYT/LPT","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"202f0a2a45a7005affc8ca590f1c61f7495770f7","submitter":{"id":64981,"url":"http://patchwork.ozlabs.org/api/1.0/people/64981/?format=json","name":"Bin Meng","email":"bmeng.cn@gmail.com"},"delegate":{"id":63396,"url":"http://patchwork.ozlabs.org/api/1.0/users/63396/?format=json","username":"cpitchen","first_name":"Cyrille","last_name":"Pitchen","email":"cyrille.pitchen@atmel.com"},"mbox":"http://patchwork.ozlabs.org/project/linux-mtd/patch/1504252841-2445-6-git-send-email-bmeng.cn@gmail.com/mbox/","series":[{"id":969,"url":"http://patchwork.ozlabs.org/api/1.0/series/969/?format=json","date":"2017-09-01T08:00:33","name":"spi-nor: intel-spi: Various fixes and enhancements","version":1,"mbox":"http://patchwork.ozlabs.org/series/969/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808567/checks/","tags":{},"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=\"tvw3cWHZ\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"D4lsy8Zo\"; 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 3xkBSR1HXHz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 17:58:15 +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 1dngq9-0002ao-1R; Fri, 01 Sep 2017 07:58:09 +0000","from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dngon-0001Xo-CP\n\tfor linux-mtd@lists.infradead.org; Fri, 01 Sep 2017 07:56:47 +0000","by mail-io0-x244.google.com with SMTP id 2so2154335ion.3\n\tfor <linux-mtd@lists.infradead.org>;\n\tFri, 01 Sep 2017 00:56:29 -0700 (PDT)","from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com.\n\t[147.11.156.139]) by smtp.gmail.com with ESMTPSA id\n\td187sm853502iod.7.2017.09.01.00.56.27\n\t(version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 01 Sep 2017 00:56:27 -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:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References:\n\tIn-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Owner;\n\tbh=f1XOr5s1WUp4pmQTw/mdjryiw7e1OzPb2mqRWW1VweE=;\n\tb=tvw3cWHZJkIk+ruhXJFpcjgr7q\n\tmFeZUFrd48Sl0TnN1k6BkoY3c1zwsYlir4RS1peT9+pnZ9v11LlNOO59lA2vQIMloI7nnYtPFCQ0A\n\tcDUeNxNyZxjq6JUl7qyxl+R6xVO+kEsq/TcfutQbvxZo8XZRMHvb/k+MXeJYu0uR0JejgN9iUtTPz\n\tb1K8V95p+3Fsn//K8p2/fRkQQozXYGb/4IztlkTr9mAYCFDjATVGT0dTjkq7vo6wSs1ZG7O9+JIOW\n\t0+onrMkmGg9vOJo6R3+YJDazWlWmU3TlULCMD9YNpcTOPPVzrf2J1VKesJXC33sXNU8r2TNHruxZ0\n\tZLXON6UA==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=PrNIKMHMjBweFZrdsm1uGwFakd847gYd/E1DUXETPvk=;\n\tb=D4lsy8ZokZnL9Rw+2DolTMtocwioVtb1APYDnNdc0ZjwhjEvcc8/3RTU53XMkQuYX+\n\tcby0GBEV9sHVkVnBjwWd8hTNdaWHQbD/Y7k8nhTM17tVXQtsEH2EyK+t6X5TJCvrhshq\n\tQ+Q37OauarQ9PCFN9dP4zlTlR3Ms//SuKynFrNrZd6NGVN8S5CKD2K0mxS4qOs/qRdPE\n\te4xYEHGhDRctM2gCDJDJNLD0bFBRuTDH+lxzTV0A3Ted6h7BtHnnEbcO5GnA6ZQOwf1u\n\t2743hX8kNDI86Kbn14UplRrLc6TPLMN+mTl4UKee0uz9UbjebrnOFYko28CUBmFiKx1Q\n\tUI6A=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=PrNIKMHMjBweFZrdsm1uGwFakd847gYd/E1DUXETPvk=;\n\tb=UmrtrzO0PIbVAurcbG765PDENGBdERReiiL6ttXlwnrme/nHXvIZadn+KQV90M0B5N\n\tQqhkoslzvdPssPqRfZ1t0p28iNi5qwx6XEuBKiRY0+BL+hIJpgCaDLjMiFV/wkUAZ8Wl\n\toaLlDPT9uRs5jReaD+PnoaKppH9sw7aKxR/1ROZviGRasE5f5CLWdIDMqz4UDfQhyJJ7\n\tjJ99s72XiNg2L7h3YmaG39ZC+iCszgEawV2TjnnBTUrexBNIQ36arI4mJ6xdzS6ULwt1\n\tYFqi7I79I7/J67d83/bB+M+egPgQ7wx5Jd1UA+58l6jeWG+fJgDiP73ApTafrVMj2ECN\n\trYOQ==","X-Gm-Message-State":"AHPjjUiH+8zSd2+UdoK9hKCEosmnbcrcBCfxb9JHkXmpXLbdPNyJ6Z09\n\tUH+LWPFANKl0LQ==","X-Google-Smtp-Source":"ADKCNb5QFvoGpjMmzDr47NOj8NQXLM3mtpAr9yA1C/NQPfubvcopqw5HmOtOUYsghnUEu5JIBsjYow==","X-Received":"by 10.107.167.141 with SMTP id q135mr762292ioe.184.1504252588837;\n\tFri, 01 Sep 2017 00:56:28 -0700 (PDT)","From":"Bin Meng <bmeng.cn@gmail.com>","To":"Mika Westerberg <mika.westerberg@linux.intel.com>,\n\tCyrille Pitchen <cyrille.pitchen@wedev4u.fr>,\n\tMarek Vasut <marek.vasut@gmail.com>,\n\tBoris Brezillon <boris.brezillon@free-electrons.com>,\n\tBrian Norris <computersforpeace@gmail.com>,\n\tRichard Weinberger <richard@nod.at>,\n\tDavid Woodhouse <dwmw2@infradead.org>, \n\tlinux-mtd <linux-mtd@lists.infradead.org>,\n\tlinux-kernel <linux-kernel@vger.kernel.org>","Subject":"[PATCH 05/10] spi-nor: intel-spi: Use SW sequencer for BYT/LPT","Date":"Fri,  1 Sep 2017 01:00:36 -0700","Message-Id":"<1504252841-2445-6-git-send-email-bmeng.cn@gmail.com>","X-Mailer":"git-send-email 1.7.9.5","In-Reply-To":"<1504252841-2445-1-git-send-email-bmeng.cn@gmail.com>","References":"<1504252841-2445-1-git-send-email-bmeng.cn@gmail.com>","X-CRM114-Version":"20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ","X-CRM114-CacheID":"sfid-20170901_005645_467239_DBC3172A ","X-CRM114-Status":"GOOD (  13.78  )","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 (bmeng.cn[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":"Stefan Roese <sr@denx.de>","MIME-Version":"1.0","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"},"content":"Baytrail/Lynx Point SPI controller's HW sequencer only supports basic\noperations. This is determined by the chipset design, however current\ncodes try to use register values in OPMENU0/OPMENU1 to see whether SW\nsequencer should be used, which is wrong. In fact OPMENU0/OPMENU1 can\nremain unprogrammed by some bootloaders.\n\nSigned-off-by: Bin Meng <bmeng.cn@gmail.com>\n---\n\n drivers/mtd/spi-nor/intel-spi.c | 30 +++++++++++++++---------------\n 1 file changed, 15 insertions(+), 15 deletions(-)","diff":"diff --git a/drivers/mtd/spi-nor/intel-spi.c b/drivers/mtd/spi-nor/intel-spi.c\nindex c4a9de6..d0237fe 100644\n--- a/drivers/mtd/spi-nor/intel-spi.c\n+++ b/drivers/mtd/spi-nor/intel-spi.c\n@@ -290,6 +290,7 @@ static int intel_spi_init(struct intel_spi *ispi)\n \t\tispi->pregs = ispi->base + BYT_PR;\n \t\tispi->nregions = BYT_FREG_NUM;\n \t\tispi->pr_num = BYT_PR_NUM;\n+\t\tispi->swseq = true;\n \n \t\tif (writeable) {\n \t\t\t/* Disable write protection */\n@@ -310,6 +311,7 @@ static int intel_spi_init(struct intel_spi *ispi)\n \t\tispi->pregs = ispi->base + LPT_PR;\n \t\tispi->nregions = LPT_FREG_NUM;\n \t\tispi->pr_num = LPT_PR_NUM;\n+\t\tispi->swseq = true;\n \t\tbreak;\n \n \tcase INTEL_SPI_BXT:\n@@ -324,12 +326,24 @@ static int intel_spi_init(struct intel_spi *ispi)\n \t\treturn -EINVAL;\n \t}\n \n-\t/* Disable #SMI generation */\n+\t/* Disable #SMI generation from HW sequencer */\n \tval = readl(ispi->base + HSFSTS_CTL);\n \tval &= ~HSFSTS_CTL_FSMIE;\n \twritel(val, ispi->base + HSFSTS_CTL);\n \n \t/*\n+\t * Some controllers can only do basic operations using hardware\n+\t * sequencer. All other operations are supposed to be carried out\n+\t * using software sequencer.\n+\t */\n+\tif (ispi->swseq) {\n+\t\t/* Disable #SMI generation from SW sequencer */\n+\t\tval = readl(ispi->sregs + SSFSTS_CTL);\n+\t\tval &= ~SSFSTS_CTL_FSMIE;\n+\t\twritel(val, ispi->sregs + SSFSTS_CTL);\n+\t}\n+\n+\t/*\n \t * BIOS programs allowed opcodes and then locks down the register.\n \t * So read back what opcodes it decided to support. That's the set\n \t * we are going to support as well.\n@@ -337,13 +351,6 @@ static int intel_spi_init(struct intel_spi *ispi)\n \topmenu0 = readl(ispi->sregs + OPMENU0);\n \topmenu1 = readl(ispi->sregs + OPMENU1);\n \n-\t/*\n-\t * Some controllers can only do basic operations using hardware\n-\t * sequencer. All other operations are supposed to be carried out\n-\t * using software sequencer. If we find that BIOS has programmed\n-\t * opcodes for the software sequencer we use that over the hardware\n-\t * sequencer.\n-\t */\n \tif (opmenu0 && opmenu1) {\n \t\tfor (i = 0; i < ARRAY_SIZE(ispi->opcodes) / 2; i++) {\n \t\t\tispi->opcodes[i] = opmenu0 >> i * 8;\n@@ -353,13 +360,6 @@ static int intel_spi_init(struct intel_spi *ispi)\n \t\tval = readl(ispi->sregs + PREOP_OPTYPE);\n \t\tispi->preopcodes[0] = val;\n \t\tispi->preopcodes[1] = val >> 8;\n-\n-\t\t/* Disable #SMI generation from SW sequencer */\n-\t\tval = readl(ispi->sregs + SSFSTS_CTL);\n-\t\tval &= ~SSFSTS_CTL_FSMIE;\n-\t\twritel(val, ispi->sregs + SSFSTS_CTL);\n-\n-\t\tispi->swseq = true;\n \t}\n \n \tintel_spi_dump_regs(ispi);\n","prefixes":["05/10"]}