@@ -889,6 +889,22 @@ static int ravb_phy_init(struct net_device *ndev)
889
889
return - ENOENT ;
890
890
}
891
891
892
+ /* This driver only support 10/100Mbit speeds on Gen3
893
+ * at this time.
894
+ */
895
+ if (priv -> chip_id == RCAR_GEN3 ) {
896
+ int err ;
897
+
898
+ err = phy_set_max_speed (phydev , SPEED_100 );
899
+ if (err ) {
900
+ netdev_err (ndev , "failed to limit PHY to 100Mbit/s\n" );
901
+ phy_disconnect (phydev );
902
+ return err ;
903
+ }
904
+
905
+ netdev_info (ndev , "limited PHY to 100Mbit/s\n" );
906
+ }
907
+
892
908
netdev_info (ndev , "attached PHY %d (IRQ %d) to driver %s\n" ,
893
909
phydev -> addr , phydev -> irq , phydev -> drv -> name );
894
910
@@ -1197,6 +1213,15 @@ static int ravb_open(struct net_device *ndev)
1197
1213
goto out_napi_off ;
1198
1214
}
1199
1215
1216
+ if (priv -> chip_id == RCAR_GEN3 ) {
1217
+ error = request_irq (priv -> emac_irq , ravb_interrupt ,
1218
+ IRQF_SHARED , ndev -> name , ndev );
1219
+ if (error ) {
1220
+ netdev_err (ndev , "cannot request IRQ\n" );
1221
+ goto out_free_irq ;
1222
+ }
1223
+ }
1224
+
1200
1225
/* Device init */
1201
1226
error = ravb_dmac_init (ndev );
1202
1227
if (error )
@@ -1220,6 +1245,7 @@ static int ravb_open(struct net_device *ndev)
1220
1245
ravb_ptp_stop (ndev );
1221
1246
out_free_irq :
1222
1247
free_irq (ndev -> irq , ndev );
1248
+ free_irq (priv -> emac_irq , ndev );
1223
1249
out_napi_off :
1224
1250
napi_disable (& priv -> napi [RAVB_NC ]);
1225
1251
napi_disable (& priv -> napi [RAVB_BE ]);
@@ -1625,10 +1651,20 @@ static int ravb_mdio_release(struct ravb_private *priv)
1625
1651
return 0 ;
1626
1652
}
1627
1653
1654
+ static const struct of_device_id ravb_match_table [] = {
1655
+ { .compatible = "renesas,etheravb-r8a7790" , .data = (void * )RCAR_GEN2 },
1656
+ { .compatible = "renesas,etheravb-r8a7794" , .data = (void * )RCAR_GEN2 },
1657
+ { .compatible = "renesas,etheravb-r8a7795" , .data = (void * )RCAR_GEN3 },
1658
+ { }
1659
+ };
1660
+ MODULE_DEVICE_TABLE (of , ravb_match_table );
1661
+
1628
1662
static int ravb_probe (struct platform_device * pdev )
1629
1663
{
1630
1664
struct device_node * np = pdev -> dev .of_node ;
1665
+ const struct of_device_id * match ;
1631
1666
struct ravb_private * priv ;
1667
+ enum ravb_chip_id chip_id ;
1632
1668
struct net_device * ndev ;
1633
1669
int error , irq , q ;
1634
1670
struct resource * res ;
@@ -1657,7 +1693,14 @@ static int ravb_probe(struct platform_device *pdev)
1657
1693
/* The Ether-specific entries in the device structure. */
1658
1694
ndev -> base_addr = res -> start ;
1659
1695
ndev -> dma = -1 ;
1660
- irq = platform_get_irq (pdev , 0 );
1696
+
1697
+ match = of_match_device (of_match_ptr (ravb_match_table ), & pdev -> dev );
1698
+ chip_id = (enum ravb_chip_id )match -> data ;
1699
+
1700
+ if (chip_id == RCAR_GEN3 )
1701
+ irq = platform_get_irq_byname (pdev , "ch22" );
1702
+ else
1703
+ irq = platform_get_irq (pdev , 0 );
1661
1704
if (irq < 0 ) {
1662
1705
error = irq ;
1663
1706
goto out_release ;
@@ -1688,6 +1731,17 @@ static int ravb_probe(struct platform_device *pdev)
1688
1731
priv -> avb_link_active_low =
1689
1732
of_property_read_bool (np , "renesas,ether-link-active-low" );
1690
1733
1734
+ if (chip_id == RCAR_GEN3 ) {
1735
+ irq = platform_get_irq_byname (pdev , "ch24" );
1736
+ if (irq < 0 ) {
1737
+ error = irq ;
1738
+ goto out_release ;
1739
+ }
1740
+ priv -> emac_irq = irq ;
1741
+ }
1742
+
1743
+ priv -> chip_id = chip_id ;
1744
+
1691
1745
/* Set function */
1692
1746
ndev -> netdev_ops = & ravb_netdev_ops ;
1693
1747
ndev -> ethtool_ops = & ravb_ethtool_ops ;
@@ -1818,13 +1872,6 @@ static const struct dev_pm_ops ravb_dev_pm_ops = {
1818
1872
#define RAVB_PM_OPS NULL
1819
1873
#endif
1820
1874
1821
- static const struct of_device_id ravb_match_table [] = {
1822
- { .compatible = "renesas,etheravb-r8a7790" },
1823
- { .compatible = "renesas,etheravb-r8a7794" },
1824
- { }
1825
- };
1826
- MODULE_DEVICE_TABLE (of , ravb_match_table );
1827
-
1828
1875
static struct platform_driver ravb_driver = {
1829
1876
.probe = ravb_probe ,
1830
1877
.remove = ravb_remove ,
0 commit comments