Re: [PATCH v2 5/5] bgmac: add support for Northstar SoC (BCM4707, BCM53018)
From: Rafał Miłecki <zajec5@gmail.com>
Date: 2014-01-04 22:24:29
2014/1/4 Hauke Mehrtens [off-list ref]:
quoted hunk ↗ jump to hunk
@@ -909,9 +926,14 @@ static void bgmac_chip_reset(struct bgmac *bgmac) flags |= BGMAC_BCMA_IOCTL_SW_RESET; } - bcma_core_enable(core, flags); + /* 3GMAC: for BCM4707, only do core reset at bgmac_probe() */ + if (ci->id != BCMA_CHIP_ID_BCM4707) + bcma_core_enable(core, flags);
You can do better :) Why calculate flags if you're not going to use them? Put that calculation code inside non-4707 block. You can also move "u32 flags = 0;" to that block.
quoted hunk ↗ jump to hunk
@@ -1427,8 +1454,16 @@ static int bgmac_probe(struct bcma_device *core) } bgmac->cmn = core->bus->drv_gmac_cmn.core; - bgmac->phyaddr = core->core_unit ? sprom->et1phyaddr : - sprom->et0phyaddr; + /* + * Too much can go wrong in scanning MDC/MDIO playing "whos my phy?" . + * Instead, explicitly use the phy address 30. + */ + if (ci->id == BCMA_CHIP_ID_BCM4707 || ci->id == BCMA_CHIP_ID_BCM53018) + bgmac->phyaddr = BGMAC_PHY_NOREGS; + else + bgmac->phyaddr = core->core_unit ? sprom->et1phyaddr : + sprom->et0phyaddr;
I'm not sure if we really want that. AFAIU it's just a workaround of the lack of NVRAM (and SPROM in the result) on BCM4707 (& family). After adding NVRAM support you're have to revert that change, am I right? Also this hack is not magically making 4707 work, as there are many other issues (also related to the lack of NVRAM), correct?