Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2220603imw; Wed, 6 Jul 2022 02:07:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sY+3oTwPvYUjBh41wvZeA0awT/LLzVLlN16IMILGzgrAxc2hkCGCDe3+l9LP9yuZlMiSFn X-Received: by 2002:a17:906:d54e:b0:726:3709:605a with SMTP id cr14-20020a170906d54e00b007263709605amr36893071ejc.424.1657098470509; Wed, 06 Jul 2022 02:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098470; cv=none; d=google.com; s=arc-20160816; b=u8dE6alDUP9PY6CVFLjntxwsT51OQTzcOLBfnN7eYx8EydT+qo1vH80eypCZQvWdvh QdY3tM+KhFOS/RUC6Rc7Le7IoVw55m+368vf774aAOjhiJ8n5+QknQYFfCzxCxPBNeB5 Bb46fwLiUuLIphLgUpT6TxZoknNSWUKdfl+EL0LfoLRCGgjB5iLIpMUjqU3u5z47YJXl LX5cVOtXCQyf0KASgY1miE4HDt4kuoczFmos2N27IOkWQvNn8oxee6K8su9ZVLecKp4B eT2s4KIDrlUuR8Ca3hqQhHMlwIOX0I9lC5IvJduuhmynT6dnlPqKqEmFx8ChhQxu3KHo zO8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5JnoAw4X1z7bCscIjsjfjSMoE54Bwt7ulA7ZsyJ5jyg=; b=ZkW4eTtrZkCF8ciCjDEcBiqvpbwMt58w511FWdvRiBKF7QugYHgvm5HOm8IESWyhf7 LDBF0j/JPA/Svbm/vw6T7zOXK0VX9Pr4CRkZ8fXbUhOMhEmiGVUIi7o6wDusqAYOmxql FFk+8J3qs4hSFWNbwyv7Y2StHtMY6besAgXNQA4+c3QuoVOGenezpMHtNOE/O1mWHoOA 98c4RfUlKxEEH3Z/WzXSgWqZ+/SlaZhOhTkeRDrO6fFAWxt1j+9k3St5bEDMZIVCyjlQ MOYyM982rwctSNdcMVecLIvOZCOOYMLHn8fP0Y+Jpj3oYyOmbSdcO01QCiWjw5hE6Kuf ofWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=xr0FpK5c; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs8-20020a1709072d0800b00718d2cbefd9si49484593ejc.807.2022.07.06.02.07.25; Wed, 06 Jul 2022 02:07:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=xr0FpK5c; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232887AbiGFJGF (ORCPT + 99 others); Wed, 6 Jul 2022 05:06:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232775AbiGFJFS (ORCPT ); Wed, 6 Jul 2022 05:05:18 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 865112494D for ; Wed, 6 Jul 2022 02:04:48 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id h17so7903202wrx.0 for ; Wed, 06 Jul 2022 02:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5JnoAw4X1z7bCscIjsjfjSMoE54Bwt7ulA7ZsyJ5jyg=; b=xr0FpK5cwnCb0WOaO6y8mE+TkKYS/kzREEXHsfMULEMhvECHCj/xpm3tcmXurmGbP4 67CBaXwsSyy+HadNjaLE5tn18Kzcs3ftlVqzg9UtTI5eBN1Cain3QkeuoXt5au1BDgvf MAq3p1njGNYdEFTmPZHhMK0640KejDHqEL7UEnnf9NjwomqWvcL3ZuYANJ19p7Br1+ye ao3UHr0Kfd3ChdaGisMDX89uwzJ7kvTjL10Wfyp/UliCxYV6AIxufOjfOkGgWk9+le/A r7leP/Z9IP7eeTX0+oyNpWOKy68v5TIWjBRSpNKNpM0VQZidMvoyC0xuzttKj65VcJa2 sPOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5JnoAw4X1z7bCscIjsjfjSMoE54Bwt7ulA7ZsyJ5jyg=; b=wPnnXjSP2PBZzhnZwIjP6jMeiHIglfIAZI24HRDk/s73PCoRPsUsaP1ddFq44/LPEL Ow2H9tHSmP8n4vVzO8QfYLxem3vFaTZIhbuYxOe5vZdqX7i61wA4GkVqgcqi+xLZ9Cvh ky774Tn//gxIowM1Y225zeW3VuB493FfExp1/mQVkoUjyfB385QJieLHG/eW1CRJ02+M 2ehGY05C57hwZZMF+fBxqwlZCoIySQmk3qasi67a1FxLwD/cyUhfJUceF1AfouJLo++B xP/ZuN4y2pPp0ZqRNSAxZJwLsREqIBRpv0A/0Uxfe7guyBvosNvih7kZSfM9GI9d+RKS 1hZQ== X-Gm-Message-State: AJIora9XLRbKN63rH3ckVlA5DzsxAWH9nJwRUoT3YxO4/Z9205whq66Y AOsnsfIiRoJ9zdveZibou3XyKA== X-Received: by 2002:a05:6000:69d:b0:21a:395e:572c with SMTP id bo29-20020a056000069d00b0021a395e572cmr35341384wrb.559.1657098287952; Wed, 06 Jul 2022 02:04:47 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id v11-20020adfe28b000000b0021d6ef34b2asm5230223wri.51.2022.07.06.02.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 02:04:47 -0700 (PDT) From: Corentin Labbe To: heiko@sntech.de, herbert@gondor.apana.org.au, krzysztof.kozlowski+dt@linaro.org, mturquette@baylibre.com, p.zabel@pengutronix.de, robh+dt@kernel.org, sboyd@kernel.org Cc: linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, john@metanate.com, didi.debian@cknow.org, Corentin Labbe Subject: [PATCH v8 14/33] crypto: rockchip: handle reset also in PM Date: Wed, 6 Jul 2022 09:03:53 +0000 Message-Id: <20220706090412.806101-15-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220706090412.806101-1-clabbe@baylibre.com> References: <20220706090412.806101-1-clabbe@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org reset could be handled by PM functions. We keep the initial reset pulse to be sure the hw is a know device state after probe. Signed-off-by: Corentin Labbe --- drivers/crypto/rockchip/rk3288_crypto.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c index d9258b9e71b3..399829ef92e0 100644 --- a/drivers/crypto/rockchip/rk3288_crypto.c +++ b/drivers/crypto/rockchip/rk3288_crypto.c @@ -74,14 +74,23 @@ static int rk_crypto_pm_suspend(struct device *dev) struct rk_crypto_info *rkdev = dev_get_drvdata(dev); rk_crypto_disable_clk(rkdev); + reset_control_assert(rkdev->rst); + return 0; } static int rk_crypto_pm_resume(struct device *dev) { struct rk_crypto_info *rkdev = dev_get_drvdata(dev); + int ret; + + ret = rk_crypto_enable_clk(rkdev); + if (ret) + return ret; + + reset_control_deassert(rkdev->rst); + return 0; - return rk_crypto_enable_clk(rkdev); } static const struct dev_pm_ops rk_crypto_pm_ops = { @@ -222,13 +231,6 @@ static void rk_crypto_unregister(void) } } -static void rk_crypto_action(void *data) -{ - struct rk_crypto_info *crypto_info = data; - - reset_control_assert(crypto_info->rst); -} - static const struct of_device_id crypto_of_id_table[] = { { .compatible = "rockchip,rk3288-crypto" }, {} @@ -258,10 +260,6 @@ static int rk_crypto_probe(struct platform_device *pdev) usleep_range(10, 20); reset_control_deassert(crypto_info->rst); - err = devm_add_action_or_reset(dev, rk_crypto_action, crypto_info); - if (err) - goto err_crypto; - crypto_info->reg = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(crypto_info->reg)) { err = PTR_ERR(crypto_info->reg); -- 2.35.1