/* Return: 0 if the link was established successfully, -ve on error  */
static int establish_link(struct udevice *dev)
/* Return: 0 if the link was established successfully, -ve on error  */
static int establish_link(struct udevice *dev)
{
	struct dp_tx *dp_tx = dev_get_priv(dev);
	int status;
	int status2;
	u32 mask;
	reset_dp_phy(dev, PHY_CONFIG_PHY_RESET_MASK);
	disable_main_link(dev);
	mask = phy_status_lanes_ready_mask(dp_tx->max_lane_count);
	status = wait_phy_ready(dev, mask);
	if (status)
		return -EIO;
	status = run_training(dev);
	status2 = set_training_pattern(dev, TRAINING_PATTERN_SET_OFF);
	if (status || status2)
		return -EIO;
	return 0;
}