Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
bac5bbd9
Commit
bac5bbd9
authored
Dec 09, 2019
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
looks like we have a fix
parent
9a32a2ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
10 deletions
+41
-10
hal_port_fsm.c
userspace/wrsw_hal/hal_port_fsm.c
+3
-0
hal_port_fsm_rx.c
userspace/wrsw_hal/hal_port_fsm_rx.c
+37
-9
hal_ports.c
userspace/wrsw_hal/hal_ports.c
+1
-1
No files found.
userspace/wrsw_hal/hal_port_fsm.c
View file @
bac5bbd9
...
...
@@ -250,6 +250,9 @@ static int port_fsm_state_link_up(fsm_t *fsm, int eventMsk, int isNewState) {
if
(
!
_isHalEventPortEarlyLinkUp
(
eventMsk
))
{
fsm_fire_state
(
fsm
,
HAL_PORT_STATE_LINK_DOWN
);
}
if
(
!
_isHalEventPortRxAligned
(
eventMsk
))
{
fsm_fire_state
(
fsm
,
HAL_PORT_STATE_LINK_DOWN
);
}
}
if
(
!
_isHalEventSfpPresent
(
eventMsk
)
)
{
...
...
userspace/wrsw_hal/hal_port_fsm_rx.c
View file @
bac5bbd9
...
...
@@ -208,6 +208,10 @@ static int _hal_port_rx_setup_state_start(fsm_t *fsm, int eventMsk, int isNewSta
MDIO_LPC_CTRL_DMTD_SOURCE_RXRECCLK
|
MDIO_LPC_CTRL_RESET_RX
,
MDIO_LPC_CTRL
);
shw_udelay
(
1000
);
pcs_writel
(
ps
,
MDIO_LPC_CTRL_TX_ENABLE
|
MDIO_LPC_CTRL_DMTD_SOURCE_RXRECCLK
,
MDIO_LPC_CTRL
);
libwr_tmo_restart
(
&
rxSetup
->
watchdog_timeout
);
}
}
...
...
@@ -391,13 +395,14 @@ static int _hal_port_rx_setup_state_done(fsm_t *fsm, int eventMsk, int isNewStat
int
early_up
=
_isHalRxSetupEventEarlyLinkUp
(
eventMsk
);
int
link_up
=
_isHalRxSetupEventLinkUp
(
eventMsk
);
int
link_aligned
=
_isHalRxSetupEventRxAligned
(
eventMsk
);
/* earlyLinkUp detection only if LPDC support */
if
(
ps
->
lpdc
.
isSupported
)
{
if
(
isNewState
)
{
libwr_tmo_restart
(
&
ps
->
lpdc
.
rxSetup
->
align_to_link_timeout
);
}
if
(
!
early_up
)
{
if
(
!
early_up
)
{
// Port went done
my_log
(
"rxcal: early link flag lost on port wri%d
\n
"
,
ps
->
hw_index
+
1
);
...
...
@@ -405,21 +410,44 @@ static int _hal_port_rx_setup_state_done(fsm_t *fsm, int eventMsk, int isNewStat
fsm_fire_state
(
fsm
,
HAL_PORT_RX_SETUP_STATE_INIT
);
return
0
;
}
if
(
!
link_aligned
)
{
// Port went done
my_log
(
"rxcal: aligned flag lost on port wri%d
\n
"
,
ps
->
hw_index
+
1
);
fsm_fire_state
(
fsm
,
HAL_PORT_RX_SETUP_STATE_INIT
);
return
0
;
}
if
(
libwr_tmo_expired
(
&
ps
->
lpdc
.
rxSetup
->
align_to_link_timeout
)
&&
!
link_up
)
{
uint32_t
stat
;
uint32_t
stat
,
msr
;
pcs_readl
(
ps
,
MDIO_LPC_STAT
,
&
stat
);
pcs_readl
(
ps
,
MII_BMSR
,
&
msr
);
// we are aligned but no Autoneg link up? restart the autonegotiation...
my_log
(
"rxcal: link is fucked up. Retrying calibration on port %d
\n
"
,
ps
->
hw_index
+
1
);
printf
(
"[port fup %d] LPC_STAT 0x%04x
\n
"
,
ps
->
hw_index
+
1
,
stat
);
dump_rx_pattern
(
ps
);
pcs_writel
(
ps
,
BMCR_ANENABLE
|
BMCR_ANRESTART
,
MII_BMCR
);
dump_rx_pattern
(
ps
);
libwr_tmo_restart
(
&
ps
->
lpdc
.
rxSetup
->
align_to_link_timeout
);
if
(
!
(
stat
&
MDIO_LPC_STAT_LINK_ALIGNED
))
{
my_log
(
"rxcal: link is fucked up and UNALIGNED. Retrying calibration on port %d
\n
"
,
ps
->
hw_index
+
1
);
fsm_fire_state
(
fsm
,
HAL_PORT_RX_SETUP_STATE_INIT
);
}
else
{
my_log
(
"rxcal: link is fucked up (AUTONEG), retrying it on port %d
\n
"
,
ps
->
hw_index
+
1
);
printf
(
"[port fup %d] LPC_STAT 0x%04x MSR 0x%04x
\n
"
,
ps
->
hw_index
+
1
,
stat
,
msr
);
dump_rx_pattern
(
ps
);
//pcs_writel(ps, BMCR_PDOWN, MII_BMCR);
shw_udelay
(
1000000
);
my_log
(
"Bring port back up...
\n
"
);
dump_rx_pattern
(
ps
);
pcs_writel
(
ps
,
BMCR_ANENABLE
|
BMCR_ANRESTART
,
MII_BMCR
);
dump_rx_pattern
(
ps
);
libwr_tmo_restart
(
&
ps
->
lpdc
.
rxSetup
->
align_to_link_timeout
);
}
return
0
;
}
...
...
userspace/wrsw_hal/hal_ports.c
View file @
bac5bbd9
...
...
@@ -39,7 +39,7 @@
extern
struct
hal_shmem_header
*
hal_shmem
;
extern
struct
wrs_shm_head
*
hal_shmem_hdr
;
#define FSM_DEBUG
0
#define FSM_DEBUG
1
hal_ports_t
halPorts
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment