Received: by 10.223.185.116 with SMTP id b49csp5958353wrg; Wed, 7 Mar 2018 22:39:22 -0800 (PST) X-Google-Smtp-Source: AG47ELuC1TFkWK96ccuaivU9ADQBFwuvTyTXjtEmjCHWxM7ErdNqpontyZJ6Pl9/BU4LLP+F1mYj X-Received: by 2002:a17:902:b686:: with SMTP id c6-v6mr22937587pls.339.1520491161895; Wed, 07 Mar 2018 22:39:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520491161; cv=none; d=google.com; s=arc-20160816; b=AZachWCoVkZ7Ci/c+FxdS/yF8NLo+VFtYRmjCok9jFk9BXaqJxUKYPAAeAnwrr8Ifu 6qUnfQa/+YE98uJyaV+HjlCwFeFtd0r00UEQyrrS00C71gee8201UGGQYHHpbdEyRLr3 +myMxTfE1rBYCUsS3K70WT3XESqtGcPgmZ3WWp/zPxr7YxNGV1/RyrzZUTEVIBJs52vc 22v0Pj/dGD1KdGHoTFe+8Bdtf8A8Xbo5RqWOqOvyZya6NIrtrz2cO3Tx01upi06lJsw4 doWZa1zxf4gdohjb68T3gJp9yT6Xq72z1GguX6j16AV9ERwp4Ns+12pQMG7Fv+qh90NU qDjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=dTjFRft2oV9fDKUl6YHdkyp7bFqng/z54R9GvFLOK0U=; b=JZFc452ru27lyO9fcItQqHKI0L16/1x+TN40Inxp9zCgeh82+ISIAUM42531QDBeOI x2BpWor9NCQfQXdb9REW8jNqbgceTZyXgMO2DXMQbvTGVI1/brWT96l8a6plCzJao0kQ rOivaEI/uqin+oBThLKc9w/FITmQ00qVGZ5VO/xx0HEGHeU0zYwZtZfm3IavZJ81rb8K +gaOAgiqVvQM9FaQcMBKh6cVlh/n1wDtYjeiCWVpckCOtH4mcsejtbYw3c43xFikztaa y/r6o4LqTIHL+zjZp1H0IYNjdBKFgbFnAwo+o8p2vAvTFth44o1rrl2hCGep1iBgVagZ iqHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=HcXBJ02J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si12488373pgc.282.2018.03.07.22.39.07; Wed, 07 Mar 2018 22:39:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=HcXBJ02J; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965434AbeCHE7r (ORCPT + 99 others); Wed, 7 Mar 2018 23:59:47 -0500 Received: from mail-bl2nam02on0136.outbound.protection.outlook.com ([104.47.38.136]:38384 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S964919AbeCHE7q (ORCPT ); Wed, 7 Mar 2018 23:59:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dTjFRft2oV9fDKUl6YHdkyp7bFqng/z54R9GvFLOK0U=; b=HcXBJ02JIx6oiJI6G4xcg7GZfdhAq1nWYiGdFD5NMvKqRlQgYA/cEJLVJghP83sKfeQOxZKEzSf34AoPKFNF6n4xIsx+GZFhvmB5ne9ijptG48CipnTnbxXqyQvEPhZh5xnrBEl0+MaPbQzIxmb3deixAUrthBDMdckmyF8gFZk= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0920.namprd21.prod.outlook.com (52.132.132.165) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.3; Thu, 8 Mar 2018 04:59:44 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8063:c68a:b210:7446%2]) with mapi id 15.20.0588.008; Thu, 8 Mar 2018 04:59:44 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Romain Izard , Stephen Boyd , Sasha Levin Subject: [PATCH AUTOSEL for 4.14 62/67] clk: at91: pmc: Wait for clocks when resuming Thread-Topic: [PATCH AUTOSEL for 4.14 62/67] clk: at91: pmc: Wait for clocks when resuming Thread-Index: AQHTtpoHB+uxbwyEJkG7qLqt1viqcQ== Date: Thu, 8 Mar 2018 04:57:59 +0000 Message-ID: <20180308045641.7814-62-alexander.levin@microsoft.com> References: <20180308045641.7814-1-alexander.levin@microsoft.com> In-Reply-To: <20180308045641.7814-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM5PR2101MB0920;20:BNRIsRYRGRxOozDgFa+1nOFSeUWGIR2rJoy79fkQ4O6dt6863wHVt5OJRRHZFvwngKNd6wnaqUKpJP2v8h0OfULT7BKPXBdOcT/DU5/Gmk6HGqFr/L6WBPw8Ub5pZN0CcGqG8xMAMaI1hbYF4g0j59em42arRWzHlltGkABUru8= x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 7fa12fc8-e502-41cf-5f03-08d584b16883 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0920; x-ms-traffictypediagnostic: DM5PR2101MB0920: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(85827821059158)(58145275503218); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231220)(944501244)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011);SRVR:DM5PR2101MB0920;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0920; x-forefront-prvs: 060503E79B x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(396003)(39380400002)(346002)(366004)(376002)(189003)(199004)(81156014)(81166006)(5250100002)(8936002)(54906003)(2501003)(305945005)(8676002)(107886003)(110136005)(97736004)(99286004)(6436002)(36756003)(316002)(72206003)(76176011)(14454004)(6486002)(7736002)(478600001)(10290500003)(186003)(22452003)(59450400001)(68736007)(105586002)(2950100002)(106356001)(102836004)(26005)(6506007)(86362001)(3660700001)(5660300001)(2906002)(10090500001)(1076002)(25786009)(2900100001)(53936002)(39060400002)(4326008)(66066001)(6512007)(6666003)(6116002)(3280700002)(3846002)(86612001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0920;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: Vc04Yn0IrVUISTSd6ryiUV6xupo3ltyjhnHRDm4phWwZ45aZ9mk+q1F7LtZySq7S221akQOi7I+Hcx2bYqA1X0UUbs5p7Zkagi3cS7XhYhINBttx04HeeXcwYAwhSYoqnfR1FLO/3aiZxTFPRqUqVbVdGpgSV1u9zGnQQXvMF2YO7VB0EPhIsueA/fvUmhLBSaV598CpE34jcv4JOZ/4rSRTfBRBYUC0zRpg412h0HRqqZMlk+//SLFW6isfVZ2xmeMrcXSnFFAQJa7zUrrHd2tMqrHmrMPEtmxZAvAu06K8G2z4q44y2PblkwdjlQLyJ6z+sxU33JkuHnV2sbQtMg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7fa12fc8-e502-41cf-5f03-08d584b16883 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Mar 2018 04:57:59.6725 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0920 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Romain Izard [ Upstream commit 960e1c4d93be86d3b118fe22d4edc69e401b28b5 ] Wait for the syncronization of all clocks when resuming, not only the UPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG() when interrupts are masked, which is the case in here. Signed-off-by: Romain Izard Acked-by: Ludovic Desroches Acked-by: Nicolas Ferre Acked-by: Alexandre Belloni Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin --- drivers/clk/at91/pmc.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c index 775af473fe11..5c2b26de303e 100644 --- a/drivers/clk/at91/pmc.c +++ b/drivers/clk/at91/pmc.c @@ -107,10 +107,20 @@ static int pmc_suspend(void) return 0; } =20 +static bool pmc_ready(unsigned int mask) +{ + unsigned int status; + + regmap_read(pmcreg, AT91_PMC_SR, &status); + + return ((status & mask) =3D=3D mask) ? 1 : 0; +} + static void pmc_resume(void) { - int i, ret =3D 0; + int i; u32 tmp; + u32 mask =3D AT91_PMC_MCKRDY | AT91_PMC_LOCKA; =20 regmap_read(pmcreg, AT91_PMC_MCKR, &tmp); if (pmc_cache.mckr !=3D tmp) @@ -134,13 +144,11 @@ static void pmc_resume(void) AT91_PMC_PCR_CMD); } =20 - if (pmc_cache.uckr & AT91_PMC_UPLLEN) { - ret =3D regmap_read_poll_timeout(pmcreg, AT91_PMC_SR, tmp, - !(tmp & AT91_PMC_LOCKU), - 10, 5000); - if (ret) - pr_crit("USB PLL didn't lock when resuming\n"); - } + if (pmc_cache.uckr & AT91_PMC_UPLLEN) + mask |=3D AT91_PMC_LOCKU; + + while (!pmc_ready(mask)) + cpu_relax(); } =20 static struct syscore_ops pmc_syscore_ops =3D { --=20 2.14.1