From patchwork Thu Jul 14 19:19:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 12918450 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 30A85C43334 for ; Thu, 14 Jul 2022 19:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=85eAgwuz5bzSEYLsIXKrI+ktctKZ0j45e1vKP/hhWXU=; b=tdoB3k/0YCnFHO QrldbwpTNJ5fz6sx9JpCYsSbkKQdPQ35DSE3UhLswgbAWq3vT0N44st1m8q5D+70eN/EbnaCihHG4 ENYeum2bWjp0xZ0XeGsUB1DyLgScnGO4WoOfu84EjFb9Wl8KPLaBtUafPtMrHqOldSpeXKymZDKZq Hw4ZMIcKFYCOeIM87BGQ+5xhF2M5WkIRQ/e0X2pDKgcJhMmX86FDy2z8ZHBo069vkC4lEMukHfqMX FF52xfgl4Ihdn6LEFF6Gu4+hSHSLj89qnZFk12EEBedP7d/SXQTYbUh1Rkyf85Rajrp5GUxtbIn4z exo79w0RtixSBb3TUjOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oC4Nb-000LN3-8E; Thu, 14 Jul 2022 19:20:07 +0000 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oC4NX-000L9k-L7; Thu, 14 Jul 2022 19:20:05 +0000 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id C4D9234D34; Thu, 14 Jul 2022 19:19:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657826396; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=J1TVAvphNmTpAWW61VUw6mw/9ks964p5lRoXg8fT5pQ=; b=yaCt/W2pKkPFnDaETQRiTHkJCEF9k9sdkjq5JwaHQnawjSKoiYi4DI8vi/+Uw5d+Sul19z 37o2WGZVI43rBZhYukzagHSaK4SmQbA7jQM9qetajPGOmDZ520FSpw9IloUNbGKlSSf9kP bRh46ZyDYQTdv+Zp8n1jh86KwnMJjmE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657826396; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=J1TVAvphNmTpAWW61VUw6mw/9ks964p5lRoXg8fT5pQ=; b=wngWGUvhjqDObMv9OkYHJzzRhkbc88uRRchYKwwT861i6KWlF4AscZVrctIi5rsYr2VauG Qs7ENmMlzAFzaQBw== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) by relay2.suse.de (Postfix) with ESMTP id 80F252C141; Thu, 14 Jul 2022 19:19:55 +0000 (UTC) From: Michal Suchanek To: linux-sunxi@lists.linux.dev Cc: Michal Suchanek , Rob Herring , Krzysztof Kozlowski , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH 1/2] mtd: spi-nor: When a flash memory is missing do not report an error Date: Thu, 14 Jul 2022 21:19:47 +0200 Message-Id: <701967b0c418db333c66b48d225df60aa9d03ead.1657826188.git.msuchanek@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220714_122003_882325_75317D6E X-CRM114-Status: GOOD ( 15.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It is normal that devices are designed with multiple types of storage, and only some types of storage are present. The kernel can handle this situation gracefully for many types of storage devices such as mmc or ata but it reports and error when spi flash is not present. Only print a notice that the storage device is missing when no response to the identify command is received. Consider reply buffers with all bits set to the same value no response. Signed-off-by: Michal Suchanek Reported-by: kernel test robot --- drivers/mtd/spi-nor/core.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 502967c76c5f..6bab540171a4 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -1652,6 +1652,24 @@ static const struct flash_info *spi_nor_match_id(struct spi_nor *nor, return NULL; } +static const bool buffer_uniform(const u8 *buffer, size_t length) +{ + bool all0; + size_t i; + + for (all0 = true, i = 0; i < length; i++) + if (buffer[i] != 0) { + all0 = false; + break; + } + if (all0) + return true; + for (i = 0; i < length; i++) + if (buffer[i] != 0xff) + return false; + return true; +} + static const struct flash_info *spi_nor_detect(struct spi_nor *nor) { const struct flash_info *info; @@ -1666,8 +1684,11 @@ static const struct flash_info *spi_nor_detect(struct spi_nor *nor) info = spi_nor_match_id(nor, id); if (!info) { - dev_err(nor->dev, "unrecognized JEDEC id bytes: %*ph\n", - SPI_NOR_MAX_ID_LEN, id); + if (buffer_uniform(id, SPI_NOR_MAX_ID_LEN)) + dev_info(nor->dev, "No flash memory detected.\n"); + else + dev_err(nor->dev, "unrecognized JEDEC id bytes: %*ph\n", + SPI_NOR_MAX_ID_LEN, id); return ERR_PTR(-ENODEV); } return info; From patchwork Thu Jul 14 19:19:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Suchanek X-Patchwork-Id: 12918451 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36CFFC433EF for ; Thu, 14 Jul 2022 19:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XFdi9FZHu785ShYy1v+2n2qiupnknms2GhIjUMZpAs8=; b=RKwte0uPsEF8BQ PsC7Zgx/wIciTpYDO7biO9B6g9wP8HuFtdNeOSSvoZy4EVNhM/H2DAYiIHua7Dh34Tygdiljlt2aH RLKlc05VhxHJF36eID/+sF/H6yyJ9VQ5kbg5AYebXcgo69ULfQXbzgaNynI0DdZDX9GCQniR9y0Br bOf51nc+mC+noFWL/8lezr56+lNG4bnI7Ixgl0Ig/R1xQbYAlHnxtc7ud6ZaLOQ74X0zWrpHZ+Yon ABnFUB5HPfXJsUx0+1Zc5eGms+9B+P77aFt/Nb/y4v0di+X2CKkkexOw9LefSxjXMBQC/U+NL/qdt +Yjf7DSkm8NFZlVllneA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oC4Nj-000LXv-Jk; Thu, 14 Jul 2022 19:20:15 +0000 Received: from smtp-out2.suse.de ([195.135.220.29]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oC4NX-000L9u-Na; Thu, 14 Jul 2022 19:20:05 +0000 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 2EAD91F986; Thu, 14 Jul 2022 19:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1657826398; h=from:from:reply-to: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=4IXIt9i4IIWMBr8dsDU+TZSGcKwpUFNYiCeI9reK8Fo=; b=ogcuG11BaEb+JOU64/DLbpgROHc29PvOwMkMSFEH8hy5UIsK9BC4cqqutMZKAfXGQ2z4LP qSEsQv9CuNeUmZ7y5YwBVvGA4WuJJUKfCsz4zm+SBeD0aNTKYbw5XJp6IPBjrWawJMqKEX QIPycGOXqiz9VCZE45SgE0f1ikUqMys= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1657826398; h=from:from:reply-to: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=4IXIt9i4IIWMBr8dsDU+TZSGcKwpUFNYiCeI9reK8Fo=; b=gbsPuTgJhHTRxWIuoej/HugirZJCurSMj40g+kYnzuvVo+0NexrRxKqgASXl/wBCVR5oJF be/0CDRYgEv7enDQ== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) by relay2.suse.de (Postfix) with ESMTP id CE1032C142; Thu, 14 Jul 2022 19:19:57 +0000 (UTC) From: Michal Suchanek To: linux-sunxi@lists.linux.dev Cc: Michal Suchanek , Rob Herring , Krzysztof Kozlowski , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: [PATCH resend 2/2] ARM: dts: sunxi: Enable optional SPI flash on Orange Pi Zero board Date: Thu, 14 Jul 2022 21:19:48 +0200 Message-Id: <62c4e6be12771f3120f67a328a51ac360dc468d2.1657826188.git.msuchanek@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <701967b0c418db333c66b48d225df60aa9d03ead.1657826188.git.msuchanek@suse.de> References: <701967b0c418db333c66b48d225df60aa9d03ead.1657826188.git.msuchanek@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220714_122003_951261_15D40E24 X-CRM114-Status: GOOD ( 11.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The flash is present on all new boards and users went out of their way to add it on the old ones. Enabling it makes a more reasonable default. Signed-off-by: Michal Suchanek --- Link: https://lore.kernel.org/all/20200929083025.2089-1-msuchanek@suse.de/ arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts index 3706216ffb40..4f782b1bdf27 100644 --- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts +++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts @@ -163,8 +163,8 @@ &ohci1 { }; &spi0 { - /* Disable SPI NOR by default: it optional on Orange Pi Zero boards */ - status = "disabled"; + /* Enable optional SPI NOR by default */ + status = "okay"; flash@0 { #address-cells = <1>;