From patchwork Mon Nov 21 08:18:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomas Melin X-Patchwork-Id: 697163 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tMhNS4qXSz9t5m for ; Mon, 21 Nov 2016 19:19:51 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1663E4B951; Mon, 21 Nov 2016 09:19:47 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BJw7rMlU27_K; Mon, 21 Nov 2016 09:19:46 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8C7A44BA29; Mon, 21 Nov 2016 09:19:46 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B51714BA29 for ; Mon, 21 Nov 2016 09:19:43 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xoS1dCLk35Bn for ; Mon, 21 Nov 2016 09:19:43 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from hel-mailgw-01.vaisala.com (hel-mailgw-01.vaisala.com [193.143.230.17]) by theia.denx.de (Postfix) with ESMTPS id 5DB7F4B951 for ; Mon, 21 Nov 2016 09:19:39 +0100 (CET) IronPort-PHdr: =?us-ascii?q?9a23=3A0aup/h0RqPKYzDK+smDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?se0VLvad9pjvdHbS+e9qxAeQG96KsLQe0aGM7vCocFdDyK7JiGoFfp1IWk1Nou?= =?us-ascii?q?QttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZr?= =?us-ascii?q?KeTpAI7SiNm82/yv95HJbQhFgDSwbalsIBmoogndqMkbjIh/Iast1xXFpWdFdf?= =?us-ascii?q?5Lzm1yP1KTmBj85sa0/JF99ilbpuws+c1dX6jkZqo0VbNXAigoPGAz/83rqALM?= =?us-ascii?q?TRCT6XsGU2UZiQRHDg7Y5xznRJjxsy/6tu1g2CmGOMD9UL45VSi+46ptVRTljj?= =?us-ascii?q?oMOTwk/2HNksF+jLxVrg+vqRJ8xIDZe52ZOOZkc6/BZ94WWXZNU8BMXCJBGIO8?= =?us-ascii?q?aI4PAvIfM+ZfqonyvUAOpga5CwayAOPvyzlIjWLx0K0m1OQhFBvJ3Bc6E9ILrn?= =?us-ascii?q?vUqNT1NKEJXOCr1qbIzC7DYOlS2Tjn8oTHbhchofSVUL92bMHfylEvGhvYgliS?= =?us-ascii?q?t4DpJS2Z2+sXv2SG9eZsS/yjhm4hpgpsuDag3N0shZPMho8Nz1DE8jh2z5gtKN?= =?us-ascii?q?2jTU57fcakEJxNtyGGL4d2Qt0tQ2VvuCsiyLMItpi1cDEXxpog2RDRceaLfJSP?= =?us-ascii?q?4hL5TOadOyl4i2hkeLKknRmy9VKvxvfgWcmz1VZGtitFkt/SuXARzxHf98qKRu?= =?us-ascii?q?Vn8ku/1juDzR3f5vtaLUwqlafXM5shzaQxlpoXv0TDBCj2mEDuga+KcUUk//Kn?= =?us-ascii?q?6//9brXjuJCcM450igflP6QwgMO/AP84PRIKX2eB4+izyLrj/UjhTLVQkvI2ir?= =?us-ascii?q?XZsIzdJckDu661GhRa0oEk6xajFDqm1NUYnWIbLFJeYh6IkpbmO1fBIfziEPiw?= =?us-ascii?q?nQfkrDA+2rXMObr9KpHMNWTY1rvse6Y750MP5hA0yIVj4JddEfkkLfbyXAelqN?= =?us-ascii?q?vdBwR/NgGwwuDPFtx8zYoaUCSEBarPY/CaikOB+u96e7rEX4QSojuoc/U=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2FyBAAWrTJY/+EBGKxdHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgw0BAQEBAYF3tzCCDoIFhiGCSRIBAQEBAQEBAQEBAQKBB4IzGIM?= =?us-ascii?q?dgVG0BotNATCGPIlvhRUFmk2Bc48GkCMCkWolAYEihWJwiDwBAQE?= X-IPAS-Result: =?us-ascii?q?A2FyBAAWrTJY/+EBGKxdHAEBBAEBCgEBFwEBBAEBCgEBgw0?= =?us-ascii?q?BAQEBAYF3tzCCDoIFhiGCSRIBAQEBAQEBAQEBAQKBB4IzGIMdgVG0BotNATCGP?= =?us-ascii?q?IlvhRUFmk2Bc48GkCMCkWolAYEihWJwiDwBAQE?= X-IronPort-AV: E=Sophos;i="5.31,674,1473109200"; d="scan'208";a="33885237" Received: from hel-smtp.corp.vaisala.com ([172.24.1.225]) by hel-mailgw-01.vaisala.com with ESMTP; 21 Nov 2016 10:19:38 +0200 Received: from debian8.corp.vaisala.com ([172.24.65.111]) by HEL-SMTP.corp.vaisala.com over TLS secured channel with Microsoft SMTPSVC(8.5.9600.16384); Mon, 21 Nov 2016 10:19:35 +0200 From: Tomas Melin To: u-boot@lists.denx.de Date: Mon, 21 Nov 2016 10:18:51 +0200 Message-Id: <1479716331-94776-1-git-send-email-tomas.melin@vaisala.com> X-Mailer: git-send-email 2.1.4 X-OriginalArrivalTime: 21 Nov 2016 08:19:35.0561 (UTC) FILETIME=[FE949F90:01D243CF] Cc: trini@konsulko.com Subject: [U-Boot] [PATCH] xyz-modem: Change getc timeout loop waiting X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This fixes the loop delay when using a hw watchdog. In case a watchdog is used that accesses CPU registers, the defined delay of 20us in a tight loop will cause a huge delay in the actual timeout seen. This is caused by the fact that udelay will inheritantly call WATCHDOG_RESET. Together with the omap wdt implementation, the seen timeout increases up to around 30s. This makes the loop very slow and causes long delays when using the modem. Instead, implement the 2 sec loop by using the timer interface to know when to break out of the timeout loop. Watchdog kicking is taken care of by getc(). Signed-off-by: Tomas Melin --- common/xyzModem.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/common/xyzModem.c b/common/xyzModem.c index 5656aac..e0d87db 100644 --- a/common/xyzModem.c +++ b/common/xyzModem.c @@ -71,12 +71,12 @@ typedef int cyg_int32; static int CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c) { -#define DELAY 20 - unsigned long counter = 0; - while (!tstc () && (counter < xyzModem_CHAR_TIMEOUT * 1000 / DELAY)) + + ulong now = get_timer(0); + while (!tstc ()) { - udelay (DELAY); - counter++; + if (get_timer(now) > xyzModem_CHAR_TIMEOUT) + break; } if (tstc ()) {