From patchwork Mon Jun 12 09:23:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13275937 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52BB0C7EE2E for ; Mon, 12 Jun 2023 09:31:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234999AbjFLJbq (ORCPT ); Mon, 12 Jun 2023 05:31:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232389AbjFLJaQ (ORCPT ); Mon, 12 Jun 2023 05:30:16 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A5D830F1 for ; Mon, 12 Jun 2023 02:24:48 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4f649db9b25so4696571e87.0 for ; Mon, 12 Jun 2023 02:24:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1686561886; x=1689153886; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c3HXmWBI5xLrWbOkueODzJ5MVGSA4Kc5TK/lazRH0B0=; b=kzgUUkMC5jsWR5xW0+ANRcf2btdakfoFVSpYBSE9CikTfQlpt+AqLN7zdBbZJFtLme xv5/N8+XHKqeOLiYheLN/vH4zRYHi9T6pytx/a+feZ6Ar+vvWiN0Eku+dctJjFBED96f y6dlmLfFclU/1M8/Dkh0s6PVP4tPSxlThdgfNA1wtRmX3AYoPWL+galeUX+z96THhp9l eoKOC7/6cBKs8NL0f/gd6xfgLidEidiAmfGdioadvL+hjOWjmHTAkyP/TtqA63cg+m8E 1Ro1pxSPqRZ/FZLWuM9+n+8mX+utAr5AZu5GwTebLop+/HDkLST5jFVWE05M/IewJtwh TSsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686561886; x=1689153886; 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:message-id:reply-to; bh=c3HXmWBI5xLrWbOkueODzJ5MVGSA4Kc5TK/lazRH0B0=; b=Eq1VMgyAUgAZQIMdRCiYhd+9GwV6nf4I3SQZAcHO2ztSt3EbaZQQ+sb0Y9PzM37uid 46e2vCPgLGlbsqASQdMwPF0HwWYjvSnQLcTAy/xUYEnFNKJJuPfQfC+Z+u7FhX/xRAL1 hNt7rk+kiAOE8wjxQKHtaT2NDaT6zqdCXigzHc20qsFUcfWm1nTCYblMlcv9vUEGo2Jp YCJ9sDHB/lrHHSh5SYSjOyNMiiuBfxjdicjHW4wxh0xc81Fjdb9S2aVxuUhCKIEcfiNO qbqCNWXfxLGYblIaIpFtGoMQa+JPkF6fgRr7itIMuh2eEMYMbH6SeWNbEi+wSm/buytg HH5w== X-Gm-Message-State: AC+VfDy/iFKBRyiuYcddGFeIfVGRzrxMkNmC597+z4UhkUEKqa3CZeYc Tb6yC4fusHeCOZdf6GN/bfDjcw== X-Google-Smtp-Source: ACHHUZ5ccKjNrjHtWSXeFcXvi6pGIDd0bXqsgL6lZowErwFAW975a65dQyiL/g71vDQz5+NfmBtGXA== X-Received: by 2002:a05:6512:615:b0:4f2:5d38:2c37 with SMTP id b21-20020a056512061500b004f25d382c37mr3795687lfe.15.1686561886665; Mon, 12 Jun 2023 02:24:46 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a222:bbe9:c688:33ae]) by smtp.gmail.com with ESMTPSA id p14-20020a7bcc8e000000b003f727764b10sm10892044wma.4.2023.06.12.02.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 02:24:46 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Kishon Vijay Abraham I , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Bartosz Golaszewski Subject: [PATCH 14/26] net: stmmac: dwmac-qcom-ethqos: add optional phyaux clock Date: Mon, 12 Jun 2023 11:23:43 +0200 Message-Id: <20230612092355.87937-15-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230612092355.87937-1-brgl@bgdev.pl> References: <20230612092355.87937-1-brgl@bgdev.pl> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Bartosz Golaszewski On sa8775p we don't use the RGMII clock but have an additional PHYAUX clock so add support for it to the driver. Signed-off-by: Bartosz Golaszewski --- .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 252dca400071..2f6b9b419601 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -94,6 +94,7 @@ struct qcom_ethqos { unsigned int rgmii_clk_rate; struct clk *rgmii_clk; + struct clk *phyaux_clk; struct phy *serdes_phy; unsigned int speed; @@ -604,6 +605,13 @@ static int ethqos_clks_config(void *priv, bool enabled) return ret; } + ret = clk_prepare_enable(ethqos->phyaux_clk); + if (ret) { + clk_disable_unprepare(ethqos->rgmii_clk); + dev_err(ðqos->pdev->dev, "phyaux enable failed\n"); + return ret; + } + /* Enable functional clock to prevent DMA reset to timeout due * to lacking PHY clock after the hardware block has been power * cycled. The actual configuration will be adjusted once @@ -611,6 +619,7 @@ static int ethqos_clks_config(void *priv, bool enabled) */ ethqos_set_func_clk_en(ethqos); } else { + clk_disable_unprepare(ethqos->phyaux_clk); clk_disable_unprepare(ethqos->rgmii_clk); } @@ -669,6 +678,12 @@ static int qcom_ethqos_probe(struct platform_device *pdev) goto out_config_dt; } + ethqos->phyaux_clk = devm_clk_get_optional(dev, "phyaux"); + if (IS_ERR(ethqos->phyaux_clk)) { + ret = PTR_ERR(ethqos->phyaux_clk); + goto out_config_dt; + } + ret = ethqos_clks_config(ethqos, true); if (ret) goto out_config_dt;