Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-dsa-b53-mmap-add-bcm63268-gphy-power-control'

Kyle Hendry says:

====================
net: dsa: b53: mmap: Add bcm63268 GPHY power control

The gpio controller on the bcm63268 has a register for
controlling the gigabit phy power. These patches disable
low power mode when enabling the gphy port.

This is based on an earlier patch series here:
https://lore.kernel.org/20250306053105.41677-1-kylehendrydev@gmail.com

I have created a new series since many of the changes
were included in the ephy control patches:
https://lore.kernel.org/20250724035300.20497-1-kylehendrydev@gmail.com
====================

Link: https://patch.msgid.link/20250814002530.5866-1-kylehendrydev@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+31 -4
+31 -4
drivers/net/dsa/b53/b53_mmap.c
··· 29 29 #include "b53_priv.h" 30 30 31 31 #define BCM63XX_EPHY_REG 0x3C 32 + #define BCM63268_GPHY_REG 0x54 33 + 34 + #define GPHY_CTRL_LOW_PWR BIT(3) 35 + #define GPHY_CTRL_IDDQ_BIAS BIT(0) 32 36 33 37 struct b53_phy_info { 38 + u32 gphy_port_mask; 34 39 u32 ephy_enable_mask; 35 40 u32 ephy_port_mask; 36 41 u32 ephy_bias_bit; ··· 70 65 static const u32 bcm63268_ephy_offsets[] = {4, 9, 14}; 71 66 72 67 static const struct b53_phy_info bcm63268_ephy_info = { 68 + .gphy_port_mask = BIT(3), 73 69 .ephy_enable_mask = GENMASK(4, 0), 74 70 .ephy_port_mask = GENMASK((ARRAY_SIZE(bcm63268_ephy_offsets) - 1), 0), 75 71 .ephy_bias_bit = 24, ··· 296 290 return regmap_update_bits(gpio_ctrl, BCM63XX_EPHY_REG, mask, val); 297 291 } 298 292 293 + static int bcm63268_gphy_set(struct b53_device *dev, bool enable) 294 + { 295 + struct b53_mmap_priv *priv = dev->priv; 296 + struct regmap *gpio_ctrl = priv->gpio_ctrl; 297 + u32 mask = GPHY_CTRL_IDDQ_BIAS | GPHY_CTRL_LOW_PWR; 298 + u32 val = 0; 299 + 300 + if (!enable) 301 + val = mask; 302 + 303 + return regmap_update_bits(gpio_ctrl, BCM63268_GPHY_REG, mask, val); 304 + } 305 + 299 306 static void b53_mmap_phy_enable(struct b53_device *dev, int port) 300 307 { 301 308 struct b53_mmap_priv *priv = dev->priv; 302 309 int ret = 0; 303 310 304 - if (priv->phy_info && (BIT(port) & priv->phy_info->ephy_port_mask)) 305 - ret = bcm63xx_ephy_set(dev, port, true); 311 + if (priv->phy_info) { 312 + if (BIT(port) & priv->phy_info->ephy_port_mask) 313 + ret = bcm63xx_ephy_set(dev, port, true); 314 + else if (BIT(port) & priv->phy_info->gphy_port_mask) 315 + ret = bcm63268_gphy_set(dev, true); 316 + } 306 317 307 318 if (!ret) 308 319 priv->phys_enabled |= BIT(port); ··· 330 307 struct b53_mmap_priv *priv = dev->priv; 331 308 int ret = 0; 332 309 333 - if (priv->phy_info && (BIT(port) & priv->phy_info->ephy_port_mask)) 334 - ret = bcm63xx_ephy_set(dev, port, false); 310 + if (priv->phy_info) { 311 + if (BIT(port) & priv->phy_info->ephy_port_mask) 312 + ret = bcm63xx_ephy_set(dev, port, false); 313 + else if (BIT(port) & priv->phy_info->gphy_port_mask) 314 + ret = bcm63268_gphy_set(dev, false); 315 + } 335 316 336 317 if (!ret) 337 318 priv->phys_enabled &= ~BIT(port);