Message ID | 20240801195422.2296347-1-msp@baylibre.com (mailing list archive) |
---|---|
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 875F4C3DA64 for <linux-arm-kernel@archiver.kernel.org>; Thu, 1 Aug 2024 19:55: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:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=jyW55qSj/iPHMS0nqqgGxT6hlNq7rzg4SSxLEN7hDfg=; b=iCG6XeyphT0QhSO+RNcK1K76+F ygGxbfxzDFaA8T2G0o3ipPuvNXst52DZIrCLHrXq2k57gpyYvNd9ddjt2ukXxc2UAFZn1fHwrQbgv OIdTD88dXlpoygp94XvbzBKTzYeZPzcmq1ydMV76QLJHil+k+Ysto30Ar0KJIKHzjHXluk0BbHtO2 JIJsg7X7w+VLYAsMbbGlfF8vYuRNjQqSmSJ8Qvy2xbs2nqAG3Fw+Wmj9KiEu3spz4QjCCUhD3ofwj 8YznWEjKizqvEbWm1eSeBmXW6mtfsT33oVao2yvqrCFfSB1ZGOEIywyVs6unLA8jReN9LZZgnfJTO JMMf/TwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZbtI-00000006ajr-3FyM; Thu, 01 Aug 2024 19:55:12 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZbsm-00000006abP-47x8 for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 19:54:43 +0000 Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-81f905eb19cso371858839f.3 for <linux-arm-kernel@lists.infradead.org>; Thu, 01 Aug 2024 12:54:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1722542079; x=1723146879; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jyW55qSj/iPHMS0nqqgGxT6hlNq7rzg4SSxLEN7hDfg=; b=rwXDBPtxr2xYsxbb7CohetNYqtPzr9/ujiEBCOPR26G/71kj5WV7YUHg1Pzc0xeIRm yBKa+vDG0LyVwrEUw5Q5mSuiYgEehfKQV3mbliigUidD/pKfB1YUPlCmcme7Vn77GLcZ oy6siHfvYml0JaG6+zd5VOy+gFj3cgshKIo/71OPX+nyhQ8grdIVHQZGq0i/+SddvKWz FrXQaMVSe+cWjz5qTNbb3oagJyORivRv6H518nP/8mUXfRWuYm1Tyf2vuMpWL+4bPdLr 8Q9Buc/eKlSonMwSXr4ZsNkC0E/xIs2jCvCe+/Dz5BvBVcantujR4IUMGqt3jGfeRVAG MIQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722542079; x=1723146879; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jyW55qSj/iPHMS0nqqgGxT6hlNq7rzg4SSxLEN7hDfg=; b=oQ93SAnNDQG1OgV8GcxRxvSq85vtRcVpv+hReA14BaQQwUvvXBFONsroXwKZqTSELz fyoA2ml3plG/nYC+Ky/VXGjOY6N9Pv1kd/DoBxRhTFdeTEhchRUu5gDjE27Z1fVVyTWL WrnVsFYJor3l4dRb1s4YCS6e9dJWiMIcWLpi39NNowZkN75WuIdGjmQO6YeII2Kob6L8 Gx8HilqonzdR4h0SI1SaWdRepvk0f6GdlxRduoXHxsQl0gwaRiDj0StWIMzGn74+r9j2 CCdc7/oZNWyOubL1C4Alu38cehpWEJz+F5bLCR6MjD59xj3RAa7I4vD992NoyvpkE9gM 6tKA== X-Forwarded-Encrypted: i=1; AJvYcCUSAX94IbxPt+Ha6ifdL4BnWtJQ2SyU9ANI2adjud+EBlWgsy21H0fZcafnRsD7mLn3bEx+SvWMBSG6N7krT8iftbbH/IYqvFV5Z4grWlb9RJMm96g= X-Gm-Message-State: AOJu0YxYAHb5bWfNQSZ4iGaM8YMDEupYjyyEeIOEc6HceYZ8hHW4a8bM pLSkEqU5xfO7QsPK7WoBLKL70BEp/8sVYvXxGfDFwmWYWr5ya11frv43GYPgGT0= X-Google-Smtp-Source: AGHT+IEKV797TyolnkJWg6HMjhoCX7q5kaFe9HOie0hsAeiTC0W9aVdTPL1KTjz4JYdm8mGMQgqIOg== X-Received: by 2002:a05:6602:27cc:b0:803:83c0:6422 with SMTP id ca18e2360f4ac-81fd435a75bmr175501739f.9.1722542078795; Thu, 01 Aug 2024 12:54:38 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a245:8609:c1c4:a4f8:94c8:31f2]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-81fd4d1b7ddsm14395039f.3.2024.08.01.12.54.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 12:54:38 -0700 (PDT) From: Markus Schneider-Pargmann <msp@baylibre.com> To: Nishanth Menon <nm@ti.com>, Tero Kristo <kristo@kernel.org>, Santosh Shilimkar <ssantosh@kernel.org> Cc: Vibhore Vardhan <vibhore@ti.com>, Kevin Hilman <khilman@baylibre.com>, Dhruva Gole <d-gole@ti.com>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Markus Schneider-Pargmann <msp@baylibre.com> Subject: [PATCH v8 0/3] firmware: ti_sci: Introduce system suspend support Date: Thu, 1 Aug 2024 21:54:19 +0200 Message-ID: <20240801195422.2296347-1-msp@baylibre.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240801_125441_203726_D32AB7AA X-CRM114-Status: GOOD ( 26.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
firmware: ti_sci: Introduce system suspend support
|
expand
|
Abstract ******** This series introduces necessary ti_sci driver functionality to support various Suspend-to-RAM modes on TI AM62 family of devices. These Low Power Modes include Deep Sleep and MCU Only as described in section "6.2.4 Power Modes" of the AM62x Technical Reference Manual [0]. Summary ******* This series is a restructuring and rebase of the patch series by Dave Gerlach [1] and Dhruva Gole [2]. It applies on top of Linux 6.11-rc1. The kernel triggers entry to Low Power Mode through the mem suspend transition with the following: * At the bootloader stage, one is expected to package the TIFS stub which then gets pulled into the Tightly coupled memory of the Device Mgr (DM) R5 when it starts up. If using U-Boot, then it requires tispl.bin to contain the TIFS stub. Refer to ti-u-boot patch [3] for further details. The supported firmware version is from TI Processor SDK >= 10.00 ie. tag 10.00.04 from ti-linux-firmware [4]. * Use a TF-A binary that supports PSCI_SYSTEM_SUSPEND call. This causes system to use PSCI system suspend as last step of mem sleep. * The firmware requires that the OS sends a TISCI_MSG_PREPARE_SLEEP message in order to provide details about suspend, so we must add the ability to send this message. We also add the remaining TISCI Low Power Mode messages required for inquiring wake reason, enabling I/O isolation, and managing LPM constraints as part of a new PM ops. These messages are part of the TISCI PM Low Power Mode API [5]. (Patch 1) * We add support for the TISCI_MSG_QUERY_FW_CAPS message, used to retrieve the firmware capabilities of the currently running system firmware [6]. Sysfw version >= 10.00.04 support LPM_DM_MANAGED capability, where Device Mgr firmware now manages which low power mode is chosen. Going forward, this is the default configuration supported for TI AM62 family of devices. The state chosen by the DM can be influenced by sending constraints using the new LPM constraint APIs. (Patch 2) * Finally, the ti_sci driver must actually send TISCI_MSG_PREPARE_SLEEP message to firmware with the above information included, which it does during the driver suspend handler when PM_MEM_SUSPEND is the determined state being entered. The mode being sent depends on whether firmware capabilities have support for LPM_DM_MANAGED feature. Legacy firmware or those supporting other modes can extend the mode selection logic as needed. (Patch 3) Testing ******* This series can for example be tested with a am62a-lp-sk board. For am62a-lp-sk all usb nodes have to be disabled at the moment (usbss0, usb0, usbss1 and usb1). There is currently an issue with USB Link Power Management and turning off the USB device which is being worked on. Once booted suspend/resume can be tested with rtcwake: $ rtcwake -m mem -s 10 -d /dev/rtc0 Make sure /dev/rtc0 corresponds to rtc-ti-k3: $ dmesg | grep rtc-ti-k3 rtc-ti-k3 2b1f0000.rtc: registered as rtc0 Base commit: ************ v6.11-rc1 Changelog: ********** v8: - Restructuring of code to include all TISCI PM LPM ops - Removing malloc related to TIFS Stub as it is managed by DM - Dropping has_lpm check as suggested by Nishanth - Using LPM_DM_MANAGED capability for mode selection - Updating the suspend and resume callback handlers v7: - Address Andrew's concerns on SYSFW fw_caps API - Remove all the unused functions and variables including set_io_isolation and wake_reason calls - use dma_free_attrs - remove IO isolation related code from linux side, v6: - link to v6 [5] - Loading of FS Stub from linux no longer needed, hence drop that patch, - Drop 1/6 and 5/6 from the previous series [4]. - Add system suspend resume callbacks which were removed in commit 9225bcdedf16297a346082e7d23b0e8434aa98ed ("firmware: ti_sci: Use system_state to determine polling") - Use IO isolation while putting the system in suspend to RAM v5: - Add support (patch 3) for detecting the low power modes (LPM) of the FW/SoC with a recently introduced core TISCI_MSG_QUERY_FW_CAPS message. - Use TISCI_MSG_QUERY_FW_CAPS instead of misusing the TISCI_MSG_PREPARE_SLEEP to detect the FW/SoC low power caps (patch 4). - Take into account the supported LPMs in ti_sci_prepare_system_suspend() and handle the case when CONFIG_SUSPEND is not enabled (patch 6) that was reported by Roger Quadros and LKP. - Pick up Rob Herring's "Reviewed-by" tag for the binding patch. v4: - Fix checkpacth warnings in patches 2 and 3. - Drop the links with anchors in patch 2. v3: - Fix the compile warnings on 32-bit platforms reported by the kernel test robot in patches (3,5). - Pick up Roger's "Tested-by" tags. v2: - Addressed comments received for v1 series [1]. - Updated v1 patch 5 to use pm notifier to avoid firmware loading issues. - Dropped the reserved region requirement and allocate DMA memory instead. The reserved region binding patch is also removed. - Introduce two more TISCI LPM messages that are supported in SysFW. - Fixes in error handling. References: *********** [0] https://www.ti.com/lit/pdf/spruiv7 [1] https://lore.kernel.org/lkml/20220421203659.27853-1-d-gerlach@ti.com [2] https://lore.kernel.org/lkml/20230804115037.754994-1-d-gole@ti.com [3] https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/?h=ti-u-boot-2023.04&id=91886b68025c7ad121e62d1fc1fa4601eeb736cd [4] https://git.ti.com/cgit/processor-firmware/ti-linux-firmware/commit/?h=10.00.06&id=193f7d7570583a41ddc50a221e37c32be6be583e [5] https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/pm/lpm.html [6] https://downloads.ti.com/tisci/esd/latest/2_tisci_msgs/general/core.html#tisci-msg-query-fw-caps Dave Gerlach (1): firmware: ti_sci: Introduce Power Management Ops Georgi Vlaev (1): firmware: ti_sci: Add support for querying the firmware caps Vibhore Vardhan (1): firmware: ti_sci: Add system suspend and resume call drivers/firmware/ti_sci.c | 438 ++++++++++++++++++++++++- drivers/firmware/ti_sci.h | 137 +++++++- include/linux/soc/ti/ti_sci_protocol.h | 46 +++ 3 files changed, 619 insertions(+), 2 deletions(-)