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: 13561992 X-Patchwork-Delegate: kuba@kernel.org 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EXN1XYGI" 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-Google-Smtp-Source: AGHT+IFomZUmY/xUptbNgyWNZcYkhKcd+F9Fm2a3eJ/uTvltvHZxO+epovoQ/+bSm+/MVwZL/j0GGQ== 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 13561993 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.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 8D2236F503; Sun, 18 Feb 2024 19:00:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282849; cv=none; b=EFgCmRkW2emJXiv5M7RriLnaCr91CpXEL4nQph8X2JB69xhi9rzdzt1n51Seg4XuSmEQcd2yZtnO7yrVUnG26bR5v9NFEv8xp/1YHi1yPCZX3MknjII8gUaLegcKQAdlmKJerQjVuiFP/Sw+uBAfrNDtaUDwjywlrx5PSstLAIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708282849; c=relaxed/simple; bh=haKYsHp4CkJD0gLwDin3HMHYGes9vTGE16+z/nBaGT4=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ojKA2/7R901SRg/G7yRRL2Is8PvbRGoQFk3hLaThO6z3zO9GLAZfdc9am9N50oQBcGHbNZ6eM84i3FYY2LZ+xjuxBklm9ZZPzeJzRvdvqcN2W84Sp5Ofe8DnELmDUbYhF90ecC5Pa/WMpuk36loQwfm7VqLqGwK2mqLpQbdObI0= 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=blQQNtMw; arc=none smtp.client-ip=209.85.128.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="blQQNtMw" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4126144d931so6064135e9.2; Sun, 18 Feb 2024 11:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708282846; x=1708887646; 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=RlNoi7vy5vrkW9XYEYtxG7NDJi03n4jp5ZDDUFrxYTc=; b=blQQNtMwegXV0YkExG+ho3A2LXoKry1KOMIMmwxvSq2zdkKRClfI2h+m+tfdgBVOSl shVP7BE2hECjIF8BvUZNVBD9v1WeNVC6G1w5D+WaxNUEqIkIrlDxCsLOMUBsPqNP4j25 B50E+26+NuBJla1zpGNJfjEVcXdy3pRsZ+f7UONWUt/2MttLjg/WK/RpznSja4oYzVTJ NtZs4y0sPvKUMPWaoGQSQUraXtt6I0fTUqqW0wc80OrYeu3zlgMmFXlPGaUG7DltwvPn NC/5/2K1ZbFFfqUD/NMEXsfKz4olDfg9FhOn/c5/jADXZGFZn//I7e41U9+VNIalP2B0 domA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708282846; x=1708887646; 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=RlNoi7vy5vrkW9XYEYtxG7NDJi03n4jp5ZDDUFrxYTc=; b=dT1DR1bKOPOYLjPIx4OPKiNABQ9MV5pemM9lebfurhCkyptu8IuLV8V4m8ibUt+YTC /aA6Ypk1M5yZIeufyWGPLXDoIj3eda0fLxFo1wXFOBNXljZrYkHhEo1yBBjecy9l8TiD ACMudy2QdexUp9HGWvrVJwa1JVApgIJ7nwWyNMYInWj8U/K8UJVRrWdXuVYICbg7q3np K4JPzH9mcLgqnO99FuwDD1pXhNlqEE37Sz/qHDfWQPkjU3DuGUeZNF46WmNv/GSiYICc FsBMZZsDSAV8b/Du6JaSbKWipWaTlgpvsOJfPyGZZ+gRaLI/NxVIFveI5/l+kGH+YH5B zvGQ== X-Forwarded-Encrypted: i=1; AJvYcCWKhEeM0l1xdTXFIr0ujXsRukk3Fz/OKSm2flGp5bVMOxY8rclu1Pp5M6EvtPZa9GODGJPeuLo9BCAaqfCCOXNvmbor78jiBTgFM+Or4BII4Um7nBigo5efgCrygTmBNEd3adac X-Gm-Message-State: AOJu0Yzfbg7Efdax6snobG/xo8bkhNsHmIp0a2mx98UCyNgiJIwIP36m YJ/JRVL+fFRuS0+6eIe6W6p01HJ43B9fTKnrrOIUMRYuWIYieiCV X-Google-Smtp-Source: AGHT+IGvvtB311ZhJD2F7yqS1jaordKewugWpMML8evIW0pEHeWIVjmqSJjSgC7o6ewbFaPXYWbpQQ== X-Received: by 2002:a5d:5487:0:b0:33d:3ee3:cc0c with SMTP id h7-20020a5d5487000000b0033d3ee3cc0cmr1403020wrv.48.1708282845633; Sun, 18 Feb 2024 11:00:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 Feb 2024 11:00:45 -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 2/6] net: phy: fill phy_id with C45 PHY Date: Sun, 18 Feb 2024 20:00:28 +0100 Message-ID: <20240218190034.15447-3-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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC With C45 PHYs that provide PHY ID in C45 Package regs, PHY device .phy_id is not filled. Correctly fill .phy_id from matching dev_id or phy_driver info. Signed-off-by: Christian Marangi --- drivers/net/phy/phy_device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 9b96357e4de8..60a60f182729 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3476,6 +3476,10 @@ static int phy_probe(struct device *dev) phy_dev_id->phy_id_mask = phydrv->phy_id_mask; } + /* Fill PHY ID with dev_id if empty and PHY is C45 */ + if (!phydev->phy_id && phydev->is_c45) + phydev->phy_id = phy_dev_id->phy_id; + /* Disable the interrupt if the PHY doesn't support it * but the interrupt is still a valid one */ 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: 13561994 X-Patchwork-Delegate: kuba@kernel.org 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="U6tPhT2/" 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-Google-Smtp-Source: AGHT+IFxwitGAS6HBiUwRWZSB+cXjxVP0CxCeF7k1rthCH1ddPC6fq9NlS/l2vp7W3J5qozbKlPouw== 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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: 13561996 X-Patchwork-Delegate: kuba@kernel.org 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="O+4sgNXF" 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-Google-Smtp-Source: AGHT+IGeLTCRBQbTQBliC8oMMSJfO+qZyMbqLc485X63GPaf7JnQ0jL39y0I2o29fHXxDw/BjYXZLw== 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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: 13561997 X-Patchwork-Delegate: kuba@kernel.org 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jlHJZJsR" 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-Google-Smtp-Source: AGHT+IGzqfvL0CYD2TWIRsZSWYbNVUZS4lbeGA2/6uQTiXorzHsvazPUrackIa058ILS91+PgJlWdA== 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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: 13561998 X-Patchwork-Delegate: kuba@kernel.org 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XFgcR6sg" 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-Google-Smtp-Source: AGHT+IEVUF1NnX7Elpx+nifzxqXhaYeWXIA9JhgVDxU4irWZFhuY+c9KYxwiQrLPBT7TTI+D0cCNrg== 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: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC 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[] = {