Skip to content

Enable interrupts on CM5 ethernet phy (again) #6963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: rpi-6.12.y
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions arch/arm64/boot/dts/broadcom/bcm2712-rpi-cm5.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ rp1_target: &pcie2 {
phy-handle = <&phy1>;
phy-reset-gpios = <&rp1_gpio 32 GPIO_ACTIVE_LOW>;
phy-reset-duration = <5>;
pinctrl-names = "default";
pinctrl-0 = <&eth0_irq_pins>;

phy1: ethernet-phy@0 {
reg = <0x0>;
Expand Down Expand Up @@ -703,6 +705,14 @@ spi10_cs_pins: &spi10_cs_gpio1 {};
gpios = <48 GPIO_ACTIVE_HIGH>;
output-high;
};

eth0_irq_pins: eth0_irq_pins {
pins = "gpio37";
function = "gpio";
// workaround missing hardware PU
bias-pull-up;
input-enable;
};
};

/ {
Expand Down
22 changes: 12 additions & 10 deletions drivers/net/phy/broadcom.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,13 +444,9 @@ static int bcm54xx_config_init(struct phy_device *phydev)
if (reg < 0)
return reg;

/* Mask interrupts globally. */
reg |= MII_BCM54XX_ECR_IM;
err = phy_write(phydev, MII_BCM54XX_ECR, reg);
if (err < 0)
return err;

/* Unmask events we are interested in. */
/* Initially all interrupts are masked in IMR, so unmask events
* we are interested in.
*/
reg = ~(MII_BCM54XX_INT_DUPLEX |
MII_BCM54XX_INT_SPEED |
MII_BCM54XX_INT_LINK);
Expand Down Expand Up @@ -516,10 +512,14 @@ static int bcm54xx_config_init(struct phy_device *phydev)
BCM54XX_SHD_LEDS1_LED3(BCM_LED_SRC_MULTICOLOR1);
bcm_phy_write_shadow(phydev, BCM54XX_SHD_LEDS1, val);
/* BCM54210PE controls two extra LEDs with the next register.
* Make them shadow the first pair of LEDs - useful on CM4 which
* uses LED3 for ETH_LEDY instead of LED1.
* Make LED3 shadow LED1, but preserve LED4 as is - useful on
* CM4/CM5 which use LED3 for ETH_LEDY instead of LED1. LED4
* is either unused or configured as INT pin on CM5.
*/
bcm_phy_write_shadow(phydev, BCM54XX_SHD_LEDS1 + 1, val);
reg = bcm_phy_read_shadow(phydev, BCM54XX_SHD_LEDS2);
reg &= ~(0xf << 0);
reg |= BCM54XX_SHD_LEDS1_LED1(BCM_LED_SRC_MULTICOLOR1);
bcm_phy_write_shadow(phydev, BCM54XX_SHD_LEDS2, reg);

val = BCM_LED_MULTICOLOR_IN_PHASE |
BCM54XX_SHD_LEDS1_LED1(led_modes[0]) |
Expand Down Expand Up @@ -1484,6 +1484,8 @@ static struct phy_driver broadcom_drivers[] = {
.probe = bcm54xx_phy_probe,
.config_init = bcm54xx_config_init,
.config_intr = bcm_phy_config_intr,
.handle_interrupt = bcm_phy_handle_interrupt,
.link_change_notify = bcm54xx_link_change_notify,
.suspend = bcm54xx_suspend,
.resume = bcm54xx_resume,
}, {
Expand Down
Loading