drivers/net/phy/m88e1512: Add a way to set output impedance manually
This patch provides the functionality to set the RGMII output impedance manually. To ensure that no race condition occurs, the driver strength values for PMOS and NMOS should be written to the RGMII output impedance calibration override register first and then the force bit should be enabled with a second write to this register. Link to the Marvell PHY 88E1512 datasheet: https://web.archive.org/web/20230125074158/https://www.marvell.com/content/dam/marvell/en/public-collateral/phys-transceivers/marvell-ethernet-phys-alaska-88e151x-datasheet.pdf Change-Id: I87fa03aa49514cdc33d2911d7f23386c8f69d95b Signed-off-by: Mario Scheithauer <mario.scheithauer@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/73018 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
This commit is contained in:
parent
33ef5c4e3a
commit
481bfe6a8b
|
@ -11,4 +11,7 @@ struct drivers_net_phy_m88e1512_config {
|
||||||
/* 1x, 2x,...8x is the number of times the PHY attempts to establish Gigabit link
|
/* 1x, 2x,...8x is the number of times the PHY attempts to establish Gigabit link
|
||||||
before the PHY downshifts to the next highest speed. */
|
before the PHY downshifts to the next highest speed. */
|
||||||
unsigned char downshift_cnt;
|
unsigned char downshift_cnt;
|
||||||
|
bool force_mos; /* Force PMOS/NMOS manually */
|
||||||
|
unsigned char pmos_val; /* Set PMOS calibration value */
|
||||||
|
unsigned char nmos_val; /* Set NMOS calibration value */
|
||||||
};
|
};
|
||||||
|
|
|
@ -67,6 +67,25 @@ static void m88e1512_init(struct device *dev)
|
||||||
mdio_write(dev, LED_TIMER_CTRL_REG, reg);
|
mdio_write(dev, LED_TIMER_CTRL_REG, reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set RGMII output impedance manually. */
|
||||||
|
if (config->force_mos) {
|
||||||
|
printk(BIOS_DEBUG, "%s: Set RGMII driver strength manually for %s.\n",
|
||||||
|
dev_path(dev->bus->dev), dev->chip_ops->name);
|
||||||
|
|
||||||
|
/* Select page 2 to access RGMII output impedance calibration override
|
||||||
|
register. */
|
||||||
|
switch_page(dev, 2);
|
||||||
|
|
||||||
|
reg = mdio_read(dev, OUT_IMP_CAL_OVERRIDE_REG);
|
||||||
|
/* Set first only NMOS/PMOS values. */
|
||||||
|
clrsetbits16(®, MOS_VALUE_MASK, PMOS_VALUE(config->pmos_val) |
|
||||||
|
NMOS_VALUE(config->nmos_val));
|
||||||
|
mdio_write(dev, OUT_IMP_CAL_OVERRIDE_REG, reg);
|
||||||
|
/* Activate the new setting. */
|
||||||
|
setbits16(®, FORCE_MOS);
|
||||||
|
mdio_write(dev, OUT_IMP_CAL_OVERRIDE_REG, reg);
|
||||||
|
}
|
||||||
|
|
||||||
/* Switch back to page 0. */
|
/* Switch back to page 0. */
|
||||||
switch_page(dev, 0);
|
switch_page(dev, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,12 @@
|
||||||
#define DOWNSHIFT_CNT_MAX 8
|
#define DOWNSHIFT_CNT_MAX 8
|
||||||
#define DOWNSHIFT_CNT(cnt) ((cnt - 1) << 12)
|
#define DOWNSHIFT_CNT(cnt) ((cnt - 1) << 12)
|
||||||
#define DOWNSHIFT_EN (1 << 11)
|
#define DOWNSHIFT_EN (1 << 11)
|
||||||
|
/* Page 2 registers */
|
||||||
|
#define OUT_IMP_CAL_OVERRIDE_REG 0x18
|
||||||
|
#define MOS_VALUE_MASK 0x0F4F
|
||||||
|
#define PMOS_VALUE(pmos) (pmos << 8)
|
||||||
|
#define FORCE_MOS (1 << 6)
|
||||||
|
#define NMOS_VALUE(nmos) (nmos << 0)
|
||||||
/* Page 3 registers */
|
/* Page 3 registers */
|
||||||
#define LED_FUNC_CTRL_REG 0x10
|
#define LED_FUNC_CTRL_REG 0x10
|
||||||
#define LED_FUNC_CTRL_MASK 0x0FFF
|
#define LED_FUNC_CTRL_MASK 0x0FFF
|
||||||
|
|
Loading…
Reference in New Issue