net: ethernet: bgmac: Make IDM register space optional
IDM operations are usually one time ops and should be done in firmware itself. Driver is not supposed to touch IDM registers. However, for some SoCs', driver is performing IDM read/writes. So this patch masks IDM operations in case firmware is taking care of IDM operations. Signed-off-by: Abhishek Shah <abhishek.shah@broadcom.com> Reviewed-by: Oza Oza <oza.oza@broadcom.com> Reviewed-by: Ray Jui <ray.jui@broadcom.com> Reviewed-by: Scott Branden <scott.branden@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
83a5c5af26
commit
a163bdb02b
@@ -55,6 +55,9 @@ static void platform_bgmac_idm_write(struct bgmac *bgmac, u16 offset, u32 value)
|
||||
|
||||
static bool platform_bgmac_clk_enabled(struct bgmac *bgmac)
|
||||
{
|
||||
if (!bgmac->plat.idm_base)
|
||||
return true;
|
||||
|
||||
if ((bgmac_idm_read(bgmac, BCMA_IOCTL) & BGMAC_CLK_EN) != BGMAC_CLK_EN)
|
||||
return false;
|
||||
if (bgmac_idm_read(bgmac, BCMA_RESET_CTL) & BCMA_RESET_CTL_RESET)
|
||||
@@ -66,6 +69,9 @@ static void platform_bgmac_clk_enable(struct bgmac *bgmac, u32 flags)
|
||||
{
|
||||
u32 val;
|
||||
|
||||
if (!bgmac->plat.idm_base)
|
||||
return;
|
||||
|
||||
/* The Reset Control register only contains a single bit to show if the
|
||||
* controller is currently in reset. Do a sanity check here, just in
|
||||
* case the bootloader happened to leave the device in reset.
|
||||
@@ -180,6 +186,7 @@ static int bgmac_probe(struct platform_device *pdev)
|
||||
bgmac->feature_flags |= BGMAC_FEAT_CMDCFG_SR_REV4;
|
||||
bgmac->feature_flags |= BGMAC_FEAT_TX_MASK_SETUP;
|
||||
bgmac->feature_flags |= BGMAC_FEAT_RX_MASK_SETUP;
|
||||
bgmac->feature_flags |= BGMAC_FEAT_IDM_MASK;
|
||||
|
||||
bgmac->dev = &pdev->dev;
|
||||
bgmac->dma_dev = &pdev->dev;
|
||||
@@ -207,15 +214,13 @@ static int bgmac_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(bgmac->plat.base);
|
||||
|
||||
regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
|
||||
if (!regs) {
|
||||
dev_err(&pdev->dev, "Unable to obtain idm resource\n");
|
||||
return -EINVAL;
|
||||
if (regs) {
|
||||
bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
|
||||
if (IS_ERR(bgmac->plat.idm_base))
|
||||
return PTR_ERR(bgmac->plat.idm_base);
|
||||
bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
|
||||
}
|
||||
|
||||
bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
|
||||
if (IS_ERR(bgmac->plat.idm_base))
|
||||
return PTR_ERR(bgmac->plat.idm_base);
|
||||
|
||||
regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base");
|
||||
if (regs) {
|
||||
bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev,
|
||||
|
Reference in New Issue
Block a user