Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2665651rdb; Wed, 15 Nov 2023 07:19:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IF1M6rFu/9bSo2/S/Z37anM7cWffiP0d6ys4Ko8FrWlcy4+NJqUcDAqt1WDXHilQSJJ1hzX X-Received: by 2002:a62:f20d:0:b0:6be:25c5:4f74 with SMTP id m13-20020a62f20d000000b006be25c54f74mr13677951pfh.13.1700061581214; Wed, 15 Nov 2023 07:19:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700061581; cv=none; d=google.com; s=arc-20160816; b=BLX2h/nzBwm4L2s+WPqgy6/vqX0TRrObKzkv+dcF2ffUkvOOGmnsHym5L/zqeWpV8Q eghA1Wj/WrzG7FfW66lyXBqdJxr7M+p3WxTqVH0UQdsGdbRZQblBomdqHDGhW6cpq2HM ro639unHrq9u6EIkgPUrwhSWo17OLJljzKo8KkGl2Kpwq8tDpuQSzmBR8WJnLRTBOLai lh0KOZA8r8sigLUtXgRufT1iupV0nYdNb/c2W/G0rzQgsDM+MP1mtuioFxVPwb9OSo2K /C/4mr7TjfgaQSw4deM/ifw66kKZXLp61DZKOHE4JcqXs9LHp52LKP8Nc4VaYwYVQ7Nc ocRw== 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=37VjmFcSyaHadPNgbdsqa1mf/2AH59SSvQZU2YKjHvQ=; fh=4gpfRGcGnp+CfSXRmR6id0uiB/MqlRnmFc1qe8IoiFE=; b=z6LwAPTFIona4TJ6SsLZ0fPKGFdSIoTWR+R5m4o577nbfdcFgYg1rSoC2c9bjhqFEW xxJ2uQ0Z8q50Kir1jT2pWZgZcYC9ow/eIp6Ku2Dupb64rz53mz20tlaJ1o8gacixXwz9 lTSTeA15bdSUohMWSYC82lTK/PugsDDyeEbAuZFkz+PVpLb1RPuXdoTBAd0aNcWZnoY6 QXNypluSLQhHhsVFw5MCiQ7egTQ2aotG9gxhh+XO3uQC5bBCbej63xpTMb1fU2MobyXM ncjWX+ibaGR7V4dliOuYHIHrhj+lk4d7GD6NJWxoV/ggxuRzMt00U+SV6Fl4Mc+uoP+I Jj6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=LFCfuiiL; 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=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id j63-20020a638b42000000b005b884a11fdcsi9870245pge.28.2023.11.15.07.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 07:19:41 -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=@lunn.ch header.s=20171124 header.b=LFCfuiiL; 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=NONE dis=NONE) header.from=lunn.ch Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 904DB80EA7A5; Wed, 15 Nov 2023 07:19:26 -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 S1344398AbjKOPTT (ORCPT + 99 others); Wed, 15 Nov 2023 10:19:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344329AbjKOPTS (ORCPT ); Wed, 15 Nov 2023 10:19:18 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAFFBC7; Wed, 15 Nov 2023 07:19:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=37VjmFcSyaHadPNgbdsqa1mf/2AH59SSvQZU2YKjHvQ=; b=LFCfuiiLezaSYqQa0KbiBlgR0L DPbCThNAHL4Pzl5FTX4yOK8w2TXMy097mcKNrsNbc8Zbtf9CKMRmrf0gf+T7npRSZfv+td+Avk7LJ txtgdY5vhDn2Qs6weKkQe/XRAXb4MqUKoGSwKFdo3i+8pSgwwbjw2o8NZefzg1kS3tso=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1r3HfV-000Fop-UB; Wed, 15 Nov 2023 16:19:05 +0100 Date: Wed, 15 Nov 2023 16:19:05 +0100 From: Andrew Lunn To: Luo Jie Cc: agross@kernel.org, andersson@kernel.org, konrad.dybcio@linaro.org, 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, hkallweit1@gmail.com, linux@armlinux.org.uk, robert.marko@sartura.hr, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, quic_srichara@quicinc.com Subject: Re: [PATCH 4/9] net: mdio: ipq4019: configure CMN PLL clock for ipq5332 Message-ID: References: <20231115032515.4249-1-quic_luoj@quicinc.com> <20231115032515.4249-5-quic_luoj@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231115032515.4249-5-quic_luoj@quicinc.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 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]); Wed, 15 Nov 2023 07:19:26 -0800 (PST) > +static void ipq_cmn_clock_config(struct mii_bus *bus) > +{ > + u32 reg_val; > + const char *cmn_ref_clk; > + struct ipq4019_mdio_data *priv = bus->priv; Reverse christmass tree place. > + > + if (priv && priv->cmn_membase) { Can priv be NULL? Can cmn_membase be NULL? > + reg_val = readl(priv->cmn_membase + CMN_PLL_REFERENCE_CLOCK); > + reg_val &= ~(CMN_PLL_REFCLK_EXTERNAL | CMN_PLL_REFCLK_INDEX); > + > + /* Select reference clock source */ > + cmn_ref_clk = of_get_property(bus->parent->of_node, "cmn_ref_clk", NULL); > + if (!cmn_ref_clk) { > + /* Internal 48MHZ selected by default */ > + reg_val |= FIELD_PREP(CMN_PLL_REFCLK_INDEX, 7); > + } else { > + if (!strcmp(cmn_ref_clk, "external_25MHz")) Not strings, please use u32 values. You can then list the valid values in the yaml file, and get te tools to verify the DT. > + reg_val |= (CMN_PLL_REFCLK_EXTERNAL | > + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 3)); > + else if (!strcmp(cmn_ref_clk, "external_31250KHz")) > + reg_val |= (CMN_PLL_REFCLK_EXTERNAL | > + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 4)); > + else if (!strcmp(cmn_ref_clk, "external_40MHz")) > + reg_val |= (CMN_PLL_REFCLK_EXTERNAL | > + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 6)); > + else if (!strcmp(cmn_ref_clk, "external_48MHz")) > + reg_val |= (CMN_PLL_REFCLK_EXTERNAL | > + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 7)); > + else if (!strcmp(cmn_ref_clk, "external_50MHz")) > + reg_val |= (CMN_PLL_REFCLK_EXTERNAL | > + FIELD_PREP(CMN_PLL_REFCLK_INDEX, 8)); > + else > + reg_val |= FIELD_PREP(CMN_PLL_REFCLK_INDEX, 7); If the value is not valid, return -EINVAL. Andrew