Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2724921lqz; Wed, 3 Apr 2024 07:00:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlH0aH7FpVWjs2YIrClhBFzF+GX+x/ZupQkKq1MwxFHb5VCDCXwJ8n8NoOR/2eTpS6VPUZ3JPvEuLyidk24zQahsZfhdV6ec2EHZXzBA== X-Google-Smtp-Source: AGHT+IHFIFvxKe4VQf8Ol3yYfxqi/k38SXHA0xElhRGFBdHt1dphWA9DXwUgbQms+7QaopDmktHO X-Received: by 2002:a05:620a:a41:b0:78b:ea81:c4fc with SMTP id j1-20020a05620a0a4100b0078bea81c4fcmr6448003qka.26.1712152811640; Wed, 03 Apr 2024 07:00:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712152811; cv=pass; d=google.com; s=arc-20160816; b=DBd+Lx6yXSsqNPdHCGWlQskR1j3gS02F6RGVb/steW44bhTxM9L7A3/FAA/qpQZexc Ng4NGIDy9jntL6Fy4uy/jSfx0OClWjzHKzaJ2hRq4C2PRW4OVeunplGED3zaxaym+u6U pYwKQ3E0r6aHdjiyv1BR9MiYxqF592eDMjZBXifQK7ILF7fEc3E2sFxMR6bqEch4w/In Oh8KZIdxNr+1/GfQ2tvw9nG+eOWU0OMx8sMpMDryPf2wcmMCgIl25tkShbqUNQYKOzMa ASAG7ltrZ+i+h7jUAOGczTEfIT7ykaLLo65XGuTKSHsmnaIdv1uTRKsz1e2B8pOT0WuO w7yQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=/sOckFOI1CXRAFgRsMvp6BVKsbI76bkKaQbhxYgnpCc=; fh=I7DoFNx/UQnjo/Ly5kxvrM4slA68yBH52HoOS26Ss1Y=; b=UP2PGXXodRLFU0sDWOHAOtLkaySsIJi56sYKj9eP8gzDJfwl/a45o6TP/e/VtXVJCU NGo4TPunGqkuAwa3hwRrFklKEjqs3OwjdraN/uRVSdihYOSiHpjR1QmCRC+ifrRCz9Ez xUd4YQL5fAO6gn2MhOSuPEbD+PEP2qddPQWQugWOg6CTesBFJD9F1rUA8cV0HSYYjEHS VtUNSRTxsTOdGMPMeOJQ4HcD+PLlJuAHKG9+7b5p/pLakxQrzpLtlWU85w0eHMi13ZH5 Khm3e4WzXhepc8QgFB+c/GQssdRJm+XvtKwk9uduQ4G4A+Lg2K3IgBhZtvMdkP54XeIi BRjA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=h1JTmxNw; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-129898-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129898-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x28-20020a05620a099c00b00789e3ef2585si13916383qkx.692.2024.04.03.07.00.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 07:00:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129898-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=h1JTmxNw; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-129898-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129898-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 57CC01C2453D for ; Wed, 3 Apr 2024 14:00:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9025D148FFA; Wed, 3 Apr 2024 13:59:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="h1JTmxNw" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FF80147C78; Wed, 3 Apr 2024 13:59:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712152798; cv=none; b=gEHtL7rhnljZtRqBAPPGjXLMp6UcK5IocL6Nk8cf2GyXLAy2M5LPb7Clmpr6U/MxmkQTaFn9nUWatbk7YHL1wpxQjjKn1KWa4PmSDwLeo2pmfoyMFPp/p9fbtkaq4rf86EYfswhcIq8gntx2Wd/Zwz0ghKWkzS74MgeCoLrP/ZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712152798; c=relaxed/simple; bh=KbRzx5XXfKnY8b5mVC12BtJ8f70M3XHiILrAjyEucgk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=E2uT0MY79vmk7tNo6yG861JYAmzJ7CB+P0o+YkkVG4777alBwTVqcnx89phi95qeyJXLd4j1nqdycstpdZI699HhZwaMe0bAa1c3xnmvZuUkfdKfcpByaFFbSNQ4+7rQXzVD8Mps+nPriq9zzUp46dHhIdxJgAdbRwOhOueP8Vk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=h1JTmxNw; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/sOckFOI1CXRAFgRsMvp6BVKsbI76bkKaQbhxYgnpCc=; b=h1JTmxNwIFKbz08jp5o7MxRNlC gpppGK7pOuBF2WPM/h3EhVAfUK36x9i/8+7rHLDQfYHPMXev/J4itbd6cQFENfJkQd+2Myv6e0nRF y5mP5Y+xc+0o2lBb/tBZmGJtIaDc2UTZ/wofV7PVf0y3DfBM/Py+BCcHpqIBhRZae9AcHbQohyPNc beVR6pfgGzqzCEZbDYVK7Cr2859pcr9YOrd1Ji/3/IRUZn9EoBmaMxO6oihutYUBmByw7Tj7T6S7I 2TFsEAseZHbNQQimiNSYyG01B2PBSXFNp0QXRE/zAbRE1ari+nQT5RCiz0IDeJ3s4uhf8JeEFW2jH 7NA/t7kA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:48386) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rs19P-0008Tb-20; Wed, 03 Apr 2024 14:59:39 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1rs19N-0007zX-CV; Wed, 03 Apr 2024 14:59:37 +0100 Date: Wed, 3 Apr 2024 14:59:37 +0100 From: "Russell King (Oracle)" To: Gregor Herburger Cc: Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Dimitri Fedrau , Stefan Eichenberger , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux@ew.tq-group.com, alexander.stein@ew.tq-group.com Subject: Re: [PATCH] net: phy: marvell-88q2xxx: add support for Rev B1 and B2 Message-ID: References: <20240403-mv88q222x-revb1-b2-init-v1-1-48b855464c37@ew.tq-group.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240403-mv88q222x-revb1-b2-init-v1-1-48b855464c37@ew.tq-group.com> Sender: Russell King (Oracle) On Wed, Apr 03, 2024 at 03:45:22PM +0200, Gregor Herburger wrote: > +static int mv88q222x_revb1_revb2_config_init(struct phy_device *phydev) > +{ > + bool is_rev_b2 = phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] == PHY_ID_88Q2220_REVB2; > + int ret, i; > + > + for (i = 0; i < ARRAY_SIZE(mv88q222x_revb1_init_seq0); i++) { > + /* Rev B2 init sequence differs compared to Rev B1. As noted in Marvell API: > + * Remove the instruction to enable TXDAC setting overwrite bit for Rev B2. > + */ > + if (is_rev_b2 && mv88q222x_revb1_init_seq1[i].regnum == 0xffe3) > + continue; > + > + ret = phy_write_mmd(phydev, mv88q222x_revb1_init_seq0[i].devad, > + mv88q222x_revb1_init_seq0[i].regnum, > + mv88q222x_revb1_init_seq0[i].val); > + if (ret < 0) > + return ret; > + } > + > + usleep_range(3000, 5000); > + > + for (i = 0; i < ARRAY_SIZE(mv88q222x_revb1_init_seq1); i++) { > + ret = phy_write_mmd(phydev, mv88q222x_revb1_init_seq1[i].devad, > + mv88q222x_revb1_init_seq1[i].regnum, > + mv88q222x_revb1_init_seq1[i].val); > + if (ret < 0) > + return ret; > + } I think a helper would be useful to write these sequences, rather than writing the same code several times: static int mv88q2xxx_write_mmd_vals(struct phy_device *phydev, const struct mmd_val *vals, size_t len) { int ret; for (; len; vals++, len--) { ret = phy_write_mmd(phydev, vals->devad, vals->regnum, vals->val); if (ret < 0) return ret; } return 0; } -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!