Skip to content

Commit bd87bb1

Browse files
kylehendrydevNipaLocal
authored andcommitted
net: dsa: b53: mmap: Implement bcm63268 gphy power control
Add check for gphy in enable/disable phy calls and set power bits in gphy control register. Signed-off-by: Kyle Hendry <kylehendrydev@gmail.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Signed-off-by: NipaLocal <nipa@local>
1 parent 0a5bd24 commit bd87bb1

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

drivers/net/dsa/b53/b53_mmap.c

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
#include "b53_priv.h"
3030

3131
#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)
3236

3337
struct b53_phy_info {
3438
u32 gphy_port_mask;
@@ -292,13 +296,30 @@ static int bcm63xx_ephy_set(struct b53_device *dev, int port, bool enable)
292296
return regmap_update_bits(gpio_ctrl, BCM63XX_EPHY_REG, mask, val);
293297
}
294298

299+
static int bcm63268_gphy_set(struct b53_device *dev, bool enable)
300+
{
301+
struct b53_mmap_priv *priv = dev->priv;
302+
struct regmap *gpio_ctrl = priv->gpio_ctrl;
303+
u32 mask = GPHY_CTRL_IDDQ_BIAS | GPHY_CTRL_LOW_PWR;
304+
u32 val = 0;
305+
306+
if (!enable)
307+
val = mask;
308+
309+
return regmap_update_bits(gpio_ctrl, BCM63268_GPHY_REG, mask, val);
310+
}
311+
295312
static void b53_mmap_phy_enable(struct b53_device *dev, int port)
296313
{
297314
struct b53_mmap_priv *priv = dev->priv;
298315
int ret = 0;
299316

300-
if (priv->phy_info && (BIT(port) & priv->phy_info->ephy_port_mask))
301-
ret = bcm63xx_ephy_set(dev, port, true);
317+
if (priv->phy_info) {
318+
if (BIT(port) & priv->phy_info->ephy_port_mask)
319+
ret = bcm63xx_ephy_set(dev, port, true);
320+
else if (BIT(port) & priv->phy_info->gphy_port_mask)
321+
ret = bcm63268_gphy_set(dev, true);
322+
}
302323

303324
if (!ret)
304325
priv->phys_enabled |= BIT(port);
@@ -309,8 +330,12 @@ static void b53_mmap_phy_disable(struct b53_device *dev, int port)
309330
struct b53_mmap_priv *priv = dev->priv;
310331
int ret = 0;
311332

312-
if (priv->phy_info && (BIT(port) & priv->phy_info->ephy_port_mask))
313-
ret = bcm63xx_ephy_set(dev, port, false);
333+
if (priv->phy_info) {
334+
if (BIT(port) & priv->phy_info->ephy_port_mask)
335+
ret = bcm63xx_ephy_set(dev, port, false);
336+
else if (BIT(port) & priv->phy_info->gphy_port_mask)
337+
ret = bcm63268_gphy_set(dev, false);
338+
}
314339

315340
if (!ret)
316341
priv->phys_enabled &= ~BIT(port);

0 commit comments

Comments
 (0)