__raw_writel(t | val, esw->base + reg);
}
-static void esw_reset(struct rt305x_esw *esw)
-{
- if (!esw->rst_esw)
- return;
-
- reset_control_assert(esw->rst_esw);
- usleep_range(60, 120);
- reset_control_deassert(esw->rst_esw);
- /* the esw takes long to reset otherwise the board hang */
- msleep(10);
-}
-
static void esw_reset_ephy(struct rt305x_esw *esw)
{
if (!esw->rst_ephy)
static int esw_apply_config(struct switch_dev *dev);
-static void esw_hw_init(struct rt305x_esw *esw)
+void rt3050_esw_hw_init(struct rt305x_esw *esw)
{
int i;
u8 port_disable = 0;
u8 port_map = RT305X_ESW_PMAP_LLLLLL;
- esw_reset(esw);
-
/* vodoo from original driver */
esw_w32(esw, 0xC8A07850, RT305X_ESW_REG_FCT0);
esw_w32(esw, 0x00000000, RT305X_ESW_REG_SGC2);
esw->global_vlan_enable = 0;
memset(esw->ports, 0, sizeof(esw->ports));
memset(esw->vlans, 0, sizeof(esw->vlans));
- esw_hw_init(esw);
+ rt3050_esw_hw_init(esw);
return 0;
}
priv->soc->swpriv = esw;
esw->priv = priv;
- esw_hw_init(esw);
+ rt3050_esw_hw_init(esw);
rgmii = of_get_property(np, "ralink,rgmii", NULL);
if (rgmii && be32_to_cpu(*rgmii) == 1) {
#include "esw_rt3050.h"
#include "mdio_rt2880.h"
+#define RT305X_RESET_FE BIT(21)
+#define RT305X_RESET_ESW BIT(23)
+
static const u16 rt5350_reg_table[FE_REG_COUNT] = {
[FE_REG_PDMA_GLO_CFG] = RT5350_PDMA_GLO_CFG,
[FE_REG_PDMA_RST_CFG] = RT5350_PDMA_RST_CFG,
txd->txd4 = 0;
}
+/* rt5350 require a combined reset as long the DMA engines crashs.
+ * it might be possible to stop the DMA engine to prevent it.
+ */
+static void rt305x_fe_reset(struct fe_priv *priv)
+{
+ fe_reset(RT305X_RESET_FE | RT305X_RESET_ESW);
+
+ /* check if switch is alive */
+ if (priv->soc->swpriv)
+ rt3050_esw_hw_init(priv->soc->swpriv);
+}
+
static struct fe_soc_data rt3050_data = {
.init_data = rt305x_init_data,
+ .reset_fe = rt305x_fe_reset,
.fwd_config = rt3050_fwd_config,
.switch_init = rt3050_esw_init,
.pdma_glo_cfg = FE_PDMA_SIZE_8DWORDS,
static struct fe_soc_data rt5350_data = {
.init_data = rt5350_init_data,
+ .reset_fe = rt305x_fe_reset,
.reg_table = rt5350_reg_table,
.set_mac = rt5350_set_mac,
.fwd_config = rt5350_fwd_config,