-
Notifications
You must be signed in to change notification settings - Fork 3k
e6000sw: Add support for MV88E6190X switch variant #1408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -217,6 +217,7 @@ e6000sw_probe(device_t dev) | |
phandle_t switch_node; | ||
#else | ||
int is_6190; | ||
int is_6190x; | ||
#endif | ||
|
||
sc = device_get_softc(dev); | ||
|
@@ -251,6 +252,10 @@ e6000sw_probe(device_t dev) | |
if (resource_int_value(device_get_name(sc->dev), | ||
device_get_unit(sc->dev), "addr", &sc->sw_addr) != 0) | ||
return (ENXIO); | ||
|
||
resource_int_value(device_get_name(sc->dev), | ||
device_get_unit(sc->dev), "is6190x", &is_6190x); | ||
|
||
if (resource_int_value(device_get_name(sc->dev), | ||
device_get_unit(sc->dev), "is6190", &is_6190) != 0) | ||
/* | ||
|
@@ -259,8 +264,16 @@ e6000sw_probe(device_t dev) | |
*/ | ||
resource_int_value(device_get_name(sc->dev), | ||
device_get_unit(sc->dev), "is8190", &is_6190); | ||
|
||
if (is_6190 !=0 && is_6190x != 0) | ||
if (bootverbose) | ||
device_printf(dev, "Cannot configure conflicting variants\n"); | ||
return (ENXIO); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given the lack of curly braces amounts to an unconditional There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The committed change has braces though |
||
|
||
if (is_6190 != 0) | ||
sc->swid = MV88E6190; | ||
else if (is_6190x != 0) | ||
sc->swid = MV88E6190X; | ||
#endif | ||
if (sc->sw_addr < 0 || sc->sw_addr > 32) | ||
return (ENXIO); | ||
|
@@ -302,6 +315,10 @@ e6000sw_probe(device_t dev) | |
description = "Marvell 88E6190"; | ||
sc->num_ports = 11; | ||
break; | ||
case MV88E6190X: | ||
description = "Marvell 88E6190X"; | ||
sc->num_ports = 11; | ||
break; | ||
default: | ||
device_printf(dev, "Unrecognized device, id 0x%x.\n", sc->swid); | ||
return (ENXIO); | ||
|
@@ -332,7 +349,7 @@ e6000sw_parse_fixed_link(e6000sw_softc_t *sc, phandle_t node, uint32_t port) | |
return (ENXIO); | ||
} | ||
if (speed == 2500 && (MVSWITCH(sc, MV88E6141) || | ||
MVSWITCH(sc, MV88E6341) || MVSWITCH(sc, MV88E6190))) | ||
MVSWITCH(sc, MV88E6341) || MVSWITCH(sc, MV88E6190) || MVSWITCH(sc, MV88E6190X))) | ||
sc->fixed25_mask |= (1 << port); | ||
} | ||
|
||
|
@@ -596,22 +613,26 @@ e6000sw_attach(device_t dev) | |
reg |= PSC_CONTROL_SPD2500; | ||
else | ||
reg |= PSC_CONTROL_SPD1000; | ||
if (MVSWITCH(sc, MV88E6190) && | ||
if (MVSWITCH(sc, MV88E6190) || | ||
MVSWITCH(sc, MV88E6190X)) && | ||
e6000sw_is_fixed25port(sc, port)) | ||
reg |= PSC_CONTROL_ALT_SPD; | ||
reg |= PSC_CONTROL_FORCED_DPX | PSC_CONTROL_FULLDPX | | ||
PSC_CONTROL_FORCED_LINK | PSC_CONTROL_LINK_UP | | ||
PSC_CONTROL_FORCED_SPD; | ||
if (!MVSWITCH(sc, MV88E6190)) | ||
if (!MVSWITCH(sc, MV88E6190) && | ||
!MVSWITCH(sc, MV88E6190X)) | ||
reg |= PSC_CONTROL_FORCED_FC | PSC_CONTROL_FC_ON; | ||
if (MVSWITCH(sc, MV88E6141) || | ||
MVSWITCH(sc, MV88E6341) || | ||
MVSWITCH(sc, MV88E6190)) | ||
MVSWITCH(sc, MV88E6190) || | ||
MVSWITCH(sc, MV88E6190X)) | ||
reg |= PSC_CONTROL_FORCED_EEE; | ||
e6000sw_writereg(sc, REG_PORT(sc, port), PSC_CONTROL, | ||
reg); | ||
/* Power on the SERDES interfaces. */ | ||
if (MVSWITCH(sc, MV88E6190) && | ||
if (MVSWITCH(sc, MV88E6190) || | ||
MVSWITCH(sc, MV88E6190X)) && | ||
(port == 9 || port == 10)) { | ||
if (e6000sw_is_fixed25port(sc, port)) | ||
sgmii = false; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, for is_6190 the code assumes one of the two properties is present (otherwise this is left uninitialised). That's a bit dodgy, but for is_6190x you definitely can't assume that otherwise you will break existing hints that predate the existence of is_6190x.