From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCECCC49ED7 for ; Fri, 20 Sep 2019 05:40:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8E36A207FC for ; Fri, 20 Sep 2019 05:40:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IIa86qxe"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=st.com header.i=@st.com header.b="fzqM/job" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8E36A207FC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=st.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lUiCvPw72yqt96QI4P/o44OudwY5t6iEHf6aMTZ/Fbs=; b=IIa86qxebEbhxh MtA0jZ7a9U0Pg2/VybMJMqFlqg9iRatw9S1Dn5RlBlWHh5OYRSgZG7GUx65VTtwnTSueOcPh2EpNP p0ZBlJXJ9Z7PzqhWk7S4xziz1ic8hrgPcy7an6VYMjVCsHdJY4TH/sHNXa1gImYLu3rGD9Qxlp0ip rFJ9exuxV/gT9dTk4s/zkzHGZcmFqza9NS2ldVS3KUn8S5s0KTPnJc1aJuU0RTSWrcKkJJ+bcfYIy 8tQ9tF9tG0ddehP8qPkgIgQTOL/guNgyE4bEeV6ZQjkF7SEE6CRGp2/GrExGMwwZnVnyV2Tu6Hxzv hPL63aUnK3EkueGipsHg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iBBeC-0002fK-7A; Fri, 20 Sep 2019 05:40:00 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iBBd9-0001uL-QG for linux-arm-kernel@lists.infradead.org; Fri, 20 Sep 2019 05:38:58 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8K5ZtCk010154; Fri, 20 Sep 2019 07:38:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=vyF/QISSJCb/iu6rS6wjZkpjt1WcfYY+i4OiL+tne44=; b=fzqM/jobMihRCtnFWd4AibkzB5Y5OczzCcrRusXKlzgyhU4KgbIot9gZx5QxUTrjUROd zoe2dSz5OwTEFdw+cJt4y+4acsno7+piZ6e0jZVwQ44TVNyAF++59wl1A1FxdRoG244p 0xocaPF+ioXom7dV5BiUKII2MRAQgGeDGIjXqUIZn8Is7S/OlhOuDQDt6cCncYApWaHa UtdpYDWbvFYAvgFAyxOlX03xVLcdYFBOwQ4ihlx/H2JKySWqDdAgcbXmG/rRIAOCKL0V CMTO4J97j2PndiJLjridOgH0Ue2/jB6Wl63RheW7KqcRXBZ8WuU9e1Tppd0rYVueGaN3 iw== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx08-00178001.pphosted.com with ESMTP id 2v3va18qd8-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 20 Sep 2019 07:38:43 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 13B9351; Fri, 20 Sep 2019 05:38:36 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id BB7F82209B1; Fri, 20 Sep 2019 07:38:35 +0200 (CEST) Received: from SAFEX1HUBCAS24.st.com (10.75.90.95) by SAFEX1HUBCAS23.st.com (10.75.90.46) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 20 Sep 2019 07:38:35 +0200 Received: from localhost (10.201.22.222) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 20 Sep 2019 07:38:35 +0200 From: Christophe Roullier To: , , , , , , Subject: [PATCH 1/5] net: ethernet: stmmac: Add support for syscfg clock Date: Fri, 20 Sep 2019 07:38:13 +0200 Message-ID: <20190920053817.13754-2-christophe.roullier@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190920053817.13754-1-christophe.roullier@st.com> References: <20190920053817.13754-1-christophe.roullier@st.com> MIME-Version: 1.0 X-Originating-IP: [10.201.22.222] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-20_01:2019-09-19,2019-09-20 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190919_223856_276002_2468F7B0 X-CRM114-Status: GOOD ( 18.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, andrew@lunn.ch, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, christophe.roullier@st.com, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add optional support for syscfg clock in dwmac-stm32.c Now Syscfg clock is activated automatically when syscfg registers are used Signed-off-by: Christophe Roullier --- .../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c index 4ef041bdf6a1..7e6619868cc1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c @@ -152,23 +152,32 @@ static int stm32mp1_clk_prepare(struct stm32_dwmac *dwmac, bool prepare) int ret = 0; if (prepare) { - ret = clk_prepare_enable(dwmac->syscfg_clk); - if (ret) - return ret; - + if (dwmac->syscfg_clk) { + ret = clk_prepare_enable(dwmac->syscfg_clk); + if (ret) + return ret; + } if (dwmac->clk_eth_ck) { ret = clk_prepare_enable(dwmac->clk_eth_ck); if (ret) { - clk_disable_unprepare(dwmac->syscfg_clk); + if (dwmac->syscfg_clk) + goto unprepare_syscfg; return ret; } } } else { - clk_disable_unprepare(dwmac->syscfg_clk); + if (dwmac->syscfg_clk) + clk_disable_unprepare(dwmac->syscfg_clk); + if (dwmac->clk_eth_ck) clk_disable_unprepare(dwmac->clk_eth_ck); } return ret; + +unprepare_syscfg: + clk_disable_unprepare(dwmac->syscfg_clk); + + return ret; } static int stm32mp1_set_mode(struct plat_stmmacenet_data *plat_dat) @@ -296,7 +305,7 @@ static int stm32mp1_parse_data(struct stm32_dwmac *dwmac, { struct platform_device *pdev = to_platform_device(dev); struct device_node *np = dev->of_node; - int err = 0; + int err; /* Gigabit Ethernet 125MHz clock selection. */ dwmac->eth_clk_sel_reg = of_property_read_bool(np, "st,eth-clk-sel"); @@ -320,13 +329,17 @@ static int stm32mp1_parse_data(struct stm32_dwmac *dwmac, return PTR_ERR(dwmac->clk_ethstp); } - /* Clock for sysconfig */ + /* Optional Clock for sysconfig */ dwmac->syscfg_clk = devm_clk_get(dev, "syscfg-clk"); if (IS_ERR(dwmac->syscfg_clk)) { - dev_err(dev, "No syscfg clock provided...\n"); - return PTR_ERR(dwmac->syscfg_clk); + err = PTR_ERR(dwmac->syscfg_clk); + if (err != -ENOENT) + return err; + dwmac->syscfg_clk = NULL; } + err = 0; + /* Get IRQ information early to have an ability to ask for deferred * probe if needed before we went too far with resource allocation. */ @@ -436,7 +449,8 @@ static int stm32mp1_suspend(struct stm32_dwmac *dwmac) return ret; clk_disable_unprepare(dwmac->clk_tx); - clk_disable_unprepare(dwmac->syscfg_clk); + if (dwmac->syscfg_clk) + clk_disable_unprepare(dwmac->syscfg_clk); if (dwmac->clk_eth_ck) clk_disable_unprepare(dwmac->clk_eth_ck); -- 2.17.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel