diff options
Diffstat (limited to 'drivers/net/ethernet/ti/davinci_emac.c')
| -rw-r--r-- | drivers/net/ethernet/ti/davinci_emac.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 41ba974bf37c..cd9b164a0434 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c | |||
| @@ -61,6 +61,7 @@ | |||
| 61 | #include <linux/davinci_emac.h> | 61 | #include <linux/davinci_emac.h> |
| 62 | #include <linux/of.h> | 62 | #include <linux/of.h> |
| 63 | #include <linux/of_address.h> | 63 | #include <linux/of_address.h> |
| 64 | #include <linux/of_device.h> | ||
| 64 | #include <linux/of_irq.h> | 65 | #include <linux/of_irq.h> |
| 65 | #include <linux/of_net.h> | 66 | #include <linux/of_net.h> |
| 66 | 67 | ||
| @@ -1752,10 +1753,14 @@ static const struct net_device_ops emac_netdev_ops = { | |||
| 1752 | #endif | 1753 | #endif |
| 1753 | }; | 1754 | }; |
| 1754 | 1755 | ||
| 1756 | static const struct of_device_id davinci_emac_of_match[]; | ||
| 1757 | |||
| 1755 | static struct emac_platform_data * | 1758 | static struct emac_platform_data * |
| 1756 | davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) | 1759 | davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) |
| 1757 | { | 1760 | { |
| 1758 | struct device_node *np; | 1761 | struct device_node *np; |
| 1762 | const struct of_device_id *match; | ||
| 1763 | const struct emac_platform_data *auxdata; | ||
| 1759 | struct emac_platform_data *pdata = NULL; | 1764 | struct emac_platform_data *pdata = NULL; |
| 1760 | const u8 *mac_addr; | 1765 | const u8 *mac_addr; |
| 1761 | 1766 | ||
| @@ -1793,7 +1798,20 @@ davinci_emac_of_get_pdata(struct platform_device *pdev, struct emac_priv *priv) | |||
| 1793 | 1798 | ||
| 1794 | priv->phy_node = of_parse_phandle(np, "phy-handle", 0); | 1799 | priv->phy_node = of_parse_phandle(np, "phy-handle", 0); |
| 1795 | if (!priv->phy_node) | 1800 | if (!priv->phy_node) |
| 1796 | pdata->phy_id = ""; | 1801 | pdata->phy_id = NULL; |
| 1802 | |||
| 1803 | auxdata = pdev->dev.platform_data; | ||
| 1804 | if (auxdata) { | ||
| 1805 | pdata->interrupt_enable = auxdata->interrupt_enable; | ||
| 1806 | pdata->interrupt_disable = auxdata->interrupt_disable; | ||
| 1807 | } | ||
| 1808 | |||
| 1809 | match = of_match_device(davinci_emac_of_match, &pdev->dev); | ||
| 1810 | if (match && match->data) { | ||
| 1811 | auxdata = match->data; | ||
| 1812 | pdata->version = auxdata->version; | ||
| 1813 | pdata->hw_ram_addr = auxdata->hw_ram_addr; | ||
| 1814 | } | ||
| 1797 | 1815 | ||
| 1798 | pdev->dev.platform_data = pdata; | 1816 | pdev->dev.platform_data = pdata; |
| 1799 | 1817 | ||
| @@ -2020,8 +2038,14 @@ static const struct dev_pm_ops davinci_emac_pm_ops = { | |||
| 2020 | }; | 2038 | }; |
| 2021 | 2039 | ||
| 2022 | #if IS_ENABLED(CONFIG_OF) | 2040 | #if IS_ENABLED(CONFIG_OF) |
| 2041 | static const struct emac_platform_data am3517_emac_data = { | ||
| 2042 | .version = EMAC_VERSION_2, | ||
| 2043 | .hw_ram_addr = 0x01e20000, | ||
| 2044 | }; | ||
| 2045 | |||
| 2023 | static const struct of_device_id davinci_emac_of_match[] = { | 2046 | static const struct of_device_id davinci_emac_of_match[] = { |
| 2024 | {.compatible = "ti,davinci-dm6467-emac", }, | 2047 | {.compatible = "ti,davinci-dm6467-emac", }, |
| 2048 | {.compatible = "ti,am3517-emac", .data = &am3517_emac_data, }, | ||
| 2025 | {}, | 2049 | {}, |
| 2026 | }; | 2050 | }; |
| 2027 | MODULE_DEVICE_TABLE(of, davinci_emac_of_match); | 2051 | MODULE_DEVICE_TABLE(of, davinci_emac_of_match); |
