Commit 7bc519b3 authored by Jan Kiszka's avatar Jan Kiszka Committed by David S. Miller

stmmac: pci: Select quark_pci_dmi_data from quark_default_data

No need to carry this reference in stmmac_pci_info - the Quark-specific
setup handler knows that it needs to use the Quark-specific DMI table.
This also allows to drop the stmmac_pci_info reference from the setup
handler parameter list.
Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c5f657e4
...@@ -38,13 +38,11 @@ struct stmmac_pci_dmi_data { ...@@ -38,13 +38,11 @@ struct stmmac_pci_dmi_data {
}; };
struct stmmac_pci_info { struct stmmac_pci_info {
int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat, int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat);
const struct stmmac_pci_info *info);
struct stmmac_pci_dmi_data *dmi;
}; };
static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, static int stmmac_pci_find_phy_addr(struct pci_dev *pdev,
const struct stmmac_pci_info *info) struct stmmac_pci_dmi_data *dmi_data)
{ {
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); const char *asset_tag = dmi_get_system_info(DMI_BOARD_ASSET_TAG);
...@@ -54,7 +52,7 @@ static int stmmac_pci_find_phy_addr(struct pci_dev *pdev, ...@@ -54,7 +52,7 @@ static int stmmac_pci_find_phy_addr(struct pci_dev *pdev,
if (!name) if (!name)
return -ENODEV; return -ENODEV;
for (dmi = info->dmi; dmi->name && *dmi->name; dmi++) { for (dmi = dmi_data; 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 asset tag is provided, match on it as well. */
if (dmi->asset_tag && strcmp(dmi->asset_tag, asset_tag)) if (dmi->asset_tag && strcmp(dmi->asset_tag, asset_tag))
...@@ -97,8 +95,7 @@ static void common_default_data(struct plat_stmmacenet_data *plat) ...@@ -97,8 +95,7 @@ static void common_default_data(struct plat_stmmacenet_data *plat)
} }
static int stmmac_default_data(struct pci_dev *pdev, static int stmmac_default_data(struct pci_dev *pdev,
struct plat_stmmacenet_data *plat, struct plat_stmmacenet_data *plat)
const struct stmmac_pci_info *info)
{ {
/* Set common default data first */ /* Set common default data first */
common_default_data(plat); common_default_data(plat);
...@@ -118,9 +115,40 @@ static const struct stmmac_pci_info stmmac_pci_info = { ...@@ -118,9 +115,40 @@ static const struct stmmac_pci_info stmmac_pci_info = {
.setup = stmmac_default_data, .setup = stmmac_default_data,
}; };
static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = {
{
.name = "Galileo",
.func = 6,
.phy_addr = 1,
},
{
.name = "GalileoGen2",
.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,
},
{}
};
static int quark_default_data(struct pci_dev *pdev, static int quark_default_data(struct pci_dev *pdev,
struct plat_stmmacenet_data *plat, struct plat_stmmacenet_data *plat)
const struct stmmac_pci_info *info)
{ {
int ret; int ret;
...@@ -131,7 +159,7 @@ static int quark_default_data(struct pci_dev *pdev, ...@@ -131,7 +159,7 @@ static int quark_default_data(struct pci_dev *pdev,
* Refuse to load the driver and register net device if MAC controller * Refuse to load the driver and register net device if MAC controller
* does not connect to any PHY interface. * does not connect to any PHY interface.
*/ */
ret = stmmac_pci_find_phy_addr(pdev, info); ret = stmmac_pci_find_phy_addr(pdev, quark_pci_dmi_data);
if (ret < 0) { if (ret < 0) {
/* Return error to the caller on DMI enabled boards. */ /* Return error to the caller on DMI enabled boards. */
if (dmi_get_system_info(DMI_BOARD_NAME)) if (dmi_get_system_info(DMI_BOARD_NAME))
...@@ -157,41 +185,8 @@ static int quark_default_data(struct pci_dev *pdev, ...@@ -157,41 +185,8 @@ static int quark_default_data(struct pci_dev *pdev,
return 0; return 0;
} }
static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = {
{
.name = "Galileo",
.func = 6,
.phy_addr = 1,
},
{
.name = "GalileoGen2",
.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,
},
{}
};
static const struct stmmac_pci_info quark_pci_info = { static const struct stmmac_pci_info quark_pci_info = {
.setup = quark_default_data, .setup = quark_default_data,
.dmi = quark_pci_dmi_data,
}; };
/** /**
...@@ -250,7 +245,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev, ...@@ -250,7 +245,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
pci_set_master(pdev); pci_set_master(pdev);
ret = info->setup(pdev, plat, info); ret = info->setup(pdev, plat);
if (ret) if (ret)
return ret; return ret;
......
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