@@ -143,6 +143,65 @@ static const u16 sh_eth_offset_gigabit[SH_ETH_MAX_REGISTER_OFFSET] = {
143143 [FWALCR1 ] = 0x00b4 ,
144144};
145145
146+ static const u16 sh_eth_offset_fast_rz [SH_ETH_MAX_REGISTER_OFFSET ] = {
147+ [EDSR ] = 0x0000 ,
148+ [EDMR ] = 0x0400 ,
149+ [EDTRR ] = 0x0408 ,
150+ [EDRRR ] = 0x0410 ,
151+ [EESR ] = 0x0428 ,
152+ [EESIPR ] = 0x0430 ,
153+ [TDLAR ] = 0x0010 ,
154+ [TDFAR ] = 0x0014 ,
155+ [TDFXR ] = 0x0018 ,
156+ [TDFFR ] = 0x001c ,
157+ [RDLAR ] = 0x0030 ,
158+ [RDFAR ] = 0x0034 ,
159+ [RDFXR ] = 0x0038 ,
160+ [RDFFR ] = 0x003c ,
161+ [TRSCER ] = 0x0438 ,
162+ [RMFCR ] = 0x0440 ,
163+ [TFTR ] = 0x0448 ,
164+ [FDR ] = 0x0450 ,
165+ [RMCR ] = 0x0458 ,
166+ [RPADIR ] = 0x0460 ,
167+ [FCFTR ] = 0x0468 ,
168+ [CSMR ] = 0x04E4 ,
169+
170+ [ECMR ] = 0x0500 ,
171+ [RFLR ] = 0x0508 ,
172+ [ECSR ] = 0x0510 ,
173+ [ECSIPR ] = 0x0518 ,
174+ [PIR ] = 0x0520 ,
175+ [APR ] = 0x0554 ,
176+ [MPR ] = 0x0558 ,
177+ [PFTCR ] = 0x055c ,
178+ [PFRCR ] = 0x0560 ,
179+ [TPAUSER ] = 0x0564 ,
180+ [MAHR ] = 0x05c0 ,
181+ [MALR ] = 0x05c8 ,
182+ [CEFCR ] = 0x0740 ,
183+ [FRECR ] = 0x0748 ,
184+ [TSFRCR ] = 0x0750 ,
185+ [TLFRCR ] = 0x0758 ,
186+ [RFCR ] = 0x0760 ,
187+ [MAFCR ] = 0x0778 ,
188+
189+ [ARSTR ] = 0x0000 ,
190+ [TSU_CTRST ] = 0x0004 ,
191+ [TSU_VTAG0 ] = 0x0058 ,
192+ [TSU_ADSBSY ] = 0x0060 ,
193+ [TSU_TEN ] = 0x0064 ,
194+ [TSU_ADRH0 ] = 0x0100 ,
195+ [TSU_ADRL0 ] = 0x0104 ,
196+ [TSU_ADRH31 ] = 0x01f8 ,
197+ [TSU_ADRL31 ] = 0x01fc ,
198+
199+ [TXNLCR0 ] = 0x0080 ,
200+ [TXALCR0 ] = 0x0084 ,
201+ [RXNLCR0 ] = 0x0088 ,
202+ [RXALCR0 ] = 0x008C ,
203+ };
204+
146205static const u16 sh_eth_offset_fast_rcar [SH_ETH_MAX_REGISTER_OFFSET ] = {
147206 [ECMR ] = 0x0300 ,
148207 [RFLR ] = 0x0308 ,
@@ -314,6 +373,11 @@ static bool sh_eth_is_gether(struct sh_eth_private *mdp)
314373 return mdp -> reg_offset == sh_eth_offset_gigabit ;
315374}
316375
376+ static bool sh_eth_is_rz_fast_ether (struct sh_eth_private * mdp )
377+ {
378+ return mdp -> reg_offset == sh_eth_offset_fast_rz ;
379+ }
380+
317381static void sh_eth_select_mii (struct net_device * ndev )
318382{
319383 u32 value = 0x0 ;
@@ -697,6 +761,38 @@ static struct sh_eth_cpu_data r8a7740_data = {
697761 .shift_rd0 = 1 ,
698762};
699763
764+ /* R7S72100 */
765+ static struct sh_eth_cpu_data r7s72100_data = {
766+ .chip_reset = sh_eth_chip_reset ,
767+ .set_duplex = sh_eth_set_duplex ,
768+
769+ .register_type = SH_ETH_REG_FAST_RZ ,
770+
771+ .ecsr_value = ECSR_ICD ,
772+ .ecsipr_value = ECSIPR_ICDIP ,
773+ .eesipr_value = 0xff7f009f ,
774+
775+ .tx_check = EESR_TC1 | EESR_FTC ,
776+ .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
777+ EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
778+ EESR_TDE | EESR_ECI ,
779+ .fdr_value = 0x0000070f ,
780+ .rmcr_value = RMCR_RNC ,
781+
782+ .no_psr = 1 ,
783+ .apr = 1 ,
784+ .mpr = 1 ,
785+ .tpauser = 1 ,
786+ .hw_swap = 1 ,
787+ .rpadir = 1 ,
788+ .rpadir_value = 2 << 16 ,
789+ .no_trimd = 1 ,
790+ .no_ade = 1 ,
791+ .hw_crc = 1 ,
792+ .tsu = 1 ,
793+ .shift_rd0 = 1 ,
794+ };
795+
700796static struct sh_eth_cpu_data sh7619_data = {
701797 .register_type = SH_ETH_REG_FAST_SH3_SH2 ,
702798
@@ -763,7 +859,7 @@ static int sh_eth_reset(struct net_device *ndev)
763859 struct sh_eth_private * mdp = netdev_priv (ndev );
764860 int ret = 0 ;
765861
766- if (sh_eth_is_gether (mdp )) {
862+ if (sh_eth_is_gether (mdp ) || sh_eth_is_rz_fast_ether ( mdp ) ) {
767863 sh_eth_write (ndev , EDSR_ENALL , EDSR );
768864 sh_eth_write (ndev , sh_eth_read (ndev , EDMR ) | EDMR_SRST_GETHER ,
769865 EDMR );
@@ -874,7 +970,7 @@ static void read_mac_address(struct net_device *ndev, unsigned char *mac)
874970
875971static unsigned long sh_eth_get_edtrr_trns (struct sh_eth_private * mdp )
876972{
877- if (sh_eth_is_gether (mdp ))
973+ if (sh_eth_is_gether (mdp ) || sh_eth_is_rz_fast_ether ( mdp ) )
878974 return EDTRR_TRNS_GETHER ;
879975 else
880976 return EDTRR_TRNS_ETHER ;
@@ -1037,7 +1133,8 @@ static void sh_eth_ring_format(struct net_device *ndev)
10371133 /* Rx descriptor address set */
10381134 if (i == 0 ) {
10391135 sh_eth_write (ndev , mdp -> rx_desc_dma , RDLAR );
1040- if (sh_eth_is_gether (mdp ))
1136+ if (sh_eth_is_gether (mdp ) ||
1137+ sh_eth_is_rz_fast_ether (mdp ))
10411138 sh_eth_write (ndev , mdp -> rx_desc_dma , RDFAR );
10421139 }
10431140 }
@@ -1058,7 +1155,8 @@ static void sh_eth_ring_format(struct net_device *ndev)
10581155 if (i == 0 ) {
10591156 /* Tx descriptor address set */
10601157 sh_eth_write (ndev , mdp -> tx_desc_dma , TDLAR );
1061- if (sh_eth_is_gether (mdp ))
1158+ if (sh_eth_is_gether (mdp ) ||
1159+ sh_eth_is_rz_fast_ether (mdp ))
10621160 sh_eth_write (ndev , mdp -> tx_desc_dma , TDFAR );
10631161 }
10641162 }
@@ -1305,9 +1403,9 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
13051403
13061404 /* In case of almost all GETHER/ETHERs, the Receive Frame State
13071405 * (RFS) bits in the Receive Descriptor 0 are from bit 9 to
1308- * bit 0. However, in case of the R8A7740's GETHER, the RFS
1309- * bits are from bit 25 to bit 16. So, the driver needs right
1310- * shifting by 16.
1406+ * bit 0. However, in case of the R8A7740, R8A779x, and
1407+ * R7S72100 the RFS bits are from bit 25 to bit 16. So, the
1408+ * driver needs right shifting by 16.
13111409 */
13121410 if (mdp -> cd -> shift_rd0 )
13131411 desc_status >>= 16 ;
@@ -2057,6 +2155,9 @@ static struct net_device_stats *sh_eth_get_stats(struct net_device *ndev)
20572155{
20582156 struct sh_eth_private * mdp = netdev_priv (ndev );
20592157
2158+ if (sh_eth_is_rz_fast_ether (mdp ))
2159+ return & ndev -> stats ;
2160+
20602161 pm_runtime_get_sync (& mdp -> pdev -> dev );
20612162
20622163 ndev -> stats .tx_dropped += sh_eth_read (ndev , TROCR );
@@ -2438,6 +2539,11 @@ static int sh_eth_vlan_rx_kill_vid(struct net_device *ndev,
24382539/* SuperH's TSU register init function */
24392540static void sh_eth_tsu_init (struct sh_eth_private * mdp )
24402541{
2542+ if (sh_eth_is_rz_fast_ether (mdp )) {
2543+ sh_eth_tsu_write (mdp , 0 , TSU_TEN ); /* Disable all CAM entry */
2544+ return ;
2545+ }
2546+
24412547 sh_eth_tsu_write (mdp , 0 , TSU_FWEN0 ); /* Disable forward(0->1) */
24422548 sh_eth_tsu_write (mdp , 0 , TSU_FWEN1 ); /* Disable forward(1->0) */
24432549 sh_eth_tsu_write (mdp , 0 , TSU_FCM ); /* forward fifo 3k-3k */
@@ -2557,6 +2663,9 @@ static const u16 *sh_eth_get_register_offset(int register_type)
25572663 case SH_ETH_REG_GIGABIT :
25582664 reg_offset = sh_eth_offset_gigabit ;
25592665 break ;
2666+ case SH_ETH_REG_FAST_RZ :
2667+ reg_offset = sh_eth_offset_fast_rz ;
2668+ break ;
25602669 case SH_ETH_REG_FAST_RCAR :
25612670 reg_offset = sh_eth_offset_fast_rcar ;
25622671 break ;
@@ -2795,6 +2904,7 @@ static struct platform_device_id sh_eth_id_table[] = {
27952904 { "sh7757-ether" , (kernel_ulong_t )& sh7757_data },
27962905 { "sh7757-gether" , (kernel_ulong_t )& sh7757_data_giga },
27972906 { "sh7763-gether" , (kernel_ulong_t )& sh7763_data },
2907+ { "r7s72100-ether" , (kernel_ulong_t )& r7s72100_data },
27982908 { "r8a7740-gether" , (kernel_ulong_t )& r8a7740_data },
27992909 { "r8a777x-ether" , (kernel_ulong_t )& r8a777x_data },
28002910 { "r8a7790-ether" , (kernel_ulong_t )& r8a779x_data },
0 commit comments