Skip to content

Commit

Permalink
Release v1.4.24
Browse files Browse the repository at this point in the history
  • Loading branch information
ec-support committed Feb 9, 2023
1 parent 02145a1 commit 53f776c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 23 deletions.
56 changes: 36 additions & 20 deletions atemsys.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ typedef struct _ATEMSYS_T_DRV_DESC_PRIVATE
phy_interface_t PhyInterface;
struct device_node* pPhyNode;
struct device_node* pMdioNode;
struct device_node* pMdioDevNode; /* node for own mdio bus */
struct phy_device* pPhyDev;
struct regulator* pPhyRegulator;
struct task_struct* etx_thread_StartPhy;
Expand Down Expand Up @@ -3019,7 +3020,6 @@ static int MdioInit(struct platform_device* pPDev)
{
struct net_device* pNDev = platform_get_drvdata(pPDev);
ATEMSYS_T_DRV_DESC_PRIVATE* pDrvDescPrivate = netdev_priv(pNDev);
struct device_node* pDevNode;
int nRes = -ENXIO;

if (pDrvDescPrivate->MacInfo.bNoMdioBus)
Expand All @@ -3043,14 +3043,10 @@ static int MdioInit(struct platform_device* pPDev)
pDrvDescPrivate->pMdioBus->priv = pDrvDescPrivate;
pDrvDescPrivate->pMdioBus->parent = &pPDev->dev;

pDevNode = of_get_child_by_name(pDrvDescPrivate->pDevNode, "mdio");
if (NULL == pDevNode) {pDevNode = of_get_child_by_name(pDrvDescPrivate->pDevNode, "mdio0");}
if (NULL == pDevNode) {pDevNode = of_get_child_by_name(pDrvDescPrivate->pDevNode, "phy");}
if (NULL == pDevNode) {pDevNode = of_get_child_by_name(pDrvDescPrivate->pDevNode, "ethernet-phy");}
if (NULL != pDevNode)
if (NULL != pDrvDescPrivate->pMdioDevNode)
{
nRes = of_mdiobus_register(pDrvDescPrivate->pMdioBus, pDevNode);
of_node_put(pDevNode);
nRes = of_mdiobus_register(pDrvDescPrivate->pMdioBus, pDrvDescPrivate->pMdioDevNode);
of_node_put(pDrvDescPrivate->pMdioDevNode);
}
else
{
Expand Down Expand Up @@ -3499,13 +3495,39 @@ static int EthernetDriverProbe(struct platform_device* pPDev)
}
}

/* look for mdio node */
if ((NULL == of_get_child_by_name(pDevNode, "mdio")) &&
(NULL == of_get_child_by_name(pDevNode, "mdio0")) &&
(NULL == of_get_child_by_name(pDevNode, "phy")) &&
(NULL == of_get_child_by_name(pDevNode, "ethernet-phy")))
/* check if mdio node is sub-node and mac has own mdio bus */
{
if ((NULL != pDrvDescPrivate->pPhyNode) || (NULL != pDrvDescPrivate->pMdioNode))
pDrvDescPrivate->pMdioDevNode = of_get_child_by_name(pDevNode, "mdio");
if (NULL == pDrvDescPrivate->pMdioDevNode)
pDrvDescPrivate->pMdioDevNode = of_get_child_by_name(pDevNode, "mdio0");
if (NULL == pDrvDescPrivate->pMdioDevNode)
pDrvDescPrivate->pMdioDevNode = of_get_child_by_name(pDevNode, "mdio1");
if (NULL == pDrvDescPrivate->pMdioDevNode)
pDrvDescPrivate->pMdioDevNode = of_get_child_by_name(pDevNode, "phy");
if (NULL == pDrvDescPrivate->pMdioDevNode)
pDrvDescPrivate->pMdioDevNode = of_get_child_by_name(pDevNode, "ethernet-phy");

if ((NULL == pDrvDescPrivate->pMdioDevNode) && (NULL != pDrvDescPrivate->pPhyNode))
{
/* check if phy node is subnode and us first sub-node as node for mdio bus */
struct device_node *pTempNode = of_get_parent(pDrvDescPrivate->pPhyNode);
if ((NULL != pTempNode) && (pTempNode == pDevNode))
{
pDrvDescPrivate->pMdioDevNode = pDrvDescPrivate->pPhyNode;
}
else if ((NULL != pTempNode) && (of_get_parent(pTempNode) == pDevNode))
{
pDrvDescPrivate->pMdioDevNode = pTempNode;
}
}

if (NULL != pDrvDescPrivate->pMdioDevNode)
{
/* mdio bus is owned by current mac instance */
pDrvDescPrivate->MacInfo.bNoMdioBus = false;
INF("%s: mac has mdio bus.\n", pPDev->name );
}
else if ((NULL != pDrvDescPrivate->pPhyNode) || (NULL != pDrvDescPrivate->pMdioNode))
{
/* mdio bus owned by another mac instance */
pDrvDescPrivate->MacInfo.bNoMdioBus = true;
Expand All @@ -3518,12 +3540,6 @@ static int EthernetDriverProbe(struct platform_device* pPDev)
INF("%s: handle mdio bus without device tree node.\n", pPDev->name );
}
}
else
{
/* mdio bus is owned by current mac instance */
pDrvDescPrivate->MacInfo.bNoMdioBus = false;
DBG("%s: mac has mdio bus.\n", pPDev->name );
}

/* PHY reset data */
nRes = of_property_read_u32(pDevNode, "atemsys-phy-reset-duration", &pDrvDescPrivate->nPhyResetDuration);
Expand Down
7 changes: 4 additions & 3 deletions atemsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
* use old mapping with ATEMSYS_LEGACY_DMA=1 define or
* activate new mapping with ATEMSYS_LEGACY_DMA=0 define for older kernel
* V1.4.23 - Fix PCI bars
* V1.4.24 - Add Device Tree Ethernet driver support for STM32mp135
* atemsys is shared across EC-Master V2.7+
*----------------------------------------------------------------------------*/
Expand All @@ -123,10 +124,10 @@
#define EC_ATEMSYSVERSION(a,b,c) (((a)<<2*8)+((b)<<1*8)+((c)<<0*8))
#endif

#define ATEMSYS_VERSION_STR "1.4.23"
#define ATEMSYS_VERSION_NUM 1,4,23
#define ATEMSYS_VERSION_STR "1.4.24"
#define ATEMSYS_VERSION_NUM 1,4,24
#if (defined ATEMSYS_C)
#define USE_ATEMSYS_API_VERSION EC_ATEMSYSVERSION(1,4,23)
#define USE_ATEMSYS_API_VERSION EC_ATEMSYSVERSION(1,4,24)
#endif

/* support selection */
Expand Down

0 comments on commit 53f776c

Please sign in to comment.