From nobody Fri Oct 31 04:13:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1749204736; cv=none; d=zohomail.com; s=zohoarc; b=LpjnaK5wShSq4Jmzf404j8xiUg2TOCTFw4vvn1Lm8E/HvWw1DjD6hoQrwn/FylZ+KopTZUyEVSuhiUkxQfIHyeBTJe8ZeO2D/xw3G64OYQnAxQXOAMk9tzR61vo4n5HiDjdkFhQdZWtDHJz9BFoWZiJODJnaVbnoZoVIYPgCdYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749204736; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=7hPQ4VxBdVLnFqUBMXQnHxRKZBnEmnRXk//zaua6W64=; b=fZkzXFby20nxNR42S90Extjs34WgYjUcuA0Kr2HbxBYv9MK1AxqH6oPNPZWdJKizIQJxklsCoUnZLhZfwjZop4u6zgRFqx2ztwacx6ylw+0637yGBhyyUh9dYcBShaALBQAdcWIVXNz7JlIg8fbtKBJSSxLcYF1Q6PUUi2W6YFU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1749204736790829.1689016098442; Fri, 6 Jun 2025 03:12:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1008361.1387655 (Exim 4.92) (envelope-from ) id 1uNU3D-0005il-Nh; Fri, 06 Jun 2025 10:11:51 +0000 Received: by outflank-mailman (output) from mailman id 1008361.1387655; Fri, 06 Jun 2025 10:11:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uNU3D-0005iC-IT; Fri, 06 Jun 2025 10:11:51 +0000 Received: by outflank-mailman (input) for mailman id 1008361; Fri, 06 Jun 2025 10:11:49 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uNU3B-0005Rs-KU for xen-devel@lists.xenproject.org; Fri, 06 Jun 2025 10:11:49 +0000 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [2a00:1450:4864:20::236]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a7f2526a-42be-11f0-b894-0df219b8e170; Fri, 06 Jun 2025 12:11:47 +0200 (CEST) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-32ac52f78c1so20381081fa.3 for ; Fri, 06 Jun 2025 03:11:47 -0700 (PDT) Received: from yp-VivoBook-ASUSLaptop-M1503QA-M1503QA.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553677389d5sm143592e87.259.2025.06.06.03.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jun 2025 03:11:46 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a7f2526a-42be-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749204707; x=1749809507; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7hPQ4VxBdVLnFqUBMXQnHxRKZBnEmnRXk//zaua6W64=; b=G2rmIWx4KAYDgvDdM626qRTYuIsOZJIiY9y6odYDCBRI1emvvtPv49LxKuanablqjk wYjbIAvigMtjNheuq2KMbhFfiDWfsR49Z4HB+i2LzBCtIC4pW5dog+mu08gKax8zsEoX ReYz1PwqZ2sW3Y3XGokyjMCAOFV6iqPmee5ZINIGgIf0mE2/uIz4081aaLjiJ/3lcpw0 xr94sbtGUKyQbf6OYZhRulBOQ9Y606W6u8VR392ZMxFEGednYSUzJVtwI0W8TAbYMkNX lWl4nmMcENvUu1n4Yf9ssbKV7Tt7moFYigFEWvVpgsLInw1Ivst1RrMUPSNUXD9I3Oq+ CHWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749204707; x=1749809507; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7hPQ4VxBdVLnFqUBMXQnHxRKZBnEmnRXk//zaua6W64=; b=JvXBGoCtamkGRMmiCAVE3TSFOAZd3i+PQLkf7NBBAG8imFgl4GdYIgZg9u8aVmRmy6 woTjsqIRv4MWLmJ//3GpFQsp3J1sVDzAYc1nWC2VSO/WTjS+m+m4TGRPhx/gS264aHOy hclN/HDO8awPTs8cGlqvoiybc+bH9BGa/S9xAo8rkdfA8LANY5TCa2L0rUNaXNi723Zx T6HtbiUz0vhPDTNl1bPlVe9EaWBS0d8LJAWdZKTxZDodiX8QSSs3wiZjJMDdAWWUAio0 hSxpFKdgBVbJSGzfzbbXgHfu3x5+LAC5OXgF4YCe7nlHAVUk+9wZs5q0f5NipxeeVt95 JjIA== X-Gm-Message-State: AOJu0YxtIzpxspIT4cPdROwMd7K8g0MtUjSj1hNa5D6NAZFfCPJw6jMp dEstY2xhGeBTkHxE6YF3LX3zeKChK76PpDz6QgkblWTopvVbGQ8lp6qy33bndNMF X-Gm-Gg: ASbGnctR/7dIh3dQRnjUvlpXjMa7KbCBp1GAxdn3nc3GVQVN5cvt3odw7g1yCYD39r1 ZYiB4DccrLy8uLlSWdyRBrmAVucqGHgBqad2NihducWgUiJrtYHs0FrOLQIwqf1eh3RMyNPDi1G iBPcOLduQihqyQpHPA1meX/djqcYJtVk6aqZWXF0y6T4a5MXJz9J0wOuZ2LGZoGxwxuhsafcNbj Wm2fIMgExwPQJI468eI9JkIzzG33qkKYRjYB+3tawoY/pOZkHNzONa6f7G3HrfwuiWw3ZjnAsQ5 Olm77dw5y8O+7npg0Xzc4xZ1UrHLV1gfcQ/sxyjH2b8fVXLKQk4kQXFJWkYwq+WNvIMs+rryL0g /yiZJmlViA0Saund+UNvPrW/ENg== X-Google-Smtp-Source: AGHT+IHcPVMXpXDFxKZ1ggDEsOO/oqjCw4oEwbGk6ItH8L5RwFF1woqnv9iCGDdBGtqaQdLse2gqFg== X-Received: by 2002:a05:6512:ba7:b0:553:27cb:b84e with SMTP id 2adb3069b0e04-55366c2ff7amr779327e87.41.1749204706738; Fri, 06 Jun 2025 03:11:46 -0700 (PDT) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Mykyta Poturai , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , Julien Grall , Stefano Stabellini , Mykola Kvach Subject: [PATCH v3 1/2] xen: Introduce system suspend config option Date: Fri, 6 Jun 2025 13:11:41 +0300 Message-ID: <412d2b68741182fe0528cb85c0af2a29a2ebec3a.1749204282.git.mykola_kvach@epam.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1749204739159116600 Content-Type: text/plain; charset="utf-8" From: Mykyta Poturai This option enables the system suspend support. This is the mechanism that allows the system to be suspended to RAM and later resumed. The patch introduces three options: - HAS_SYSTEM_SUSPEND: indicates suspend support is available on the platfor= m. - SYSTEM_SUSPEND_ALWAYS_ON: used for architectures where suspend must always be enabled. - SYSTEM_SUSPEND: user-facing option to enable/disable suspend if supported. Defaults to enabled if SYSTEM_SUSPEND_ALWAYS_ON is set and depends on HAS_SYSTEM_SUSPEND. On x86, both HAS_SYSTEM_SUSPEND and SYSTEM_SUSPEND_ALWAYS_ON are selected by default, making suspend support always enabled. The options are designed to be easily extensible to other architectures (e.g., PPC, RISC-V) as future support is added. Signed-off-by: Mykyta Poturai Signed-off-by: Mykola Kvach Acked-by: Jan Beulich --- Changes introduced in v3: - select HAS_SYSTEM_SUSPEND from SYSTEM_SUSPEND_ALWAYS_ON - drop selecting HAS_SYSTEM_SUSPEND from X86 - simplify default setting in SYSTEM_SUSPEND - hide prompt of SYSTEM_SUSPEND when SYSTEM_SUSPEND_ALWAYS_ON is enabled - move HAS_SYSTEM_SUSPEND alongside other HAS_* configs Discussion on adding the SYSTEM_SUSPEND config can be found here: https://lists.xenproject.org/archives/html/xen-devel/2025-03/msg00169.html --- xen/arch/x86/Kconfig | 1 + xen/common/Kconfig | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 7afe879710..752d5141bb 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -33,6 +33,7 @@ config X86 select HAS_VMAP select HAS_VPCI if HVM select NEEDS_LIBELF + select SYSTEM_SUSPEND_ALWAYS_ON =20 config ARCH_DEFCONFIG string diff --git a/xen/common/Kconfig b/xen/common/Kconfig index eece1370a3..867710134a 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -122,6 +122,9 @@ config HAS_SCHED_GRANULARITY config HAS_STACK_PROTECTOR bool =20 +config HAS_SYSTEM_SUSPEND + bool + config HAS_UBSAN bool =20 @@ -593,4 +596,19 @@ config BUDDY_ALLOCATOR_SIZE Amount of memory reserved for the buddy allocator to serve Xen heap, working alongside the colored one. =20 +config SYSTEM_SUSPEND_ALWAYS_ON + bool + select HAS_SYSTEM_SUSPEND + +config SYSTEM_SUSPEND + bool "System suspend support" if !SYSTEM_SUSPEND_ALWAYS_ON + depends on HAS_SYSTEM_SUSPEND + default SYSTEM_SUSPEND_ALWAYS_ON + help + This option enables the system suspend support. This is the + mechanism that allows the system to be suspended to RAM and + later resumed. + + If unsure, say N. + endmenu --=20 2.48.1 From nobody Fri Oct 31 04:13:25 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1749204731; cv=none; d=zohomail.com; s=zohoarc; b=GpO/oG4HsiIWtXqnIMggP9p3tI3CvUlWTL6cSwpwJNdSXM+EIFxsuw3ozJ3XACaE3Vrpgj5c2rFhx2npkXyyIs4qlrxYk6RZTQVyyatKoYpoyeTV0BeYd8/zW1evq4A0711DBj1AcFoexRa4JqeG0DtYNIsUauKlwyQQTpU4AE0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749204731; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=9dWxP7Icxj1+b68Zu3OZEwOOJEHkIKPApD7TkfsOeh4=; b=iBtw7ovKUkUd8m0OEmyaxk6fVMz7X1zwGcudv1lZ0H02WkrIQK3TWzqmzCIODgqjQwm3d/yXeINqEgzbVbq2ySz6dybOU5bvEyyuWW5CvKFadLuCFI/DUTq7UuJKeOMKuZQs5inbOsGIXSeYyQVuqOspMEQ7PUcbfw/2VNiIQCE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1749204731793668.3392161978213; Fri, 6 Jun 2025 03:12:11 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1008360.1387650 (Exim 4.92) (envelope-from ) id 1uNU3D-0005g9-ED; Fri, 06 Jun 2025 10:11:51 +0000 Received: by outflank-mailman (output) from mailman id 1008360.1387650; Fri, 06 Jun 2025 10:11:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uNU3D-0005fy-BN; Fri, 06 Jun 2025 10:11:51 +0000 Received: by outflank-mailman (input) for mailman id 1008360; Fri, 06 Jun 2025 10:11:49 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uNU3B-0005Rm-Hk for xen-devel@lists.xenproject.org; Fri, 06 Jun 2025 10:11:49 +0000 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [2a00:1450:4864:20::12c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a8aeaa0b-42be-11f0-a301-13f23c93f187; Fri, 06 Jun 2025 12:11:49 +0200 (CEST) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-55365c63fa5so946653e87.1 for ; Fri, 06 Jun 2025 03:11:49 -0700 (PDT) Received: from yp-VivoBook-ASUSLaptop-M1503QA-M1503QA.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-553677389d5sm143592e87.259.2025.06.06.03.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Jun 2025 03:11:47 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a8aeaa0b-42be-11f0-a301-13f23c93f187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749204708; x=1749809508; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9dWxP7Icxj1+b68Zu3OZEwOOJEHkIKPApD7TkfsOeh4=; b=NWnFApOn6agP8AoJCRiexbt3oZuRnUVeB0Yv9rRmn/uFgZscNdmpOt3CCygmVV7bev 5g3co1JWI963iab/o8ZmjQ//TQZvshu5chxTKLJ0LdLpsBiopLI1uMpkUT8+txw2KB7Q 6mr9FlerLBxVIKfrZWB49P88lEiZDadfVAgMwqy9M1Uf7/9son1ACSqH+xcpO3EGozUc 1cLcvUtFejT5cPJ7278QzKaoiEa0MeSesffI3jEd3Gnl19X5/vCba0RViHKTT17qFhmB H0ZEHs8bfqpWWxTVgUOYxTmhoIxWSKtIaRwP579BC8ZVzNjLCBi8JrOBGMBXUbRmCYKJ 9i1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749204708; x=1749809508; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9dWxP7Icxj1+b68Zu3OZEwOOJEHkIKPApD7TkfsOeh4=; b=Eeor0SkvFT8+bxN4gc7S8Bi58RVzYbFB7yLuyL8+voPWmA1xyI+0LYIYX9fTqJtqQ5 CkpwxfXhmUGg2VF7HHrL4W3CXJ1m6RawaDeW2/xnyQx1roydBIszZaLNteU+E+xAkbwO dS2ILkr3kOyvAAQQykfqFlR5d8JWI/YLdYym7pOcPpD546kY+GwQcxQQrkHVSn8z1Hr2 oP9wkPxyfGn4OAD0sl0gh1ORq/LZ7vvfFYUvPVWe7yes/7bEZ5OnDJoWQneM8NXUKOXB fL+bMWlojS0jsrvEyTBO7xvyueDh7CasunG50xIKtxhwl29wno8yXOz+S/+TMlY8ngTZ 7gUA== X-Gm-Message-State: AOJu0YzYGNrZutouLcWVMa01nkIbF0qHg7ycEc2bPh8dgO6ac3ucuEw/ N/YRbVcTpkjaPH1HCJgo79MJk1ILduuEIPRyrWwb/yQLJNv7VEizKLg4hJrv7VKJ X-Gm-Gg: ASbGncsX+62RGZ+NdUY/GYfs1vyp7ETgLG2T5uJQlM2Wpz7tyzVuGnqTIjnQ2oshNUL i49lZKG1Us4zLm9PF1pa1y+I0eAr9pJpDNBS6jwZpm0n3Jh1tDXlTIDxwO/u2ScuguYr6Cea54Y Xknt1Q/WpIXHnpaP6F+WDQ06tIoU+2F16VZ72OyEDWS7ODd/+MZMtQyczwz0ugyhnq+H5oFKsNh KcmKhYCK51DYg68tealsMpokVF++xhfGKUE5DJb5Yp+XfFN81yViMgmZJm2VmpvLLcaYlhOdo0f qRfgGWBO/+ye9ozBXycF7veKs16+VINXqpsqOSu9WUIZEvQZ9txeEGkosGTsxb0HXlFgyuRhWM7 WQ5t5fPdgAd8nWUsA9bFIqKzMwQ== X-Google-Smtp-Source: AGHT+IFtTWG82lj9kW60Ux7/zGpH+k9xbSgOEp6QEHnyKcsn4vfhrvxUPy+hETCT0HhwTVgiuuYEFw== X-Received: by 2002:a05:6512:2345:b0:553:2dce:3abc with SMTP id 2adb3069b0e04-55366c38984mr725671e87.50.1749204707935; Fri, 06 Jun 2025 03:11:47 -0700 (PDT) From: Mykola Kvach To: xen-devel@lists.xenproject.org Cc: Volodymyr Babchuk , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk , Oleksandr Andrushchenko , Mykola Kvach Subject: [PATCH v3 2/2] xen/char: implement suspend/resume calls for SCIF driver Date: Fri, 6 Jun 2025 13:11:42 +0300 Message-ID: <3be3369910ec5159eab3cb26155da645dd1df83b.1749204282.git.mykola_kvach@epam.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1749204733003116600 Content-Type: text/plain; charset="utf-8" From: Volodymyr Babchuk The changes have been tested only on the Renesas R-Car H3 Starter Kit board. Signed-off-by: Volodymyr Babchuk Signed-off-by: Oleksandr Andrushchenko Signed-off-by: Mykola Kvach --- In patch v2, I just added a CONFIG_SYSTEM_SUSPEND check around the suspend/resume functions in the SCIF driver. --- xen/drivers/char/scif-uart.c | 40 ++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/xen/drivers/char/scif-uart.c b/xen/drivers/char/scif-uart.c index 757793ca45..888821a3b8 100644 --- a/xen/drivers/char/scif-uart.c +++ b/xen/drivers/char/scif-uart.c @@ -139,9 +139,8 @@ static void scif_uart_interrupt(int irq, void *data) } } =20 -static void __init scif_uart_init_preirq(struct serial_port *port) +static void scif_uart_disable(struct scif_uart *uart) { - struct scif_uart *uart =3D port->uart; const struct port_params *params =3D uart->params; =20 /* @@ -155,6 +154,14 @@ static void __init scif_uart_init_preirq(struct serial= _port *port) =20 /* Reset TX/RX FIFOs */ scif_writew(uart, SCIF_SCFCR, SCFCR_RFRST | SCFCR_TFRST); +} + +static void scif_uart_init_preirq(struct serial_port *port) +{ + struct scif_uart *uart =3D port->uart; + const struct port_params *params =3D uart->params; + + scif_uart_disable(uart); =20 /* Clear all errors and flags */ scif_readw(uart, params->status_reg); @@ -271,6 +278,31 @@ static void scif_uart_stop_tx(struct serial_port *port) scif_writew(uart, SCIF_SCSCR, scif_readw(uart, SCIF_SCSCR) & ~SCSCR_TI= E); } =20 +#ifdef CONFIG_SYSTEM_SUSPEND + +static void scif_uart_suspend(struct serial_port *port) +{ + struct scif_uart *uart =3D port->uart; + + scif_uart_stop_tx(port); + scif_uart_disable(uart); +} + +static void scif_uart_resume(struct serial_port *port) +{ + struct scif_uart *uart =3D port->uart; + const struct port_params *params =3D uart->params; + uint16_t ctrl; + + scif_uart_init_preirq(port); + + /* Enable TX/RX and Error Interrupts */ + ctrl =3D scif_readw(uart, SCIF_SCSCR); + scif_writew(uart, SCIF_SCSCR, ctrl | params->irq_flags); +} + +#endif /* CONFIG_SYSTEM_SUSPEND */ + static struct uart_driver __read_mostly scif_uart_driver =3D { .init_preirq =3D scif_uart_init_preirq, .init_postirq =3D scif_uart_init_postirq, @@ -281,6 +313,10 @@ static struct uart_driver __read_mostly scif_uart_driv= er =3D { .start_tx =3D scif_uart_start_tx, .stop_tx =3D scif_uart_stop_tx, .vuart_info =3D scif_vuart_info, +#ifdef CONFIG_SYSTEM_SUSPEND + .suspend =3D scif_uart_suspend, + .resume =3D scif_uart_resume, +#endif }; =20 static const struct dt_device_match scif_uart_dt_match[] __initconst =3D --=20 2.48.1