diff options
author | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> | 2013-06-07 09:58:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-08 02:38:24 -0400 |
commit | f5d12767c8fd77e29d3d6771de59fd9ac3e540bb (patch) | |
tree | 11130a56372afa05518735c115c0198b47c13fb5 /drivers/net/ethernet/renesas | |
parent | e5c9b4cd665106d9b5397114ea81a53059410b6a (diff) |
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>
Diffstat (limited to 'drivers/net/ethernet/renesas')
-rw-r--r-- | drivers/net/ethernet/renesas/sh_eth.c | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index da620ecd4151..6d44a43e5884 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c | |||
@@ -556,8 +556,7 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp) | |||
556 | else | 556 | else |
557 | return &sh_eth_my_cpu_data; | 557 | return &sh_eth_my_cpu_data; |
558 | } | 558 | } |
559 | 559 | #endif | |
560 | #elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) | ||
561 | 560 | ||
562 | static void sh_eth_chip_reset(struct net_device *ndev) | 561 | static void sh_eth_chip_reset(struct net_device *ndev) |
563 | { | 562 | { |
@@ -568,7 +567,7 @@ static void sh_eth_chip_reset(struct net_device *ndev) | |||
568 | mdelay(1); | 567 | mdelay(1); |
569 | } | 568 | } |
570 | 569 | ||
571 | static void sh_eth_set_rate(struct net_device *ndev) | 570 | static void sh_eth_set_rate_gether(struct net_device *ndev) |
572 | { | 571 | { |
573 | struct sh_eth_private *mdp = netdev_priv(ndev); | 572 | struct sh_eth_private *mdp = netdev_priv(ndev); |
574 | 573 | ||
@@ -587,11 +586,40 @@ static void sh_eth_set_rate(struct net_device *ndev) | |||
587 | } | 586 | } |
588 | } | 587 | } |
589 | 588 | ||
590 | /* sh7763 */ | 589 | /* SH7734 */ |
591 | static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | 590 | static struct sh_eth_cpu_data sh7734_data = { |
592 | .chip_reset = sh_eth_chip_reset, | 591 | .chip_reset = sh_eth_chip_reset, |
593 | .set_duplex = sh_eth_set_duplex, | 592 | .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, | ||
595 | 623 | ||
596 | .ecsr_value = ECSR_ICD | ECSR_MPD, | 624 | .ecsr_value = ECSR_ICD | ECSR_MPD, |
597 | .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, | 625 | .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, |
@@ -612,14 +640,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = { | |||
612 | .no_trimd = 1, | 640 | .no_trimd = 1, |
613 | .no_ade = 1, | 641 | .no_ade = 1, |
614 | .tsu = 1, | 642 | .tsu = 1, |
615 | #if defined(CONFIG_CPU_SUBTYPE_SH7734) | ||
616 | .hw_crc = 1, | ||
617 | .select_mii = 1, | ||
618 | #else | ||
619 | .irq_flags = IRQF_SHARED, | 643 | .irq_flags = IRQF_SHARED, |
620 | #endif | ||
621 | }; | 644 | }; |
622 | #endif | ||
623 | 645 | ||
624 | static void sh_eth_chip_reset_r8a7740(struct net_device *ndev) | 646 | static void sh_eth_chip_reset_r8a7740(struct net_device *ndev) |
625 | { | 647 | { |
@@ -632,25 +654,6 @@ static void sh_eth_chip_reset_r8a7740(struct net_device *ndev) | |||
632 | sh_eth_select_mii(ndev); | 654 | sh_eth_select_mii(ndev); |
633 | } | 655 | } |
634 | 656 | ||
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 | |||
654 | /* R8A7740 */ | 657 | /* R8A7740 */ |
655 | static struct sh_eth_cpu_data r8a7740_data = { | 658 | static struct sh_eth_cpu_data r8a7740_data = { |
656 | .chip_reset = sh_eth_chip_reset_r8a7740, | 659 | .chip_reset = sh_eth_chip_reset_r8a7740, |
@@ -2698,6 +2701,8 @@ static const struct dev_pm_ops sh_eth_dev_pm_ops = { | |||
2698 | static struct platform_device_id sh_eth_id_table[] = { | 2701 | static struct platform_device_id sh_eth_id_table[] = { |
2699 | { "sh7619-ether", (kernel_ulong_t)&sh7619_data }, | 2702 | { "sh7619-ether", (kernel_ulong_t)&sh7619_data }, |
2700 | { "sh771x-ether", (kernel_ulong_t)&sh771x_data }, | 2703 | { "sh771x-ether", (kernel_ulong_t)&sh771x_data }, |
2704 | { "sh7734-gether", (kernel_ulong_t)&sh7734_data }, | ||
2705 | { "sh7763-gether", (kernel_ulong_t)&sh7763_data }, | ||
2701 | { "r8a7740-gether", (kernel_ulong_t)&r8a7740_data }, | 2706 | { "r8a7740-gether", (kernel_ulong_t)&r8a7740_data }, |
2702 | { CARDNAME }, | 2707 | { CARDNAME }, |
2703 | { } | 2708 | { } |