Skip to content

Commit a3153d8

Browse files
Sergei Shtylyovdavem330
authored andcommitted
sh_eth: get register layout from 'struct sh_eth_cpu_data'
The register layout is a SoC characteristic, so it's wrong that it's stored in the otherwise board specific platform data. Add 'register_type' field to 'struct sh_eth_cpu_data', initialize it properly for each SoC, and read it from this structure instead of the platfrom data from now on... Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent bd61224 commit a3153d8

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎drivers/net/ethernet/renesas/sh_eth.c‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,8 @@ static struct sh_eth_cpu_data r8a777x_data = {
378378
.set_duplex = sh_eth_set_duplex,
379379
.set_rate = sh_eth_set_rate_r8a777x,
380380

381+
.register_type = SH_ETH_REG_FAST_RCAR,
382+
381383
.ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD,
382384
.ecsipr_value = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP,
383385
.eesipr_value = 0x01ff009f,
@@ -398,6 +400,8 @@ static struct sh_eth_cpu_data r8a7790_data = {
398400
.set_duplex = sh_eth_set_duplex,
399401
.set_rate = sh_eth_set_rate_r8a777x,
400402

403+
.register_type = SH_ETH_REG_FAST_RCAR,
404+
401405
.ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD,
402406
.ecsipr_value = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP,
403407
.eesipr_value = 0x01ff009f,
@@ -435,6 +439,8 @@ static struct sh_eth_cpu_data sh7724_data = {
435439
.set_duplex = sh_eth_set_duplex,
436440
.set_rate = sh_eth_set_rate_sh7724,
437441

442+
.register_type = SH_ETH_REG_FAST_SH4,
443+
438444
.ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD,
439445
.ecsipr_value = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP,
440446
.eesipr_value = 0x01ff009f,
@@ -473,6 +479,8 @@ static struct sh_eth_cpu_data sh7757_data = {
473479
.set_duplex = sh_eth_set_duplex,
474480
.set_rate = sh_eth_set_rate_sh7757,
475481

482+
.register_type = SH_ETH_REG_FAST_SH4,
483+
476484
.eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
477485
.rmcr_value = 0x00000001,
478486

@@ -541,6 +549,8 @@ static struct sh_eth_cpu_data sh7757_data_giga = {
541549
.set_duplex = sh_eth_set_duplex,
542550
.set_rate = sh_eth_set_rate_giga,
543551

552+
.register_type = SH_ETH_REG_GIGABIT,
553+
544554
.ecsr_value = ECSR_ICD | ECSR_MPD,
545555
.ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP,
546556
.eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
@@ -599,6 +609,8 @@ static struct sh_eth_cpu_data sh7734_data = {
599609
.set_duplex = sh_eth_set_duplex,
600610
.set_rate = sh_eth_set_rate_gether,
601611

612+
.register_type = SH_ETH_REG_GIGABIT,
613+
602614
.ecsr_value = ECSR_ICD | ECSR_MPD,
603615
.ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP,
604616
.eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
@@ -626,6 +638,8 @@ static struct sh_eth_cpu_data sh7763_data = {
626638
.set_duplex = sh_eth_set_duplex,
627639
.set_rate = sh_eth_set_rate_gether,
628640

641+
.register_type = SH_ETH_REG_GIGABIT,
642+
629643
.ecsr_value = ECSR_ICD | ECSR_MPD,
630644
.ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP,
631645
.eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
@@ -663,6 +677,8 @@ static struct sh_eth_cpu_data r8a7740_data = {
663677
.set_duplex = sh_eth_set_duplex,
664678
.set_rate = sh_eth_set_rate_gether,
665679

680+
.register_type = SH_ETH_REG_GIGABIT,
681+
666682
.ecsr_value = ECSR_ICD | ECSR_MPD,
667683
.ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP,
668684
.eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
@@ -685,6 +701,8 @@ static struct sh_eth_cpu_data r8a7740_data = {
685701
};
686702

687703
static struct sh_eth_cpu_data sh7619_data = {
704+
.register_type = SH_ETH_REG_FAST_SH3_SH2,
705+
688706
.eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
689707

690708
.apr = 1,
@@ -694,6 +712,8 @@ static struct sh_eth_cpu_data sh7619_data = {
694712
};
695713

696714
static struct sh_eth_cpu_data sh771x_data = {
715+
.register_type = SH_ETH_REG_FAST_SH3_SH2,
716+
697717
.eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
698718
.tsu = 1,
699719
};
@@ -2643,10 +2663,10 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
26432663
mdp->edmac_endian = pd->edmac_endian;
26442664
mdp->no_ether_link = pd->no_ether_link;
26452665
mdp->ether_link_active_low = pd->ether_link_active_low;
2646-
mdp->reg_offset = sh_eth_get_register_offset(pd->register_type);
26472666

26482667
/* set cpu data */
26492668
mdp->cd = (struct sh_eth_cpu_data *)id->driver_data;
2669+
mdp->reg_offset = sh_eth_get_register_offset(mdp->cd->register_type);
26502670
sh_eth_set_default_cpu_data(mdp->cd);
26512671

26522672
/* set function */

‎drivers/net/ethernet/renesas/sh_eth.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ struct sh_eth_cpu_data {
454454
void (*set_rate)(struct net_device *ndev);
455455

456456
/* mandatory initialize value */
457+
int register_type;
457458
unsigned long eesipr_value;
458459

459460
/* optional initialize value */

0 commit comments

Comments
 (0)