summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Gregory <graeme.gregory@linaro.org>2014-06-30 19:52:02 +0100
committerHanjun Guo <hanjun.guo@linaro.org>2015-02-25 16:07:11 +0800
commit9e6fdb917df4d89ccb8881cb8f74700ba2de1c94 (patch)
treeff37afa90657112040cf333980b13cc3a364a31a
parentd4930eb817f99bdfd7478cb9d29ed4588ea385bb (diff)
net: smsc911x add support for probing from ACPI
This is a standard platform device to resources are converted in the ACPI core in the same fasion as DT resources. For the other DT provided information there is _DSD for ACPI. Signed-off-by: Graeme Gregory <graeme.gregory@linaro.org>
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 2965c6ae7d6e..ffbd358e319e 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -60,6 +60,7 @@
#include <linux/of_gpio.h>
#include <linux/of_net.h>
#include <linux/pm_runtime.h>
+#include <linux/acpi.h>
#include "smsc911x.h"
@@ -2412,9 +2413,36 @@ static inline int smsc911x_probe_config_dt(
}
#endif /* CONFIG_OF */
+#ifdef CONFIG_ACPI
+/* Configure some sensible defaults for ACPI mode */
+static int smsc911x_probe_config_acpi(struct smsc911x_platform_config *config,
+ acpi_handle *ahandle)
+{
+ if (!ahandle)
+ return -ENOSYS;
+
+ config->phy_interface = PHY_INTERFACE_MODE_MII;
+
+ config->flags |= SMSC911X_USE_32BIT;
+
+ config->irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH;
+
+ config->irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL;
+
+ return 0;
+}
+#else
+static int smsc911x_probe_config_acpi(struct smsc911x_platform_config *config,
+ acpi_handle *ahandle)
+{
+ return -ENOSYS;
+}
+#endif /* CONFIG_ACPI */
+
static int smsc911x_drv_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
+ acpi_handle *ahandle = ACPI_HANDLE(&pdev->dev);
struct net_device *dev;
struct smsc911x_data *pdata;
struct smsc911x_platform_config *config = dev_get_platdata(&pdev->dev);
@@ -2479,6 +2507,9 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
}
retval = smsc911x_probe_config_dt(&pdata->config, np);
+ if (retval)
+ retval = smsc911x_probe_config_acpi(&pdata->config, ahandle);
+
if (retval && config) {
/* copy config parameters across to pdata */
memcpy(&pdata->config, config, sizeof(pdata->config));
@@ -2654,6 +2685,12 @@ static const struct of_device_id smsc911x_dt_ids[] = {
MODULE_DEVICE_TABLE(of, smsc911x_dt_ids);
#endif
+static const struct acpi_device_id smsc911x_acpi_ids[] = {
+ { "LNRO001B", },
+ { "ARMH9118", },
+ { }
+};
+
static struct platform_driver smsc911x_driver = {
.probe = smsc911x_drv_probe,
.remove = smsc911x_drv_remove,
@@ -2661,6 +2698,7 @@ static struct platform_driver smsc911x_driver = {
.name = SMSC_CHIPNAME,
.pm = SMSC911X_PM_OPS,
.of_match_table = of_match_ptr(smsc911x_dt_ids),
+ .acpi_match_table = ACPI_PTR(smsc911x_acpi_ids),
},
};