Commit ad08ac18 authored by Arun Ramadoss's avatar Arun Ramadoss Committed by David S. Miller

net: dsa: microchip: move start of switch to ksz_setup

This patch move the setting the start bit from the individual switch
configuration to ksz_setup
Signed-off-by: default avatarArun Ramadoss <arun.ramadoss@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0abab9f3
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#define SW_REVISION_M 0x0E #define SW_REVISION_M 0x0E
#define SW_REVISION_S 1 #define SW_REVISION_S 1
#define SW_START 0x01
#define KSZ8863_REG_SW_RESET 0x43 #define KSZ8863_REG_SW_RESET 0x43
......
...@@ -1287,9 +1287,6 @@ static int ksz9477_setup(struct dsa_switch *ds) ...@@ -1287,9 +1287,6 @@ static int ksz9477_setup(struct dsa_switch *ds)
/* enable global MIB counter freeze function */ /* enable global MIB counter freeze function */
ksz_cfg(dev, REG_SW_MAC_CTRL_6, SW_MIB_COUNTER_FREEZE, true); ksz_cfg(dev, REG_SW_MAC_CTRL_6, SW_MIB_COUNTER_FREEZE, true);
/* start switch */
ksz_cfg(dev, REG_SW_OPERATION, SW_START, true);
return 0; return 0;
} }
......
...@@ -165,7 +165,6 @@ ...@@ -165,7 +165,6 @@
#define SW_DOUBLE_TAG BIT(7) #define SW_DOUBLE_TAG BIT(7)
#define SW_RESET BIT(1) #define SW_RESET BIT(1)
#define SW_START BIT(0)
#define REG_SW_MAC_ADDR_0 0x0302 #define REG_SW_MAC_ADDR_0 0x0302
#define REG_SW_MAC_ADDR_1 0x0303 #define REG_SW_MAC_ADDR_1 0x0303
......
...@@ -155,6 +155,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -155,6 +155,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x02, .stp_ctrl_reg = 0x02,
.broadcast_ctrl_reg = 0x06, .broadcast_ctrl_reg = 0x06,
.multicast_ctrl_reg = 0x04, .multicast_ctrl_reg = 0x04,
.start_ctrl_reg = 0x01,
.supports_mii = {false, false, false, false, true}, .supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true}, .supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true}, .supports_rgmii = {false, false, false, false, true},
...@@ -190,6 +191,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -190,6 +191,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x02, .stp_ctrl_reg = 0x02,
.broadcast_ctrl_reg = 0x06, .broadcast_ctrl_reg = 0x06,
.multicast_ctrl_reg = 0x04, .multicast_ctrl_reg = 0x04,
.start_ctrl_reg = 0x01,
.supports_mii = {false, false, false, false, true}, .supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true}, .supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true}, .supports_rgmii = {false, false, false, false, true},
...@@ -211,6 +213,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -211,6 +213,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x02, .stp_ctrl_reg = 0x02,
.broadcast_ctrl_reg = 0x06, .broadcast_ctrl_reg = 0x06,
.multicast_ctrl_reg = 0x04, .multicast_ctrl_reg = 0x04,
.start_ctrl_reg = 0x01,
.supports_mii = {false, false, false, false, true}, .supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true}, .supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true}, .supports_rgmii = {false, false, false, false, true},
...@@ -231,6 +234,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -231,6 +234,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x02, .stp_ctrl_reg = 0x02,
.broadcast_ctrl_reg = 0x06, .broadcast_ctrl_reg = 0x06,
.multicast_ctrl_reg = 0x04, .multicast_ctrl_reg = 0x04,
.start_ctrl_reg = 0x01,
.supports_mii = {false, false, true}, .supports_mii = {false, false, true},
.supports_rmii = {false, false, true}, .supports_rmii = {false, false, true},
.internal_phy = {true, true, false}, .internal_phy = {true, true, false},
...@@ -251,6 +255,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -251,6 +255,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x0B04, .stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332, .broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331, .multicast_ctrl_reg = 0x0331,
.start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, .supports_mii = {false, false, false, false,
false, true, false}, false, true, false},
.supports_rmii = {false, false, false, false, .supports_rmii = {false, false, false, false,
...@@ -276,6 +281,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -276,6 +281,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x0B04, .stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332, .broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331, .multicast_ctrl_reg = 0x0331,
.start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, .supports_mii = {false, false, false, false,
false, true, true}, false, true, true},
.supports_rmii = {false, false, false, false, .supports_rmii = {false, false, false, false,
...@@ -300,6 +306,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -300,6 +306,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x0B04, .stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332, .broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331, .multicast_ctrl_reg = 0x0331,
.start_ctrl_reg = 0x0300,
.supports_mii = {false, false, true}, .supports_mii = {false, false, true},
.supports_rmii = {false, false, true}, .supports_rmii = {false, false, true},
.supports_rgmii = {false, false, true}, .supports_rgmii = {false, false, true},
...@@ -321,6 +328,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -321,6 +328,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x0B04, .stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332, .broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331, .multicast_ctrl_reg = 0x0331,
.start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, .supports_mii = {false, false, false, false,
false, true, true}, false, true, true},
.supports_rmii = {false, false, false, false, .supports_rmii = {false, false, false, false,
...@@ -345,6 +353,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -345,6 +353,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x0B04, .stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332, .broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331, .multicast_ctrl_reg = 0x0331,
.start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, true}, .supports_mii = {false, false, false, false, true},
.supports_rmii = {false, false, false, false, true}, .supports_rmii = {false, false, false, false, true},
.supports_rgmii = {false, false, false, false, true}, .supports_rgmii = {false, false, false, false, true},
...@@ -365,6 +374,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -365,6 +374,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x0B04, .stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332, .broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331, .multicast_ctrl_reg = 0x0331,
.start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, true, true}, .supports_mii = {false, false, false, false, true, true},
.supports_rmii = {false, false, false, false, true, true}, .supports_rmii = {false, false, false, false, true, true},
.supports_rgmii = {false, false, false, false, true, true}, .supports_rgmii = {false, false, false, false, true, true},
...@@ -385,6 +395,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -385,6 +395,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x0B04, .stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332, .broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331, .multicast_ctrl_reg = 0x0331,
.start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, .supports_mii = {false, false, false, false,
true, true, false, false}, true, true, false, false},
.supports_rmii = {false, false, false, false, .supports_rmii = {false, false, false, false,
...@@ -409,6 +420,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -409,6 +420,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x0B04, .stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332, .broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331, .multicast_ctrl_reg = 0x0331,
.start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, .supports_mii = {false, false, false, false,
true, true, false, false}, true, true, false, false},
.supports_rmii = {false, false, false, false, .supports_rmii = {false, false, false, false,
...@@ -433,6 +445,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { ...@@ -433,6 +445,7 @@ const struct ksz_chip_data ksz_switch_chips[] = {
.stp_ctrl_reg = 0x0B04, .stp_ctrl_reg = 0x0B04,
.broadcast_ctrl_reg = 0x0332, .broadcast_ctrl_reg = 0x0332,
.multicast_ctrl_reg = 0x0331, .multicast_ctrl_reg = 0x0331,
.start_ctrl_reg = 0x0300,
.supports_mii = {false, false, false, false, .supports_mii = {false, false, false, false,
true, true, false, false}, true, true, false, false},
.supports_rmii = {false, false, false, false, .supports_rmii = {false, false, false, false,
...@@ -672,6 +685,10 @@ int ksz_setup(struct dsa_switch *ds) ...@@ -672,6 +685,10 @@ int ksz_setup(struct dsa_switch *ds)
return ret; return ret;
} }
/* start switch */
regmap_update_bits(dev->regmap[0], dev->info->start_ctrl_reg,
SW_START, SW_START);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(ksz_setup); EXPORT_SYMBOL_GPL(ksz_setup);
......
...@@ -49,6 +49,7 @@ struct ksz_chip_data { ...@@ -49,6 +49,7 @@ struct ksz_chip_data {
int stp_ctrl_reg; int stp_ctrl_reg;
int broadcast_ctrl_reg; int broadcast_ctrl_reg;
int multicast_ctrl_reg; int multicast_ctrl_reg;
int start_ctrl_reg;
bool supports_mii[KSZ_MAX_NUM_PORTS]; bool supports_mii[KSZ_MAX_NUM_PORTS];
bool supports_rmii[KSZ_MAX_NUM_PORTS]; bool supports_rmii[KSZ_MAX_NUM_PORTS];
bool supports_rgmii[KSZ_MAX_NUM_PORTS]; bool supports_rgmii[KSZ_MAX_NUM_PORTS];
...@@ -429,6 +430,8 @@ static inline void ksz_regmap_unlock(void *__mtx) ...@@ -429,6 +430,8 @@ static inline void ksz_regmap_unlock(void *__mtx)
#define MULTICAST_STORM_DISABLE BIT(6) #define MULTICAST_STORM_DISABLE BIT(6)
#define SW_START 0x01
/* Regmap tables generation */ /* Regmap tables generation */
#define KSZ_SPI_OP_RD 3 #define KSZ_SPI_OP_RD 3
#define KSZ_SPI_OP_WR 2 #define KSZ_SPI_OP_WR 2
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment