From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrice CHOTARD Date: Wed, 13 May 2020 08:31:44 +0000 Subject: [RESEND PATCH v2 03/11] net: dwc_eth_qos: Move interface() to eqos_ops structure In-Reply-To: <20200512095603.29126-4-david.wu@rock-chips.com> References: <20200512095603.29126-1-david.wu@rock-chips.com> <20200512095603.29126-4-david.wu@rock-chips.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 5/12/20 11:56 AM, David Wu wrote: > 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 > --- > > Changes in v2: > - None > > drivers/net/dwc_eth_qos.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c > index 92dab678c7..ae2167637f 100644 > --- a/drivers/net/dwc_eth_qos.c > +++ b/drivers/net/dwc_eth_qos.c > @@ -283,7 +283,6 @@ struct eqos_config { > int swr_wait; > int config_mac; > int config_mac_mdio; > - phy_interface_t (*interface)(struct udevice *dev); > struct eqos_ops *ops; > }; > > @@ -302,6 +301,7 @@ struct eqos_ops { > int (*eqos_disable_calibration)(struct udevice *dev); > int (*eqos_set_tx_clk_speed)(struct udevice *dev); > ulong (*eqos_get_tick_clk_rate)(struct udevice *dev); > + phy_interface_t (*eqos_get_interface)(struct udevice *dev); > }; > > struct eqos_priv { > @@ -1227,7 +1227,7 @@ static int eqos_start(struct udevice *dev) > addr = DWC_NET_PHYADDR; > #endif > eqos->phy = phy_connect(eqos->mii, addr, dev, > - eqos->config->interface(dev)); > + eqos->config->ops->eqos_get_interface(dev)); > if (!eqos->phy) { > pr_err("phy_connect() failed"); > goto err_stop_resets; > @@ -1827,7 +1827,7 @@ static int eqos_probe_resources_stm32(struct udevice *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) { > pr_err("Invalid PHY interface\n"); > @@ -1938,7 +1938,7 @@ static int eqos_probe_resources_imx(struct udevice *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) { > pr_err("Invalid PHY interface\n"); > @@ -2122,7 +2122,8 @@ static struct eqos_ops eqos_tegra186_ops = { > .eqos_calibrate_pads = eqos_calibrate_pads_tegra186, > .eqos_disable_calibration = eqos_disable_calibration_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 = { > @@ -2131,7 +2132,6 @@ static const struct eqos_config eqos_tegra186_config = { > .swr_wait = 10, > .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB, > .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_20_35, > - .interface = eqos_get_interface_tegra186, > .ops = &eqos_tegra186_ops > }; > > @@ -2149,7 +2149,8 @@ static struct eqos_ops eqos_stm32_ops = { > .eqos_calibrate_pads = eqos_calibrate_pads_stm32, > .eqos_disable_calibration = eqos_disable_calibration_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 = { > @@ -2158,7 +2159,6 @@ static const struct eqos_config eqos_stm32_config = { > .swr_wait = 50, > .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_AV, > .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300, > - .interface = eqos_get_interface_stm32, > .ops = &eqos_stm32_ops > }; > > @@ -2176,7 +2176,8 @@ static struct eqos_ops eqos_imx_ops = { > .eqos_calibrate_pads = eqos_calibrate_pads_imx, > .eqos_disable_calibration = eqos_disable_calibration_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 = { > @@ -2185,7 +2186,6 @@ struct eqos_config eqos_imx_config = { > .swr_wait = 50, > .config_mac = EQOS_MAC_RXQ_CTRL0_RXQ0EN_ENABLED_DCB, > .config_mac_mdio = EQOS_MAC_MDIO_ADDRESS_CR_250_300, > - .interface = eqos_get_interface_imx, > .ops = &eqos_imx_ops > }; > Reviewed-by: Patrice Chotard Thanks