Commit 3c32109b authored by Adam Wujek's avatar Adam Wujek 💬

userspace/libwr: change the definition of ports' left LEDs

For port configured as none, non-wr, auto use the same orange color.
Before none and auto were represented with the same color as master (yellow).
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 69751e15
......@@ -1291,11 +1291,12 @@ For more details please refer to following subsections.
The status LED is placed together with power indicator LED on the left side of
switch's front panel. The status LED is the right one.
During barebox/kernel boot the status LED is off. When startup-mb.sh starts
During barebox/kernel boot the status LED is off. When @t{startup-mb.sh} starts
the LED is set to yellow. If the HAL starts successfully then the LED is set to
green. If the HAL caught a SIGNAL sent by other process, HAL sets the status
LED to orange.
When reboot is performed status LED is turned off.
When the regular reboot is performed status LED is turned off. In case of
a kernel crash the LED remains unchanged.
@c =-------------------------------------------------------------------------
@node Ports' LEDs
......@@ -1304,8 +1305,8 @@ When reboot is performed status LED is turned off.
Under each switch's port there are two LEDs. The left LED is on when particular
port is populated with an SFP and the link is up. It's color is dependent on
the configured function. For ports configured as a slave the LED is green, for
non-wr ports the LED is orange. For ports configured as a master and other
cases (including wrong configuration) the left LED is yellow.
master ports the LED is yellow. For ports configured as an auto, none, non-wr
and other cases (including wrong configuration) the left LED is orange.
The right LED blinks when packet is transmitted or received on a port.
......
......@@ -503,13 +503,13 @@ void shw_sfp_gpio_init(void)
for (i = 0; i < 18; i++) {
shw_sfp_set_led_synced(i, 1);
shw_udelay(7000);
shw_sfp_set_generic(i, 1, SFP_LED_WRMODE_MASTER);
shw_sfp_set_generic(i, 1, SFP_LED_WRMODE1 | SFP_LED_WRMODE2);
shw_udelay(7000);
}
for (i = 0; i < 18; i++) {
shw_sfp_set_led_synced(i, 0);
shw_udelay(7000);
shw_sfp_set_generic(i, 0, SFP_LED_WRMODE_MASTER);
shw_sfp_set_generic(i, 0, SFP_LED_WRMODE1 | SFP_LED_WRMODE2);
shw_udelay(7000);
}
......
......@@ -3,7 +3,7 @@
/* note each led contains green and orange part */
#define SFP_LED_WRMODE_SLAVE (1) /* green */
#define SFP_LED_WRMODE_NON_WR (2) /* orange */
#define SFP_LED_WRMODE_OTHER (2) /* orange */
#define SFP_LED_WRMODE_MASTER (3) /* yellow */
#define SFP_LED_WRMODE_OFF (3) /* to off entire WRMODE LED */
#define SFP_LED_WRMODE1 (1 << 0)
......@@ -11,6 +11,18 @@
#define SFP_LED_SYNCED (1 << 2)
#define SFP_TX_DISABLE (1 << 3)
#define shw_sfp_set_led_wrmode_slave(num) \
shw_sfp_set_generic(num, 1, SFP_LED_WRMODE_SLAVE)
#define shw_sfp_set_led_wrmode_master(num) \
shw_sfp_set_generic(num, 1, SFP_LED_WRMODE_MASTER)
#define shw_sfp_set_led_wrmode_other(num) \
shw_sfp_set_generic(num, 1, SFP_LED_WRMODE_OTHER)
#define shw_sfp_set_led_wrmode_off(num) \
shw_sfp_set_generic(num, 0, SFP_LED_WRMODE_OFF)
#define shw_sfp_set_led_synced(num, status) \
shw_sfp_set_generic(num, status, SFP_LED_SYNCED)
......
......@@ -365,7 +365,7 @@ static int hal_port_link_down(struct hal_port_state * p, int link_up)
}
/* turn off link/wrmode LEDs */
shw_sfp_set_generic(p->hw_index, 0, SFP_LED_WRMODE_OFF);
shw_sfp_set_led_wrmode_off(p->hw_index);
p->state = HAL_PORT_STATE_LINK_DOWN;
hal_port_reset_state(p);
......@@ -419,15 +419,15 @@ static void hal_port_fsm(struct hal_port_state * p)
p->tx_cal_pending = 0;
p->rx_cal_pending = 0;
/* set link/wrmode LEDs */
if (p->mode == HEXP_PORT_MODE_WR_SLAVE) {/* slave */
shw_sfp_set_generic(p->hw_index, 1,
SFP_LED_WRMODE_SLAVE);
} else if (p->mode == HEXP_PORT_MODE_WR_MASTER) {/* master */
shw_sfp_set_generic(p->hw_index, 1,
SFP_LED_WRMODE_MASTER);
} else { /* non-wr or other */
shw_sfp_set_generic(p->hw_index, 1,
SFP_LED_WRMODE_NON_WR);
if (p->mode == HEXP_PORT_MODE_WR_SLAVE) {
/* slave */
shw_sfp_set_led_wrmode_slave(p->hw_index);
} else if (p->mode == HEXP_PORT_MODE_WR_MASTER) {
/* master */
shw_sfp_set_led_wrmode_master(p->hw_index);
} else {
/* auto, none, non-wr or other */
shw_sfp_set_led_wrmode_other(p->hw_index);
}
pr_info("%s: link up\n", p->name);
p->state = HAL_PORT_STATE_UP;
......
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