Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2844941imm; Wed, 3 Oct 2018 10:01:11 -0700 (PDT) X-Google-Smtp-Source: ACcGV61pgovY1u/ecNpDVHRBs95JozCuZGAp5EEnfsnHpnfwxMOQMyh+dKah9Iq+2vpF5bR0v2G8 X-Received: by 2002:a62:24c3:: with SMTP id k64-v6mr2602596pfk.195.1538586071108; Wed, 03 Oct 2018 10:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538586071; cv=none; d=google.com; s=arc-20160816; b=cKmykAK740GvP8MLZM9ePIAQ1B+r0ianc2oXlMOMwCCLcff3tt5VUleyQ8gkE55QzK Choyjfi+fWPOe8UXLMhJZp9tzU4nAqoruZQ91gXkiA0X5FrF4+73khGebm9ez6aW2CaT xmg4kq4rj6MJ8I0rZKXlSFqBfoLluUFMdf3Si3xjWJRkShzLZCopGxOIgNv0BlA7xlis 93eczwuRGu60e4y8o72nkdmwMG9nwWvQ0Eg/G89t3i7sZg6AMdWxNH21EgVKZl86WM3l KF+A0+F8fsXQhNsCssjnrEM61NCBMH/QHZJd4nmx1gZdUkp+nl9xSxPKWzkZhUsAP+1V 3eLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NFCxn/zpN3aBsqFK6nZx5DRUTun+rFvg1/bVH+chpSk=; b=BXCXHjCPkLIkRHaSyqdCe/ydeTUD7tLlMA34fDOGpQH6xwNzzwvfsLDB8a/T0rjHn1 RiXCjOectaUcjfi8+k8UfQS/cRiXG0TgHjo/195vDHSsaf+LLntrQ5Xug2a1A5lFug+a C/Vuvf1JkTOC0pfrVzinw6e6DnIvhuFDQIypkILn6eKl8VlYLEiTSyGsCDFJQnatry2L dMF+5mZXThF4QrfZMEFw5HmmBLtpH5BwTtb49TAZX/02jTNQK5oRUCsYOcA5CK0YbyeC ejmIb5tyi5bJH0HVDhu/9sWluKQphCw3T0H0c+KIwA8jAN/ONbfo0arpgUWrO5GeptgL Nf5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=umAjsLP7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3-v6si1905909pgb.72.2018.10.03.10.00.55; Wed, 03 Oct 2018 10:01:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=umAjsLP7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727313AbeJCXsH (ORCPT + 99 others); Wed, 3 Oct 2018 19:48:07 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:57728 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbeJCXsG (ORCPT ); Wed, 3 Oct 2018 19:48:06 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id w93Gug53083686; Wed, 3 Oct 2018 11:56:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1538585802; bh=NFCxn/zpN3aBsqFK6nZx5DRUTun+rFvg1/bVH+chpSk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=umAjsLP7MJ39ivwebqTUdOCS7tmFha6eRl/eGgIlk0bidtObGF3bOSEQWYUoVkivx rL0byFVlHxcp1sWAxR21anT33DhO9KoDKKQU+ujtrhh8K9HUc/mCicjhBiJ8NQUDug 2cQw6Y2X0BSFj8lMEOPYX4jQkf1e+wVbldueyFFQ= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w93GuggJ007047; Wed, 3 Oct 2018 11:56:42 -0500 Received: from DFLE113.ent.ti.com (10.64.6.34) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Wed, 3 Oct 2018 11:56:42 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Wed, 3 Oct 2018 11:56:42 -0500 Received: from a0132425.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w93GuZMI030968; Wed, 3 Oct 2018 11:56:39 -0500 From: Vignesh R To: Boris Brezillon , Marek Vasut , Rob Herring CC: Brian Norris , Yogesh Gaur , Linux ARM Mailing List , , , , Vignesh R Subject: [PATCH 1/3] mtd: spi-nor: Add Octal mode support for mt35xu512aba Date: Wed, 3 Oct 2018 22:26:01 +0530 Message-ID: <20181003165603.2579-2-vigneshr@ti.com> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181003165603.2579-1-vigneshr@ti.com> References: <20181003165603.2579-1-vigneshr@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Micron's mt35xu512aba flash is an Octal flash that has x8 IO lines. It supports read/write over 8 IO lines simulatenously. Add support for Octal read mode for Micron mt35xu512aba. Unfortunately, this flash is only complaint to SFDP JESD216B and does not seem to support newer JESD216C standard that provides auto detection of Octal mode capabilities and opcodes. Therefore, this capability is manually added using new SPI_NOR_OCTAL_READ flag. Signed-off-by: Vignesh R --- drivers/mtd/spi-nor/spi-nor.c | 11 ++++++++++- include/linux/mtd/spi-nor.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index aff5e6ff0b2c..4926e805a8cb 100644 --- a/drivers/mtd/spi-nor/spi-nor.c +++ b/drivers/mtd/spi-nor/spi-nor.c @@ -90,6 +90,7 @@ struct flash_info { #define NO_CHIP_ERASE BIT(12) /* Chip does not support chip erase */ #define SPI_NOR_SKIP_SFDP BIT(13) /* Skip parsing of SFDP tables */ #define USE_CLSR BIT(14) /* use CLSR command */ +#define SPI_NOR_OCTAL_READ BIT(15) /* Flash supports Octal Read */ int (*quad_enable)(struct spi_nor *nor); }; @@ -209,6 +210,7 @@ static inline u8 spi_nor_convert_3to4_read(u8 opcode) { SPINOR_OP_READ_1_2_2, SPINOR_OP_READ_1_2_2_4B }, { SPINOR_OP_READ_1_1_4, SPINOR_OP_READ_1_1_4_4B }, { SPINOR_OP_READ_1_4_4, SPINOR_OP_READ_1_4_4_4B }, + { SPINOR_OP_READ_1_1_8, SPINOR_OP_READ_1_1_8_4B }, { SPINOR_OP_READ_1_1_1_DTR, SPINOR_OP_READ_1_1_1_DTR_4B }, { SPINOR_OP_READ_1_2_2_DTR, SPINOR_OP_READ_1_2_2_DTR_4B }, @@ -1406,7 +1408,7 @@ static const struct flash_info spi_nor_ids[] = { { "mt25qu02g", INFO(0x20bb22, 0, 64 * 1024, 4096, SECT_4K | USE_FSR | SPI_NOR_QUAD_READ | NO_CHIP_ERASE) }, /* Micron */ - { "mt35xu512aba", INFO(0x2c5b1a, 0, 128 * 1024, 512, SECT_4K | USE_FSR | SPI_NOR_4B_OPCODES) }, + { "mt35xu512aba", INFO(0x2c5b1a, 0, 128 * 1024, 512, SECT_4K | USE_FSR | SPI_NOR_OCTAL_READ | SPI_NOR_4B_OPCODES) }, /* PMC */ { "pm25lv512", INFO(0, 0, 32 * 1024, 2, SECT_4K_PMC) }, @@ -3199,6 +3201,13 @@ static int spi_nor_init_params(struct spi_nor *nor, SNOR_PROTO_1_1_4); } + if (info->flags & SPI_NOR_OCTAL_READ) { + params->hwcaps.mask |= SNOR_HWCAPS_READ_1_1_8; + spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ_1_1_8], + 0, 8, SPINOR_OP_READ_1_1_8, + SNOR_PROTO_1_1_8); + } + /* Page Program settings. */ params->hwcaps.mask |= SNOR_HWCAPS_PP; spi_nor_set_pp_settings(¶ms->page_programs[SNOR_CMD_PP], diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h index 8b1acf68b7ac..ae9861ed7e0f 100644 --- a/include/linux/mtd/spi-nor.h +++ b/include/linux/mtd/spi-nor.h @@ -50,6 +50,7 @@ #define SPINOR_OP_READ_1_2_2 0xbb /* Read data bytes (Dual I/O SPI) */ #define SPINOR_OP_READ_1_1_4 0x6b /* Read data bytes (Quad Output SPI) */ #define SPINOR_OP_READ_1_4_4 0xeb /* Read data bytes (Quad I/O SPI) */ +#define SPINOR_OP_READ_1_1_8 0x8b /* Read data bytes (Octal Output SPI) */ #define SPINOR_OP_PP 0x02 /* Page program (up to 256 bytes) */ #define SPINOR_OP_PP_1_1_4 0x32 /* Quad page program */ #define SPINOR_OP_PP_1_4_4 0x38 /* Quad page program */ @@ -73,6 +74,7 @@ #define SPINOR_OP_READ_1_2_2_4B 0xbc /* Read data bytes (Dual I/O SPI) */ #define SPINOR_OP_READ_1_1_4_4B 0x6c /* Read data bytes (Quad Output SPI) */ #define SPINOR_OP_READ_1_4_4_4B 0xec /* Read data bytes (Quad I/O SPI) */ +#define SPINOR_OP_READ_1_1_8_4B 0x7c /* Read data bytes (Octal Output SPI) */ #define SPINOR_OP_PP_4B 0x12 /* Page program (up to 256 bytes) */ #define SPINOR_OP_PP_1_1_4_4B 0x34 /* Quad page program */ #define SPINOR_OP_PP_1_4_4_4B 0x3e /* Quad page program */ -- 2.19.0