Re: 4.2-rc3: APM xgene2: ethernet doesn't work

2015-07-23 Thread Suman Tripathi
Hi Ming,

On Thu, Jul 23, 2015 at 2:37 PM, Ming Lei  wrote:
> Hi Guys,
>
> When booting from UEFI/ACPI, sometimes there is a crash[1]
> from rx path, sometimes there isn't any rx packets comming.
>
> Firmware version: 2.02.10
>
> Thanks,
>
> [1], crash log
> Call trace:
> skbuff: skb_over_panic: text:ffc00048094c len:85 put:60
> head: data:  (null) tail:0x3c end:0x0
> dev:
> Kernel panic - not syncing: BUG!
> CPU: 0 PID: 0 Comm: swapper/0 Tainted: GW   4.2.0-rc3+ #76
> Hardware name: AppliedMicro Mustang/Mustang, BIOS 2.0.0 Jun  9 2015
> Call trace:
> [] dump_backtrace+0x0/0x12c
> [] show_stack+0x10/0x1c
> [] dump_stack+0x8c/0xdc
> [] panic+0xe4/0x220
> [] skb_panic+0x74/0x78
> [] skb_put+0x88/0x8c
> [] xgene_enet_process_ring+0xcc/0x394
> [] xgene_enet_napi+0x1c/0x54
> [] net_rx_action+0x124/0x2c0
> [] __do_softirq+0x110/0x238
> [] irq_exit+0x88/0xf0
> [] __handle_domain_irq+0x68/0xb4
> [] gic_handle_irq+0x30/0x7c
> Exception stack(0xffc000877dc0 to 0xffc000877ee0)
> 7dc0: 00874000 ffc0 0087a648 ffc0 00877f00 ffc0 000869e0 ffc0
> 7de0:   00877f10 ffc0 fffbcb38 ffc7 fffbcb44 ffc7
> 7e00:  0100 da24b9c8 ffc7 fffbe0d9 ffc7 fffbe0d8 ffc7
> 7e20: 008813a0 ffc0 9429  0750  008c93a9 ffc0
> 7e40: 007a1b38 ffc0 007a1b20 ffc0 df5d7500 ffbe  
> 7e60: 98ab6000 007f 98a9d440 007f   00874000 ffc0
> 7e80: 0087a648 ffc0 00867b00 ffc0 0001  00877f20 ffc0
> 7ea0: 00614500 ffc0 00785000 ffc0 008c9000 ffc0 0087a6cc ffc0
> 7ec0: ffa01348 0047 00877f00 ffc0 000869dc ffc0 00877f00 ffc0
> [] el1_irq+0x64/0xd8
> [] default_idle_call+0x18/0x2c
> [] cpu_startup_entry+0xfc/0x180
> [] rest_init+0x80/0x8c
> [] start_kernel+0x3c0/0x3d8
> Rebooting in 1 seconds..[DRAM: PHY calibrating ...ignored]
>  ECC init *ignored]

It will be fixed in next release as it is a fix in firmware.

-- 
Thanks,
with regards,
Suman Tripathi
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next] drivers: net: xgene: Fix the compilation error "error: implicit declaration of function 'acpi_evaluate_integer'" for CONFIG_ACPI=n.

2015-07-06 Thread Suman Tripathi
This patch guards the acpi_evaluate_interger function as it fails
the build for CONFIG_ACPI=n.

Signed-off-by: Iyappan Subramanian 
Signed-off-by: Suman Tripathi 
Reported-by: kbuild test robot 
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 4e83d4c..70b9ef6 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -871,6 +871,7 @@ static const struct net_device_ops xgene_ndev_ops = {
.ndo_set_mac_address = xgene_enet_set_mac_address,
 };

