From patchwork Sun Feb 18 19:00:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 202857 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp914014dyc; Sun, 18 Feb 2024 11:04:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUsVYB+m0BH4Jo6m0Sh6rW96tCBReYKI1XJlKW2Fgz4En68vbRL6RX+ueV04RFQn4eJixmql54DiWj/WQtjryMcQ9mF1A== X-Google-Smtp-Source: AGHT+IFVuZlmSAHGu864t7bg4Gx7qb3mKKwU6UJbfpvD+hzZ3uZWnlpBOxB8/eCr4JSmWNRETk1F X-Received: by 2002:a05:622a:8:b0:42d:c7c9:76a1 with SMTP id x8-20020a05622a000800b0042dc7c976a1mr12752994qtw.62.1708283054604; Sun, 18 Feb 2024 11:04:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283054; cv=pass; d=google.com; s=arc-20160816; b=M6Zm1efsPJT2Lz75FBzC4UBFaHSxlwRqewuBWIUoHkc0PYRjnY+0eZrdYsJ5hTvUhu 5JEw7RxSHPZVlcks9QP6KNCgyPccWFwCn2mjxg4NQsiLnOWiOdRtFOQ6CQfhbjPn+xIC 34FQPwq4nDs8KdF5+rp8RsjF4h6/wWE4Pw4OVm1hcSzTGrzFTWrlUaYEoTmpKHVE5VUX 9manzhp2C05ZB4QjDhZO/W9VktuQX1u5U0HkPJRBJOdG2RXnSYioZqHwuIkAegyP6ZAc Yzk2W/as+VXIJLbqgCnrqafuHAFJng+AjJVVjx+NKP4QRk8HwetodJ3QOzEO1OFk9l3C I0jw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=mEYeK8i11QxkJeB25DqEOcldL7O5Xx2ufJLmOFFJoo8=; fh=0Uqy4ndOVczKA4S2DiGP8uU8AGLP8yY0P+FFmHRKvxQ=; b=B/3hTI+EgDy6mu3+ISvf993GjjO7IPNSkX+r+rVQ6wQLooJzPdWQi925FHV78HftM7 TYw5fgeRwkFb+77fSntLsw+0knT71iZfGU6QpnkYVMLrcVb+bnqGy/i+L3x2ug3jL4gt +2lCKkj/EyawoRWvYJgnWWO/FciYvxDf/VqnRaKzNaag7EKyUWXsrdzUPJKmwNi04dE6 9kkwdWHVTnDnmzxYLE6Dfr/x3Bkbp+PkXteUPXh31Zv9a8xbgSD/f1/HfpOmuZztZrTS 8/S9LlBo8lc2YNJZCYJ7o+VgxVIFKNi51k/AS/W/cI6Osht7QrgVohorCXEaJ2jZBBYn Se7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EXN1XYGI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70522-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70522-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id c21-20020a37e115000000b007873518dda4si4636742qkm.105.2024.02.18.11.04.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:04:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70522-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EXN1XYGI; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70522-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70522-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 599F61C20F6C for ; Sun, 18 Feb 2024 19:04:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BEBB745F1; Sun, 18 Feb 2024 19:00:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EXN1XYGI" Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 94E506F09B; Sun, 18 Feb 2024 19:00:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282848; cv=none; b=c/5rzxXeUpGlwb0hlSW5FVt+XTsTGHMP6H2E7d8gRr+h44LDKHrsgpiYl5wC1OkYQkt7mshvOl+mEQfVNf2aLh8NLQCeu6DUkWEYOwRzVab6w3Q0Cu1e2D/UA2MWRTcLdx1DAriV8jaNBC5bVxUgomcZgYLNfXatuj2QSaMyK3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282848; c=relaxed/simple; bh=/PV/hiioXn852DS6V+QqGARR5Kr4QVyjX7tUAzXK4v0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o3SKSamBO7Xdk+Y5pDiv1d60pPrPayCC/WGKYLX9OcWXZYhcSloZsMkZ3GRGz4SkGlV79/ZDWL76om9n/OVb2qZisqvPc22QxORwP0d1RfMYZJsZcDOPN87SRRRRstQKHhBWmkcCWSpawjbVWQQcYfT76yPsQ8VPiByqPCnLikw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EXN1XYGI; arc=none smtp.client-ip=209.85.208.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2d107900457so51332651fa.1; Sun, 18 Feb 2024 11:00:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708282845; x=1708887645; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mEYeK8i11QxkJeB25DqEOcldL7O5Xx2ufJLmOFFJoo8=; b=EXN1XYGIJ4DugLviidezJrzLiwm8NCSIxFtm6A5f62c6JqXomxvus29LahGXjhoM2u AoIIyEvGzf3kiltrfr9EHPvpD20ftVYlejq1MWIjwiAEyO7jacaW6xcnhsxzMTxZ/XZR hLHBhRHlWG8Zia6HICPVrfmj/u4ORmOpciq6Zzp6I/go1q3lI2cip5n+lAC/1sGg6eCR 8SAzpsQEan2fmPTHgKu1Rb1gpvu1Qu2FbTSj1l7Jax7e5xFSraf0+B6ZFZSudzGzLRkB MDXf2c4JpWqsMxX3zkL/+6ZbJfO3+0V2KDLdBcBEdFUB7ncSHYUZ+NQs0T+09gZX/kaz u2Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708282845; x=1708887645; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mEYeK8i11QxkJeB25DqEOcldL7O5Xx2ufJLmOFFJoo8=; b=s13j7zBcwSh5zWrE37kHEv35Y3kO9kxv3pZUHM4BjU1SdPPbuHXF/2q5Nig3tqozBU szjDZWUlGG4MFI0RvkdIP4BOOwgIby49oOG+0vpRRBkK2V1CUEi6exnlMSb+a/ALZlXJ kCpZ3np4fkY1K+e1N4+/giqxXye4uL+rFuMgqAJRU6Kv0yuS+BUsiP5SwSC3y6iTqDkc rL37kkED7aryNVVCHXMWCyO/iz6ibuYVoYmSv3LY8fyYkoXCyFY+yi9K8Om/L9XAjmjL 1zqSXBQYmdT9RPSuuic8x4XdVSh2KyQmjCHZA/jaJYVTvyWlL9cAK5JX33KMs06yGavN ftcQ== X-Forwarded-Encrypted: i=1; AJvYcCWF7S7pffDedlWVoeI+kwuTGX/p1EirrTFwZUIryvvVLfeFegRs3OuSjvliNywJ3XPou3U57XLJOoS7r+zDRyvDDTza0fh8y7wsPY8dhpoLtm/eyOJtx0e9t7izWg33AJnAeo3S X-Gm-Message-State: AOJu0YxL2SwGNBUCHemslSWUXhsq+E0+9INKb1Lc0Hd1vazT0Yc2G2cL 4mOQ/OuwSYIqjVQzQMOap/wqBN12TA4ovPsusAIvKdTPHqgeSK5y X-Received: by 2002:a2e:b60a:0:b0:2d2:31b0:4f64 with SMTP id r10-20020a2eb60a000000b002d231b04f64mr1761364ljn.34.1708282844348; Sun, 18 Feb 2024 11:00:44 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id m15-20020a056000008f00b0033b728190c1sm8115762wrx.79.2024.02.18.11.00.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:00:43 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Christian Marangi , Robert Marko , "Russell King (Oracle)" , Greg Kroah-Hartman , Pieter Jansen van Vuuren , Nipun Gupta , Andy Shevchenko , Puneet Gupta , Abhijit Gangurde , Umang Jain , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next RFC PATCH 1/6] net: phy: add support for defining multiple PHY IDs in PHY driver Date: Sun, 18 Feb 2024 20:00:27 +0100 Message-ID: <20240218190034.15447-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218190034.15447-1-ansuelsmth@gmail.com> References: <20240218190034.15447-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791264612202360692 X-GMAIL-MSGID: 1791264612202360692 Some PHY driver might implement the same OPs for different PHY ID and using a mask is not enough to match similar PHYs. To reduce code duplication, add support for defining multiple PHY IDs in PHY driver struct. Introduce a new variable in phy_driver struct, .ids, where a table array of mdio_device_id can be defined to reference multiple PHY IDs (with their own masks) supporting the same group of OPs and flags. Introduce a new variable in phy_device, .dev_id, where the matching mdio_device_id is stored. PHYs supporting multiple PHYs for one PHY driver struct, should use this instead of matching for phy_id. Single PHY ID implementation is still supported and dev_id is filled with the data from phy_driver in this case. Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 94 ++++++++++++++++++++++++++++++------ include/linux/phy.h | 8 ++- 2 files changed, 85 insertions(+), 17 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index d63dca535746..9b96357e4de8 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -522,12 +522,74 @@ static int phy_scan_fixups(struct phy_device *phydev) return 0; } +static int phy_driver_match_id(struct phy_driver *phydrv, u32 id, + const struct mdio_device_id **dev_id) +{ + const struct mdio_device_id *ids = phydrv->ids; + + /* PHY driver might provide an array of different PHY IDs and + * masks. Walk them if this is the case and compare with ID. + */ + if (ids) { + /* From mdio_device_id struct phy_id_mask MUST + * be used as sentinel. + */ + while (ids->phy_id_mask) { + if (phy_id_compare(id, ids->phy_id, ids->phy_id_mask)) { + if (dev_id) + *dev_id = ids; + + return 1; + } + + ids++; + } + } + + if (phy_id_compare(id, phydrv->phy_id, phydrv->phy_id_mask)) + return 1; + + return 0; +} + +/** + * phy_driver_match - match a phydriver with a given PHY istance + * @phydrv: PHY driver to compare with + * @phydev: PHY istance to use for comparison. Either PHY ID will be used or + * with C45 PHY ID is extracted from Package regs. + * @dev_id: Pointer where to store pointer to a matchin mdio_device_id. + * mdio_device_id are assumed to be statically allocated for each PHY driver, + * hence the reference to this struct is returned here. + * + * Returns 1 if matching, 0 otherwise. dev_id can be passed as NULL to skip + * referecing a matching mdio_device_id if found. + */ +static int phy_driver_match(struct phy_driver *phydrv, struct phy_device *phydev, + const struct mdio_device_id **dev_id) +{ + const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids); + int i; + + if (!phydev->is_c45) + return phy_driver_match_id(phydrv, phydev->phy_id, + dev_id); + + for (i = 1; i < num_ids; i++) { + if (phydev->c45_ids.device_ids[i] == 0xffffffff) + continue; + + if (phy_driver_match_id(phydrv, phydev->c45_ids.device_ids[i], + dev_id)) + return 1; + } + + return 0; +} + static int phy_bus_match(struct device *dev, struct device_driver *drv) { struct phy_device *phydev = to_phy_device(dev); struct phy_driver *phydrv = to_phy_driver(drv); - const int num_ids = ARRAY_SIZE(phydev->c45_ids.device_ids); - int i; if (!(phydrv->mdiodrv.flags & MDIO_DEVICE_IS_PHY)) return 0; @@ -535,20 +597,7 @@ static int phy_bus_match(struct device *dev, struct device_driver *drv) if (phydrv->match_phy_device) return phydrv->match_phy_device(phydev); - if (phydev->is_c45) { - for (i = 1; i < num_ids; i++) { - if (phydev->c45_ids.device_ids[i] == 0xffffffff) - continue; - - if (phy_id_compare(phydev->c45_ids.device_ids[i], - phydrv->phy_id, phydrv->phy_id_mask)) - return 1; - } - return 0; - } else { - return phy_id_compare(phydev->phy_id, phydrv->phy_id, - phydrv->phy_id_mask); - } + return phy_driver_match(phydrv, phydev, NULL); } static ssize_t @@ -3410,9 +3459,22 @@ static int phy_probe(struct device *dev) struct phy_device *phydev = to_phy_device(dev); struct device_driver *drv = phydev->mdio.dev.driver; struct phy_driver *phydrv = to_phy_driver(drv); + const struct mdio_device_id *dev_id = NULL; + struct mdio_device_id *phy_dev_id; int err = 0; phydev->drv = phydrv; + phy_dev_id = (struct mdio_device_id *)&phydev->dev_id; + /* Fill the mdio_device_id for the PHY istance. + * If PHY driver provide an array of PHYs, search the right one, + * in the other case fill it with the phy_driver data. + */ + if (phy_driver_match(phydrv, phydev, &dev_id) && dev_id) { + memcpy(phy_dev_id, dev_id, sizeof(*dev_id)); + } else { + phy_dev_id->phy_id = phydrv->phy_id; + phy_dev_id->phy_id_mask = phydrv->phy_id_mask; + } /* Disable the interrupt if the PHY doesn't support it * but the interrupt is still a valid one diff --git a/include/linux/phy.h b/include/linux/phy.h index c2dda21b39e1..f0313b9e0173 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -547,6 +547,7 @@ struct macsec_ops; * @drv: Pointer to the driver for this PHY instance * @devlink: Create a link between phy dev and mac dev, if the external phy * used by current mac interface is managed by another mac interface. + * @dev_id: The matched device ID for this PHY instance * @phy_id: UID for this device found during discovery * @c45_ids: 802.3-c45 Device Identifiers if is_c45. * @is_c45: Set to true if this PHY uses clause 45 addressing. @@ -645,6 +646,7 @@ struct phy_device { struct device_link *devlink; + const struct mdio_device_id dev_id; u32 phy_id; struct phy_c45_device_ids c45_ids; @@ -885,6 +887,8 @@ struct phy_led { * struct phy_driver - Driver structure for a particular PHY type * * @mdiodrv: Data common to all MDIO devices + * @ids: array of mdio device IDs to match this driver (terminated with + * zero phy_id_mask) * @phy_id: The result of reading the UID registers of this PHY * type, and ANDing them with the phy_id_mask. This driver * only works for PHYs with IDs which match this field @@ -906,6 +910,7 @@ struct phy_led { */ struct phy_driver { struct mdio_driver_common mdiodrv; + const struct mdio_device_id *ids; u32 phy_id; char *name; u32 phy_id_mask; @@ -1206,7 +1211,8 @@ static inline bool phy_id_compare(u32 id1, u32 id2, u32 mask) */ static inline bool phydev_id_compare(struct phy_device *phydev, u32 id) { - return phy_id_compare(id, phydev->phy_id, phydev->drv->phy_id_mask); + return phy_id_compare(id, phydev->dev_id.phy_id, + phydev->dev_id.phy_id_mask); } /* A Structure for boards to register fixups with the PHY Lib */ From patchwork Sun Feb 18 19:00:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 202858 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp914137dyc; Sun, 18 Feb 2024 11:04:28 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW1cTkzj9iq3xVh/6w+Op6W6TMgADK8j+OYBHaXOwwj1aglkDau+SLM8PJodFJvZhn5LhMWOPI1gShv0utrYd0n0HMfoA== X-Google-Smtp-Source: AGHT+IHnMrfWB1WQOFGbv1dL9hN78oQ46BK7xka/SNdzpDLtLoV8d+FExpLN6obJFI7Qby6Wi1AN X-Received: by 2002:a17:906:b106:b0:a3d:dc7f:6e92 with SMTP id u6-20020a170906b10600b00a3ddc7f6e92mr5270841ejy.73.1708283068028; Sun, 18 Feb 2024 11:04:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283068; cv=pass; d=google.com; s=arc-20160816; b=npYF/YRUlqRhh5SEck3eX0zjRU4IUmYXJeLT9zemOhLg5+SUPca3FUepXo0VwBkre+ vL+1P4jG7HrHy//OhFxF7JwYP9oi0uKEfXcKb/VmL8O/WSlZofDmziMIzn2G2zq2nRQi gANczhk4v1JZ+uuMeP2zK9XBcYLYBX+K2IGdk1SRXqw0AuPuifvLReY95lYX3qgKPx9U Cr1Gkq+EPvFmiAONlloAbnv5KY3i0gk+oVVZC0gAnfa5qKggZndEovWLq0UAF2XRhCr1 st6nnH0QD30LzAKFKpgax4UVgl1xNmpcFpiujl5Fr42xKtN9D24JkvhAwzQpGWt4Sz+c Dpsg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=gDLjeqjcDDwD7/npT7DJCTwwYCyrxg7kY3LYI6eWDbI=; fh=OzSk3E3Jw/hoD0sQDoVLvuPafFGCkYCmyzv8Afk0ffI=; b=1IFqGs4NwJdNcwXEjrzUkxnuLxpbBXPed8x8R1MYK3PdQXJ1w+Sqz8kwApnk8wMbwp AoUxI98ziRLicLWLBiSzDaqVDtaLhn8fEGtL16ws2++BmilAKpoMIWHmk2CLb6/6/xYY SvkkUOtW2nedVLxOKUM3JmBqdrEIhlGEzxDA/RO92KhfD0ONe1tYh+xjouxCcQgHDBam gzJq/RYoESYqEpHr/hPl5MEx/yNwxJKMbDqakcjD5HJLmK/P4hGbLErS77dK1WRrN1yh Z4Wu0q7ARyEU9NuD1AvYR95rZld2I/isSq8HTC9Bi7N4VAbjukf5CWPpbJqjkudpd3IS zKGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="U6tPhT2/"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70524-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70524-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gl24-20020a170906e0d800b00a3e6862cae0si711554ejb.746.2024.02.18.11.04.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:04:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70524-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="U6tPhT2/"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70524-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70524-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9A6E11F21A8F for ; Sun, 18 Feb 2024 19:04:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2BABC74E14; Sun, 18 Feb 2024 19:00:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U6tPhT2/" Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6B1571B25; Sun, 18 Feb 2024 19:00:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282850; cv=none; b=Qge6XWbzobzatsXRB5xgOPFdtE3CvtRAnHMlal+Qw9hontgpq0Ry3elRuWfWjq+nZ6EpdXcdZIQqe0xLaHmIncqAOUccw1HtyjEW1JTc4bBQEK30VW4jcN5+Oj2hvg75JS53LyaSWOlFQfxfZjN2WOHqc0tNaZlMxnNN5JjKxfs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282850; c=relaxed/simple; bh=2LCv+lgmH0ansXxRDGS7Qz4W8gc7nGFuPp9Acdwiv1k=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b363HgrHhZpujbiCacxtSWlI5rLUkuA8h4i16L8ChjVdWCgZcE4gZ4rRgMBhmbrcHJYgVeuPNJo2ul7L2LYG7Fl3/NjWI+uYKX/GLrQHOf6x2TnnLlryqGjNEwjpABYRTVq9P+uXV9V8RSvFUh99w3Yu7Tn4a4MkgA8wOAiSveU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=U6tPhT2/; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-337cc8e72f5so1893782f8f.1; Sun, 18 Feb 2024 11:00:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708282847; x=1708887647; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=gDLjeqjcDDwD7/npT7DJCTwwYCyrxg7kY3LYI6eWDbI=; b=U6tPhT2/93tQ8fCXHSIeV585Y/nToaRCIDbhBi3cy/eHTZaPCxIMWG9StvIy9qwz85 ysPsqDVbap9zjNFn2tc03dpKTs8swNI10WXUxGGl12UqNUEmSwrG8dU3Z0CmROvMqK3O xbyGKwauuqCEMh3rqmBRBHOvxKgHx2M6zK/ghbVQArFlN+nGE9rslwO7KEpL8ryFSVlA jIUTBQCCyHxvqtj1ZPWjDtxcaCJPI10LlQPopUiENB7wsvKAvmg4OoN4H7JPHj9fDHDm VGjM4W4nWqnlvZ/X9Hs+cXfXkFtQVB3WUjgTd15Warduqi6WuiVcaW4exVILWHDH3sfx suCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708282847; x=1708887647; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gDLjeqjcDDwD7/npT7DJCTwwYCyrxg7kY3LYI6eWDbI=; b=NlpLjiLlLd2/TUoxtfV9cMNYjMDqF3xfwTwiEo/TaN5gElsKZP7nqkzw2zoQZviJSA Eh19AIet/pbYTiNolotXy77TNxVxvm0iqDBHAxvV/NDcEUXJt975CfbpDaEqsXeM3EXc KHtAbIt+ybUFeIZtHTMz4exei+0b0YHUC+kK9MsFD30sX6VLEIOykLOq/USPgyUFRQ15 bOoFMuoqZwlcInupgXRHrvIgs0X2dx4f6fF8EyVJiaZ/nGfu9+kFoc2Sf20bE4qeXJLM IbkvNgyUoImkbsGBVdfQxxGLfnIee083mqXUAEeqoP8H3iRxAN9OAYwc5LTw8tbU3cOD EI8w== X-Forwarded-Encrypted: i=1; AJvYcCVq8SbjChIOZnCaDyl9BbymZCKCHwM+xyExn5GRYbldBaug9fyTOFnJkTc+ymhudm0xdFkrF2UC7nxkhyVYaarUJ2vk5ycuc4WbHim6jIZY7lUF9VmFgPQ7WcOdfafwbquFCBZ3 X-Gm-Message-State: AOJu0Ywg1ufF9M5AHHxua2n9RHaRMVCVxvEAdnONFysitWqC0GfXmSNf sp0CH/+PeA9JLkPDdTKTcRfRnNANDtvmDJ9OtipK9stRv8xRo/V0 X-Received: by 2002:a05:6000:809:b0:33d:1656:21ff with SMTP id bt9-20020a056000080900b0033d165621ffmr7979799wrb.4.1708282846942; Sun, 18 Feb 2024 11:00:46 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id m15-20020a056000008f00b0033b728190c1sm8115762wrx.79.2024.02.18.11.00.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:00:46 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Christian Marangi , Robert Marko , "Russell King (Oracle)" , Greg Kroah-Hartman , Pieter Jansen van Vuuren , Nipun Gupta , Andy Shevchenko , Puneet Gupta , Abhijit Gangurde , Umang Jain , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next RFC PATCH 3/6] mod_devicetable: permit to define a name for an mdio_device_id Date: Sun, 18 Feb 2024 20:00:29 +0100 Message-ID: <20240218190034.15447-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218190034.15447-1-ansuelsmth@gmail.com> References: <20240218190034.15447-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791264626720694117 X-GMAIL-MSGID: 1791264626720694117 Permit to optionally define a name for an mdio_device_id. This can be used for PHY driver that might define multiple PHY IDs for the same group of PHY driver OPs to define different names for each PHY ID and better identify the different models at runtime. Signed-off-by: Christian Marangi --- include/linux/mod_devicetable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index f458469c5ce5..9dc6f0cc26b4 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -630,10 +630,12 @@ struct platform_device_id { * for this PHY type * @phy_id_mask: Defines the significant bits of @phy_id. A value of 0 * is used to terminate an array of struct mdio_device_id. + * @name: Optional Friendly name that identify the PHY device/family. */ struct mdio_device_id { __u32 phy_id; __u32 phy_id_mask; + const char *name; }; struct zorro_device_id { From patchwork Sun Feb 18 19:00:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 202859 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp914250dyc; Sun, 18 Feb 2024 11:04:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUL+NX23IuFEYU0n/9GZgb7Jptex2h5j5yiQHiSJlm+tIGVPdz30i52HlvvwxexY2TcNAfGLb2p2sGdAk6B/4DNM3QW1Q== X-Google-Smtp-Source: AGHT+IGBbw7CTPTVCMjqAjE0QfKjvopmYle4iqbQV6ZMAyO6g9lBYlREnpcmH0BmdrwjfcnMNInn X-Received: by 2002:aa7:850b:0:b0:6e0:9e95:b3f8 with SMTP id v11-20020aa7850b000000b006e09e95b3f8mr9305103pfn.9.1708283084908; Sun, 18 Feb 2024 11:04:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283084; cv=pass; d=google.com; s=arc-20160816; b=bn4yZIHAyzHxC0+orv6jFkj2qqVqTuxX+F0NSUcyHYFxRnEmx9BT5nm7U8MHQ8rWCg BdICidOAy7Pip9M+0s+0PoYhKSO7/4aXiq+c6omKotbKtG31lmz8+AG3H9Krr5dTTMk+ ZgWimWVbPAtufK9H+3KmJUuVJGCJ8L/rTgR0jRoRuLaMPuN/hOIL4JP68wfXVpZ0haWo Ivpxx92RXMa+LJEfHieQb4Og92drqnlDrJV4RKo/2X3Mu94rCR0s5i2hetzHCs9s3rBb o7Fmh/DzMEif7VFeT4mGX3p+XsotVgHV+ny40Y7WrUulzZyRDfhxEVn/ILtuOkjTGxmM b4yA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=xb5ObgV1b0NTnABEN6/+CA1UUGUDFrITZUbF1bp3zy8=; fh=OH7s0y4ha448Per6dKtGV0hT+ZsKviWOE56UFibxL/A=; b=0Z3GYPr5/2RBEDfI6uYi6ybxqPwYRSh42IK8+5yMXuThH2GIFv4Ci57ojRstIvGHl7 3QWwX3suCINKNS/1DuCIijkQ40DcXTM+H+kX5YuvIaq/a3PeTFa9HDYZXih5XYkRNoj3 qw0VFryE3kv+FIh7J0SeszznCGo74ynz1qakEXl3sfCHz4ORLu2up8TDrLCx84Ly8jy2 uaufgM0khIGXV1yCB4XtErzVh6amzaoYH2q2yIKNapPIF+Nf3sVO/5vx7+dn4N18QP3G Lm9j2USk5D+9QKBDmdBX2XENTmZ8ElvVSM4u28Ikpla9zM3P2C2omcpKoVuHgWfZBYjX HIjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=O+4sgNXF; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70526-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70526-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id cj10-20020a056a00298a00b006e46102e64bsi592936pfb.109.2024.02.18.11.04.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:04:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70526-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=O+4sgNXF; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70526-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70526-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id B73DC282075 for ; Sun, 18 Feb 2024 19:04:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56B2276025; Sun, 18 Feb 2024 19:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O+4sgNXF" Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E1B371B52; Sun, 18 Feb 2024 19:00:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282852; cv=none; b=E3BAQUH4lF0lCNhNOPxTEP3fdBpM95WUueHVzJaDotyjyVTp2iL7PE6XSlal0ykVMNvuBpLxKclp7WB0A8eT1ve1Ox8vzwqMbsMxj6o7e/Zte8h3WoTB3kiiVVtDkS7om8vQtXEidHuzD7I8KcRSJlLuBEgznjMfZOgSHGTJsvI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282852; c=relaxed/simple; bh=Pdd44FrDd8LXtjrVj7SjYcAmMigl0EYIfRo3HodS0aI=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U9ohhOQPVv18EDQ60FaSAN8a5Hhbo9NhCte5tK3XR6gfQS1eJAP9WkYxXXywSqS9moQqM1RFZQmrGJACo1z/j9arvODe9JEXHcuy57GxbhjJQzudlc7FLCdm5VLh30ow9NpXAvFyvcWSqPb6da8zRRdkMAFr8vWpKPLzgjKMgno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=O+4sgNXF; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-33d3b43c492so415147f8f.3; Sun, 18 Feb 2024 11:00:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708282848; x=1708887648; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=xb5ObgV1b0NTnABEN6/+CA1UUGUDFrITZUbF1bp3zy8=; b=O+4sgNXF9pAPla7XmtNsfrqLrIxM32qAwE+LtGEGJxdHPFiEg/1EKpmPgVFm7KqtRK 7RCI+HZZKfBo283RYhPVBHf8r1j4kp0wkedg3Axl9PrF+pRuQmXBmV7ycUJ4sgg4Crli 6LH1UgcPYtVdUYAcOty6yIZToknLfk9vdX1XJFQcvVA7htDG7w4k7S/xrHKG7a4PJGHQ r4Uta0TmfPUQflSGvQT+qoSngDMWKqcpaoJZTNS4oA2WFyQ08R4i9KNbGBFltRyNwHea 3skDXQxu73QN2T9VCtBOj4jw/+EVc1XyWdKjN+Y80jUAoHBFu9p8y5cEU17XpUhRATLK iiqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708282848; x=1708887648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xb5ObgV1b0NTnABEN6/+CA1UUGUDFrITZUbF1bp3zy8=; b=uFBsqZXKirqVdEWWSxI+nkbQ87SKBw7xmH0Cad4sODsNCr0G7DHcghsyvdOGj3u2PB Sf0hd7uTpR0kTXHZvoY9PlJ3EeDr/aOuWlilBfwrLYBLCdGefo8yB1zM6y++Yjx6CDXw F3w21KY9sJOPJpqqEhpvtx71xKyByOgRWy7mgHWkvV+JBn3Z8FfWQZsTp/IMh++ioJNz xLu2Vk3ylVLbv2AHkZWfDYeaPNnYaOp9LVoJtnhkjMaPQWf+OweSC3A9UY+Q+RcWFUgp 4cGxiIsGazkJnbVM+pAx3jLt/VK/vcqphWFxmFuRipgcTQ34ofd4ubJkS2Y91N5XB82p orxA== X-Forwarded-Encrypted: i=1; AJvYcCW/q8ai/S0HGLV5zax89eScV787vWNe+/fLd5Xa+y7brAASHtjAYpMui7VdemlndbXfWYPRSiDjg481doYirJqZnASSCFKwrcr1NBalvFSVH7lLWosDgypKRYg1gj8Tgt7IDLH8 X-Gm-Message-State: AOJu0Yy7ppOVwa866G+EGiX00+FGGatSiLpqv9kHnB/Z6jSbpxo97uZI sH+TBQP1hfqZU3PRAwvYv/1/YvB3MT1ux7WDItkvFRYF1Fha/4yl X-Received: by 2002:a5d:4704:0:b0:33d:1d2f:1fdc with SMTP id y4-20020a5d4704000000b0033d1d2f1fdcmr4021243wrq.38.1708282848175; Sun, 18 Feb 2024 11:00:48 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id m15-20020a056000008f00b0033b728190c1sm8115762wrx.79.2024.02.18.11.00.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:00:47 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Christian Marangi , Robert Marko , "Russell King (Oracle)" , Greg Kroah-Hartman , Pieter Jansen van Vuuren , Nipun Gupta , Andy Shevchenko , Puneet Gupta , Abhijit Gangurde , Umang Jain , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next RFC PATCH 4/6] net: phy: support named mdio_device_id PHY IDs Date: Sun, 18 Feb 2024 20:00:30 +0100 Message-ID: <20240218190034.15447-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218190034.15447-1-ansuelsmth@gmail.com> References: <20240218190034.15447-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791264644111306316 X-GMAIL-MSGID: 1791264644111306316 PHY IDs defined in PHY driver .ids can have a more specific name defined. If this is the case, overwrite the PHY istance dev name with the more specific one from the matching dev_id. Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 60a60f182729..9e359e304f91 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3471,9 +3471,15 @@ static int phy_probe(struct device *dev) */ if (phy_driver_match(phydrv, phydev, &dev_id) && dev_id) { memcpy(phy_dev_id, dev_id, sizeof(*dev_id)); + /* If defined, overwrite the PHY driver dev name with a + * more specific one from the matching dev_id. + */ + if (dev_id->name) + drv->name = dev_id->name; } else { phy_dev_id->phy_id = phydrv->phy_id; phy_dev_id->phy_id_mask = phydrv->phy_id_mask; + phy_dev_id->name = phydrv->name; } /* Fill PHY ID with dev_id if empty and PHY is C45 */ From patchwork Sun Feb 18 19:00:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 202861 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp914430dyc; Sun, 18 Feb 2024 11:05:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVlIGrJRH3VZXxotcN+Yt/eFX1oynkjyn5bn8Gz7gNKkUBkB3sb+eAMEz5lPnBS+SDvyHbyO8OflOGyiJfkLeG79tnRDQ== X-Google-Smtp-Source: AGHT+IEeTTZV4bg7z4ua6gIiFn4VxH1zUpbC1PafQAw3m5BygvqCO8lfHjzpbaMhCRy+alvQT5HC X-Received: by 2002:a05:6a20:ce47:b0:19e:b95f:123c with SMTP id id7-20020a056a20ce4700b0019eb95f123cmr11481885pzb.49.1708283107118; Sun, 18 Feb 2024 11:05:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283107; cv=pass; d=google.com; s=arc-20160816; b=oVfwTZzk5+MIip9V8Aa4Ai38KYJWubPMYWR5aLuKX/xpPvxRXVHXQmjhMeywUbwEEe 1A2t529mtw608H6I3sdieYE4ElhAzqDuWCx+0tW42bR5UwJCgu6WWsIgWWHtfgHKNgI5 S6d4W8uWe3eGyIab/I/3lRZ4zyjlXkX4/vdnZKv08S/FitaTWBgRuzKVTJxx7ZXYPMKa NpD4EwIY22ta1kinzq4yGpXy1yWvtnC6wJTiKb/4nlSR4LLKRJGM61k9I709JAq7easU 9iyxjlXW9HG3q4XE/qowdBXvhVnNdrLBaPo3IbiA9Ov6khGCDf/ngfx0QL9mcXIqb8IR pVKg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=+dU1BBPhidy3QSkuNfiM8Gww7zKe+F20tB7LQibq13Y=; fh=F1vs/SmqPXOLIkIxJPdcQqRr/xud+mUa2X0hSayRVPk=; b=gvIepTDt8X+L4EHmhhJrdtV6hjg+siRiZbqt5AMa1pyVs5WrilDJoADmU0k9F6p02S V967pNv2AvTX8Um4KfLT2OmsoXToP8QAUiJwinBsCHyJDTnulyPGMUVb+I80NHG5mOJP b5HQZ+z5ktenkngesejQdEOt7pGMiEhORHKk0N1SMAUf0W9wiVU9KOVPSPf+6wQCroJt eC/HstKWXI2ZnjAX3hUYNgBHckFc+DizV/l2VMwtWPrg9ICJC7+Ls7fhukxXC5v55xyK bnqXoZcxjqV1zn/QLAEwKqfFuAxB48q8dfrGjJ5XXrRqRWvRcLtSfPb5o6sEcVRviKYQ E9yg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jlHJZJsR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70527-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70527-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id fj36-20020a056a003a2400b006d9bb8e9e5esi3280019pfb.356.2024.02.18.11.05.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:05:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70527-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=jlHJZJsR; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70527-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70527-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 172A5280E2E for ; Sun, 18 Feb 2024 19:05:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78C8F7602B; Sun, 18 Feb 2024 19:00:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jlHJZJsR" Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3091E73170; Sun, 18 Feb 2024 19:00:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282853; cv=none; b=K6SuHhTiP/grTzurJ0UXHAzhS0hyaQZUWn16rfnPya2mDOtZdRacG28mds/ve10L9T1CJPmIYlp5k6OduPwEre8vP/Lbla67j5Yr1vDT9LS1yoGAAgHhz8Up7esF4aWWIyzvDVUS/0k5mXbbCs5NIlmiCZP8lXWYLygjwNj9KnQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282853; c=relaxed/simple; bh=J026UxEVxVrHqoetNwJqWqAaKMfc2Oh3wU+/mVBHyOE=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hkv/oWlPlvOaoMNEn2adve1RlRec/cy+XTgLl422thoxtJZBaVeIrDSaRRbOkvTOxyqgsg2iRn8cA3VeC3Q6Zf2Jbwve4MzSAg0WYsLjQQCwFMl5LfKF+KY580oVPHHeFHYNFl3FDX1igT/U4H1vDOjubu/i3xzP2TFjmdazOWQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jlHJZJsR; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-33d375993f4so404464f8f.1; Sun, 18 Feb 2024 11:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708282849; x=1708887649; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=+dU1BBPhidy3QSkuNfiM8Gww7zKe+F20tB7LQibq13Y=; b=jlHJZJsRwtvvtq3CnNmeZB02912zk1C6OLoMGWcclvjnhCNtq6EKLq5xYNEvEX9mn2 NuzmH6xetL0+P/8BMZEkQLM40FLoA4DbIh6DRVm4hY/rntPxnVJTYVTcsuczLV4i2Xfj GK8fT+OjD7DWfTC1acbKhb6uQBID595B1zUnZKeAgpEtY4KLwK3dOXh7zoPoUvh6cpx3 I2vRBKdvUhxLFBOvoujNRnmB8FOdIIzuryNYsO2E4+qjHsrHT1cBhPSMQy55OHLdJEax 5xDtKAV/9glQIkmCdlptHudiozMTHWMSrj9qlbsIrE1n8r6OANz+1Ef7aE5D3LpzayCI ijEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708282849; x=1708887649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+dU1BBPhidy3QSkuNfiM8Gww7zKe+F20tB7LQibq13Y=; b=YS1KjdDLpDwemmbdmhT/uP4XxDfGztsvU0PUn5K0GPx64iGwt114fFhYhWXWfjPzWx lrh9G7iRXXGm705TFFG1bQnMzwi6csfJAEj6TksIM70qJcy+5kyAYKY1namlgT8ujIA1 uN7jBNyytU3Rt5HTijgY4tlCwr+SlhxW1QMapeP1rh/KzxGMzCntnYovCP8D9++yJANe 6Cy5ZMb5jUi4V2RA5pmTEURrn4hkor7m9LTEQyI73qMOROEw4hgkMtFZNgql00K0azuW 7JjQ9t4prUupu7K8XyftJydDIucZmZvJRePjigIFTchAAb7YY9Hx3DkL2Fqto1NW6gUj HRqg== X-Forwarded-Encrypted: i=1; AJvYcCUBR5zWAfUn6r7i5n090HC7V/BTBzdR38zt0wRbONwoypPK+MxtbOMPzkCxBg/7Oe+nwFaE12wvtCJRwNS7H4ezaP5N72GzNxzHZs1ljnkW1fhcIUxkM3s3Gz/dhhQgfAGnlYuQ X-Gm-Message-State: AOJu0YyXl7qmUgtjHCnizDaJRVhhzlAFnU/Hkf/zRW7icKZW7EQFnaq6 pHPvwrKrpQNWPl18Y1RTmATUWeZMaJFr06ScBg9Reuz7Z6qOe+uN X-Received: by 2002:adf:f3c2:0:b0:33d:35ef:ac2e with SMTP id g2-20020adff3c2000000b0033d35efac2emr2915574wrp.17.1708282849381; Sun, 18 Feb 2024 11:00:49 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id m15-20020a056000008f00b0033b728190c1sm8115762wrx.79.2024.02.18.11.00.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:00:49 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Christian Marangi , Robert Marko , "Russell King (Oracle)" , Greg Kroah-Hartman , Pieter Jansen van Vuuren , Nipun Gupta , Andy Shevchenko , Puneet Gupta , Abhijit Gangurde , Umang Jain , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next RFC PATCH 5/6] net: phy: aquantia: group common OPs for PHYs where possible Date: Sun, 18 Feb 2024 20:00:31 +0100 Message-ID: <20240218190034.15447-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218190034.15447-1-ansuelsmth@gmail.com> References: <20240218190034.15447-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791264667289193431 X-GMAIL-MSGID: 1791264667289193431 Group common OPS for PHY where possible by defining multiple PHYs for similar PHY drivers instead of duplicating them for each PHY. Signed-off-by: Christian Marangi --- drivers/net/phy/aquantia/aquantia_main.c | 170 +++++++++-------------- 1 file changed, 64 insertions(+), 106 deletions(-) diff --git a/drivers/net/phy/aquantia/aquantia_main.c b/drivers/net/phy/aquantia/aquantia_main.c index a6a7980585f5..4a788fc8e26a 100644 --- a/drivers/net/phy/aquantia/aquantia_main.c +++ b/drivers/net/phy/aquantia/aquantia_main.c @@ -770,16 +770,26 @@ static int aqr111_config_init(struct phy_device *phydev) static struct phy_driver aqr_driver[] = { { - PHY_ID_MATCH_MODEL(PHY_ID_AQ1202), - .name = "Aquantia AQ1202", - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr_read_status, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQ2104), - .name = "Aquantia AQ2104", + .name = "Aquantia AQ1202/AQ2104/AQR106/AQR405", + .ids = (const struct mdio_device_id []){ + { + PHY_ID_MATCH_MODEL(PHY_ID_AQ1202), + .name = "Aquantia AQ1202" + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_AQ2104), + .name = "Aquantia AQ2104", + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR106), + .name = "Aquantia AQR106", + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR405), + .name = "Aquantia AQR405", + }, + { /* sentinel */ }, + }, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, .handle_interrupt = aqr_handle_interrupt, @@ -796,16 +806,22 @@ static struct phy_driver aqr_driver[] = { .resume = aqr107_resume, }, { - PHY_ID_MATCH_MODEL(PHY_ID_AQR106), - .name = "Aquantia AQR106", - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr_read_status, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQR107), - .name = "Aquantia AQR107", + .name = "Aquantia AQR107/AQR112/AQR412", + .ids = (const struct mdio_device_id []){ + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR107), + .name = "Aquantia AQR107" + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR112), + .name = "Aquantia AQR112", + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR412), + .name = "Aquantia AQR412", + }, + { /* sentinel */ }, + }, .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqr107_config_init, @@ -842,27 +858,22 @@ static struct phy_driver aqr_driver[] = { .link_change_notify = aqr107_link_change_notify, }, { - PHY_ID_MATCH_MODEL(PHY_ID_AQR111), - .name = "Aquantia AQR111", - .probe = aqr107_probe, - .get_rate_matching = aqr107_get_rate_matching, - .config_init = aqr111_config_init, - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr107_read_status, - .get_tunable = aqr107_get_tunable, - .set_tunable = aqr107_set_tunable, - .suspend = aqr107_suspend, - .resume = aqr107_resume, - .get_sset_count = aqr107_get_sset_count, - .get_strings = aqr107_get_strings, - .get_stats = aqr107_get_stats, - .link_change_notify = aqr107_link_change_notify, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0), - .name = "Aquantia AQR111B0", + .name = "Aquantia AQR111/AQR111B0", + .ids = (const struct mdio_device_id []){ + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR111), + .name = "Aquantia AQR111" + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR111B0), + .name = "Aquantia AQR111B0", + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR106), + .name = "Aquantia AQR106", + }, + { /* sentinel */ }, + }, .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqr111_config_init, @@ -880,71 +891,18 @@ static struct phy_driver aqr_driver[] = { .link_change_notify = aqr107_link_change_notify, }, { - PHY_ID_MATCH_MODEL(PHY_ID_AQR405), - .name = "Aquantia AQR405", - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr_read_status, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQR112), - .name = "Aquantia AQR112", - .probe = aqr107_probe, - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .get_tunable = aqr107_get_tunable, - .set_tunable = aqr107_set_tunable, - .suspend = aqr107_suspend, - .resume = aqr107_resume, - .read_status = aqr107_read_status, - .get_rate_matching = aqr107_get_rate_matching, - .get_sset_count = aqr107_get_sset_count, - .get_strings = aqr107_get_strings, - .get_stats = aqr107_get_stats, - .link_change_notify = aqr107_link_change_notify, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQR412), - .name = "Aquantia AQR412", - .probe = aqr107_probe, - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .get_tunable = aqr107_get_tunable, - .set_tunable = aqr107_set_tunable, - .suspend = aqr107_suspend, - .resume = aqr107_resume, - .read_status = aqr107_read_status, - .get_rate_matching = aqr107_get_rate_matching, - .get_sset_count = aqr107_get_sset_count, - .get_strings = aqr107_get_strings, - .get_stats = aqr107_get_stats, - .link_change_notify = aqr107_link_change_notify, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQR113), - .name = "Aquantia AQR113", - .probe = aqr107_probe, - .get_rate_matching = aqr107_get_rate_matching, - .config_init = aqr113c_config_init, - .config_aneg = aqr_config_aneg, - .config_intr = aqr_config_intr, - .handle_interrupt = aqr_handle_interrupt, - .read_status = aqr107_read_status, - .get_tunable = aqr107_get_tunable, - .set_tunable = aqr107_set_tunable, - .suspend = aqr107_suspend, - .resume = aqr107_resume, - .get_sset_count = aqr107_get_sset_count, - .get_strings = aqr107_get_strings, - .get_stats = aqr107_get_stats, - .link_change_notify = aqr107_link_change_notify, -}, -{ - PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), - .name = "Aquantia AQR113C", + .name = "Aquantia AQR113/AQR113C", + .ids = (const struct mdio_device_id []){ + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR113), + .name = "Aquantia AQR113" + }, + { + PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), + .name = "Aquantia AQR113C", + }, + { /* sentinel */ }, + }, .probe = aqr107_probe, .get_rate_matching = aqr107_get_rate_matching, .config_init = aqr113c_config_init, From patchwork Sun Feb 18 19:00:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 202862 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp914470dyc; Sun, 18 Feb 2024 11:05:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWuAH34BVXSHkHtCuQ/pZVI6t413E34GZYHK1EdZjDY3xZoLnzpJonTYIySpsUQaQjyYPFhPQNo9HUNOFSSZbkhz1jvdg== X-Google-Smtp-Source: AGHT+IFUS3KR0cwlvsp48MVPLp4ZCieqvLRIELQO4ArngVkEGazAGIsnb7zFfNu8ifjoh58TeSTQ X-Received: by 2002:a05:6402:31fb:b0:564:d1f:1f41 with SMTP id dy27-20020a05640231fb00b005640d1f1f41mr4487504edb.23.1708283112336; Sun, 18 Feb 2024 11:05:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708283112; cv=pass; d=google.com; s=arc-20160816; b=wicOHOnRajM3AY8y9IwZqkPcwVtIIFUwDJusa4VZVWijc2sCQ2ZU+OSvE3eNcRv+nV 32XFlaxQ6Uc6MSfc8VlEk4o5wmTrQjTeP+p8wPHCK1PiEwdEM/JamiSnYzkmRb50DdwU mS3l4LZpBr3pA41Ok9HfjJx2+g9GIfb1qVV9vXdBRTqs8/DdHS0kav8tnVa7RoBi0xxn rj9ALxYLet7BexU0jCrF7Xf4JV30Y4r3pkFsuQLnMLyhq8msPpmepVkwoYLBJ/9mKMfn Y/5S4f6wsaCxSpuZ7gA59+sefKGJlvOIHucCQiuk/+rd7Q+o0gXiBMimDGSmqa9W+smF ZbaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:to:from:dkim-signature; bh=LVCDWG5HyyNzD3ROBUiUfCNlTle5zKPM92sFTYbMog8=; fh=GRR4xHh0g5b4pjrE+jeaE6o3vJvA98+f7bemXrDyMdc=; b=UuslS642IP+ylR9WcFlHr0s9/502mdukt/F9e59wTpBz2agRftnsBeG/j9uo2JoASb qzrHfhTY+uqnDn6QGhENYnYa3YObwq95U59yjMuH1MJGseBepUz3anWFXI4nC5G4NaeM lcyK1C5CEbTnZ8Yo3artKpuk8d6a0VdavWmtMKS7yrYG7LEFILlw4Zce2g7WJ3SBblY4 GqZfW1zohwidq9z23dsOKBWp3wdYyXMYHBK8C1ktaf0FmBErWDuFWm/PAEsJNwz+HywM JQIT+c0CvX6aHoZSdgxUCoayjzjqKcEqVdvy7eZlnyQvVHl4+ZhHWCCtK4U5YW4V7Cfw 7WRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XFgcR6sg; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70528-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70528-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id u23-20020a50c057000000b005647becf0basi98635edd.27.2024.02.18.11.05.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:05:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-70528-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XFgcR6sg; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-70528-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-70528-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C75E81F21A28 for ; Sun, 18 Feb 2024 19:05:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAF3073170; Sun, 18 Feb 2024 19:00:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XFgcR6sg" Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C62F745D0; Sun, 18 Feb 2024 19:00:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282854; cv=none; b=kt/66KL9hl7Sfm50JIVf069uXU+OiP14O/hAkWOFNxtIAp7jix8bGN62L+b+P0ydl0YTY/X3BQprfCiWDsYb34lS8oy+WE5RYo+OT1eAL84lmK0vc4z0emMF2DKwSnNffCXIpmJ2X+r4GeDF7/0P59lwDA/qrZK56rUZtfWh6lg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282854; c=relaxed/simple; bh=X4Dgs1+oA9FIuXWyYEmtL0W3o+8D/VQnJV5zcr/C9d0=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RaZpsiQQUoW78Pk0x5H2yNERy4xthR0zHYMyvdIKyI45TtPfENYvQtnJoBIVRYfWZE6rNzgkLem2EWW8nKn1Z0qR0EL8R+lws/lT9NomALYsSMLh6NAfmTOvNLujU1RCsR9WuDGhXXjgBjkyl0GsSqwk2gcvp9wFJ5kIvhuS3+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XFgcR6sg; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-33d4c11bd34so286606f8f.3; Sun, 18 Feb 2024 11:00:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708282851; x=1708887651; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LVCDWG5HyyNzD3ROBUiUfCNlTle5zKPM92sFTYbMog8=; b=XFgcR6sggisqPR51O3FvovfBB6tSIhv2iwrQxnLpMFDcXAVLYUNaxNFmh3uNptX4r+ 9HKXR8qZd//9GJ3D6DgXG40zwymxsGwfSmpiqwGaYACADJ55gK9RDEeLYj8//YiqBdu1 HUU7ear5C7kbe9GB+RuvxRn6/aABIvn01QHuxXwQG1iV3qiESYzYHSZJala1tTih0RZ9 GEda4D1I7A7oK6yWoNvdWGoHfv+Bf8hesJ6Ouut09Krme8QrouRlbyqMvfrF5XrPMo/K IG5Wfg5tsjGD5I8HtNYbA5pa9GUKKFkhSGyWkRbM8xL9yCHWCFXA/1IdlfcBUmJSU3dR +06w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708282851; x=1708887651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LVCDWG5HyyNzD3ROBUiUfCNlTle5zKPM92sFTYbMog8=; b=q+xkaVxdHd2OhVDGsB4vVE5PM8X2Mi4QjrBEpwaRTSuXeMbKGp2+Q+eEAOsWRftYBy mBT+LzGnW5VAWtLrxV+lbv9E01TftuIsXUWe4qrUoS4RNlbNXipdaIA5lLtsiSjzAWHz 0lo5FGj2iyyQnjJnMgDnbWwCyk9qqZ5ARYWGHTGPDLEBcJYdUiXe2y8WT9rmInc3pi3d /VStTor/FsyyKpzFsdqHnU8i7bG2pElNDOsbejJFxCGEzLLWScY6jAU0EZI5gscuo/QV AwnTlgkGCqmHSNMlXMC17VcaZQNngBo6RhjVguE8Y6eT7v0Nwgzc2hINaHKz1iKnMfKa Dipw== X-Forwarded-Encrypted: i=1; AJvYcCVGW0MGibrtb2GNiaqwE5a8LqISAr1ps0QaIJSE4iHJPQw21ZPqkWrXPF4MPJ2CZzrszPSLLL8NpxkGMAAKsdECrVUQROXJh+AMlPEHC63+WT/VHaaVG1Xmk7TJcgX5Unr6tA0S X-Gm-Message-State: AOJu0Yyc6qtWSFbQqr1w3ZqO4C78jlRua37WkjLD2Nn9a4kyoJa03C6P Qc/3HhAhfRESBvIzVr+ICdA8V7D1AUSjBbzOk0I6OQxLMUShEEr6 X-Received: by 2002:a5d:5487:0:b0:33d:3ee3:cc0b with SMTP id h7-20020a5d5487000000b0033d3ee3cc0bmr2003541wrv.49.1708282850734; Sun, 18 Feb 2024 11:00:50 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id m15-20020a056000008f00b0033b728190c1sm8115762wrx.79.2024.02.18.11.00.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:00:50 -0800 (PST) From: Christian Marangi To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Florian Fainelli , Broadcom internal kernel review list , Christian Marangi , Robert Marko , "Russell King (Oracle)" , Greg Kroah-Hartman , Pieter Jansen van Vuuren , Nipun Gupta , Andy Shevchenko , Puneet Gupta , Abhijit Gangurde , Umang Jain , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next RFC PATCH 6/6] net: phy: bcm7xxx: rework phy_driver table to new multiple PHY ID format Date: Sun, 18 Feb 2024 20:00:32 +0100 Message-ID: <20240218190034.15447-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218190034.15447-1-ansuelsmth@gmail.com> References: <20240218190034.15447-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791264672737866645 X-GMAIL-MSGID: 1791264672737866645 Rework bcm7xxx PHY driver table to new multiple PHY format implementation to reduce code duplication and final size of the compiled module. Signed-off-by: Christian Marangi --- drivers/net/phy/bcm7xxx.c | 140 ++++++++++++++++++++++---------------- 1 file changed, 82 insertions(+), 58 deletions(-) diff --git a/drivers/net/phy/bcm7xxx.c b/drivers/net/phy/bcm7xxx.c index 97638ba7ae85..4d886bb8a3e2 100644 --- a/drivers/net/phy/bcm7xxx.c +++ b/drivers/net/phy/bcm7xxx.c @@ -845,16 +845,6 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .phy_id = (_oui), \ .phy_id_mask = 0xfffffff0, \ .name = _name, \ - /* PHY_GBIT_FEATURES */ \ - .flags = PHY_IS_INTERNAL, \ - .config_init = bcm7xxx_28nm_config_init, \ - .resume = bcm7xxx_28nm_resume, \ - .get_tunable = bcm7xxx_28nm_get_tunable, \ - .set_tunable = bcm7xxx_28nm_set_tunable, \ - .get_sset_count = bcm_phy_get_sset_count, \ - .get_strings = bcm_phy_get_strings, \ - .get_stats = bcm7xxx_28nm_get_phy_stats, \ - .probe = bcm7xxx_28nm_probe, \ } #define BCM7XXX_28NM_EPHY(_oui, _name) \ @@ -862,16 +852,6 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .phy_id = (_oui), \ .phy_id_mask = 0xfffffff0, \ .name = _name, \ - /* PHY_BASIC_FEATURES */ \ - .flags = PHY_IS_INTERNAL, \ - .config_init = bcm7xxx_28nm_ephy_config_init, \ - .resume = bcm7xxx_28nm_ephy_resume, \ - .get_sset_count = bcm_phy_get_sset_count, \ - .get_strings = bcm_phy_get_strings, \ - .get_stats = bcm7xxx_28nm_get_phy_stats, \ - .probe = bcm7xxx_28nm_probe, \ - .read_mmd = bcm7xxx_28nm_ephy_read_mmd, \ - .write_mmd = bcm7xxx_28nm_ephy_write_mmd, \ } #define BCM7XXX_40NM_EPHY(_oui, _name) \ @@ -879,12 +859,6 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .phy_id = (_oui), \ .phy_id_mask = 0xfffffff0, \ .name = _name, \ - /* PHY_BASIC_FEATURES */ \ - .flags = PHY_IS_INTERNAL, \ - .soft_reset = genphy_soft_reset, \ - .config_init = bcm7xxx_config_init, \ - .suspend = bcm7xxx_suspend, \ - .resume = bcm7xxx_config_init, \ } #define BCM7XXX_16NM_EPHY(_oui, _name) \ @@ -892,41 +866,91 @@ static int bcm7xxx_28nm_probe(struct phy_device *phydev) .phy_id = (_oui), \ .phy_id_mask = 0xfffffff0, \ .name = _name, \ - /* PHY_BASIC_FEATURES */ \ - .flags = PHY_IS_INTERNAL, \ - .get_sset_count = bcm_phy_get_sset_count, \ - .get_strings = bcm_phy_get_strings, \ - .get_stats = bcm7xxx_28nm_get_phy_stats, \ - .probe = bcm7xxx_28nm_probe, \ - .config_init = bcm7xxx_16nm_ephy_config_init, \ - .config_aneg = genphy_config_aneg, \ - .read_status = genphy_read_status, \ - .resume = bcm7xxx_16nm_ephy_resume, \ } static struct phy_driver bcm7xxx_driver[] = { - BCM7XXX_28NM_EPHY(PHY_ID_BCM72113, "Broadcom BCM72113"), - BCM7XXX_28NM_EPHY(PHY_ID_BCM72116, "Broadcom BCM72116"), - BCM7XXX_16NM_EPHY(PHY_ID_BCM72165, "Broadcom BCM72165"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7250, "Broadcom BCM7250"), - BCM7XXX_28NM_EPHY(PHY_ID_BCM7255, "Broadcom BCM7255"), - BCM7XXX_28NM_EPHY(PHY_ID_BCM7260, "Broadcom BCM7260"), - BCM7XXX_28NM_EPHY(PHY_ID_BCM7268, "Broadcom BCM7268"), - BCM7XXX_28NM_EPHY(PHY_ID_BCM7271, "Broadcom BCM7271"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7278, "Broadcom BCM7278"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7364, "Broadcom BCM7364"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7366, "Broadcom BCM7366"), - BCM7XXX_16NM_EPHY(PHY_ID_BCM74165, "Broadcom BCM74165"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM74371, "Broadcom BCM74371"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7439, "Broadcom BCM7439"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7439_2, "Broadcom BCM7439 (2)"), - BCM7XXX_28NM_GPHY(PHY_ID_BCM7445, "Broadcom BCM7445"), - BCM7XXX_40NM_EPHY(PHY_ID_BCM7346, "Broadcom BCM7346"), - BCM7XXX_40NM_EPHY(PHY_ID_BCM7362, "Broadcom BCM7362"), - BCM7XXX_40NM_EPHY(PHY_ID_BCM7425, "Broadcom BCM7425"), - BCM7XXX_40NM_EPHY(PHY_ID_BCM7429, "Broadcom BCM7429"), - BCM7XXX_40NM_EPHY(PHY_ID_BCM7435, "Broadcom BCM7435"), - BCM7XXX_16NM_EPHY(PHY_ID_BCM7712, "Broadcom BCM7712"), +{ + .name = "Broadcom BCM7XXX 16NM EPHY", + .ids = (const struct mdio_device_id []){ + BCM7XXX_16NM_EPHY(PHY_ID_BCM72165, "Broadcom BCM72165"), + BCM7XXX_16NM_EPHY(PHY_ID_BCM74165, "Broadcom BCM74165"), + BCM7XXX_16NM_EPHY(PHY_ID_BCM7712, "Broadcom BCM7712"), + { /* sentinel */ }, + }, + /* PHY_BASIC_FEATURES */ + .flags = PHY_IS_INTERNAL, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm7xxx_28nm_get_phy_stats, + .probe = bcm7xxx_28nm_probe, + .config_init = bcm7xxx_16nm_ephy_config_init, + .config_aneg = genphy_config_aneg, + .read_status = genphy_read_status, + .resume = bcm7xxx_16nm_ephy_resume, +}, +{ + .name = "Broadcom BCM7XXX 28NM GPHY", + .ids = (const struct mdio_device_id []){ + BCM7XXX_28NM_GPHY(PHY_ID_BCM7250, "Broadcom BCM7250"), + BCM7XXX_28NM_GPHY(PHY_ID_BCM7278, "Broadcom BCM7278"), + BCM7XXX_28NM_GPHY(PHY_ID_BCM7364, "Broadcom BCM7364"), + BCM7XXX_28NM_GPHY(PHY_ID_BCM7366, "Broadcom BCM7366"), + BCM7XXX_28NM_GPHY(PHY_ID_BCM74371, "Broadcom BCM74371"), + BCM7XXX_28NM_GPHY(PHY_ID_BCM7439, "Broadcom BCM7439"), + BCM7XXX_28NM_GPHY(PHY_ID_BCM7439_2, "Broadcom BCM7439 (2)"), + BCM7XXX_28NM_GPHY(PHY_ID_BCM7445, "Broadcom BCM7445"), + { /* sentinel */ }, + }, + /* PHY_GBIT_FEATURES */ + .flags = PHY_IS_INTERNAL, + .config_init = bcm7xxx_28nm_config_init, + .resume = bcm7xxx_28nm_resume, + .get_tunable = bcm7xxx_28nm_get_tunable, + .set_tunable = bcm7xxx_28nm_set_tunable, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm7xxx_28nm_get_phy_stats, + .probe = bcm7xxx_28nm_probe, +}, +{ + .name = "Broadcom BCM7XXX 28NM EPHY", + .ids = (const struct mdio_device_id []){ + BCM7XXX_28NM_EPHY(PHY_ID_BCM72113, "Broadcom BCM72113"), + BCM7XXX_28NM_EPHY(PHY_ID_BCM72116, "Broadcom BCM72116"), + BCM7XXX_28NM_EPHY(PHY_ID_BCM7255, "Broadcom BCM7255"), + BCM7XXX_28NM_EPHY(PHY_ID_BCM7260, "Broadcom BCM7260"), + BCM7XXX_28NM_EPHY(PHY_ID_BCM7268, "Broadcom BCM7268"), + BCM7XXX_28NM_EPHY(PHY_ID_BCM7271, "Broadcom BCM7271"), + { /* sentinel */ }, + }, + /* PHY_BASIC_FEATURES */ + .flags = PHY_IS_INTERNAL, + .config_init = bcm7xxx_28nm_ephy_config_init, + .resume = bcm7xxx_28nm_ephy_resume, + .get_sset_count = bcm_phy_get_sset_count, + .get_strings = bcm_phy_get_strings, + .get_stats = bcm7xxx_28nm_get_phy_stats, + .probe = bcm7xxx_28nm_probe, + .read_mmd = bcm7xxx_28nm_ephy_read_mmd, + .write_mmd = bcm7xxx_28nm_ephy_write_mmd, +}, +{ + .name = "Broadcom BCM7XXX 40NM EPHY", + .ids = (const struct mdio_device_id []){ + BCM7XXX_40NM_EPHY(PHY_ID_BCM7346, "Broadcom BCM7346"), + BCM7XXX_40NM_EPHY(PHY_ID_BCM7362, "Broadcom BCM7362"), + BCM7XXX_40NM_EPHY(PHY_ID_BCM7425, "Broadcom BCM7425"), + BCM7XXX_40NM_EPHY(PHY_ID_BCM7429, "Broadcom BCM7429"), + BCM7XXX_40NM_EPHY(PHY_ID_BCM7435, "Broadcom BCM7435"), + { /* sentinel */ }, + }, + /* PHY_BASIC_FEATURES */ + .flags = PHY_IS_INTERNAL, + .soft_reset = genphy_soft_reset, + .config_init = bcm7xxx_config_init, + .suspend = bcm7xxx_suspend, + .resume = bcm7xxx_config_init, +}, }; static struct mdio_device_id __maybe_unused bcm7xxx_tbl[] = {