net: dwc_eth_qos: Move interface() to eqos_ops structure

After moving to eqos_ops, if eqos_config is defined
outside file, can not export interface() definition,
only export eqos_ops struct defined in dwc_eth_qos.c.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Change-Id: Ibc60f49f36bb2011454370ed7fcc6d9db3b34d9f
This commit is contained in:
David Wu 2020-04-30 09:09:29 +08:00 committed by Joseph Chen
parent 13105a0ba7
commit bbbbc81c01
1 changed files with 10 additions and 10 deletions

View File

@ -282,7 +282,6 @@ struct eqos_config {
int swr_wait; int swr_wait;
int config_mac; int config_mac;
int config_mac_mdio; int config_mac_mdio;
phy_interface_t (*interface)(struct udevice *dev);
struct eqos_ops *ops; struct eqos_ops *ops;
}; };
@ -301,6 +300,7 @@ struct eqos_ops {
int (*eqos_disable_calibration)(struct udevice *dev); int (*eqos_disable_calibration)(struct udevice *dev);
int (*eqos_set_tx_clk_speed)(struct udevice *dev); int (*eqos_set_tx_clk_speed)(struct udevice *dev);
ulong (*eqos_get_tick_clk_rate)(struct udevice *dev); ulong (*eqos_get_tick_clk_rate)(struct udevice *dev);
phy_interface_t (*eqos_get_interface)(struct udevice *dev);
}; };
struct eqos_priv { struct eqos_priv {
@ -1226,7 +1226,7 @@ static int eqos_start(struct udevice *dev)
addr = DWC_NET_PHYADDR; addr = DWC_NET_PHYADDR;
#endif #endif
eqos->phy = phy_connect(eqos->mii, addr, dev, eqos->phy = phy_connect(eqos->mii, addr, dev,
eqos->config->interface(dev)); eqos->config->ops->eqos_get_interface(dev));
if (!eqos->phy) { if (!eqos->phy) {
pr_err("phy_connect() failed"); pr_err("phy_connect() failed");
goto err_stop_resets; goto err_stop_resets;
@ -1826,7 +1826,7 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
debug("%s(dev=%p):\n", __func__, dev); debug("%s(dev=%p):\n", __func__, dev);
interface = eqos->config->interface(dev); interface = eqos->config->ops->eqos_get_interface(dev);
if (interface == PHY_INTERFACE_MODE_NONE) { if (interface == PHY_INTERFACE_MODE_NONE) {
pr_err("Invalid PHY interface\n"); pr_err("Invalid PHY interface\n");
@ -1937,7 +1937,7 @@ static int eqos_probe_resources_imx(struct udevice *dev)
debug("%s(dev=%p):\n", __func__, dev); debug("%s(dev=%p):\n", __func__, dev);
interface = eqos->config->interface(dev); interface = eqos->config->ops->eqos_get_interface(dev);
if (interface == PHY_INTERFACE_MODE_NONE) { if (interface == PHY_INTERFACE_MODE_NONE) {
pr_err("Invalid PHY interface\n"); pr_err("Invalid PHY interface\n");
@ -2121,7 +2121,8 @@ static struct eqos_ops eqos_tegra186_ops = {
.eqos_calibrate_pads = eqos_calibrate_pads_tegra186, .eqos_calibrate_pads = eqos_calibrate_pads_tegra186,
.eqos_disable_calibration = eqos_disable_calibration_tegra186, .eqos_disable_calibration = eqos_disable_calibration_tegra186,
.eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_tegra186, .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_tegra186,
.eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_tegra186 .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_tegra186,
.eqos_get_interface = eqos_get_interface_tegra186
}; };
static const struct eqos_config eqos_tegra186_config = { static const struct eqos_config eqos_tegra186_config = {
@ -2130,7 +2131,6 @@ static const struct eqos_config eqos_tegra186_config = {
.swr_wait = 10, .swr_wait = 10,
.config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB, .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB,
.config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_20_35, .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_20_35,
.interface = eqos_get_interface_tegra186,
.ops = &eqos_tegra186_ops .ops = &eqos_tegra186_ops
}; };
@ -2148,7 +2148,8 @@ static struct eqos_ops eqos_stm32_ops = {
.eqos_calibrate_pads = eqos_calibrate_pads_stm32, .eqos_calibrate_pads = eqos_calibrate_pads_stm32,
.eqos_disable_calibration = eqos_disable_calibration_stm32, .eqos_disable_calibration = eqos_disable_calibration_stm32,
.eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_stm32, .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_stm32,
.eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_stm32 .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_stm32,
.eqos_get_interface = eqos_get_interface_stm32
}; };
static const struct eqos_config eqos_stm32_config = { static const struct eqos_config eqos_stm32_config = {
@ -2157,7 +2158,6 @@ static const struct eqos_config eqos_stm32_config = {
.swr_wait = 50, .swr_wait = 50,
.config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_AV, .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_AV,
.config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300, .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300,
.interface = eqos_get_interface_stm32,
.ops = &eqos_stm32_ops .ops = &eqos_stm32_ops
}; };
@ -2175,7 +2175,8 @@ static struct eqos_ops eqos_imx_ops = {
.eqos_calibrate_pads = eqos_calibrate_pads_imx, .eqos_calibrate_pads = eqos_calibrate_pads_imx,
.eqos_disable_calibration = eqos_disable_calibration_imx, .eqos_disable_calibration = eqos_disable_calibration_imx,
.eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_imx, .eqos_set_tx_clk_speed = eqos_set_tx_clk_speed_imx,
.eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx .eqos_get_tick_clk_rate = eqos_get_tick_clk_rate_imx,
.eqos_get_interface = eqos_get_interface_imx
}; };
struct eqos_config eqos_imx_config = { struct eqos_config eqos_imx_config = {
@ -2184,7 +2185,6 @@ struct eqos_config eqos_imx_config = {
.swr_wait = 50, .swr_wait = 50,
.config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB, .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB,
.config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300, .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300,
.interface = eqos_get_interface_imx,
.ops = &eqos_imx_ops .ops = &eqos_imx_ops
}; };