Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux-2.6-block.git] / drivers / net / ethernet / stmicro / stmmac / stmmac_platform.c
index 4514ba73d96116317ca5ff8b797b037ae7434ffd..dcbd2a1601e89a620bb2dc1c77887e374d3fe2ba 100644 (file)
@@ -95,6 +95,42 @@ static int dwmac1000_validate_ucast_entries(int ucast_entries)
        return x;
 }
 
+/**
+ * stmmac_axi_setup - parse DT parameters for programming the AXI register
+ * @pdev: platform device
+ * @priv: driver private struct.
+ * Description:
+ * if required, from device-tree the AXI internal register can be tuned
+ * by using platform parameters.
+ */
+static struct stmmac_axi *stmmac_axi_setup(struct platform_device *pdev)
+{
+       struct device_node *np;
+       struct stmmac_axi *axi;
+
+       np = of_parse_phandle(pdev->dev.of_node, "snps,axi-config", 0);
+       if (!np)
+               return NULL;
+
+       axi = kzalloc(sizeof(*axi), GFP_KERNEL);
+       if (!axi)
+               return ERR_PTR(-ENOMEM);
+
+       axi->axi_lpi_en = of_property_read_bool(np, "snps,lpi_en");
+       axi->axi_xit_frm = of_property_read_bool(np, "snps,xit_frm");
+       axi->axi_kbbe = of_property_read_bool(np, "snps,axi_kbbe");
+       axi->axi_axi_all = of_property_read_bool(np, "snps,axi_all");
+       axi->axi_fb = of_property_read_bool(np, "snps,axi_fb");
+       axi->axi_mb = of_property_read_bool(np, "snps,axi_mb");
+       axi->axi_rb =  of_property_read_bool(np, "snps,axi_rb");
+
+       of_property_read_u32(np, "snps,wr_osr_lmt", &axi->axi_wr_osr_lmt);
+       of_property_read_u32(np, "snps,rd_osr_lmt", &axi->axi_rd_osr_lmt);
+       of_property_read_u32_array(np, "snps,blen", axi->axi_blen, AXI_BLEN);
+
+       return axi;
+}
+
 /**
  * stmmac_probe_config_dt - parse device-tree driver parameters
  * @pdev: platform_device structure
@@ -223,13 +259,11 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
                }
                plat->dma_cfg = dma_cfg;
                of_property_read_u32(np, "snps,pbl", &dma_cfg->pbl);
+               dma_cfg->aal = of_property_read_bool(np, "snps,aal");
                dma_cfg->fixed_burst =
                        of_property_read_bool(np, "snps,fixed-burst");
                dma_cfg->mixed_burst =
                        of_property_read_bool(np, "snps,mixed-burst");
-               of_property_read_u32(np, "snps,burst_len", &dma_cfg->burst_len);
-               if (dma_cfg->burst_len < 0 || dma_cfg->burst_len > 256)
-                       dma_cfg->burst_len = 0;
        }
        plat->force_thresh_dma_mode = of_property_read_bool(np, "snps,force_thresh_dma_mode");
        if (plat->force_thresh_dma_mode) {
@@ -237,6 +271,8 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
                pr_warn("force_sf_dma_mode is ignored if force_thresh_dma_mode is set.");
        }
 
+       plat->axi = stmmac_axi_setup(pdev);
+
        return plat;
 }
 #else