ravb: Add aligned_tx to struct ravb_hw_info
authorBiju Das <biju.das.jz@bp.renesas.com>
Wed, 18 Aug 2021 19:07:54 +0000 (20:07 +0100)
committerDavid S. Miller <davem@davemloft.net>
Thu, 19 Aug 2021 11:05:15 +0000 (12:05 +0100)
R-Car Gen2 needs a 4byte aligned address for the transmission buffer,
whereas R-Car Gen3 doesn't have any such restriction.

Add aligned_tx to struct ravb_hw_info to select the driver to choose
between aligned and unaligned tx buffers.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/ravb.h
drivers/net/ethernet/renesas/ravb_main.c

index 6ff0b26..4f71e56 100644 (file)
@@ -990,6 +990,7 @@ enum ravb_chip_id {
 
 struct ravb_hw_info {
        enum ravb_chip_id chip_id;
+       unsigned aligned_tx: 1;
 };
 
 struct ravb_private {
index b6554e5..dbccf2c 100644 (file)
@@ -1930,6 +1930,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 
 static const struct ravb_hw_info ravb_gen2_hw_info = {
        .chip_id = RCAR_GEN2,
+       .aligned_tx = 1,
 };
 
 static const struct of_device_id ravb_match_table[] = {
@@ -2140,7 +2141,7 @@ static int ravb_probe(struct platform_device *pdev)
        ndev->max_mtu = 2048 - (ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN);
        ndev->min_mtu = ETH_MIN_MTU;
 
-       priv->num_tx_desc = info->chip_id == RCAR_GEN2 ?
+       priv->num_tx_desc = info->aligned_tx ?
                NUM_TX_DESC_GEN2 : NUM_TX_DESC_GEN3;
 
        /* Set function */