Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6507216rdb; Thu, 14 Dec 2023 23:46:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2Tu4lI0tsGYbXBGIPxvScG/JsEArqMccNJRwsRvVFWF2inJnTPMapk4W8MQQTYkyKvRwP X-Received: by 2002:a05:6358:52ce:b0:170:f019:3122 with SMTP id z14-20020a05635852ce00b00170f0193122mr7397641rwz.7.1702626397356; Thu, 14 Dec 2023 23:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702626397; cv=none; d=google.com; s=arc-20160816; b=fx0l1Flbvnd6J9ZfSe+xKM5ng5T+ubSjEPYAildbCbM7O+MD/2M3M6JexYfYZB01+o 9y6PWwNeJZ7W7f4NvB6fKg0Izz9lVsscK2aWP5i7faoxC0ogIlbA618wa4BuWHPiuK3x +CRCbTpl3oEbfxt+3O+QcHqoGRwzHlUsGS5ReMYZX0LLrP9W1oWNoWFQa2F6dwzmfdlJ o0BWnVQ1SOewDr6Nx88suzdPK2/p+sjko8WrMwcZXq2zgZKWsLFmRF6LSnPPLjo/guY3 3tL9KOR3CE7KjPBAQlFLz3oHRW3keSzR8jFefMQ9iXZCheqsZVusZ4O5V/7iVg5DNuwl fiYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=YrZo+c4DtXh15qYYe/RRRGILE2qQhvakcQbBlfaMAmg=; fh=/GuWXIFJTb2Z3LVYajHwooJWphp6NrpriHhj5GHcik0=; b=kq0MRbwJbAqXTpO9Is/CzVm+raJgJo3eGQCdw65h8xQ+rxPi0HY3CBSnjK0xPOi0Xb OuDtLP3mYOLtALPOc3C7EYXwVTWvcb28yE/xDh56101uTbJtf0m+QE6+PXfA+0nKthux me5Z1Nu4JYo/ZmzJeG4V0a9Noh+fnDjQizLo+lpohx8KH29MH7onNLS3FWj+6s8k3Gws VpTXaEsYtlXyO15B1GmUX3gNdD/IW+VdIciGqTvo+nyTfmM4mI8mNrVZ+vl0sFw/WnOq DDd9DnJuazVK/yscs+Yh28djKoB9bArh4Kr78Ihork+ch1CWgS+DaVhCScngTwvhvIkG 9/Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=YDGZ3btr; spf=pass (google.com: domain of linux-kernel+bounces-553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-553-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a123-20020a636681000000b005c6032d28c2si12262597pgc.41.2023.12.14.23.46.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 23:46:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=YDGZ3btr; spf=pass (google.com: domain of linux-kernel+bounces-553-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-553-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E9BEA28729B for ; Fri, 15 Dec 2023 07:46:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B4F22DB72; Fri, 15 Dec 2023 07:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="YDGZ3btr" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E609B2D7AA; Fri, 15 Dec 2023 07:41:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BF6Da2u015208; Fri, 15 Dec 2023 07:41:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= qcppdkim1; bh=YrZo+c4DtXh15qYYe/RRRGILE2qQhvakcQbBlfaMAmg=; b=YD GZ3btr7i/H78GlHGu7CWLg+hF0LLAXanz5yBzbzdMj8bNr1diPaKRigUXo11fT3g pnwF2j2XlM8ZuHLWhZGxRyK/P4rO31F6TxDZOe/x4mLNBLdaX2H1xZ1VaJUBJb+l hQCP6n4FSx6iC1yUfXfJHV9lUqt2B7s7oEa2yUBtQPJ5dUxkcepVrbvFSihFhMY3 06Gg1JjT38Hh7MxcrVDr2Id5TsFwRGseclE9FVGYjZGY7Nb4kD0cHCUuh4XCyEwf 6oQeO/4cIVACrUZi8Fw4KcQCUt+RUHbqUuaMtpS1cADVFIY2Nt7EzK4geT83ELkp +a/TqxhGEPuBnIFx9CBg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3v0hb00745-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 07:41:20 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BF7fJZ5022331 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 15 Dec 2023 07:41:19 GMT Received: from akronite-sh-dev02.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Thu, 14 Dec 2023 23:41:15 -0800 From: Luo Jie To: , , , , , , , , , , , , CC: , , , Subject: [PATCH v8 12/14] net: phy: at803x: configure qca8084 common clocks Date: Fri, 15 Dec 2023 15:40:02 +0800 Message-ID: <20231215074005.26976-13-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231215074005.26976-1-quic_luoj@quicinc.com> References: <20231215074005.26976-1-quic_luoj@quicinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: ydnC9ijGTP51n5Tjq2aUS8FJyQTbYZ78 X-Proofpoint-GUID: ydnC9ijGTP51n5Tjq2aUS8FJyQTbYZ78 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 malwarescore=0 priorityscore=1501 impostorscore=0 spamscore=0 mlxlogscore=999 clxscore=1015 lowpriorityscore=0 bulkscore=0 suspectscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312150047 After initial clock sequence, the clock source 312.5MHZ is available, the common clocks based on clock source 312.5MHZ needs to be configured, which includes APB bridge clock tree with rate 312.5MHZ, AHB clock tree with 104.17MHZ. Signed-off-by: Luo Jie --- drivers/net/phy/at803x.c | 69 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c index 9885a728c72a..3ef4eacf40c7 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -340,6 +340,14 @@ static struct at803x_hw_stat qca83xx_hw_stats[] = { }; enum { + APB_BRIDGE_CLK, + AHB_CLK, + SEC_CTRL_AHB_CLK, + TLMM_CLK, + TLMM_AHB_CLK, + CNOC_AHB_CLK, + MDIO_AHB_CLK, + MDIO_MASTER_AHB_CLK, SRDS0_SYS_CLK, SRDS1_SYS_CLK, GEPHY0_SYS_CLK, @@ -363,6 +371,14 @@ enum { }; static const char *const qca8084_clock_name[] = { + "apb_bridge", + "ahb", + "sec_ctrl_ahb", + "tlmm", + "tlmm_ahb", + "cnoc_ahb", + "mdio_ahb", + "mdio_master_ahb", "srds0_sys", "srds1_sys", "gephy0_sys", @@ -975,6 +991,53 @@ static int qca8084_clock_config(struct phy_device *phydev) return 0; } +static int qca8084_common_clock_init(struct phy_device *phydev) +{ + struct at803x_priv *priv; + int ret = 0; + + priv = phydev->priv; + /* Enable APB bridge tree clock */ + ret = clk_set_rate(priv->clk[APB_BRIDGE_CLK], 312500000); + if (ret) + return ret; + + ret = clk_prepare_enable(priv->clk[APB_BRIDGE_CLK]); + if (ret) + return ret; + + /* Enable AHB tree clocks */ + ret = clk_set_rate(priv->clk[AHB_CLK], 104170000); + if (ret) + return ret; + + ret = clk_prepare_enable(priv->clk[AHB_CLK]); + if (ret) + return ret; + + ret = clk_prepare_enable(priv->clk[SEC_CTRL_AHB_CLK]); + if (ret) + return ret; + + ret = clk_prepare_enable(priv->clk[TLMM_CLK]); + if (ret) + return ret; + + ret = clk_prepare_enable(priv->clk[TLMM_AHB_CLK]); + if (ret) + return ret; + + ret = clk_prepare_enable(priv->clk[CNOC_AHB_CLK]); + if (ret) + return ret; + + ret = clk_prepare_enable(priv->clk[MDIO_AHB_CLK]); + if (ret) + return ret; + + return clk_prepare_enable(priv->clk[MDIO_MASTER_AHB_CLK]); +} + static int qca8084_probe(struct phy_device *phydev) { int ret; @@ -987,7 +1050,11 @@ static int qca8084_probe(struct phy_device *phydev) if (ret) return ret; - return qca8084_clock_config(phydev); + ret = qca8084_clock_config(phydev); + if (ret) + return ret; + + return qca8084_common_clock_init(phydev); } static int at803x_probe(struct phy_device *phydev) -- 2.42.0