Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sergei Shtylyov and committed by
David S. Miller
a3153d8c bd61224b

+22 -1
+21 -1
drivers/net/ethernet/renesas/sh_eth.c
··· 378 378 .set_duplex = sh_eth_set_duplex, 379 379 .set_rate = sh_eth_set_rate_r8a777x, 380 380 381 + .register_type = SH_ETH_REG_FAST_RCAR, 382 + 381 383 .ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD, 382 384 .ecsipr_value = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP, 383 385 .eesipr_value = 0x01ff009f, ··· 399 397 static struct sh_eth_cpu_data r8a7790_data = { 400 398 .set_duplex = sh_eth_set_duplex, 401 399 .set_rate = sh_eth_set_rate_r8a777x, 400 + 401 + .register_type = SH_ETH_REG_FAST_RCAR, 402 402 403 403 .ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD, 404 404 .ecsipr_value = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP, ··· 439 435 .set_duplex = sh_eth_set_duplex, 440 436 .set_rate = sh_eth_set_rate_sh7724, 441 437 438 + .register_type = SH_ETH_REG_FAST_SH4, 439 + 442 440 .ecsr_value = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD, 443 441 .ecsipr_value = ECSIPR_PSRTOIP | ECSIPR_LCHNGIP | ECSIPR_ICDIP, 444 442 .eesipr_value = 0x01ff009f, ··· 478 472 static struct sh_eth_cpu_data sh7757_data = { 479 473 .set_duplex = sh_eth_set_duplex, 480 474 .set_rate = sh_eth_set_rate_sh7757, 475 + 476 + .register_type = SH_ETH_REG_FAST_SH4, 481 477 482 478 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, 483 479 .rmcr_value = 0x00000001, ··· 549 541 .set_duplex = sh_eth_set_duplex, 550 542 .set_rate = sh_eth_set_rate_giga, 551 543 544 + .register_type = SH_ETH_REG_GIGABIT, 545 + 552 546 .ecsr_value = ECSR_ICD | ECSR_MPD, 553 547 .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, 554 548 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, ··· 609 599 .set_duplex = sh_eth_set_duplex, 610 600 .set_rate = sh_eth_set_rate_gether, 611 601 602 + .register_type = SH_ETH_REG_GIGABIT, 603 + 612 604 .ecsr_value = ECSR_ICD | ECSR_MPD, 613 605 .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, 614 606 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, ··· 637 625 .chip_reset = sh_eth_chip_reset, 638 626 .set_duplex = sh_eth_set_duplex, 639 627 .set_rate = sh_eth_set_rate_gether, 628 + 629 + .register_type = SH_ETH_REG_GIGABIT, 640 630 641 631 .ecsr_value = ECSR_ICD | ECSR_MPD, 642 632 .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, ··· 677 663 .set_duplex = sh_eth_set_duplex, 678 664 .set_rate = sh_eth_set_rate_gether, 679 665 666 + .register_type = SH_ETH_REG_GIGABIT, 667 + 680 668 .ecsr_value = ECSR_ICD | ECSR_MPD, 681 669 .ecsipr_value = ECSIPR_LCHNGIP | ECSIPR_ICDIP | ECSIPR_MPDIP, 682 670 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, ··· 701 685 }; 702 686 703 687 static struct sh_eth_cpu_data sh7619_data = { 688 + .register_type = SH_ETH_REG_FAST_SH3_SH2, 689 + 704 690 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, 705 691 706 692 .apr = 1, ··· 712 694 }; 713 695 714 696 static struct sh_eth_cpu_data sh771x_data = { 697 + .register_type = SH_ETH_REG_FAST_SH3_SH2, 698 + 715 699 .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff, 716 700 .tsu = 1, 717 701 }; ··· 2663 2643 mdp->edmac_endian = pd->edmac_endian; 2664 2644 mdp->no_ether_link = pd->no_ether_link; 2665 2645 mdp->ether_link_active_low = pd->ether_link_active_low; 2666 - mdp->reg_offset = sh_eth_get_register_offset(pd->register_type); 2667 2646 2668 2647 /* set cpu data */ 2669 2648 mdp->cd = (struct sh_eth_cpu_data *)id->driver_data; 2649 + mdp->reg_offset = sh_eth_get_register_offset(mdp->cd->register_type); 2670 2650 sh_eth_set_default_cpu_data(mdp->cd); 2671 2651 2672 2652 /* set function */
+1
drivers/net/ethernet/renesas/sh_eth.h
··· 454 454 void (*set_rate)(struct net_device *ndev); 455 455 456 456 /* mandatory initialize value */ 457 + int register_type; 457 458 unsigned long eesipr_value; 458 459 459 460 /* optional initialize value */