+#ifdef CONFIG_ACPI
 static int xgene_get_port_id_acpi(struct device *dev,
  struct xgene_enet_pdata *pdata)
 {
@@ -886,6 +887,7 @@ static int xgene_get_port_id_acpi(struct device *dev,

return 0;
 }
+#endif

 static int xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata 
*pdata)
 {
--
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH net-next v1 1/1] drivers: net: xgene: Fix the compilation error "error: implicit declaration of function 'acpi_evaluate_integer'" in APM X-Gene ethernet driver.

2015-07-01 Thread Suman Tripathi
Hi ,

Any comments on this patch .

On Wed, Jun 24, 2015 at 1:51 PM, Suman Tripathi  wrote:
> This patch guards the acpi_evaluate_interger function as it fails
> the build for NON_ACPI CONFIG.
>
> Signed-off-by: Iyappan Subramanian 
> Signed-off-by: Suman Tripathi 
> Reported-by: kbuild test robot 
> ---
>  drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c 
> b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> index 4e83d4c..70b9ef6 100644
> --- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> +++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
> @@ -871,6 +871,7 @@ static const struct net_device_ops xgene_ndev_ops = {
> .ndo_set_mac_address = xgene_enet_set_mac_address,
>  };
>
> +#ifdef CONFIG_ACPI
>  static int xgene_get_port_id_acpi(struct device *dev,
>   struct xgene_enet_pdata *pdata)
>  {
> @@ -886,6 +887,7 @@ static int xgene_get_port_id_acpi(struct device *dev,
>
> return 0;
>  }
> +#endif
>
>  static int xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata 
> *pdata)
>  {
> --
> 1.8.2.1
>



-- 
Thanks,
with regards,
Suman Tripathi
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v1 1/1] drivers: net: xgene: Fix the compilation error "error: implicit declaration of function 'acpi_evaluate_integer'" in APM X-Gene ethernet driver.

2015-06-24 Thread Suman Tripathi
This patch guards the acpi_evaluate_interger function as it fails
the build for NON_ACPI CONFIG.

Signed-off-by: Iyappan Subramanian 
Signed-off-by: Suman Tripathi 
Reported-by: kbuild test robot 
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 4e83d4c..70b9ef6 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -871,6 +871,7 @@ static const struct net_device_ops xgene_ndev_ops = {
.ndo_set_mac_address = xgene_enet_set_mac_address,
 };

+#ifdef CONFIG_ACPI
 static int xgene_get_port_id_acpi(struct device *dev,
  struct xgene_enet_pdata *pdata)
 {
@@ -886,6 +887,7 @@ static int xgene_get_port_id_acpi(struct device *dev,

return 0;
 }
+#endif

 static int xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata 
*pdata)
 {
--
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v1 0/1]drivers: net: xgene: Fix the ACPI support for RGMII/SGMII0/XFI ethernet interfaces of APM X-Gene SoC.

2015-06-24 Thread Suman Tripathi
v1 change:
 * Fix the compilation error.
 * Drop other patches as it got accepted.

Signed-off-by: Iyappan Subramanian 
Signed-off-by: Suman Tripathi 
---

Suman Tripathi (1):
  drivers: net: xgene: Fix the compilation error "error: implicit
declaration of function 'acpi_evaluate_integer'" in APM X-Gene
ethernet driver.

 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 ++
 1 file changed, 2 insertions(+)

--
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v0 2/4] drivers: net: xgene: Implement the backward compatibility with the old and new firmware w.r.t Tx completion IRQ interrupt.

2015-06-23 Thread Suman Tripathi
This patch implements the backward compatibility with the old firmware where
the Tx completion IRQ interrupt was absent whereas incase of new firmware
the Tx completion IRQ interrupt is present.

