ar71xx: ag71xx: get max_frame_len and desc_pktlen_mask from platform data
authorGabor Juhos <juhosg@openwrt.org>
Fri, 20 Dec 2013 11:41:17 +0000 (11:41 +0000)
committerGabor Juhos <juhosg@openwrt.org>
Fri, 20 Dec 2013 11:41:17 +0000 (11:41 +0000)
This will allow to use SoC specific values for both.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
SVN-Revision: 39145

target/linux/ar71xx/files/arch/mips/ath79/dev-eth.c
target/linux/ar71xx/files/arch/mips/include/asm/mach-ath79/ag71xx_platform.h
target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c

index 742218bb32ba05edd7abc748fe8a3adb889137b8..8b54d0c817fb887aa22e4e27900aabd6cf70ece7 100644 (file)
@@ -786,6 +786,9 @@ void __init ath79_register_eth(unsigned int id)
 
        pdata = pdev->dev.platform_data;
 
+       pdata->max_frame_len = 1540;
+       pdata->desc_pktlen_mask = 0xfff;
+
        err = ath79_setup_phy_if_mode(id, pdata);
        if (err) {
                printk(KERN_ERR
index 68aea202bd5ec4e191e8c0444f97505fbcb86026..d46dc4e317653263e4adb842686da931a89d70bc 100644 (file)
@@ -45,6 +45,9 @@ struct ag71xx_platform_data {
        u32             fifo_cfg1;
        u32             fifo_cfg2;
        u32             fifo_cfg3;
+
+       unsigned int    max_frame_len;
+       unsigned int    desc_pktlen_mask;
 };
 
 struct ag71xx_mdio_platform_data {
index a129a6f2918bd9d6b4926132a72db229b8cff38f..9df27ff1a9116edbabf578072add6e775cad804e 100644 (file)
@@ -1124,6 +1124,9 @@ static int ag71xx_probe(struct platform_device *pdev)
                goto err_out;
        }
 
+       if (!pdata->max_frame_len || !pdata->desc_pktlen_mask)
+               return -EINVAL;
+
        SET_NETDEV_DEV(dev, &pdev->dev);
 
        ag = netdev_priv(dev);
@@ -1169,8 +1172,8 @@ static int ag71xx_probe(struct platform_device *pdev)
        ag->tx_ring.size = AG71XX_TX_RING_SIZE_DEFAULT;
        ag->rx_ring.size = AG71XX_RX_RING_SIZE_DEFAULT;
 
-       ag->max_frame_len = AG71XX_TX_MTU_LEN;
-       ag->desc_pktlen_mask = DESC_PKTLEN_MASK;
+       ag->max_frame_len = pdata->max_frame_len;
+       ag->desc_pktlen_mask = pdata->desc_pktlen_mask;
 
        ag->stop_desc = dma_alloc_coherent(NULL,
                sizeof(struct ag71xx_desc), &ag->stop_desc_dma, GFP_KERNEL);