Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp1249756rdh; Fri, 24 Nov 2023 08:12:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYFeBto5tOS6Q+q9K0l5yvBuoPaPyU17Kafh13bZYqt9dFosrEK9QxCX2yoiZ2IZMf+rxA X-Received: by 2002:a05:6808:1288:b0:3b8:3ff6:3071 with SMTP id a8-20020a056808128800b003b83ff63071mr1846027oiw.12.1700842331646; Fri, 24 Nov 2023 08:12:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700842331; cv=none; d=google.com; s=arc-20160816; b=u/idGw/+tzSuPuefRhwx4RyyAAN1Cq1JeaC9kOkmUosDp8hRn7Ya1HNxgHh6CSYl3e AKRGndTT6iwBNA3CHRiv3yj3MwjjzXE1GiPhuFPzFz8jAjw5AFUqXxqSd+kW89rMzqAt /QIr+DImoqaZNMEa5m++BK6IlU1u4ldmSBz7LfGepnWft3zfv8PT+fVusS/ywyK8W45/ Q4zwnudIZdFRkdUIEHTPl4yb5wYZAYPYSRlxcKbQi5jfCSk33KqRnp8AR2NeGTE+3XBH IPJvKkQ0ISBV2bxnzgIWYanqkxCceE3GI4z3n6+pIrs5wGxz9cOfoP+htlECKGcMS8Tq wGTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=I35NveYhkoZ28DMqDop9zJmkqxtTHkbKlKYsYxwRQuE=; fh=cbksp0H6vv3AAiKhAaLJkBOyuTHKli1jXKU5wbhXYnU=; b=g3ZWPNmhk66fmTEVoTEgp6S66ldYa2RM1CCokbGazvs/InpxerdWuWR1LL/gvo/7zt pWl5zINzcw88QfLcb1NqDWtiB5xPgvoJeVj+35XIVPLTtW2V88FKm32+5xhSck+VuyGO dL9eCaaIZdVZLLpECPlanUisi0BD8MnrGXXp+b8tNqbYBKO+7WljmeH5KSu0UznrUbOh ryszdrJCso0IHaHewHXetxUb8jMWzD6wtsqkli3mv8aIIpGuIWGfHrBQ5T19HjlUp0VP ZsYsiJp9FszrnjquROHda5inPn6/F9GAYj3ZTagdCtyf+xzdEi+NK31BhWRVohUQ7hya tQHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=huFi1LIG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id fg14-20020a056808640e00b003b834603fb4si1615307oib.313.2023.11.24.08.12.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 08:12:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=huFi1LIG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 4A61380A0DFA; Fri, 24 Nov 2023 08:12:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231259AbjKXQLw (ORCPT + 99 others); Fri, 24 Nov 2023 11:11:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345505AbjKXQLp (ORCPT ); Fri, 24 Nov 2023 11:11:45 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D51119AB; Fri, 24 Nov 2023 08:11:49 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a03a900956dso398610166b.1; Fri, 24 Nov 2023 08:11:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700842308; x=1701447108; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=I35NveYhkoZ28DMqDop9zJmkqxtTHkbKlKYsYxwRQuE=; b=huFi1LIGb+FA19Pp5QUqdux4rLG4jOmab9aAEmc2lFcqUWvO0jo7QIjgj0ptLgbM5E +AMxlu0YqhxoJuuv4Ma1j/xglUIRfR2aVnbw+pKvjwrNjTR8u5IfIBz9IUlHH8q0dFgG 2khzNu4MwiAitKWPIVkyrVG1TRqno4Sd7kEj7YfWNp3CxeCz3zNFqSSEtEjjpKPp+x8N 5Fd+Tk+xs5oTvlFcCdb5fSjOKEzM31Y1enALCfy84tocIcO8NRqF7Ccoths/+Dc+VuFC 9nBxzwxu/hKabMRZKycsdB4mzl50EkegasLM7PdA8+m/id3h5FiMjeXzwWW8+omX42eM CgoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700842308; x=1701447108; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=I35NveYhkoZ28DMqDop9zJmkqxtTHkbKlKYsYxwRQuE=; b=O9vVlHjaA2n00va5feBvhGRCsjFLguDiUwvoCIrBMN9KwLwcZ7oNKx/y1VFV62+sHg IyxcznYE8zjo9Xx66VAkVHm/H3q7bFSEgEkfG6wisrHWzzrtNeHHUEL0uuKv7I9sn5Qi 8iiLmwHuSMHC0+4k8Xlkhfj0YlG+UnlmFPGJagxbUWDdVuMzOaRJX8H9nkvn9vm0LTPB 3nBehCb9+wu5MXRGsDML8xfeGBFjVWSOCAg6Etl5yTxuKvhm6BP6V1ECl1PaclaBF/37 40UDiYZ5Qpy0if6DPKPl0Cemf/PQ2NJxw5K3FaM1MELeejYteNHfz0KYX6U9lhTqvraq Wh2A== X-Gm-Message-State: AOJu0Yxdnkjoa3srSy3MIC9O5qWOCn1csxgwFWoVCZDDoSoAqiFbnx+w 5mcAqVgDs9b3cLarXv/HOmM= X-Received: by 2002:a17:906:7494:b0:a01:d701:2f1d with SMTP id e20-20020a170906749400b00a01d7012f1dmr3109574ejl.14.1700842307727; Fri, 24 Nov 2023 08:11:47 -0800 (PST) Received: from skbuf ([188.26.185.12]) by smtp.gmail.com with ESMTPSA id n20-20020a170906119400b009fbdacf9363sm2211170eja.21.2023.11.24.08.11.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 08:11:47 -0800 (PST) Date: Fri, 24 Nov 2023 18:11:45 +0200 From: Vladimir Oltean To: Ante Knezic Cc: netdev@vger.kernel.org, woojung.huh@microchip.com, andrew@lunn.ch, f.fainelli@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, marex@denx.de, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v5 2/2] net: dsa: microchip: add property to select internal RMII reference clock Message-ID: <20231124161145.q4zww6m5hi3ccqzk@skbuf> References: <4e62cff653c7845bb848de5af44abe7e5578f624.1700841353.git.ante.knezic@helmholz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4e62cff653c7845bb848de5af44abe7e5578f624.1700841353.git.ante.knezic@helmholz.de> X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 24 Nov 2023 08:12:08 -0800 (PST) On Fri, Nov 24, 2023 at 05:01:48PM +0100, Ante Knezic wrote: > +static int ksz88x3_config_rmii_clk(struct ksz_device *dev, int cpu_port) > +{ > + struct device_node *ports, *port, *cpu_node; > + bool rmii_clk_internal; > + > + if (!ksz_is_ksz88x3(dev)) > + return 0; > + > + cpu_node = NULL; > + > + ports = of_get_child_by_name(dev->dev->of_node, "ports"); > + if (!ports) > + ports = of_get_child_by_name(dev->dev->of_node, > + "ethernet-ports"); > + if (!ports) > + return -ENODEV; > + > + for_each_available_child_of_node(ports, port) { > + u32 index; > + > + if (of_property_read_u32(port, "reg", &index) < 0) > + return -ENODEV; > + > + if (index == cpu_port) { > + cpu_node = port; > + break; > + } > + } > + > + if (!cpu_node) > + return -ENODEV; Too much code. Assuming you have struct dsa_port *cpu_dp, you can access cpu_dp->dn instead of re-parsing the device tree. > + > + rmii_clk_internal = of_property_read_bool(cpu_node, > + "microchip,rmii-clk-internal"); > + > + ksz_cfg(dev, KSZ88X3_REG_FVID_AND_HOST_MODE, > + KSZ88X3_PORT3_RMII_CLK_INTERNAL, rmii_clk_internal); > + > + return 0; > +} Please wait for 24 hours before reposting, maybe you get more feedback.