usleep_range(10, 20);
}
+void fe_reset_fe(struct fe_priv *priv)
+{
+ if (!priv->rst_fe)
+ return;
+
+ reset_control_assert(priv->rst_fe);
+ usleep_range(60, 120);
+ reset_control_deassert(priv->rst_fe);
+ usleep_range(60, 120);
+}
+
static inline void fe_int_disable(u32 mask)
{
fe_reg_w32(fe_reg_r32(FE_REG_FE_INT_ENABLE) & ~mask,
return rx_done;
}
-static void fe_tx_timeout(struct net_device *dev)
+static void fe_tx_timeout(struct net_device *dev, unsigned int txqueue)
{
struct fe_priv *priv = netdev_priv(dev);
struct fe_tx_ring *ring = &priv->tx_ring;
{
struct fe_priv *priv = netdev_priv(dev);
struct device_node *port;
- const char *mac_addr;
int err;
- priv->soc->reset_fe();
+ if (priv->soc->reset_fe)
+ priv->soc->reset_fe(priv);
+ else
+ fe_reset_fe(priv);
+
+ if (priv->soc->switch_init) {
+ err = priv->soc->switch_init(priv);
+ if (err) {
+ if (err == -EPROBE_DEFER)
+ return err;
- if (priv->soc->switch_init)
- if (priv->soc->switch_init(priv)) {
netdev_err(dev, "failed to initialize switch core\n");
return -ENODEV;
}
+ }
fe_reset_phy(priv);
- mac_addr = of_get_mac_address(priv->dev->of_node);
- if (!IS_ERR_OR_NULL(mac_addr))
- ether_addr_copy(dev->dev_addr, mac_addr);
+ of_get_mac_address(priv->dev->of_node, dev->dev_addr);
/* If the mac address is invalid, use random mac address */
if (!is_valid_ether_addr(dev->dev_addr)) {
struct clk *sysclk;
int err, napi_weight;
- device_reset(&pdev->dev);
+ err = device_reset(&pdev->dev);
+ if (err)
+ dev_err(&pdev->dev, "failed to reset device\n");
match = of_match_device(of_fe_match, &pdev->dev);
soc = (struct fe_soc_data *)match->data;
goto err_free_dev;
}
+ priv = netdev_priv(netdev);
+ spin_lock_init(&priv->page_lock);
+ priv->rst_fe = devm_reset_control_get(&pdev->dev, "fe");
+ if (IS_ERR(priv->rst_fe))
+ priv->rst_fe = NULL;
+
if (soc->init_data)
soc->init_data(soc, netdev);
netdev->vlan_features = netdev->hw_features &
if (fe_reg_table[FE_REG_FE_DMA_VID_BASE])
netdev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
- priv = netdev_priv(netdev);
- spin_lock_init(&priv->page_lock);
if (fe_reg_table[FE_REG_FE_COUNTER_BASE]) {
priv->hw_stats = kzalloc(sizeof(*priv->hw_stats), GFP_KERNEL);
if (!priv->hw_stats) {