Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2895342pxb; Mon, 17 Jan 2022 07:50:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyS9Jw80DeeBgqwSgFcOrYvJVlTxJ8p/SClxxBhEorOPlk9l+UkU5mxnItkKDHv28HgcsNs X-Received: by 2002:a63:3f0e:: with SMTP id m14mr19654329pga.376.1642434642532; Mon, 17 Jan 2022 07:50:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642434642; cv=none; d=google.com; s=arc-20160816; b=Kg2Ej/7W4aG/PqhhijBBLZKU+pTpbxjlYwFopA8+Oa55SCG9gdEDt26YIuBfzk2af5 EZ9IzUvwqri22qbPrVsicj7xXLG/7q6BsLIQPGnwjrOqAFj1xJKWc6YEU3hjkNYGmNbD edFarIO8rELEBu1DZsAPzz8ATe4FNiuakQolfcF/5Wc//5vJowTQwlDvRFk53blBgBiD S4t78simvI06gUtkF3WM9gOU7BWneikArKeliLiEq2L0sPg8AW4qb6RKHJDSJMUWQkr9 +g7dlL7clq+lrYFFLgSwBQSCFJGLK85JVgfB4x/dqjNDZhzr3rOkdt/tFBkf7skj1dga GCfA== 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; bh=u2WjetE2oQN0MefKUA8B2wEylSOlBZdAW9N22zOiKo0=; b=CutRca5+MnpyJBcmjPcLNMQG9soLCCnkgcR+MzYMVnNYzihNzlRfBrMCSSE2SYHRSt Va1jFGgaYcJWLvH3fG9P/hA4NwD1dKbN5mg/koNkCp4vcIoDO68b4pFpkQbXne442oc4 /5jAjM9k2S7CqHq0/BQRXWNV2NhOtxz5nni7zeHyXbi9gI+HFRAn6ad9zWdIDakmOM8y vLY0nm43IeUGrUyGgJZ3Sc6MYC6MsclBzJ8RqKuMKeF9P+VwoAr3vNvon6C/1n26Wkh2 sq/haqwYCLsjLc6EQmrlyITwuzapK0ZCAhORZuIfpR1p9UY8jf+BaqprgrCJOTM/v6R2 Em5g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w20si14770628pga.118.2022.01.17.07.50.29; Mon, 17 Jan 2022 07:50:42 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237409AbiAQHH1 (ORCPT + 99 others); Mon, 17 Jan 2022 02:07:27 -0500 Received: from mailgw01.mediatek.com ([60.244.123.138]:34702 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S237357AbiAQHHQ (ORCPT ); Mon, 17 Jan 2022 02:07:16 -0500 X-UUID: 502752355ffc444ead3f9ef4967e427e-20220117 X-UUID: 502752355ffc444ead3f9ef4967e427e-20220117 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1499993200; Mon, 17 Jan 2022 15:07:12 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Mon, 17 Jan 2022 15:07:11 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 17 Jan 2022 15:07:10 +0800 From: Biao Huang To: , Jakub Kicinski , Rob Herring , CC: Matthias Brugger , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Biao Huang , , , , , , , , , Subject: [PATCH net-next v12 1/7] stmmac: dwmac-mediatek: add platform level clocks management Date: Mon, 17 Jan 2022 15:07:00 +0800 Message-ID: <20220117070706.17853-2-biao.huang@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117070706.17853-1-biao.huang@mediatek.com> References: <20220117070706.17853-1-biao.huang@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch implements clks_config callback for dwmac-mediatek platform, which could support platform level clocks management. Signed-off-by: Biao Huang Acked-by: AngeloGioacchino Del Regno --- .../ethernet/stmicro/stmmac/dwmac-mediatek.c | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c index 58c0feaa8131..0ff57c268dca 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -359,9 +358,6 @@ static int mediatek_dwmac_init(struct platform_device *pdev, void *priv) return ret; } - pm_runtime_enable(&pdev->dev); - pm_runtime_get_sync(&pdev->dev); - return 0; } @@ -370,11 +366,25 @@ static void mediatek_dwmac_exit(struct platform_device *pdev, void *priv) struct mediatek_dwmac_plat_data *plat = priv; clk_bulk_disable_unprepare(plat->num_clks_to_config, plat->clks); - - pm_runtime_put_sync(&pdev->dev); - pm_runtime_disable(&pdev->dev); } +static int mediatek_dwmac_clks_config(void *priv, bool enabled) +{ + struct mediatek_dwmac_plat_data *plat = priv; + int ret = 0; + + if (enabled) { + ret = clk_bulk_prepare_enable(plat->num_clks_to_config, plat->clks); + if (ret) { + dev_err(plat->dev, "failed to enable clks, err = %d\n", ret); + return ret; + } + } else { + clk_bulk_disable_unprepare(plat->num_clks_to_config, plat->clks); + } + + return ret; +} static int mediatek_dwmac_probe(struct platform_device *pdev) { struct mediatek_dwmac_plat_data *priv_plat; @@ -420,6 +430,7 @@ static int mediatek_dwmac_probe(struct platform_device *pdev) plat_dat->bsp_priv = priv_plat; plat_dat->init = mediatek_dwmac_init; plat_dat->exit = mediatek_dwmac_exit; + plat_dat->clks_config = mediatek_dwmac_clks_config; mediatek_dwmac_init(pdev, priv_plat); ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); -- 2.25.1