Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp552925rwb; Tue, 27 Sep 2022 00:59:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7raUbIfHf/xdeBqsfZ2QmDFowB0Nie/XI705p3IcA+9eYw0I/QSWa2TbUmFod/DAz0GIbu X-Received: by 2002:a17:902:c1cd:b0:177:e483:51b0 with SMTP id c13-20020a170902c1cd00b00177e48351b0mr26520028plc.41.1664265586608; Tue, 27 Sep 2022 00:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664265586; cv=none; d=google.com; s=arc-20160816; b=ShkRuF/2/ynTQ3LInzoeEkzsex2Zq6KNIO7zW2avT12v6RUOY5KxnRzHFvmE5S/m4E R2B3J2ic7A136hydObjnmi6ZB1o5VasUxUtP1G4iIDnw6P+eDwPYXF2GS6f+hK7zDes1 n/wb5p6VMqky7/QCJ3jd2W1cVaPqNO34VyhKUQVMh+YN0vJVABvH7WdVwW/uBs4Tugbv sQ2f8JHUUN6z/nikB9iFsEXblrMr2aAr6W0lEBj1jgpQqRIKruX7fwrYCURDPykecn93 r21//Z91MVR/3vYPMjJRLPE8JtjkndL98fgEYrC2MHkUJbQbPLIZ9V4DF9Z7Hivum4LZ bXXw== 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=UGbdJwhNtYNfg6qIard96SGzNtmQLkXSB3qcyDfr1D0=; b=dBjWhDtkxkuLQHIeG+Q69LdTbsX3+3DDEY9jyrwm1p+kYFa5tO/a9BJygxAH2HKBHq q96ulMToNXhqReY3UC9WzqaCuA337RezMuM+wm/9yjPmctnIdlkSyu5z6+CisHQUBU91 IoXNSv051Vi0HCX6kJwGn7e/4Pfw8RCCpkdd7quI1rGjU+xAe1tF66bM8lDzDnlimew7 OYrAAUVbU9j+Bm/Kua46uPcfnf+64IMfXe290M7e3uDjDlxSh6b4C+e8IvbYIgxZ4Vy7 x2uG2aMx+fgLFwQ4lwAYMXK+fPZNbduBJDKPC1MovV8cYCrH3KWwtoblrXIy3PCMBvCo 1fgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=oJ1V7ClH; 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 4-20020a630e44000000b0043be9db9a04si1308794pgo.193.2022.09.27.00.59.34; Tue, 27 Sep 2022 00:59:46 -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=oJ1V7ClH; 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 S231450AbiI0H7N (ORCPT + 99 others); Tue, 27 Sep 2022 03:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231558AbiI0H5n (ORCPT ); Tue, 27 Sep 2022 03:57:43 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ADC9ACA23 for ; Tue, 27 Sep 2022 00:56:13 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id t4so5974276wmj.5 for ; Tue, 27 Sep 2022 00:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=UGbdJwhNtYNfg6qIard96SGzNtmQLkXSB3qcyDfr1D0=; b=oJ1V7ClH/AxqFsip+Snl9v8pZ3quO3ZUVr2JKxgO/s+X8KKUFRT6eXqmLeRsBKUV+S 7dxCj7gqXUPZs7CjKFJ9pQn2CcbApzGeKH/9pCZF2GGSiij+xFaCZY9hhyFZXAPaU+MK ZdwEiA7p5MT5pAwxf5xBp21GiJxvMg0FaNEbvtY3Sh5FUomwM73EUKW5GCzfWDgMZMxt Foc6fvkXgvb4oeV9NonPouZXSeDg/BJhZFtLb35BZPcax4UwhE0SqBIzSbthWLcHhRA6 UEwTeP1K4uJlZwPMmisUjO/n0JIlegHqUV+owv/PfLUkt2exHgMHqWo6NPtvM0t/aEGI njGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=UGbdJwhNtYNfg6qIard96SGzNtmQLkXSB3qcyDfr1D0=; b=qUw+MoSilhCvX+oCnoYt8UBsH18IQONNxi1leA2KJv64ILvxl4OnNSKVBnBrw1gSgS OLxs/Rko2dLkILIt9a1bMIiYbJ2zcdS78E0PfwNogyRewy7NHpt8c6V2BKAMgjmwjox7 yx1LjPsGSFQHX2XbGgplcBcAec94TLP7pU1VVD9E1AUtq8y0NL6FvsTrJUKlXgaAyq46 HeQOaBuSBwrP0A+kOiLq1ncskqUbtUXpPUqmYUx4Y35dp2t5QjQNLwqW1yRn0H/i6r36 WDz9CpiTiYRhlAiZtgC2CxI+5Y7Xx7EVk6+Yg+ZTdPbEcgoLeEwg9boGB6V4+qhqBL23 qgRg== X-Gm-Message-State: ACrzQf2Gsc3JFMKmou+65gcaH8GHh7eRWP1cyn2MKNGcr9jX0XPS/6w2 Nbt5wHo5SpmoipPz1eNHk3PybA== X-Received: by 2002:a05:600c:4e52:b0:3b4:91ec:b15d with SMTP id e18-20020a05600c4e5200b003b491ecb15dmr1591518wmq.119.1664265349794; Tue, 27 Sep 2022 00:55:49 -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 x8-20020adfdcc8000000b0022afbd02c69sm1076654wrm.56.2022.09.27.00.55.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 00:55:49 -0700 (PDT) From: Corentin Labbe To: heiko@sntech.de, ardb@kernel.org, davem@davemloft.net, herbert@gondor.apana.org.au, krzysztof.kozlowski+dt@linaro.org, mturquette@baylibre.com, robh+dt@kernel.org, sboyd@kernel.org Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Corentin Labbe , John Keeping Subject: [PATCH v10 15/33] crypto: rockchip: use clk_bulk to simplify clock management Date: Tue, 27 Sep 2022 07:54:53 +0000 Message-Id: <20220927075511.3147847-16-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220927075511.3147847-1-clabbe@baylibre.com> References: <20220927075511.3147847-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 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 rk3328 does not have the same clock names than rk3288, instead of using a complex clock management, let's use clk_bulk to simplify their handling. Reviewed-by: John Keeping Signed-off-by: Corentin Labbe --- drivers/crypto/rockchip/rk3288_crypto.c | 66 ++++--------------------- drivers/crypto/rockchip/rk3288_crypto.h | 6 +-- 2 files changed, 11 insertions(+), 61 deletions(-) diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c index 399829ef92e0..a635029ac71d 100644 --- a/drivers/crypto/rockchip/rk3288_crypto.c +++ b/drivers/crypto/rockchip/rk3288_crypto.c @@ -22,47 +22,16 @@ static int rk_crypto_enable_clk(struct rk_crypto_info *dev) { int err; - err = clk_prepare_enable(dev->sclk); - if (err) { - dev_err(dev->dev, "[%s:%d], Couldn't enable clock sclk\n", - __func__, __LINE__); - goto err_return; - } - err = clk_prepare_enable(dev->aclk); - if (err) { - dev_err(dev->dev, "[%s:%d], Couldn't enable clock aclk\n", - __func__, __LINE__); - goto err_aclk; - } - err = clk_prepare_enable(dev->hclk); - if (err) { - dev_err(dev->dev, "[%s:%d], Couldn't enable clock hclk\n", - __func__, __LINE__); - goto err_hclk; - } - err = clk_prepare_enable(dev->dmaclk); - if (err) { - dev_err(dev->dev, "[%s:%d], Couldn't enable clock dmaclk\n", - __func__, __LINE__); - goto err_dmaclk; - } - return err; -err_dmaclk: - clk_disable_unprepare(dev->hclk); -err_hclk: - clk_disable_unprepare(dev->aclk); -err_aclk: - clk_disable_unprepare(dev->sclk); -err_return: + err = clk_bulk_prepare_enable(dev->num_clks, dev->clks); + if (err) + dev_err(dev->dev, "Could not enable clock clks\n"); + return err; } static void rk_crypto_disable_clk(struct rk_crypto_info *dev) { - clk_disable_unprepare(dev->dmaclk); - clk_disable_unprepare(dev->hclk); - clk_disable_unprepare(dev->aclk); - clk_disable_unprepare(dev->sclk); + clk_bulk_disable_unprepare(dev->num_clks, dev->clks); } /* @@ -266,27 +235,10 @@ static int rk_crypto_probe(struct platform_device *pdev) goto err_crypto; } - crypto_info->aclk = devm_clk_get(&pdev->dev, "aclk"); - if (IS_ERR(crypto_info->aclk)) { - err = PTR_ERR(crypto_info->aclk); - goto err_crypto; - } - - crypto_info->hclk = devm_clk_get(&pdev->dev, "hclk"); - if (IS_ERR(crypto_info->hclk)) { - err = PTR_ERR(crypto_info->hclk); - goto err_crypto; - } - - crypto_info->sclk = devm_clk_get(&pdev->dev, "sclk"); - if (IS_ERR(crypto_info->sclk)) { - err = PTR_ERR(crypto_info->sclk); - goto err_crypto; - } - - crypto_info->dmaclk = devm_clk_get(&pdev->dev, "apb_pclk"); - if (IS_ERR(crypto_info->dmaclk)) { - err = PTR_ERR(crypto_info->dmaclk); + crypto_info->num_clks = devm_clk_bulk_get_all(&pdev->dev, + &crypto_info->clks); + if (crypto_info->num_clks < 3) { + err = -EINVAL; goto err_crypto; } diff --git a/drivers/crypto/rockchip/rk3288_crypto.h b/drivers/crypto/rockchip/rk3288_crypto.h index ddbb9246ce16..28bf09fe1c1d 100644 --- a/drivers/crypto/rockchip/rk3288_crypto.h +++ b/drivers/crypto/rockchip/rk3288_crypto.h @@ -190,10 +190,8 @@ struct rk_crypto_info { struct device *dev; - struct clk *aclk; - struct clk *hclk; - struct clk *sclk; - struct clk *dmaclk; + struct clk_bulk_data *clks; + int num_clks; struct reset_control *rst; void __iomem *reg; int irq; -- 2.35.1