{"id":819035,"url":"http://patchwork.ozlabs.org/api/patches/819035/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pwm/patch/20170927083555.16580-2-romain.izard.pro@gmail.com/","project":{"id":38,"url":"http://patchwork.ozlabs.org/api/projects/38/?format=json","name":"Linux PWM development","link_name":"linux-pwm","list_id":"linux-pwm.vger.kernel.org","list_email":"linux-pwm@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170927083555.16580-2-romain.izard.pro@gmail.com>","list_archive_url":null,"date":"2017-09-27T08:35:48","name":"[v3,1/8] clk: at91: pmc: Wait for clocks when resuming","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"3c0aefa7e09b25b04e247655ccad78b77581748f","submitter":{"id":8236,"url":"http://patchwork.ozlabs.org/api/people/8236/?format=json","name":"Romain Izard","email":"romain.izard.pro@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pwm/patch/20170927083555.16580-2-romain.izard.pro@gmail.com/mbox/","series":[{"id":5310,"url":"http://patchwork.ozlabs.org/api/series/5310/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pwm/list/?series=5310","date":"2017-09-27T08:35:48","name":"Various patches for SAMA5D2 backup mode","version":3,"mbox":"http://patchwork.ozlabs.org/series/5310/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/819035/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/819035/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-pwm-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pwm-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"F3lk96+J\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3y2B4P44t4z9t3x\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 18:36:21 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752579AbdI0IgU (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tWed, 27 Sep 2017 04:36:20 -0400","from mail-wm0-f66.google.com ([74.125.82.66]:46771 \"EHLO\n\tmail-wm0-f66.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752487AbdI0IgO (ORCPT\n\t<rfc822; linux-pwm@vger.kernel.org>); Wed, 27 Sep 2017 04:36:14 -0400","by mail-wm0-f66.google.com with SMTP id m72so15481186wmc.1;\n\tWed, 27 Sep 2017 01:36:13 -0700 (PDT)","from localhost.localdomain (146.187.3.109.rev.sfr.net.\n\t[109.3.187.146]) by smtp.gmail.com with ESMTPSA id\n\tr6sm9699900wrg.40.2017.09.27.01.36.11\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 27 Sep 2017 01:36:12 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=SXCU17pSZBd7SdVZm1ZcLIHKqn3I6ldleFFnCs7nces=;\n\tb=F3lk96+JS4bvFaGYoy2MEdUk42Z4fNxTJ+LYRkCeR89A1dDEukmVQJlv8L/fEyV/f1\n\trWyot8tSq5SNGhUFhiQn07y5UTDFtV79hV2wGTV55deEG8tx7QOp58PHv6dkPHKdcaaP\n\tkarjnMiPYU5uTTuJtfOouc/BNX+af/DAQriGfvLZb9IlLpqO3Q0Dj3a5GHvlVli1oIeK\n\tbJcelXXTDlk0o1qRJoTzUfnxdJk6KrHj+Cj3kFUUAyrx8uPYdOZsUYXfRIq+PBtSALPo\n\tCK876vJklL4gUsK7BxGWBRwmsHI4cU3Yq1SA7vtzu+gYTTO7ibTdYXSJcVNV6vsHcOfn\n\tAVUw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=SXCU17pSZBd7SdVZm1ZcLIHKqn3I6ldleFFnCs7nces=;\n\tb=CejRLTHdh/nbbuhwlFDM6us9G5RwCM8oZ+lxRCZW79yvWl07RPiA3iWoBN7qJuxSAF\n\tDDbNLiMVHO4Hy58Tqf4kcXXSqq9dFVXNBu+/rvCIN5SBTXGAB868LxDc4bFilBtULjYi\n\tqXzqFqlSDhVKYraTZsZ6/7K+dRmWi/fwLCEhiCDXv9zgA3Q1ds0s3wqZ/ZbG1T+/riXo\n\tzHiIiM95yQlMpuycwQIY2NY2pmlA15axWXb5HKvSSzDbKG2mKnACo9BqCBJ8eYcgyRuV\n\tT+4Jiyv8mNn1zknz97geyTyftCRGRJQXCyrHy0IhbIFo9V/R+zbdoOG+w+lCSqPG364B\n\tkL5Q==","X-Gm-Message-State":"AHPjjUjjoO4FPlCJOAotx/XZ1yyodgJ6D+CFgEdH9w/Ecmm0Xhf/6iV9\n\tYM70NC74B2HlmfNXzx7ImIE=","X-Google-Smtp-Source":"AOwi7QC8de/LX7DtKfMfi8SNQ+mtUl0r03rkwEBNWagZeggs51mwGBQraPxvcv6K0Io8et8nDUveUQ==","X-Received":"by 10.28.174.67 with SMTP id x64mr909409wme.82.1506501373069;\n\tWed, 27 Sep 2017 01:36:13 -0700 (PDT)","From":"Romain Izard <romain.izard.pro@gmail.com>","To":"Boris Brezillon <boris.brezillon@free-electrons.com>,\n\tMichael Turquette <mturquette@baylibre.com>,\n\tStephen Boyd <sboyd@codeaurora.org>, Lee Jones <lee.jones@linaro.org>,\n\tWenyou Yang <wenyou.yang@atmel.com>, Josh Wu <rainyfeeling@outlook.com>,\n\tRichard Weinberger <richard@nod.at>,\n\tDavid Woodhouse <dwmw2@infradead.org>,\n\tBrian Norris <computersforpeace@gmail.com>,\n\tMarek Vasut <marek.vasut@gmail.com>,\n\tCyrille Pitchen <cyrille.pitchen@wedev4u.fr>,\n\tThierry Reding <thierry.reding@gmail.com>,\n\tRichard Genoud <richard.genoud@gmail.com>,\n\tGreg Kroah-Hartman <gregkh@linuxfoundation.org>,\n\tJiri Slaby <jslaby@suse.com>, Alan Stern <stern@rowland.harvard.edu>,\n\tLudovic Desroches <ludovic.desroches@microchip.com>,\n\tNicolas Ferre <nicolas.ferre@microchip.com>,\n\tAlexandre Belloni <alexandre.belloni@free-electrons.com>","Cc":"linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tlinux-mtd@lists.infradead.org, linux-pwm@vger.kernel.org,\n\tlinux-serial@vger.kernel.org, linux-usb@vger.kernel.org,\n\tRomain Izard <romain.izard.pro@gmail.com>","Subject":"[PATCH v3 1/8] clk: at91: pmc: Wait for clocks when resuming","Date":"Wed, 27 Sep 2017 10:35:48 +0200","Message-Id":"<20170927083555.16580-2-romain.izard.pro@gmail.com>","X-Mailer":"git-send-email 2.11.0","In-Reply-To":"<20170927083555.16580-1-romain.izard.pro@gmail.com>","References":"<20170927083555.16580-1-romain.izard.pro@gmail.com>","Sender":"linux-pwm-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-pwm.vger.kernel.org>","X-Mailing-List":"linux-pwm@vger.kernel.org"},"content":"Wait for the syncronization of all clocks when resuming, not only the\nUPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG()\nwhen interrupts are masked, which is the case in here.\n\nSigned-off-by: Romain Izard <romain.izard.pro@gmail.com>\nAcked-by: Ludovic Desroches <ludovic.desroches@microchip.com>\nAcked-by: Nicolas Ferre <nicolas.ferre@microchip.com>\n---\n drivers/clk/at91/pmc.c | 24 ++++++++++++++++--------\n 1 file changed, 16 insertions(+), 8 deletions(-)","diff":"diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c\nindex 775af473fe11..5c2b26de303e 100644\n--- a/drivers/clk/at91/pmc.c\n+++ b/drivers/clk/at91/pmc.c\n@@ -107,10 +107,20 @@ static int pmc_suspend(void)\n \treturn 0;\n }\n \n+static bool pmc_ready(unsigned int mask)\n+{\n+\tunsigned int status;\n+\n+\tregmap_read(pmcreg, AT91_PMC_SR, &status);\n+\n+\treturn ((status & mask) == mask) ? 1 : 0;\n+}\n+\n static void pmc_resume(void)\n {\n-\tint i, ret = 0;\n+\tint i;\n \tu32 tmp;\n+\tu32 mask = AT91_PMC_MCKRDY | AT91_PMC_LOCKA;\n \n \tregmap_read(pmcreg, AT91_PMC_MCKR, &tmp);\n \tif (pmc_cache.mckr != tmp)\n@@ -134,13 +144,11 @@ static void pmc_resume(void)\n \t\t\t     AT91_PMC_PCR_CMD);\n \t}\n \n-\tif (pmc_cache.uckr & AT91_PMC_UPLLEN) {\n-\t\tret = regmap_read_poll_timeout(pmcreg, AT91_PMC_SR, tmp,\n-\t\t\t\t\t       !(tmp & AT91_PMC_LOCKU),\n-\t\t\t\t\t       10, 5000);\n-\t\tif (ret)\n-\t\t\tpr_crit(\"USB PLL didn't lock when resuming\\n\");\n-\t}\n+\tif (pmc_cache.uckr & AT91_PMC_UPLLEN)\n+\t\tmask |= AT91_PMC_LOCKU;\n+\n+\twhile (!pmc_ready(mask))\n+\t\tcpu_relax();\n }\n \n static struct syscore_ops pmc_syscore_ops = {\n","prefixes":["v3","1/8"]}