Mario Scheithauer has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/69433 )
Change subject: drivers/phy/m88e1512: Add interrupt enable ......................................................................
drivers/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 --- M src/drivers/phy/m88e1512/chip.h M src/drivers/phy/m88e1512/m88e1512.c M src/drivers/phy/m88e1512/m88e1512.h 3 files changed, 42 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/33/69433/1
diff --git a/src/drivers/phy/m88e1512/chip.h b/src/drivers/phy/m88e1512/chip.h index d30923a..cd66217 100644 --- a/src/drivers/phy/m88e1512/chip.h +++ b/src/drivers/phy/m88e1512/chip.h @@ -7,4 +7,5 @@ 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/phy/m88e1512/m88e1512.c b/src/drivers/phy/m88e1512/m88e1512.c index aadd593..ba927f4 100644 --- a/src/drivers/phy/m88e1512/m88e1512.c +++ b/src/drivers/phy/m88e1512/m88e1512.c @@ -8,6 +8,12 @@ #include "chip.h" #include "m88e1512.h"
+static void switch_page(struct device *dev, const struct mdio_operations *mdio_ops, + uint8_t phy_adr, uint8_t page) +{ + mdio_ops->write(dev, phy_adr, PAGE_REG, page); +} + static void m88e1512_init(struct device *dev) { const struct mdio_operations *mdio_ops; @@ -25,7 +31,7 @@ dev_path(parent), dev->chip_ops->name);
/* Select page 3 to access LED function control register. */ - mdio_ops->write(parent, dev->path.pnp.device, PAGE_REG, 3); + switch_page(parent, mdio_ops, dev->path.pnp.device, 3);
/* Modify PHY LED mode. */ page_reg = mdio_ops->read(parent, dev->path.pnp.device, LED_FUNC_CTRL_REG); @@ -34,7 +40,25 @@ mdio_ops->write(parent, dev->path.pnp.device, LED_FUNC_CTRL_REG, page_reg);
/* Switch back to page 0. */ - mdio_ops->write(parent, dev->path.pnp.device, PAGE_REG, 0); + switch_page(parent, mdio_ops, dev->path.pnp.device, 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(parent), dev->chip_ops->name); + + /* Select page 3 to access LED function control register. */ + switch_page(parent, mdio_ops, dev->path.pnp.device, 3); + + page_reg = mdio_ops->read(parent, dev->path.pnp.device, + LED_TIMER_CTRL_REG); + setbits16(&page_reg, LED_IRQ_ENABLE); + mdio_ops->write(parent, dev->path.pnp.device, LED_TIMER_CTRL_REG, + page_reg); + + /* Switch back to page 0. */ + switch_page(parent, mdio_ops, dev->path.pnp.device, 0); } }
diff --git a/src/drivers/phy/m88e1512/m88e1512.h b/src/drivers/phy/m88e1512/m88e1512.h index 36e3279..ca0f756 100644 --- a/src/drivers/phy/m88e1512/m88e1512.h +++ b/src/drivers/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_ */