Commit b59c43e0 authored by Ajay Gupta's avatar Ajay Gupta Committed by David S. Miller

net: stmmac: dwc-qos: use generic device api

Use generic device api so that driver can work both with DT
or ACPI based devices.
Signed-off-by: default avatarAjay Gupta <ajayg@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce2b5a3a
...@@ -40,7 +40,7 @@ struct tegra_eqos { ...@@ -40,7 +40,7 @@ struct tegra_eqos {
static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
struct plat_stmmacenet_data *plat_dat) struct plat_stmmacenet_data *plat_dat)
{ {
struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev;
u32 burst_map = 0; u32 burst_map = 0;
u32 bit_index = 0; u32 bit_index = 0;
u32 a_index = 0; u32 a_index = 0;
...@@ -52,8 +52,9 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, ...@@ -52,8 +52,9 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
return -ENOMEM; return -ENOMEM;
} }
plat_dat->axi->axi_lpi_en = of_property_read_bool(np, "snps,en-lpi"); plat_dat->axi->axi_lpi_en = device_property_read_bool(dev,
if (of_property_read_u32(np, "snps,write-requests", "snps,en-lpi");
if (device_property_read_u32(dev, "snps,write-requests",
&plat_dat->axi->axi_wr_osr_lmt)) { &plat_dat->axi->axi_wr_osr_lmt)) {
/** /**
* Since the register has a reset value of 1, if property * Since the register has a reset value of 1, if property
...@@ -68,7 +69,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, ...@@ -68,7 +69,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
plat_dat->axi->axi_wr_osr_lmt--; plat_dat->axi->axi_wr_osr_lmt--;
} }
if (of_property_read_u32(np, "snps,read-requests", if (device_property_read_u32(dev, "snps,read-requests",
&plat_dat->axi->axi_rd_osr_lmt)) { &plat_dat->axi->axi_rd_osr_lmt)) {
/** /**
* Since the register has a reset value of 1, if property * Since the register has a reset value of 1, if property
...@@ -82,7 +83,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev, ...@@ -82,7 +83,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
*/ */
plat_dat->axi->axi_rd_osr_lmt--; plat_dat->axi->axi_rd_osr_lmt--;
} }
of_property_read_u32(np, "snps,burst-map", &burst_map); device_property_read_u32(dev, "snps,burst-map", &burst_map);
/* converts burst-map bitmask to burst array */ /* converts burst-map bitmask to burst array */
for (bit_index = 0; bit_index < 7; bit_index++) { for (bit_index = 0; bit_index < 7; bit_index++) {
...@@ -421,7 +422,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev) ...@@ -421,7 +422,7 @@ static int dwc_eth_dwmac_probe(struct platform_device *pdev)
void *priv; void *priv;
int ret; int ret;
data = of_device_get_match_data(&pdev->dev); data = device_get_match_data(&pdev->dev);
memset(&stmmac_res, 0, sizeof(struct stmmac_resources)); memset(&stmmac_res, 0, sizeof(struct stmmac_resources));
...@@ -478,7 +479,7 @@ static int dwc_eth_dwmac_remove(struct platform_device *pdev) ...@@ -478,7 +479,7 @@ static int dwc_eth_dwmac_remove(struct platform_device *pdev)
const struct dwc_eth_dwmac_data *data; const struct dwc_eth_dwmac_data *data;
int err; int err;
data = of_device_get_match_data(&pdev->dev); data = device_get_match_data(&pdev->dev);
err = stmmac_dvr_remove(&pdev->dev); err = stmmac_dvr_remove(&pdev->dev);
if (err < 0) if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment