Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 12fcf941 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller
Browse files

cxgb3: implement set_phys_id



Implement new ethtool set_phys_id on Chelsio cxgb3 board.

Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 81b8709c
Loading
Loading
Loading
Loading
+14 −11
Original line number Original line Diff line number Diff line
@@ -1749,23 +1749,26 @@ static int restart_autoneg(struct net_device *dev)
	return 0;
	return 0;
}
}


static int cxgb3_phys_id(struct net_device *dev, u32 data)
static int set_phys_id(struct net_device *dev,
		       enum ethtool_phys_id_state state)
{
{
	struct port_info *pi = netdev_priv(dev);
	struct port_info *pi = netdev_priv(dev);
	struct adapter *adapter = pi->adapter;
	struct adapter *adapter = pi->adapter;
	int i;


	if (data == 0)
	switch (state) {
		data = 2;
	case ETHTOOL_ID_ACTIVE:
		return -EINVAL;


	for (i = 0; i < data * 2; i++) {
	case ETHTOOL_ID_OFF:
		t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL,
		t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, 0);
				 (i & 1) ? F_GPIO0_OUT_VAL : 0);
		if (msleep_interruptible(500))
		break;
		break;
	}

	case ETHTOOL_ID_ON:
	case ETHTOOL_ID_INACTIVE:
		t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL,
		t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL,
			 F_GPIO0_OUT_VAL);
			 F_GPIO0_OUT_VAL);
	}

	return 0;
	return 0;
}
}


@@ -2107,7 +2110,7 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
	.set_sg = ethtool_op_set_sg,
	.set_sg = ethtool_op_set_sg,
	.get_link = ethtool_op_get_link,
	.get_link = ethtool_op_get_link,
	.get_strings = get_strings,
	.get_strings = get_strings,
	.phys_id = cxgb3_phys_id,
	.set_phys_id = set_phys_id,
	.nway_reset = restart_autoneg,
	.nway_reset = restart_autoneg,
	.get_sset_count = get_sset_count,
	.get_sset_count = get_sset_count,
	.get_ethtool_stats = get_stats,
	.get_ethtool_stats = get_stats,