struct eth_pdata eth_pdata;
struct axidma_reg *dmatx;
struct axidma_reg *dmarx;
+ int pcsaddr;
int phyaddr;
u8 eth_hasnobuf;
int phy_of_handle;
struct axidma_priv {
struct axidma_reg *dmatx;
struct axidma_reg *dmarx;
+ int pcsaddr;
int phyaddr;
struct axi_regs *iobase;
phy_interface_t interface;
if (IS_ENABLED(CONFIG_DM_ETH_PHY))
priv->phyaddr = eth_phy_get_addr(dev);
+ /*
+ * Set address of PCS/PMA PHY to the one pointed by phy-handle for
+ * backward compatibility.
+ */
+ if (priv->phyaddr != -1 && priv->pcsaddr == 0)
+ priv->pcsaddr = priv->phyaddr;
+
if (priv->phyaddr == -1) {
/* Detect the PHY address */
for (i = 31; i >= 0; i--) {
* after DMA and ethernet resets and hence
* check and clear if set.
*/
- ret = phyread(priv, priv->phyaddr, MII_BMCR, &temp);
+ ret = phyread(priv, priv->pcsaddr, MII_BMCR, &temp);
if (ret)
return 0;
if (temp & BMCR_ISOLATE) {
temp &= ~BMCR_ISOLATE;
- ret = phywrite(priv, priv->phyaddr, MII_BMCR, temp);
+ ret = phywrite(priv, priv->pcsaddr, MII_BMCR, temp);
if (ret)
return 0;
}
if (priv->mactype == EMAC_1G) {
priv->eth_hasnobuf = plat->eth_hasnobuf;
+ priv->pcsaddr = plat->pcsaddr;
priv->phyaddr = plat->phyaddr;
priv->phy_of_handle = plat->phy_of_handle;
priv->interface = pdata->phy_interface;
if (plat->mactype == EMAC_1G) {
plat->phyaddr = -1;
+ /* PHYAD 0 always redirects to the PCS/PMA PHY */
+ plat->pcsaddr = 0;
offset = fdtdec_lookup_phandle(gd->fdt_blob, node,
"phy-handle");
plat->eth_hasnobuf = fdtdec_get_bool(gd->fdt_blob, node,
"xlnx,eth-hasnobuf");
+
+ if (pdata->phy_interface == PHY_INTERFACE_MODE_SGMII ||
+ pdata->phy_interface == PHY_INTERFACE_MODE_1000BASEX) {
+ offset = fdtdec_lookup_phandle(gd->fdt_blob, node,
+ "pcs-handle");
+ if (offset > 0) {
+ plat->pcsaddr = fdtdec_get_int(gd->fdt_blob,
+ offset, "reg", -1);
+ }
+ }
}
return 0;