diff options
author | Marek Vasut <marek.vasut+renesas@gmail.com> | 2018-01-21 15:31:48 +0100 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2018-01-27 20:38:53 +0100 |
commit | a220784b1421546da3c80db71b8f808471c86e02 (patch) | |
tree | 14e7c4cd1d131c312f0b009dfef165609a89b6c6 /drivers | |
parent | 013af64f8f0d01d16acee1eca9a7f4097d6a1b95 (diff) |
net: sh_eth: Clump legacy functions together
Move the legacy functions around, so that they can be wrapped in a
massive ifdef CONFIG_DM_ETH once DM support is added. No functional
change.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/sh_eth.c | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 47d25c550e..8442fc9a2f 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -111,13 +111,6 @@ err: return ret; } -static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len) -{ - struct sh_eth_dev *eth = dev->priv; - - return sh_eth_send_common(eth, packet, len); -} - static int sh_eth_recv_start(struct sh_eth_dev *eth) { int port = eth->port, len = 0; @@ -157,34 +150,6 @@ static void sh_eth_recv_finish(struct sh_eth_dev *eth) port_info->rx_desc_cur = port_info->rx_desc_base; } -static int sh_eth_recv_common(struct sh_eth_dev *eth) -{ - int port = eth->port, len = 0; - struct sh_eth_info *port_info = ð->port_info[port]; - uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2); - - len = sh_eth_recv_start(eth); - if (len > 0) { - invalidate_cache(packet, len); - net_process_received_packet(packet, len); - sh_eth_recv_finish(eth); - } else - len = 0; - - /* Restart the receiver if disabled */ - if (!(sh_eth_read(port_info, EDRRR) & EDRRR_R)) - sh_eth_write(port_info, EDRRR_R, EDRRR); - - return len; -} - -static int sh_eth_recv_legacy(struct eth_device *dev) -{ - struct sh_eth_dev *eth = dev->priv; - - return sh_eth_recv_common(eth); -} - static int sh_eth_reset(struct sh_eth_dev *eth) { struct sh_eth_info *port_info = ð->port_info[eth->port]; @@ -403,22 +368,6 @@ static void sh_eth_write_hwaddr(struct sh_eth_info *port_info, sh_eth_write(port_info, val, MALR); } -static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth) -{ - int port = eth->port, ret = 0; - struct sh_eth_info *port_info = ð->port_info[port]; - struct eth_device *dev = port_info->dev; - struct phy_device *phydev; - - phydev = phy_connect( - miiphy_get_dev_by_name(dev->name), - port_info->phy_addr, dev, CONFIG_SH_ETHER_PHY_MODE); - port_info->phydev = phydev; - phy_config(phydev); - - return ret; -} - static void sh_eth_mac_regs_config(struct sh_eth_dev *eth, unsigned char *mac) { struct sh_eth_info *port_info = ð->port_info[eth->port]; @@ -563,6 +512,57 @@ static int sh_eth_start_common(struct sh_eth_dev *eth) return 0; } +static int sh_eth_phy_config_legacy(struct sh_eth_dev *eth) +{ + int port = eth->port, ret = 0; + struct sh_eth_info *port_info = ð->port_info[port]; + struct eth_device *dev = port_info->dev; + struct phy_device *phydev; + + phydev = phy_connect( + miiphy_get_dev_by_name(dev->name), + port_info->phy_addr, dev, CONFIG_SH_ETHER_PHY_MODE); + port_info->phydev = phydev; + phy_config(phydev); + + return ret; +} + +static int sh_eth_send_legacy(struct eth_device *dev, void *packet, int len) +{ + struct sh_eth_dev *eth = dev->priv; + + return sh_eth_send_common(eth, packet, len); +} + +static int sh_eth_recv_common(struct sh_eth_dev *eth) +{ + int port = eth->port, len = 0; + struct sh_eth_info *port_info = ð->port_info[port]; + uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2); + + len = sh_eth_recv_start(eth); + if (len > 0) { + invalidate_cache(packet, len); + net_process_received_packet(packet, len); + sh_eth_recv_finish(eth); + } else + len = 0; + + /* Restart the receiver if disabled */ + if (!(sh_eth_read(port_info, EDRRR) & EDRRR_R)) + sh_eth_write(port_info, EDRRR_R, EDRRR); + + return len; +} + +static int sh_eth_recv_legacy(struct eth_device *dev) +{ + struct sh_eth_dev *eth = dev->priv; + + return sh_eth_recv_common(eth); +} + static int sh_eth_init_legacy(struct eth_device *dev, bd_t *bd) { struct sh_eth_dev *eth = dev->priv; |