From patchwork Mon Feb 26 10:40:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Dunaev X-Patchwork-Id: 206555 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1991262dyb; Mon, 26 Feb 2024 02:54:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVmHTRyxc6Mva80vu5QMSsHBT03IWD5pBa76KdmN2lqE9rIoleA3W+3rNkpK3FrejPUN65I+gWF+M9DQLIE6Rqtoruiqg== X-Google-Smtp-Source: AGHT+IE7BFH0DHJ6SCSN8aSvbBCzlAY6bx39DZNn7uxkc57q+auhjhqF/uRersAJbYoEQvWx9y+7 X-Received: by 2002:a17:902:ce89:b0:1dc:696d:ec6e with SMTP id f9-20020a170902ce8900b001dc696dec6emr7841948plg.21.1708944873387; Mon, 26 Feb 2024 02:54:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708944873; cv=pass; d=google.com; s=arc-20160816; b=hDC4sk4hPcw2qUUnjxmEGdzciNQ/Oz+iO0bD2NlvrjkUltEL+IbA77mlxVfRWmA9H7 qqPU8xS+z+APAkVF9HGl61HRQ3Yka/EHUvkCsd0pous2qyuRD8qJlR3AvkSMG7ASuVbS /PPQoPIZvgWmcZlnidBs+5S0215B0AeGqcQDAXN3kSjbVsXRbCi1HkmvGzciAbIo3Jq5 SM/GTZ5Xrv49k0Iew5ljVB9h8qaCE1ulMoUjgw9vtVcwXUvANlTIqPVrtiP/vYXC8fbO W9aAJCp1sS+WIYyU3mpkCWGVOfjVKRFwo+MdpksGLZft0B+roa/8nNzj54eHUWZP4+FI 2TMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=GjFvSsWMQF//AIRWMkIQWeYqQcroXAOSfkVX4RVpqIs=; fh=/1STbxAIgMcGmfPDmQY9Qa9CQcd8vtC0UBh6c/QvATI=; b=mqRm0ghet3AZksLnr/opwJ0xHlQoxr5Tnis59Dpe03uj2qCj8RjuUhqNqXTkuIvCUS 1Y4S5C/K+ReodPdk0Hbnmg5IxJfbnXnK8LJ7rEAKyrfj24yLAFKz1ZSXWC6E69taAgWB HeT7V21aWaADhnGnbPL9VekAy2qvgVL1ltzftkA2CXCXUq/HSg5RNriRELvRobDXC1If mpKjDLpKXqcHaUbvfa4H7rfNn93TbVVJUoUTwlHzGWDvSp7o1dQS01XAPFCFMuHBN5vk shA78JFi9i+9smHeN/RH6N1TkrCWaE4W9xLTziC3WMFGHAcIR6P0MzoSkkP/YyC4LXxs TCxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=tecon.ru dmarc=pass fromdomain=tecon.ru); spf=pass (google.com: domain of linux-kernel+bounces-81178-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81178-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=tecon.ru Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q14-20020a170902f78e00b001d92eb54a6asi3461172pln.387.2024.02.26.02.54.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 02:54:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81178-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=tecon.ru dmarc=pass fromdomain=tecon.ru); spf=pass (google.com: domain of linux-kernel+bounces-81178-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81178-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=tecon.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 8DAA7294427 for ; Mon, 26 Feb 2024 10:45:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA00A4C631; Mon, 26 Feb 2024 10:42:18 +0000 (UTC) Received: from mail.tecon.ru (mail.tecon.ru [82.112.190.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7E1C1DDF2 for ; Mon, 26 Feb 2024 10:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.112.190.120 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708944137; cv=none; b=pmL8uEpp1ZyFROVqT/qqeL7KQnw+tXb1S96SIzZVkYzuqAPlJGAwhwOsAuuugj1NxeVUxAvabt9WreBpnr5LdUvFnQ+HYl2vFMCwPHfvurdKdatH3bkIN0VX17Lm6ho6feiOSZfLGg/qOboC/uVZyaNxOHVThSeR5REsJJg905U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708944137; c=relaxed/simple; bh=zyNhrX2MVbvnqyKCu8lbBxzBNryOLSqO8SEiSi2jKFE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TinIiknRPhce+ioMhqhj7wc5YS9eUzu1fGXfJ6cebhTh3YGXxu6iejw7TKbFKuEFIY/mxzgaV7RoOo/D+LQBYsuok3xAUnGdnuiM6glX/mkKRIn8ktxLIT21Iz8iWV5ip5eoT02Vd9Yfxeho+N3TnDOED3BCpCs3/tw/HRNDq8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=tecon.ru; spf=pass smtp.mailfrom=tecon.ru; arc=none smtp.client-ip=82.112.190.120 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=tecon.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tecon.ru From: Dmitry Dunaev To: CC: , Dmitry Dunaev , Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , , Subject: [PATCH v2] mtd: spi-nor: Add Puya Semiconductor chips driver Date: Mon, 26 Feb 2024 13:40:59 +0300 Message-ID: <20240226104101.1848855-1-dunaev@tecon.ru> In-Reply-To: <9ebf9cdf-eeba-417a-8410-3f87a0973136@linaro.org> References: <9ebf9cdf-eeba-417a-8410-3f87a0973136@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791955082519073850 X-GMAIL-MSGID: 1791958579180881418 Add a SPI NOR manufacturer driver for Puya Semiconductor chips Signed-off-by: Dmitry Dunaev --- drivers/mtd/spi-nor/Makefile | 1 + drivers/mtd/spi-nor/core.c | 1 + drivers/mtd/spi-nor/core.h | 1 + drivers/mtd/spi-nor/puya.c | 64 ++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 drivers/mtd/spi-nor/puya.c diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile index 5e68468b72fc..3e22039d0432 100644 --- a/drivers/mtd/spi-nor/Makefile +++ b/drivers/mtd/spi-nor/Makefile @@ -10,6 +10,7 @@ spi-nor-objs += intel.o spi-nor-objs += issi.o spi-nor-objs += macronix.o spi-nor-objs += micron-st.o +spi-nor-objs += puya.o spi-nor-objs += spansion.o spi-nor-objs += sst.o spi-nor-objs += winbond.o diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 4129764fad8c..09ad2142d004 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2045,6 +2045,7 @@ static const struct spi_nor_manufacturer *manufacturers[] = { &spi_nor_issi, &spi_nor_macronix, &spi_nor_micron, + &spi_nor_puya, &spi_nor_st, &spi_nor_spansion, &spi_nor_sst, diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index d36c0e072954..93df7a6328ca 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -609,6 +609,7 @@ extern const struct spi_nor_manufacturer spi_nor_intel; extern const struct spi_nor_manufacturer spi_nor_issi; extern const struct spi_nor_manufacturer spi_nor_macronix; extern const struct spi_nor_manufacturer spi_nor_micron; +extern const struct spi_nor_manufacturer spi_nor_puya; extern const struct spi_nor_manufacturer spi_nor_st; extern const struct spi_nor_manufacturer spi_nor_spansion; extern const struct spi_nor_manufacturer spi_nor_sst; diff --git a/drivers/mtd/spi-nor/puya.c b/drivers/mtd/spi-nor/puya.c new file mode 100644 index 000000000000..2198a9ed7101 --- /dev/null +++ b/drivers/mtd/spi-nor/puya.c @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2024, Tecon MT LLC. + */ + +#include + +#include "core.h" + +/* Puya Semiconductor (Shanghai) Co., Ltd */ +static const struct flash_info puya_nor_parts[] = { + { + .id = SNOR_ID(0x85, 0x60, 0x10), + .name = "p25q05h", + .size = SZ_64K, + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id = SNOR_ID(0x85, 0x60, 0x11), + .name = "p25q10h", + .size = SZ_128K, + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id = SNOR_ID(0x85, 0x60, 0x12), + .name = "p25q20h", + .size = SZ_256K, + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id = SNOR_ID(0x85, 0x60, 0x13), + .name = "p25q40h", + .size = SZ_512K, + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id = SNOR_ID(0x85, 0x60, 0x14), + .name = "p25q80h", + .size = SZ_1M, + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id = SNOR_ID(0x85, 0x60, 0x15), + .name = "p25q16h", + .size = SZ_2M, + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id = SNOR_ID(0x85, 0x60, 0x16), + .name = "p25q32h", + .size = SZ_4M, + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id = SNOR_ID(0x85, 0x60, 0x17), + .name = "p25q64h", + .size = SZ_8M, + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + }, { + .id = SNOR_ID(0x85, 0x60, 0x18), + .name = "p25q128h", + .size = SZ_8M, + .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ, + } +}; + +const struct spi_nor_manufacturer spi_nor_puya = { + .name = "puya", + .parts = puya_nor_parts, + .nparts = ARRAY_SIZE(puya_nor_parts), +};