~ubuntu-branches/ubuntu/vivid/u-boot/vivid

« back to all changes in this revision

Viewing changes to drivers/net/altera_tse.c

  • Committer: Package Import Robot
  • Author(s): Clint Adams
  • Date: 2012-01-02 17:49:39 UTC
  • mfrom: (1.2.7)
  • Revision ID: package-import@ubuntu.com-20120102174939-iddq37p3372x10yp
Tags: 2011.12-1
* New upstream version.
  - Drop build-timestamp_autogenerated.h-without-config.patch (merged).
  - Drop ublimage-NAND-block-size-isn-t-set-at-build-time.patch (merged).
  - Update kerma-sheevaplug-mvsdio.diff
  - Update mipsel-native-endianness.diff
  - Drop dreamplug-v8.patch (merged).

Show diffs side-by-side

added added

removed removed

Lines of Context:
199
199
                debug("Timeout waiting sgdma in do async!\n");
200
200
 
201
201
        /*
 
202
         * Clear the RUN bit in the control register. This is needed
 
203
         * to restart the SGDMA engine later on.
 
204
         */
 
205
        dev->control = 0;
 
206
 
 
207
        /*
202
208
         * Clear any (previous) status register information
203
209
         * that might occlude our error checking later.
204
210
         */
317
323
 
318
324
                /* setup the sgdma */
319
325
                alt_sgdma_do_async_transfer(priv->sgdma_rx, &rx_desc[0]);
 
326
 
 
327
                return packet_length;
320
328
        }
321
329
 
322
330
        return -1;
351
359
 
352
360
        if (counter >= ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) {
353
361
                debug("Timeout waiting for rx sgdma!\n");
354
 
                rx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
355
 
                rx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
 
362
                rx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
 
363
                rx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
356
364
        }
357
365
 
358
366
        counter = 0;
364
372
 
365
373
        if (counter >= ALT_TSE_SGDMA_BUSY_WATCHDOG_CNTR) {
366
374
                debug("Timeout waiting for tx sgdma!\n");
367
 
                tx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
368
 
                tx_sgdma->control &= ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
 
375
                tx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
 
376
                tx_sgdma->control = ALT_SGDMA_CONTROL_SOFTWARERESET_MSK;
369
377
        }
370
378
        /* reset the mac */
371
379
        mac_dev->command_config.bits.transmit_enable = 1;
577
585
{
578
586
        uint mii_data = tse_mdio_read(priv, mii_reg);
579
587
        mii_data &= 0xfff0;
580
 
        mii_data |= 0xb;
 
588
        if ((priv->flags >= 1) && (priv->flags <= 4))
 
589
                mii_data |= 0xb;
 
590
        else if (priv->flags == 5)
 
591
                mii_data |= 0x4;
 
592
 
581
593
        return mii_data;
582
594
}
583
595
 
585
597
{
586
598
        uint mii_data = tse_mdio_read(priv, mii_reg);
587
599
        mii_data &= ~0x82;
588
 
        mii_data |= 0x82;
 
600
        if ((priv->flags >= 1) && (priv->flags <= 4))
 
601
                mii_data |= 0x82;
 
602
 
589
603
        return mii_data;
590
604
}
591
605
 
876
890
 
877
891
/* TSE init code */
878
892
int altera_tse_initialize(u8 dev_num, int mac_base,
879
 
                          int sgdma_rx_base, int sgdma_tx_base)
 
893
                          int sgdma_rx_base, int sgdma_tx_base,
 
894
                          u32 sgdma_desc_base, u32 sgdma_desc_size)
880
895
{
881
896
        struct altera_tse_priv *priv;
882
897
        struct eth_device *dev;
897
912
                free(dev);
898
913
                return 0;
899
914
        }
900
 
        tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX),
901
 
                                     &dma_handle);
 
915
        if (sgdma_desc_size) {
 
916
                if (sgdma_desc_size < (sizeof(*tx_desc) * (3 + PKTBUFSRX))) {
 
917
                        printf("ALTERA_TSE-%hu: "
 
918
                               "descriptor memory is too small\n", dev_num);
 
919
                        free(priv);
 
920
                        free(dev);
 
921
                        return 0;
 
922
                }
 
923
                tx_desc = (struct alt_sgdma_descriptor *)sgdma_desc_base;
 
924
        } else {
 
925
                tx_desc = dma_alloc_coherent(sizeof(*tx_desc) * (3 + PKTBUFSRX),
 
926
                                             &dma_handle);
 
927
        }
 
928
 
902
929
        rx_desc = tx_desc + 2;
903
930
        debug("tx desc: address = 0x%x\n", (unsigned int)tx_desc);
904
931
        debug("rx desc: address = 0x%x\n", (unsigned int)rx_desc);