Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3050626pxf; Sun, 21 Mar 2021 17:05:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxur01QLfwSwjx8eK8EIAtq1WnXpTDvbev3arCY/VwhUsiA0Ef+nE4M5xQ7wBHK87sKXrEX X-Received: by 2002:a17:907:2d9f:: with SMTP id gt31mr16464647ejc.233.1616371508993; Sun, 21 Mar 2021 17:05:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616371508; cv=none; d=google.com; s=arc-20160816; b=t92fu9BS2+xjlPTVNQzbBVUnASM9PuquREx+qdZo/2WjQM4TevzD55uFPSoSoecOZ2 2hetUJ/hsjlv7ZVXcTe6qSGr5zNaQbHCdTMdGu0q9WTLd9bapwNPjwUUl1JzpE9pHy7D YMc6vBuaU6JLKts829qZJz8LtYQ+j0dGg5lM67XsE9fDwb5g9WcoryY6PZo6wJyb6+W3 eh45IR9jnz5GhZnAz1c3VfKB4sAWeH9tebKiTeiUfXAat3M81g7ub3HLsREKxzEGa8Gk IZwhxzBPf74fnJYhsgYdOxmg4+8j/mF8ttpSt5ZPenH7+aFsEQukPIItLx1Xw/8GmnSd xktA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7pVgZhYEGnaY7ZyodtaxdbrPf8RrPat3Gjq9g+Zbg9g=; b=PRxAAZZxwBYJNjQRfBxFbhQYIiSF47YXa2Apd3lNJyRA4aVQ2U1FCwRIAvXQPD/pRj lpy5bVs943VS1DGE1kaDo60EARaxSk4ByTc9biI6U6RUBU33+/n1H4FyDend23bYLBMZ LU8f7x7nEmZYB4jMJnzRFVgos5CPKvopp7wgBcQh7rE0b/F1zPnccJwviWOYY8fCq/Zp teKElHjHOpJ7/kCrB5cJC+ttSEOH2PW3J5U6ea6y0ZMmKaC7YjFevSWa7cEHzAurEOhB xwgp6aWdTwqq2Sx7y3bnjAKMibMW3o9B4rx3HXL0sdrLmFC9y06xGdNJqbCqQQttF+OZ gGAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b="On6P/TW4"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si9423577ejd.455.2021.03.21.17.04.47; Sun, 21 Mar 2021 17:05:08 -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=@walle.cc header.s=mail2016061301 header.b="On6P/TW4"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230364AbhCUXwL (ORCPT + 99 others); Sun, 21 Mar 2021 19:52:11 -0400 Received: from ssl.serverraum.org ([176.9.125.105]:48919 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230131AbhCUXvu (ORCPT ); Sun, 21 Mar 2021 19:51:50 -0400 Received: from mwalle01.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:fa59:71ff:fe9b:b851]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id DBBC922253; Mon, 22 Mar 2021 00:51:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1616370709; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7pVgZhYEGnaY7ZyodtaxdbrPf8RrPat3Gjq9g+Zbg9g=; b=On6P/TW4uuPZWXKyBGd6I6RdKokSF2yYPaP/OannPEgOS4y+CAaBsGCXJOFTzldTRCqjrn UVjAXyW2BI3NTt7kDXavoknFRQVHdY0mEXsL9KewJw9tZNHu9/j4aluR5mIH0uMjSEub6p sl5VRv5U5SFIBwDY00dCKVeJTJtbZIM= From: Michael Walle To: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Pratyush Yadav , Michael Walle Subject: [PATCH v5 3/3] mtd: spi-nor: winbond: add OTP support to w25q32fw/jw Date: Mon, 22 Mar 2021 00:51:40 +0100 Message-Id: <20210321235140.8308-4-michael@walle.cc> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210321235140.8308-1-michael@walle.cc> References: <20210321235140.8308-1-michael@walle.cc> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With all the helper functions in place, add OTP support for the Winbond W25Q32JW and W25Q32FW. Both were tested on a LS1028A SoC with a NXP FSPI controller. Signed-off-by: Michael Walle --- drivers/mtd/spi-nor/winbond.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 20b2c6f19d6f..9a81c67a60c6 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -54,14 +54,18 @@ static const struct flash_info winbond_parts[] = { { "w25q32", INFO(0xef4016, 0, 64 * 1024, 64, SECT_4K) }, { "w25q32dw", INFO(0xef6016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, + SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) + OTP_INFO(256, 3, 0x1000, 0x1000) + }, + { "w25q32jv", INFO(0xef7016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, { "w25q32jwm", INFO(0xef8016, 0, 64 * 1024, 64, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | - SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, + SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) + OTP_INFO(256, 3, 0x1000, 0x1000) }, { "w25q64jwm", INFO(0xef8017, 0, 64 * 1024, 128, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) }, @@ -132,9 +136,18 @@ static int winbond_set_4byte_addr_mode(struct spi_nor *nor, bool enable) return spi_nor_write_disable(nor); } +static const struct spi_nor_otp_ops winbond_otp_ops = { + .read = spi_nor_otp_read_secr, + .write = spi_nor_otp_write_secr, + .lock = spi_nor_otp_lock_sr2, + .is_locked = spi_nor_otp_is_locked_sr2, +}; + static void winbond_default_init(struct spi_nor *nor) { nor->params->set_4byte_addr_mode = winbond_set_4byte_addr_mode; + if (nor->params->otp.org->n_regions) + nor->params->otp.ops = &winbond_otp_ops; } static const struct spi_nor_fixups winbond_fixups = { -- 2.20.1