Skip to content

Commit 332e9f3

Browse files
committed
Merge: CNB95: phy: update to v6.8
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4561 JIRA: https://issues.redhat.com/browse/RHEL-33716 Signed-off-by: Izabela Bakollari <ibakolla@redhat.com> Approved-by: Andrew Halaney <ahalaney@redhat.com> Approved-by: Ivan Vecera <ivecera@redhat.com> Approved-by: Petr Oros <poros@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents a23b9d3 + 01eacf1 commit 332e9f3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+8837
-3086
lines changed

Documentation/networking/phy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ required delays, as defined per the RGMII standard, several options may be
120120
available:
121121

122122
* Some SoCs may offer a pin pad/mux/controller capable of configuring a given
123-
set of pins'strength, delays, and voltage; and it may be a suitable
123+
set of pins' strength, delays, and voltage; and it may be a suitable
124124
option to insert the expected 2ns RGMII delay.
125125

126126
* Modifying the PCB design to include a fixed delay (e.g: using a specifically

MAINTAINERS

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11841,6 +11841,13 @@ F: Documentation/devicetree/bindings/net/ieee802154/mcr20a.txt
1184111841
F: drivers/net/ieee802154/mcr20a.c
1184211842
F: drivers/net/ieee802154/mcr20a.h
1184311843

11844+
MDIO REGMAP DRIVER
11845+
M: Maxime Chevallier <maxime.chevallier@bootlin.com>
11846+
L: netdev@vger.kernel.org
11847+
S: Maintained
11848+
F: drivers/net/mdio/mdio-regmap.c
11849+
F: include/linux/mdio/mdio-regmap.h
11850+
1184411851
MEASUREMENT COMPUTING CIO-DAC IIO DRIVER
1184511852
M: William Breathitt Gray <vilhelm.gray@gmail.com>
1184611853
L: linux-iio@vger.kernel.org
@@ -13867,7 +13874,7 @@ NXP C45 TJA11XX PHY DRIVER
1386713874
M: Radu Pirea <radu-nicolae.pirea@oss.nxp.com>
1386813875
L: netdev@vger.kernel.org
1386913876
S: Maintained
13870-
F: drivers/net/phy/nxp-c45-tja11xx.c
13877+
F: drivers/net/phy/nxp-c45-tja11xx*
1387113878

1387213879
NXP FSPI DRIVER
1387313880
M: Ashish Kumar <ashish.kumar@nxp.com>

drivers/net/mdio/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,17 @@ config MDIO_IPQ8064
181181
This driver supports the MDIO interface found in the network
182182
interface units of the IPQ8064 SoC
183183

184+
config MDIO_REGMAP
185+
tristate
186+
help
187+
This driver allows using MDIO devices that are not sitting on a
188+
regular MDIO bus, but still exposes the standard 802.3 register
189+
layout. It's regmap-based so that it can be used on integrated,
190+
memory-mapped PHYs, SPI PHYs and so on. A new virtual MDIO bus is
191+
created, and its read/write operations are mapped to the underlying
192+
regmap. Users willing to use this driver must explicitly select
193+
REGMAP.
194+
184195
config MDIO_THUNDER
185196
tristate "ThunderX SOCs MDIO buses"
186197
depends on 64BIT

drivers/net/mdio/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ obj-$(CONFIG_MDIO_MOXART) += mdio-moxart.o
1919
obj-$(CONFIG_MDIO_MSCC_MIIM) += mdio-mscc-miim.o
2020
obj-$(CONFIG_MDIO_MVUSB) += mdio-mvusb.o
2121
obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o
22+
obj-$(CONFIG_MDIO_REGMAP) += mdio-regmap.o
2223
obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o
2324
obj-$(CONFIG_MDIO_THUNDER) += mdio-thunder.o
2425
obj-$(CONFIG_MDIO_XGENE) += mdio-xgene.o

drivers/net/mdio/acpi_mdio.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,29 @@
1616

1717
MODULE_AUTHOR("Calvin Johnson <calvin.johnson@oss.nxp.com>");
1818
MODULE_LICENSE("GPL");
19+
MODULE_DESCRIPTION("ACPI MDIO bus (Ethernet PHY) accessors");
1920

2021
/**
21-
* acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL.
22+
* __acpi_mdiobus_register - Register mii_bus and create PHYs from the ACPI ASL.
2223
* @mdio: pointer to mii_bus structure
2324
* @fwnode: pointer to fwnode of MDIO bus. This fwnode is expected to represent
25+
* @owner: module owning this @mdio object.
2426
* an ACPI device object corresponding to the MDIO bus and its children are
2527
* expected to correspond to the PHY devices on that bus.
2628
*
2729
* This function registers the mii_bus structure and registers a phy_device
2830
* for each child node of @fwnode.
2931
*/
30-
int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
32+
int __acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode,
33+
struct module *owner)
3134
{
3235
struct fwnode_handle *child;
3336
u32 addr;
3437
int ret;
3538

3639
/* Mask out all PHYs from auto probing. */
3740
mdio->phy_mask = GENMASK(31, 0);
38-
ret = mdiobus_register(mdio);
41+
ret = __mdiobus_register(mdio, owner);
3942
if (ret)
4043
return ret;
4144

@@ -55,4 +58,4 @@ int acpi_mdiobus_register(struct mii_bus *mdio, struct fwnode_handle *fwnode)
5558
}
5659
return 0;
5760
}
58-
EXPORT_SYMBOL(acpi_mdiobus_register);
61+
EXPORT_SYMBOL(__acpi_mdiobus_register);

