Skip to content

Commit

Permalink
stmmac: add delay for JL2XX1 Gigabit Ethernet PHY
Browse files Browse the repository at this point in the history
This adds optional 1.5s delay to stmmac driver which can be
enabled through Kconfig CONFIG_STMMAC_JL2XX1=y which will be
applied only when the ethernet PHY ID matches JL2XX1 or JL2101

Co-authored-by: Portisch <hugo.portisch@yahoo.de>
  • Loading branch information
7Ji and Portisch committed Oct 5, 2022
1 parent 992cbe6 commit 09edb86
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ config STMMAC_PLATFORM

if STMMAC_PLATFORM

config STMMAC_JL2XX1
bool "Allow STMMAC delay for JL2XX1/JL2101 Gigabit Ethernet PHY"
default n
depends on STMMAC_PLATFORM
---help---
This allows the STMMAC driver to be delayed for 1.5 seconds
if the PHY JL2XX1/JL2101 is found so they can be properly
initialized. This is only applied to the specific PHY IDs
so other PHY won't be affected.

config DWMAC_GENERIC
tristate "Generic driver for DWMAC"
default STMMAC_PLATFORM
Expand Down
11 changes: 11 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ static void stmmac_exit_fs(struct net_device *dev);
#define TX_MONITOR
#endif

/* PHY ID for JL2XX1 and JL2101, these are used for special initialization modifications for them */
#ifdef CONFIG_STMMAC_JL2XX1
#define JL2XX1_PHY_ID 0x937c4030
#define JL2101_PHY_ID 0x937c4032
#endif

#ifdef TX_MONITOR
static struct workqueue_struct *moniter_tx_wq;
static struct delayed_work moniter_tx_worker;
Expand Down Expand Up @@ -1658,6 +1664,11 @@ static int stmmac_init_dma_engine(struct stmmac_priv *priv)
if (priv->extend_desc && (priv->mode == STMMAC_RING_MODE))
atds = 1;

#ifdef CONFIG_STMMAC_JL2XX1
if (priv->phydev->phy_id == JL2XX1_PHY_ID || priv->phydev->phy_id == JL2101_PHY_ID)
msleep(1500);
#endif

ret = priv->hw->dma->reset(priv->ioaddr);
if (ret) {
dev_err(priv->device, "Failed to reset the dma\n");
Expand Down

0 comments on commit 09edb86

Please sign in to comment.