Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1266248rdg; Fri, 11 Aug 2023 16:00:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYkNzcXI0ssIRVvTgq79FwZX12KCFvB5Dcmtvb+AtRxFcVDJFrPmoqtu4ZTWt0W8KdDznn X-Received: by 2002:a05:6a20:3943:b0:12f:382d:2a37 with SMTP id r3-20020a056a20394300b0012f382d2a37mr4385077pzg.15.1691794818196; Fri, 11 Aug 2023 16:00:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691794818; cv=none; d=google.com; s=arc-20160816; b=d2n1ti8Ahypmfpg3ciL6wbqLlOImZLD8U9PaZru3B4ZlTFhbx7oPtnXbaiXAIAvU55 cVlrZk8FUsDDx6icgBU0c9uEbkEICOP+n31/P3O4Hx09HPUaG0NXCWenr4nCvH4+bJOL PeX58NLB/pFEc13lPprNIPNR0LJvwz7jMUk9S2rNgPOjX/SzhdGo4an1JuYfOYIIpKNG 6gRxEWEr4ULNFHiEpk5kJIR04uZLMMKN2fnU/wgCGgVkVoSzjCc0HzJGlLfE0LzCU/8k +EF26tmqlB1fbHfbUn3HZTZnOLlFWgSIzhYvJtrwR9HQ3r2XwW9Zh1qvBDiC69LU7K56 BMgA== 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=5h1odbNO24iYYxkXMh64axJnPjcbJqfCMNkvmSMHegI=; fh=5OelwTccP94v5WS2TPwPovu/OlK1jZWlfgfkmISFfnc=; b=D/gCjgbfkNBoP4noL/r5bX26oQwyJk739EIvi0fJAN632nyWAPF4vbaVfg1vzS8w+c fz1IgZJa36UsfBakAgRjhB9tQnzsd0e1oXgKwVbKhJWHQUmHJYkIFaqyOutu4AZtq28W dAVIIzidOmYdnRHhSIbNcInQrHYydrszY7hClVXYqdlu90t0exIVQXfL0CBOJO+r09Qh SYIFjSspfdcysD/aU0CNy1hUVakHjvzlXLIXHm5cH8GSWnB0WPkammxdevrOWheskXqc pq9tx57KWpOm5NVz1Dh1zAd+ecnPgzCVDMoB5MF99WShEPvTas03Kd+VFX58uITjIJVA vIpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=IPGoRB6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a634d07000000b00563e0e86f17si4124331pgb.573.2023.08.11.16.00.05; Fri, 11 Aug 2023 16:00:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=IPGoRB6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236111AbjHKWRV (ORCPT + 99 others); Fri, 11 Aug 2023 18:17:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236889AbjHKWQo (ORCPT ); Fri, 11 Aug 2023 18:16:44 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B8CB358D; Fri, 11 Aug 2023 15:16:34 -0700 (PDT) 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=5h1odbNO24iYYxkXMh64axJnPjcbJqfCMNkvmSMHegI=; b=IPGoRB6zcVLLrY5XpuS1naYRVN NvkT5wyre9ALZpHsTpj+ufl7HPsKAx7qab+/LtuAKg7VEYlJxNXmjYpPwFZEaYu7Sa6QGUjEnqVE7 nqYmAieVdwyChLvWzsGfqaL4/xor4xr3z5HM120sxLlXpos5K1IBq054/RzjgpIj/P8s=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qUaQg-003qgz-25; Sat, 12 Aug 2023 00:16:22 +0200 Date: Sat, 12 Aug 2023 00:16:22 +0200 From: Andrew Lunn To: Giulio Benetti Cc: Broadcom internal kernel review list , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jim Reinhart , James Autry , Matthew Maron Subject: Re: [PATCH] net: phy: broadcom: add support for BCM5221 phy Message-ID: <0188dd19-7fcb-4bfe-945d-6cb5b57ae80a@lunn.ch> References: <20230811215322.8679-1-giulio.benetti@benettiengineering.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230811215322.8679-1-giulio.benetti@benettiengineering.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,URIBL_BLOCKED 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 On Fri, Aug 11, 2023 at 11:53:22PM +0200, Giulio Benetti wrote: > This patch adds the BCM5221 PHY support by reusing > brcm_fet_config_intr() and brcm_fet_handle_interrupt() and > implementing config_init()/suspend()/resume(). > > Sponsored by: Tekvox Inc. That is a new tag. Maybe you should update Documentation/process/submitting-patches.rst ? > +static int bcm5221_config_init(struct phy_device *phydev) > +{ > + int reg, err, err2, brcmtest; > + > + /* Reset the PHY to bring it to a known state. */ > + err = phy_write(phydev, MII_BMCR, BMCR_RESET); > + if (err < 0) > + return err; > + > + /* The datasheet indicates the PHY needs up to 1us to complete a reset, > + * build some slack here. > + */ > + usleep_range(1000, 2000); > + > + /* The PHY requires 65 MDC clock cycles to complete a write operation > + * and turnaround the line properly. > + * > + * We ignore -EIO here as the MDIO controller (e.g.: mdio-bcm-unimac) > + * may flag the lack of turn-around as a read failure. This is > + * particularly true with this combination since the MDIO controller > + * only used 64 MDC cycles. This is not a critical failure in this > + * specific case and it has no functional impact otherwise, so we let > + * that one go through. If there is a genuine bus error, the next read > + * of MII_BRCM_FET_INTREG will error out. > + */ > + err = phy_read(phydev, MII_BMCR); > + if (err < 0 && err != -EIO) > + return err; It is pretty normal to check the value of MII_BMCR and ensure that BMCR_RESET has cleared. See phy_poll_reset(). It might not be needed, if you trust the datasheet, but 802.3 C22 says it should clear. > + /* Enable auto MDIX */ > + err = phy_clear_bits(phydev, BCM5221_AEGSR, BCM5221_AEGSR_MDIX_DIS); > + if (err < 0) > + return err; It is better to set it based on phydev->mdix_ctrl. > @@ -1288,6 +1431,7 @@ static struct mdio_device_id __maybe_unused broadcom_tbl[] = { > { PHY_ID_BCM53125, 0xfffffff0 }, > { PHY_ID_BCM53128, 0xfffffff0 }, > { PHY_ID_BCM89610, 0xfffffff0 }, > + { PHY_ID_BCM5221, 0xfffffff0 }, This table has some sort of sorting. I would put this new entry before PHY_ID_BCM5241. > #define PHY_ID_BCM50610 0x0143bd60 > #define PHY_ID_BCM50610M 0x0143bd70 > #define PHY_ID_BCM5241 0x0143bc30 > +#define PHY_ID_BCM5221 0x004061e0 The value looks odd. Is the OUI correct? Is that a broadcom OUI? Andrew --- pw-bot: cr