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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 28A54C433F5 for ; Fri, 14 Jan 2022 11:05:32 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8F81383394; Fri, 14 Jan 2022 12:05:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=openbsd.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=kpnmail.nl header.i=@kpnmail.nl header.b="iLQnZvRW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BC7278340A; Fri, 14 Jan 2022 12:05:19 +0100 (CET) Received: from ewsoutbound.kpnmail.nl (ewsoutbound.kpnmail.nl [195.121.94.186]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BD2818340A for ; Fri, 14 Jan 2022 12:05:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=openbsd.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=kettenis@openbsd.org X-KPN-MessageId: c0327417-7529-11ec-922e-00505699b430 Received: from smtp.kpnmail.nl (unknown [10.31.155.8]) by ewsoutbound.so.kpn.org (Halon) with ESMTPS id c0327417-7529-11ec-922e-00505699b430; Fri, 14 Jan 2022 12:04:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kpnmail.nl; s=kpnmail01; h=mime-version:message-id:date:subject:to:from; bh=E/232aTzfsX4392Z8XDFX8SUOIauyiJ6B8evNmSUZ4M=; b=iLQnZvRWeN2+ehCMzPbxOwajaYifDM8lzhK55aZqGv1Dvv3r4F2bjY3QOePlepQAuLHWVEnITmLiu Mnn4IsUH2bDPXBAj503LfJ+3l9o+8BGfzI39g8il30yo6txgR7paCyfyqNUQufPk8+Elj81oREw5it bR+SgSziOE9vCuFA= X-KPN-VerifiedSender: No X-CMASSUN: 33|/9kE2yx/P+t4V6jGCDJKWechWXC7gjMP7AcolgRLRc6cNejThDkshG2tD0KYzT0 pRiM/K3Ps2KL2Z59TShSVww== X-Originating-IP: 83.163.83.176 Received: from copland.sibelius.xs4all.nl (sibelius.xs4all.nl [83.163.83.176]) by smtp.xs4all.nl (Halon) with ESMTPSA id ebb545c4-7529-11ec-a83c-00505699d6e5; Fri, 14 Jan 2022 12:05:45 +0100 (CET) From: Mark Kettenis To: u-boot@lists.denx.de Cc: sjg@chromium.org, jh80.chung@samsung.com, trini@konsulko.com, sven@svenpeter.dev, marcan@marcan.st, bmeng.cn@gmail.com, Mark Kettenis Subject: [PATCH 5/8] nvme: Add shutdown function Date: Fri, 14 Jan 2022 12:04:35 +0100 Message-Id: <20220114110438.58452-6-kettenis@openbsd.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220114110438.58452-1-kettenis@openbsd.org> References: <20220114110438.58452-1-kettenis@openbsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Add a function to disable the NVMe controller. This will be used to let the driver for the NVMe storage integrated on Apple SoCs shutdown the NVMe controller such we can shutdown the NVMe IOP controller in a clean way afterwards before handing control to the OS. Signed-off-by: Mark Kettenis --- drivers/nvme/nvme.c | 7 +++++++ drivers/nvme/nvme.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index e2d0f9c668..3b1a5c718f 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -896,3 +896,10 @@ free_queue: free_nvme: return ret; } + +int nvme_shutdown(struct udevice *udev) +{ + struct nvme_dev *ndev = dev_get_priv(udev); + + return nvme_disable_ctrl(ndev); +} diff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h index 57803b43fd..6e39af8831 100644 --- a/drivers/nvme/nvme.h +++ b/drivers/nvme/nvme.h @@ -670,5 +670,6 @@ struct nvme_ops { }; int nvme_init(struct udevice *udev); +int nvme_shutdown(struct udevice *udev); #endif /* __DRIVER_NVME_H__ */ -- 2.34.1