[kernel] make rtl8366 driver OF capable
[openwrt.git] / target / linux / generic / files / drivers / net / phy / rtl8367.c
index ee2a047..d2d4faa 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/platform_device.h>
+#include <linux/of_platform.h>
 #include <linux/delay.h>
 #include <linux/skbuff.h>
 #include <linux/rtl8367.h>
@@ -1677,22 +1677,9 @@ static int __devinit rtl8367_probe(struct platform_device *pdev)
        struct rtl8366_smi *smi;
        int err;
 
-       pdata = pdev->dev.platform_data;
-       if (!pdata) {
-               dev_err(&pdev->dev, "no platform data specified\n");
-               err = -EINVAL;
-               goto err_out;
-       }
-
-       smi = rtl8366_smi_alloc(&pdev->dev);
-       if (!smi) {
-               err = -ENOMEM;
-               goto err_out;
-       }
-
-       smi->gpio_sda = pdata->gpio_sda;
-       smi->gpio_sck = pdata->gpio_sck;
-       smi->hw_reset = pdata->hw_reset;
+       smi = rtl8366_smi_probe(pdev);
+       if (!smi)
+               return -ENODEV;
 
        smi->clk_delay = 1500;
        smi->cmd_read = 0xb9;
@@ -1747,10 +1734,19 @@ static void rtl8367_shutdown(struct platform_device *pdev)
                rtl8367_reset_chip(smi);
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id rtl8367_match[] = {
+       { .compatible = "rtl8367" },
+       {},
+};
+MODULE_DEVICE_TABLE(of, rtl83767_match);
+#endif
+
 static struct platform_driver rtl8367_driver = {
        .driver = {
                .name           = RTL8367_DRIVER_NAME,
                .owner          = THIS_MODULE,
+               .of_match_table = of_match_ptr(rtl8367_match),
        },
        .probe          = rtl8367_probe,
        .remove         = __devexit_p(rtl8367_remove),