Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp858544rdb; Wed, 6 Dec 2023 01:46:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNMChk8eXUirWR2BUYO9qEpS8Xc/qqW+G2u9SMZ449R4inOARDAqZsGOPdQjs0+Xr3MlIn X-Received: by 2002:a05:6a20:3c8e:b0:18f:e048:78a2 with SMTP id b14-20020a056a203c8e00b0018fe04878a2mr174779pzj.44.1701855989233; Wed, 06 Dec 2023 01:46:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701855989; cv=none; d=google.com; s=arc-20160816; b=mk7M/dcFHBwfL/IVdAKKHBL2sQMs7+6THu8g4dvSjiJeI6Hnnn2Nemrq82/4ob4Xad dX1qUSZF/9ixZvsALpS47EtSTIRbBvekMWd38IdW6dVrfrVj7aWEYGca0IIL7A4HPtSB bYM7KDAaItvyr9q5XSUEbI0E2o3nF51W8ZuvWZu7VXPRpZQOeEZ7AIkw70zLt/8b3A66 9QownaeS1miEqYdNrFbIZWiA4dSWMGlFCc3v/mooZ6xuZ6dD0Oy++LNjAnA3PlWqgulK kXs+DZyHDFEF1BkFhov75Xgo2eakUItTWiXmGMdzSbNrSSZcKUam0FlfjxrdtbAMs7L7 cL2g== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=1wOVKCT46yFHYzsZfptn/YLuf58amecso91N0y4R11c=; fh=4XFqYhoFoDZCNTsAMuumPWj6CnGttoVw9HRFMl4668g=; b=rv86Jry1UImujs/vvlL7Azm3TN1lTIPBWZjfLIdkzOk2z19W046Q4Np/PKlGCHo3GI FxNeAXGJxN8PHfnt+IpwF3E1/O1be+1dDI/2At36l8SY+qXlw5D5d1ZE9RHJl0V2R09V 2zy8LCq7qQHMHYHwY8uGYwXFAo9yj8ivbp61LURZwn5RdcrQ+UN4MA3RCuHJXfa4cyeP B7ZAiU/DcgcemCQi6EsACvTnQGZ12I2egqU2s5ehmcFb/lNer3NlwFBh/mPqo7ThVM9I +F/xgo9Zp3bSOlh5vNsN1uYWX4jFXyYjIMXG92RTqmLo7q48SxqS0pe0lqGJuVUkKith aqUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=J6Viro+m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id v5-20020a17090a898500b0028558f4e661si2699272pjn.145.2023.12.06.01.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 01:46:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=J6Viro+m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id DAB918082A73; Wed, 6 Dec 2023 01:45:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377199AbjLFJoy (ORCPT + 99 others); Wed, 6 Dec 2023 04:44:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229471AbjLFJoy (ORCPT ); Wed, 6 Dec 2023 04:44:54 -0500 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51149B9; Wed, 6 Dec 2023 01:44:59 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 3672B20005; Wed, 6 Dec 2023 09:44:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701855897; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1wOVKCT46yFHYzsZfptn/YLuf58amecso91N0y4R11c=; b=J6Viro+mz0owT7xGlK236zyL/HHYYcaom8AJXxIhCJMxSlaCJIaCrVXTji8O0Y2B+FB3yI Ki01S0DKSB/GoyzwVdzLKhDlNObkSufX0srTobqBjEeIx8Mrk8IR5FNoOGCGiFfDUwgnvf 19+Uf8Rp0ztIC+ysfcHt9FZXj6whr9foZTg/GS1oFm0uxrMeZ9QT/431AC2O1k+erb3MKg eePPpZRAN1tp/2qZTHcU4e6sPPlFPUEj3+etcmOKCKOULfBZJqVNa1b52PePUBkcj67nft mRFIcgRG5xrRP0G44UqazKz5cxGUgTYE8mw0WOpSfevOFsWtdzXGhB4f1081og== Date: Wed, 6 Dec 2023 10:44:48 +0100 From: Maxime Chevallier To: Daniel Golle Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chunfeng Yun , Vinod Koul , Kishon Vijay Abraham I , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , Andrew Lunn , Heiner Kallweit , Russell King , Alexander Couzens , Qingfang Deng , SkyLake Huang , Philipp Zabel , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-phy@lists.infradead.org Subject: Re: [RFC PATCH v2 2/8] phy: add driver for MediaTek pextp 10GE SerDes PHY Message-ID: <20231206104448.0774da58@device.home> In-Reply-To: <63636378a52dd1ea7370dbf0ca3037a7d24004b9.1701826319.git.daniel@makrotopia.org> References: <63636378a52dd1ea7370dbf0ca3037a7d24004b9.1701826319.git.daniel@makrotopia.org> Organization: Bootlin X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-GND-Sasl: maxime.chevallier@bootlin.com 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 06 Dec 2023 01:45:25 -0800 (PST) Hello Daniel, On Wed, 6 Dec 2023 01:44:08 +0000 Daniel Golle wrote: > Add driver for MediaTek's pextp 10 Gigabit/s Ethernet SerDes PHY which > can be found in the MT7988 SoC. > > The PHY can operates only in PHY_MODE_ETHERNET, the submode is one of > PHY_INTERFACE_MODE_* corresponding to the supported modes: > > * USXGMII > * 10GBase-R > * 5GBase-R > * 2500Base-X > * 1000Base-X > * Cisco SGMII (MAC side) > > In order to work-around a performance issue present on the first of > two PEXTP present in MT7988 special tuning is applied which can be > selected by adding the mediatek,usxgmii-performance-errata property to > the device tree node. > > There is no documentation what-so-ever for the pextp registers and > this driver is based on a GPL licensed implementation found in > MediaTek's SDK. > > Signed-off-by: Daniel Golle > --- [...] > + > +static int mtk_pextp_power_on(struct phy *phy) > +{ > + struct mtk_pextp_phy *pextp = phy_get_drvdata(phy); > + int ret; > + > + ret = clk_prepare_enable(pextp->clk[0]); > + if (ret) > + return ret; > + > + return clk_prepare_enable(pextp->clk[1]); > +} clk_bulk operations could be used here > +static int mtk_pextp_power_off(struct phy *phy) > +{ > + struct mtk_pextp_phy *pextp = phy_get_drvdata(phy); > + > + clk_disable_unprepare(pextp->clk[1]); > + clk_disable_unprepare(pextp->clk[0]); > + > + return 0; > +} Here > +static const struct phy_ops mtk_pextp_ops = { > + .power_on = mtk_pextp_power_on, > + .power_off = mtk_pextp_power_off, > + .set_mode = mtk_pextp_set_mode, > + .reset = mtk_pextp_reset, > + .owner = THIS_MODULE, > +}; > + > +static int mtk_pextp_probe(struct platform_device *pdev) > +{ > + struct device_node *np = pdev->dev.of_node; > + struct phy_provider *phy_provider; > + struct mtk_pextp_phy *pextp; > + struct phy *phy; > + > + if (!np) > + return -ENODEV; > + > + pextp = devm_kzalloc(&pdev->dev, sizeof(*pextp), GFP_KERNEL); > + if (!pextp) > + return -ENOMEM; > + > + pextp->base = devm_of_iomap(&pdev->dev, np, 0, NULL); > + if (!pextp->base) > + return -EIO; > + > + pextp->dev = &pdev->dev; > + pextp->clk[0] = devm_clk_get(&pdev->dev, "topxtal"); > + if (IS_ERR(pextp->clk[0])) > + return PTR_ERR(pextp->clk[0]); > + > + pextp->clk[1] = devm_clk_get(&pdev->dev, "xfipll"); > + if (IS_ERR(pextp->clk[1])) > + return PTR_ERR(pextp->clk[1]); And here as well. Thanks, Maxime