| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | |
|---|
| 2 | 3 | /* Copyright (c) 2014 Linaro Ltd. |
|---|
| 3 | 4 | * Copyright (c) 2014 Hisilicon Limited. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 7 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | | - * (at your option) any later version. |
|---|
| 9 | 5 | */ |
|---|
| 10 | 6 | |
|---|
| 11 | 7 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 19 | 15 | #include <linux/of_net.h> |
|---|
| 20 | 16 | #include <linux/mfd/syscon.h> |
|---|
| 21 | 17 | #include <linux/regmap.h> |
|---|
| 18 | + |
|---|
| 19 | +#define SC_PPE_RESET_DREQ 0x026C |
|---|
| 22 | 20 | |
|---|
| 23 | 21 | #define PPE_CFG_RX_ADDR 0x100 |
|---|
| 24 | 22 | #define PPE_CFG_POOL_GRP 0x300 |
|---|
| .. | .. |
|---|
| 37 | 35 | #define GE_MODE_CHANGE_REG 0x1b4 |
|---|
| 38 | 36 | #define GE_RECV_CONTROL_REG 0x1e0 |
|---|
| 39 | 37 | #define GE_STATION_MAC_ADDRESS 0x210 |
|---|
| 40 | | -#define PPE_CFG_CPU_ADD_ADDR 0x580 |
|---|
| 41 | | -#define PPE_CFG_MAX_FRAME_LEN_REG 0x408 |
|---|
| 38 | + |
|---|
| 42 | 39 | #define PPE_CFG_BUS_CTRL_REG 0x424 |
|---|
| 43 | 40 | #define PPE_CFG_RX_CTRL_REG 0x428 |
|---|
| 41 | + |
|---|
| 42 | +#if defined(CONFIG_HI13X1_GMAC) |
|---|
| 43 | +#define PPE_CFG_CPU_ADD_ADDR 0x6D0 |
|---|
| 44 | +#define PPE_CFG_MAX_FRAME_LEN_REG 0x500 |
|---|
| 45 | +#define PPE_CFG_RX_PKT_MODE_REG 0x504 |
|---|
| 46 | +#define PPE_CFG_QOS_VMID_GEN 0x520 |
|---|
| 47 | +#define PPE_CFG_RX_PKT_INT 0x740 |
|---|
| 48 | +#define PPE_INTEN 0x700 |
|---|
| 49 | +#define PPE_INTSTS 0x708 |
|---|
| 50 | +#define PPE_RINT 0x704 |
|---|
| 51 | +#define PPE_CFG_STS_MODE 0x880 |
|---|
| 52 | +#else |
|---|
| 53 | +#define PPE_CFG_CPU_ADD_ADDR 0x580 |
|---|
| 54 | +#define PPE_CFG_MAX_FRAME_LEN_REG 0x408 |
|---|
| 44 | 55 | #define PPE_CFG_RX_PKT_MODE_REG 0x438 |
|---|
| 45 | 56 | #define PPE_CFG_QOS_VMID_GEN 0x500 |
|---|
| 46 | 57 | #define PPE_CFG_RX_PKT_INT 0x538 |
|---|
| .. | .. |
|---|
| 48 | 59 | #define PPE_INTSTS 0x608 |
|---|
| 49 | 60 | #define PPE_RINT 0x604 |
|---|
| 50 | 61 | #define PPE_CFG_STS_MODE 0x700 |
|---|
| 62 | +#endif /* CONFIG_HI13X1_GMAC */ |
|---|
| 63 | + |
|---|
| 51 | 64 | #define PPE_HIS_RX_PKT_CNT 0x804 |
|---|
| 65 | + |
|---|
| 66 | +#define RESET_DREQ_ALL 0xffffffff |
|---|
| 52 | 67 | |
|---|
| 53 | 68 | /* REG_INTERRUPT */ |
|---|
| 54 | 69 | #define RCV_INT BIT(10) |
|---|
| .. | .. |
|---|
| 61 | 76 | /* TX descriptor config */ |
|---|
| 62 | 77 | #define TX_FREE_MEM BIT(0) |
|---|
| 63 | 78 | #define TX_READ_ALLOC_L3 BIT(1) |
|---|
| 64 | | -#define TX_FINISH_CACHE_INV BIT(2) |
|---|
| 79 | +#if defined(CONFIG_HI13X1_GMAC) |
|---|
| 80 | +#define TX_CLEAR_WB BIT(7) |
|---|
| 81 | +#define TX_RELEASE_TO_PPE BIT(4) |
|---|
| 82 | +#define TX_FINISH_CACHE_INV BIT(6) |
|---|
| 83 | +#define TX_POOL_SHIFT 16 |
|---|
| 84 | +#else |
|---|
| 65 | 85 | #define TX_CLEAR_WB BIT(4) |
|---|
| 86 | +#define TX_FINISH_CACHE_INV BIT(2) |
|---|
| 87 | +#endif |
|---|
| 66 | 88 | #define TX_L3_CHECKSUM BIT(5) |
|---|
| 67 | 89 | #define TX_LOOP_BACK BIT(11) |
|---|
| 68 | 90 | |
|---|
| .. | .. |
|---|
| 97 | 119 | #define GE_RX_PORT_EN BIT(1) |
|---|
| 98 | 120 | #define GE_TX_PORT_EN BIT(2) |
|---|
| 99 | 121 | |
|---|
| 100 | | -#define PPE_CFG_STS_RX_PKT_CNT_RC BIT(12) |
|---|
| 101 | | - |
|---|
| 102 | 122 | #define PPE_CFG_RX_PKT_ALIGN BIT(18) |
|---|
| 103 | | -#define PPE_CFG_QOS_VMID_MODE BIT(14) |
|---|
| 123 | + |
|---|
| 124 | +#if defined(CONFIG_HI13X1_GMAC) |
|---|
| 125 | +#define PPE_CFG_QOS_VMID_GRP_SHIFT 4 |
|---|
| 126 | +#define PPE_CFG_RX_CTRL_ALIGN_SHIFT 7 |
|---|
| 127 | +#define PPE_CFG_STS_RX_PKT_CNT_RC BIT(0) |
|---|
| 128 | +#define PPE_CFG_QOS_VMID_MODE BIT(15) |
|---|
| 129 | +#define PPE_CFG_BUS_LOCAL_REL (BIT(9) | BIT(15) | BIT(19) | BIT(23)) |
|---|
| 130 | + |
|---|
| 131 | +/* buf unit size is cache_line_size, which is 64, so the shift is 6 */ |
|---|
| 132 | +#define PPE_BUF_SIZE_SHIFT 6 |
|---|
| 133 | +#define PPE_TX_BUF_HOLD BIT(31) |
|---|
| 134 | +#define SOC_CACHE_LINE_MASK 0x3F |
|---|
| 135 | +#else |
|---|
| 104 | 136 | #define PPE_CFG_QOS_VMID_GRP_SHIFT 8 |
|---|
| 137 | +#define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11 |
|---|
| 138 | +#define PPE_CFG_STS_RX_PKT_CNT_RC BIT(12) |
|---|
| 139 | +#define PPE_CFG_QOS_VMID_MODE BIT(14) |
|---|
| 140 | +#define PPE_CFG_BUS_LOCAL_REL BIT(14) |
|---|
| 141 | + |
|---|
| 142 | +/* buf unit size is 1, so the shift is 6 */ |
|---|
| 143 | +#define PPE_BUF_SIZE_SHIFT 0 |
|---|
| 144 | +#define PPE_TX_BUF_HOLD 0 |
|---|
| 145 | +#endif /* CONFIG_HI13X1_GMAC */ |
|---|
| 105 | 146 | |
|---|
| 106 | 147 | #define PPE_CFG_RX_FIFO_FSFU BIT(11) |
|---|
| 107 | 148 | #define PPE_CFG_RX_DEPTH_SHIFT 16 |
|---|
| 108 | 149 | #define PPE_CFG_RX_START_SHIFT 0 |
|---|
| 109 | | -#define PPE_CFG_RX_CTRL_ALIGN_SHIFT 11 |
|---|
| 110 | 150 | |
|---|
| 111 | | -#define PPE_CFG_BUS_LOCAL_REL BIT(14) |
|---|
| 112 | 151 | #define PPE_CFG_BUS_BIG_ENDIEN BIT(0) |
|---|
| 113 | 152 | |
|---|
| 114 | 153 | #define RX_DESC_NUM 128 |
|---|
| .. | .. |
|---|
| 132 | 171 | #define HIP04_MIN_TX_COALESCE_FRAMES 100 |
|---|
| 133 | 172 | |
|---|
| 134 | 173 | struct tx_desc { |
|---|
| 174 | +#if defined(CONFIG_HI13X1_GMAC) |
|---|
| 175 | + u32 reserved1[2]; |
|---|
| 176 | + u32 send_addr; |
|---|
| 177 | + u16 send_size; |
|---|
| 178 | + u16 data_offset; |
|---|
| 179 | + u32 reserved2[7]; |
|---|
| 180 | + u32 cfg; |
|---|
| 181 | + u32 wb_addr; |
|---|
| 182 | + u32 reserved3[3]; |
|---|
| 183 | +#else |
|---|
| 135 | 184 | u32 send_addr; |
|---|
| 136 | 185 | u32 send_size; |
|---|
| 137 | 186 | u32 next_addr; |
|---|
| 138 | 187 | u32 cfg; |
|---|
| 139 | 188 | u32 wb_addr; |
|---|
| 189 | +#endif |
|---|
| 140 | 190 | } __aligned(64); |
|---|
| 141 | 191 | |
|---|
| 142 | 192 | struct rx_desc { |
|---|
| 193 | +#if defined(CONFIG_HI13X1_GMAC) |
|---|
| 194 | + u32 reserved1[3]; |
|---|
| 195 | + u16 pkt_len; |
|---|
| 196 | + u16 reserved_16; |
|---|
| 197 | + u32 reserved2[6]; |
|---|
| 198 | + u32 pkt_err; |
|---|
| 199 | + u32 reserved3[5]; |
|---|
| 200 | +#else |
|---|
| 143 | 201 | u16 reserved_16; |
|---|
| 144 | 202 | u16 pkt_len; |
|---|
| 145 | 203 | u32 reserve1[3]; |
|---|
| 146 | 204 | u32 pkt_err; |
|---|
| 147 | 205 | u32 reserve2[4]; |
|---|
| 206 | +#endif |
|---|
| 148 | 207 | }; |
|---|
| 149 | 208 | |
|---|
| 150 | 209 | struct hip04_priv { |
|---|
| 151 | 210 | void __iomem *base; |
|---|
| 152 | | - int phy_mode; |
|---|
| 211 | +#if defined(CONFIG_HI13X1_GMAC) |
|---|
| 212 | + void __iomem *sysctrl_base; |
|---|
| 213 | +#endif |
|---|
| 214 | + phy_interface_t phy_mode; |
|---|
| 153 | 215 | int chan; |
|---|
| 154 | 216 | unsigned int port; |
|---|
| 217 | + unsigned int group; |
|---|
| 155 | 218 | unsigned int speed; |
|---|
| 156 | 219 | unsigned int duplex; |
|---|
| 157 | 220 | unsigned int reg_inten; |
|---|
| .. | .. |
|---|
| 227 | 290 | writel_relaxed(val, priv->base + GE_MODE_CHANGE_REG); |
|---|
| 228 | 291 | } |
|---|
| 229 | 292 | |
|---|
| 293 | +static void hip04_reset_dreq(struct hip04_priv *priv) |
|---|
| 294 | +{ |
|---|
| 295 | +#if defined(CONFIG_HI13X1_GMAC) |
|---|
| 296 | + writel_relaxed(RESET_DREQ_ALL, priv->sysctrl_base + SC_PPE_RESET_DREQ); |
|---|
| 297 | +#endif |
|---|
| 298 | +} |
|---|
| 299 | + |
|---|
| 230 | 300 | static void hip04_reset_ppe(struct hip04_priv *priv) |
|---|
| 231 | 301 | { |
|---|
| 232 | 302 | u32 val, tmp, timeout = 0; |
|---|
| .. | .. |
|---|
| 247 | 317 | val |= PPE_CFG_STS_RX_PKT_CNT_RC; |
|---|
| 248 | 318 | writel_relaxed(val, priv->base + PPE_CFG_STS_MODE); |
|---|
| 249 | 319 | |
|---|
| 250 | | - val = BIT(priv->port); |
|---|
| 320 | + val = BIT(priv->group); |
|---|
| 251 | 321 | regmap_write(priv->map, priv->port * 4 + PPE_CFG_POOL_GRP, val); |
|---|
| 252 | 322 | |
|---|
| 253 | | - val = priv->port << PPE_CFG_QOS_VMID_GRP_SHIFT; |
|---|
| 323 | + val = priv->group << PPE_CFG_QOS_VMID_GRP_SHIFT; |
|---|
| 254 | 324 | val |= PPE_CFG_QOS_VMID_MODE; |
|---|
| 255 | 325 | writel_relaxed(val, priv->base + PPE_CFG_QOS_VMID_GEN); |
|---|
| 256 | 326 | |
|---|
| 257 | | - val = RX_BUF_SIZE; |
|---|
| 327 | + val = RX_BUF_SIZE >> PPE_BUF_SIZE_SHIFT; |
|---|
| 258 | 328 | regmap_write(priv->map, priv->port * 4 + PPE_CFG_RX_BUF_SIZE, val); |
|---|
| 259 | 329 | |
|---|
| 260 | 330 | val = RX_DESC_NUM << PPE_CFG_RX_DEPTH_SHIFT; |
|---|
| .. | .. |
|---|
| 291 | 361 | val |= GE_RX_STRIP_PAD | GE_RX_PAD_EN; |
|---|
| 292 | 362 | writel_relaxed(val, priv->base + GE_RECV_CONTROL_REG); |
|---|
| 293 | 363 | |
|---|
| 364 | +#ifndef CONFIG_HI13X1_GMAC |
|---|
| 294 | 365 | val = GE_AUTO_NEG_CTL; |
|---|
| 295 | 366 | writel_relaxed(val, priv->base + GE_TX_LOCAL_PAGE_REG); |
|---|
| 367 | +#endif |
|---|
| 296 | 368 | } |
|---|
| 297 | 369 | |
|---|
| 298 | 370 | static void hip04_mac_enable(struct net_device *ndev) |
|---|
| .. | .. |
|---|
| 335 | 407 | |
|---|
| 336 | 408 | static void hip04_set_xmit_desc(struct hip04_priv *priv, dma_addr_t phys) |
|---|
| 337 | 409 | { |
|---|
| 338 | | - writel(phys, priv->base + PPE_CFG_CPU_ADD_ADDR); |
|---|
| 410 | + u32 val; |
|---|
| 411 | + |
|---|
| 412 | + val = phys >> PPE_BUF_SIZE_SHIFT | PPE_TX_BUF_HOLD; |
|---|
| 413 | + writel(val, priv->base + PPE_CFG_CPU_ADD_ADDR); |
|---|
| 339 | 414 | } |
|---|
| 340 | 415 | |
|---|
| 341 | 416 | static void hip04_set_recv_desc(struct hip04_priv *priv, dma_addr_t phys) |
|---|
| 342 | 417 | { |
|---|
| 343 | | - regmap_write(priv->map, priv->port * 4 + PPE_CFG_RX_ADDR, phys); |
|---|
| 418 | + u32 val; |
|---|
| 419 | + |
|---|
| 420 | + val = phys >> PPE_BUF_SIZE_SHIFT; |
|---|
| 421 | + regmap_write(priv->map, priv->port * 4 + PPE_CFG_RX_ADDR, val); |
|---|
| 344 | 422 | } |
|---|
| 345 | 423 | |
|---|
| 346 | 424 | static u32 hip04_recv_cnt(struct hip04_priv *priv) |
|---|
| .. | .. |
|---|
| 448 | 526 | |
|---|
| 449 | 527 | priv->tx_skb[tx_head] = skb; |
|---|
| 450 | 528 | priv->tx_phys[tx_head] = phys; |
|---|
| 451 | | - desc->send_addr = cpu_to_be32(phys); |
|---|
| 452 | | - desc->send_size = cpu_to_be32(skb->len); |
|---|
| 453 | | - desc->cfg = cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV); |
|---|
| 529 | + |
|---|
| 530 | + desc->send_size = (__force u32)cpu_to_be32(skb->len); |
|---|
| 531 | +#if defined(CONFIG_HI13X1_GMAC) |
|---|
| 532 | + desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV |
|---|
| 533 | + | TX_RELEASE_TO_PPE | priv->port << TX_POOL_SHIFT); |
|---|
| 534 | + desc->data_offset = (__force u32)cpu_to_be32(phys & SOC_CACHE_LINE_MASK); |
|---|
| 535 | + desc->send_addr = (__force u32)cpu_to_be32(phys & ~SOC_CACHE_LINE_MASK); |
|---|
| 536 | +#else |
|---|
| 537 | + desc->cfg = (__force u32)cpu_to_be32(TX_CLEAR_WB | TX_FINISH_CACHE_INV); |
|---|
| 538 | + desc->send_addr = (__force u32)cpu_to_be32(phys); |
|---|
| 539 | +#endif |
|---|
| 454 | 540 | phys = priv->tx_desc_dma + tx_head * sizeof(struct tx_desc); |
|---|
| 455 | | - desc->wb_addr = cpu_to_be32(phys); |
|---|
| 541 | + desc->wb_addr = (__force u32)cpu_to_be32(phys + |
|---|
| 542 | + offsetof(struct tx_desc, send_addr)); |
|---|
| 456 | 543 | skb_tx_timestamp(skb); |
|---|
| 457 | 544 | |
|---|
| 458 | 545 | hip04_set_xmit_desc(priv, phys); |
|---|
| .. | .. |
|---|
| 515 | 602 | priv->rx_phys[priv->rx_head] = 0; |
|---|
| 516 | 603 | |
|---|
| 517 | 604 | desc = (struct rx_desc *)skb->data; |
|---|
| 518 | | - len = be16_to_cpu(desc->pkt_len); |
|---|
| 519 | | - err = be32_to_cpu(desc->pkt_err); |
|---|
| 605 | + len = be16_to_cpu((__force __be16)desc->pkt_len); |
|---|
| 606 | + err = be32_to_cpu((__force __be32)desc->pkt_err); |
|---|
| 520 | 607 | |
|---|
| 521 | 608 | if (0 == len) { |
|---|
| 522 | 609 | dev_kfree_skb_any(skb); |
|---|
| .. | .. |
|---|
| 692 | 779 | return 0; |
|---|
| 693 | 780 | } |
|---|
| 694 | 781 | |
|---|
| 695 | | -static void hip04_timeout(struct net_device *ndev) |
|---|
| 782 | +static void hip04_timeout(struct net_device *ndev, unsigned int txqueue) |
|---|
| 696 | 783 | { |
|---|
| 697 | 784 | struct hip04_priv *priv = netdev_priv(ndev); |
|---|
| 698 | 785 | |
|---|
| .. | .. |
|---|
| 724 | 811 | { |
|---|
| 725 | 812 | struct hip04_priv *priv = netdev_priv(netdev); |
|---|
| 726 | 813 | |
|---|
| 727 | | - /* Check not supported parameters */ |
|---|
| 728 | | - if ((ec->rx_max_coalesced_frames) || (ec->rx_coalesce_usecs_irq) || |
|---|
| 729 | | - (ec->rx_max_coalesced_frames_irq) || (ec->tx_coalesce_usecs_irq) || |
|---|
| 730 | | - (ec->use_adaptive_rx_coalesce) || (ec->use_adaptive_tx_coalesce) || |
|---|
| 731 | | - (ec->pkt_rate_low) || (ec->rx_coalesce_usecs_low) || |
|---|
| 732 | | - (ec->rx_max_coalesced_frames_low) || (ec->tx_coalesce_usecs_high) || |
|---|
| 733 | | - (ec->tx_max_coalesced_frames_low) || (ec->pkt_rate_high) || |
|---|
| 734 | | - (ec->tx_coalesce_usecs_low) || (ec->rx_coalesce_usecs_high) || |
|---|
| 735 | | - (ec->rx_max_coalesced_frames_high) || (ec->rx_coalesce_usecs) || |
|---|
| 736 | | - (ec->tx_max_coalesced_frames_irq) || |
|---|
| 737 | | - (ec->stats_block_coalesce_usecs) || |
|---|
| 738 | | - (ec->tx_max_coalesced_frames_high) || (ec->rate_sample_interval)) |
|---|
| 739 | | - return -EOPNOTSUPP; |
|---|
| 740 | | - |
|---|
| 741 | 814 | if ((ec->tx_coalesce_usecs > HIP04_MAX_TX_COALESCE_USECS || |
|---|
| 742 | 815 | ec->tx_coalesce_usecs < HIP04_MIN_TX_COALESCE_USECS) || |
|---|
| 743 | 816 | (ec->tx_max_coalesced_frames > HIP04_MAX_TX_COALESCE_FRAMES || |
|---|
| .. | .. |
|---|
| 758 | 831 | } |
|---|
| 759 | 832 | |
|---|
| 760 | 833 | static const struct ethtool_ops hip04_ethtool_ops = { |
|---|
| 834 | + .supported_coalesce_params = ETHTOOL_COALESCE_TX_USECS | |
|---|
| 835 | + ETHTOOL_COALESCE_TX_MAX_FRAMES, |
|---|
| 761 | 836 | .get_coalesce = hip04_get_coalesce, |
|---|
| 762 | 837 | .set_coalesce = hip04_set_coalesce, |
|---|
| 763 | 838 | .get_drvinfo = hip04_get_drvinfo, |
|---|
| .. | .. |
|---|
| 818 | 893 | struct of_phandle_args arg; |
|---|
| 819 | 894 | struct net_device *ndev; |
|---|
| 820 | 895 | struct hip04_priv *priv; |
|---|
| 821 | | - struct resource *res; |
|---|
| 822 | 896 | int irq; |
|---|
| 823 | 897 | int ret; |
|---|
| 824 | 898 | |
|---|
| .. | .. |
|---|
| 832 | 906 | platform_set_drvdata(pdev, ndev); |
|---|
| 833 | 907 | SET_NETDEV_DEV(ndev, &pdev->dev); |
|---|
| 834 | 908 | |
|---|
| 835 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 836 | | - priv->base = devm_ioremap_resource(d, res); |
|---|
| 909 | + priv->base = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 837 | 910 | if (IS_ERR(priv->base)) { |
|---|
| 838 | 911 | ret = PTR_ERR(priv->base); |
|---|
| 839 | 912 | goto init_fail; |
|---|
| 840 | 913 | } |
|---|
| 841 | 914 | |
|---|
| 842 | | - ret = of_parse_phandle_with_fixed_args(node, "port-handle", 2, 0, &arg); |
|---|
| 915 | +#if defined(CONFIG_HI13X1_GMAC) |
|---|
| 916 | + priv->sysctrl_base = devm_platform_ioremap_resource(pdev, 1); |
|---|
| 917 | + if (IS_ERR(priv->sysctrl_base)) { |
|---|
| 918 | + ret = PTR_ERR(priv->sysctrl_base); |
|---|
| 919 | + goto init_fail; |
|---|
| 920 | + } |
|---|
| 921 | +#endif |
|---|
| 922 | + |
|---|
| 923 | + ret = of_parse_phandle_with_fixed_args(node, "port-handle", 3, 0, &arg); |
|---|
| 843 | 924 | if (ret < 0) { |
|---|
| 844 | 925 | dev_warn(d, "no port-handle\n"); |
|---|
| 845 | 926 | goto init_fail; |
|---|
| .. | .. |
|---|
| 847 | 928 | |
|---|
| 848 | 929 | priv->port = arg.args[0]; |
|---|
| 849 | 930 | priv->chan = arg.args[1] * RX_DESC_NUM; |
|---|
| 931 | + priv->group = arg.args[2]; |
|---|
| 850 | 932 | |
|---|
| 851 | 933 | hrtimer_init(&priv->tx_coalesce_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
|---|
| 852 | 934 | |
|---|
| .. | .. |
|---|
| 867 | 949 | goto init_fail; |
|---|
| 868 | 950 | } |
|---|
| 869 | 951 | |
|---|
| 870 | | - priv->phy_mode = of_get_phy_mode(node); |
|---|
| 871 | | - if (priv->phy_mode < 0) { |
|---|
| 952 | + ret = of_get_phy_mode(node, &priv->phy_mode); |
|---|
| 953 | + if (ret) { |
|---|
| 872 | 954 | dev_warn(d, "not find phy-mode\n"); |
|---|
| 873 | | - ret = -EINVAL; |
|---|
| 874 | 955 | goto init_fail; |
|---|
| 875 | 956 | } |
|---|
| 876 | 957 | |
|---|
| .. | .. |
|---|
| 907 | 988 | ndev->irq = irq; |
|---|
| 908 | 989 | netif_napi_add(ndev, &priv->napi, hip04_rx_poll, NAPI_POLL_WEIGHT); |
|---|
| 909 | 990 | |
|---|
| 991 | + hip04_reset_dreq(priv); |
|---|
| 910 | 992 | hip04_reset_ppe(priv); |
|---|
| 911 | 993 | if (priv->phy_mode == PHY_INTERFACE_MODE_MII) |
|---|
| 912 | 994 | hip04_config_port(ndev, SPEED_100, DUPLEX_FULL); |
|---|