@@ -49,6 +49,13 @@ static void r8a779f0_eth_serdes_write32(void __iomem *addr, u32 offs, u32 bank,
4949 iowrite32 (data , addr + offs );
5050}
5151
52+ static u32 r8a779f0_eth_serdes_read32 (void __iomem * addr , u32 offs , u32 bank )
53+ {
54+ iowrite32 (bank , addr + R8A779F0_ETH_SERDES_BANK_SELECT );
55+
56+ return ioread32 (addr + offs );
57+ }
58+
5259static int
5360r8a779f0_eth_serdes_reg_wait (struct r8a779f0_eth_serdes_channel * channel ,
5461 u32 offs , u32 bank , u32 mask , u32 expected )
@@ -319,6 +326,7 @@ static int r8a779f0_eth_serdes_hw_init_late(struct r8a779f0_eth_serdes_channel
319326* channel )
320327{
321328 int ret ;
329+ u32 val ;
322330
323331 ret = r8a779f0_eth_serdes_chan_setting (channel );
324332 if (ret )
@@ -332,6 +340,26 @@ static int r8a779f0_eth_serdes_hw_init_late(struct r8a779f0_eth_serdes_channel
332340
333341 r8a779f0_eth_serdes_write32 (channel -> addr , 0x03d0 , 0x380 , 0x0000 );
334342
343+ val = r8a779f0_eth_serdes_read32 (channel -> addr , 0x00c0 , 0x180 );
344+ r8a779f0_eth_serdes_write32 (channel -> addr , 0x00c0 , 0x180 , val | BIT (8 ));
345+ ret = r8a779f0_eth_serdes_reg_wait (channel , 0x0100 , 0x180 , BIT (0 ), 1 );
346+ if (ret )
347+ return ret ;
348+ r8a779f0_eth_serdes_write32 (channel -> addr , 0x00c0 , 0x180 , val & ~BIT (8 ));
349+ ret = r8a779f0_eth_serdes_reg_wait (channel , 0x0100 , 0x180 , BIT (0 ), 0 );
350+ if (ret )
351+ return ret ;
352+
353+ val = r8a779f0_eth_serdes_read32 (channel -> addr , 0x0144 , 0x180 );
354+ r8a779f0_eth_serdes_write32 (channel -> addr , 0x0144 , 0x180 , val | BIT (4 ));
355+ ret = r8a779f0_eth_serdes_reg_wait (channel , 0x0180 , 0x180 , BIT (0 ), 1 );
356+ if (ret )
357+ return ret ;
358+ r8a779f0_eth_serdes_write32 (channel -> addr , 0x0144 , 0x180 , val & ~BIT (4 ));
359+ ret = r8a779f0_eth_serdes_reg_wait (channel , 0x0180 , 0x180 , BIT (0 ), 0 );
360+ if (ret )
361+ return ret ;
362+
335363 return r8a779f0_eth_serdes_monitor_linkup (channel );
336364}
337365
0 commit comments