From patchwork Fri Jul 2 12:45:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500057 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.a=rsa-sha256 header.s=selector1 header.b=mgeuQfok; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZYz6vncz9sT6 for ; Fri, 2 Jul 2021 22:45:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3F40081ED0; Fri, 2 Jul 2021 14:45:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=prevas.dk header.i=@prevas.dk header.b="mgeuQfok"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DD7C482959; Fri, 2 Jul 2021 14:45:22 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER, SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on20718.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::718]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 722CB80C70 for ; Fri, 2 Jul 2021 14:45:19 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=prevas.dk Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rasmus.villemoes@prevas.dk ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OhdXEpnGdFUS0ok5MyBpJt9wJ/IEAlqIaNqR59YzO1VHQqbQGhNWdlEgFvyhaMjXUCN3hq0eNtDTpko5Ace6fwXqs5rg8W0D0DJABFXbuVFBDUxipN78UFr0CpEQHBt57mIn2qMEB4riWuOjFDd6jn4sU02dDGhvHwbqB4nlmhPuIxQ91Uz+6em69GDtrxvvWkW8z3shHnm3cW59qjk6z6Pp7T5J6nlgl+D4NLskLnF+yZUxX2J8NtGet8E0s7enyXi6lvNtvPoOA6+8p4kcbfQK1ugKyPNxIh5pmwohDXCS99nNCVa6uCZ6UeIEpUBVl8MWmY9Al0SEvIY0hgTByg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fXnfdsDpXRrq2gmk7PcbPCWhapyaonC9m6ivhMW5cTY=; b=ENxKc3sJkIR4gEdXL5N0eDESvZ/hBe0kYnRAHP9K3qEqyYGHz5SQdLLw5//JC6JlLNlAN7FC0oIgQ6Jj03Yf3D+HsyplCDiLrznApug1Qewti8sAX1LtbgJGMhK87E+g4Mg1Lhcdhe6baNMK68jIVam0MTvKgi1W/tQGeIQ/AYgNNLdK6bR25yvMGpv7Ez1uVDZdQ9YWu4VxFRt1YLBxnNNF3gwfMnt5eKzXaWl+IJL7tjmQuvExhdtzDNUX+x65iimwn7NcJ0sj7Ik7P0mqvYvvGG20OT39XdiUVjKIFiYXaznmJv9SrP48lrb9Eej2WERH1w9L/XHj6lN/oYE3ZQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=prevas.dk; dmarc=pass action=none header.from=prevas.dk; dkim=pass header.d=prevas.dk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=prevas.dk; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fXnfdsDpXRrq2gmk7PcbPCWhapyaonC9m6ivhMW5cTY=; b=mgeuQfokGzZqcu728vXNxo82/HL7JMID196ckFNa5m1CshoNeA4IpYjnosJ1IZHnEXo/B84GlghWSIP47sVoTpP2bLlPZ9YfvTaw7H2tC6/etDnGMbr+QFzyf1xrXf+8U+J2avbBwBIsfxg5uLVVx2uOpDpOpl05s0SaJgSu8S0= Authentication-Results: lists.denx.de; dkim=none (message not signed) header.d=none;lists.denx.de; dmarc=none action=none header.from=prevas.dk; Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) by AM9PR10MB3990.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:1cf::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22; Fri, 2 Jul 2021 12:45:18 +0000 Received: from AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::fc83:36a5:db02:3dbb]) by AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM ([fe80::fc83:36a5:db02:3dbb%7]) with mapi id 15.20.4287.029; Fri, 2 Jul 2021 12:45:18 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 00/10] handling all DM watchdogs in watchdog_reset() Date: Fri, 2 Jul 2021 14:45:00 +0200 Message-Id: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 X-Originating-IP: [80.208.64.110] X-ClientProxiedBy: AM4PR0501CA0065.eurprd05.prod.outlook.com (2603:10a6:200:68::33) To AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:3f::10) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from prevas-ravi.prevas.se (80.208.64.110) by AM4PR0501CA0065.eurprd05.prod.outlook.com (2603:10a6:200:68::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22 via Frontend Transport; Fri, 2 Jul 2021 12:45:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 99ffaa26-1e90-4f8b-d4a6-08d93d573f62 X-MS-TrafficTypeDiagnostic: AM9PR10MB3990: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VEOYGfaUtpVy4smyPz3HI0wrSXZoSzZE72H9Kr++97oTN28+dHL85M3PhuOMRtCXt++7kHC5rHO8uWf/FBShac9XCfq4zVu9kCR+D9WDU02kVzyxEquWhJXKhxyQu/mwNOod7sox/xAiKPWOb44DHFO0daIEGYvzezuKZcofOtmw+gn98iF1UWx22wqfeF4QjahRxGSYjLZabiDmgv88dGCTx+7uIh0sq+aKO/CC2ocCDpQVErxT1NfNhcHFOHMCXZdHe1ZFoeRoz+ZBTVG14wPWJ1qi9g4zEgNTEX+wnpHY/zP31vjkVTocfEsjbzl0ujniRYamyvNS/j3uE/M5LmvRJDCwernOsuCodgRNpvZ6xmsuo/emZk+dbkrbiXU4Y6y5UhK5iQaN1dTOu80lMI9vkDGPDVJF45rAd93DK9fwBWI1jZ7eXPwexlOC5l6NxEtniRkQC++B9tweiEqVkFsQdDSCv+b98mA/gp2xbqQrOGsWtQ8af4fxeT7+7DD0KG+YK/jLk4Jss4gKCcrLz8jqU8JmD5K1CLyWb5LXlwGlPqDp83pCGx07V8NcghEngdjbrB4oqJG+8saNW71lFJBG8zxPh14X7DZHP7vX64P2vypel0vqoI0KTqMS4A/Vo97Ap9fa9F2pHcwU3wdalTJrS8j4+herOnZIWzvrwMjEAqr0futsZ+2coDnlL0AvqM6KmmrzfKHEOrMiluqzn4wYqryAuQsxDzDo6E2ODczYLUteMwUqdYF8T4gbKVyGs0aDhdSSOjTUT620vn8xHOLTuC2k4IiP3AWpEv7HylaI9IW+R9XpXLOEypK142Oqju0+XFoMmphymi3zOlrwpw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(366004)(396003)(376002)(39850400004)(346002)(136003)(5660300002)(83380400001)(86362001)(8936002)(66946007)(6666004)(6506007)(66556008)(966005)(52116002)(6486002)(8976002)(8676002)(66476007)(6916009)(6512007)(186003)(38350700002)(54906003)(107886003)(16526019)(38100700002)(44832011)(36756003)(4326008)(316002)(26005)(2906002)(956004)(478600001)(1076003)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SV04PkL/j6CNQVR5W3OENXNr2Yx1cF+xGan5Kx57kpbqxpjSBm+QR0aV5CoIVIGD8i6V8kCt69JEIWIcSMCXGsDrG9ckxsgON/zDLZM6XqTNMUvvDSxAQJ2FJYTcmQKHoFmDYcPhQPZa/MqyWXX3QxeMLGLqy0PdoNid+yaiW9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xMIyvbyfs0tNP8rp8F1UEODsLtU90nB4k/XQidbBPzrlKbxq2kUmljMEiBwbk2AkqDWs7w9tN1s3UY0hnluD34SehuZ X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 99ffaa26-1e90-4f8b-d4a6-08d93d573f62 X-MS-Exchange-CrossTenant-AuthSource: AM0PR10MB1874.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2021 12:45:18.5595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d350cf71-778d-4780-88f5-071a4cb1ed61 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VNEa/i8Dd4MGnY5FByFhUQwH4yi8Es5Lmrci9OWc2CuNMTbyzt2Js3+CHXftM62wkdO6o/uADtfgYQMpFtp9Xahl1FFZ7sosPt6R3d/Q9Dg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR10MB3990 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean This series is an attempt at expanding the wdt-uclass provided watchdog_reset() to handle all DM watchdogs, not just the first one. As a sort of nice side effect, it turns out that doing that makes wdt-uclass fit better into the uclass model, in that we now do the work that was previously done in the ad hoc initr_watchdog for one device in .pre_probe and .post_probe hooks instead. It also includes a patch adding a driver for a gpio-petted watchdog device (and a sandbox test of that) - it is included here because that also gives a relatively easy way to have more than one (kind of) watchdog device in the sandbox, which is then used at the end to test that watchdog_reset() behaves as expected. v2 here: https://lore.kernel.org/u-boot/20210527220017.1266765-1-rasmus.villemoes@prevas.dk/ Changes in v3: - Rebase to master (b7ad721c83) - Add various R-b tags from Stefan and Simon - Add comments to members of struct wdt_priv in patches 2 and 5. - Change a newly introduced printf(), for failing uclass_get(), in patch 7 to log_debug (but keep existing printfs as-is, apart from the inclusion of device names). - Add another log_debug in patch 7 if device probing fails. - Add comment before uclass_foreach_dev() loop in watchdog_reset(), and furthermore include a device_active() check inside the loop. - Drop unneeded include in patch 8. - Use timer_test_add_offset() instead of mdelay() in patch 10. Rasmus Villemoes (10): watchdog: wdt-uclass.c: use wdt_start() in wdt_expire_now() watchdog: wdt-uclass.c: introduce struct wdt_priv watchdog: wdt-uclass.c: neaten UCLASS_DRIVER definition watchdog: wdt-uclass.c: refactor initr_watchdog() watchdog: wdt-uclass.c: keep track of each device's running state sandbox: disable CONFIG_WATCHDOG_AUTOSTART watchdog: wdt-uclass.c: handle all DM watchdogs in watchdog_reset() watchdog: add gpio watchdog driver sandbox: add test of wdt_gpio driver sandbox: add test of wdt-uclass' watchdog_reset() arch/sandbox/dts/test.dts | 8 + configs/sandbox64_defconfig | 2 + configs/sandbox_defconfig | 2 + .../watchdog/gpio-wdt.txt | 19 ++ drivers/watchdog/Kconfig | 9 + drivers/watchdog/Makefile | 1 + drivers/watchdog/gpio_wdt.c | 68 +++++++ drivers/watchdog/wdt-uclass.c | 172 ++++++++++++------ include/asm-generic/global_data.h | 6 - test/dm/wdt.c | 90 ++++++++- 10 files changed, 316 insertions(+), 61 deletions(-) create mode 100644 doc/device-tree-bindings/watchdog/gpio-wdt.txt create mode 100644 drivers/watchdog/gpio_wdt.c