drivers/net/mdio/fwnode_mdio.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
MODULE_AUTHOR("Calvin Johnson <calvin.johnson@oss.nxp.com>");
1616
MODULE_LICENSE("GPL");
17+
MODULE_DESCRIPTION("FWNODE MDIO bus (Ethernet PHY) accessors");
1718

1819
static struct pse_control *
1920
fwnode_find_pse_control(struct fwnode_handle *fwnode)

drivers/net/mdio/mdio-aspeed.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,4 @@ module_platform_driver(aspeed_mdio_driver);
155155

156156
MODULE_AUTHOR("Andrew Jeffery <andrew@aj.id.au>");
157157
MODULE_LICENSE("GPL");
158+
MODULE_DESCRIPTION("ASPEED MDIO bus controller");

drivers/net/mdio/mdio-bitbang.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,4 @@ void free_mdio_bitbang(struct mii_bus *bus)
263263
EXPORT_SYMBOL(free_mdio_bitbang);
264264

265265
MODULE_LICENSE("GPL v2");
266+
MODULE_DESCRIPTION("Bitbanged MDIO buses");

drivers/net/mdio/mdio-regmap.c

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// SPDX-License-Identifier: GPL-2.0-or-later
2+
/* Driver for MMIO-Mapped MDIO devices. Some IPs expose internal PHYs or PCS
3+
* within the MMIO-mapped area
4+
*
5+
* Copyright (C) 2023 Maxime Chevallier <maxime.chevallier@bootlin.com>
6+
*/
7+
#include <linux/bitfield.h>
8+
#include <linux/delay.h>
9+
#include <linux/mdio.h>
10+
#include <linux/module.h>
11+
#include <linux/of.h>
12+
#include <linux/of_mdio.h>
13+
#include <linux/phy.h>
14+
#include <linux/platform_device.h>
15+
#include <linux/regmap.h>
16+
#include <linux/mdio/mdio-regmap.h>
17+
18+
#define DRV_NAME "mdio-regmap"
19+
20+
struct mdio_regmap_priv {
21+
struct regmap *regmap;
22+
u8 valid_addr;
23+
};
24+
25+
static int mdio_regmap_read_c22(struct mii_bus *bus, int addr, int regnum)
26+
{
27+
struct mdio_regmap_priv *ctx = bus->priv;
28+
unsigned int val;
29+
int ret;
30+
31+
if (ctx->valid_addr != addr)
32+
return -ENODEV;
33+
34+
ret = regmap_read(ctx->regmap, regnum, &val);
35+
if (ret < 0)
36+
return ret;
37+
38+
return val;
39+
}
40+
41+
static int mdio_regmap_write_c22(struct mii_bus *bus, int addr, int regnum,
42+
u16 val)
43+
{
44+
struct mdio_regmap_priv *ctx = bus->priv;
45+
46+
if (ctx->valid_addr != addr)
47+
return -ENODEV;
48+
49+
return regmap_write(ctx->regmap, regnum, val);
50+
}
51+
52+
struct mii_bus *devm_mdio_regmap_register(struct device *dev,
53+
const struct mdio_regmap_config *config)
54+
{
55+
struct mdio_regmap_priv *mr;
56+
struct mii_bus *mii;
57+
int rc;
58+
59+
if (!config->parent)
60+
return ERR_PTR(-EINVAL);
61+
62+
mii = devm_mdiobus_alloc_size(config->parent, sizeof(*mr));
63+
if (!mii)
64+
return ERR_PTR(-ENOMEM);
65+
66+
mr = mii->priv;
67+
mr->regmap = config->regmap;
68+
mr->valid_addr = config->valid_addr;
69+
70+
mii->name = DRV_NAME;
71+
strscpy(mii->id, config->name, MII_BUS_ID_SIZE);
72+
mii->parent = config->parent;
73+
mii->read = mdio_regmap_read_c22;
74+
mii->write = mdio_regmap_write_c22;
75+
76+
if (config->autoscan)
77+
mii->phy_mask = ~BIT(config->valid_addr);
78+
else
79+
mii->phy_mask = ~0;
80+
81+
rc = devm_mdiobus_register(dev, mii);
82+
if (rc) {
83+
dev_err(config->parent, "Cannot register MDIO bus![%s] (%d)\n", mii->id, rc);
84+
return ERR_PTR(rc);
85+
}
86+
87+
return mii;
88+
}
89+
EXPORT_SYMBOL_GPL(devm_mdio_regmap_register);
90+
91+
MODULE_DESCRIPTION("MDIO API over regmap");
92+
MODULE_AUTHOR("Maxime Chevallier <maxime.chevallier@bootlin.com>");
93+
MODULE_LICENSE("GPL");

