Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3823224ybt; Tue, 23 Jun 2020 11:34:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTMSEL/aKwNtcZsB7oN06CE5oJ7OsV0KseS+5+w/yzthcfVRq7kD0Pf+3CcsGMsS71XNIU X-Received: by 2002:aa7:c68b:: with SMTP id n11mr23297203edq.278.1592937261055; Tue, 23 Jun 2020 11:34:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592937261; cv=none; d=google.com; s=arc-20160816; b=U81EoTJkqquUwBPOoLErKf4m16psRi8TKnaBSx3JG+J9RYOnbYSz2e10YkkfFg8DLQ EbgAIl3nnWnx4H1bD0dMATs9ckzz7JPqEXtXFWchFnj3wxCz05oezajm2RSRw55e0FJS qxJapcd7nBBSmCSn7Vl/e03TQEs1Q3r6i1w8NHZT7k14gq+60g117MUq2/C+9Nhg9quM cXJKWeHWcbpxwyaD7AB9wsJnVZMLYumK4713xeCqy4EYH7o7jCRZnQJUwQc52RYX9/zG PvA/PHdSxVcJs9tuHkAeQYd+SkJMMo0ZwqO6IQHxkB61s0oTe+0siAcuUc7LMc0Sgp0T rALg== 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=GqkBcyXjBXiod4RrFOhbO6koYzCT9k/GbaT798jYrzI=; b=plguWmV1gMkUE6UaX7Ue/GX9yuj8wEsazQmMyC8dNeNj36G4j/zYVLNxHJL/YCYDV+ y0k2/3Z8LogotjUI1XfNB4rpzg/io6X1DOYZ+iUSVnSyk/r/Nlndh0XcfyOw30HFgR2D ICzNzPZKSsDtgpe6kaaIzTs/4EG3qkjsGX0tzApMyUcC+l5nj/98GuKyPuBxRWJnTH+0 +yO+l8sw4tEdhnw+Ak10a7zwOj6t87dj3178t7IgifC4+dClsiJejxd+6NE9pO/UQsvk D1WXZ3umwIpiQ2VwdEPY2SIYLIOAdc64qHDEM3NPuVenPdqoA/QmFfZUnjxJ6RqJnDZ1 2anQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=R7fJLnhH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id h25si11072780ejt.604.2020.06.23.11.33.57; Tue, 23 Jun 2020 11:34:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=R7fJLnhH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2387423AbgFWSbU (ORCPT + 99 others); Tue, 23 Jun 2020 14:31:20 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:47952 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387578AbgFWSbR (ORCPT ); Tue, 23 Jun 2020 14:31:17 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05NIV7hE046789; Tue, 23 Jun 2020 13:31:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1592937067; bh=GqkBcyXjBXiod4RrFOhbO6koYzCT9k/GbaT798jYrzI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=R7fJLnhHf4wXiawXdsEhYG5Ayc1iO856DnElB8vXocrKK/8jAzoCuY3unfUqw2Ygh gJP34jK+ESEsInPOuzZLygGE5zcC+CU5wXSTMTKCN+l1IciWs+1mwdGOZXO/8hDje7 gRife8olqP9YDlGdMuG7eWWZf4fhzURdAkfPz9/U= Received: from DLEE114.ent.ti.com (dlee114.ent.ti.com [157.170.170.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05NIV7xx042197; Tue, 23 Jun 2020 13:31:07 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 23 Jun 2020 13:31:07 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 23 Jun 2020 13:31:07 -0500 Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05NIUVJK000942; Tue, 23 Jun 2020 13:31:02 -0500 From: Pratyush Yadav To: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mark Brown , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Matthias Brugger , Michal Simek , , , , , CC: Pratyush Yadav , Sekhar Nori , Boris Brezillon Subject: [PATCH v10 06/17] mtd: spi-nor: sfdp: get command opcode extension type from BFPT Date: Wed, 24 Jun 2020 00:00:19 +0530 Message-ID: <20200623183030.26591-7-p.yadav@ti.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200623183030.26591-1-p.yadav@ti.com> References: <20200623183030.26591-1-p.yadav@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 Some devices in DTR mode expect an extra command byte called the extension. The extension can either be same as the opcode, bitwise inverse of the opcode, or another additional byte forming a 16-byte opcode. Get the extension type from the BFPT. For now, only flashes with "repeat" and "inverse" extensions are supported. Signed-off-by: Pratyush Yadav --- drivers/mtd/spi-nor/sfdp.c | 17 +++++++++++++++++ drivers/mtd/spi-nor/sfdp.h | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index cb6e93a3560a..3f709de5ea67 100644 --- a/drivers/mtd/spi-nor/sfdp.c +++ b/drivers/mtd/spi-nor/sfdp.c @@ -605,6 +605,23 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor, if (bfpt_header->length == BFPT_DWORD_MAX_JESD216B) return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt, params); + /* 8D-8D-8D command extension. */ + switch (bfpt.dwords[BFPT_DWORD(18)] & BFPT_DWORD18_CMD_EXT_MASK) { + case BFPT_DWORD18_CMD_EXT_REP: + nor->cmd_ext_type = SPI_NOR_EXT_REPEAT; + break; + + case BFPT_DWORD18_CMD_EXT_INV: + nor->cmd_ext_type = SPI_NOR_EXT_INVERT; + break; + + case BFPT_DWORD18_CMD_EXT_RES: + return -EINVAL; + + case BFPT_DWORD18_CMD_EXT_16B: + dev_err(nor->dev, "16-bit opcodes not supported\n"); + return -ENOTSUPP; + } return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt, params); } diff --git a/drivers/mtd/spi-nor/sfdp.h b/drivers/mtd/spi-nor/sfdp.h index 7f9846b3a1ad..6d7243067252 100644 --- a/drivers/mtd/spi-nor/sfdp.h +++ b/drivers/mtd/spi-nor/sfdp.h @@ -90,6 +90,12 @@ struct sfdp_bfpt { #define BFPT_DWORD15_QER_SR2_BIT1_NO_RD (0x4UL << 20) #define BFPT_DWORD15_QER_SR2_BIT1 (0x5UL << 20) /* Spansion */ +#define BFPT_DWORD18_CMD_EXT_MASK GENMASK(30, 29) +#define BFPT_DWORD18_CMD_EXT_REP (0x0UL << 29) /* Repeat */ +#define BFPT_DWORD18_CMD_EXT_INV (0x1UL << 29) /* Invert */ +#define BFPT_DWORD18_CMD_EXT_RES (0x2UL << 29) /* Reserved */ +#define BFPT_DWORD18_CMD_EXT_16B (0x3UL << 29) /* 16-bit opcode */ + struct sfdp_parameter_header { u8 id_lsb; u8 minor; -- 2.27.0