Commit 212c7fd6 authored by Jan Kiszka's avatar Jan Kiszka Committed by David S. Miller

stmmac: Add support for SIMATIC IOT2000 platform

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: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarSascha Weisenberger <sascha.weisenberger@siemens.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 412b65d1
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
*/ */
struct stmmac_pci_dmi_data { struct stmmac_pci_dmi_data {
const char *name; const char *name;
const char *asset_tag;
unsigned int func; unsigned int func;
int phy_addr; int phy_addr;
}; };
...@@ -46,6 +47,7 @@ struct stmmac_pci_info { ...@@ -46,6 +47,7 @@ struct stmmac_pci_info {
static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *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 *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); unsigned int func = PCI_FUNC(info->pdev->devfn);
struct stmmac_pci_dmi_data *dmi; struct stmmac_pci_dmi_data *dmi;
...@@ -57,9 +59,13 @@ static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *info) ...@@ -57,9 +59,13 @@ static int stmmac_pci_find_phy_addr(struct stmmac_pci_info *info)
return 1; return 1;
for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) { 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 dmi->phy_addr;
} }
}
return -ENODEV; return -ENODEV;
} }
...@@ -153,6 +159,24 @@ static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = { ...@@ -153,6 +159,24 @@ static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = {
.func = 6, .func = 6,
.phy_addr = 1, .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,
},
{} {}
}; };
......
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