diff options
author | Mario Scheithauer <mario.scheithauer@siemens.com> | 2022-11-10 09:34:57 +0100 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2022-11-24 06:01:30 +0000 |
commit | 155cf5cd2ee844e9fb86f0f2487ccca65e560f33 (patch) | |
tree | d0626d306a6d84c43b8f8883a97e23febec4092f | |
parent | 969531b6d8c015c329f96840a1337d6b7e9c5595 (diff) |
drivers/net/phy/m88e1512: Add interrupt enable
INTn on Marvell PHY can be routed to LED[2] pin. This setting must be
made via LED Timer Control Register on page 3.
Change-Id: Ida1efbb604c382676b9d13ac8bf14de768f93637
Signed-off-by: Mario Scheithauer <mario.scheithauer@siemens.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/69433
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r-- | src/drivers/net/phy/m88e1512/chip.h | 1 | ||||
-rw-r--r-- | src/drivers/net/phy/m88e1512/m88e1512.c | 16 | ||||
-rw-r--r-- | src/drivers/net/phy/m88e1512/m88e1512.h | 2 |
3 files changed, 19 insertions, 0 deletions
diff --git a/src/drivers/net/phy/m88e1512/chip.h b/src/drivers/net/phy/m88e1512/chip.h index 36a46e93c9..9a3523d7ee 100644 --- a/src/drivers/net/phy/m88e1512/chip.h +++ b/src/drivers/net/phy/m88e1512/chip.h @@ -7,4 +7,5 @@ struct drivers_net_phy_m88e1512_config { unsigned char led_0_ctrl; /* LED[0] Control */ unsigned char led_1_ctrl; /* LED[1] Control */ unsigned char led_2_ctrl; /* LED[2] Control */ + bool enable_int; /* INTn can be routed to LED[2] pin */ }; diff --git a/src/drivers/net/phy/m88e1512/m88e1512.c b/src/drivers/net/phy/m88e1512/m88e1512.c index d0883bf9d6..a8d1c730a1 100644 --- a/src/drivers/net/phy/m88e1512/m88e1512.c +++ b/src/drivers/net/phy/m88e1512/m88e1512.c @@ -34,6 +34,22 @@ static void m88e1512_init(struct device *dev) /* Switch back to page 0. */ switch_page(dev, 0); } + + /* INTn can be routed to LED[2] pin. */ + if (config->enable_int) { + printk(BIOS_DEBUG, "%s: INTn is routed to LED[2] pin %s.\n", + dev_path(dev->bus->dev), dev->chip_ops->name); + + /* Select page 3 to access LED function control register. */ + switch_page(dev, 3); + + reg = mdio_read(dev, LED_TIMER_CTRL_REG); + setbits16(®, LED_IRQ_ENABLE); + mdio_write(dev, LED_TIMER_CTRL_REG, reg); + + /* Switch back to page 0. */ + switch_page(dev, 0); + } } struct device_operations m88e1512_ops = { diff --git a/src/drivers/net/phy/m88e1512/m88e1512.h b/src/drivers/net/phy/m88e1512/m88e1512.h index 36e3279689..ca0f756693 100644 --- a/src/drivers/net/phy/m88e1512/m88e1512.h +++ b/src/drivers/net/phy/m88e1512/m88e1512.h @@ -7,5 +7,7 @@ #define PAGE_REG 0x16 #define LED_FUNC_CTRL_REG 0x10 #define LED_FUNC_CTRL_MASK 0x0FFF +#define LED_TIMER_CTRL_REG 0x12 +#define LED_IRQ_ENABLE (1 << 7) #endif /* _PHY_M88E1512_H_ */ |