linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] stmmac: Add support for SIMATIC IOT2000 platform
@ 2017-05-02  7:58 Jan Kiszka
  2017-05-02  8:02 ` Andy Shevchenko
  2017-05-02 19:31 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Kiszka @ 2017-05-02  7:58 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, David Miller
  Cc: netdev, Linux Kernel Mailing List, Sascha Weisenberger, Andy Shevchenko

The IOT2000 is industrial controller platform, derived from the Intel
Galileo Gen2 board. The variant IOT2020 comes with one LAN port, the
IOT2040 has two of them. They can be told apart based on the board asset
tag in the DMI table.

Based on patch by Sascha Weisenberger.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Sascha Weisenberger <sascha.weisenberger@siemens.com>
---

Changes in v2:
- reformatted match conditions [Andy]

 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 26 +++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 5c9e462276b9..11d2229e536b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -32,6 +32,7 @@
  */
 struct stmmac_pci_dmi_data {
 	const char *name;
+	const char *asset_tag;
 	unsigned int func;
 	int phy_addr;
 };
@@ -46,6 +47,7 @@ struct stmmac_pci_info {
 static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *info)
 {
 	const char *name = dmi_get_system_info(DMI_BOARD_NAME);
+	const char *asset_tag = dmi_get_system_info(DMI_BOARD_ASSET_TAG);
 	unsigned int func = PCI_FUNC(info->pdev->devfn);
 	struct stmmac_pci_dmi_data *dmi;
 
@@ -57,8 +59,12 @@ static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *info)
 		return 1;
 
 	for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) {
-		if (!strcmp(dmi->name, name) && dmi->func == func)
+		if (!strcmp(dmi->name, name) && dmi->func == func) {
+			/* If asset tag is provided, match on it as well. */
+			if (dmi->asset_tag && strcmp(dmi->asset_tag, asset_tag))
+				continue;
 			return dmi->phy_addr;
+		}
 	}
 
 	return -ENODEV;
@@ -142,6 +148,24 @@ static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = {
 		.func = 6,
 		.phy_addr = 1,
 	},
+	{
+		.name = "SIMATIC IOT2000",
+		.asset_tag = "6ES7647-0AA00-0YA2",
+		.func = 6,
+		.phy_addr = 1,
+	},
+	{
+		.name = "SIMATIC IOT2000",
+		.asset_tag = "6ES7647-0AA00-1YA2",
+		.func = 6,
+		.phy_addr = 1,
+	},
+	{
+		.name = "SIMATIC IOT2000",
+		.asset_tag = "6ES7647-0AA00-1YA2",
+		.func = 7,
+		.phy_addr = 1,
+	},
 	{}
 };
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] stmmac: Add support for SIMATIC IOT2000 platform
  2017-05-02  7:58 [PATCH v2] stmmac: Add support for SIMATIC IOT2000 platform Jan Kiszka
@ 2017-05-02  8:02 ` Andy Shevchenko
  2017-05-02 19:31 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2017-05-02  8:02 UTC (permalink / raw)
  To: Jan Kiszka
  Cc: Giuseppe Cavallaro, Alexandre Torgue, David Miller, netdev,
	Linux Kernel Mailing List, Sascha Weisenberger

On Tue, May 2, 2017 at 10:58 AM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
> The IOT2000 is industrial controller platform, derived from the Intel
> Galileo Gen2 board. The variant IOT2020 comes with one LAN port, the
> IOT2040 has two of them. They can be told apart based on the board asset
> tag in the DMI table.
>
> Based on patch by Sascha Weisenberger.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Signed-off-by: Sascha Weisenberger <sascha.weisenberger@siemens.com>

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> ---
>
> Changes in v2:
> - reformatted match conditions [Andy]
>
>  drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 26 +++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> index 5c9e462276b9..11d2229e536b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> @@ -32,6 +32,7 @@
>   */
>  struct stmmac_pci_dmi_data {
>         const char *name;
> +       const char *asset_tag;
>         unsigned int func;
>         int phy_addr;
>  };
> @@ -46,6 +47,7 @@ struct stmmac_pci_info {
>  static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *info)
>  {
>         const char *name = dmi_get_system_info(DMI_BOARD_NAME);
> +       const char *asset_tag = dmi_get_system_info(DMI_BOARD_ASSET_TAG);
>         unsigned int func = PCI_FUNC(info->pdev->devfn);
>         struct stmmac_pci_dmi_data *dmi;
>
> @@ -57,8 +59,12 @@ static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *info)
>                 return 1;
>
>         for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) {
> -               if (!strcmp(dmi->name, name) && dmi->func == func)
> +               if (!strcmp(dmi->name, name) && dmi->func == func) {
> +                       /* If asset tag is provided, match on it as well. */
> +                       if (dmi->asset_tag && strcmp(dmi->asset_tag, asset_tag))
> +                               continue;
>                         return dmi->phy_addr;
> +               }
>         }
>
>         return -ENODEV;
> @@ -142,6 +148,24 @@ static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = {
>                 .func = 6,
>                 .phy_addr = 1,
>         },
> +       {
> +               .name = "SIMATIC IOT2000",
> +               .asset_tag = "6ES7647-0AA00-0YA2",
> +               .func = 6,
> +               .phy_addr = 1,
> +       },
> +       {
> +               .name = "SIMATIC IOT2000",
> +               .asset_tag = "6ES7647-0AA00-1YA2",
> +               .func = 6,
> +               .phy_addr = 1,
> +       },
> +       {
> +               .name = "SIMATIC IOT2000",
> +               .asset_tag = "6ES7647-0AA00-1YA2",
> +               .func = 7,
> +               .phy_addr = 1,
> +       },
>         {}
>  };
>



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] stmmac: Add support for SIMATIC IOT2000 platform
  2017-05-02  7:58 [PATCH v2] stmmac: Add support for SIMATIC IOT2000 platform Jan Kiszka
  2017-05-02  8:02 ` Andy Shevchenko
@ 2017-05-02 19:31 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-05-02 19:31 UTC (permalink / raw)
  To: jan.kiszka
  Cc: peppe.cavallaro, alexandre.torgue, netdev, linux-kernel,
	sascha.weisenberger, andy.shevchenko

From: Jan Kiszka <jan.kiszka@siemens.com>
Date: Tue, 2 May 2017 09:58:00 +0200

> The IOT2000 is industrial controller platform, derived from the Intel
> Galileo Gen2 board. The variant IOT2020 comes with one LAN port, the
> IOT2040 has two of them. They can be told apart based on the board asset
> tag in the DMI table.
> 
> Based on patch by Sascha Weisenberger.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> Signed-off-by: Sascha Weisenberger <sascha.weisenberger@siemens.com>
> ---
> 
> Changes in v2:
> - reformatted match conditions [Andy]

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-02 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-02  7:58 [PATCH v2] stmmac: Add support for SIMATIC IOT2000 platform Jan Kiszka
2017-05-02  8:02 ` Andy Shevchenko
2017-05-02 19:31 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).