#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/rtl8366.h>
printk(KERN_NOTICE RTL8366S_DRIVER_DESC
" version " RTL8366S_DRIVER_VER"\n");
- 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 = 10;
smi->cmd_read = 0xa9;
return 0;
}
+#ifdef CONFIG_OF
+static const struct of_device_id rtl8366s_match[] = {
+ { .compatible = "rtl8366s" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, rtl8366s_match);
+#endif
+
static struct platform_driver rtl8366s_driver = {
.driver = {
.name = RTL8366S_DRIVER_NAME,
.owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rtl8366s_match),
},
.probe = rtl8366s_probe,
.remove = __devexit_p(rtl8366s_remove),