
add possibility to disable gigabit support through plattform data. Current boards should not be affected through this patch.
Signed-off-by: Heiko Schocher hs@denx.de Cc: Cyril Chemparathy cyril@ti.com Cc: Chandan Nath chandan.nath@ti.com Cc: Satyanarayana, Sandhya sandhya.satyanarayana@ti.com Cc: Ilya Yanok ilya.yanok@cogentembedded.com Cc: Yegor Yefremov yegorslists@googlemail.com Cc: Mugunthan V N mugunthanvnm@ti.com Cc: Tom Rini trini@ti.com Cc: Joe Hershberger joe.hershberger@gmail.com --- board/phytec/pcm051/board.c | 1 + board/ti/am335x/board.c | 1 + drivers/net/cpsw.c | 14 ++++++++++++-- include/cpsw.h | 1 + 4 Dateien geändert, 15 Zeilen hinzugefügt(+), 2 Zeilen entfernt(-)
diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c index 43d7b6e..9ea50e1 100644 --- a/board/phytec/pcm051/board.c +++ b/board/phytec/pcm051/board.c @@ -213,6 +213,7 @@ static struct cpsw_platform_data cpsw_data = { .hw_stats_reg_ofs = 0x900, .mac_control = (1 << 5), .control = cpsw_control, + .gigabit_en = 1, .host_port_num = 0, .version = CPSW_CTRL_VERSION_2, }; diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index b371376..e52b009 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -464,6 +464,7 @@ static struct cpsw_platform_data cpsw_data = { .hw_stats_reg_ofs = 0x900, .mac_control = (1 << 5), .control = cpsw_control, + .gigabit_en = 1, .host_port_num = 0, .version = CPSW_CTRL_VERSION_2, }; diff --git a/drivers/net/cpsw.c b/drivers/net/cpsw.c index 379b679..10b8aeb 100644 --- a/drivers/net/cpsw.c +++ b/drivers/net/cpsw.c @@ -578,8 +578,15 @@ static void cpsw_slave_update_link(struct cpsw_slave *slave,
if (*link) { /* link up */ mac_control = priv->data.mac_control; - if (phy->speed == 1000) - mac_control |= GIGABITEN; + if (phy->speed == 1000) { + if (priv->data.gigabit_en) { + mac_control |= GIGABITEN; + } else { + /* Disable gigabit as it's non-functional */ + mac_control &= ~GIGABITEN; + phy->speed = 100; + } + } if (phy->duplex == DUPLEX_FULL) mac_control |= FULLDUPLEXEN; if (phy->speed == 100) @@ -943,6 +950,9 @@ static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave) SUPPORTED_100baseT_Full | SUPPORTED_1000baseT_Full);
+ if (!priv->data.gigabit_en) + supported &= ~SUPPORTED_1000baseT_Full; + phydev = phy_connect(priv->bus, CONFIG_PHY_ADDR, dev, diff --git a/include/cpsw.h b/include/cpsw.h index 296b0e5..fa217f4 100644 --- a/include/cpsw.h +++ b/include/cpsw.h @@ -41,6 +41,7 @@ struct cpsw_platform_data { u32 hw_stats_reg_ofs; /* cpsw hw stats counters */ u32 mac_control; struct cpsw_slave_data *slave_data; + u32 gigabit_en; /* gigabit capable AND enabled */ void (*control)(int enabled); u32 host_port_num; u8 version;