@@ -1651,6 +1651,7 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
16511651 struct net_device * dev ;
16521652 struct device_node * dn = pdev -> dev .of_node ;
16531653 struct rtl838x_eth_priv * priv ;
1654+ const struct rtl838x_eth_reg * matchdata ;
16541655 phy_interface_t phy_mode ;
16551656 struct phylink * phylink ;
16561657 u8 mac_addr [ETH_ALEN ];
@@ -1665,8 +1666,10 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
16651666 return - EINVAL ;
16661667 }
16671668
1668- rxrings = (soc_info .family == RTL8380_FAMILY_ID
1669- || soc_info .family == RTL8390_FAMILY_ID ) ? 8 : 32 ;
1669+ matchdata = (const struct rtl838x_eth_reg * )device_get_match_data (& pdev -> dev );
1670+
1671+ rxrings = (matchdata -> family_id == RTL8380_FAMILY_ID ||
1672+ matchdata -> family_id == RTL8390_FAMILY_ID ) ? 8 : 32 ;
16701673 rxrings = rxrings > MAX_RXRINGS ? MAX_RXRINGS : rxrings ;
16711674 rxringlen = MAX_ENTRIES / rxrings ;
16721675 rxringlen = rxringlen > MAX_RXLEN ? MAX_RXLEN : rxringlen ;
@@ -1676,6 +1679,7 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
16761679 return - ENOMEM ;
16771680 SET_NETDEV_DEV (dev , & pdev -> dev );
16781681 priv = netdev_priv (dev );
1682+ priv -> r = matchdata ;
16791683
16801684 /* Allocate buffer memory */
16811685 priv -> membase = dmam_alloc_coherent (& pdev -> dev , rxrings * rxringlen * RING_BUFFER +
@@ -1711,22 +1715,18 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
17111715 switch (priv -> family_id ) {
17121716 case RTL8380_FAMILY_ID :
17131717 priv -> cpu_port = RTL838X_CPU_PORT ;
1714- priv -> r = & rtl838x_reg ;
17151718 dev -> netdev_ops = & rtl838x_eth_netdev_ops ;
17161719 break ;
17171720 case RTL8390_FAMILY_ID :
17181721 priv -> cpu_port = RTL839X_CPU_PORT ;
1719- priv -> r = & rtl839x_reg ;
17201722 dev -> netdev_ops = & rtl839x_eth_netdev_ops ;
17211723 break ;
17221724 case RTL9300_FAMILY_ID :
17231725 priv -> cpu_port = RTL930X_CPU_PORT ;
1724- priv -> r = & rtl930x_reg ;
17251726 dev -> netdev_ops = & rtl930x_eth_netdev_ops ;
17261727 break ;
17271728 case RTL9310_FAMILY_ID :
17281729 priv -> cpu_port = RTL931X_CPU_PORT ;
1729- priv -> r = & rtl931x_reg ;
17301730 dev -> netdev_ops = & rtl931x_eth_netdev_ops ;
17311731 rtl931x_chip_init (priv );
17321732 break ;
@@ -1842,10 +1842,22 @@ static void rtl838x_eth_remove(struct platform_device *pdev)
18421842}
18431843
18441844static const struct of_device_id rtl838x_eth_of_ids [] = {
1845- { .compatible = "realtek,rtl8380-eth" },
1846- { .compatible = "realtek,rtl8392-eth" },
1847- { .compatible = "realtek,rtl9301-eth" },
1848- { .compatible = "realtek,rtl9311-eth" },
1845+ {
1846+ .compatible = "realtek,rtl8380-eth" ,
1847+ .data = & rtl838x_reg ,
1848+ },
1849+ {
1850+ .compatible = "realtek,rtl8392-eth" ,
1851+ .data = & rtl839x_reg ,
1852+ },
1853+ {
1854+ .compatible = "realtek,rtl9301-eth" ,
1855+ .data = & rtl930x_reg ,
1856+ },
1857+ {
1858+ .compatible = "realtek,rtl9311-eth" ,
1859+ .data = & rtl931x_reg ,
1860+ },
18491861 { /* sentinel */ }
18501862};
18511863MODULE_DEVICE_TABLE (of , rtl838x_eth_of_ids );
0 commit comments