Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
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
Software for White Rabbit PTP Core
Commits
99a27709
Commit
99a27709
authored
Jun 23, 2020
by
Tomasz Wlostowski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dev/endpoint: make PHY reset function public
parent
a88ce3d3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
endpoint.c
dev/endpoint.c
+22
-15
endpoint.h
include/dev/endpoint.h
+1
-0
No files found.
dev/endpoint.c
View file @
99a27709
...
...
@@ -111,6 +111,27 @@ void ep_init()
EP
->
DMCR
=
EP_DMCR_EN
|
EP_DMCR_N_AVG_W
(
DMTD_AVG_SAMPLES
);
}
void
ep_reset_phy
(
void
)
{
uint32_t
mcr
;
/* Reset the GTP Transceiver - it's important to do the GTP phase alignment every time
we start up the software, otherwise the calibration RX/TX deltas may not be correct */
ep_pcs_write
(
MDIO_REG_MCR
,
MDIO_MCR_PDOWN
);
/* reset the PHY */
if
(
!
IS_WR_NODE_SIM
)
timer_delay_ms
(
200
);
ep_pcs_write
(
MDIO_REG_MCR
,
MDIO_MCR_RESET
);
/* reset the PHY */
ep_pcs_write
(
MDIO_REG_MCR
,
0
);
/* reset the PHY */
/* Don't advertise anything - we don't want flow control */
ep_pcs_write
(
MDIO_REG_ADVERTISE
,
0
);
mcr
=
MDIO_MCR_SPEED1000_MASK
|
MDIO_MCR_FULLDPLX_MASK
;
if
(
autoneg_enabled
)
mcr
|=
MDIO_MCR_ANENABLE
|
MDIO_MCR_ANRESTART
;
ep_pcs_write
(
MDIO_REG_MCR
,
mcr
);
}
/* Enables/disables transmission and reception. When autoneg is set to 1,
starts up 802.3 autonegotiation process */
int
ep_enable
(
int
enabled
,
int
autoneg
)
...
...
@@ -136,22 +157,8 @@ int ep_enable(int enabled, int autoneg)
autoneg_enabled
=
autoneg
;
/* Reset the GTP Transceiver - it's important to do the GTP phase alignment every time
we start up the software, otherwise the calibration RX/TX deltas may not be correct */
ep_pcs_write
(
MDIO_REG_MCR
,
MDIO_MCR_PDOWN
);
/* reset the PHY */
if
(
!
IS_WR_NODE_SIM
)
timer_delay_ms
(
200
);
ep_pcs_write
(
MDIO_REG_MCR
,
MDIO_MCR_RESET
);
/* reset the PHY */
ep_pcs_write
(
MDIO_REG_MCR
,
0
);
/* reset the PHY */
/* Don't advertise anything - we don't want flow control */
ep_pcs_write
(
MDIO_REG_ADVERTISE
,
0
);
mcr
=
MDIO_MCR_SPEED1000_MASK
|
MDIO_MCR_FULLDPLX_MASK
;
if
(
autoneg
)
mcr
|=
MDIO_MCR_ANENABLE
|
MDIO_MCR_ANRESTART
;
ep_reset_phy
();
ep_pcs_write
(
MDIO_REG_MCR
,
mcr
);
return
0
;
}
...
...
include/dev/endpoint.h
View file @
99a27709
...
...
@@ -35,6 +35,7 @@ int ep_sfp_enable(int ena);
uint16_t
ep_pcs_read
(
int
location
);
void
ep_pcs_write
(
int
location
,
int
value
);
void
ep_reset_phy
(
void
);
void
pfilter_init_default
(
void
);
...
...
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