Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Ethernet/W5500/w5500.h
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ extern "C" {
#define PHYCFGR_OPMDC_ALLA (7<<3)
#define PHYCFGR_OPMDC_PDOWN (6<<3)
#define PHYCFGR_OPMDC_NA (5<<3)
#define PHYCFGR_OPMDC_100FA (4<<3)
#define PHYCFGR_OPMDC_100HA (4<<3)
#define PHYCFGR_OPMDC_100F (3<<3)
#define PHYCFGR_OPMDC_100H (2<<3)
#define PHYCFGR_OPMDC_10F (1<<3)
Expand Down
22 changes: 17 additions & 5 deletions Ethernet/wizchip_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,13 +749,26 @@ void wizphy_reset(void)

void wizphy_setphyconf(wiz_PhyConf* phyconf)
{
uint8_t tmp = 0;
uint8_t tmp = getPHYCFGR() & ~(PHYCFGR_RST);
if(phyconf->by == PHY_CONFBY_SW)
tmp |= PHYCFGR_OPMD;
else
tmp &= ~PHYCFGR_OPMD;
if(phyconf->mode == PHY_MODE_AUTONEGO)
tmp |= PHYCFGR_OPMDC_ALLA;
{
/* For the W5500, 100BT-HDX is the only valid speed+duplex config
* that can be paired with auto-negotiation */
if (phyconf->speed == PHY_SPEED_100 && phyconf->duplex == PHY_DUPLEX_HALF)
{
tmp |= PHYCFGR_OPMDC_100HA;
}
else
{
/* For all other combinations, ignore them as garbage
* and simply enable All Modes with auto-negotiation */
tmp |= PHYCFGR_OPMDC_ALLA;
}
}
else
{
if(phyconf->duplex == PHY_DUPLEX_FULL)
Expand Down Expand Up @@ -785,7 +798,7 @@ void wizphy_getphyconf(wiz_PhyConf* phyconf)
switch(tmp & PHYCFGR_OPMDC_ALLA)
{
case PHYCFGR_OPMDC_ALLA:
case PHYCFGR_OPMDC_100FA:
case PHYCFGR_OPMDC_100HA:
phyconf->mode = PHY_MODE_AUTONEGO;
break;
default:
Expand All @@ -794,7 +807,7 @@ void wizphy_getphyconf(wiz_PhyConf* phyconf)
}
switch(tmp & PHYCFGR_OPMDC_ALLA)
{
case PHYCFGR_OPMDC_100FA:
case PHYCFGR_OPMDC_100HA:
case PHYCFGR_OPMDC_100F:
case PHYCFGR_OPMDC_100H:
phyconf->speed = PHY_SPEED_100;
Expand All @@ -805,7 +818,6 @@ void wizphy_getphyconf(wiz_PhyConf* phyconf)
}
switch(tmp & PHYCFGR_OPMDC_ALLA)
{
case PHYCFGR_OPMDC_100FA:
case PHYCFGR_OPMDC_100F:
case PHYCFGR_OPMDC_10F:
phyconf->duplex = PHY_DUPLEX_FULL;
Expand Down