[U-Boot] net, cpsw: disable gigabit support through plattform data

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;

On Tue, Jun 04, 2013 at 10:51:54AM +0200, Heiko Schocher wrote:
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
Why? Based on some of your later patches, you're working with a customer that was sampled very early in am335x, but has newer silicon now. This looks like the work-around for very early parts where indeed, gigabit had to be disabled. We removed this from mainline (or from what was submitted to mainline, I forget which now) intentionally. NAK, without some new information coming to light. Thanks!

Dear Heiko,
In message 1370335914-14027-1-git-send-email-hs@denx.de you wrote:
add possibility to disable gigabit support through plattform data. Current boards should not be affected through this patch.
...
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;
Is this reliable? I mean, how do we know it's a 100 Mbps connection (and not for example a 10 Mbs one) ?
Best regards,
Wolfgang Denk

Hello Wolfgang,
Am 04.06.2013 17:00, schrieb Wolfgang Denk:
Dear Heiko,
In message 1370335914-14027-1-git-send-email-hs@denx.de you wrote:
add possibility to disable gigabit support through plattform data. Current boards should not be affected through this patch.
...
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;
Is this reliable? I mean, how do we know it's a 100 Mbps connection (and not for example a 10 Mbs one) ?
Indeed. Anyway, I have to check, if this patch is necessary, as Tom noted ...
bye, Heiko

On 6/4/2013 8:45 PM, Heiko Schocher wrote:
Hello Wolfgang,
Am 04.06.2013 17:00, schrieb Wolfgang Denk:
Dear Heiko,
In message 1370335914-14027-1-git-send-email-hs@denx.de you wrote:
add possibility to disable gigabit support through plattform data. Current boards should not be affected through this patch.
...
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;
Is this reliable? I mean, how do we know it's a 100 Mbps connection (and not for example a 10 Mbs one) ?
Phy speed info will be read from phy status itself for configuring mac ctrl reg.
Indeed. Anyway, I have to check, if this patch is necessary, as Tom noted ...
bye, Heiko
As Tom mentioned this patch is applicable only for initial samples as there was a issue with Gig mode packet transfer. Now there is no issue with having Gig enabled by default.
Regards Mugunthan V N

Hello Mugunthan, Tom,
Am 04.06.2013 17:29, schrieb Mugunthan V N:
On 6/4/2013 8:45 PM, Heiko Schocher wrote:
Hello Wolfgang,
Am 04.06.2013 17:00, schrieb Wolfgang Denk:
Dear Heiko,
In message 1370335914-14027-1-git-send-email-hs@denx.de you wrote:
add possibility to disable gigabit support through plattform data. Current boards should not be affected through this patch.
...
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;
Is this reliable? I mean, how do we know it's a 100 Mbps connection (and not for example a 10 Mbs one) ?
Phy speed info will be read from phy status itself for configuring mac ctrl reg.
Indeed. Anyway, I have to check, if this patch is necessary, as Tom noted ...
bye, Heiko
As Tom mentioned this patch is applicable only for initial samples as there was a issue with Gig mode packet transfer. Now there is no issue with having Gig enabled by default.
Indeed, ethernet works fine without this patch :-)
Sorry for the noise. I delete this patch in patchwork.
Thanks!
bye, Heiko
participants (4)
-
Heiko Schocher
-
Mugunthan V N
-
Tom Rini
-
Wolfgang Denk