Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp855495rdb; Wed, 6 Dec 2023 01:38:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGI0qO9p9elIkKzA0bjlz6MmV/hoxhS9+yebLI3/1BMi5kxT9NOOMnzAOuEtwFB+K0jUYra X-Received: by 2002:a05:6e02:1c05:b0:35d:6ddd:7f83 with SMTP id l5-20020a056e021c0500b0035d6ddd7f83mr847113ilh.61.1701855519871; Wed, 06 Dec 2023 01:38:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701855519; cv=none; d=google.com; s=arc-20160816; b=BfmIvi/cmcXT10CGERUjxwI12/zkdGBwtq/Wu36z8PswTB+hGjw+RfuFPgfHFW5ZPr UAnb7xBNByb6PojGXbRoyS5Zcz1hdaPdBisflQTbvVNdhV1CjURGWQnTrIPxzU18Kr+8 AvaTvwPeKYbOUpvycmGgQ6Cyz6+vlbZi86Lp6HfgETIHR1UHoM0AvVi+6bZKaErO8+dh D1JwXANJR36+bOGXdbUiu0rEQXEEkKcvfJYS5x+P8Yyo5AnvsxIegKavjkhwMG3LQYfG bucnR69mmaV/Io8LVVVSJgtzUGQAg0sf8cmsgmjluazWBV9k7vOhyXJz9NaLvgxOuVZx bzIA== 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=4y+flM2aoike/FPH6qr4fSM5H3yUCAUYtHfykcYhVEk=; fh=4XFqYhoFoDZCNTsAMuumPWj6CnGttoVw9HRFMl4668g=; b=VDEJcsBmh3YbBtAF7FuSmhLe2vWrKz3FReRnRd3qZqZcq4W/x5FCNSOmS6gH7PO0sc KWNE2C3/lMU0RbNzfZyv3MSY4cmDNtSN6IG7fwb8MtWsQvanOTzA9jUhnMjjgFdKGa+q yOJ86K7ag9k1yDikRQT/stXdTGF7Qli9XN89YeEQ1FRKV5W2kjwC2SHU0u+YXRSNktn8 JfizKWf88/IWeZcVvx2ndiPssVwE8lAINkn4AKVzCXOpxOcdMr2Jk0yzd5q+k59/4KLL f2yP0wiFg7QpKdYQd3fqzTpHNCbpMOL0bP1ZL8w9GLtMHgzHWHJJVk612sK509Q0COX/ R/tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=k3xwGbvc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id q7-20020a634307000000b0056952b496efsi11209350pga.366.2023.12.06.01.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 01:38:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=k3xwGbvc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 3A8BB807C765; Wed, 6 Dec 2023 01:38:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377200AbjLFJi3 (ORCPT + 99 others); Wed, 6 Dec 2023 04:38:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377117AbjLFJi2 (ORCPT ); Wed, 6 Dec 2023 04:38:28 -0500 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::225]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD4D3B9; Wed, 6 Dec 2023 01:38:33 -0800 (PST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2AE831C000C; Wed, 6 Dec 2023 09:38:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1701855512; 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=4y+flM2aoike/FPH6qr4fSM5H3yUCAUYtHfykcYhVEk=; b=k3xwGbvc8l51DdwhCNNogPX2i1UK8RjJkiIGiGaX0/DJVE/mlb7iIDCQUJX7b0YZt7Pyrz ol/ktsBWk+HKKJ9KtMnbWNEZbsDwzAZarfZ8Tvw7RKPgjQfRyvZTdgdh2dzaknhZgnsGPc CYNBqpr0zllwndP39wsFuYC0BUL1s/YeutbzFu7W1iQ/r2FAd2DGfueucoeZnU4UGzcbUd DKRseSOSfCmYsxVvS2QS2Ef4WcQCfq6MI2Adx2ZJCp2z/Rr7ilVlDANz8ZYN4LzE2Yf7ZG sRDfl+Qr214EPqeEauGxYkj4Y7YZqozG5zfnFxtxI9jLhBh5pkCvFanPbMffsQ== Date: Wed, 6 Dec 2023 10:38:26 +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 3/8] net: pcs: pcs-mtk-lynxi: add platform driver for MT7988 Message-ID: <20231206103826.4e396513@device.home> In-Reply-To: <68bb81ac6bf99393c8de256f42e5715626590af8.1701826319.git.daniel@makrotopia.org> References: <68bb81ac6bf99393c8de256f42e5715626590af8.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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 06 Dec 2023 01:38:38 -0800 (PST) Hello Daniel, My two cents below : On Wed, 6 Dec 2023 01:44:17 +0000 Daniel Golle wrote: > Introduce a proper platform MFD driver for the LynxI (H)SGMII PCS which > is going to initially be used for the MT7988 SoC. > > Signed-off-by: Daniel Golle [ ... ] > +static int mtk_pcs_lynxi_enable(struct phylink_pcs *pcs) > +{ > + struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs); > + > + if (mpcs->sgmii_tx && mpcs->sgmii_rx) { > + clk_prepare_enable(mpcs->sgmii_rx); > + clk_prepare_enable(mpcs->sgmii_tx); You can use the clk_bulk_prepare_enable() here > + } > + > + return 0; > +} > + > static void mtk_pcs_lynxi_disable(struct phylink_pcs *pcs) > { > struct mtk_pcs_lynxi *mpcs = pcs_to_mtk_pcs_lynxi(pcs); > > + regmap_set_bits(mpcs->regmap, SGMSYS_QPHY_PWR_STATE_CTRL, SGMII_PHYA_PWD); > + > + if (mpcs->sgmii_tx && mpcs->sgmii_rx) { > + clk_disable_unprepare(mpcs->sgmii_tx); > + clk_disable_unprepare(mpcs->sgmii_rx); and clk_bulk_disable_unprepare() here [...] > +static int mtk_pcs_lynxi_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct device_node *np = dev->of_node; > + struct mtk_pcs_lynxi *mpcs; > + struct phylink_pcs *pcs; > + struct regmap *regmap; > + u32 flags = 0; > + > + mpcs = devm_kzalloc(dev, sizeof(*mpcs), GFP_KERNEL); > + if (!mpcs) > + return -ENOMEM; > + > + regmap = syscon_node_to_regmap(np->parent); > + if (IS_ERR(regmap)) > + return PTR_ERR(regmap); > + > + if (of_property_read_bool(np->parent, "mediatek,pnswap")) > + flags |= MTK_SGMII_FLAG_PN_SWAP; > + > + mpcs->rstc = of_reset_control_get_shared(np->parent, NULL); > + if (IS_ERR(mpcs->rstc)) > + return PTR_ERR(mpcs->rstc); > + > + reset_control_deassert(mpcs->rstc); > + mpcs->sgmii_sel = devm_clk_get_enabled(dev, "sgmii_sel"); > + if (IS_ERR(mpcs->sgmii_sel)) > + return PTR_ERR(mpcs->sgmii_sel); > + > + mpcs->sgmii_rx = devm_clk_get(dev, "sgmii_rx"); > + if (IS_ERR(mpcs->sgmii_rx)) > + return PTR_ERR(mpcs->sgmii_rx); > + > + mpcs->sgmii_tx = devm_clk_get(dev, "sgmii_tx"); > + if (IS_ERR(mpcs->sgmii_tx)) > + return PTR_ERR(mpcs->sgmii_tx); and clk bulk operations here as well ? Maxime