Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1033461rwb; Wed, 16 Nov 2022 11:00:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf5xkQwrQq9ZND1iyAN1NUZyk1g/9GnS/YvcRuwiI1fi0kwAZ2ImOM1HxX6WQn8ZYqt1DXIW X-Received: by 2002:a63:c0f:0:b0:476:fc22:d14 with SMTP id b15-20020a630c0f000000b00476fc220d14mr1037750pgl.65.1668625232069; Wed, 16 Nov 2022 11:00:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668625232; cv=none; d=google.com; s=arc-20160816; b=t3Yd+HgKWirJ9L299DuWzsiKSGDFH1lauH21SLCeOCL9L1AKstL530qUovXjsCq3vA AOAv5KLQqvZKn4OtKC946fnHD831PniIVBvP5yHbX5fLYMXQw4d7JG/HIN4I4ZEItLUo Ex2z2ozEV79WAM2nz9BS8TX9eZQTy6XKjtAAp7OKY0yG/bjJfGR2fKqcE1c84FgplD2T KmuuursHrkOZS0SBMK1wIOrzWjBXEB7yBpSOMD/LLEEJJ2TgnA0tWS6BVweV389tdnHZ OKfnKfoUQR2kVfD3p+ivZ2+3XIogDv5qK2Sm7tH3Sku+Ym6gAwDn6N6S3MRmB5+Bli5G O1VA== 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=1L0WY0yI5y9feiQbVZ8rLBkv86csE4RjbMTHBRJ+J34=; b=vbwr0LAo7H2Z3w5BMBY8UJn/yHS064xlv4JNY2G/HXGnBc55W5HEzKloktp73uKNv8 tVEih2DU0GC5oQDVBVXOMEMG34uKlt58gvfeWLcze1/X/IgsDd88MNLbgBqLqtCfhfsH /TlFLK8uT7yay8ZOY7IwlacBEXIhXjOA6H6Vxj2bn0clFBXFIl6ncHN6O6KuAmILl5yK nwVemLS64YwNXsBX+WQRDVGCH2tIzZXCpDUvmzOt0HNVG9C+bBev4mF1q/lJ0zitwzJe CR39d83bOfKJP80YlaOXYD0vzwLHcTxigNqR+FhHsMDtdt8Q7cnTazHPYHMusJ6NOBdh 65qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=P40jWrct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f10-20020a17090a9b0a00b00212d2ba106fsi2326861pjp.151.2022.11.16.11.00.19; Wed, 16 Nov 2022 11:00:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=P40jWrct; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234108AbiKPSNg (ORCPT + 90 others); Wed, 16 Nov 2022 13:13:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233825AbiKPSNe (ORCPT ); Wed, 16 Nov 2022 13:13:34 -0500 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD828DEA5; Wed, 16 Nov 2022 10:13:32 -0800 (PST) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 2AGIDIvt124704; Wed, 16 Nov 2022 12:13:18 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1668622398; bh=1L0WY0yI5y9feiQbVZ8rLBkv86csE4RjbMTHBRJ+J34=; h=From:To:CC:Subject:Date; b=P40jWrct08UtaFW0YRvLV82dO7rVZqAMjKHuZsph3hYg/zD+oMPsZccKjXr2bATJT QukX6qqOhTzTnn+6/ISdcROydQ0DDWgd7gxtdbqyErK3nCfUMW1rGXhnEKt8ZLO2QR i3tyumpjAQaEDcRoIJQxAk2EdJ+68YJyTWTRdryc= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 2AGIDI2s013544 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 16 Nov 2022 12:13:18 -0600 Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Wed, 16 Nov 2022 12:13:17 -0600 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Wed, 16 Nov 2022 12:13:17 -0600 Received: from jti.ent.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 2AGID8ME026690; Wed, 16 Nov 2022 12:13:10 -0600 From: Georgi Vlaev To: Nishanth Menon , Tero Kristo , Santosh Shilimkar , Rob Herring , Krzysztof Kozlowski CC: , , , Vibhore Vardhan , Vignesh Raghavendra , Roger Quadros Subject: [PATCH v4 0/5] firmware: ti_sci: Introduce system suspend support Date: Wed, 16 Nov 2022 20:13:02 +0200 Message-ID: <20221116181307.198209-1-g-vlaev@ti.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series introduces necessary ti_sci driver functionality in preparation of supporting DeepSleep mode for suspend to mem on TI K3 AM62x. This version is a fixup and rebase of the patch series by Dave Gerlach [1]. It applies on top of v6.1-rc5. Deep Sleep mode is described in section "5.2.4.4 DeepSleep" of the AM62x Technical Reference Manual [2]. The kernel triggers entry to Deep Sleep mode through the mem suspend transition with the following: * 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 TISCI_MSG_LPM_WAKE_REASON and TISCI_MSG_SET_IO_ISOLATION messages as part of a new PM ops. These messages are part of the TISCI PM Low Power Mode API [3]. (Patch 2) * A memory address must be provided to the firmware using the above message, which is allocated and managed by dma_alloc_coherent() and friends. (Patch 3) * System must load firmware to a specific location before Deep Sleep is entered, and this is accomplished using a memory region in device tree to indicate where this firmware should be loaded, and also a "firmware-name" property to indicate the name of the firmware to load. The ti_sci driver checks in its pm handler to see if the firmware has been loaded and if not, loads it. (Patch 4) * 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. (Patch 5) This is tested on am625-sk using a limited dts with all devices disabled apart from cpu0, main_uart0, i2c, rtc, mmc/sd, dmsc, and secure_proxy_main. Testing this sequence requires K3 sdhci suspend/resume support [4], enable the wkup_rtc in the am625-sk.dts, disable devices that don't support system suspend/resume like OSPI and CPSW3G. In can be tested on the following branch: https://github.com/gvlaev/linux/tree/upstream-v6.2/lpm-ti-sci-v2 Changelog: 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. [1] https://lore.kernel.org/lkml/20220421203659.27853-1-d-gerlach@ti.com [2] https://www.ti.com/lit/pdf/spruiv7 [3] https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/pm/lpm.html [4] https://lore.kernel.org/lkml/20220408124338.27090-1-a-govindraju@ti.com Georgi Vlaev (5): dt-bindings: ti, sci: Add lpm region and firmware-name firmware: ti_sci: Introduce Power Management Ops firmware: ti_sci: Allocate memory for the LPM modes firmware: ti_sci: Use dt provided fw name and address to load at suspend time firmware: ti_sci: Introduce prepare system suspend call .../bindings/arm/keystone/ti,sci.yaml | 21 +- drivers/firmware/ti_sci.c | 357 ++++++++++++++++++ drivers/firmware/ti_sci.h | 64 +++- include/linux/soc/ti/ti_sci_protocol.h | 44 +++ 4 files changed, 481 insertions(+), 5 deletions(-) base-commit: 094226ad94f471a9f19e8f8e7140a09c2625abaa -- 2.30.2