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
33092ecf
Commit
33092ecf
authored
Nov 17, 2018
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wrsw: more robust link detection for PHY calibration
parent
a903c4d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
hal_ports.c
userspace/wrsw_hal/hal_ports.c
+16
-16
No files found.
userspace/wrsw_hal/hal_ports.c
View file @
33092ecf
...
...
@@ -202,6 +202,7 @@ struct hal_port_tx_setup_state
struct
hal_port_rx_setup_state
{
timeout_t
link_timeout
;
int
state
;
int
attempts
;
};
...
...
@@ -494,6 +495,8 @@ static int rx_fsm_update(struct hal_port_state *p)
struct
hal_port_rx_setup_state
*
fsm
=
p
->
rx_setup_fsm
;
struct
hal_port_tx_setup_state
*
fsm_tx
=
p
->
tx_setup_fsm
;
int
early_link_up
=
pcs_readl
(
p
,
MDIO_DBG0
)
&
MDIO_DBG0_LINK_UP
;
if
(
fsm_tx
->
state
!=
TX_SETUP_DONE
)
{
fsm
->
state
=
RX_SETUP_STATE_INIT
;
...
...
@@ -506,11 +509,11 @@ static int rx_fsm_update(struct hal_port_state *p)
{
pcs_writel
(
p
,
MDIO_DBG1_TX_ENABLE
|
MDIO_DBG1_DMTD_SOURCE_RXRECCLK
,
MDIO_DBG1
);
if
(
pcs_readl
(
p
,
MDIO_DBG0
)
&
MDIO_DBG0_LINK_UP
)
if
(
early_link_up
)
{
if
(
fsm_tx
->
state
==
TX_SETUP_DONE
)
{
pr
intf
(
"Rx-cal: calibrating port %d.
\n
"
,
p
->
hw_index
+
1
);
pr
_debug
(
"Rx-cal: calibrating port %d.
\n
"
,
p
->
hw_index
+
1
);
fsm
->
state
=
RX_SETUP_STATE_RESET_PCS
;
rts_enable_ptracker
(
p
->
hw_index
,
0
);
...
...
@@ -524,23 +527,18 @@ static int rx_fsm_update(struct hal_port_state *p)
case
RX_SETUP_STATE_RESET_PCS
:
{
//printf("REset PCS\n");
if
(
pcs_readl
(
p
,
MDIO_DBG0
)
&
MDIO_DBG0_LINK_UP
)
if
(
early_link_up
)
{
fsm
->
state
=
RX_SETUP_STATE_WAIT_LOCK
;
libwr_tmo_init
(
&
fsm
->
link_timeout
,
100
,
1
);
pcs_writel
(
p
,
MDIO_DBG1_RESET_RX
|
MDIO_DBG1_TX_ENABLE
|
MDIO_DBG1_DMTD_SOURCE_RXRECCLK
,
MDIO_DBG1
);
shw_udelay
(
1
);
pcs_writel
(
p
,
MDIO_DBG1_TX_ENABLE
|
MDIO_DBG1_DMTD_SOURCE_RXRECCLK
,
MDIO_DBG1
);
fsm
->
attempts
++
;
shw_udelay
(
1000
);
//usleep(100000);
}
else
{
fsm
->
state
=
RX_SETUP_STATE_INIT
;
}
break
;
...
...
@@ -549,13 +547,16 @@ static int rx_fsm_update(struct hal_port_state *p)
case
RX_SETUP_STATE_WAIT_LOCK
:
{
uint16_t
dbg0
=
pcs_readl
(
p
,
MDIO_DBG0
);
// if( dbg0 & MDIO_DBG0_RESET_RX_DONE )
{
int
rx_up
=
dbg0
&
MDIO_DBG0_LINK_UP
;
int
rx_aligned
=
dbg0
&
MDIO_DBG0_LINK_ALIGNED
;
// printf("up %d aligned %d\n", rx_up ? 1: 0, rx_aligned ? 1: 0);
int
rx_up
=
dbg0
&
MDIO_DBG0_LINK_UP
;
int
rx_aligned
=
dbg0
&
MDIO_DBG0_LINK_ALIGNED
;
if
(
libwr_tmo_expired
(
&
fsm
->
link_timeout
)
&&
!
rx_up
)
{
fsm
->
state
=
RX_SETUP_STATE_INIT
;
}
else
{
if
(
!
rx_up
)
return
0
;
...
...
@@ -565,7 +566,6 @@ static int rx_fsm_update(struct hal_port_state *p)
rts_enable_ptracker
(
p
->
hw_index
,
0
);
rts_enable_ptracker
(
p
->
hw_index
,
1
);
tx_fsm_pll_state
.
channels
[
p
->
hw_index
].
flags
=
0
;
fsm
->
state
=
RX_SETUP_VALIDATE
;
}
else
...
...
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