Signed-off-by: Iyappan Subramanian 
Signed-off-by: Suman Tripathi 
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index c8f97a7..946ebde 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1024,11 +1024,13 @@ static int xgene_enet_get_resources(struct 
xgene_enet_pdata *pdata)
if (pdata->phy_mode != PHY_INTERFACE_MODE_RGMII) {
ret = platform_get_irq(pdev, 1);
if (ret <= 0) {
-   dev_err(dev, "Unable to get ENET Tx completion IRQ\n");
-   ret = ret ? : -ENXIO;
-   return ret;
-   }
-   pdata->txc_irq = ret;
+   pdata->cq_cnt = 0;
+   dev_info(dev, "Unable to get Tx completion IRQ,"
+"using Rx IRQ instead\n");
+   } else {
+   pdata->cq_cnt = XGENE_MAX_TXC_RINGS;
+   pdata->txc_irq = ret;
+   }
}

pdata->clk = devm_clk_get(&pdev->dev, NULL);
@@ -1105,13 +1107,11 @@ static void xgene_enet_setup_ops(struct 
xgene_enet_pdata *pdata)
pdata->mac_ops = &xgene_sgmac_ops;
pdata->port_ops = &xgene_sgport_ops;
pdata->rm = RM1;
-   pdata->cq_cnt = XGENE_MAX_TXC_RINGS;
break;
default:
pdata->mac_ops = &xgene_xgmac_ops;
pdata->port_ops = &xgene_xgport_ops;
pdata->rm = RM0;
-   pdata->cq_cnt = XGENE_MAX_TXC_RINGS;
break;
}

--
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v0 0/4] drivers: net: xgene: Fix the ACPI support for RGMII/SGMII0/XFI ethernet interfaces of APM X-Gene SoC.

2015-06-23 Thread Suman Tripathi
Signed-off-by: Iyappan Subramanian 
Signed-off-by: Suman Tripathi 
---

Suman Tripathi (4):
  drivers: net: xgene: Fix the ACPI support for RGMII/SGMII0/XFI
interface of APM X-Gene SoC ethernet controller.
  drivers: net: xgene: Implement the backward compatibility with the old
and new firmware w.r.t Tx completion IRQ interrupt.
  drivers: net: xgene: Add ACPI support for SGMII0 and XFI1 interface of
2nd H/W version of APM X-Gene SoC ethernet controller.
  drivers: net: xgene: Check for IS_ERR rather than NULL for clock.

 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c|  7 +-
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c  | 84 ++-
 drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | 13 ++--
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 13 ++--
 4 files changed, 73 insertions(+), 44 deletions(-)

--
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v0 3/4] drivers: net: xgene: Add ACPI support for SGMII0 and XFI1 interface of 2nd H/W version of APM X-Gene SoC ethernet controller.

2015-06-23 Thread Suman Tripathi
This patch adds the ACPI support for SGMII0 and XFI1 interface of
2nd H/W version of APM X-Gene SoC ethernet controller.

Signed-off-by: Iyappan Subramanian 
Signed-off-by: Suman Tripathi 
---
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 946ebde..ed52d65 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1289,6 +1289,8 @@ static const struct acpi_device_id 
xgene_enet_acpi_match[] = {
{ "APMC0D05", XGENE_ENET1},
{ "APMC0D30", XGENE_ENET1},
{ "APMC0D31", XGENE_ENET1},
+   { "APMC0D26", XGENE_ENET2},
+   { "APMC0D25", XGENE_ENET2},
{ }
 };
 MODULE_DEVICE_TABLE(acpi, xgene_enet_acpi_match);
--
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v0 4/4] drivers: net: xgene: Check for IS_ERR rather than NULL for clock.

2015-06-23 Thread Suman Tripathi
This patches fixes the code to check for IS_ERR rather
than NULL for clock interface.

Signed-off-by: Iyappan Subramanian 
Signed-off-by: Suman Tripathi 
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c|  5 +++--
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c  |  2 +-
 drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c | 13 -
 drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c | 13 -
 4 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 8ff736d..a626c43 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -610,7 +610,7 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
if (!xgene_ring_mgr_init(pdata))
return -ENODEV;

