/* Attaches the synopGMAC device structure to the hardware. Device structure is populated with MAC/DMA and PHY base addresses.  */
static s32 synopGMAC_scan_phyid(synopGMACdevice *gmacdev, u32 phyBase)
/* Attaches the synopGMAC device structure to the hardware. Device structure is populated with MAC/DMA and PHY base addresses.  */
static s32 synopGMAC_scan_phyid(synopGMACdevice *gmacdev, u32 phyBase)
{
    int i, j;
    u16 data;
    for (i = phyBase, j = 0; j < 32; i = (i + 1) & 0x1f, j++)
    {
        synopGMAC_read_phy_reg(gmacdev->MacBase, i, 2, &data);
        if (data != 0 && data != 0xffff) break;
        synopGMAC_read_phy_reg(gmacdev->MacBase, i, 3, &data);
        if (data != 0 && data != 0xffff) break;
    }
    if (j == 32)
    {
        j = -1;
    }
    return j;
}