From nobody Tue Feb 10 11:41:23 2026 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=1748419593; cv=none; d=zohomail.com; s=zohoarc; b=nPVbLg/n9UrF+AGGpsgwrgOihrImNq/xrgHrGafMKmVDe4HdweCRpFqopDvy5F8gP/i3rVhw80Hgv7STXWcbjfby3ilCvPGkc2zeWIP6jEaadhCNMknmm1h2DuNUhgRxOhOK3C4R0gjA9JH1MKjMvMbQU27uwDBEEUurx6/nHjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1748419593; 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=XIX1UhUKMMwUB0iNjuiBdoWECTVnrPsi+Xhcq60yacoy7c9F/TFPw9PVnUDg2D4/sKPwiksp2C4DPsClnr621XyJcxASuDFEpqFfdNkJXZQE2uOzueMXgM89KEcRsR2phx2hgJgvZ+mH0LXSIouSR5GjkGEABL4pHQsQJGYAuSw= 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 1748419593383743.0642332868056; Wed, 28 May 2025 01:06:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.998972.1379652 (Exim 4.92) (envelope-from ) id 1uKBnb-0003TA-B6; Wed, 28 May 2025 08:06:07 +0000 Received: by outflank-mailman (output) from mailman id 998972.1379652; Wed, 28 May 2025 08:06:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uKBnb-0003T3-7j; Wed, 28 May 2025 08:06:07 +0000 Received: by outflank-mailman (input) for mailman id 998972; Wed, 28 May 2025 08:06:05 +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 1uKBnZ-0003Ro-P5 for xen-devel@lists.xenproject.org; Wed, 28 May 2025 08:06:05 +0000 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [2a00:1450:4864:20::12b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 99029b4a-3b9a-11f0-b894-0df219b8e170; Wed, 28 May 2025 10:06:02 +0200 (CEST) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-54afb5fcebaso5384115e87.3 for ; Wed, 28 May 2025 01:06:02 -0700 (PDT) Received: from yp-VivoBook-ASUSLaptop-M1503QA-M1503QA.. ([95.67.15.120]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-32a79f5478asm1437671fa.78.2025.05.28.01.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 May 2025 01:06:00 -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: 99029b4a-3b9a-11f0-b894-0df219b8e170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748419561; x=1749024361; 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=JdpB73NzhO1Fnvap+aqJxwPlKOJWRow+OKWmBPv5vdxdoTBrPP86Briiekq8RNwyy5 /XD8rif+RfkfVv1Bcn4hzmWSmvpmZtlgquFQDpmujOLCdRUDYqKbnw9bBOsBx7oxEAPI e19dM0q8kdO03D6TDFiKDPGvy94gBESMPrYtdZWYGN5TaVbFnZa2FMVSnynRqfCkJUsQ xbltNFIzF20jjDrSDmEuFdWzoyjo0LDL1fMdOZXnciLOAAGPy5HWu75C2+d/XpoNSN2w jgBp20Ga2TNBjxb7SS7Pw17ZIUJPatBFHRjG5jxiWvaN782CG4yMqRtdgtOcLc1/yhcp CC0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748419561; x=1749024361; 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=s/wlnxmQdicrJ39MkELnSpHZ4AolkBTULc2jqoXODomyXDpNneiNzp+nFwwI/qbxIU teERRwlPlaR8qMUvsYwjzORdiplqFPo1IoE9Mj5k4cphYVeA0aCNkHtM1KlsX6qSOtWY FGgXTDgEqDtV/d3sWuSWcXJauq/6TJWJbX4+Hzi+OHEqsvvSJjzpkQXFj8BT6CEaoK3o L/r8aaO2/AuwK5fN4nd7axC94S5dm4jywJfUzhF9GMlwkBpGYgXzyqLhd1oP8mngdFpA sFKHxTUjK9S02GGDvl1AxG6e6ikRLdG0vdYGKGpPTJvtiQppDO80Fley89s23pfoy/6a QvuQ== X-Gm-Message-State: AOJu0YzGmUItspWTThY0Z0UJG52bwmWxvmHGHPFfe+Ee5WljgwPc4gWv xq16P7diKA/8nxoLQ1n3S1mEC14ihVSRltZ7jagnk/DxuyQ11tEn2qu84oEfHw== X-Gm-Gg: ASbGncsSGM2/51Ucyy2ry52kfAGPNRPHbsFWw1JJEZTEVza5z3laX9MVwJnYiujuyEX WA/fkNwMeXbCYo+ufNZqy4RObjZ4SHf95KqSCedHdtbqNChcvtbcrGD3ywfKtqOuXsJHhuSJ/ay wkBN/fe3FDFPas/+9yT9SpgG8etnNEX3/ZMfEdQpUqwYN56GOTENrKc7wHrCvR+JcVwChFofvR4 lSAzBUZbbdWg19DjaKIm1nwBuKeA+A3EHt11mAI7taRQoNpuycTK2TyDCBEMtrIos/WICYdUlHK 9qz/Tiypw8/P3egtlz/Oy8msNW/jHqxmI8WVsGHGIU3LpNsXtF4fH4bkDvPoQ5OWmPE6nM07PEK JrjlXq1wHfwvnTG4= X-Google-Smtp-Source: AGHT+IG6u5YLRxmcByItaH8PWCNYHSyVYF7Eh3p2pFq0FQVKsPfgi80VcoNfxaXymwzalNg0N635lw== X-Received: by 2002:a05:6512:3055:b0:553:2fb1:cfe9 with SMTP id 2adb3069b0e04-5532fb1e6aemr286965e87.21.1748419561240; Wed, 28 May 2025 01:06:01 -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 v2 2/2] xen/char: implement suspend/resume calls for SCIF driver Date: Wed, 28 May 2025 11:05:19 +0300 Message-ID: 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: 1748419595136116600 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