-   if (pdata->clk) {
+   if (!IS_ERR(pdata->clk)) {
clk_prepare_enable(pdata->clk);
clk_disable_unprepare(pdata->clk);
clk_prepare_enable(pdata->clk);
@@ -629,7 +629,8 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)

 static void xgene_gport_shutdown(struct xgene_enet_pdata *pdata)
 {
-   clk_disable_unprepare(pdata->clk);
+   if (!IS_ERR(pdata->clk))
+   clk_disable_unprepare(pdata->clk);
 }

 static int xgene_enet_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index ed52d65..4e83d4c 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -1036,7 +1036,7 @@ static int xgene_enet_get_resources(struct 
xgene_enet_pdata *pdata)
pdata->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(pdata->clk)) {
/* Firmware may have set up the clock already. */
-   pdata->clk = NULL;
+   dev_info(dev, "clocks have been setup already\n");
}

if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
index ff240b3..2e80c95 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
@@ -333,10 +333,12 @@ static int xgene_enet_reset(struct xgene_enet_pdata *p)
 {
if (!xgene_ring_mgr_init(p))
return -ENODEV;
-
-   clk_prepare_enable(p->clk);
-   clk_disable_unprepare(p->clk);
-   clk_prepare_enable(p->clk);
+
+   if (!IS_ERR(p->clk)) {
+   clk_prepare_enable(p->clk);
+   clk_disable_unprepare(p->clk);
+   clk_prepare_enable(p->clk);
+   }

xgene_enet_ecc_init(p);
xgene_enet_config_ring_if_assoc(p);
@@ -369,7 +371,8 @@ static void xgene_enet_cle_bypass(struct xgene_enet_pdata 
*p,

 static void xgene_enet_shutdown(struct xgene_enet_pdata *p)
 {
-   clk_disable_unprepare(p->clk);
+   if (!IS_ERR(p->clk))
+   clk_disable_unprepare(p->clk);
 }

 static void xgene_enet_link_state(struct work_struct *work)
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
index 27ba2fe..a86cfe4 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c
@@ -255,10 +255,12 @@ static int xgene_enet_reset(struct xgene_enet_pdata 
*pdata)
 {
if (!xgene_ring_mgr_init(pdata))
return -ENODEV;
-
-   clk_prepare_enable(pdata->clk);
-   clk_disable_unprepare(pdata->clk);
-   clk_prepare_enable(pdata->clk);
+
+   if (!IS_ERR(pdata->clk)) {
+   clk_prepare_enable(pdata->clk);
+   clk_disable_unprepare(pdata->clk);
+   clk_prepare_enable(pdata->clk);
+   }

xgene_enet_ecc_init(pdata);
xgene_enet_config_ring_if_assoc(pdata);
@@ -285,7 +287,8 @@ static void xgene_enet_xgcle_bypass(struct xgene_enet_pdata 
*pdata,

 static void xgene_enet_shutdown(struct xgene_enet_pdata *pdata)
 {
-   clk_disable_unprepare(pdata->clk);
+   if (!IS_ERR(pdata->clk))
+   clk_disable_unprepare(pdata->clk);
 }

 static void xgene_enet_link_state(struct work_struct *work)
--
1.8.2.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH net-next v0 1/4] drivers: net: xgene: Fix the ACPI support for RGMII/SGMII0/XFI interface of APM X-Gene SoC ethernet controller.

2015-06-23 Thread Suman Tripathi
This patch implements couple of fixes to support ACPI for RGMII/SGMII0/XFI
interface of APM X-Gene SoC ethernet controller driver. This patch uses
the _SUN acpi object to fetch the port-id information whereas the FDT uses
port-id binding for port-id information.

Signed-off-by: Iyappan Subramanian 
Signed-off-by: Suman Tripathi 
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c   |  2 +-
 drivers/net/ethernet/apm/xgene/xgene_enet_main.c | 66 +++-
 2 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 25873d1..8ff736d 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -751,7 +751,7 @@ static int xgene_mdiobus_register(struct xgene_enet_pdata 
*pdata,
if (ret)
return -EINVAL;

-   phy = get_phy_device(mdio, phy_id, true);
+   phy = get_phy_device(mdio, phy_id, false);
if (!phy || IS_ERR(phy))
return -EIO;

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c 
b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
index 1bb3175..c8f97a7 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
@@ -29,6 +29,7 @@
 #define RES_RING_CMD   2

 static const struct of_device_id xgene_enet_of_match[];
+static const struct acpi_device_id xgene_enet_acpi_match[];

 static void xgene_enet_init_bufpool(struct xgene_enet_desc_ring *buf_pool)
 {
@@ -870,24 +871,33 @@ static const struct net_device_ops xgene_ndev_ops = {
.ndo_set_mac_address = xgene_enet_set_mac_address,
 };

-static int xgene_get_port_id(struct device *dev, struct xgene_enet_pdata 
*pdata)
+static int xgene_get_port_id_acpi(struct device *dev,
+ struct xgene_enet_pdata *pdata)
+{
+   acpi_status status;
+   u64 temp;
+
+   status = acpi_evaluate_integer(ACPI_HANDLE(dev), "_SUN", NULL, &temp);
+   if (ACPI_FAILURE(status)) {
+   pdata->port_id = 0;
+   } else {
+   pdata->port_id = temp;
+   }
+
+   return 0;
+}
+
+static int xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata 
*pdata)
 {
u32 id = 0;
int ret;

-   ret = device_property_read_u32(dev, "port-id", &id);
-
-   switch (ret) {
-   case -EINVAL:
+   ret = of_property_read_u32(dev->of_node, "port-id", &id);
+   if (ret) {
pdata->port_id = 0;
ret = 0;
-   break;
-   case 0:
+   } else {
pdata->port_id = id & BIT(0);
-   break;
-   default:
-   dev_err(dev, "Incorrect port-id specified: errno: %d\n", ret);
-   break;
}

return ret;
@@ -976,8 +986,13 @@ static int xgene_enet_get_resources(struct 
xgene_enet_pdata *pdata)
dev_err(dev, "Unable to retrieve ENET Ring command region\n");
return -ENOMEM;
}
-
-   ret = xgene_get_port_id(dev, pdata);
+
+   if (dev->of_node)
+   ret = xgene_get_port_id_dt(dev, pdata);
+#ifdef CONFIG_ACPI
+   else
+   ret = xgene_get_port_id_acpi(dev, pdata);
+#endif
if (ret)
return ret;

@@ -1173,9 +1188,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
struct xgene_enet_pdata *pdata;
struct device *dev = &pdev->dev;
struct xgene_mac_ops *mac_ops;
-#ifdef CONFIG_OF
const struct of_device_id *of_id;
-#endif
int ret;

ndev = alloc_etherdev(sizeof(struct xgene_enet_pdata));
@@ -1194,16 +1207,23 @@ static int xgene_enet_probe(struct platform_device 
*pdev)
  NETIF_F_GSO |
  NETIF_F_GRO;

-#ifdef CONFIG_OF
of_id = of_match_device(xgene_enet_of_match, &pdev->dev);
if (of_id) {
pdata->enet_id = (enum xgene_enet_id)of_id->data;
-   if (!pdata->enet_id) {
-   free_netdev(ndev);
-   return -ENODEV;
-   }
+   }
+#ifdef CONFIG_ACPI
+   else {
+   const struct acpi_device_id *acpi_id;
+
+   acpi_id = acpi_match_device(xgene_enet_acpi_match, &pdev->dev);
+   if (acpi_id)
+   pdata->enet_id = (enum xgene_enet_id) 
acpi_id->driver_data;
}
 #endif
+   if (!pdata->enet_id) {
+   free_netdev(ndev);
+   return -ENODEV;
+   }

ret = xgene_enet_get_resources(pdata);
if (ret)
@@ -1266,9 +1286,9 @@ static int xgene_enet_remove(struct platform_device *pdev)

 #ifdef CONFIG_ACPI
 static const struct acpi_device_id xgene_enet_acpi_match[] = {
-   { "APMC0D05", },
-