From nobody Wed Dec 17 14:13:43 2025 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B720D221264 for ; Mon, 3 Nov 2025 12:42:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762173766; cv=none; b=eB8dNc57fycce3WJDKENL1qhY75a2/XuLJIW2rfd7XNeascIHPqc9YyAOxZesmoW+pePzW9HWGOV73FHLORwuzpdHTDgh1rNlCu3nTWAeroAyCaiL1nHH1Boq8x/StRVQ1EeRn0jLb4cZLCV0l0XHY5dREH6LyKMjRrMWO/YlUc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762173766; c=relaxed/simple; bh=05bvAMFQtigRL9AkIb9HLNaYbuwhPBcTJBkQFv446gU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bYvlpOFEEEsZ39ig7XjNLw251R5wK8+I+oTNBn4KD3yoBHqCTg7Iza+OCwvmRoQq2wMLlWoP1M0Y5PQQSdzN9LxNX1nokQA1sW9vzpvXDmvtqnbanwVV30HGOpxyA7pNhHzy35As5tyhZVSIizpvSb0e+QEaOzKG5mIx+t0YZ/g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=WdHMaNdA; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="WdHMaNdA" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-640aa1445c3so2258113a12.1 for ; Mon, 03 Nov 2025 04:42:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1762173763; x=1762778563; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6fFCdIMIJ8Uo09Pxm7hTDDj9X6OUIsKRKshcXYCzYPI=; b=WdHMaNdAzTg+Dvwh45Xy6GVseFqWBuHOk1oom7fYSjeiC9sVqPp9WAX0ZtaV54edto ns3X1B98dSQQSm2zc9OH0aubBBZ7vzDKQQLOlURyI+gp3tsUu53SoCV/BX5tdrFu+AMs EBgEpl+TmMfkCtqJFHSoGPNCB7Ryad9TQ1+Q7OEXeFtdkWPsuN8Whi3RdhYkrqsYFV9z W32A4IS2qHqbUaN+AH+oXKohEXM+ej/5KPv0o8XFC8Yh5JW6MKjWvmp3OHkZI6AiQnS3 5UUbN3dul1a6b5zou+Ycts+h8nxXJgljMlMauglAXY056VgYP+WS5if3AGJqMu/w5NFa PzEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762173763; x=1762778563; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6fFCdIMIJ8Uo09Pxm7hTDDj9X6OUIsKRKshcXYCzYPI=; b=caCKAGXQCwOeGdH4N9mmXEY5dA85zOlxtM7xx65tfORqsFvvkTFkwNUY3G5Lt2+a1S 5Xze/0HaLbEgtowVIHS8cmkATmecHVUh7PEDIqaBwWXQdYz0He/925jZSv8ktnwm6hFG NtSVHYxvBENMzCtc7i9rH8BZCA/9rfJP7eSTBRS2ZJUfJyymBGlrQDo+yUDkPDtZiAGj 9+aLKE3wGUQqC17pNOyTTPWK08plLxoBVXlHJPGHJ+Cu2ogiFjMPMDzAF8pq1Fn0+pRL Lt1SgVCejhbkOQRueAxoJD4zkatl+7nUItczxYoQVJ228yMYSZtcknaVrGrkKol80wua IdWQ== X-Forwarded-Encrypted: i=1; AJvYcCUB0oMxzjN47qwIpn4U0HKmO4TaiYHSacCZUHo2ujKXuStvQ71jDUVGsAHfLU091SWRa6tL0augDR93q7k=@vger.kernel.org X-Gm-Message-State: AOJu0YyyMd8AcF5prBuR5B/NhdX2jJ2jwCXqVJOdz3KS0/R0vHeyJGxD GWwQbs0x8xZxyWE91c+y5ejv577W8WW7FqrnASs3CbpCh+maoXJJGWlKdnKinRXXLSI= X-Gm-Gg: ASbGnctvjDnJwB491kFzFg7w92N9EtEd3jRQp2VEhX+jTFAqTcQKuAw4DKc1Di0lLOV 5QUAuDk3p8v5o0gjcLX+Di0/fMs32K+4nk9qAGT1w6DKVr/2m01f2uCE6CK+qW9m7Kv2AIrPBfF QwjfECcdY7aPtESox/TqeUwIkRMg0G2wO1U+muuW4JNmkMtHuK8fewYnEJ4eHoD3xG805DDfmU6 8YMrvm3T0CeMq9Px047hhNn6FtXaUbH6ORSim1+Eenf0F2HvlTYX8MaEw50TEjrk32JQ+E2trXC WEfy63jhvmKcAnSLlqGTZ4l5cRgFw9Jn57+dZ9xntFK7ssM5WNnZevtNxAYs620Q9cVD+pIy+nE UDRMMY8DG9SIK2SC1YVnki8Vhi3mSggzmpoaEZdVnXJbaWIGtJWlybqnBqeuepi9kK59jcimWuF uAo9eLvA== X-Google-Smtp-Source: AGHT+IGLOlATomjwi7fjoVoQAOmBe8LfZrNU0JTjWyfW5nhEuGL7RfvkIMlNkbvH5sxfdhy0mbYqtw== X-Received: by 2002:a05:6402:440d:b0:640:6512:b9f with SMTP id 4fb4d7f45d1cf-640770209afmr12414380a12.28.1762173763080; Mon, 03 Nov 2025 04:42:43 -0800 (PST) Received: from localhost ([2001:4090:a247:830a:fe22:a8:f29a:a5c3]) by smtp.gmail.com with UTF8SMTPSA id 4fb4d7f45d1cf-640aa4067f6sm5556380a12.34.2025.11.03.04.42.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 04:42:42 -0800 (PST) From: "Markus Schneider-Pargmann (TI.com)" Date: Mon, 03 Nov 2025 13:42:19 +0100 Subject: [PATCH v10 1/3] firmware: ti_sci: Support transfers without response Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251103-topic-am62-partialio-v6-12-b4-v10-1-0557e858d747@baylibre.com> References: <20251103-topic-am62-partialio-v6-12-b4-v10-0-0557e858d747@baylibre.com> In-Reply-To: <20251103-topic-am62-partialio-v6-12-b4-v10-0-0557e858d747@baylibre.com> To: Nishanth Menon , Tero Kristo , Santosh Shilimkar Cc: Vishal Mahaveer , Kevin Hilman , Dhruva Gole , Sebin Francis , Kendall Willis , Akashdeep Kaur , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Markus Schneider-Pargmann (TI.com)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1698; i=msp@baylibre.com; h=from:subject:message-id; bh=05bvAMFQtigRL9AkIb9HLNaYbuwhPBcTJBkQFv446gU=; b=owGbwMvMwCXWejAsc4KoVzDjabUkhkyOxYYuAaVLVRiPt3JoMtrKTTqVPGHBt8C59bPfH/Pm0 eFI17vQUcrCIMbFICumyNKZGJr2X37nseRFyzbDzGFlAhnCwMUpABPp2sfwP1Io8u3ah0+7Qsy1 7vg8+H6J6QTbOom63ra1x1YGSx/NYmX4p9tmlb56XfzltTOZRAuFHj1WW1h5dnNb5KXdUtU/Y7r fsgEA X-Developer-Key: i=msp@baylibre.com; a=openpgp; fpr=BADD88DB889FDC3E8A3D5FE612FA6A01E0A45B41 Check the header flags if an response is expected or not. If it is not expected skip the receive part of ti_sci_do_xfer(). This prepares the driver for one-way messages as prepare_sleep for Partial-IO. Reviewed-by: Kendall Willis Signed-off-by: Markus Schneider-Pargmann (TI.com) Reviewed-by: Dhruva Gole Reviewed-by: Sebin Francis --- drivers/firmware/ti_sci.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 49fd2ae01055d0f425062147422471f0fd49e4bd..2585cb82d1ad8e3d79bca458a2b= 86cc81a3e627b 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -398,6 +398,9 @@ static void ti_sci_put_one_xfer(struct ti_sci_xfers_inf= o *minfo, static inline int ti_sci_do_xfer(struct ti_sci_info *info, struct ti_sci_xfer *xfer) { + struct ti_sci_msg_hdr *hdr =3D (struct ti_sci_msg_hdr *)xfer->tx_message.= buf; + bool response_expected =3D !!(hdr->flags & (TI_SCI_FLAG_REQ_ACK_ON_PROCES= SED | + TI_SCI_FLAG_REQ_ACK_ON_RECEIVED)); int ret; int timeout; struct device *dev =3D info->dev; @@ -409,12 +412,12 @@ static inline int ti_sci_do_xfer(struct ti_sci_info *= info, =20 ret =3D 0; =20 - if (system_state <=3D SYSTEM_RUNNING) { + if (response_expected && system_state <=3D SYSTEM_RUNNING) { /* And we wait for the response. */ timeout =3D msecs_to_jiffies(info->desc->max_rx_timeout_ms); if (!wait_for_completion_timeout(&xfer->done, timeout)) ret =3D -ETIMEDOUT; - } else { + } else if (response_expected) { /* * If we are !running, we cannot use wait_for_completion_timeout * during noirq phase, so we must manually poll the completion. --=20 2.51.0 From nobody Wed Dec 17 14:13:43 2025 Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com [209.85.208.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D696A308F33 for ; Mon, 3 Nov 2025 12:42:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762173768; cv=none; b=UOGM2sx7OUxcHxGzROhDKrfypwdOG6LqLObLEqc42wiN9e2fawHZPwFZW3Wy0PO+lIcR8qq7Sl1AZKne6NIhW1PdtRVgf7/ZEKYRHWNuRHKS/mwdFakeyLcDlEI7BSY1/Jh6n92vStgMyE72OatGh6GQpTXWTykFYmV/eBtjqOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762173768; c=relaxed/simple; bh=3nTf+/ss8Vb1phICCN/rX1fk5ehJsdJVA3tLrFZB+zQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=n6gocOAzZidHRH7LnMtv+j8XHpykrHWlOBJNdV2eCYHo8/spPR9WmS4YcIAMJ8pLjfLf561gIKSx0fLVUTNFoMIWMJBVeBgH7MBVwK5gnei2490cTwKW2O4Zoa+DdBjLaPKFIRk/jKyhXNCsZjOrVsW4fOBAJhHa/HHRypJwecI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=mFZTLWae; arc=none smtp.client-ip=209.85.208.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="mFZTLWae" Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-63bdfd73e6eso10130547a12.0 for ; Mon, 03 Nov 2025 04:42:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1762173764; x=1762778564; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=q+/t9bteFAoRNa+cQTzNOtIizDYHm0AvKyEZOiZN2Yo=; b=mFZTLWaeASw94HUsRKaHFP1S5fPxai9bP9KG7YJJUyJhe+R+B9C3TH1SQT1UWGSElE G02HijpTBNWrTcdx+OE7GZYkWE8wAdXAFi+cJgYlZlzu5LKLpiQ0vSTal4DOjiFORfyT gk+TftrsrElxexu4oSag/1Imyz4bbDgVybB1RGVy2mZF7zd7ZhW47FziuJFQb/XtZbRW YsAnB3ECLJF4JvqW9OEtKiA4GqEYZmk7f3AC+1NjJtnprVeYHlJnzFXMq2cOzRbmhZ90 tO1//ldvjeBFG8XctdDnKNwks1E+ez0F9kf47hOtHWsjhb1QFiKJReLKg3sjwLMgaeAS qqtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762173764; x=1762778564; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q+/t9bteFAoRNa+cQTzNOtIizDYHm0AvKyEZOiZN2Yo=; b=gWtOZBdJWbpxkkiuViYCt+8WL2yQPW04A2uX7auCQoRagZMBYSMwi+jxqQdUlkvC7Q hUst8AstYPINpkUqj2OLaUv4gfv5hgCv+WHYeJ9cQYZwuRYbz5hbu+jM1TqqWi39TKoi 3mgBqJBnYrL4yVBaSnw0vMVQnvj2t4z+AFulQxSipR06i5G09gTCz+5gcwEH0P7sMkQ1 a0G0acJu5BHRLuig3m3tb/fzQmuPmfr06CxvY0N1Uz/DLglJnvYgE/7LDHnpIYjvLefW E//7g09MoK2G6z+Lwvf45qyNInp6B0cJOERxswU7S1PeJqCz4+A0PuNmgBt30xWyrTJT KDCA== X-Forwarded-Encrypted: i=1; AJvYcCUdcztJzVU28POs7XbO3RdZgWCqJ+aCR2YVjaoaN/IpfFaB1JoqwIBb+I1qyCGYsF215ndGjDmin/pD5z8=@vger.kernel.org X-Gm-Message-State: AOJu0YxIndZHVvKG1qJBKs0ASvchUdF890KWehEDW+l2uk14UEvERCcg J4I6e+uNoIVqm3PEz/3pXsyipl5HWSasPaOfWwmj17O8lWhrd53cuSl7v0yYz7yauZg= X-Gm-Gg: ASbGnctZKCE3YDbUW3h3XVIcc+vCaO3dpwUneaiinQFymtp0rz58ZZZiyJjLo3e6RbF DrThskW13hr0sJNVUGmpbEPgBN7ieRXnqSJa50lhrTbnhh+FzV5xJTU/Hl0LmLg/w8LMpmvFT0P f6P/7GP6vEzYEaJzUqrOAUE9cI2AcAut/6Zqov9tSGpvsKCPUEpBNvTQ9EfsiW6F44SV6TnZAXS w9xW2IfdrAe5dyePC31+PnhiJQWIEXbeaMVmrrVExdxYDSG9P289ba0WGNjvq21SnEvfAeinecL Pc+OM+G76q3JVRCCTpX7mh1QrihWcLDOaVyXkHFWe2RP1cd/9CUakqO+g0/c+eZ6g8aKu7q12l8 cZT1QKLs3X6wdsmADrRvIC3CwH1vxQxew9t007cnzW6qlowHyHsd+WLZ3L/UkWQkAGTEOi9y2oA iLnzA66g== X-Google-Smtp-Source: AGHT+IFIHqwLMhjGscMYSAijor0+3yh5hRoO0Raw0QVXNoSscDyDDbST6mC5uISlP4ngwkAwYv6teg== X-Received: by 2002:a17:907:9707:b0:b3c:5f99:dac7 with SMTP id a640c23a62f3a-b706e54eabfmr1302167766b.21.1762173764075; Mon, 03 Nov 2025 04:42:44 -0800 (PST) Received: from localhost ([2001:4090:a247:830a:fe22:a8:f29a:a5c3]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-b70acf84c51sm510327066b.30.2025.11.03.04.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 04:42:43 -0800 (PST) From: "Markus Schneider-Pargmann (TI.com)" Date: Mon, 03 Nov 2025 13:42:20 +0100 Subject: [PATCH v10 2/3] firmware: ti_sci: Partial-IO support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251103-topic-am62-partialio-v6-12-b4-v10-2-0557e858d747@baylibre.com> References: <20251103-topic-am62-partialio-v6-12-b4-v10-0-0557e858d747@baylibre.com> In-Reply-To: <20251103-topic-am62-partialio-v6-12-b4-v10-0-0557e858d747@baylibre.com> To: Nishanth Menon , Tero Kristo , Santosh Shilimkar Cc: Vishal Mahaveer , Kevin Hilman , Dhruva Gole , Sebin Francis , Kendall Willis , Akashdeep Kaur , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Markus Schneider-Pargmann (TI.com)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=7313; i=msp@baylibre.com; h=from:subject:message-id; bh=3nTf+/ss8Vb1phICCN/rX1fk5ehJsdJVA3tLrFZB+zQ=; b=owGbwMvMwCXWejAsc4KoVzDjabUkhkyOxaZpaTeDLddf+spvW/3j+orOe8slzeqzCj/0xrB9m MKw/U9ARykLgxgXg6yYIktnYmjaf/mdx5IXLdsMM4eVCWQIAxenAEykT4WR4axrzwFtDSZNw/xn 1b0bIw8d474xd2f+x602rPGWWU+W5TH8D/oaNmOf/bIZp5XjTz3y9v6t/Ld7U8amrs+Gm0SyWeY asAEA X-Developer-Key: i=msp@baylibre.com; a=openpgp; fpr=BADD88DB889FDC3E8A3D5FE612FA6A01E0A45B41 Add support for Partial-IO poweroff. In Partial-IO pins of a few hardware units can generate system wakeups while DDR memory is not powered resulting in a fresh boot of the system. These hardware units in the SoC are always powered so that some logic can detect pin activity. If the system supports Partial-IO as described in the fw capabilities, a sys_off handler is added. This sys_off handler decides if the poweroff is executed by entering normal poweroff or Partial-IO instead. The decision is made by checking if wakeup is enabled on all devices that may wake up the SoC from Partial-IO. The possible wakeup devices are found by checking which devices reference a "Partial-IO" system state in the list of wakeup-source system states. Only devices that are actually enabled by the user will be considered as an active wakeup source. If none of the wakeup sources is enabled the system will do a normal poweroff. If at least one wakeup source is enabled it will instead send a TI_SCI_MSG_PREPARE_SLEEP message from the sys_off handler. Sending this message will result in an immediate shutdown of the system. No execution is expected after this point. The code will wait for 5s and do an emergency_restart afterwards if Partial-IO wasn't entered at that point. A short documentation about Partial-IO can be found in section 6.2.4.5 of the TRM at https://www.ti.com/lit/pdf/spruiv7 Signed-off-by: Markus Schneider-Pargmann (TI.com) Reviewed-by: Dhruva Gole Reviewed-by: Kendall Willis Reviewed-by: Sebin Francis --- drivers/firmware/ti_sci.c | 109 ++++++++++++++++++++++++++++++++++++++++++= +--- drivers/firmware/ti_sci.h | 5 +++ 2 files changed, 107 insertions(+), 7 deletions(-) diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 2585cb82d1ad8e3d79bca458a2b86cc81a3e627b..811507ded63ac784ad6c6ad77b2= f827768f3f3c7 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -1673,6 +1673,9 @@ static int ti_sci_cmd_clk_get_freq(const struct ti_sc= i_handle *handle, static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8= mode, u32 ctx_lo, u32 ctx_hi, u32 debug_flags) { + u32 msg_flags =3D mode =3D=3D TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO ? + TI_SCI_FLAG_REQ_GENERIC_NORESPONSE : + TI_SCI_FLAG_REQ_ACK_ON_PROCESSED; struct ti_sci_info *info; struct ti_sci_msg_req_prepare_sleep *req; struct ti_sci_msg_hdr *resp; @@ -1689,7 +1692,7 @@ static int ti_sci_cmd_prepare_sleep(const struct ti_s= ci_handle *handle, u8 mode, dev =3D info->dev; =20 xfer =3D ti_sci_get_one_xfer(info, TI_SCI_MSG_PREPARE_SLEEP, - TI_SCI_FLAG_REQ_ACK_ON_PROCESSED, + msg_flags, sizeof(*req), sizeof(*resp)); if (IS_ERR(xfer)) { ret =3D PTR_ERR(xfer); @@ -1709,11 +1712,12 @@ static int ti_sci_cmd_prepare_sleep(const struct ti= _sci_handle *handle, u8 mode, goto fail; } =20 - resp =3D (struct ti_sci_msg_hdr *)xfer->xfer_buf; - - if (!ti_sci_is_response_ack(resp)) { - dev_err(dev, "Failed to prepare sleep\n"); - ret =3D -ENODEV; + if (msg_flags =3D=3D TI_SCI_FLAG_REQ_ACK_ON_PROCESSED) { + resp =3D (struct ti_sci_msg_hdr *)xfer->xfer_buf; + if (!ti_sci_is_response_ack(resp)) { + dev_err(dev, "Failed to prepare sleep\n"); + ret =3D -ENODEV; + } } =20 fail: @@ -3667,6 +3671,78 @@ devm_ti_sci_get_resource(const struct ti_sci_handle = *handle, struct device *dev, } EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource); =20 +/* + * Iterate all device nodes that have a wakeup-source property and check i= f one + * of the possible phandles points to a Partial-IO system state. If it + * does resolve the device node to an actual device and check if wakeup is + * enabled. + */ +static bool ti_sci_partial_io_wakeup_enabled(struct ti_sci_info *info) +{ + struct device_node *wakeup_node =3D NULL; + + for_each_node_with_property(wakeup_node, "wakeup-source") { + struct of_phandle_iterator it; + int err; + + of_for_each_phandle(&it, err, wakeup_node, "wakeup-source", NULL, 0) { + struct platform_device *pdev; + bool may_wakeup; + + /* + * Continue if idle-state-name is not off-wake. Return + * value is the index of the string which should be 0 if + * off-wake is present. + */ + if (of_property_match_string(it.node, "idle-state-name", "off-wake")) + continue; + + pdev =3D of_find_device_by_node(wakeup_node); + if (!pdev) + continue; + + may_wakeup =3D device_may_wakeup(&pdev->dev); + put_device(&pdev->dev); + + if (may_wakeup) { + dev_dbg(info->dev, "%pOF identified as wakeup source for Partial-IO\n", + wakeup_node); + of_node_put(it.node); + of_node_put(wakeup_node); + return true; + } + } + } + + return false; +} + +static int ti_sci_sys_off_handler(struct sys_off_data *data) +{ + struct ti_sci_info *info =3D data->cb_data; + const struct ti_sci_handle *handle =3D &info->handle; + bool enter_partial_io =3D ti_sci_partial_io_wakeup_enabled(info); + int ret; + + if (!enter_partial_io) + return NOTIFY_DONE; + + dev_info(info->dev, "Entering Partial-IO because a powered wakeup-enabled= device was found.\n"); + + ret =3D ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTI= AL_IO, 0, 0, 0); + if (ret) { + dev_err(info->dev, + "Failed to enter Partial-IO %pe, trying to do an emergency restart\n", + ERR_PTR(ret)); + emergency_restart(); + } + + mdelay(5000); + emergency_restart(); + + return NOTIFY_DONE; +} + static int tisci_reboot_handler(struct sys_off_data *data) { struct ti_sci_info *info =3D data->cb_data; @@ -3946,6 +4022,19 @@ static int ti_sci_probe(struct platform_device *pdev) goto out; } =20 + if (info->fw_caps & MSG_FLAG_CAPS_LPM_PARTIAL_IO) { + ret =3D devm_register_sys_off_handler(dev, + SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_FIRMWARE, + ti_sci_sys_off_handler, + info); + if (ret) { + dev_err(dev, "Failed to register sys_off_handler %pe\n", + ERR_PTR(ret)); + goto out; + } + } + dev_info(dev, "ABI: %d.%d (firmware rev 0x%04x '%s')\n", info->handle.version.abi_major, info->handle.version.abi_minor, info->handle.version.firmware_revision, @@ -3955,7 +4044,13 @@ static int ti_sci_probe(struct platform_device *pdev) list_add_tail(&info->node, &ti_sci_list); mutex_unlock(&ti_sci_list_mutex); =20 - return of_platform_populate(dev->of_node, NULL, NULL, dev); + ret =3D of_platform_populate(dev->of_node, NULL, NULL, dev); + if (ret) { + dev_err(dev, "platform_populate failed %pe\n", ERR_PTR(ret)); + goto out; + } + return 0; + out: if (!IS_ERR(info->chan_tx)) mbox_free_channel(info->chan_tx); diff --git a/drivers/firmware/ti_sci.h b/drivers/firmware/ti_sci.h index 701c416b2e78f8ef20ce6741a88ffa6fd4853b2d..09eaea54dd5cabce72dd1652c96= 03e3ab446b60c 100644 --- a/drivers/firmware/ti_sci.h +++ b/drivers/firmware/ti_sci.h @@ -595,6 +595,11 @@ struct ti_sci_msg_resp_get_clock_freq { struct ti_sci_msg_req_prepare_sleep { struct ti_sci_msg_hdr hdr; =20 +/* + * When sending prepare_sleep with MODE_PARTIAL_IO no response will be sen= t, + * no further steps are required. + */ +#define TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO 0x03 #define TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED 0xfd u8 mode; u32 ctx_lo; --=20 2.51.0 From nobody Wed Dec 17 14:13:43 2025 Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1E0D30CDB1 for ; Mon, 3 Nov 2025 12:42:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762173769; cv=none; b=sFJAuWW8az6jKeelzVzsBdQALPNQ4R7Vk3OCu1I6qCE83uOhCDJxgmUluJamEOqzi/Dy9Z40e1vmUGXod9N76osljl9neP0PYaYdqTI5hk6brmIcwJZsDlMEX4CN2x3cEfeM8aL4TyJPFHNb9qSfKAlK6k345Lx57/cziJ6r8K0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762173769; c=relaxed/simple; bh=9WWZRj95x1PsEyZywEyr4mp9AG5VR4rGO6uiOLlvg2k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=J/J9wnZ0XN3mmihkky1430ifwV/pn31x6tn+3gXLwZCuvOjJo5logPCURfL4GA5LdM3YCevTl8Z8i/K6yg7zAdvq8e4c2zJcGMgpWIkiUuX+67rFP2ZBslt6iVHUUx6ffWS90cRodNIFoOU2+T5HtxNIXc9isl97M6q4Z3KL3os= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=W0vtjdpc; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="W0vtjdpc" Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-6399328ff1fso7438246a12.0 for ; Mon, 03 Nov 2025 04:42:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1762173765; x=1762778565; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=PPrnykW9RcTv8SXmC4oIff7zEg9zUe3KhDF23k6GnlE=; b=W0vtjdpcAFoqNDwPO/neNXFiGxgBqSgDMHoH7+WMYDE9PuL1R+LzQNdTz/L/gfMaNv us8cojP/zowHd/QbzLQIxV0tAu0ol5LhLmDzLwPRnhZ4Yoe9Qf94yy80Om1E5GKWVabz 6G2YxswccxGUdC1kC5fIaQgNPYK0fCPQXUApjhuIMi2VuQ3ZVhRWSFh6+p3yv+Tb+xdi s+MbEOb8J/sCdrwsn4rkUOQAuY8CBwvQF85Wa4l4E0z06+sQ29a8F85OwkClPKHUTUAU iQRAI6E3tbj47TabMlVHLWu+w1mJYqH8lKQaCwmfnJIwHAOHuJCrQHbuTdFuDO3MnUn2 YynA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762173765; x=1762778565; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PPrnykW9RcTv8SXmC4oIff7zEg9zUe3KhDF23k6GnlE=; b=K3ZTEKFxt07DFV4vdNz3Zx/ykq5tk6vJxYuG/KFJGx+jMYFkhKBOd45vFTaOe95bkP WM30234LzuxBgolvjZDVpd3eI+70KS5VmfKduq/IJQHrqtRRFK3Q3QlAiv5xisktydaj tJ6cbEmDgdZznIikIBcvlQMIk+ztIqadMfBoZZDENPykAHq+YbXxUxcjFaeOYpIpKz7d eBSsygrPLsPcSNd+rg/cRIkfgnGB9H3zncV21sm5mq9x0OenipRwVMYObxF3MDKIfjSM dXTAAEsysRlB5z0euC2FPKA3J9VW8H8Cj1O8SWrYr0ZLb4NnI4LP9QLy4e6MhD+921pp TGzw== X-Forwarded-Encrypted: i=1; AJvYcCVQLMAWWW71QTr6b67/NNkFUxYa44UMbeQMrEnfvRGO8JgF8EAPU71pfwTXVRtemvNswHuy/U2Tc/D8Qpw=@vger.kernel.org X-Gm-Message-State: AOJu0YxnhNfnt2BIRjIwP7xUQZlwQ1RC5psRl4UlKL7BBrS9kINAt7nx lkP4t65+lJP1oKfobIwKYq65GRXcLUJdElJQjB4pCEvIWgbdH79+yWnpKp9zCydvwus= X-Gm-Gg: ASbGncvbaNyV6CAqYESGZXkAKsLqdSzcK6RSYN8Nycla363WD4lPECBd4PnqzoCR0J9 +jdnGXeoILxJXqS5t9Aax8RyrcQmkBCBUHoa+VkQVyLZgHRi7JKIPQD2pTB2jlGJ0ha9179u+6d J5DOzMNgX7tYU5LCfzpFm0mxOXRvFZJs9HrJX3djbvWYcyx1sczoSiliDCboDtt1brvVa8AE2EI uQQiu5qi/OCeg+ewjC5J5XHYiZMdzR5zSoWd8nN9dJgOooeI91Y9z2XF0WJv+c/84CGhvjRehVB m3DbOGL2dGoWTQgaHF+c/nHzkuSf09x+dKaVt/iLRXc9knyquXsS8RiKh+4F2egDB1dBKnwa7Kf OkjL6NRY2XP9c3LwCecEp2/flxdciefCN/NbPppVWFeXLXy4a4a+2k2ckIDZOcK4RG5Oc8QQ= X-Google-Smtp-Source: AGHT+IEt2sGyB8OGmSAirfMXRL4rXymXxxnigXWQMbloi64CMl+rBW5jNMGAdVjLMSOzt2Z2+JBIlg== X-Received: by 2002:a17:907:60cd:b0:b3b:110c:d343 with SMTP id a640c23a62f3a-b70701061c7mr1219796166b.8.1762173765217; Mon, 03 Nov 2025 04:42:45 -0800 (PST) Received: from localhost ([2001:4090:a247:830a:fe22:a8:f29a:a5c3]) by smtp.gmail.com with UTF8SMTPSA id a640c23a62f3a-b70bd65ca39sm348853066b.26.2025.11.03.04.42.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 04:42:44 -0800 (PST) From: "Markus Schneider-Pargmann (TI.com)" Date: Mon, 03 Nov 2025 13:42:21 +0100 Subject: [PATCH v10 3/3] firmware: ti_sci: Remove constant 0 function arguments Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251103-topic-am62-partialio-v6-12-b4-v10-3-0557e858d747@baylibre.com> References: <20251103-topic-am62-partialio-v6-12-b4-v10-0-0557e858d747@baylibre.com> In-Reply-To: <20251103-topic-am62-partialio-v6-12-b4-v10-0-0557e858d747@baylibre.com> To: Nishanth Menon , Tero Kristo , Santosh Shilimkar Cc: Vishal Mahaveer , Kevin Hilman , Dhruva Gole , Sebin Francis , Kendall Willis , Akashdeep Kaur , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "Markus Schneider-Pargmann (TI.com)" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2722; i=msp@baylibre.com; h=from:subject:message-id; bh=9WWZRj95x1PsEyZywEyr4mp9AG5VR4rGO6uiOLlvg2k=; b=owGbwMvMwCXWejAsc4KoVzDjabUkhkyOxdZ7NE5/fPheUGmV3Z/0nr0a4lOcNDdtrst6dE+iI 5rzgu6ljlIWBjEuBlkxRZbOxNC0//I7jyUvWrYZZg4rE8gQBi5OAZjIMz2G/+lzd76tzC2pOXVi 14eD3gfTM6epTn4ZKz5hxcdT513ypIIZ/tfuLI4p25z+VE9ng/P5tUrJc1ZvqXbXUq8I0eOXn1B mxAAA X-Developer-Key: i=msp@baylibre.com; a=openpgp; fpr=BADD88DB889FDC3E8A3D5FE612FA6A01E0A45B41 ti_sci_cmd_prepare_sleep takes three arguments ctx_lo, ctx_hi and debug_flags which are always 0 for the caller. Remove these arguments as they are basically unused. Signed-off-by: Markus Schneider-Pargmann (TI.com) Reviewed-by: Kendall Willis Reviewed-by: Sebin Francis --- drivers/firmware/ti_sci.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 811507ded63ac784ad6c6ad77b2f827768f3f3c7..023c603ae58cb5df176c66eec42= 9bd0b4037b798 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -1664,14 +1664,10 @@ static int ti_sci_cmd_clk_get_freq(const struct ti_= sci_handle *handle, * ti_sci_cmd_prepare_sleep() - Prepare system for system suspend * @handle: pointer to TI SCI handle * @mode: Device identifier - * @ctx_lo: Low part of address for context save - * @ctx_hi: High part of address for context save - * @debug_flags: Debug flags to pass to firmware * * Return: 0 if all went well, else returns appropriate error value. */ -static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8= mode, - u32 ctx_lo, u32 ctx_hi, u32 debug_flags) +static int ti_sci_cmd_prepare_sleep(const struct ti_sci_handle *handle, u8= mode) { u32 msg_flags =3D mode =3D=3D TISCI_MSG_VALUE_SLEEP_MODE_PARTIAL_IO ? TI_SCI_FLAG_REQ_GENERIC_NORESPONSE : @@ -1702,9 +1698,9 @@ static int ti_sci_cmd_prepare_sleep(const struct ti_s= ci_handle *handle, u8 mode, =20 req =3D (struct ti_sci_msg_req_prepare_sleep *)xfer->xfer_buf; req->mode =3D mode; - req->ctx_lo =3D ctx_lo; - req->ctx_hi =3D ctx_hi; - req->debug_flags =3D debug_flags; + req->ctx_lo =3D 0; + req->ctx_hi =3D 0; + req->debug_flags =3D 0; =20 ret =3D ti_sci_do_xfer(info, xfer); if (ret) { @@ -3729,7 +3725,7 @@ static int ti_sci_sys_off_handler(struct sys_off_data= *data) =20 dev_info(info->dev, "Entering Partial-IO because a powered wakeup-enabled= device was found.\n"); =20 - ret =3D ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTI= AL_IO, 0, 0, 0); + ret =3D ti_sci_cmd_prepare_sleep(handle, TISCI_MSG_VALUE_SLEEP_MODE_PARTI= AL_IO); if (ret) { dev_err(info->dev, "Failed to enter Partial-IO %pe, trying to do an emergency restart\n", @@ -3768,8 +3764,7 @@ static int ti_sci_prepare_system_suspend(struct ti_sc= i_info *info) * internal use and can be 0 */ return ti_sci_cmd_prepare_sleep(&info->handle, - TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED, - 0, 0, 0); + TISCI_MSG_VALUE_SLEEP_MODE_DM_MANAGED); } else { /* DM Managed is not supported by the firmware. */ dev_err(info->dev, "Suspend to memory is not supported by the firmware\= n"); --=20 2.51.0