forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/net/ethernet/agere/et131x.c
....@@ -714,11 +714,11 @@
714714 * gather additional information that normally would
715715 * come from the eeprom, like MAC Address
716716 */
717
- adapter->has_eeprom = 0;
717
+ adapter->has_eeprom = false;
718718 return -EIO;
719719 }
720720 }
721
- adapter->has_eeprom = 1;
721
+ adapter->has_eeprom = true;
722722
723723 /* Read the EEPROM for information regarding LED behavior. Refer to
724724 * et131x_xcvr_init() for its use.
....@@ -950,7 +950,6 @@
950950 u32 hash2 = 0;
951951 u32 hash3 = 0;
952952 u32 hash4 = 0;
953
- u32 pm_csr;
954953
955954 /* If ET131X_PACKET_TYPE_MULTICAST is specified, then we provision
956955 * the multi-cast LIST. If it is NOT specified, (and "ALL" is not
....@@ -984,7 +983,6 @@
984983 }
985984
986985 /* Write out the new hash to the device */
987
- pm_csr = readl(&adapter->regs->global.pm_csr);
988986 if (!et1310_in_phy_coma(adapter)) {
989987 writel(hash1, &rxmac->multi_hash1);
990988 writel(hash2, &rxmac->multi_hash2);
....@@ -999,7 +997,6 @@
999997 u32 uni_pf1;
1000998 u32 uni_pf2;
1001999 u32 uni_pf3;
1002
- u32 pm_csr;
10031000
10041001 /* Set up unicast packet filter reg 3 to be the first two octets of
10051002 * the MAC address for both address
....@@ -1025,7 +1022,6 @@
10251022 (adapter->addr[4] << ET_RX_UNI_PF_ADDR1_5_SHIFT) |
10261023 adapter->addr[5];
10271024
1028
- pm_csr = readl(&adapter->regs->global.pm_csr);
10291025 if (!et1310_in_phy_coma(adapter)) {
10301026 writel(uni_pf1, &rxmac->uni_pf_addr1);
10311027 writel(uni_pf2, &rxmac->uni_pf_addr2);
....@@ -2362,7 +2358,7 @@
23622358
23632359 /* Allocate memory for the TCB's (Transmit Control Block) */
23642360 tx_ring->tcb_ring = kcalloc(NUM_TCB, sizeof(struct tcb),
2365
- GFP_ATOMIC | GFP_DMA);
2361
+ GFP_KERNEL | GFP_DMA);
23662362 if (!tx_ring->tcb_ring)
23672363 return -ENOMEM;
23682364
....@@ -2426,7 +2422,7 @@
24262422 u32 thiscopy, remainder;
24272423 struct sk_buff *skb = tcb->skb;
24282424 u32 nr_frags = skb_shinfo(skb)->nr_frags + 1;
2429
- struct skb_frag_struct *frags = &skb_shinfo(skb)->frags[0];
2425
+ skb_frag_t *frags = &skb_shinfo(skb)->frags[0];
24302426 struct phy_device *phydev = adapter->netdev->phydev;
24312427 dma_addr_t dma_addr;
24322428 struct tx_ring *tx_ring = &adapter->tx_ring;
....@@ -2488,11 +2484,11 @@
24882484 frag++;
24892485 }
24902486 } else {
2491
- desc[frag].len_vlan = frags[i - 1].size;
2487
+ desc[frag].len_vlan = skb_frag_size(&frags[i - 1]);
24922488 dma_addr = skb_frag_dma_map(&adapter->pdev->dev,
24932489 &frags[i - 1],
24942490 0,
2495
- frags[i - 1].size,
2491
+ desc[frag].len_vlan,
24962492 DMA_TO_DEVICE);
24972493 desc[frag].addr_lo = lower_32_bits(dma_addr);
24982494 desc[frag].addr_hi = upper_32_bits(dma_addr);
....@@ -2958,7 +2954,6 @@
29582954 struct et131x_adapter *adapter = netdev_priv(netdev);
29592955
29602956 strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
2961
- strlcpy(info->version, DRIVER_VERSION, sizeof(info->version));
29622957 strlcpy(info->bus_info, pci_name(adapter->pdev),
29632958 sizeof(info->bus_info));
29642959 }
....@@ -3258,19 +3253,11 @@
32583253 return PTR_ERR(phydev);
32593254 }
32603255
3261
- phydev->supported &= (SUPPORTED_10baseT_Half |
3262
- SUPPORTED_10baseT_Full |
3263
- SUPPORTED_100baseT_Half |
3264
- SUPPORTED_100baseT_Full |
3265
- SUPPORTED_Autoneg |
3266
- SUPPORTED_MII |
3267
- SUPPORTED_TP);
3256
+ phy_set_max_speed(phydev, SPEED_100);
32683257
32693258 if (adapter->pdev->device != ET131X_PCI_DEVICE_ID_FAST)
3270
- phydev->supported |= SUPPORTED_1000baseT_Half |
3271
- SUPPORTED_1000baseT_Full;
3259
+ phy_set_max_speed(phydev, SPEED_1000);
32723260
3273
- phydev->advertising = phydev->supported;
32743261 phydev->autoneg = AUTONEG_ENABLE;
32753262
32763263 phy_attached_info(phydev);
....@@ -3452,12 +3439,9 @@
34523439 * send a pause packet, otherwise just exit
34533440 */
34543441 if (adapter->flow == FLOW_TXONLY || adapter->flow == FLOW_BOTH) {
3455
- u32 pm_csr;
3456
-
34573442 /* Tell the device to send a pause packet via the back
34583443 * pressure register (bp req and bp xon/xoff)
34593444 */
3460
- pm_csr = readl(&iomem->global.pm_csr);
34613445 if (!et1310_in_phy_coma(adapter))
34623446 writel(3, &iomem->txmac.bp_ctrl);
34633447 }
....@@ -3659,15 +3643,6 @@
36593643 return del_timer_sync(&adapter->error_timer);
36603644 }
36613645
3662
-static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf,
3663
- int cmd)
3664
-{
3665
- if (!netdev->phydev)
3666
- return -EINVAL;
3667
-
3668
- return phy_mii_ioctl(netdev->phydev, reqbuf, cmd);
3669
-}
3670
-
36713646 /* et131x_set_packet_filter - Configures the Rx Packet filtering */
36723647 static int et131x_set_packet_filter(struct et131x_adapter *adapter)
36733648 {
....@@ -3819,7 +3794,7 @@
38193794 * specified by the 'tx_timeo" element in the net_device structure (see
38203795 * et131x_alloc_device() to see how this value is set).
38213796 */
3822
-static void et131x_tx_timeout(struct net_device *netdev)
3797
+static void et131x_tx_timeout(struct net_device *netdev, unsigned int txqueue)
38233798 {
38243799 struct et131x_adapter *adapter = netdev_priv(netdev);
38253800 struct tx_ring *tx_ring = &adapter->tx_ring;
....@@ -3907,7 +3882,7 @@
39073882 .ndo_set_mac_address = eth_mac_addr,
39083883 .ndo_validate_addr = eth_validate_addr,
39093884 .ndo_get_stats = et131x_stats,
3910
- .ndo_do_ioctl = et131x_ioctl,
3885
+ .ndo_do_ioctl = phy_do_ioctl,
39113886 };
39123887
39133888 static int et131x_pci_setup(struct pci_dev *pdev,