From patchwork Fri Jul 2 12:45:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500058 X-Patchwork-Delegate: sr@denx.de 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=Km8L6Qop; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZZ24WBwz9sjD for ; Fri, 2 Jul 2021 22:45:46 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F199C829E2; Fri, 2 Jul 2021 14:45:28 +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="Km8L6Qop"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 80C5A829BA; Fri, 2 Jul 2021 14:45:25 +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 A9AD681EBD 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=GLUDtTr1cRUAzzvCNri3mtJfXEeXAx6kWjQ2ZtApctEsWrTNhlvltnqxVY6PuI/FHjyfi9bK7QAQdcfvEr//HE6JjXfBfBK+dUwWB4PYqsorc26LAhTcE8aY4ZMKuSRIfZwRUdZK3HJDyAZeWEf+KRs6LVHiJ/ychmZXO+UpJq2wzPvMPS8+nJ0aU8P9u9Kghu3yk3TSYxyJvU+z44RlFf8ig/OYmW5/2aDvw/EpmpIX/Y5u3RG9jG+dclHTTKfLCwdU3oT8+ccCCeH6TC54HYJC98Nwm1wGQQSqu5S+p3iQNJtUvrN2HsBooBU3AMeH7SD8dKJMZSDHz72vpCnGbA== 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=E6KEW3FA2Bu0DKEms2UpXSnkVeSVNMiremXNtp0CPfY=; b=TL/ij+nGYR1DHhyhgdeH1mEfxEnJsgwzEaNsOkYU/30YSyKQ9heU5MmRaRofLQUto17OaXHinNkCFLTuD+9XQZYlVTvxI8UWnndkoGFCGKyO3uqiapGUMeo5kha8TSBgfb5Kov6PFfXNoFn9BdIUFlR2XzUjvsWE9MnlseEu6ZaQCQQAWuFyYcbhQ1zepEwfl7WBZT60YwoYtyp3iOphwUZk/vYKNuQiJAD4YE3ySkmkYf6OSupiDjWFneYUUHnqIx4ow+mHPPTYmiZTTqkzi84xnW1YTFFO0ld4B0olieTInHPmLMqIJ8jF79jSYjzCgWM17vJbvi4nNoxdbqOXsg== 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=E6KEW3FA2Bu0DKEms2UpXSnkVeSVNMiremXNtp0CPfY=; b=Km8L6QopLTQIn1WH0voIhZmqCKh9fUP2j1ztLa2dNWKrQaxTMWGks2RYgwVcWHyyu895omLW2+0PAYm/xblMLulvy8jZE2JRISNDcUQrjzevk4VmxPOlgUIG1shoBqV7DiTZq0Ivw+eEvf01uA0OFRVz3KU/gTI+U3BXXqypukc= 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:19 +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:19 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 01/10] watchdog: wdt-uclass.c: use wdt_start() in wdt_expire_now() Date: Fri, 2 Jul 2021 14:45:01 +0200 Message-Id: <20210702124510.124401-2-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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: 68781008-2f9f-4e0c-e8f4-08d93d573fb0 X-MS-TrafficTypeDiagnostic: AM9PR10MB3990: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4941; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QB8vSHpBcjmOyoqgTehzMX6vr+IOznp/fXumQciztJImcdKIWzsmiHgNcMsNxxplVNInpJlTWb86WoJrg4t5zYW+etYE9g8A4SgZk09WJzBmAlRFpd8wExnofAA4G8YN0cjoPc2XaNNL6ZdrW2KKzOhtcuK1OAhbqjZA1cKBQC4BmBCpoESw1HHjKQ6HJnBJYrQ0Uawcb6kOFb+e5baBzvbyBgog2AiR5wTMDOACIDVyvBxeUYG0Q7Xdbwu9Ah+LB0T1ZVxnWrFOQ3bdk86o7aF/hiZDTL8U9fHmyxGRAWEjmyvTJZT5e1Bf8H3m0oJ3ela9crdNdXwVPwpipRS5g073nzxeRWhz+DN13vo9KLmHkycr0TNd7kYm/HOVluQ+xVMJup2VvksQ4oEbcslMmQAb35mOCWMX6QATENUV26R/Zv9RhI2cdC4YyKHpPiZIzzr2JXrDFIxJFfLO5nydf8b5MABdb/dxK3LQaTEW6PBaUykROtxUzt8mTl4BPtJAC2pBiVsOua2X9a65tWePziNMH0bHRQpZX854MFZTAReDvZ/R6qakOgYyv76zFJfaQJg8aX1xBvy+cIoGxPc2dqsj5EYxmdyS1/Sf+OjkdPpex1yJWbsP4qsxekrmJm4XsNy9tIWIfQstKLbvYDKsLOgZl2iU6sCC0mDLBbE1a9y6kjuHfRsx6Mdl4RLoJgB7RjPykWWxBvpW9mIHdSEMYA== 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)(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: lksWZ5WYrtaLWz01tWJKCX3v0ztGFny9fPlbqfMOBftBxXlXZi6DnHIjY33z5geb7YnkSWIKTphxuX1kpsQMDc9MnbuusiT8zdecZgwfNzSagYwiyD8jGkangjDYYyGxiD6kVhH0wtPiw20uOAdAApy3QIpgYia10iJvoixF+am3p44TsbeiQgS1WuWD9A5UGnJ7gJCtJRD1Et+/1XDKtw68wRqHDl6ztSU07d1trfmXJU5i0gUwV6JxSvz/oj8TWMQxlKVtHQA7vLo84in5CvT37eKvGuG6NI2TVK4hDYWmS00iNQ9QE/SFJQATIPD735I7TGN8HEy+nY3xj6RZPN2Hw/HTmGo6KBJsjU8QQiZHNKCUtxBGAzxmkF9seksVFKV6V3SW0kCNBjgzh6F6JXSWnEc6Xemwce6kyV7/Cup6TQuZTbtZEaAV6H+0wtmRwKxqMFZbTnt4wHZGiV72u6u5N1da5TfQzm2e8AWAEzNZweWIZSzsRRXPXighL2UiKa/9Zml4DZ5N3x354I4Mj8XXiM8+8jHClyLdVrND7QN0d4IB/WWfOHclZZnv7ovkLY3I8NGsxVx6zdY4WCEU0JRqz+1AJJ9w5rv6j6tsnnj6XvtxfGMj4nyfT8YEF0P55/epT0dcGGqayD9G7x5gu/jldzOw0JO5APhQdpiRwBzvUQh23YoE4sc6A3cyGkmtoEgVl+9Yk3LzEV7Bzi0F/TS30FjrEEzFOfw7XsyX/9DRWARqNz9ViocZM7jzJ+k3zrZLycpvtsL7jhnkpPUCoqc1ozHfAX76rFTOEa6dhOqJxCv3zucXbfMFk09vCHgjS4qiETBGbsa/ML7gUKk858gxh9dbPCRv4mVijdxV6kAy0hjeVWzAA0m4CbVyuRT9qIKH/76Jzrq60ZpieP0cuQLHrEZbLIV5t8DZnb1ZUIHC+wOyyboSPXg3U65Tx/j64puHDgto3rkqR8gSnH0g0AUucD11+vd/BjSxYCc2kIN68PMV9MrVve6yB+o85neTvctJkltfhWX9yb/yB7GsWWD9/KmSVjACFtyW3YgZhN1ZzWWZ/SkHhCryY0vfoDU0bhtyx/LK5bwKy6/CvVRtOnEsEBT0HM2ZdB3VDMXw70Injtzy/9hDG/mm+KwWxXAs2EzGT8HNAQbpn+wghsUWvsLRKhDt0fhEOSCaVyadW9zfpFh4C6WC4Xn0faK2mRlh33C2milMJV9NfG5tRDGcakk8znrbomP5IIBrR4NgPw6iyA+Cr+5HHA6mz9BYJVMM7e/YiK0sKO6S6/lEpHXyEzoi35x6du47N73PnQ58y1e/VF++rGD2dKQ2Iim3tlLy X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 68781008-2f9f-4e0c-e8f4-08d93d573fb0 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:19.0632 (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: FYmF3r9gbDm9yg8Z6vQAznkBtMyDfyvV00Dk2UXnEqil0JDBndchScIIKgqjciYUmyu1vpjN52SrbV/aw3dMcDJZPZQvUZ5ADZ/TW+tn8Xs= 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 wdt_start() does the "no ->start? return -ENOSYS" check, don't open-code that in wdt_expire_now(). Also, wdt_start() maintains some global (and later some per-device) state, which would get out of sync with this direct method call - not that it matters much here since the board is supposed to reset very soon. Reviewed-by: Simon Glass Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- drivers/watchdog/wdt-uclass.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index 2687135296..634428fa24 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -118,10 +118,8 @@ int wdt_expire_now(struct udevice *dev, ulong flags) if (ops->expire_now) { return ops->expire_now(dev, flags); } else { - if (!ops->start) - return -ENOSYS; + ret = wdt_start(dev, 1, flags); - ret = ops->start(dev, 1, flags); if (ret < 0) return ret; From patchwork Fri Jul 2 12:45:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500059 X-Patchwork-Delegate: sr@denx.de 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=DlBsEz0q; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZZD1TGMz9sT6 for ; Fri, 2 Jul 2021 22:45:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 77B62828F8; Fri, 2 Jul 2021 14:45:31 +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="DlBsEz0q"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4F1CA829BA; Fri, 2 Jul 2021 14:45:26 +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 EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on071e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::71e]) (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 C24B681FD5 for ; Fri, 2 Jul 2021 14:45:20 +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=C3cNZCBoDdIbBXhB7MUA4EhQJFKQZCoA9jKSTMa5hDVHM48NSrtC1Ck3ridvr3W+a522ds4UJ5ys5xlEsBj+yhVXL8Y+lmgf59FngLmIMEhzAuWViMjskGxv5nv1VRcvnHKLnmA3VkT1oleJBnyOLsPshF4pvIosqkr3Ke4gBQYUR4sCSK2tvOnw/bT7HBDHmkESGan/rjinHDgmx5OtdO0V+uvCTyTHgvy1HNFpgU+Y7Xda2ZEq3lZxBJeVdZXLuULPb7ohblkeNqhcbXn1htI7LZQyJTwEmCxhOS9ChX818PhDSz3ZqEAvWuBVJylMHp4FeoMarveHAQ9gs0UOWg== 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=H1mYpL4gOfhGOUYfzR9sEsFeSVZQ7Fmi5cLInj83+gA=; b=K56xFZBBZnxZ+6UYFgqJhwl9PzRq9QQSMBud+XP1G/yuiz9bx1PJh4ZX6dgTS8A+b9Fc35/FZVgO2hDOO46lhAddztCM59dUidI5J/KK6YBYPSXzTb1Hvms/L8R0NHPIW7dDu2p4taPHdIZNrzml6Mn5EOkgfYvcX/YvDQmgZxJXGLufmsPfDnjCF+/7YXVBsrHxc8HcGFfYY8qh1bI9V4xFKdpZkagjheohsFVm73Noo/+rBbSz2w/oqzcNPC6bKruQ+UDHeunkw4HFdwe04LDSHim07sKJw2aDDyqn+Pga/T+XlQ5rszDYz48/bVt0qD29mW2kNQUwQyP4TPO6Vg== 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=H1mYpL4gOfhGOUYfzR9sEsFeSVZQ7Fmi5cLInj83+gA=; b=DlBsEz0qXLysSHNNONrw5G0R2HAvqh8I+P7SJsxt1nFuBpbVqalnkp/Ii0JTcf+Zo5WoQ4O8m73uHUPZpO7FRF6ohbJeA4Puj/qALybEmN6is+86uuCZxCTOPTsVFxrmNxRHM2zjDOJeRD6DgY4GTcW/IwWkXWMjoqFyiv1creA= 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:19 +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:19 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 02/10] watchdog: wdt-uclass.c: introduce struct wdt_priv Date: Fri, 2 Jul 2021 14:45:02 +0200 Message-Id: <20210702124510.124401-3-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e42c4d15-e5da-4a58-0591-08d93d574004 X-MS-TrafficTypeDiagnostic: AM9PR10MB3990: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lSbjViS8sllPuALEdVFcYjNouNM2M1tS0K97KQNc+ByifzL4YIT0QMUOr/af1traE9gh2ToT/lH+u82fqb0UN3XRqmx2BbVQI0HVojzZV5i+6KpkynGtzMCKPO9irda/v2iUfT3J/Sc1cz3eAc32bCuVcpx5n7pitc0O7s508o5+U4x4DLcjGlITpijGisRF15duru+nylZWpH7rP3Eg5yPQJ7oG7XwjqD3vbhyCI4VpWPHdNpjvkWM2jCdaiJh7vQwCSrzjes+8O0VAs0ep7orK7Rc+icasMDW43YuyL6KevSrKl9icBBD4NvGx3DBBvx3h4DsDpxcYkT7e2Yvya0n1sc13UtzVL22Rk28BKQeMaXLyN4pM1JDTtIxEpxA+ersx/9Tvfm3W2RsPYD84ahnEEPhdgA4LEbdCgcIkqw4cQvDiRnu1fDzW74wR0VotNJyscwA69++jvfTeQcXlOxR3rbB2jvP7FbAvF2dRMHUh1LZLMKXl2rFSdf29e/G07PWjnCXMjbN7fVQYdhe1aHqWbu+Q2oV+9aXOL0ZsWi/boBzZP9Wm1YdMSCj/LoW1ZFggS/Hai0viTXwsZyN3mUztjgnpATepbe3IznZpkcyIefbWQkUKY5dJ0YNRyhAVJfKPRpbhcjj9baczTNQ65U9bicAyXCZ6xVapYRlELIXnDEMum/tvUhpKTF7s8+Ji/Arzd/rxoNr0W7L4NYlqdw== 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)(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: RsgPGQGcMojXn+kYXPVsmYTpE6iL27bbf+jXDf2dutYd3I993smk1GTi/NjprJy3/uvZR1AUR/qxjx/U9uG5bOD/tdlUs6h9SG0o1snWIGV9peIFdPxRmHTKOwhtWYcVzdROGBwJWtw0+U1eTEWUXwToXcUnquR80+f7aKcndY7NVCJD2gWD51vCybGceOr3PKZNpJEZZp2YYBxzU5ihTj4nrCHk7S4EIjxDLczgWKwJzFs+Ep0UcyWtSP4UJwu/QGgTUYh3r9Xdiwht7/CQIiPuxTYFJ+qOqNlAWB9ebMlcIJdT4Rh3iwnGfVPWF4qDEs44qQXTQQ3bWKXtXoo0+OlEgDnAWEEKz+ad03/E4Ez7A0jd6ICrvMQZmLq678uKhxavoWnZ3CIQGbcfJnE+aq/6DYE14nNboNVBoKTITj71H9c2GwvpxN+Cj494rql2sQPgfOT3KPyCwWdExihKDCcGlYnDdtaeVjTGdp366eDqSPMpAhB1wUPpV0MK966i8wc2NSFgIqOxatNdrc21H7ylpJlYliKJhYOWuQxCHCy4QO15wNObI4xGcNUV63zpYo9ENB0w+COGira1f+S57dknJIjxN3ZYv5dzfFKKNwTeFAIaaaN5f2yhpybQJD1RJHP0aIxxiOPVhkcoEhin9ohjcdsVORZP8TcblgHD8Wa4/mdrgBlZ3pX5waneHR+WYfoMgDb4hpDsvxqtECfNc2fPt7JdIQmyJyCSNKidE14Uw/Vb+/F4bLOyaXGT7oIROx2AqWofxqA6Gbd0Py/Ojxk+7Wh5D9qrJ84A0PsAN7VmEbeC3OowAyR2C4R0133febped8B8nfHAbbXeKJZjMVn9SKNi8YjE5HO518dHrl1idg3EmSnqzqJ4Nanb0bnGMNoHhhkY/2NAuPTXXakIdGAM/UuAItUIZf6sl3+ZULFMQ1T9P+o4qLW9iiIeW1ScnWQ6MDnjJL9t31znVvz/FYFLXFV92Bx7R28ptOVTF0kVCMG9njlSVDzxeznm9MnqTUj0jrQTij2pE7f4DnLoXD1ZtUODnuxsL+ydKWkcE3m9t9+nS0B3REdNf7eExkGv0AObPwJwS/zZ1fKAiiOBb1wW0tBxElSaGWSXgp8v0Af6OwcqLYQWBIZciZ0dm1NBQhUGUY2ncYvveOAfNf36eArFAoYMseEABdwDAt/2agTOfArHMQmL+nHqiXf1TYx3hqFbE9peefsnLJ7GT6VqpvhZubWX66+nrwPvRWEJ73d8nPGKOh6i/xNeg9yzcuk+u2IlKO5vJVN9b3TD+MCKx0h1oKhgTxq50hRcORZAz/mmk+FNLzalBSEiKqpmSX50 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: e42c4d15-e5da-4a58-0591-08d93d574004 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:19.6279 (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: x7Dn+OYO091D/sP+rOw+LPvG0eTpNx5KVDLlrfNdtP7PX/kKTLaQR2jSC6zFYBBSfVJKtCs21e1iYIm9u+DHjSHqTOKM7jYMZ5jrzMBsAC4= 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 As preparation for having the wdt-uclass provided watchdog_reset() function handle all DM watchdog devices, and not just the first such, introduce a uclass-owned struct to hold the reset_period and next_reset, so these become per-device instead of being static variables. No functional change intended. Reviewed-by: Simon Glass Signed-off-by: Rasmus Villemoes Reviewed-by: Stefan Roese --- drivers/watchdog/wdt-uclass.c | 74 +++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 20 deletions(-) diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index 634428fa24..d0c1630cd4 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -18,15 +18,24 @@ DECLARE_GLOBAL_DATA_PTR; #define WATCHDOG_TIMEOUT_SECS (CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000) -/* - * Reset every 1000ms, or however often is required as indicated by a - * hw_margin_ms property. - */ -static ulong reset_period = 1000; +struct wdt_priv { + /* Timeout, in seconds, to configure this device to. */ + u32 timeout; + /* + * Time, in milliseconds, between calling the device's ->reset() + * method from watchdog_reset(). + */ + ulong reset_period; + /* + * Next time (as returned by get_timer(0)) to call + * ->reset(). + */ + ulong next_reset; +}; int initr_watchdog(void) { - u32 timeout = WATCHDOG_TIMEOUT_SECS; + struct wdt_priv *priv; int ret; /* @@ -42,28 +51,21 @@ int initr_watchdog(void) return 0; } } - - if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { - timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec", - WATCHDOG_TIMEOUT_SECS); - reset_period = dev_read_u32_default(gd->watchdog_dev, - "hw_margin_ms", - 4 * reset_period) / 4; - } + priv = dev_get_uclass_priv(gd->watchdog_dev); if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) { printf("WDT: Not starting\n"); return 0; } - ret = wdt_start(gd->watchdog_dev, timeout * 1000, 0); + ret = wdt_start(gd->watchdog_dev, priv->timeout * 1000, 0); if (ret != 0) { printf("WDT: Failed to start\n"); return 0; } printf("WDT: Started with%s servicing (%ds timeout)\n", - IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", timeout); + IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", priv->timeout); return 0; } @@ -137,18 +139,21 @@ int wdt_expire_now(struct udevice *dev, ulong flags) */ void watchdog_reset(void) { - static ulong next_reset; + struct wdt_priv *priv; + struct udevice *dev; ulong now; /* Exit if GD is not ready or watchdog is not initialized yet */ if (!gd || !(gd->flags & GD_FLG_WDT_READY)) return; + dev = gd->watchdog_dev; + priv = dev_get_uclass_priv(dev); /* Do not reset the watchdog too often */ now = get_timer(0); - if (time_after_eq(now, next_reset)) { - next_reset = now + reset_period; - wdt_reset(gd->watchdog_dev); + if (time_after_eq(now, priv->next_reset)) { + priv->next_reset = now + priv->reset_period; + wdt_reset(dev); } } #endif @@ -175,9 +180,38 @@ static int wdt_post_bind(struct udevice *dev) return 0; } +static int wdt_pre_probe(struct udevice *dev) +{ + u32 timeout = WATCHDOG_TIMEOUT_SECS; + /* + * Reset every 1000ms, or however often is required as + * indicated by a hw_margin_ms property. + */ + ulong reset_period = 1000; + struct wdt_priv *priv; + + if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { + timeout = dev_read_u32_default(dev, "timeout-sec", timeout); + reset_period = dev_read_u32_default(dev, "hw_margin_ms", + 4 * reset_period) / 4; + } + priv = dev_get_uclass_priv(dev); + priv->timeout = timeout; + priv->reset_period = reset_period; + /* + * Pretend this device was last reset "long" ago so the first + * watchdog_reset will actually call its ->reset method. + */ + priv->next_reset = get_timer(0); + + return 0; +} + UCLASS_DRIVER(wdt) = { .id = UCLASS_WDT, .name = "watchdog", .flags = DM_UC_FLAG_SEQ_ALIAS, .post_bind = wdt_post_bind, + .pre_probe = wdt_pre_probe, + .per_device_auto = sizeof(struct wdt_priv), }; From patchwork Fri Jul 2 12:45:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500060 X-Patchwork-Delegate: sr@denx.de 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=BetuHhxx; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZZP694bz9sT6 for ; Fri, 2 Jul 2021 22:46:05 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2930882022; Fri, 2 Jul 2021 14:45:34 +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="BetuHhxx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 07AD7829C3; Fri, 2 Jul 2021 14:45:26 +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 EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on071e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::71e]) (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 E3B7282022 for ; Fri, 2 Jul 2021 14:45:20 +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=ergVLtxd+L28X9OxECiKjrugLvpOk8Rh5fZBGKFS8ptK2TkJApPnvor2kN9BNOLdfsOnyEh0OhJEbeFOb4D+hSE7iM80X8KVJVyaBn5r/KILDuwSg1hyLPQ++LN2SpGSo23A80sHx0OTnBLWP/JSQmM/JlP3LL3aLQNNfIkf66xgDJz90P6Xo5MART6daBZBiSg4RsuqhtuC8J3GON0rvVy4IQSwgC9CrWst4jjGGxE052T5ngTDFPgTA1jofbvGn+Jz8P5zYLpk+Haz32vMfH7cFv30u580R19HVAiEX1rqbgkKFuZ0XREqMBmKbACTo/XCRDnPooqvqzMoruxaUw== 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=hosjLM9T7irsBw6OdHnr5vMAIcyIen2Yq+0PWBkiqoM=; b=JH6h0yu40Mi76rPihLEYMj1D5AF1a4chYbdB5jQDEai81ImC1AOhKFonnZ95njjbTuGbAQTFHn5GzSyeUoQMrHsy8Iwi+EDfcLNDBTFPAq0Ssd9W+svRjqQVg1VySuLbZ437bG515RkIprJU/fR4senUDXpehrl22K3XKZi3n3O6qd5YndpNKgpMK2gAb8u7xSVKYLo1DhxWY0N90NNMWYnqObx7rmfiGdBfziToOLn0ZxHd6NjsxehqK/HHE5SL3+95UW5QMWp+lg0QRR0rPwmGyf9ZtXLQpI0ywgADzKWUILiBxT3+WhJzyTZRb6r0J906ozrVBijqIbITuAuaPQ== 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=hosjLM9T7irsBw6OdHnr5vMAIcyIen2Yq+0PWBkiqoM=; b=BetuHhxxE0Ee64HvYg+b5gleK8PK7lXK9V32MYFUfyByAtRqR2ugbOA/om3id89b0BgITRilJS437QxTfnuLJtu2X6auzaZK8UEgyx484fNdCilwiys0kG+LS39ycgXStYV8V9yjuWZaSiQzYERgOJqqVimBzLvwpFtKuhJ5UDc= 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:20 +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:20 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 03/10] watchdog: wdt-uclass.c: neaten UCLASS_DRIVER definition Date: Fri, 2 Jul 2021 14:45:03 +0200 Message-Id: <20210702124510.124401-4-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff5f2ec9-eaf1-4612-103a-08d93d57405f X-MS-TrafficTypeDiagnostic: AM9PR10MB3990: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:663; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7r1D2H26CTJuKD+oRYZ9Lt/S2ytse7sTa2DaR6qIYjvoaQ5768bX+Z9izufMT4i4jQAJSFuZHQJDqh6eWthtPiem3mjZqPbvtDifO2UxJMGK/ZMbWVkgieW/+a/RqG6/3C5rrqmwOguWeQSlqdRWRSnZ/InhDDBopXbj7aYrkT5fehsy1DnkLPxKIPZDqonFJOxSzD3epbkAiLnkf7YQvrOnJPVA+ge7YXjkJmLQmPnoWkgAE3pqM55DizJOQert6kaeBvE2wkQ9cPYw/2Q0uNR0d6IppXDtoUPIEvwRiIen2ENmYsrBUw5XQYdBpBVz+JduVgBzUqlnqq3FIN5fyIyoGXSg9Yg5BJnjpxgVdt38/D1+G/rGttgrvRyMcaqJKMUK2N5cMw95o5qjTCCIlmTYU23b/qGYtgCshoAEEhvbDC6Apxjk+5o0F94CpzF9SlZL92Tc5wIOL+yOWL+lWIgq0bSUtjTBRHAjjgT0faEjYOehj8hvWrpL1hm6TeaFJ6bInpcrkxhPNifF0OBhMwvsuB4Cz6la8WSqpmb3sYZ1Dcrl5ZWrPjmFOWCZFxVh5sdv3P23EG/FmK/FNEIW8vGGYaEMwPa042ohVejR+05MNsp6W3erxS3QsExzcvprHgpckkLrKjV4HbZ07mvAkH8rjjpCDAEsFG8cc2ZLkwi3Tcwasi604uI5NKti3rtbZ3jpcSIQu5coFoQ7xHlLlw== 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)(52116002)(6486002)(8976002)(8676002)(66476007)(6916009)(6512007)(186003)(38350700002)(54906003)(107886003)(16526019)(38100700002)(44832011)(36756003)(4326008)(4744005)(316002)(26005)(2906002)(956004)(478600001)(1076003)(2616005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oByYqp8IrJ9ck/p6PCmXtLIFvkE1JyguFHNu1pCZD2NdHIY1j3VYLG2cZ2cmfWWW1fj43TxDPp2L5QGplSfE+kT74+QR0OGFRPJw0kUdCHoGqs8uH6uzkZc8Glfgf/pAyCidTgkfN5gDZoZYKD1LBZSGBsYnMLStieekIUKzkNNvtc9yEZQ2YBCKRGqSqkSH/DYPnY96ZbzHGeA1M0nltd83LsLqipI2M1pFPpW7a5MvJOSeHO+RyRZcgziujQUMJ0mqzJ1jW0WxvvHNEHzwPvb1z8jYliUq+Jopgy+UkYg8O1uRbwCTpfZ8QYGbs2lMTquXXaiIah3vLBFVkOtY3HcxyBPKft1mhcoIHGSidA3mEWrWde5lEmE77dhbnMPXfGFwjoOjTzdgep+3jUxMp1ytlAM8oGJMwa/fFSDq+KHVQrElnqas/OPIsCXMDPjzd1v7DBwpfp0URwCxSuP8DpDXKVa8ZLC5mbxJYBAi9VclnLokE1q/ZNb7q3uK4ZvRLH1QsitetcfN0KDczGx+CxgCSsgvuguN0tCnLXpwvO3lwUtP09DoblAeEDyIb65EGhWQvDBH4nOOFBoZywzIQcvk0ZnYun+HYtTGSVEKZieYzxXfQHh5C7AyZV8zBv/5plmEkOnO9+uAeLryaUqIxZybw6UoUpfliM//3OOwIsP1h79BlJqojDKYc9XzssjI7KFpOY3/OysqD22e4Mh8kc8iYbBPgOZjz/i94G7qR3bdiHUzjAxQ6YJxONU2/CXk5BMioXN1ZmuBA2lKt6NrYrReJ9rQ9DHSJhaaK5s209BdqyqOaHhXywoQdcW6pnhtBNrdi9sfVNk5jsYlkd/XLAUfQDl5tQptEN28umBJu8nk6TyQaz/O4WKHaibipbGeXrHokuSk0g291oSXs2qJyi5F9XmA/YxdkbBdHll2Mpppk8w5SrxymJ65Sc0alFUihn7MJq7pFSAgKFO07lZlmH6osMDsk7B4W7WALr1Cs3FADIuWUz7gd1OjIFHo/px6AEW7FPbI3zj0fEqB4VF4DVChNP5YOioiHUiJgGipBaT3TGYcWRQPGUniPnwYFn0Ov2zhjp9YWZba8JURJTBsZqR/Y5uKgYKOx55RLvc5wrEhxWukUDXHbZZrl8EwHO5gf8vLhgjEouJwqT80yJFtRVsWDKhA/VLPiRzMMPy2hV4+t2AXyHiMR2cUUqml5nvL76FZOq3kVT04w5M6jxyvIcdp0jfFTbAZyGJBsKHZkku8VbmVbqGuTkJt65unIOOFKmOMqUKc86ANVcZ152ZtUB0g+AbrtFH1gEW/4xDz5TmOdpNb4hKeRx++l6zJ7370 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: ff5f2ec9-eaf1-4612-103a-08d93d57405f 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:20.2206 (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: Uq1k9hrFY9T4OpaZ6WosZ/QueVGDetfgv2RdyUVSyGxvzktq4Gtg2Q7tpBmWjUu4jOnvHibWpTX+tH1K3HRRoHyrY8Qq4Cnh96E5o0/8NGU= 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 The addition of .pre_probe and .per_device_auto made this look bad. Fix it. Reviewed-by: Simon Glass Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- drivers/watchdog/wdt-uclass.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index d0c1630cd4..8ddba9b046 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -208,10 +208,10 @@ static int wdt_pre_probe(struct udevice *dev) } UCLASS_DRIVER(wdt) = { - .id = UCLASS_WDT, - .name = "watchdog", - .flags = DM_UC_FLAG_SEQ_ALIAS, - .post_bind = wdt_post_bind, + .id = UCLASS_WDT, + .name = "watchdog", + .flags = DM_UC_FLAG_SEQ_ALIAS, + .post_bind = wdt_post_bind, .pre_probe = wdt_pre_probe, .per_device_auto = sizeof(struct wdt_priv), }; From patchwork Fri Jul 2 12:45:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500061 X-Patchwork-Delegate: sr@denx.de 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=85.214.62.61; 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=c5DyZjnl; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 4GGZZd35rSz9sXS for ; Fri, 2 Jul 2021 22:46:17 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 002DB82A29; Fri, 2 Jul 2021 14:45:36 +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="c5DyZjnl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7D28C829E7; Fri, 2 Jul 2021 14:45:29 +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 EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on071e.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0c::71e]) (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 2192A828A1 for ; Fri, 2 Jul 2021 14:45:21 +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=TuJiZCbwkOv+kOf5o33uOzZNLFmNWUea+GuNZrc3ZF+HQhFrJRFDgD4+K5tLrhQMavEq3TkdRmVdgzxgUY98mIH+AV4vjbxHlQYtvteyzpNmyFR7///UWCXC2QpLXWaRmwVIGWIwZGtDybs1enzCRjyrQxG+RUxFsfJVWQhIRkmjFx58hLXn6ghVttjme2Vm4jQsWkrWjGGAvcDPp2a4HYMsna1Ixv/9CKEnadOaOmbod5MHIjU1hPww2f/HjQ+JgXoec9YMce4CZtMfi6fl780mRXF0VS6HFklYGYSLzJW3loB6YMpTOpZt1tNs68z9wknc+Lpl2YAk2NIdyu6J5w== 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=b1m5SwQKOG7iZ2HCK0uvow2GhfpfAqon3urIpfj+ed8=; b=UbDos7QNYfY4QMLDeBLWB78U9ydV/aD+LLd4qdsVW1599NAtqIPRmotEt5DZwlY9EOb6hO/cLpI6tCaIx3rWVnLgtFLE9DIIqCK0aMfAG6PCkjwkjoJkDAVSfMDhn/919V1a5t8C3RWRqfOGPAoPWltpHrL4UWxPLTE/6TAEVbFrb3iTJzR9alJuLo2Km66vvvRJ396mdowYcN3Wu6NUPRgJDNKbM62EhIM/CpW5to9a8BGY33MElm+vSQMraAWJvYRyjp4S/BUtygJzzGtIahuCZXdtzIFKSnvdyIa+Glv50Oi0F8Mj0GtSxvf5C7cgB53D13LfxxTyHTI0fM//dg== 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=b1m5SwQKOG7iZ2HCK0uvow2GhfpfAqon3urIpfj+ed8=; b=c5DyZjnl1gYJisOcwu4eQIm5G2K4nWi0WCQ3r5Dby21tVusMuQCiZGO5Yt/6CA+0XfXScmGg7t6VPCYCRCwTl0HB9gnsWJ00lWrBybZozM55rDTt1xFYzobrqzCxBuBkVu4dyAicMcx1wbawkGpke2WWrbpV6XFZdxpcpHZbc2w= 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:20 +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:20 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 04/10] watchdog: wdt-uclass.c: refactor initr_watchdog() Date: Fri, 2 Jul 2021 14:45:04 +0200 Message-Id: <20210702124510.124401-5-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b68b402-d63a-4872-c5d2-08d93d5740a2 X-MS-TrafficTypeDiagnostic: AM9PR10MB3990: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:486; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sJ2SA1N50VHb+luDLPp1OTEcpwggmDFxgFr+iWko8A7B2qVxLwhzZpgsktvNkibSMlW9QTd1yO9SiP7bWKExGBYJK8dU9tOmorfT8A0y+s9ZtYMNWtlZEI2E40leahL9Wd/Lx+LOosvFBU/bYEFDh6fSyt8NLeC/KzWwZe+mgVVaeiuSOeyVCwI8MlvQwXZzH3HlrqW711ZK0tfu5rksR7q4qPB9Cy4v6HPJIGilJWNV2GYrS3ZG/mH/nb7HFIgx1goc5D9N9Dgh5FiPChzOHYOD10NdhaWuAPhYf/6Y7LTRFA0Q1LfcbdLyncEqwQI/DD2bhPUV7dllSr4rtWjwLiwgLtOg5f1OT0kYpZxD85K76alwqfpKg6FguKTc/aczCGSj3Iqtd6fnHRS1VOgGBznrFQFA3BW9y287FWLasKjIE7Ena7qIZB5/UUV4YAvsAWJWfDRpj3p0JEeXubfK3PkIha9i3Z5jWzHcmRiBFYCKxHf80v8khijbLfZYbL/DZLo0TEMVKlHExr1qDSAeyCSG3xJPOEYyErgYgPMInmAijeIhdsXas1dDTHewmHODbkhZD1FM8WQqZeRt+XqhZFgr0ldquLauihsMXJJ10X5aIl3LvTNSgOo1xJhs3kuuzorEWl7VdnWsstOf+UKvveOIshstVrqv/3BkekjrdYNyFAqlkd0Zm3hwLP9aKVKERtaW72nq4Ib1vS/joo08vw== 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)(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: 4aEGC7UpVR2N1w+q8nopUurxt9Bo6KFPgUkEJH9J3r3nuhkkX9P20ramuSKpw0SH8N4ImcO9NraInFzyzODc5BZZNVRC16d7gjZR85SesPrzjoRZQlbTnTauA7HjdIrmP/FFhQWKX8w18Ex7gy3TvfTXhrs7IrJyOYuP37lfEpHrG6r3xn8ORweXVusvugwNyYgBJ1PJJsfHzB1Z5tUFj1e2hNBTSe9zTAfVWSpZ7u3PZ7co/W+q8/s1HMMjxEYH051VIhUJd3gTO4XHCgsnqy9W4k9d5jEW3pnkho2Pr7i7voFTLErziM5wKChj1SQj6afsVZvQkaLnHqXL1iznjgNZ+4SYiNydleNIjh8LF/bj7H3WACD94AgPSIT3+bCarfHhjGJTl7t1iui/dv5tet9IpiaSLgbypTyZ2cxA6kQyriTS5McPVLHOAprsYHwJmisTzu7C3Ix6yHmZFooQ5R0QhhruIAD5X9wUZXygGR19YJE0JUe3KfYEHpFEVs44tM4+pykUpc6617o8lQu62Db5PXx2vUHI7Oj1zRQIjR3a2tId80gN8QUgqABsUoAnm7ZjVBaHk35uf2BgedIbLA3X57XoDJDbCE0OOaWuCvEjiOXWGqZXTErwl2vtY/ytFDxFMjZII+wp6jhrrpZwykuFn4EoOjmvB+w8EgbumsGPrEKeoEedccDOLWKgrabKsTxsjT2Y3Y8+EDUr6SYlv4ebDTnsSAbS7mrc7XkkOike+TwUaacJStztG2uqxlu7v/N2XX2gFKpBmTLjTr/7fnIT3ss/Qh2NHKluAbGUobwlsnIFHjBgg9VWi5SMI0WeBfJVr/vWakMGKNjRNgUzmiCKDjQAFXrj6afhAfCEH7D5o4zmoX6OqRdslHCe5kMYxfET423DVPrdRYHlfeaAB0gfrdHKz/lS5+x0DizrkSo5hhZXF220tJLD22VotkXbFQufu90f5VfNbLd30hpn4UxJQmGheCm1bGQR0C11465QrgHZ9/5dsErZrngXTJkjcmc0RFpVbylbFkTmH96IAcyWRvilkBt+mbBSqHP28qnW88yVKdgNo5IpxDJeEz0GdKNkAv3jfvTzdWN4JoeNwqtrbUJW+W/+2RefeXR9VEpbuDBsLBqRPONedyNHHtrlipOKe07s5YZVuHHbcX6OLEnr1DpgxD783qKKaCGPtqp77gCl+ilKdeTY+1JsmUxAFJQqomGz0sowhySEO3J3V9XU6ncie8eQlLcbppWTYExPqPOYeD+xAV8Dvl+mNtHdTLRiusTy8Uod/ap72HVUvrLT+gDlGWvf5TUn4lD5992xuNgGnDIPdJwypvV48pf8 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 8b68b402-d63a-4872-c5d2-08d93d5740a2 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:20.6623 (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: l/t9QbOm1jmRjpr/SN0TaOagyl8gj2TgxjqnItnyfHYMJKerhAXm10rGaqQsXbse47IKlene3PEl5Byyv7fC6Z/AZaSO3iOdNUTM7NuYQcY= 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 In preparation for handling all DM watchdogs in watchdog_reset(), pull out the code which handles starting (or not) the gd->watchdog_dev device. Include the device name in various printfs. Reviewed-by: Simon Glass Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- drivers/watchdog/wdt-uclass.c | 37 ++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index 8ddba9b046..32f5b1d0f2 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -33,11 +33,30 @@ struct wdt_priv { ulong next_reset; }; -int initr_watchdog(void) +static void init_watchdog_dev(struct udevice *dev) { struct wdt_priv *priv; int ret; + priv = dev_get_uclass_priv(dev); + + if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) { + printf("WDT: Not starting %s\n", dev->name); + return; + } + + ret = wdt_start(dev, priv->timeout * 1000, 0); + if (ret != 0) { + printf("WDT: Failed to start %s\n", dev->name); + return; + } + + printf("WDT: Started %s with%s servicing (%ds timeout)\n", dev->name, + IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", priv->timeout); +} + +int initr_watchdog(void) +{ /* * Init watchdog: This will call the probe function of the * watchdog driver, enabling the use of the device @@ -51,21 +70,7 @@ int initr_watchdog(void) return 0; } } - priv = dev_get_uclass_priv(gd->watchdog_dev); - - if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) { - printf("WDT: Not starting\n"); - return 0; - } - - ret = wdt_start(gd->watchdog_dev, priv->timeout * 1000, 0); - if (ret != 0) { - printf("WDT: Failed to start\n"); - return 0; - } - - printf("WDT: Started with%s servicing (%ds timeout)\n", - IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", priv->timeout); + init_watchdog_dev(gd->watchdog_dev); return 0; } From patchwork Fri Jul 2 12:45:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500062 X-Patchwork-Delegate: sr@denx.de 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=Rh7lq9A1; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZZq2H2Mz9sjD for ; Fri, 2 Jul 2021 22:46:26 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9211582B36; Fri, 2 Jul 2021 14:45:39 +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="Rh7lq9A1"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 06B6482824; Fri, 2 Jul 2021 14:45:30 +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 ABDE3828F8 for ; Fri, 2 Jul 2021 14:45:21 +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=aqbOUlQDQdWeUKq8OWTeO2R7yGflwdoTBst4KDa+nQJjLGclkkUTkBZrJCMOQjnIpxNrgZwnLtTbiVOaRh3rhezXzEfg06FitvvKxLHRPFk6PapLlr1K2AYfFRVVJoY7QkiwJFtsw3mu3zZsDPPp2udIQOswSKVRKW58a5408N9Ip78ogUKw9x2mLkWbXYTVI0AqDvhSR0uoAidZStxt/rCnaIIDQVtnBf5So/ur7kviThDJb76qjS80M4KcvDsyFGipOk+fC5+5LXeS4hCs/s9u+yImx3fDtTZBgsQ8A3WO060L4IohEe3ITOyX+gBUvBeBHCDyGf2tDt01qnP3Aw== 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=74yYfcU+ixrHq3ILDmw+83YiaUj4BDIcuFZFtI7d2U0=; b=QY9phLXzhnkr6XSRHTH5ow+KxA9gVBRnyFODkS4U+p00TrQ7B2xP08ouFSEEJYRPR2qkXRoD28+uLEvdOoq8u+QuA0kzYiu7DLWnFj2WEM9baT4y2hMdSa7aNTUbKAEof/R/fqHA0u65bS3EFukh1KZyG2gbhbzFsqpmm8m31YfyJSp2ndXFElrI78IRLQRaMv199twnbb5BzpDZ85cKvd/SufIezu+h+RE9WHR4fu4Zaqj0f5iqV792NaYXXHVWbPWlx1bY7hxWtiqXfxEGYzwuncf3O9UTXXr2oc0KIeTpECMLLOQxjds8Quo4QAAcj+jKyb32eH2+WmSdq25zKw== 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=74yYfcU+ixrHq3ILDmw+83YiaUj4BDIcuFZFtI7d2U0=; b=Rh7lq9A1ZZgxhbCLiNQ7UecNlF6aKkBiK27hdcamjMXAqOV12jDjyOhpdKB04YiIb/oJJNsuIN86mZ5KRlJCthHtkNxoFLwFc6KAduv+ABCGyYbSEUWKsI6Lns5C33sOx6xn0mfIyrrDpZd4AXeEj+b1U+M1wdP91MoqVskqRis= 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:21 +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:21 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 05/10] watchdog: wdt-uclass.c: keep track of each device's running state Date: Fri, 2 Jul 2021 14:45:05 +0200 Message-Id: <20210702124510.124401-6-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30162c20-0e48-43ec-da1c-08d93d5740f0 X-MS-TrafficTypeDiagnostic: AM9PR10MB3990: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1201; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T2UAX4pIkHfFcRhDI05E4rwFvYIRpk+tSHK/muSXrBEt+YTU1gOn1yIncary9U93NCRvRRY1IJUfctmuPkQUQAV50gF2lq7baSxvxdQCqtIN3BzXsG/j44iug3EzkjJuaR0CKmj3yp7J87iraX4A4eb1QGfdH97TWXIW/aW7Cbw5PsunSv2hLJluxLAGbXdBsHs8Ui5GylJDrcAj/siZX1csp5LV+xDXg5OnQBKyMyayoJC9N4WcOIheZtJV7LVFMpJkv8qqvusC7SvzSCHnb2O0qDbBYXhsmCYc4IFKumxTdNE2uTFaMTQ+X8SCRghD6X61t/JGG5mbTFlVPwEy5sqz6g3PeyRnIxnySD1CqjEiH0GXJ+tU9IhThFCyGR/qXnlWAZqVJ3T2LQhV4Q/YGjnEm4kYAAFt0D4JdHLxwjl9ZK0Mj2Tj47BnoTrG0PEb3DchPiU+YOlJGUDdNpbVTqx77PQ9upDmcTUbrZ7rxnm4tUm8h3Ugsxbpx724nagVq+TTcxvF088PiKoyFT0fjbrmS9ScXW2AAiYivzLIifvJ+TXEYzDd4JqC7kPDn1hGqWLj3Qt5+fz6koxypIbGRnGlCsDOaPW/27YhuMirEiqGQAtTJJgKiexkKGVXFHUhp/JGB8p5+u4GaRIfMWeV5qjvCTZYS9EJBksFaaQHS8HeV1b3kShaAeoTLwTzXIwTeQdkqZTW1kT4C7Mb1VHgWA== 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)(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: IflwmfKB0E3VMqmaUsB+5ZiF5+YB/C/tl65EwrXkKdbQwYOzOKrjcfel+0apJlBaqKIiev8G61GLRmqxn702Rg9SJq95IayBs8J2pYyiyDVw4TXmFtQPAKinbovb81OAH/awMqy4/Ku33I3FRS7hDCdERpCYcRwS5CY9CNLUx2q3ygeXGv1dk8fRaGz8o4gXX6/pD/I4ETVTG24yBLoCkxZyqdp4F/4aPokXAvWZ8YkROxkbT9kwCpEfrytfhAFGIHZ0m0sA0O8BpO+oUqZoGQ7MM9HvaXGnirKopTjiT47NeLKNWu/ZCixCpPkzpMr3baNXVi8jIfCNdY5aQQnzdFPQ971gXceB0fU2a74u5q3Jcf0+7ZJ/Zr0fmvNSfT/z/Xxianh9wpQi+Hf+V831llzJ6tkU1L2UIEJJco1X5xBtjlaOjZIu6SRMx0vBTuBLjCB2ops9024amMVu7AqAki6SiEtXtL+Wlg8pL79lz+dAVZ0tpRc1zcsT3RLK8AIZMweQT2La5h2KiQP8ci43OXNaJ2I3SLbwwxdAcYNaxGziv+PriO/YidKPV9j1rgTjuTOUgX7tvLGCjQMWYEXYkwewbHA4f4sdutVPxdbVxdMkgfhKXGzK7rOhdkuHLA81XpSaO+XGb9SoFYYrRfVZooNwWDDa3UEoXgw8jHaMl/6DnIx7VeejIWTnW69KcWqrAgAfNlNe+8YWoo3S6i7myIPwprttzZ/qPXyNtegETGAK+1I1G5//EHnTLgOIN25Wv3eOcJgJv2aDFnWVW2cXn4rKKtRSrbv8tmWQSmnRGdvZcAtIr+lECFJAq/2pQ954wKdN9a0SB9gUSShtw2SK7EuvLHa5LVHjbU7llDoLewaR3aDvUCpTO3V0lPv7BZLxxOiCg/pNfrcbXAnlNRuujsH5a+hms1T9tKWTcMPYsuvZToOt5jn6d6ygzNQ6uEWWAoW29jnFvH1qdss6uDzPURHZfDzXMWmUwSeEhonyYAWvfb190G5/Re4oiYfUygznwf9G5/9KrvUBEOgPW0rXQ0dSHobFRNv10H+hMRvePDoq+7Q1DiVsJVXNTIcy1aZZ0Mbj/4kiKA/MKW2BnLBWpuM4RGBmZqDubok+uLnzzSyHa5xWjRKGpIxlCFTIrOkiUVqAZvr1ZMAnITZCAcZC/YWP6A7MThO6gsvzdE+HuVemxrzPNj4/TT6sIgZx+dxvGLeUYeljLYJZ3ZYIcfSh9nvI9tn8n2v4Ywlj5wldKIVZGJhj3t/oOSVrMmlsOssSrRt6JM4UnfSsC8yD2mOcieHPKvUOFhDxhwB1BaIKBwxAY1I97zrDc2/JdY/jxcJP X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 30162c20-0e48-43ec-da1c-08d93d5740f0 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:21.1750 (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: T9wTpaaVyKMOKUrhirrOpzXjDe+THKrarHW5VPcwngpy4OkCnYZgS32w9Sr7Y5nEs0D1isC4fa1QDJm5J52NWAR+WVOMSgyCgdwGoFCZzF0= 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 As a step towards handling all DM watchdogs in watchdog_reset(), use a per-device flag to keep track of whether the device has been started instead of a bit in gd->flags. We will still need that bit to know whether we are past initr_watchdog() and hence have populated gd->watchdog_dev - incidentally, that is how it was used prior to commit 9c44ff1c5f3c. Reviewed-by: Simon Glass Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- drivers/watchdog/wdt-uclass.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index 32f5b1d0f2..ca20c124d4 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -31,6 +31,8 @@ struct wdt_priv { * ->reset(). */ ulong next_reset; + /* Whether watchdog_start() has been called on the device. */ + bool running; }; static void init_watchdog_dev(struct udevice *dev) @@ -72,6 +74,7 @@ int initr_watchdog(void) } init_watchdog_dev(gd->watchdog_dev); + gd->flags |= GD_FLG_WDT_READY; return 0; } @@ -84,8 +87,11 @@ int wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags) return -ENOSYS; ret = ops->start(dev, timeout_ms, flags); - if (ret == 0) - gd->flags |= GD_FLG_WDT_READY; + if (ret == 0) { + struct wdt_priv *priv = dev_get_uclass_priv(dev); + + priv->running = true; + } return ret; } @@ -99,8 +105,11 @@ int wdt_stop(struct udevice *dev) return -ENOSYS; ret = ops->stop(dev); - if (ret == 0) - gd->flags &= ~GD_FLG_WDT_READY; + if (ret == 0) { + struct wdt_priv *priv = dev_get_uclass_priv(dev); + + priv->running = false; + } return ret; } @@ -154,6 +163,9 @@ void watchdog_reset(void) dev = gd->watchdog_dev; priv = dev_get_uclass_priv(dev); + if (!priv->running) + return; + /* Do not reset the watchdog too often */ now = get_timer(0); if (time_after_eq(now, priv->next_reset)) { From patchwork Fri Jul 2 12:45:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500063 X-Patchwork-Delegate: sr@denx.de 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=eZxF/8Pi; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZb12fsvz9sT6 for ; Fri, 2 Jul 2021 22:46:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BDAD7829FB; Fri, 2 Jul 2021 14:45:41 +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="eZxF/8Pi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F3058829F8; Fri, 2 Jul 2021 14:45:32 +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-am6eur05on20712.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::712]) (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 85C278291E for ; Fri, 2 Jul 2021 14:45:22 +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=gYemV5Wepp5tS8JsjHOCN7facQHN7PKa+m3Oxxh2jfyo8D+tPaNrcIoh84Y9lxknQc4lakM5ArzpNquU8hZWsL5yMTBq4uGogFd/KhpUu7dn1b8pnEttu4cfvO2+MNJBacDGy1CedRgNihG+4hirAQ45N1gEQR7rZbUEJeUjHS2P/p1TbRPQ9z9ImPKKsqFzfy/r5k1Mzug2BWyS3L1ghD4WScHBw+RG4pZoE7Dbxlvd3Y6PKdd4p6hcd0AiBG28Gzwq0Joea1GQ39J8Bw8PTXWf+U+SGiURR/SVAMMKul2Ooo2opsmTyL9RgxDjNgRpG9K/ilubAfYC/ag/KA97cg== 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=UarR0ZtbLywXb1h+IK32GP8qDkwjGxI0U2yCn5IvE4I=; b=hmPv6DpNhpvbAQKJEDasCjE9Nr4Rwr3s7ytoRWp8LqqXME4ZIaX6PVOJku4E4yfAe1144Jqw3wqZXsoTBGwAZc/92gFjKnBbcR4Wc8ZiqKi00sIhCFqkMhEE/jCh2J38++HJygIDpC+urTj/g84QDeW1NZ1RpSXpCdBZ3uIRNr+oXbp6tsYv+MhQmFy4LPWMsRKLLkGg4yQDDVZujvVRPh9zL0GNZ5LDEBIrsdV63Mhv3gtIeanwhT5oTJfJGQCtjc+VdCahFDIy8Q5iNUq54yUhhedVhtY0YbEfWFdt9/9gTqDdeg5jKvdxDi/w5UoFckeEWSZew9BY1gKePSmPJQ== 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=UarR0ZtbLywXb1h+IK32GP8qDkwjGxI0U2yCn5IvE4I=; b=eZxF/8PiQYD9o2QaFzPLQ1uqyoTP+EoD3Pt1CGcdlgEFYxqNbZ1HzqTuP6O7Qs1xSWS0rqXtkod+pdOTNDSNtzzBD2/uTIvxQ9yF46cGZe+uCR6caa3teicItOlxlSKIda4nr5Ro2FklbCXIgrPrdjm9NWFBWm4gIGkDjIdplPU= 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:21 +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:21 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 06/10] sandbox: disable CONFIG_WATCHDOG_AUTOSTART Date: Fri, 2 Jul 2021 14:45:06 +0200 Message-Id: <20210702124510.124401-7-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6174dbe3-9dc8-4cfa-ee6b-08d93d57413e X-MS-TrafficTypeDiagnostic: AM9PR10MB3990: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FxXHBRwqdCPAbSi1hExduwoG7FvrSavNqlldoXZGHTfkNWTuEzhhNPoLZktJygmN8i1UbMVNpoDMupes49lWm4ordn5SIOL6W1Rct28JgxfHn3uu7q2b8NFHEjs8OW/is1zprC/sBSSpVJFmSPS5XvN6daFKf5+Ebqsh9vUsA1sDbyXic2fqvjggW+Z9Az9BYvkrAuOONpCcyHXfkFs2Z+mHyrDld5k8X4z8YdFUb7IXTtg9vQnaIdqnkdBdw4j3x+Uhj2xv4NJ9gUmqICLZ0zK3tOH6kQz7aRralmPrNU49G7NibI3Xq4vcHcbTPEo2plBNOA9zGt3nzNJrKnKyT8YnNVrvhp1xuHAJBZLDhUWiDeKynKsuS/UmBfzNCrRF8hLdAlxOUUYUr1pFiJm9OV6MZye5IueFvONxf6GhWA6ZCBWAsq8fvsZuVwpdONRzRTQD2mK6caL6dpjUIux27y6AF7H2VBkMwexcBCmgXSiVL5/wj4KhQFcmKzM3dQIwVMV2utYdx6up9u5RzteD/ZmA3sDLt4Ez8Egt7RXbvbNIX5NWmL7u/YsuqaHm8TczAZyJNG9NkiGMw2OSQP8YwkqRcva0aVyrMMGrfkZ23eQOotmSrYouVHLCKuzKqkq88En9Hfbpo1uqlCIOqWL8y/q6JH5Unxilq6x+ikRyfHcO+KSD/K0JFV/12AN9OVYEAW2Wxr0Pxl4iFphLaTDS7w== 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)(86362001)(8936002)(66946007)(6666004)(6506007)(66556008)(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: xYUnkZW2+UXqbalUzl7duDmD4mNi0qtiA7nTB9+IUR18BFxN+5s7jJJHg16UDgAC+YCDBmA5Vi0E1BXoSVYG80Ww2oMKrLv9UeLrGLk0xKnNbVxF1i4AKRJCnaq7RvB2saM9OCUNXz2XfLggtbjrSvCLxu/T7qosiqyBvlXKZo83ypHLYzvY65Cq+RX9zxtsscvLG+MmHkOcBXYJ2SvtN9F6M9s9p6KPH1lQm+vGMG3duawBERe87BNCxWWX4CmYPyaKBhWFvZmY7Jy9GGHX3558oV1KPtOWpBF3sI7vi5XfuZs45cz6wIYmjqyjb2t71hcH/bHsaTz9oO08cgui0rKocO6Vhzv9SR7qIxjJu9vAcg4ZgfuvvG9afi1LrYdFpRMw36TyH4c7xky6Ww4ap4T789wGNckqZVlneanHua5qCVEagB1egjs3rtHDotrP6u5HNhbBWHb4ORw5hPhGaZ7PtCc3v+NuzcIhGtHgDMzd8oKzEnfko7D9yE493LFR+kxhKWCNaceLKIrOQu0vgJdQy3+kINU4/16B91jbW47oxq25buqt5zr60BZKaxUQcOeNN1o5rxxQhcrbLLcyHdLCQqGvNUygrS76S4e0HYA+JKxIjeY27nPxUskZPpQd7QAc3pBjwQGSS4RAt9rKwVAum5V2Adp3O/TXj++vdNkNEGIAZG8YKSXLzKdUeWIxS/DfR9pC6XO15L64UDtwlgJyTzjc6oAy3E5PxFiR2e+vFCG7CL2MutRttIcgo7STdmn7T4V9TghdEMPlLDyfztzNgfWUiX448td6Ljzm3oaOZsWy2xDT2PngI3QKmEjyWM7sw28Nz7EZiltSDPob7ckDRRq3pjbpi6sgdMbhRObNdaOORvgjsLQ8ObRFRPsvIXF1ioS/tiJk3hiqP4KFmcG4YftBjIjzcSEJZOPQbI1Zrujvcb+ze7JkRVz7RA1mIH2W0wMlAd+q8GO9FBR/UVdDxnJ95yxJdmRrwzxV80vcjJGv/8t8nwBZ4MDLVTQjickDrruNevy4W2I/NHu1wv3Ofg9hfEi6Vvk5RFfPB6skKP/j4Jqkdmpj5XGrZL2GoT2NUO/6OkP6w1VlX7ErBBnI4zIo7x0WwPoSqFMtUBayU+AbVw7nlr/kh1mHNdH1fELB1LU1wLIyceooH6gOMOdXM5/1LSo9hHMrb38ynjdRYZvHPgelSoWGKiOO3UpR+vK8bCpRddDwguSwVDcn0lWI4RzUzQ5U2WuhR9So2/F0ElllQwQpW4pKWDmG7cSv8ctj7T4wdvaufqmeTtOVsJjBOWvGaOevPkdeMT4ky9boS9k50Dz65hgN+8wd6clJ X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 6174dbe3-9dc8-4cfa-ee6b-08d93d57413e 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:21.7077 (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: KV2BGvUUR87L1NFqF3A/Z5x1GFR0h3ykYc7oxts0hp8+11zRL/Bf+KoMCr0TQg9vhLWM19Ktbpa6U2cYO3HRa6O1FKz9Onhza83tb/M3VXA= 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 A later refactoring will put most of initr_watchdog() into a .post_probe function, which means that all watchdog devices end up being subject to the auto-start functionality. For the unit tests, it is more convenient if the tests are in charge of when the watchdog devices are started and stopped. Reviewed-by: Simon Glass Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index fafa85a5c0..bf436963ec 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -223,6 +223,7 @@ CONFIG_OSD=y CONFIG_SANDBOX_OSD=y CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_VIDEO_BMP_RLE8=y +# CONFIG_WATCHDOG_AUTOSTART is not set CONFIG_WDT=y CONFIG_WDT_SANDBOX=y CONFIG_FS_CBFS=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index f279bd1a0f..56254e1ea2 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -270,6 +270,7 @@ CONFIG_W1=y CONFIG_W1_GPIO=y CONFIG_W1_EEPROM=y CONFIG_W1_EEPROM_SANDBOX=y +# CONFIG_WATCHDOG_AUTOSTART is not set CONFIG_WDT=y CONFIG_WDT_SANDBOX=y CONFIG_FS_CBFS=y From patchwork Fri Jul 2 12:45:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500065 X-Patchwork-Delegate: sr@denx.de 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=NfqVLt70; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZbR1wJnz9sT6 for ; Fri, 2 Jul 2021 22:46:59 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 300BF82BC7; Fri, 2 Jul 2021 14:45:47 +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="NfqVLt70"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D12DF82959; Fri, 2 Jul 2021 14:45:33 +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-am6eur05on20701.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1b::701]) (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 25E1380C70 for ; Fri, 2 Jul 2021 14:45:23 +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=VqEpS1TKnhzUIuWfZ5yUR0JZ1D/u6s+IfsxOEJHNZO9ywRpW69NURVxPbNraVsFPWD4UI8nGw6v/iTCx+4nCNKla0hH0BaclfkJEn45wWN/inlfY/YCns5b2HmeyKkG/VC7rF7wfQj5JAmMWtd4p2h8AY9iQDARiEFsvQKgjDP7p3GI5dlXZ/nvJPKojZIJoOw618q7qi5RSEK7QYd/v24KeKtXuNqskMu+0fisbJdm5R9+c6A/xIRr0eQtiT8Jkl4DtGGVQlmi67iUgKnclullIlGWOiePosK3HBhDEK9eYdoW9xSVAd+Ff97W6YCGsxDmz0BVm/MKJ1kHJKIjzmQ== 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=OZTPWSLRdZ5/DGbS6m6S9Gb1tQldSN0fUBBQM5+vbxs=; b=T0XeJ4FxCr+NDNiMQZMXjGYpe4+LNjDYY15P3v4pufcZatUy+zcl8eLxALbOoCW4aQk3W1k4sxemFVZaGiwyLNr2fA4/s0XYbY6o7K2q1UuYU8HXQZrRyDSujjpd+J9wsiFw/koCevCxfDXnsAQWgMIi9Lrj5O7w+EyOayQXAVpHa0+tQC9xAHzVo2ysxXwxtC5BTq6lOhdg9zyB4tdiCJ4H5EJsLSjaMXOmoh/Z/h4l/9JrlXZI9VmaJbCyN70Kipb678vRD+dyOjzhrwWNjLv1BfefKT+R8Jv6FU677hMnJuLQDtKToNpetSvhXxMhf59cfcr6hp2AWUI3vXs/IA== 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=OZTPWSLRdZ5/DGbS6m6S9Gb1tQldSN0fUBBQM5+vbxs=; b=NfqVLt70Uuuwcjt11liIPLFQrThHR/OTo2L4G2+1pIxC4u7FSHrJ0N5rngpTn/4tXiABt4N6U0Psaf7+1xnMDlBryFXpGvWmu20Ly5+Gj1h9wWbreI8+IX2fw1nL1mRR++7NuzTm3NTn5tIJA54MFt5n25E80SKWb3h4YXYc4bI= 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:22 +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:22 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 07/10] watchdog: wdt-uclass.c: handle all DM watchdogs in watchdog_reset() Date: Fri, 2 Jul 2021 14:45:07 +0200 Message-Id: <20210702124510.124401-8-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 07398178-f8f1-401f-42ac-08d93d57419c X-MS-TrafficTypeDiagnostic: AM9PR10MB3990: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2887; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bh4o0stXG6jdrSFFW/eIFKVJxKhQ3rvYF/pYv8R+8MyL3QH3s6wYDOjxvOkMqLa4G24HIziD4OoT4D417A+bqe+BxuIS+BdytfKGtNswbOwrgE/nGJmwKmczTL/w5cS/G8OvYxrEPHcIW2DXGi04EcLXg1wtJI4VcGX4JN5U4U/LcBU+nXGmM6lTs9jjyP+wejtQcspogLYUEtsPfRr+K3HU8vH9hqQFQ7wB3YB5Y6MPVGiSWKe2IoROqXw0Quo/YuAENA17f2FzfnlRUbWG8J6CCSYlwXaUgmL3QZZHkaHspjU+eThbmPn8OI4U9m3zIZwF81TFHI9TJ5EkzZbC/oXMx47aVWXd8iK0Q931MrWApRqAm07a/DSsJYOkf2smAgr0QD5ZQzUbwdDszYXYj6ysq4IPqYlZgAOwE0ONn9O5Mnt7UuVWRtgWCJ8Tl0P6d4Wzarp0cCSmRWlFxqsu4r6AS//wcldbqA4HkaycSViRuPQeDLk3Z5U5ozheQajmkOPMSQjR9ccndUyZRtYklVEa0wonQ0GhMDKmT4KOqF4431OCV+62Kt75UpQyTGvqpLV/JuJbzDc74lwMoE0Xxv66Fbh6zDztAbcDiow8+Sj1CyTPZbtV9EdDyN+L4pTN6UfHY7m9JoTNia/ZO6Z8qH2rSdiLFCMRrZlRsGT4k4KV0GOf6/Crd6Q6hjw+CU/t4gzpN1uhH78/TKLde3nreg== 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)(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: O/WogFXwjfHzG+yXXCYdwq6ynQy86TEr6VUavFTdQMqQVRgxnbXnt0kctB/cKE90gHtfn/7/xDYekOx38BQcamyrRyylcubaHMF9IYFfgXBjv45Ap2lD5DfTi7CLEZpMQtG49Rq9pHCkaGbLDSjaymGL2EMYeeunCR2fc0HIQwERtNc5CkVE68oyKKnVvffu3MfvOoEAWszPIwgmar+gbc19+NwPF0Uyn5pcYGcoQ7m/xtUs7476Bkh/y4+wuRLBqtzqOIwMvXYLUjn+5VEm0/nJT0I1mSblcs2hGWMv3yVjmRM/NU/FGYzv+5jjRtCH7wzB8ZJjpCgqQ5uHzNDpimIp2TALMm4rwElriXdUAoOtZbYhFJHpyiXBlFtt2fIz7KYxzmfz0xbQh5zm4XDOb9gNG1IsKeWl/vwaP2exje5jx3pvRDDCiLwKTRs7rBXOevVXfv5xumRgtHokIGVjvk5x6cOImj8thobygatlAJn7KgQzdJN6ewv3TPY7mmQ8Q1IT3svz6NIOpWHo69dI9jLR7FDuQMUkmj8hryPHwIczzG07Pxai4M7CWdfoH6v+tE2LJ9DeW/WF3OJ+XDFHKxct3dhjJ43ctS0MORdjaVg/FaxRctZOSYMiSlyJ6qyKWdQ8rUY8Y05eINhVEdqOC8NTw78bK8oASE24/jDBq6PjzQQszYn7Uw8+NuOq/SoI6bO5dIFYOjalTuIz5YM+goIvP12At87CimOS5+NqYroFp+Q9RyKjwtXY2cZgnu0b01CaNcmmck63bzLOf4urtMgGX9d9SJZsK+vDdC+WYvQwmgbWb48xC8atmQbQVdB7GtOvU0rx45JfxbrkMpNWiVseHCJbj54YCHK79qd7bKtvRtaH3okUtNbwI8ExbVJpElEd8aiADhoo+CLKX1Uu3XTrbIUkPN/9t9jGAbvnT3xTouVa+QTPl2QesVL0uaRWawADLbJWscGAG+A+3NYTuu431yXyz875nnWhJIcNh0KU1pEOGf4c5Ip9FDTFmAszcB+U0yP7g8VA1TM5UCKsW4h/zJ301verXBwoJedPT3SA3miNbnSNSdegMYqLKsm4SykeqXXJsoo75bmBcI0NqdhfggXvRtyelSoOX1ZLG1HdSIm+WIjLRhgXGNj5MqEZaDsAKiHc0+KlcSce5Fn1APfj2u7mDDNDIkGm2FQcwcRmZmnZjnLwT9pazeeaVeWqyx/7hoAei8k+punZ9H8jf0tofwjQV6lO0FoLnyOYcGAlqF2X/sfPlBIGrYymOp/MXaXpS1vsmm5aa4hhj+RNK/IaiiMDYNmjaXtNSs4W5M06KBusnenX8oQD6o5r+2Y3 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 07398178-f8f1-401f-42ac-08d93d57419c 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:22.3113 (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: XU8pXRwTjSlvRvwrDluQnjWnaF1NCKsnc6gFZdaHeUK9O56KhrPdtMGxUx8gAphvnbDSUQXYz+zX5qYxYEMu/BLnK191dx2hPt9tbsTvct0= 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 A board can have and make use of more than one watchdog device, say one built into the SOC and an external gpio-petted one. Having wdt-uclass only handle the first is both a little arbitrary and unexpected. So change initr_watchdog() so we visit (probe) all DM watchdog devices. This essentially boils down to making the init_watchdog_dev function into a .post_probe method. Similarly let watchdog_reset() loop over the whole uclass - each having their own ratelimiting metadata, and a separate "is this device running" flag. This gets rid of the watchdog_dev member of struct global_data. We do, however, still need the GD_FLG_WDT_READY set in initr_watchdog(). This is because watchdog_reset() can get called before DM is ready, and I don't think we can call uclass_get() that early. The current code just returns 0 if "getting" the first device fails - that can of course happen because there are no devices, but it could also happen if its ->probe call failed. In keeping with that, continue with the handling of the remaining devices even if one fails to probe. This is also why we cannot use uclass_probe_all(). If desired, it's possible to later add a per-device "u-boot,autostart" boolean property, so that one can do CONFIG_WATCHDOG_AUTOSTART per-device. Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- drivers/watchdog/wdt-uclass.c | 96 ++++++++++++++++++------------- include/asm-generic/global_data.h | 6 -- 2 files changed, 56 insertions(+), 46 deletions(-) diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c index ca20c124d4..0972541148 100644 --- a/drivers/watchdog/wdt-uclass.c +++ b/drivers/watchdog/wdt-uclass.c @@ -35,44 +35,23 @@ struct wdt_priv { bool running; }; -static void init_watchdog_dev(struct udevice *dev) +int initr_watchdog(void) { - struct wdt_priv *priv; + struct udevice *dev; + struct uclass *uc; int ret; - priv = dev_get_uclass_priv(dev); - - if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) { - printf("WDT: Not starting %s\n", dev->name); - return; - } - - ret = wdt_start(dev, priv->timeout * 1000, 0); - if (ret != 0) { - printf("WDT: Failed to start %s\n", dev->name); - return; + ret = uclass_get(UCLASS_WDT, &uc); + if (ret) { + log_debug("Error getting UCLASS_WDT: %d\n", ret); + return 0; } - printf("WDT: Started %s with%s servicing (%ds timeout)\n", dev->name, - IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", priv->timeout); -} - -int initr_watchdog(void) -{ - /* - * Init watchdog: This will call the probe function of the - * watchdog driver, enabling the use of the device - */ - if (uclass_get_device_by_seq(UCLASS_WDT, 0, - (struct udevice **)&gd->watchdog_dev)) { - debug("WDT: Not found by seq!\n"); - if (uclass_get_device(UCLASS_WDT, 0, - (struct udevice **)&gd->watchdog_dev)) { - printf("WDT: Not found!\n"); - return 0; - } + uclass_foreach_dev(dev, uc) { + ret = device_probe(dev); + if (ret) + log_debug("Error probing %s: %d\n", dev->name, ret); } - init_watchdog_dev(gd->watchdog_dev); gd->flags |= GD_FLG_WDT_READY; return 0; @@ -155,22 +134,34 @@ void watchdog_reset(void) { struct wdt_priv *priv; struct udevice *dev; + struct uclass *uc; ulong now; /* Exit if GD is not ready or watchdog is not initialized yet */ if (!gd || !(gd->flags & GD_FLG_WDT_READY)) return; - dev = gd->watchdog_dev; - priv = dev_get_uclass_priv(dev); - if (!priv->running) + if (uclass_get(UCLASS_WDT, &uc)) return; - /* Do not reset the watchdog too often */ - now = get_timer(0); - if (time_after_eq(now, priv->next_reset)) { - priv->next_reset = now + priv->reset_period; - wdt_reset(dev); + /* + * All devices bound to the wdt uclass should have been probed + * in initr_watchdog(). But just in case something went wrong, + * check device_active() before accessing the uclass private + * data. + */ + uclass_foreach_dev(dev, uc) { + if (!device_active(dev)) + continue; + priv = dev_get_uclass_priv(dev); + if (!priv->running) + continue; + /* Do not reset the watchdog too often */ + now = get_timer(0); + if (time_after_eq(now, priv->next_reset)) { + priv->next_reset = now + priv->reset_period; + wdt_reset(dev); + } } } #endif @@ -224,11 +215,36 @@ static int wdt_pre_probe(struct udevice *dev) return 0; } +static int wdt_post_probe(struct udevice *dev) +{ + struct wdt_priv *priv; + int ret; + + priv = dev_get_uclass_priv(dev); + + if (!CONFIG_IS_ENABLED(WATCHDOG_AUTOSTART)) { + printf("WDT: Not starting %s\n", dev->name); + return 0; + } + + ret = wdt_start(dev, priv->timeout * 1000, 0); + if (ret != 0) { + printf("WDT: Failed to start %s\n", dev->name); + return 0; + } + + printf("WDT: Started %s with%s servicing (%ds timeout)\n", dev->name, + IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", priv->timeout); + + return 0; +} + UCLASS_DRIVER(wdt) = { .id = UCLASS_WDT, .name = "watchdog", .flags = DM_UC_FLAG_SEQ_ALIAS, .post_bind = wdt_post_bind, .pre_probe = wdt_pre_probe, + .post_probe = wdt_post_probe, .per_device_auto = sizeof(struct wdt_priv), }; diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 47921d27b1..b554016628 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -445,12 +445,6 @@ struct global_data { */ fdt_addr_t translation_offset; #endif -#if CONFIG_IS_ENABLED(WDT) - /** - * @watchdog_dev: watchdog device - */ - struct udevice *watchdog_dev; -#endif #ifdef CONFIG_GENERATE_ACPI_TABLE /** * @acpi_ctx: ACPI context pointer From patchwork Fri Jul 2 12:45:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500066 X-Patchwork-Delegate: sr@denx.de 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=J1LlLaeY; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZbc6dPXz9sXS for ; Fri, 2 Jul 2021 22:47:08 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 31FB482BD8; Fri, 2 Jul 2021 14:45:49 +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="J1LlLaeY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE4708291E; Fri, 2 Jul 2021 14:45:33 +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 EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0716.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::716]) (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 95E9182959 for ; Fri, 2 Jul 2021 14:45:24 +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=PLO8KB63z2b+KMKttc68cBOURsOL8xqjGda11kzeTauxM7+fkS0M1Owu3Ia9qHwM1qJ0LE3v31Ek2RZgDIESNVVdTM4JoQwizNeeHz47cyED6oRkabYzvIyM44eVHHB3kmwlODi7Qym52MYyxZav0rK1tB0DE0CfSLqxDrkdgoILg04c3SvrNeMmtPBFVIHNjDJRtNLH2oNrAsAaSTpR/TsmaMJ9yId4eapvo13YERL3VVfP90FMkIyHO2Wbppq01gefb/udtU0excnqyAPfEw3ch0Qqnz0y9tUwUAhZov1IJKSSedZQelGnzkqjbF2UZRX5htH8pnL5w4cM6NAwYg== 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=wVHtMlh6BnVxk0kZ3R9jr8TMp7CoyIL9ebyTI90EULM=; b=jIXjPkIhPnhdvPvxqHR9m8XREVXpX4R1GCaxycE50L/UfjYwnYjTht+aCfjk54M877v+2c8Gh1cdaRrU3T3go3W9gCftHhyES7ZKen6k2XnWpJR8Khr0EUpjz/Ejt2h056QD9/Z6Q6JqgEMLEyBqn2JfnaA4z0KMZS+vLvacbLiCTfGY3+sOH3Rxus45XB2aJaZdY+QVZILugTkUqm0bKjZzIYE6qwaCxrDdGNn3n1YyfXbRsRW2HdvvMvuN1N+C//MdUtc62RLCMhedLwn3mcVpmVDwgXYs/vtOE1Ejy0imw3qU7V6A8bguVQDy/4JVXqk1EolyPM7HBhGSRFbfIg== 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=wVHtMlh6BnVxk0kZ3R9jr8TMp7CoyIL9ebyTI90EULM=; b=J1LlLaeYiDZ57rit6BbjMqeH2VCxAfwuI14zcj0dvunof8M1uLlh5WwPqQHnB5Ato6TtsuAIWX42EHpLz11Ju5aIIyAk9hotzHoU8wsrlZBWgONo9bXhKETGPkPB00pBrZUErfxHD4nGN58gXN0gjLSsBMRe49n5jdJTmbFOflU= 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 AM0PR10MB3106.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:12a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Fri, 2 Jul 2021 12:45:22 +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:22 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 08/10] watchdog: add gpio watchdog driver Date: Fri, 2 Jul 2021 14:45:08 +0200 Message-Id: <20210702124510.124401-9-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9cadf440-2ef3-42af-d095-08d93d5741e8 X-MS-TrafficTypeDiagnostic: AM0PR10MB3106: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m9YVqgvqbgnZbiSxg3scI/6nKWxeoj9m9XwVgpC1+91yk5Bqnkkcmbx9A3KfsAjegxRHJJGm+dkoik4Lvxov+FM/Et1shtATjBapl9pe77fOdCrFXSrPhUuSuLm2Qzs/mj/4yFgb9ragAdi3JBX4zxW1/rBrMS+KdRx93LASNgtoeDsACWoS0xsFjRzxFdwmHOlIHOERmnq2efakhw8V4bJ2xoqWsCMrO7pW6jtJ/sAmO1rUk64GeokU+O6skl76S13/ahznJJfEPNdOhHalDUwGA1TLtS+CN23iSD1433r6rnXi0mbO5MAXsBYtO1nXGIw4cbZR7dvtq82I1h54IX8jm0MIH9HzvDbjgWC2146viUQBZS7QXvYgXKpcBChVUw6GVebN2ObnaCeVsyt06Gc07+diREPVBNDOIzJsRABpq+gUPyPpK3oAfTyo0QR/i7+Ln0+oFloTuSLtAxedhwi6GWTKvmkKu//60sHZ6lrhGDO7mNCpvkMOONfBq/hh8ljg98ko6g7bgauJUVhbbTTsyEiJY3toATg6HKP++0W884h3WJWL68rH0NBnKQwsMzfiJ3nIZLtSdXSRoxK1Z1l+6CwcngX6sGoC5DKJsiqTSc0Hks4YR8yP0fHWnfy9x/L2cJx44kxosfgWIpCcgxAEtPa2auv34FG5KitMX4nBq/iM+Co11dreWflokceW2KXWOggh63uCSEFjEdC9+uAoGlGdVaks5WbtExPl6JYWQNekm87EgB7MNDcH+JFMH7xof78YoR+Br6jTPwmdrdAFjDFK+y44aw/B0G9hxom94cX95SMSdIXvrJUSlRsOiSRqTf8FZ/FPP90h1w2q4g== 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:(396003)(346002)(376002)(39850400004)(366004)(136003)(186003)(52116002)(1076003)(956004)(16526019)(478600001)(8976002)(38350700002)(8676002)(6916009)(8936002)(38100700002)(6666004)(2616005)(54906003)(36756003)(4326008)(66556008)(86362001)(26005)(66946007)(316002)(966005)(2906002)(83380400001)(107886003)(44832011)(6512007)(5660300002)(6506007)(6486002)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m26xhCeDeOuOrejXnr1AHNdi2gerqjXKjlNGy5HxUPcyOVpZcNWBoUNh6FhzYUveMOdf8Gb9eAWzCg6s5Y1cC6kCX2LIStV6VZxE2BquX+brNBjHRWtB7kJlHUBedTx71fM+xrUSzj3x46WB5sKJZB7Kqtjfx+8WZW6uX0ngLCSupIXHe/Otu15E0s8Ul7zYzFfDej8jAvnjclRiYPDEGt8PA7nAiaYJHLzT8Ir7tAw19RJ6meNma/4kyp5hYMm00eM50KOtX6On8lsPl4v1ncTTwVYQk9tEh1ChMs+BZEfcqg4Xm1pCD+5N3f//tPcfzU0n+5jdcQoPBD9Zxb9CgNSr5bWsxCYhHWI5OSn8/YnCCO3UUgBY8/sFBgd2kgBKFPKT4+fUmi9Dff6PbqwrXmEcQfx3wkP/VVqkRirXywaMihgDe7VSSA/Af4wZdLDUcW3f/BWf4cF0NeOm1eIc4D3YCDzeGV8StJ0MGRCgUm5LF6CaT1R7aMKEu8c485P2Ik1QoS++7RH3boeSZgsVL8qnM3ONwKSp1dBEYCU+9ARrKdPBtz5SqyakiCvePt27jy1ylbqklkCTTX/yB0nksRvY8SUpGFdkf8YyOB8BzYCtZMDyAawZJ5S8+QYrguVDuE7u9rCEDchBga4Xwq5szbak17I7S2kHtYzontbSD5XOaxT4tJFRpLKtsHDv++Lu9gVsoBtUrgMZKyDE+92iR+XqBN4++chSAOTXDZiuo9FgClCHh0yF/yXMwglTrX73GegiuLTSqBScYa+TSihJEkwpZ0qjscYRpfbvEL2hmIv0wYpsG8rYFJb6CTr5NEcPF583ofsfxTMd9eu6zamUaf+kwiRM4BmykptAdWhRf+2w/F/sz7rHcq3kpw1nYctoxmcN3gs2l9N8X0BuCBMI9YmxKVf0WACbTP9e+VxASr28mbEfzOUpOcL/3uTmsIjjORfXZE9bShMHHBj7ZJpj3lsAN8h0OuJ47fnGobR4zebr8J4DsST97hsDGqVmAZCid7kUjAluhaaptWGJVw4D0s3JJCRFiSrufaQvCc9rjFK5EtZWA8z/XYvvqCioc3sixKCrAVlpy6ygIql93PsPgGRSYop6eLLrKcqtt7s6Hr4utNePoXdwY2WUYPwYwNrz0nMvVPSoqOXmbZRJ8yE0EkGo3SLlBIERNLjgli4jG9WMSDhtMgMB80NRtT4KGNtQCw3GqF7DwQCWTi40ul523V/JXYzNAuB+gzFSc9mDwqzUaCfj7wrAHgKupcCyZ7J+VjYaYeYyrObNK81EYFLaWar0Dt/ao8VCoCkUpX30jqdY7LI93E/PmpwweFvZ10PL X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: 9cadf440-2ef3-42af-d095-08d93d5741e8 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:22.7891 (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: CqLkF62WKqwhz0lnmpEDMxwj+e2LcvhSzLr5TIJUFeWwzLaey+A06LrfH6Z1QpGzAxFyQJ/0ScMW2sgDTVrSoN4cnt8DmWxNum6Exnm0Km4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3106 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 A rather common kind of external watchdog circuit is one that is kept alive by toggling a gpio. Add a driver for handling such a watchdog. The corresponding linux driver apparently has support for some watchdog circuits which can be disabled by tri-stating the gpio, but I have never actually encountered such a chip in the wild; the whole point of adding an external watchdog is usually that it is not in any way under software control. For forward-compatibility, and to make DT describe the hardware, the current driver only supports devices that have the always-running property. I went a little back and forth on whether I should fail ->probe or only ->start, and ended up deciding ->start was the right place. The compatible string is probably a little odd as it has nothing to do with linux per se - however, I chose that to make .dts snippets reusable between device trees used with U-Boot and linux, and this is the (only) compatible string that linux' corresponding driver and DT binding accepts. I have asked whether one should/could add "wdt-gpio" to that binding, but the answer was no: https://lore.kernel.org/lkml/CAL_JsqKEGaFpiFV_oAtE+S_bnHkg4qry+bhx2EDs=NSbVf_giA@mail.gmail.com/ If someone feels strongly about this, I can certainly remove the "linux," part from the string - it probably wouldn't the only place where one can't reuse a DT snippet as-is between linux and U-Boot. Reviewed-by: Simon Glass Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- .../watchdog/gpio-wdt.txt | 19 ++++++ drivers/watchdog/Kconfig | 9 +++ drivers/watchdog/Makefile | 1 + drivers/watchdog/gpio_wdt.c | 68 +++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 doc/device-tree-bindings/watchdog/gpio-wdt.txt create mode 100644 drivers/watchdog/gpio_wdt.c diff --git a/doc/device-tree-bindings/watchdog/gpio-wdt.txt b/doc/device-tree-bindings/watchdog/gpio-wdt.txt new file mode 100644 index 0000000000..c9a8559a3e --- /dev/null +++ b/doc/device-tree-bindings/watchdog/gpio-wdt.txt @@ -0,0 +1,19 @@ +GPIO watchdog timer + +Describes a simple watchdog timer which is reset by toggling a gpio. + +Required properties: + +- compatible: Must be "linux,wdt-gpio". +- gpios: gpio to toggle when wdt driver reset method is called. +- always-running: Boolean property indicating that the watchdog cannot + be disabled. At present, U-Boot only supports this kind of GPIO + watchdog. + +Example: + + gpio-wdt { + gpios = <&gpio0 1 0>; + compatible = "linux,wdt-gpio"; + always-running; + }; diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index f0ff2612a6..6fbb5c1b6d 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -147,6 +147,15 @@ config WDT_CORTINA This driver support all CPU ISAs supported by Cortina Access CAxxxx SoCs. +config WDT_GPIO + bool "External gpio watchdog support" + depends on WDT + depends on DM_GPIO + help + Support for external watchdog fed by toggling a gpio. See + doc/device-tree-bindings/watchdog/gpio-wdt.txt for + information on how to describe the watchdog in device tree. + config WDT_MPC8xx bool "MPC8xx watchdog timer support" depends on WDT && MPC8xx diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 5c7ef593fe..f14415bb8e 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -25,6 +25,7 @@ obj-$(CONFIG_WDT_BOOKE) += booke_wdt.o obj-$(CONFIG_WDT_CORTINA) += cortina_wdt.o obj-$(CONFIG_WDT_ORION) += orion_wdt.o obj-$(CONFIG_WDT_CDNS) += cdns_wdt.o +obj-$(CONFIG_WDT_GPIO) += gpio_wdt.o obj-$(CONFIG_WDT_MPC8xx) += mpc8xx_wdt.o obj-$(CONFIG_WDT_MT7620) += mt7620_wdt.o obj-$(CONFIG_WDT_MT7621) += mt7621_wdt.o diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c new file mode 100644 index 0000000000..982a66b3f9 --- /dev/null +++ b/drivers/watchdog/gpio_wdt.c @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include +#include + +struct gpio_wdt_priv { + struct gpio_desc gpio; + bool always_running; + int state; +}; + +static int gpio_wdt_reset(struct udevice *dev) +{ + struct gpio_wdt_priv *priv = dev_get_priv(dev); + + priv->state = !priv->state; + + return dm_gpio_set_value(&priv->gpio, priv->state); +} + +static int gpio_wdt_start(struct udevice *dev, u64 timeout, ulong flags) +{ + struct gpio_wdt_priv *priv = dev_get_priv(dev); + + if (priv->always_running) + return 0; + + return -ENOSYS; +} + +static int dm_probe(struct udevice *dev) +{ + struct gpio_wdt_priv *priv = dev_get_priv(dev); + int ret; + + priv->always_running = dev_read_bool(dev, "always-running"); + ret = gpio_request_by_name(dev, "gpios", 0, &priv->gpio, GPIOD_IS_OUT); + if (ret < 0) { + dev_err(dev, "Request for wdt gpio failed: %d\n", ret); + return ret; + } + + if (priv->always_running) + ret = gpio_wdt_reset(dev); + + return ret; +} + +static const struct wdt_ops gpio_wdt_ops = { + .start = gpio_wdt_start, + .reset = gpio_wdt_reset, +}; + +static const struct udevice_id gpio_wdt_ids[] = { + { .compatible = "linux,wdt-gpio" }, + {} +}; + +U_BOOT_DRIVER(wdt_gpio) = { + .name = "wdt_gpio", + .id = UCLASS_WDT, + .of_match = gpio_wdt_ids, + .ops = &gpio_wdt_ops, + .probe = dm_probe, + .priv_auto = sizeof(struct gpio_wdt_priv), +}; From patchwork Fri Jul 2 12:45:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500067 X-Patchwork-Delegate: sr@denx.de 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=jATjykpP; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZbq6t9Mz9sT6 for ; Fri, 2 Jul 2021 22:47:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AA5DE82BE0; Fri, 2 Jul 2021 14:45:51 +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="jATjykpP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3C96C829B9; Fri, 2 Jul 2021 14:45:35 +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 EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0716.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::716]) (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 BDE56829B9 for ; Fri, 2 Jul 2021 14:45:24 +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=gNq2QGukBJ5DL2I8Q9iP++FxVaHYk5dijPnfS0YFLZvGx96dTW0vCNhWfXIDmqh9cgZQW3ZdfjKXXjPN647LZUUkvr/WTcQdyf5ZUmgYXYTZNUryP94D8vfSjXxbrsXPgqpw5sr0AT8i1zzGfy+pg7k7nxqZtu92BJTad8cNUK3DtqYLcWkEmbcyKIePKtlDlZpiRt3sx9zEKRwjbFwDdyXJ/i7KkuyobP5awpH57dEDIDnc8fhP/D8iJW/7e0HRe3UiLcVctRXhXrXuMktBZtiaqOHiB1mkjhT+KZ3xNDQiiyoXflCsyDvgWm4RqPXzITc4yt5JDw9kcglolVrSXA== 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=JG6FP4NnWrd9zMAn7BBBU+uqD4xmmRgoyQEm3d3S+Wk=; b=Mshg7X8HeXzArJvqCcbZNCEnEV/I51OUwFeX6C9fmqiboQ+wb6NS5zU9wt/8ybDOZgiRiy/kHaexx7cEMknBR6j5X6yRcHflBxdfMju33n7V3eEvn7ZcYvQkzODAZuOx6ebwF2WwvDVYb2ONxxMGOoGE2tvTlO8J7AeHR5gv11jV79K5ii8NyK/vjwCgxf+J0f/VUKriaPgqIIAO4Agu7uipuXXE0RxRGOA2e/qWt3bqN/qzFf2IN2rr0s6bT4ZASqExTlkysDSvYi8GDCQlzVF6vuhJ1d8qeJmIU5smuS5mkkygwyJ/VIkI8SuxrYlDx1Ens3ruObPwVlvH/Eiofw== 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=JG6FP4NnWrd9zMAn7BBBU+uqD4xmmRgoyQEm3d3S+Wk=; b=jATjykpPwZoQHXKJ01QLwQZ50g1z2wNch40lDomZeM1tOaMpAThsy6NSKufR5B9SFT9V9T8tuOktd8pKMzmMQiSTC9A7s9WmSj/+3shi1371lz4Oe9p13knT5DdUefKwgLSQY///LH4HRp0RhrYoQgkbl10RrsLzEKW+ITBgo+w= 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 AM0PR10MB3106.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:12a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Fri, 2 Jul 2021 12:45:23 +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:23 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 09/10] sandbox: add test of wdt_gpio driver Date: Fri, 2 Jul 2021 14:45:09 +0200 Message-Id: <20210702124510.124401-10-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d02dc292-c973-4659-d76c-08d93d57423c X-MS-TrafficTypeDiagnostic: AM0PR10MB3106: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I3/amHpNQ6sQiNOJ4/U9FueB93YugZwZAcejyuCxsKmK7eNSgwnfk7XCkKTu90Sc8UtTkBPhyjy7St1PCjsDcXIQi8B9pxGdpbWvOq3C33Dcf9KSGp6aJJY/gY7oBpBJQTisbM+Z6SsnOlN8WsWnTgaKcsIq2jtqS/Pd4573A/sDu5/zsh/4AgyqkPf08dvN659OMPveEQyoz70kKBoj/Szz59EYZJ/OUfpe8xo9/XW2RBIAt3kWh6S8C94N1+Ggr0F+QNY3uhJSw29122/RMzbylN8nLUyz5+kpUKZZM4dreTC3E3CuT252mMoXWXrLQEspI90LOd0kZIflrLT9uPEJzysYw45orz3SPw2FDRsRA9TmmVYSFcnuFy71p3xpRS7+PaVC4wDFDkM3SQ2Bhr8F1aTaLrSqEJroVdc6sel3V0XZuQVm1b200GqYo+HZJxbjSusc7YzBS3z/6SxWsQfYrsCd57Fdw785jWkbZhpInPJp6E8xpj3HKfN80DpgggjdiH1fPq9QWrg/ILtYNQAGnwnOc2wviTvczkffVW0WwNFKek82DMupuQDk9TMZumWyg29XuLpVFffBKv1b8048Xor1rXfrTS48peUVsHJCL1sNEbKMyj1Z8wdQzXEWY6WL1gQyAM62YJZY1GnCRusVaQaVrBn4QTaTKXhZ8EP/ufebAJFO3F1mgIO5NrbMh8QYNCOFP+7Qu2RGdRRgkg== 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:(396003)(346002)(376002)(39850400004)(366004)(136003)(186003)(52116002)(1076003)(956004)(16526019)(478600001)(8976002)(38350700002)(8676002)(6916009)(8936002)(38100700002)(6666004)(2616005)(54906003)(36756003)(4326008)(66556008)(86362001)(26005)(66946007)(316002)(2906002)(83380400001)(107886003)(44832011)(6512007)(5660300002)(6506007)(6486002)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kzn79uhjxxCPBzLOCxnKH6tKFFl3cJdKCcwGvwBk00Lcmcsqoe6jOLnlv3Am0tQe7nIjJiIjwOV524cqcvngLEBT7tjpXvEMuuG6x+dsiikXHj2s8GIGGjoyxOxY3BmGGQ4qDnZGa2LSjNQRcqmzuxqInR5z3W7SoMy9VK9Ed3PAuO8zl6MpTC5cdYNo5p0soatki4BT0N5J49XHVPShiSYsptm3pGYdNLP3Xgr4SB/cpCLf9LLYYmIRNizVIQ6niPi3xz7r9ikvF2NA2QdZ+tVgRHiIcfIFrEbItVv/GIITpNldZIGPEg2HLIvqbW6+wz8lbhD/CJEBqUPd+ANclkFkEeEcadl/mBaGTxeReAVXQIMurWunT768Ok08wSvd1kTyUvwMyY9v1DgCS4WjI/Jf6IolZpZO51fwQLcRCDSdEBZtuIFw65tqx2+GnENGxcGcMFIslsfv4cOFFg0NuwrMx28nArtx9R9w8qntZIzNahoURR7SeCOKk+/K7EdmwJAk5sLYknpbAk9vCx5eYGA9//F93ffvhB7bG/t/CCWJnhNWTaGvnlEG/MvoMhACqKMRk4dJw0vougjvVdX55AxPZCseyfnqbTRxKBhjraAWAgRP8RklpwsawX84zqyA566F2L2Cbb3BM+UOrqA3PLCPNsG0vt4xTWWdyV5ghWympGDJ3R74KE+CSUuRDgWcEOVvdPnrKQ66WD3Gx2hS16PQZymKKcuwSVEWE0FShci94bJVJo5qH3FH2V6q5+pusXE3eOoQmFtbdD6n0OVbRHNxlx7olHzQMwEasO7knyWMH9LRAuCvxtDT++8BLB1GnRzS6IWneI6l9azQMCEjPFUK37109pgHl9I+aRj8Pcyll2R39yV/tw9Dz/FOFBnTlhRO8mBVZdT2gmOi4BxsEUYxZ3qELpWcfYTVyTCwzJDutUN7YlzSc8L9mz4nvtKC9gYd6X6e3IJ56DrB7iunw4WFsP+2Qd7Lha0qC5WnTQcmWJpZhI39OCjG8r4HF39D4D1MiTw+Lay3kAgaR1CqJE7s1kxqtOPvRe9SeICorHFxSXjtnzWgJuGW1Zjp+vzWvsJJVGcU92o/55vzkaanKKbp8BoCCbOky+jTtjrne8JoNiyF67QeQoHyU9HWq7WhBLB+IzTa5n7CsiXXJb172tpSuOoBxHRnpyunsEeCQLPZxob+yy5IB59T2IxDprDTUOEdYSxY9uC0zCNtgn0iOrJcanokJGiK4Mk8pdIDCJMcRIt/lTgT0HiD39PQ1HbwNIyv/hsaS/xjKy0IHgOrQT7cSk41ELKekwsIbDv/8ZLFr49GAuagWnPSj+LwwLq3 X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: d02dc292-c973-4659-d76c-08d93d57423c 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:23.3737 (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: dzuDY3UUqKaVUYhcaUrlEFTWB2t6ABs8BNBlBcoJ83wfRNvx7OWQUu4hltLJLt0+gZIIickd7RNvyGMVLwCheIhi9Atcu6IyQdIRF3OgITs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3106 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 It seems that no other test has claimed gpio_a:7 yet, so use that. The only small wrinkle is modifying the existing wdt test to use uclass_get_device_by_driver() since we now have two UCLASS_WDT instances in play, so it's a little more robust to fetch the device by driver and not merely uclass+index. Reviewed-by: Simon Glass Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- arch/sandbox/dts/test.dts | 6 ++++++ configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + test/dm/wdt.c | 36 +++++++++++++++++++++++++++++++++++- 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 8e7eaf2d15..f0be050759 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -755,6 +755,12 @@ }; }; + gpio-wdt { + gpios = <&gpio_a 7 0>; + compatible = "linux,wdt-gpio"; + always-running; + }; + mbox: mbox { compatible = "sandbox,mbox"; #mbox-cells = <1>; diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index bf436963ec..b941149dfb 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -225,6 +225,7 @@ CONFIG_SPLASH_SCREEN_ALIGN=y CONFIG_VIDEO_BMP_RLE8=y # CONFIG_WATCHDOG_AUTOSTART is not set CONFIG_WDT=y +CONFIG_WDT_GPIO=y CONFIG_WDT_SANDBOX=y CONFIG_FS_CBFS=y CONFIG_FS_CRAMFS=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 56254e1ea2..84145b8383 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -272,6 +272,7 @@ CONFIG_W1_EEPROM=y CONFIG_W1_EEPROM_SANDBOX=y # CONFIG_WATCHDOG_AUTOSTART is not set CONFIG_WDT=y +CONFIG_WDT_GPIO=y CONFIG_WDT_SANDBOX=y CONFIG_FS_CBFS=y CONFIG_FS_CRAMFS=y diff --git a/test/dm/wdt.c b/test/dm/wdt.c index 24b991dff6..abff853a02 100644 --- a/test/dm/wdt.c +++ b/test/dm/wdt.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -19,7 +20,8 @@ static int dm_test_wdt_base(struct unit_test_state *uts) struct udevice *dev; const u64 timeout = 42; - ut_assertok(uclass_get_device(UCLASS_WDT, 0, &dev)); + ut_assertok(uclass_get_device_by_driver(UCLASS_WDT, + DM_DRIVER_GET(wdt_sandbox), &dev)); ut_assertnonnull(dev); ut_asserteq(0, state->wdt.counter); ut_asserteq(false, state->wdt.running); @@ -39,3 +41,35 @@ static int dm_test_wdt_base(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_wdt_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + +static int dm_test_wdt_gpio(struct unit_test_state *uts) +{ + /* + * The sandbox wdt gpio is "connected" to gpio bank a, offset + * 7. Use the sandbox back door to verify that the gpio-wdt + * driver behaves as expected. + */ + struct udevice *wdt, *gpio; + const u64 timeout = 42; + const int offset = 7; + int val; + + ut_assertok(uclass_get_device_by_driver(UCLASS_WDT, + DM_DRIVER_GET(wdt_gpio), &wdt)); + ut_assertnonnull(wdt); + + ut_assertok(uclass_get_device_by_name(UCLASS_GPIO, "base-gpios", &gpio)); + ut_assertnonnull(gpio); + ut_assertok(wdt_start(wdt, timeout, 0)); + + val = sandbox_gpio_get_value(gpio, offset); + ut_assertok(wdt_reset(wdt)); + ut_asserteq(!val, sandbox_gpio_get_value(gpio, offset)); + ut_assertok(wdt_reset(wdt)); + ut_asserteq(val, sandbox_gpio_get_value(gpio, offset)); + + ut_asserteq(-ENOSYS, wdt_stop(wdt)); + + return 0; +} +DM_TEST(dm_test_wdt_gpio, UT_TESTF_SCAN_FDT); From patchwork Fri Jul 2 12:45:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 1500064 X-Patchwork-Delegate: sr@denx.de 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=85.214.62.61; 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=Yd/6yztL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GGZbD3lSkz9sT6 for ; Fri, 2 Jul 2021 22:46:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9BC00829F9; Fri, 2 Jul 2021 14:45:44 +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="Yd/6yztL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5887C829FB; Fri, 2 Jul 2021 14:45:33 +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,T_FILL_THIS_FORM_SHORT autolearn=no autolearn_force=no version=3.4.2 Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0716.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::716]) (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 E07B3829AE for ; Fri, 2 Jul 2021 14:45:24 +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=PZb3Dpsld6FqVnKbjXBbDzeuHcUQqDCjM+MkpfwHBckHM5s7XWFaQVkRae3C/ekwPAoBSkJGbyOu7q/ByE5Ddcyms4kkAS4DhOscrq+lzBbeM2gpfAcDQlvm7/bp8V6GRbI14ptT5JqocEuRWitXsoumwmxp1TYzvmZ/PZ7wt+qzeb0RA4BIjJRAdwAR13zp1X9d8xHlXDS0RQQHXmCwL51ibk0sPvAI59iTAz8ZF4/jvIXfVSSM8yyjg1UqJpL0jTwMR3m8QDe7zfBSMNRZYcRCwOUSmgp5juFnhURfaPXuKq2cWohvPaoeM7gfrUcufMiJLB7Eqns+5TNeq8mzcQ== 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=szwn+3uQwctmEHBD6tpZtKCIoOpSFvfslWYjSZloCOM=; b=CRJAXgJO00T3RSqH5Sw5FHhRYTwgS87WYvGCNKy7QRcyAE0HVIBhnsDw0GZ/CZyohXDUqPPmGLci/aNqbqGKrTSifIPtshSVHMocMLtDbLH5kx5XwF5ZOWXL8oaM3HeBi48KQEfvVDS0HNnuaSaT0Rw8T5tD+IP8mIiv5n4VOlyZGnzT3tCKJvAp1V+PzXfc2/jbEJWxtTW4tIoDnPZsTqvk5MaT3A1UzGZ4mMkc4CGGbo9nRD9DHTl5clpGFN8d6fMZr8cFNQqPJJOBg6x2U0+Sjj6B9iDryU3QWhU0NLoKeg2e9L5FHQxnPSx+ot6G5KSRkbwfo07fp2PvGhkEHQ== 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=szwn+3uQwctmEHBD6tpZtKCIoOpSFvfslWYjSZloCOM=; b=Yd/6yztLl11mzIOrEjNdYft+YImukKWE9FyANDMP36w4uBP0v9dTAZKr0qPdEh8B+KKcIiL5ITOVCYHR6mreMZg0Z0WuPwok4gZ0Klqr723vD7iLyCGDuVHKZBaxX6ruwj8pWb53q2uFV8nZ5R0ydPr3Pal/oJ01ag5sqcqXLpw= 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 AM0PR10MB3106.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:12a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.23; Fri, 2 Jul 2021 12:45:24 +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:23 +0000 From: Rasmus Villemoes To: u-boot@lists.denx.de Cc: Simon Glass , Stefan Roese , Tom Rini , Rasmus Villemoes Subject: [PATCH v3 10/10] sandbox: add test of wdt-uclass' watchdog_reset() Date: Fri, 2 Jul 2021 14:45:10 +0200 Message-Id: <20210702124510.124401-11-rasmus.villemoes@prevas.dk> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> References: <20210702124510.124401-1-rasmus.villemoes@prevas.dk> 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:23 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d22bdb8a-c37f-4a5c-203a-08d93d574285 X-MS-TrafficTypeDiagnostic: AM0PR10MB3106: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3631; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sq617znh/PVSVW00//2LOXDDAavsQnudVHzUemKFQBOq6n23DQWLHrEANYsXGsXwn0AsYgip1YNreCcae7zZvsBYWapeIKVYRYyLmM9+tPde0h8TkUn/pw3CZF+kLpyxaNoxEViku3I1cwIBjrhAUKmBqv5DOzqamwYoOdABggFZ2n2K/bOjHpvKRzev7RrCgMl1djejmyOxANDcygQTnkiE48vihKayJ1oKpL1X0UcGFwzfHVGMOThZ6s0NXTwxhEHtcMZhB0GRQ1ArrYyLFAapjuq2c4DjcYEROlokQspO+X/kftCdqYviETGAVxbLnF2QHLmT5EwomR3T8gK2TvGlw0eJ7kykulVXbdXX9J2Tq5P/weY1q8T65TvFlFFibIUHAQoC+9VWeko5yc9FaQprrqO0XPi1zxSSHmONQfTb4XzlM1KrL4zbrrLDtXdC81u+y9KiXvrHWubOmOjQiub/jNz0lEu6Qf5o6w+72E656c88xIckapH6jWWPvVfa6nulLJyu90+f705A78G/w+etQ3jfNtpprO9ZFg3ipjMEcmpdlr6mhBeo8cRMJ6tylJeaHavWI6ftaIxyftqfakVEit/qQTgSGPE+2MW75GlN2IZjJWuEUNtC87SW1X/68yfCskiMsxcHMI2Qy0IeBOtB5dyqHdknc+YSCkR4FRGvUsTwhbJwkaecyg5kFXwQEypLjfpfV4kHuNDVBbk3IQ== 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:(396003)(346002)(376002)(39850400004)(366004)(136003)(186003)(52116002)(1076003)(956004)(16526019)(478600001)(8976002)(38350700002)(8676002)(6916009)(8936002)(38100700002)(6666004)(2616005)(54906003)(36756003)(4326008)(66556008)(86362001)(26005)(66946007)(316002)(2906002)(83380400001)(107886003)(44832011)(6512007)(5660300002)(6506007)(6486002)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uQWljpnqnWoybVLI45Tf9IZ+LkEvKnuGNA7XoxPh+unvgX51KXJFhjEbNKAHV8ioCVDp51BviL+5XQKKAc0YVU41Nx656w/hqbM+skKTROiT2RMi1S8FvMjvfmzAD5xim5dqUcKW+IVJCObMu3m5o9ZkX6Wx5Ozud7kjPl6W2HZOcVset3SqvJASHpPDJr7O7znoOsF7z2LY+ufvYYHkwC56g9b6lYoQAgEJGSsk8VAnSIfIPuLNcg0jr07YsRiAGpJ94Vj0LJTZkofFCyBhrFmzDav1X0UuisAKN+UIIQ7b5xNdVi1Tcn/cc5MAurFy21NRtk2jDNNdV9b3v0p9ZI/xRjIv0DIQevjYayygBycUaa1qpjSj4Usa4zqm6x5nF9DXhp59SD8SRQOe6rIeaEFiI9ntfEuxJBlBm23KKAvCPFfOihMvsLC4dDWf/4sYFSPTSuFclvbopXKHG5WrVVebxBsjUayLe7Yl2g4BcPGzWf6jcswv953LHV/6oobBQKyEfdxGMKZspkwSbnu7/0lf+VmCfP7PcRNkEcFY/qDbLsXBBlaFJ19FkHI0oHciNaJmFssSrouVHBc3bDkn/e7yun3JDIBqzMbJJefCfwBXafQrGoxTOehjVvCyT03gALgXC35g6JHXztywW3ri2czR+EIFR9opkIUf+aaFYeYNsWSaRjkBmVVuqelWNSOEQuisHwAOmqETczCMFFF958ALXoxv7Wz22OveEbCVqBukK02p2Y9dPhe9SohHZVIR78SmYV6G+39i5bybenmHSum+qwXyVt0jZpeKmJpcMhn+jkbm+lQTHcm1vELwzTaLrPUe5GPb0zZK28Hdd2rGzaVt7J8s0i0CFCy6rQJOV+wkJFMxMNms7lmGdph/VGLfebnXAntiNp0bQ6GW49oxmab05PWqSsEih4E4rk503st5jG4oFff6AMnenB8ww6H9cmjB7zL0AMhf6zu/5bl9+E3cC45hYjhTpR+JTtVK+3X4Ip1TFt1JQ6WnAi8N2xADCXT6hjRkIjXpFftTaUKeOu2b2FFZy2fwad9s35AAB3yujtJJ46ngK/DG+ep2lVrEyXhHq0gA3NnMKz/zr9FgeMNxFw2JtnIvAk004a56EIl/YTMarQnppPO3QsPuh7KuBfoDf7BQ9+/bm92JtQXUNp1NJXFXR7AtttjN7TtVZwlOZozyqQBxcaecz/D51DPVvXLspNOmseM+kJAcmO8/YkyIXVKqC/NXbNrME5VjZXIHI3XR4mu12G6S5ApqaLR7M8YTJpaP9TCykl/XPvGl7uxmRsIEiyf6d/KGG1DT9SOeGPxZzbZ8wb1kr51rhChh X-OriginatorOrg: prevas.dk X-MS-Exchange-CrossTenant-Network-Message-Id: d22bdb8a-c37f-4a5c-203a-08d93d574285 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:23.8714 (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: EDBHefvamTlyOSsvok48MYH9t5xhINq69ljgNOyqix50PfTYbVMEZNRI9FQj5wZ7Vsetu45q0JEnNrulbhWI1+lSk3wcfo44ucdlYpt1090= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB3106 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 Check that the watchdog_reset() implementation in wdt-uclass behaves as expected: - resets all activated watchdog devices - leaves unactivated/stopped devices alone - that the rate-limiting works, with a per-device threshold Reviewed-by: Simon Glass Reviewed-by: Stefan Roese Signed-off-by: Rasmus Villemoes --- arch/sandbox/dts/test.dts | 2 ++ test/dm/wdt.c | 54 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index f0be050759..78efd3bc10 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -758,6 +758,7 @@ gpio-wdt { gpios = <&gpio_a 7 0>; compatible = "linux,wdt-gpio"; + hw_margin_ms = <100>; always-running; }; @@ -1239,6 +1240,7 @@ wdt0: wdt@0 { compatible = "sandbox,wdt"; + hw_margin_ms = <200>; }; axi: axi@0 { diff --git a/test/dm/wdt.c b/test/dm/wdt.c index abff853a02..ee615f0e14 100644 --- a/test/dm/wdt.c +++ b/test/dm/wdt.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include /* Test that watchdog driver functions are called */ static int dm_test_wdt_base(struct unit_test_state *uts) @@ -73,3 +75,55 @@ static int dm_test_wdt_gpio(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_wdt_gpio, UT_TESTF_SCAN_FDT); + +static int dm_test_wdt_watchdog_reset(struct unit_test_state *uts) +{ + struct sandbox_state *state = state_get_current(); + struct udevice *gpio_wdt, *sandbox_wdt; + struct udevice *gpio; + const u64 timeout = 42; + const int offset = 7; + uint reset_count; + int val; + + ut_assertok(uclass_get_device_by_driver(UCLASS_WDT, + DM_DRIVER_GET(wdt_gpio), &gpio_wdt)); + ut_assertnonnull(gpio_wdt); + ut_assertok(uclass_get_device_by_driver(UCLASS_WDT, + DM_DRIVER_GET(wdt_sandbox), &sandbox_wdt)); + ut_assertnonnull(sandbox_wdt); + ut_assertok(uclass_get_device_by_name(UCLASS_GPIO, "base-gpios", &gpio)); + ut_assertnonnull(gpio); + + /* Neither device should be "started", so watchdog_reset() should be a no-op. */ + reset_count = state->wdt.reset_count; + val = sandbox_gpio_get_value(gpio, offset); + watchdog_reset(); + ut_asserteq(reset_count, state->wdt.reset_count); + ut_asserteq(val, sandbox_gpio_get_value(gpio, offset)); + + /* Start both devices. */ + ut_assertok(wdt_start(gpio_wdt, timeout, 0)); + ut_assertok(wdt_start(sandbox_wdt, timeout, 0)); + + /* Make sure both devices have just been pinged. */ + timer_test_add_offset(100); + watchdog_reset(); + reset_count = state->wdt.reset_count; + val = sandbox_gpio_get_value(gpio, offset); + + /* The gpio watchdog should be pinged, the sandbox one not. */ + timer_test_add_offset(30); + watchdog_reset(); + ut_asserteq(reset_count, state->wdt.reset_count); + ut_asserteq(!val, sandbox_gpio_get_value(gpio, offset)); + + /* After another ~30ms, both devices should get pinged. */ + timer_test_add_offset(30); + watchdog_reset(); + ut_asserteq(reset_count + 1, state->wdt.reset_count); + ut_asserteq(val, sandbox_gpio_get_value(gpio, offset)); + + return 0; +} +DM_TEST(dm_test_wdt_watchdog_reset, UT_TESTF_SCAN_FDT);