Skip to content

Commit f5d1276

Browse files
Sergei Shtylyovdavem330
authored andcommitted
sh_eth: get SH77{34|63} support out of #ifdef
Get the SH77{34|63} specific code/data in the driver out of #ifdef by adding "sh7734-gether" and "sh7763-gether" to the platform driver's ID table. Note that we have to split the 'struct sh_eth_cpu_data' instance into two due to #ifdef inside it; note that we can kill the duplicate sh_eth_set_rate_gether(). Change the GEther platform device's name in the SH platform code accordingly. Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e5c9b4c commit f5d1276

4 files changed

Lines changed: 39 additions & 34 deletions

File tree

‎arch/sh/boards/board-espt.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static struct sh_eth_plat_data sh7763_eth_pdata = {
8585
};
8686

8787
static struct platform_device espt_eth_device = {
88-
.name = "sh-eth",
88+
.name = "sh7763-gether",
8989
.resource = sh_eth_resources,
9090
.num_resources = ARRAY_SIZE(sh_eth_resources),
9191
.dev = {

‎arch/sh/boards/mach-sh7763rdp/setup.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static struct sh_eth_plat_data sh7763_eth_pdata = {
9393
};
9494

9595
static struct platform_device sh7763rdp_eth_device = {
96-
.name = "sh-eth",
96+
.name = "sh7763-gether",
9797
.resource = sh_eth_resources,
9898
.num_resources = ARRAY_SIZE(sh_eth_resources),
9999
.dev = {

‎arch/sh/kernel/cpu/sh4a/clock-sh7734.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ static struct clk_lookup lookups[] = {
238238
CLKDEV_CON_ID("adc0", &mstp_clks[MSTP313]),
239239
CLKDEV_CON_ID("mtu0", &mstp_clks[MSTP312]),
240240
CLKDEV_CON_ID("iebus0", &mstp_clks[MSTP304]),
241-
CLKDEV_DEV_ID("sh-eth.0", &mstp_clks[MSTP114]),
241+
CLKDEV_DEV_ID("sh7734-gether.0", &mstp_clks[MSTP114]),
242242
CLKDEV_CON_ID("rtc0", &mstp_clks[MSTP303]),
243243
CLKDEV_CON_ID("hif0", &mstp_clks[MSTP302]),
244244
CLKDEV_CON_ID("stif0", &mstp_clks[MSTP301]),

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

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,7 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp)
556556
else
557557
return &sh_eth_my_cpu_data;
558558
}
559-
560-
#elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
559+
#endif
561560

562561
static void sh_eth_chip_reset(struct net_device *ndev)
563562
{
@@ -568,7 +567,7 @@ static void sh_eth_chip_reset(struct net_device *ndev)
568567
mdelay(1);
569568
}
570569

571-
static void sh_eth_set_rate(struct net_device *ndev)
570+
static void sh_eth_set_rate_gether(struct net_device *ndev)
572571
{
573572
struct sh_eth_private *mdp = netdev_priv(ndev);
574573

@@ -587,11 +586,40 @@ static void sh_eth_set_rate(struct net_device *ndev)
587586
}
588587
}
589588

590-
/* sh7763 */
591-
static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
589+
/* SH7734 */
590+
static struct sh_eth_cpu_data sh7734_data = {
592591
.chip_reset = sh_eth_chip_reset,
593592
.set_duplex = sh_eth_set_duplex,
594-
.set_rate = sh_eth_set_rate,
593+
.set_rate = sh_eth_set_rate_gether,
594+
595+
.ecsr_value = ECSR_ICD | ECSR_MPD,
596+
.ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP,
597+
.eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
598+
599+
.tx_check = EESR_TC1 | EESR_FTC,
600+
.eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | \
601+
EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | \
602+
EESR_ECI,
603+
.tx_error_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_TDE | \
604+
EESR_TFE,
605+
606+
.apr = 1,
607+
.mpr = 1,
608+
.tpauser = 1,
609+
.bculr = 1,
610+
.hw_swap = 1,
611+
.no_trimd = 1,
612+
.no_ade = 1,
613+
.tsu = 1,
614+
.hw_crc = 1,
615+
.select_mii = 1,
616+
};
617+
618+
/* SH7763 */
619+
static struct sh_eth_cpu_data sh7763_data = {
620+
.chip_reset = sh_eth_chip_reset,
621+
.set_duplex = sh_eth_set_duplex,
622+
.set_rate = sh_eth_set_rate_gether,
595623

596624
.ecsr_value = ECSR_ICD | ECSR_MPD,
597625
.ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP,
@@ -612,14 +640,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
612640
.no_trimd = 1,
613641
.no_ade = 1,
614642
.tsu = 1,
615-
#if defined(CONFIG_CPU_SUBTYPE_SH7734)
616-
.hw_crc = 1,
617-
.select_mii = 1,
618-
#else
619643
.irq_flags = IRQF_SHARED,
620-
#endif
621644
};
622-
#endif
623645

624646
static void sh_eth_chip_reset_r8a7740(struct net_device *ndev)
625647
{
@@ -632,25 +654,6 @@ static void sh_eth_chip_reset_r8a7740(struct net_device *ndev)
632654
sh_eth_select_mii(ndev);
633655
}
634656

635-
static void sh_eth_set_rate_gether(struct net_device *ndev)
636-
{
637-
struct sh_eth_private *mdp = netdev_priv(ndev);
638-
639-
switch (mdp->speed) {
640-
case 10: /* 10BASE */
641-
sh_eth_write(ndev, GECMR_10, GECMR);
642-
break;
643-
case 100:/* 100BASE */
644-
sh_eth_write(ndev, GECMR_100, GECMR);
645-
break;
646-
case 1000: /* 1000BASE */
647-
sh_eth_write(ndev, GECMR_1000, GECMR);
648-
break;
649-
default:
650-
break;
651-
}
652-
}
653-
654657
/* R8A7740 */
655658
static struct sh_eth_cpu_data r8a7740_data = {
656659
.chip_reset = sh_eth_chip_reset_r8a7740,
@@ -2698,6 +2701,8 @@ static const struct dev_pm_ops sh_eth_dev_pm_ops = {
26982701
static struct platform_device_id sh_eth_id_table[] = {
26992702
{ "sh7619-ether", (kernel_ulong_t)&sh7619_data },
27002703
{ "sh771x-ether", (kernel_ulong_t)&sh771x_data },
2704+
{ "sh7734-gether", (kernel_ulong_t)&sh7734_data },
2705+
{ "sh7763-gether", (kernel_ulong_t)&sh7763_data },
27012706
{ "r8a7740-gether", (kernel_ulong_t)&r8a7740_data },
27022707
{ CARDNAME },
27032708
{ }

0 commit comments

Comments
 (0)