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: 1534346 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; 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=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HKFJK5mZJz9ssD for ; Wed, 29 Sep 2021 21:58:25 +1000 (AEST) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HKFJK22h6z2yWG for ; Wed, 29 Sep 2021 21:58:25 +1000 (AEST) Authentication-Results: lists.ozlabs.org; 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 X-Original-To: linux-aspeed@lists.ozlabs.org Delivered-To: linux-aspeed@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=bewilderbeest.net (client-ip=71.19.156.171; helo=thorn.bewilderbeest.net; envelope-from=zev@bewilderbeest.net; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (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 Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [71.19.156.171]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HKFCq6GpPz2yw0; Wed, 29 Sep 2021 21:54:31 +1000 (AEST) 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 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-BeenThere: linux-aspeed@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux ASPEED SoC development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vignesh Raghavendra , Zev Weiss , Tudor Ambarus , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Richard Weinberger , Michael Walle , linux-mtd@lists.infradead.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , Miquel Raynal , Jeremy Kerr , linux-aspeed@lists.ozlabs.org, Pratyush Yadav , linux-arm-kernel@lists.infradead.org Errors-To: linux-aspeed-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linux-aspeed" 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;