Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp742012pxb; Wed, 29 Sep 2021 08:47:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBKmOg81FM33/Rdla1v7Ldqc+l+rWq7uCtcV/T4HqsWuLfB/P4SV9TzYyyUsNEoaMEPpT4 X-Received: by 2002:a17:906:5cf:: with SMTP id t15mr435658ejt.375.1632930448337; Wed, 29 Sep 2021 08:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632930448; cv=none; d=google.com; s=arc-20160816; b=NS/bs0w7pulKOD5wT5HHP7x+pr9w2Tl2guJIxeLp/XCTHqEcrd3Lx8K+CCtdOyFwPg MiErTxFvwQHuQiu8lac5dFRCrI5iZo733PN0nY1gQEnd6wb/ZvlrVBBSqlr5eY260J2R Ka/SliE9dMnzChQio236KQs1H+VrXYUSYSYryL0/Flnlech7EuJaJ7Ln3w5AVXZE5xpS fDbEejrVSC+Q3RDMa6x/UhCZfQ7EtZmUlhL3rJlFFvbFFVLcaw0sl+h8wYncqmuDpxEx bzhrp0sxYLwemZNnqGSXzgDmrL+5ErHH1Lfuu0mCLnMfx+BSiz48kVHVRI+g2t0zoGAF rchw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=QIOhbXTW+4LTUMlGEWB6KTncQEdjxs82r47WlkWtpzM=; b=kIuR6+6zLuj5DUyeTEKWxtHeWWTYfPDM3QJ86iCJxD6A6vI1yws9EH5HPjeXkKqAVd Hc+rzXm24fIOvUk60exg07CYYLcBJy8tUTU8n5DsR5ZMQwOTEoxrSGzaSPdN3sFpWoBJ e1No891U+vm1bUKN9fCPVSFjZnhz6Dhjf2TWp3fp1G3TJAoCu6+PL6q7B2O7C5AATZ4q 6H6FjTKty2/u1L45Kr8PDO/AcxBG3D9oX7gm80n2FPjCtKjkwWspz1vbRbKwzhGWnzOi 2PHlPoeZNcHqJrZOYuvypP9udvEqQ29Prv4IFqgQe3pQ84Xx7xI07+oXZTG0q3tej+UZ 6Xpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=PTRcCeCW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d3si371974edm.263.2021.09.29.08.46.48; Wed, 29 Sep 2021 08:47:28 -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=@bewilderbeest.net header.s=thorn header.b=PTRcCeCW; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343524AbhI2L4Z (ORCPT + 99 others); Wed, 29 Sep 2021 07:56:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343508AbhI2L4G (ORCPT ); Wed, 29 Sep 2021 07:56:06 -0400 X-Greylist: delayed 95437 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 29 Sep 2021 04:54:25 PDT Received: from thorn.bewilderbeest.net (thorn.bewilderbeest.net [IPv6:2605:2700:0:5::4713:9cab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBA2AC06161C; Wed, 29 Sep 2021 04:54:25 -0700 (PDT) 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 C2A4B228; Wed, 29 Sep 2021 04:54:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1632916463; bh=QIOhbXTW+4LTUMlGEWB6KTncQEdjxs82r47WlkWtpzM=; h=From:To:Cc:Subject:Date:From; b=PTRcCeCWPbaNeUFJGtSuQneB/EDyfvdN4ll8NFb8jeYFSNP2dv8+OpvPAEtAaOGD/ ILxTuNdlM8KvWB2E9+S9lfk2UhzebJ+nOecoREqBVDC2Opjam2gd9JblinMDfPw406 FC1thpKR8dYPcjQogufcLRZckybbLL8ukMrRuf28= From: Zev Weiss To: openbmc@lists.ozlabs.org Cc: Greg Kroah-Hartman , Jeremy Kerr , Joel Stanley , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= , Zev Weiss , Rob Herring , Frank Rowand , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , linux-mtd@lists.infradead.org, Tudor Ambarus , Michael Walle , Pratyush Yadav , Andrew Jeffery , linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Subject: [PATCH 0/6] Dynamic aspeed-smc flash chips via "reserved" DT status Date: Wed, 29 Sep 2021 04:54:02 -0700 Message-Id: <20210929115409.21254-1-zev@bewilderbeest.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, This patch series aims to improve a scenario that arises in OpenBMC and which isn't handled very well at the moment. Certain devices, the example at hand being the flash chip used to store the host's firmware (e.g. the BIOS), may be shared between the BMC and the host system but only available to one or the other at any given time. The device may thus be effectively off-limits to the BMC when it boots, and only usable after userspace performs the necessary steps to coordinate appropriately with the host (tracking its power state, twiddling GPIOs, sending IPMI commands, etc.). Neither the "okay" nor the "disabled" device-tree status values works nicely for the flash device this case -- an "okay" device gets probed automatically as soon as the device and a driver for it are available, and a "disabled" one gets forgotten about entirely, whereas we want the BMC's kernel to be aware of the existence of the device, but not try to actually do anything with it (i.e. probe it) until explicitly requested to do so by userspace. However, while there's no support for it currently in the kernel tree, the device-tree spec [0] also lists "reserved" as a possible status value, and its description seems like a fairly reasonable fit for this situation: Indicates that the device is operational, but should not be used. Typically this is used for devices that are controlled by another software component, such as platform firmware. These patches start making use of this status value in the aspeed-smc driver. The first patch adds a companion routine to of_device_is_available() that checks for a "reserved" status instead of "okay". The second patch is a small MTD adjustment to allow an unregistered device to be cleanly re-registered. Patches 3 through 5 modify the aspeed-smc driver to allow individual chips to be attached and detached at runtime, and to avoid automatically attaching any marked as reserved. Finally, patch 6 employs the newly-supported status in adding support for the BIOS flash device to the ASRock Rack e3c246d4i BMC. Thanks, Zev [0] https://github.com/devicetree-org/devicetree-specification/releases/download/v0.3/devicetree-specification-v0.3.pdf Zev Weiss (6): of: base: Add function to check for status = "reserved" mtd: core: clear out unregistered devices a bit more mtd: spi-nor: aspeed: Refactor registration/unregistration mtd: spi-nor: aspeed: Allow attaching & detaching chips at runtime mtd: spi-nor: aspeed: Don't automatically attach reserved chips ARM: dts: aspeed: Add e3c246d4i BIOS flash device .../ABI/stable/sysfs-driver-aspeed-smc | 17 ++ .../boot/dts/aspeed-bmc-asrock-e3c246d4i.dts | 16 ++ drivers/mtd/mtdcore.c | 7 +- drivers/mtd/spi-nor/controllers/aspeed-smc.c | 177 +++++++++++++++--- drivers/of/base.c | 53 +++++- include/linux/of.h | 6 + 6 files changed, 238 insertions(+), 38 deletions(-) create mode 100644 Documentation/ABI/stable/sysfs-driver-aspeed-smc -- 2.33.0