struct ar8xxx_chip {
int (*hw_init)(struct ar8216_priv *priv);
struct ar8xxx_chip {
int (*hw_init)(struct ar8216_priv *priv);
+ void (*init_port)(struct ar8216_priv *priv, int port);
void (*setup_port)(struct ar8216_priv *priv, int port, u32 egress,
u32 ingress, u32 members, u32 pvid);
void (*setup_port)(struct ar8216_priv *priv, int port, u32 egress,
u32 ingress, u32 members, u32 pvid);
+ int (*atu_flush)(struct ar8216_priv *priv);
priv->write(priv, AR8216_REG_VTU, op);
}
priv->write(priv, AR8216_REG_VTU, op);
}
+static int
+ar8216_atu_flush(struct ar8216_priv *priv)
+{
+ int ret;
+
+ ret = ar8216_wait_bit(priv, AR8216_REG_ATU, AR8216_ATU_ACTIVE, 0);
+ if (!ret)
+ priv->write(priv, AR8216_REG_ATU, AR8216_ATU_OP_FLUSH);
+
+ return ret;
+}
+
static void
ar8216_setup_port(struct ar8216_priv *priv, int port, u32 egress, u32 ingress,
u32 members, u32 pvid)
static void
ar8216_setup_port(struct ar8216_priv *priv, int port, u32 egress, u32 ingress,
u32 members, u32 pvid)
static const struct ar8xxx_chip ar8216_chip = {
.hw_init = ar8216_hw_init,
static const struct ar8xxx_chip ar8216_chip = {
.hw_init = ar8216_hw_init,
+ .init_port = ar8216_init_port,
.setup_port = ar8216_setup_port,
.setup_port = ar8216_setup_port,
+ .atu_flush = ar8216_atu_flush,
};
static const struct ar8xxx_chip ar8236_chip = {
.hw_init = ar8236_hw_init,
};
static const struct ar8xxx_chip ar8236_chip = {
.hw_init = ar8236_hw_init,
+ .init_port = ar8216_init_port,
.setup_port = ar8236_setup_port,
.setup_port = ar8236_setup_port,
+ .atu_flush = ar8216_atu_flush,
};
static const struct ar8xxx_chip ar8316_chip = {
.hw_init = ar8316_hw_init,
};
static const struct ar8xxx_chip ar8316_chip = {
.hw_init = ar8316_hw_init,
+ .init_port = ar8216_init_port,
.setup_port = ar8216_setup_port,
.setup_port = ar8216_setup_port,
+ .atu_flush = ar8216_atu_flush,
/* Configure all ports */
for (i = 0; i < AR8216_NUM_PORTS; i++)
/* Configure all ports */
for (i = 0; i < AR8216_NUM_PORTS; i++)
- ar8216_init_port(priv, i);
+ priv->chip->init_port(priv, i);
ar8216_init_globals(priv);
mutex_unlock(&priv->reg_mutex);
ar8216_init_globals(priv);
mutex_unlock(&priv->reg_mutex);
/* flush the address translation unit */
mutex_lock(&priv->reg_mutex);
/* flush the address translation unit */
mutex_lock(&priv->reg_mutex);
- ret = ar8216_wait_bit(priv, AR8216_REG_ATU, AR8216_ATU_ACTIVE, 0);
- if (!ret)
- priv->write(priv, AR8216_REG_ATU, AR8216_ATU_OP_FLUSH);
+ ret = priv->chip->atu_flush(priv);
mutex_unlock(&priv->reg_mutex);
phydev->state = PHY_RUNNING;
mutex_unlock(&priv->reg_mutex);
phydev->state = PHY_RUNNING;