From patchwork Wed Sep 29 11:54:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zev Weiss X-Patchwork-Id: 1534350 X-Patchwork-Delegate: tudor.ambarus@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=cVFsF4LV; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=bewilderbeest.net header.i=@bewilderbeest.net header.a=rsa-sha256 header.s=thorn header.b=e1JR3ccg; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HKFLT07fcz9ssD for ; Wed, 29 Sep 2021 22:00:17 +1000 (AEST) 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=FuHFmN2Q8ZcO06duQyUzvkclbl1z3wcliNSjx8rhsug=; b=cVFsF4LVUpYPYk +X6qmdxiy4JKX3Yl2LWMSDwLNBA+d12IsX7B9ExAC6qAfqACSCYDrWVVJfrxkQ8YIuRm5FYRFxoB3 P+5TXDr48eeBkKdw+a4NGSV5583L+266f3ADTyCSFF7mquRxmfYQV06u3u+Yp+HvzTg9gL+74RWI7 5wZY/jqbQyjpvpZ2kMKhYCrOWyl1rWNJbOHihaBJxUc5x3bMau9zEONGjhwdTHPx75ru+Tkia5z0I 4e22YpoogDAwOjOQ9zKWze2NDQM5K8cIBznF9ueg+aFqxPORT9H0lPZBUa/6/kOX8AZK+5Vlgd3qN 9/yhrHsaEJ7jHoMazyDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVYFU-00AvkI-82; Wed, 29 Sep 2021 11:59:44 +0000 Received: from thorn.bewilderbeest.net ([2605:2700:0:5::4713:9cab]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mVYAQ-00Atzb-Ge; Wed, 29 Sep 2021 11:54:32 +0000 Received: from hatter.bewilderbeest.net (71-212-29-146.tukw.qwest.net [71.212.29.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id E8698C81; Wed, 29 Sep 2021 04:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1632916470; bh=Y009K+RO8RDHvkwOXnnVGdcXcV27deDObF+gK4oQAV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e1JR3ccgRHn33ud6tMgC1CMeeRisKIlAAgrBRm7eb6hSGpyGrdolKwcy7HVnjgYQk PNAz2XS/8sH8jKzNjRq3hHsPjLgkukc3El2ZdjBfGCg1RbDxoUuzgZfUkDPi+piwd/ RC1TN5yznTetYwWE5qOhl0+22V/KcVmBL31QXIEc= From: Zev Weiss To: openbmc@lists.ozlabs.org Cc: Greg Kroah-Hartman , Jeremy Kerr , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Zev Weiss , Tudor Ambarus , Michael Walle , Pratyush Yadav , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Andrew Jeffery , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] mtd: spi-nor: aspeed: Don't automatically attach reserved chips Date: Wed, 29 Sep 2021 04:54:07 -0700 Message-Id: <20210929115409.21254-6-zev@bewilderbeest.net> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210929115409.21254-1-zev@bewilderbeest.net> References: <20210929115409.21254-1-zev@bewilderbeest.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210929_045430_601407_ABA5B8A0 X-CRM114-Status: GOOD ( 15.35 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: With this change, any flash chips under the controller that are marked with a DT status of "reserved" will be created, but not automatically attached. Userspace can later request that they be attached [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org With this change, any flash chips under the controller that are marked with a DT status of "reserved" will be created, but not automatically attached. Userspace can later request that they be attached using the attach_chip sysfs file. This is to accommodate situations where a chip may be (for example) shared with another controller external to the SoC and require userspace to arbitrate access to it prior to actually attaching it. (such as a firmware SPI flash shared between a BMC and the host system). Signed-off-by: Zev Weiss --- drivers/mtd/spi-nor/controllers/aspeed-smc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/spi-nor/controllers/aspeed-smc.c b/drivers/mtd/spi-nor/controllers/aspeed-smc.c index da49192a8220..328b008fafb2 100644 --- a/drivers/mtd/spi-nor/controllers/aspeed-smc.c +++ b/drivers/mtd/spi-nor/controllers/aspeed-smc.c @@ -826,10 +826,14 @@ static int aspeed_smc_setup_flash(struct aspeed_smc_controller *controller, unsigned int cs; int ret = -ENODEV; - for_each_available_child_of_node(np, child) { + for_each_child_of_node(np, child) { struct aspeed_smc_chip *chip; struct spi_nor *nor; + /* Skip disabled nodes, but include reserved ones for later attachment */ + if (!of_device_is_available(child) && !of_device_is_reserved(child)) + continue; + /* This driver does not support NAND or NOR flash devices. */ if (!of_device_is_compatible(child, "jedec,spi-nor")) continue; @@ -873,6 +877,9 @@ static int aspeed_smc_setup_flash(struct aspeed_smc_controller *controller, controller->chips[cs] = chip; + if (of_device_is_reserved(child)) + continue; + ret = aspeed_smc_register_chip(chip); if (ret) break;