diff options
Diffstat (limited to 'drivers/net/sh_eth.c')
-rw-r--r-- | drivers/net/sh_eth.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index dcf9f87d021f..e9e7a530552c 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c | |||
@@ -512,6 +512,7 @@ static unsigned long sh_eth_get_edtrr_trns(struct sh_eth_private *mdp) | |||
512 | } | 512 | } |
513 | 513 | ||
514 | struct bb_info { | 514 | struct bb_info { |
515 | void (*set_gate)(unsigned long addr); | ||
515 | struct mdiobb_ctrl ctrl; | 516 | struct mdiobb_ctrl ctrl; |
516 | u32 addr; | 517 | u32 addr; |
517 | u32 mmd_msk;/* MMD */ | 518 | u32 mmd_msk;/* MMD */ |
@@ -542,6 +543,10 @@ static int bb_read(u32 addr, u32 msk) | |||
542 | static void sh_mmd_ctrl(struct mdiobb_ctrl *ctrl, int bit) | 543 | static void sh_mmd_ctrl(struct mdiobb_ctrl *ctrl, int bit) |
543 | { | 544 | { |
544 | struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl); | 545 | struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl); |
546 | |||
547 | if (bitbang->set_gate) | ||
548 | bitbang->set_gate(bitbang->addr); | ||
549 | |||
545 | if (bit) | 550 | if (bit) |
546 | bb_set(bitbang->addr, bitbang->mmd_msk); | 551 | bb_set(bitbang->addr, bitbang->mmd_msk); |
547 | else | 552 | else |
@@ -553,6 +558,9 @@ static void sh_set_mdio(struct mdiobb_ctrl *ctrl, int bit) | |||
553 | { | 558 | { |
554 | struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl); | 559 | struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl); |
555 | 560 | ||
561 | if (bitbang->set_gate) | ||
562 | bitbang->set_gate(bitbang->addr); | ||
563 | |||
556 | if (bit) | 564 | if (bit) |
557 | bb_set(bitbang->addr, bitbang->mdo_msk); | 565 | bb_set(bitbang->addr, bitbang->mdo_msk); |
558 | else | 566 | else |
@@ -563,6 +571,10 @@ static void sh_set_mdio(struct mdiobb_ctrl *ctrl, int bit) | |||
563 | static int sh_get_mdio(struct mdiobb_ctrl *ctrl) | 571 | static int sh_get_mdio(struct mdiobb_ctrl *ctrl) |
564 | { | 572 | { |
565 | struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl); | 573 | struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl); |
574 | |||
575 | if (bitbang->set_gate) | ||
576 | bitbang->set_gate(bitbang->addr); | ||
577 | |||
566 | return bb_read(bitbang->addr, bitbang->mdi_msk); | 578 | return bb_read(bitbang->addr, bitbang->mdi_msk); |
567 | } | 579 | } |
568 | 580 | ||
@@ -571,6 +583,9 @@ static void sh_mdc_ctrl(struct mdiobb_ctrl *ctrl, int bit) | |||
571 | { | 583 | { |
572 | struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl); | 584 | struct bb_info *bitbang = container_of(ctrl, struct bb_info, ctrl); |
573 | 585 | ||
586 | if (bitbang->set_gate) | ||
587 | bitbang->set_gate(bitbang->addr); | ||
588 | |||
574 | if (bit) | 589 | if (bit) |
575 | bb_set(bitbang->addr, bitbang->mdc_msk); | 590 | bb_set(bitbang->addr, bitbang->mdc_msk); |
576 | else | 591 | else |
@@ -1646,7 +1661,8 @@ static int sh_mdio_release(struct net_device *ndev) | |||
1646 | } | 1661 | } |
1647 | 1662 | ||
1648 | /* MDIO bus init function */ | 1663 | /* MDIO bus init function */ |
1649 | static int sh_mdio_init(struct net_device *ndev, int id) | 1664 | static int sh_mdio_init(struct net_device *ndev, int id, |
1665 | struct sh_eth_plat_data *pd) | ||
1650 | { | 1666 | { |
1651 | int ret, i; | 1667 | int ret, i; |
1652 | struct bb_info *bitbang; | 1668 | struct bb_info *bitbang; |
@@ -1661,6 +1677,7 @@ static int sh_mdio_init(struct net_device *ndev, int id) | |||
1661 | 1677 | ||
1662 | /* bitbang init */ | 1678 | /* bitbang init */ |
1663 | bitbang->addr = ndev->base_addr + mdp->reg_offset[PIR]; | 1679 | bitbang->addr = ndev->base_addr + mdp->reg_offset[PIR]; |
1680 | bitbang->set_gate = pd->set_mdio_gate; | ||
1664 | bitbang->mdi_msk = 0x08; | 1681 | bitbang->mdi_msk = 0x08; |
1665 | bitbang->mdo_msk = 0x04; | 1682 | bitbang->mdo_msk = 0x04; |
1666 | bitbang->mmd_msk = 0x02;/* MMD */ | 1683 | bitbang->mmd_msk = 0x02;/* MMD */ |
@@ -1854,7 +1871,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) | |||
1854 | goto out_release; | 1871 | goto out_release; |
1855 | 1872 | ||
1856 | /* mdio bus init */ | 1873 | /* mdio bus init */ |
1857 | ret = sh_mdio_init(ndev, pdev->id); | 1874 | ret = sh_mdio_init(ndev, pdev->id, pd); |
1858 | if (ret) | 1875 | if (ret) |
1859 | goto out_unregister; | 1876 | goto out_unregister; |
1860 | 1877 | ||