From patchwork Thu Mar 30 08:23:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guochun Mao X-Patchwork-Id: 9653221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B5DCF6034C for ; Thu, 30 Mar 2017 08:35:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A57EE2679B for ; Thu, 30 Mar 2017 08:35:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96A37284D5; Thu, 30 Mar 2017 08:35:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AE7362679B for ; Thu, 30 Mar 2017 08:35:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=o0REX5grbUyn6y1/Sj9IVdYbVcoDgFNoSFSzRg4IBIw=; b=kGNmzCpoA+Hfcw +xfSTi4C7Wx2i7iFae6zFnk5Wrr/7hI0fGzvGHHkKDYSfNlzRf6NQLLf11glpF0PdinOmWRYrKbnQ fNpV/S/yOElBv9GnAW2aC/lSotpiKJDOnKL2G4F3MK1cCpZMoaH+C5W7mVAzxdKYyoJJlmLXe4RJv G4n6Rb7pEJuEels4I1vJiw0qE6eYaJom5bfm6sRSmHd7HLWr3OP82+GwC6poqJM1+eeTwiqtIdIqC 2UBtuqQRo53ezEepo9uNNGN93jriGpFDHuKrracDL9I5e/geH6m7RckBxby7ywizAxsa4p1b5MlXl +foO28w/mKMiGu3a4gYw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1ctVYj-0008Iy-ES; Thu, 30 Mar 2017 08:35:57 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ctVOL-0008Pl-W7; Thu, 30 Mar 2017 08:25:15 +0000 Received: from mtkhts09.mediatek.inc [(172.21.101.70)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 57004396; Thu, 30 Mar 2017 16:24:45 +0800 Received: from mhfsdcap03.mhfswrd (10.17.3.153) by mtkhts09.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 14.3.266.1; Thu, 30 Mar 2017 16:23:51 +0800 From: Guochun Mao To: Boris Brezillon , Marek Vasut Subject: [PATCH V1 1/1] mtd: mtk-nor: set controller to 4B mode with large capacity flash Date: Thu, 30 Mar 2017 16:23:42 +0800 Message-ID: <1490862222-723-2-git-send-email-guochun.mao@mediatek.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1490862222-723-1-git-send-email-guochun.mao@mediatek.com> References: <1490862222-723-1-git-send-email-guochun.mao@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170330_012514_319445_4D9A80BF X-CRM114-Status: GOOD ( 10.38 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Guochun Mao , Richard Weinberger , Russell King , linux-kernel@vger.kernel.org, Rob Herring , linux-mtd@lists.infradead.org, Matthias Brugger , linux-mediatek@lists.infradead.org, Cyrille Pitchen , David Woodhouse , linux-arm-kernel@lists.infradead.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP when nor's size larger than 16MByte, nor and controller should enter 4Byte mode simultaneously. Signed-off-by: Guochun Mao --- drivers/mtd/spi-nor/mtk-quadspi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/mtd/spi-nor/mtk-quadspi.c b/drivers/mtd/spi-nor/mtk-quadspi.c index e661877..05cd8a8 100644 --- a/drivers/mtd/spi-nor/mtk-quadspi.c +++ b/drivers/mtd/spi-nor/mtk-quadspi.c @@ -369,6 +369,13 @@ static int mt8173_nor_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, /* We only handle 1 byte */ ret = mt8173_nor_wr_sr(mt8173_nor, *buf); break; + case SPINOR_OP_EN4B: + /* Set nor controller to 4-byte address mode, + * and simultaneously set nor flash. + * This case should cooperate with default operation. + */ + writeb(readb(mt8173_nor->base + MTK_NOR_DUAL_REG) | 0x10, + mt8173_nor->base + MTK_NOR_DUAL_REG); default: ret = mt8173_nor_do_tx_rx(mt8173_nor, opcode, buf, len, NULL, 0); if (ret)