Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1452931pxu; Thu, 17 Dec 2020 10:14:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyMs4saI0ZSRKUiSWf++zz/F/A/oDaVwakjd690akP7wkbJJ4A13vsWkUdmpiCCboaIxAAb X-Received: by 2002:a17:907:3fa3:: with SMTP id hr35mr232687ejc.71.1608228883330; Thu, 17 Dec 2020 10:14:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608228883; cv=none; d=google.com; s=arc-20160816; b=PWN4kpPWOf6HoOjUm0rsyY8u5Mx5oN6GX0K+lUim/wKrD7OrJZHnaRuq5tbzDJTeoB 5fe2wy/tyzQ/55nlT6nmUSK4qMrqEQYprgWFKcNZCe/toPEgYhTOb8zmv6r5IqJTKGbw sVwDD3MMXsnAaPQV9Hzc7rAyB720BX4rw9oNQyubhNyYjdMSiv+Nyt20fEUrXS81LVzR cv5gH7zjJ5cCqRYORrnsQrT4XdgRrO70ilXQW9G1oFo/3HfPK8H52AQ77A9TLP0syYDe ScLRzMKvP9KCSds8VWr7FEml6GyqdmOiuHVU/KSWBrkmW8KjZfZnZzWBJXWZKaOiP/qF mrKA== 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=DAtdibIFrFoBdbWxAk3vr83zchLhlmDglPbN6gXDjkM=; b=Z13jsEpQkrtqAv0XJRFA5j11vxk4mKHKiCooKGleuLfAOzbnoAyTM+0I0+Dzy+Dl+S GXSibISUhEohgp0gCyqi5qqnMFIGw/ZIFE/rxvfu5gtXEJxyxfDec0NmnTVCHuB7rfGp KvM+xJC/+ptOU5vl3o0KjTE7naN4SXFqzgZ24lKKxThB3QF/7qvlEvh2rDm8lXWwMkyf HeX+lxuFUthE5XYCZV4/7A0l+tTIj8ox+EKbeNHv+Ju1ECZqERpZDdth/p5Ms06GFzrz 4OjsIdH3sYnrirSeEJ8MurGdSB5MzE/PrT526CzB/svHyHmlx8gmEM5vHRjZQgKr4pbW CDuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N3Ck5qX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m14si38526ejj.422.2020.12.17.10.14.20; Thu, 17 Dec 2020 10:14:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N3Ck5qX6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731541AbgLQSKx (ORCPT + 99 others); Thu, 17 Dec 2020 13:10:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730994AbgLQSJQ (ORCPT ); Thu, 17 Dec 2020 13:09:16 -0500 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02EF5C061A47; Thu, 17 Dec 2020 10:08:10 -0800 (PST) Received: by mail-lf1-x130.google.com with SMTP id l11so59863593lfg.0; Thu, 17 Dec 2020 10:08:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DAtdibIFrFoBdbWxAk3vr83zchLhlmDglPbN6gXDjkM=; b=N3Ck5qX6m1iyF3ASnevrle+liHZfmUJKPpVtCyekINsKU3z6ST0UE5bLfsWvIqI28T q7/Vi3Sc4DvowsD/9Kmvo9md/xI9QWZRDL4tjGFj4npdFEjHST28bU04ou4et5wKrnOO fGttY/cszQ/PtGCr9+VXIP0aN0P10J7+bkhjTUGdyAz347VikCOIE1A/6pxOdMKz2ypq G0p8gf3pn4Qae0IPmyP+JyNMnhpFGkCQ/5nzKj46gc4j5Wo6lbhgkrL0lY/7fhfeBAg0 g6JRxyE7jW+z6VXVtkverbxDgAkw6Wh0KasCpETW49fvq3UdS3d9CrPZiAEb+zOriUYO zpSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DAtdibIFrFoBdbWxAk3vr83zchLhlmDglPbN6gXDjkM=; b=JjsimmKWE0GxH6Ds1THkxofYf9wA8SY3V/pk6tZzFzmPDG4B/Syi0hAp5flLqZF01E Y04oYlM+o/RJgq/Rhfr2yf1F9LkyykbLe38IcjgWhzgOBL8G0pDBLpKjbxIgC2nPX/fd 0IWjy9I8UYkhNuacdkWziVt3c7PLZF1HMOq66Qr1usGSupro4belMiB7A2fHP6a/5HPN zmT3u8FRmohIzQ0W0zMXut8gc/o6SEGcp96Rl5X7z+rRBxW9nFjnTNkGmmtyL6IT3o9x YBqdBx6AhsKsf8AGdzTbxoql54z2r9BFivFQI+LWdE+jP5egRe9mbIPYVeiakhn+iYGZ Y4ow== X-Gm-Message-State: AOAM532Q5bm8rg7kfSRmqPPuBNBZBq3r3Itp3JgGHhQjcR4wFQbfaX6A bnalZmGkC+KLVWIvzUKDj3Y= X-Received: by 2002:a2e:b5b3:: with SMTP id f19mr223623ljn.199.1608228488528; Thu, 17 Dec 2020 10:08:08 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id u5sm655596lff.78.2020.12.17.10.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Dec 2020 10:08:08 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Liam Girdwood , Ulf Hansson , Mauro Carvalho Chehab , Rob Herring , Peter Geis , Nicolas Chauvet , Krzysztof Kozlowski , "Rafael J. Wysocki" , Kevin Hilman , Peter De Schrijver , Viresh Kumar , Stephen Boyd , Michael Turquette Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH v2 42/48] memory: tegra30-emc: Use devm_tegra_core_dev_init_opp_table() Date: Thu, 17 Dec 2020 21:06:32 +0300 Message-Id: <20201217180638.22748-43-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201217180638.22748-1-digetx@gmail.com> References: <20201217180638.22748-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use common devm_tegra_core_dev_init_opp_table() helper for the OPP table initialization. Signed-off-by: Dmitry Osipenko --- drivers/memory/tegra/tegra30-emc.c | 57 +++--------------------------- 1 file changed, 4 insertions(+), 53 deletions(-) diff --git a/drivers/memory/tegra/tegra30-emc.c b/drivers/memory/tegra/tegra30-emc.c index 44ac155936aa..c6309afd9939 100644 --- a/drivers/memory/tegra/tegra30-emc.c +++ b/drivers/memory/tegra/tegra30-emc.c @@ -1480,58 +1480,6 @@ static int tegra_emc_interconnect_init(struct tegra_emc *emc) return err; } -static int tegra_emc_opp_table_init(struct tegra_emc *emc) -{ - u32 hw_version = BIT(tegra_sku_info.soc_speedo_id); - struct opp_table *clk_opp_table, *hw_opp_table; - int err; - - clk_opp_table = dev_pm_opp_set_clkname(emc->dev, NULL); - err = PTR_ERR_OR_ZERO(clk_opp_table); - if (err) { - dev_err(emc->dev, "failed to set OPP clk: %d\n", err); - return err; - } - - hw_opp_table = dev_pm_opp_set_supported_hw(emc->dev, &hw_version, 1); - err = PTR_ERR_OR_ZERO(hw_opp_table); - if (err) { - dev_err(emc->dev, "failed to set OPP supported HW: %d\n", err); - goto put_clk_table; - } - - err = dev_pm_opp_of_add_table(emc->dev); - if (err) { - if (err == -ENODEV) - dev_err(emc->dev, "OPP table not found, please update your device tree\n"); - else - dev_err(emc->dev, "failed to add OPP table: %d\n", err); - - goto put_hw_table; - } - - dev_info(emc->dev, "OPP HW ver. 0x%x, current clock rate %lu MHz\n", - hw_version, clk_get_rate(emc->clk) / 1000000); - - /* first dummy rate-set initializes voltage state */ - err = dev_pm_opp_set_rate(emc->dev, clk_get_rate(emc->clk)); - if (err) { - dev_err(emc->dev, "failed to initialize OPP clock: %d\n", err); - goto remove_table; - } - - return 0; - -remove_table: - dev_pm_opp_of_remove_table(emc->dev); -put_hw_table: - dev_pm_opp_put_supported_hw(hw_opp_table); -put_clk_table: - dev_pm_opp_put_clkname(clk_opp_table); - - return err; -} - static void devm_tegra_emc_unset_callback(void *data) { tegra20_clk_set_emc_round_callback(NULL, NULL); @@ -1577,6 +1525,7 @@ static int tegra_emc_init_clk(struct tegra_emc *emc) static int tegra_emc_probe(struct platform_device *pdev) { + struct tegra_core_opp_params opp_params = {}; struct device_node *np; struct tegra_emc *emc; int err; @@ -1626,7 +1575,9 @@ static int tegra_emc_probe(struct platform_device *pdev) if (err) return err; - err = tegra_emc_opp_table_init(emc); + opp_params.init_state = true; + + err = devm_tegra_core_dev_init_opp_table(&pdev->dev, &opp_params); if (err) return err; -- 2.29.2