]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
ethernet: xilinx: Add support for 10G MAC
authorKedareswara rao Appana <appanad@xilinx.com>
Mon, 18 Sep 2017 06:20:02 +0000 (11:50 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 15 Mar 2018 14:17:46 +0000 (15:17 +0100)
This patch add's support for the 10G MAC.

Signed-off-by: Kedareswara rao Appana <appanad@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/ethernet/xilinx/xilinx_axienet.h
drivers/net/ethernet/xilinx/xilinx_axienet_main.c

index 23317ea181c14285310d5a6b34ab10c0e0420ad3..e00d664cc941ec42bec3de8718c18b1c01fe3805 100644 (file)
@@ -486,11 +486,13 @@ struct axienet_local {
  *
  * @XAXIENET_1G:        IP is 1G MAC
  * @XAXIENET_2_5G:      IP type is 2.5G MAC.
+ * @XAXIENET_LEGACY_10G: IP type is legacy 10G MAC.
  *
  */
 enum axienet_ip_type {
        XAXIENET_1G = 0,
        XAXIENET_2_5G,
+       XAXIENET_LEGACY_10G,
 };
 
 struct axienet_config {
index 8197b280d7bfc1f131c5645232bab6fe99ad7db8..f2f80aa352e6445c89146cc711251f52a2657709 100644 (file)
@@ -299,6 +299,10 @@ static void axienet_set_mac_address(struct net_device *ndev,
        if (!is_valid_ether_addr(ndev->dev_addr))
                eth_hw_addr_random(ndev);
 
+       if (lp->axienet_config->mactype != XAXIENET_1G &&
+           lp->axienet_config->mactype != XAXIENET_2_5G)
+               return;
+
        /* Set up unicast MAC address filter set its mac address */
        axienet_iow(lp, XAE_UAW0_OFFSET,
                    (ndev->dev_addr[0]) |
@@ -347,7 +351,7 @@ static void axienet_set_multicast_list(struct net_device *ndev)
        u32 reg, af0reg, af1reg;
        struct axienet_local *lp = netdev_priv(ndev);
 
-       if (lp->eth_hasnobuf)
+       if ((lp->axienet_config->mactype != XAXIENET_1G) || lp->eth_hasnobuf)
                return;
 
        if (ndev->flags & (IFF_ALLMULTI | IFF_PROMISC) ||
@@ -679,7 +683,8 @@ static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                return NETDEV_TX_BUSY;
        }
 
-       if (skb->ip_summed == CHECKSUM_PARTIAL && !lp->eth_hasnobuf) {
+       if (skb->ip_summed == CHECKSUM_PARTIAL && !lp->eth_hasnobuf &&
+           (lp->axienet_config->mactype == XAXIENET_1G)) {
                if (lp->features & XAE_FEATURE_FULL_TX_CSUM) {
                        /* Tx Full Checksum Offload Enabled */
                        cur_p->app0 |= 2;
@@ -691,7 +696,8 @@ static int axienet_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                        cur_p->app1 = (csum_start_off << 16) | csum_index_off;
                }
        } else if (skb->ip_summed == CHECKSUM_UNNECESSARY &&
-                  !lp->eth_hasnobuf) {
+                  !lp->eth_hasnobuf &&
+                  (lp->axienet_config->mactype == XAXIENET_1G)) {
                cur_p->app0 |= 2; /* Tx Full Checksum Offload Enabled */
        }
 
@@ -760,7 +766,8 @@ static int axienet_recv(struct net_device *ndev, int budget)
                tail_p = lp->rx_bd_p + sizeof(*lp->rx_bd_v) * lp->rx_bd_ci;
                skb = (struct sk_buff *) (cur_p->sw_id_offset);
 
-               if (lp->eth_hasnobuf)
+               if (lp->eth_hasnobuf ||
+                   (lp->axienet_config->mactype != XAXIENET_1G))
                        length = cur_p->status & XAXIDMA_BD_STS_ACTUAL_LEN_MASK;
                else
                        length = cur_p->app4 & 0x0000FFFF;
@@ -776,6 +783,7 @@ static int axienet_recv(struct net_device *ndev, int budget)
 
                /* if we're doing Rx csum offload, set it up */
                if (lp->features & XAE_FEATURE_FULL_RX_CSUM &&
+                   (lp->axienet_config->mactype == XAXIENET_1G) &&
                    !lp->eth_hasnobuf) {
                        csumstatus = (cur_p->app2 &
                                      XAE_FULL_CSUM_STATUS_MASK) >> 3;
@@ -785,7 +793,8 @@ static int axienet_recv(struct net_device *ndev, int budget)
                        }
                } else if ((lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) != 0 &&
                           skb->protocol == htons(ETH_P_IP) &&
-                          skb->len > 64 && !lp->eth_hasnobuf) {
+                          skb->len > 64 && !lp->eth_hasnobuf &&
+                          (lp->axienet_config->mactype == XAXIENET_1G)) {
                        skb->csum = be32_to_cpu(cur_p->app3 & 0xFFFF);
                        skb->ip_summed = CHECKSUM_COMPLETE;
                }
@@ -1022,7 +1031,8 @@ static int axienet_open(struct net_device *ndev)
                        phydev = of_phy_connect(lp->ndev, lp->phy_node,
                                                axienet_adjust_link, 0,
                                                PHY_INTERFACE_MODE_RGMII_ID);
-               } else {
+               } else if ((lp->axienet_config->mactype == XAXIENET_1G) ||
+                            (lp->axienet_config->mactype == XAXIENET_2_5G)) {
                        phydev = of_phy_connect(lp->ndev, lp->phy_node,
                                                axienet_adjust_link, lp->phy_flags,
                                                lp->phy_interface);
@@ -1546,6 +1556,11 @@ static const struct axienet_config axienet_2_5g_config = {
        .setoptions = axienet_setoptions,
 };
 
+static const struct axienet_config axienet_10g_config = {
+       .mactype = XAXIENET_LEGACY_10G,
+       .setoptions = axienet_setoptions,
+};
+
 /* Match table for of_platform binding */
 static const struct of_device_id axienet_of_match[] = {
        { .compatible = "xlnx,axi-ethernet-1.00.a", .data = &axienet_1g_config},
@@ -1553,6 +1568,7 @@ static const struct of_device_id axienet_of_match[] = {
        { .compatible = "xlnx,axi-ethernet-2.01.a", .data = &axienet_1g_config},
        { .compatible = "xlnx,axi-2_5-gig-ethernet-1.0",
                                                .data = &axienet_2_5g_config},
+       { .compatible = "xlnx,ten-gig-eth-mac", .data = &axienet_10g_config},
        {},
 };