drivers/net/mdio/of_mdio.c

Lines changed: 58 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>");
2727
MODULE_LICENSE("GPL");
28+
MODULE_DESCRIPTION("OpenFirmware MDIO bus (Ethernet PHY) accessors");
2829

2930
/* Extract the clause 22 phy ID from the compatible string of the form
3031
* ethernet-phy-idAAAA.BBBB */
@@ -131,13 +132,60 @@ bool of_mdiobus_child_is_phy(struct device_node *child)
131132
return true;
132133
}
133134

134-
if (!of_find_property(child, "compatible", NULL))
135+
if (!of_property_present(child, "compatible"))
135136
return true;
136137

137138
return false;
138139
}
139140
EXPORT_SYMBOL(of_mdiobus_child_is_phy);
140141

142+
static int __of_mdiobus_parse_phys(struct mii_bus *mdio, struct device_node *np,
143+
bool *scanphys)
144+
{
145+
struct device_node *child;
146+
int addr, rc = 0;
147+
148+
/* Loop over the child nodes and register a phy_device for each phy */
149+
for_each_available_child_of_node(np, child) {
150+
if (of_node_name_eq(child, "ethernet-phy-package")) {
151+
/* Ignore invalid ethernet-phy-package node */
152+
if (!of_property_present(child, "reg"))
153+
continue;
154+
155+
rc = __of_mdiobus_parse_phys(mdio, child, NULL);
156+
if (rc && rc != -ENODEV)
157+
goto exit;
158+
159+
continue;
160+
}
161+
162+
addr = of_mdio_parse_addr(&mdio->dev, child);
163+
if (addr < 0) {
164+
/* Skip scanning for invalid ethernet-phy-package node */
165+
if (scanphys)
166+
*scanphys = true;
167+
continue;
168+
}
169+
170+
if (of_mdiobus_child_is_phy(child))
171+
rc = of_mdiobus_register_phy(mdio, child, addr);
172+
else
173+
rc = of_mdiobus_register_device(mdio, child, addr);
174+
175+
if (rc == -ENODEV)
176+
dev_err(&mdio->dev,
177+
"MDIO device at address %d is missing.\n",
178+
addr);
179+
else if (rc)
180+
goto exit;
181+
}
182+
183+
return 0;
184+
exit:
185+
of_node_put(child);
186+
return rc;
187+
}
188+
141189
/**
142190
* __of_mdiobus_register - Register mii_bus and create PHYs from the device tree
143191
* @mdio: pointer to mii_bus structure
@@ -179,33 +227,18 @@ int __of_mdiobus_register(struct mii_bus *mdio, struct device_node *np,
179227
return rc;
180228

181229
/* Loop over the child nodes and register a phy_device for each phy */
182-
for_each_available_child_of_node(np, child) {
183-
addr = of_mdio_parse_addr(&mdio->dev, child);
184-
if (addr < 0) {
185-
scanphys = true;
186-
continue;
187-
}
188-
189-
if (of_mdiobus_child_is_phy(child))
190-
rc = of_mdiobus_register_phy(mdio, child, addr);
191-
else
192-
rc = of_mdiobus_register_device(mdio, child, addr);
193-
194-
if (rc == -ENODEV)
195-
dev_err(&mdio->dev,
196-
"MDIO device at address %d is missing.\n",
197-
addr);
198-
else if (rc)
199-
goto unregister;
200-
}
230+
rc = __of_mdiobus_parse_phys(mdio, np, &scanphys);
231+
if (rc)
232+
goto unregister;
201233

202234
if (!scanphys)
203235
return 0;
204236

205237
/* auto scan for PHYs with empty reg property */
206238
for_each_available_child_of_node(np, child) {
207-
/* Skip PHYs with reg property set */
208-
if (of_find_property(child, "reg", NULL))
239+
/* Skip PHYs with reg property set or ethernet-phy-package node */
240+
if (of_property_present(child, "reg") ||
241+
of_node_name_eq(child, "ethernet-phy-package"))
209242
continue;
210243

211244
for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
@@ -226,13 +259,15 @@ int __of_mdiobus_register(struct mii_bus *mdio, struct device_node *np,
226259
if (!rc)
227260
break;
228261
if (rc != -ENODEV)
229-
goto unregister;
262+
goto put_unregister;
230263
}
231264
}
232265
}
233266

234267
return 0;
235268

269+
put_unregister:
270+
of_node_put(child);
236271
unregister:
237272
mdiobus_unregister(mdio);
238273
return rc;

0 commit comments

Comments
 (0)