Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5870748rdb; Thu, 14 Dec 2023 01:50:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNcKe4IEWs/eo/KyeIoHJDTQrW2BLMj1FPEOiqErdMgnIRYm4jeGT3T9vsq1HydxhczLdl X-Received: by 2002:a17:903:11c7:b0:1d2:ec56:eab8 with SMTP id q7-20020a17090311c700b001d2ec56eab8mr13630965plh.44.1702547451309; Thu, 14 Dec 2023 01:50:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702547451; cv=none; d=google.com; s=arc-20160816; b=TItCs7lz1ErtHsiRJCd2NP3mzCnaIB8YJaNbh3uPLVDgqy3LQaSWy7eQ9mZ5ipYdjR eDxHVbtql8ViPKugSYXCwQ4+NKwiGntMQSSIEeXQL9t8KPxA0ILqgAz+lg0ApvH70Byc /701lD04/d7LH8lEeQT9h4tf5XTj4uaugR+el5pkzCS9xuC6xS6fJnl/Ppm158+tb7cF igOkHqpOdIwRb++8UhoAcaMNI2jbfWlcOey+kbH4DOxJou6bBlBHQc3Av7aGEi92W7KF y9GdcsOMdMDIl6UZw9L6H9ieYMZn5nqERRMqqfqdTXz1xzW5oZybjAv7MEMQ+PFNdiwh RW6g== 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=UPSQOuBh14dqy+VE2CjEh9qgLnMj8uBsrhetcQjZ3IU=; fh=/GuWXIFJTb2Z3LVYajHwooJWphp6NrpriHhj5GHcik0=; b=iqoPlgGpClMURv8V2luCTg8DepeCqOInk86xiYWBBxsPHwA5ChwsBL7hralXCFRKHO mdN0MRvPiqrp8WAX9VXLjQDg8Z6tkfO16nliPCKxQniW3dDcb3Nneh40kgGYkZQYBkeK setFBQzBV4V1C4lAnnfQFPB7NclQDm4DJraMcUckiGU+eO0MXhigrlOR0Mx4uaonq1bS 6brI8gv7APc0MftbUmosCRx3cnohGy++DC0LAY2kRVfegXcfdKhcOqsHsrylizksiBr1 X0GGP4XrnAotDOJ3HLKfJIIXya/R8e7Bug56GqyktJ1pMoVs2o3bnig4YKo/lz33NZp3 /bvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jq5c+gON; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id i34-20020a635422000000b005c658bf30a8si10852583pgb.302.2023.12.14.01.50.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 01:50:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=jq5c+gON; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1DF938326584; Thu, 14 Dec 2023 01:50:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443668AbjLNJuZ (ORCPT + 99 others); Thu, 14 Dec 2023 04:50:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443650AbjLNJuF (ORCPT ); Thu, 14 Dec 2023 04:50:05 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15FBF19B1; Thu, 14 Dec 2023 01:49:35 -0800 (PST) Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3BE4qC9p028409; Thu, 14 Dec 2023 09:49:22 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=UPSQOuBh14dqy+VE2CjEh9qgLnMj8uBsrhetcQjZ3IU=; b=jq 5c+gON2jdEBM5olU312eYmoqhMK35j6nmuOxZChmejvRbSuvn7FInxLILw+DirSs yw4jY/ic+NmvoIU+CHPvXFSPEQxkvl5vyrH+Ai/t+O6Qp254T/y63wSGdrK72Jk7 66G/WmFaiuCZcZdfiM+zBxXlB5Cu3chInu1TLC3AzQG4MQx7o/WLkUecLUsi4WfZ Lk8q02PwuHM5LhBkqHNVhzVP3JMeA8h0T87irlzO2ccBr1YS7GOFl9aJa849nYgg wgUj7ARq01gFT63rdQNRN+zuoewo5QMGxCtK5U+D3Hn1mdmaLKN5KkHe03JJQI/w GFdmQRc0dPFZF+0D6Ccg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3uytn68jy3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 09:49:22 +0000 (GMT) Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3BE9nLw6007213 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 14 Dec 2023 09:49:21 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 01:49:17 -0800 From: Luo Jie To: , , , , , , , , , , , , CC: , , , Subject: [PATCH v7 12/14] net: phy: at803x: configure qca8084 common clocks Date: Thu, 14 Dec 2023 17:48:11 +0800 Message-ID: <20231214094813.24690-13-quic_luoj@quicinc.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231214094813.24690-1-quic_luoj@quicinc.com> References: <20231214094813.24690-1-quic_luoj@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) 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-GUID: xl1nKYK7jXxhSbPAdIJ-EWH0Wf5GjBxP X-Proofpoint-ORIG-GUID: xl1nKYK7jXxhSbPAdIJ-EWH0Wf5GjBxP 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 clxscore=1015 malwarescore=0 phishscore=0 mlxlogscore=999 mlxscore=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 bulkscore=0 impostorscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2312140065 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Dec 2023 01:50:47 -0800 (PST) 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 204f5ca6001c..4499d78891d2 100644 --- a/drivers/net/phy/at803x.c +++ b/drivers/net/phy/at803x.c @@ -340,6 +340,14 @@ static struct at803x_hw_stat at803x_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, @@ -389,6 +397,14 @@ struct at803x_context { }; static const char *const qca8084_clock_name[QCA8084_CLK_CNT] = { + "apb_bridge", + "ahb", + "sec_ctrl_ahb", + "tlmm", + "tlmm_ahb", + "cnoc_ahb", + "mdio_ahb", + "mdio_master_ahb", "srds0_sys", "srds1_sys", "gephy0_sys", @@ -1168,6 +1184,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; @@ -1180,7 +1243,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