From 6886519f62cf784ed12a0367fa100092130d8522 Mon Sep 17 00:00:00 2001 From: blogic Date: Sat, 15 Dec 2012 01:59:08 +0000 Subject: [kernel] make rtl8366 driver OF capable git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34682 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../generic/files/drivers/net/phy/rtl8366rb.c | 30 ++++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'target/linux/generic/files/drivers/net/phy/rtl8366rb.c') diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c index 775949792..7f24d04dc 100644 --- a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c +++ b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include #include @@ -1179,22 +1179,9 @@ static int __devinit rtl8366rb_probe(struct platform_device *pdev) printk(KERN_NOTICE RTL8366RB_DRIVER_DESC " version " RTL8366RB_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; @@ -1241,10 +1228,19 @@ static int __devexit rtl8366rb_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id rtl8366rb_match[] = { + { .compatible = "rtl8366rb" }, + {}, +}; +MODULE_DEVICE_TABLE(of, rtl8366rb_match); +#endif + static struct platform_driver rtl8366rb_driver = { .driver = { .name = RTL8366RB_DRIVER_NAME, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(rtl8366rb_match), }, .probe = rtl8366rb_probe, .remove = __devexit_p(rtl8366rb_remove), -- cgit v1.2.3