|
@@ -233,6 +233,12 @@ static inline void c_can_pm_runtime_put_sync(const struct c_can_priv *priv)
|
|
pm_runtime_put_sync(priv->device);
|
|
pm_runtime_put_sync(priv->device);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static inline void c_can_reset_ram(const struct c_can_priv *priv, bool enable)
|
|
|
|
+{
|
|
|
|
+ if (priv->raminit)
|
|
|
|
+ priv->raminit(priv, enable);
|
|
|
|
+}
|
|
|
|
+
|
|
static inline int get_tx_next_msg_obj(const struct c_can_priv *priv)
|
|
static inline int get_tx_next_msg_obj(const struct c_can_priv *priv)
|
|
{
|
|
{
|
|
return (priv->tx_next & C_CAN_NEXT_MSG_OBJ_MASK) +
|
|
return (priv->tx_next & C_CAN_NEXT_MSG_OBJ_MASK) +
|
|
@@ -1090,6 +1096,7 @@ static int c_can_open(struct net_device *dev)
|
|
struct c_can_priv *priv = netdev_priv(dev);
|
|
struct c_can_priv *priv = netdev_priv(dev);
|
|
|
|
|
|
c_can_pm_runtime_get_sync(priv);
|
|
c_can_pm_runtime_get_sync(priv);
|
|
|
|
+ c_can_reset_ram(priv, true);
|
|
|
|
|
|
/* open the can device */
|
|
/* open the can device */
|
|
err = open_candev(dev);
|
|
err = open_candev(dev);
|
|
@@ -1118,6 +1125,7 @@ static int c_can_open(struct net_device *dev)
|
|
exit_irq_fail:
|
|
exit_irq_fail:
|
|
close_candev(dev);
|
|
close_candev(dev);
|
|
exit_open_fail:
|
|
exit_open_fail:
|
|
|
|
+ c_can_reset_ram(priv, false);
|
|
c_can_pm_runtime_put_sync(priv);
|
|
c_can_pm_runtime_put_sync(priv);
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
@@ -1131,6 +1139,8 @@ static int c_can_close(struct net_device *dev)
|
|
c_can_stop(dev);
|
|
c_can_stop(dev);
|
|
free_irq(dev->irq, dev);
|
|
free_irq(dev->irq, dev);
|
|
close_candev(dev);
|
|
close_candev(dev);
|
|
|
|
+
|
|
|
|
+ c_can_reset_ram(priv, false);
|
|
c_can_pm_runtime_put_sync(priv);
|
|
c_can_pm_runtime_put_sync(priv);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -1188,6 +1198,7 @@ int c_can_power_down(struct net_device *dev)
|
|
|
|
|
|
c_can_stop(dev);
|
|
c_can_stop(dev);
|
|
|
|
|
|
|
|
+ c_can_reset_ram(priv, false);
|
|
c_can_pm_runtime_put_sync(priv);
|
|
c_can_pm_runtime_put_sync(priv);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -1206,6 +1217,7 @@ int c_can_power_up(struct net_device *dev)
|
|
WARN_ON(priv->type != BOSCH_D_CAN);
|
|
WARN_ON(priv->type != BOSCH_D_CAN);
|
|
|
|
|
|
c_can_pm_runtime_get_sync(priv);
|
|
c_can_pm_runtime_get_sync(priv);
|
|
|
|
+ c_can_reset_ram(priv, true);
|
|
|
|
|
|
/* Clear PDR and INIT bits */
|
|
/* Clear PDR and INIT bits */
|
|
val = priv->read_reg(priv, C_CAN_CTRL_EX_REG);
|
|
val = priv->read_reg(priv, C_CAN_CTRL_EX_REG);
|