35 #ifndef SYNOP_GMAC_DEV_H 36 #define SYNOP_GMAC_DEV_H 1 50 #define DEFAULT_PHY_BASE PHY1 //We use First Phy 52 #define GMAC0MappedAddr EMAC_BASE //0x40012000 53 #define GMAC1MappedAddr EMAC_BASE 54 #define MACBASE 0x0000 // The Mac Base address offset is 0x0000 55 #define DMABASE 0x1000 // Dma base address starts with an offset 0x1000 58 #define TRANSMIT_DESC_SIZE 8//256 //Tx Descriptors needed in the Descriptor pool/queue 59 #define RECEIVE_DESC_SIZE 16//256 //Rx Descriptors needed in the Descriptor pool/queue 61 #define ETHERNET_HEADER 14 //6 byte Dest addr, 6 byte Src addr, 2 byte length/type 62 #define ETHERNET_CRC 4 //Ethernet CRC 63 #define ETHERNET_EXTRA 2 //Only God knows about this????? 64 #define ETHERNET_PACKET_COPY 250 // Maximum length when received data is copied on to a new skb 65 #define ETHERNET_PACKET_EXTRA 18 // Preallocated length for the rx packets is MTU + ETHERNET_PACKET_EXTRA 66 #define VLAN_TAG 4 //optional 802.1q VLAN Tag 67 #define MIN_ETHERNET_PAYLOAD 46 //Minimum Ethernet payload size 68 #define MAX_ETHERNET_PAYLOAD 1500 //Maximum Ethernet payload size 69 #define JUMBO_FRAME_PAYLOAD 9000 //Jumbo frame payload size 71 #define TX_BUF_SIZE ETHERNET_HEADER + ETHERNET_CRC + MAX_ETHERNET_PAYLOAD + VLAN_TAG 75 #define DEFAULT_MAC0_ADDRESS {0x00, 0x55, 0x7B, 0xB5, 0x7D, 0xF7} 76 #define DEFAULT_MAC1_ADDRESS {0x00, 0x55, 0x7B, 0xB5, 0x7D, 0xF8} 91 #define MODULO_INTERRUPT 1 // if it is set to 1, interrupt is available for all the descriptors or else interrupt is available only for 108 RINGMODE = 0x00000001,
109 CHAINMODE = 0x00000002,
113 SINGLEBUF = 0x00000001,
114 DUALBUF = 0x00000002,
117 typedef u32 * dma_addr_t;
122 unsigned char data[2048];
124 unsigned int volatile rdy;
131 u32 tx_aborted_errors;
132 u32 tx_carrier_errors;
133 u32 tx_ip_header_errors;
134 u32 tx_ip_payload_errors;
141 u32 rx_length_errors;
144 u32 rx_ip_header_errors;
145 u32 rx_ip_payload_errors;
204 PHY_CONTROL_REG = 0x0000,
205 PHY_STATUS_REG = 0x0001,
206 PHY_ID_HI_REG = 0x0002,
207 PHY_ID_LOW_REG = 0x0003,
208 PHY_AN_ADV_REG = 0x0004,
209 PHY_LNK_PART_ABl_REG = 0x0005,
210 PHY_AN_EXP_REG = 0x0006,
211 PHY_AN_NXT_PAGE_TX_REG = 0x0007,
212 PHY_LNK_PART_NXT_PAGE_REG = 0x0008,
213 PHY_1000BT_CTRL_REG = 0x0009,
214 PHY_1000BT_STATUS_REG = 0x000a,
215 PHY_SPECIFIC_CTRL_REG = 0x0010,
216 PHY_SPECIFIC_STATUS_REG = 0x0011,
217 PHY_INTERRUPT_ENABLE_REG = 0x0012,
218 PHY_INTERRUPT_STATUS_REG = 0x0013,
219 PHY_EXT_PHY_SPC_CTRL = 0x0014,
220 PHY_RX_ERR_COUNTER = 0x0015,
221 PHY_EXT_ADDR_CBL_DIAG = 0x0016,
222 PHY_LED_CONTROL = 0x0018,
223 PHY_MAN_LED_OVERIDE = 0x0019,
224 PHY_EXT_PHY_SPC_CTRL2 = 0x001a,
225 PHY_EXT_PHY_SPC_STATUS = 0x001b,
226 PHY_CBL_DIAG_REG = 0x001c,
236 Mii_Speed_10 = 0x0000,
237 Mii_Speed_100 = 0x2000,
238 Mii_Speed_1000 = 0x0040,
242 Mii_Manual_Master_Config = 0x0800,
244 Mii_Loopback = 0x4000,
245 Mii_NoLoopback = 0x0000,
248 enum Mii_Phy_Status {
249 Mii_phy_status_speed_10 = 0x0000,
250 Mii_phy_status_speed_100 = 0x4000,
251 Mii_phy_status_speed_1000 = 0x8000,
253 Mii_phy_status_full_duplex = 0x2000,
254 Mii_phy_status_half_duplex = 0x0000,
256 Mii_phy_status_link_up = 0x0400,
260 enum Mii_GEN_STATUS {
261 Mii_AutoNegCmplt = 0x0020,
265 enum Mii_Link_Status {
270 enum Mii_Duplex_Mode {
274 enum Mii_Link_Speed {
294 GmacFrameFilter = 0x0004,
295 GmacHashHigh = 0x0008,
296 GmacHashLow = 0x000C,
297 GmacGmiiAddr = 0x0010,
298 GmacGmiiData = 0x0014,
299 GmacFlowControl = 0x0018,
302 GmacVersion = 0x0020,
304 GmacWakeupAddr = 0x0028,
305 GmacPmtCtrlStatus = 0x002C,
308 GmacLPICtrlSts = 0x0030,
309 GmacLPITimerCtrl = 0x0034,
312 GmacInterruptStatus = 0x0038,
313 GmacInterruptMask = 0x003C,
315 GmacAddr0High = 0x0040,
316 GmacAddr0Low = 0x0044,
317 GmacAddr1High = 0x0048,
318 GmacAddr1Low = 0x004C,
319 GmacAddr2High = 0x0050,
320 GmacAddr2Low = 0x0054,
321 GmacAddr3High = 0x0058,
322 GmacAddr3Low = 0x005C,
323 GmacAddr4High = 0x0060,
324 GmacAddr4Low = 0x0064,
325 GmacAddr5High = 0x0068,
326 GmacAddr5Low = 0x006C,
327 GmacAddr6High = 0x0070,
328 GmacAddr6Low = 0x0074,
329 GmacAddr7High = 0x0078,
330 GmacAddr7Low = 0x007C,
331 GmacAddr8High = 0x0080,
332 GmacAddr8Low = 0x0084,
333 GmacAddr9High = 0x0088,
334 GmacAddr9Low = 0x008C,
335 GmacAddr10High = 0x0090,
336 GmacAddr10Low = 0x0094,
337 GmacAddr11High = 0x0098,
338 GmacAddr11Low = 0x009C,
339 GmacAddr12High = 0x00A0,
340 GmacAddr12Low = 0x00A4,
341 GmacAddr13High = 0x00A8,
342 GmacAddr13Low = 0x00AC,
343 GmacAddr14High = 0x00B0,
344 GmacAddr14Low = 0x00B4,
345 GmacAddr15High = 0x00B8,
346 GmacAddr15Low = 0x00BC,
347 GmacRgmiiCtrlSts = 0x00D8,
348 GmacVLANIncRep = 0x0584,
350 GmacTSControl = 0x0700,
352 GmacTSSubSecIncr = 0x0704,
357 GmacTSHighUpdate = 0x0710,
358 GmacTSLowUpdate = 0x0714,
360 GmacTSAddend = 0x0718,
362 GmacTSTargetTimeHigh = 0x071C,
363 GmacTSTargetTimeLow = 0x0720,
365 GmacTSHighWord = 0x0724,
368 GmacTSStatus = 0x0728,
369 GmacPPSCtrl = 0x072C,
371 GmacPPSWidth = 0x0764,
389 GmacSrcAddrInsRpl = 0x70000000,
390 GmacSrcAddrIns = 0x20000000,
391 GmacSrcAddrRpl = 0x30000000,
392 GmacWatchdog = 0x00800000,
393 GmacWatchdogDisable = 0x00800000,
394 GmacWatchdogEnable = 0x00000000,
396 GmacJabber = 0x00400000,
397 GmacJabberDisable = 0x00400000,
398 GmacJabberEnable = 0x00000000,
400 GmacFrameBurst = 0x00200000,
401 GmacFrameBurstEnable = 0x00200000,
402 GmacFrameBurstDisable = 0x00000000,
404 GmacJumboFrame = 0x00100000,
405 GmacJumboFrameEnable = 0x00100000,
406 GmacJumboFrameDisable = 0x00000000,
408 GmacInterFrameGap7 = 0x000E0000,
409 GmacInterFrameGap6 = 0x000C0000,
410 GmacInterFrameGap5 = 0x000A0000,
411 GmacInterFrameGap4 = 0x00080000,
412 GmacInterFrameGap3 = 0x00040000,
413 GmacInterFrameGap2 = 0x00020000,
414 GmacInterFrameGap1 = 0x00010000,
415 GmacInterFrameGap0 = 0x00000000,
417 GmacDisableCrs = 0x00010000,
418 GmacMiiGmii = 0x00008000,
419 GmacSelectMii = 0x00008000,
420 GmacSelectGmii = 0x00000000,
422 GmacFESpeed100 = 0x00004000,
423 GmacFESpeed10 = 0x00000000,
425 GmacRxOwn = 0x00002000,
426 GmacDisableRxOwn = 0x00002000,
427 GmacEnableRxOwn = 0x00000000,
429 GmacLoopback = 0x00001000,
430 GmacLoopbackOn = 0x00001000,
431 GmacLoopbackOff = 0x00000000,
433 GmacDuplex = 0x00000800,
434 GmacFullDuplex = 0x00000800,
435 GmacHalfDuplex = 0x00000000,
437 GmacRxIpcOffload = 0x00000400,
439 GmacRetry = 0x00000200,
440 GmacRetryDisable = 0x00000200,
441 GmacRetryEnable = 0x00000000,
443 GmacLinkUp = 0x00000100,
444 GmacLinkDown = 0x00000100,
446 GmacPadCrcStrip = 0x00000080,
447 GmacPadCrcStripEnable = 0x00000080,
448 GmacPadCrcStripDisable = 0x00000000,
450 GmacBackoffLimit = 0x00000060,
451 GmacBackoffLimit3 = 0x00000060,
452 GmacBackoffLimit2 = 0x00000040,
453 GmacBackoffLimit1 = 0x00000020,
454 GmacBackoffLimit0 = 0x00000000,
456 GmacDeferralCheck = 0x00000010,
457 GmacDeferralCheckEnable = 0x00000010,
458 GmacDeferralCheckDisable = 0x00000000,
461 GmacTxEnable = 0x00000008,
462 GmacTxDisable = 0x00000000,
465 GmacRxEnable = 0x00000004,
466 GmacRxDisable = 0x00000000,
470 enum GmacFrameFilterReg {
471 GmacFilter = 0x80000000,
472 GmacFilterOff = 0x80000000,
473 GmacFilterOn = 0x00000000,
474 GmacVlanTagFilter = 0x00010000,
475 GmacHashPerfectFilter = 0x00000400,
477 GmacSrcAddrFilter = 0x00000200,
478 GmacSrcAddrFilterEnable = 0x00000200,
479 GmacSrcAddrFilterDisable = 0x00000000,
481 GmacSrcInvaAddrFilter = 0x00000100,
482 GmacSrcInvAddrFilterEn = 0x00000100,
483 GmacSrcInvAddrFilterDis = 0x00000000,
485 GmacPassControl = 0x000000C0,
486 GmacPassControl3 = 0x000000C0,
487 GmacPassControl2 = 0x00000080,
488 GmacPassControl1 = 0x00000040,
489 GmacPassControl0 = 0x00000000,
491 GmacBroadcast = 0x00000020,
492 GmacBroadcastDisable = 0x00000020,
493 GmacBroadcastEnable = 0x00000000,
495 GmacMulticastFilter = 0x00000010,
496 GmacMulticastFilterOff = 0x00000010,
497 GmacMulticastFilterOn = 0x00000000,
499 GmacDestAddrFilter = 0x00000008,
500 GmacDestAddrFilterInv = 0x00000008,
501 GmacDestAddrFilterNor = 0x00000000,
503 GmacMcastHashFilter = 0x00000004,
504 GmacMcastHashFilterOn = 0x00000004,
505 GmacMcastHashFilterOff = 0x00000000,
507 GmacUcastHashFilter = 0x00000002,
508 GmacUcastHashFilterOn = 0x00000002,
509 GmacUcastHashFilterOff = 0x00000000,
511 GmacPromiscuousMode = 0x00000001,
512 GmacPromiscuousModeOn = 0x00000001,
513 GmacPromiscuousModeOff = 0x00000000,
518 enum GmacGmiiAddrReg {
519 GmiiDevMask = 0x0000F800,
522 GmiiRegMask = 0x000007C0,
525 GmiiCsrClkMask = 0x0000001C,
526 GmiiCsrClk5 = 0x00000014,
527 GmiiCsrClk4 = 0x00000010,
528 GmiiCsrClk3 = 0x0000000C,
529 GmiiCsrClk2 = 0x00000008,
530 GmiiCsrClk1 = 0x00000004,
531 GmiiCsrClk0 = 0x00000000,
533 GmiiWrite = 0x00000002,
534 GmiiRead = 0x00000000,
536 GmiiBusy = 0x00000001,
539 enum GmacVlanTagReg {
540 GmacEnableSVlan = 0x00040000,
541 GmacVlanInvMatch = 0x00020000,
542 GmacEnable12BitComp = 0x00010000,
543 GmacVlanTagMsk = 0x0000FFFF
548 enum GmacLPICtrlStsReg {
549 GmacLPITxAuto = 0x00080000,
550 GmacLPIPhyStsEn = 0x00040000,
551 GmacLPIPhySts = 0x00020000,
552 GmacLPIEn = 0x00010000,
553 GmacRxLPISts = 0x00000200,
554 GmacTxLPISts = 0x00000100,
555 GmacRxLPIExit = 0x00000008,
556 GmacRxLPIEnter = 0x00000004,
557 GmacTxLPIExit = 0x00000002,
558 GmacTxLPIEnter = 0x00000001,
561 enum GmacLPITimerCtrlReg {
562 GmacLPILinkStableTimerMsk = 0x03FF0000,
563 GmacLPITxWaitTimerMsk = 0x0000FFFF,
568 enum GmacGmiiDataReg {
569 GmiiDataMask = 0x0000FFFF,
574 enum GmacFlowControlReg {
575 GmacPauseTimeMask = 0xFFFF0000,
576 GmacPauseTimeShift = 16,
578 GmacPauseLowThresh = 0x00000030,
579 GmacPauseLowThresh3 = 0x00000030,
580 GmacPauseLowThresh2 = 0x00000020,
581 GmacPauseLowThresh1 = 0x00000010,
582 GmacPauseLowThresh0 = 0x00000000,
584 GmacUnicastPauseFrame = 0x00000008,
585 GmacUnicastPauseFrameOn = 0x00000008,
586 GmacUnicastPauseFrameOff = 0x00000000,
588 GmacRxFlowControl = 0x00000004,
589 GmacRxFlowControlEnable = 0x00000004,
590 GmacRxFlowControlDisable = 0x00000000,
592 GmacTxFlowControl = 0x00000002,
593 GmacTxFlowControlEnable = 0x00000002,
594 GmacTxFlowControlDisable = 0x00000000,
596 GmacFlowControlBackPressure= 0x00000001,
597 GmacSendPauseFrame = 0x00000001,
601 enum GmacVLANIncRepReg {
602 GmacSVLAN = 0x00080000,
603 GmacCVLAN = 0x00000000,
604 GmacVLP = 0x00040000,
605 GmacVLANNoACT = 0x00000000,
606 GmacVLANDel = 0x00010000,
607 GmacVLANIns = 0x00020000,
608 GmacVLANRep = 0x00030000,
609 GmacVLANMsk = 0x0000FFFF
614 enum GmacInterruptStatusBitDefinition {
615 GmacLPIIntSts = 0x00000400,
616 GmacTSIntSts = 0x00000200,
617 GmacMmcRxChksumOffload = 0x00000080,
618 GmacMmcTxIntSts = 0x00000040,
619 GmacMmcRxIntSts = 0x00000020,
620 GmacMmcIntSts = 0x00000010,
621 GmacPmtIntSts = 0x00000008,
622 GmacPcsAnComplete = 0x00000004,
623 GmacPcsLnkStsChange = 0x00000002,
624 GmacRgmiiIntSts = 0x00000001,
629 enum GmacInterruptMaskBitDefinition {
630 GmacTSIntMask = 0x00000200,
631 GmacPmtIntMask = 0x00000008,
632 GmacPcsAnIntMask = 0x00000004,
633 GmacPcsLnkStsIntMask = 0x00000002,
634 GmacRgmiiIntMask = 0x00000001,
645 DmaTxPollDemand = 0x0004,
646 DmaRxPollDemand = 0x0008,
647 DmaRxBaseAddr = 0x000C,
648 DmaTxBaseAddr = 0x0010,
651 DmaInterrupt = 0x001C,
652 DmaMissedFr = 0x0020,
653 DmaTxCurrDesc = 0x0048,
654 DmaRxCurrDesc = 0x004C,
655 DmaTxCurrAddr = 0x0050,
656 DmaRxCurrAddr = 0x0054,
669 DmaFixedBurstEnable = 0x00010000,
670 DmaFixedBurstDisable = 0x00000000,
672 DmaTxPriorityRatio11 = 0x00000000,
673 DmaTxPriorityRatio21 = 0x00004000,
674 DmaTxPriorityRatio31 = 0x00008000,
675 DmaTxPriorityRatio41 = 0x0000C000,
677 DmaBurstLengthx8 = 0x01000000,
679 DmaBurstLength256 = 0x01002000,
680 DmaBurstLength128 = 0x01001000,
681 DmaBurstLength64 = 0x01000800,
682 DmaBurstLength32 = 0x00002000,
683 DmaBurstLength16 = 0x00001000,
684 DmaBurstLength8 = 0x00000800,
685 DmaBurstLength4 = 0x00000400,
686 DmaBurstLength2 = 0x00000200,
687 DmaBurstLength1 = 0x00000100,
688 DmaBurstLength0 = 0x00000000,
690 DmaDescriptor8Words = 0x00000080,
691 DmaDescriptor4Words = 0x00000000,
693 DmaDescriptorSkip16 = 0x00000040,
694 DmaDescriptorSkip8 = 0x00000020,
695 DmaDescriptorSkip4 = 0x00000010,
696 DmaDescriptorSkip2 = 0x00000008,
697 DmaDescriptorSkip1 = 0x00000004,
698 DmaDescriptorSkip0 = 0x00000000,
700 DmaArbitRr = 0x00000000,
701 DmaArbitPr = 0x00000002,
703 DmaResetOn = 0x00000001,
704 DmaResetOff = 0x00000000,
713 GmacLPIIntr = 0x40000000,
716 GmacPmtIntr = 0x10000000,
717 GmacMmcIntr = 0x08000000,
718 GmacLineIntfIntr = 0x04000000,
720 DmaErrorBit2 = 0x02000000,
721 DmaErrorBit1 = 0x01000000,
722 DmaErrorBit0 = 0x00800000,
724 DmaTxState = 0x00700000,
725 DmaTxStopped = 0x00000000,
726 DmaTxFetching = 0x00100000,
727 DmaTxWaiting = 0x00200000,
728 DmaTxReading = 0x00300000,
729 DmaTxSuspended = 0x00600000,
730 DmaTxClosing = 0x00700000,
732 DmaRxState = 0x000E0000,
733 DmaRxStopped = 0x00000000,
734 DmaRxFetching = 0x00020000,
735 DmaRxWaiting = 0x00060000,
736 DmaRxSuspended = 0x00080000,
737 DmaRxClosing = 0x000A0000,
738 DmaRxQueuing = 0x000E0000,
740 DmaIntNormal = 0x00010000,
741 DmaIntAbnormal = 0x00008000,
743 DmaIntEarlyRx = 0x00004000,
744 DmaIntBusError = 0x00002000,
745 DmaIntEarlyTx = 0x00000400,
746 DmaIntRxWdogTO = 0x00000200,
747 DmaIntRxStopped = 0x00000100,
748 DmaIntRxNoBuffer = 0x00000080,
749 DmaIntRxCompleted = 0x00000040,
750 DmaIntTxUnderflow = 0x00000020,
751 DmaIntRcvOverflow = 0x00000010,
752 DmaIntTxJabberTO = 0x00000008,
753 DmaIntTxNoBuffer = 0x00000004,
754 DmaIntTxStopped = 0x00000002,
755 DmaIntTxCompleted = 0x00000001,
760 DmaDisableDropTcpCs = 0x04000000,
762 DmaStoreAndForward = 0x00200000,
763 DmaFlushTxFifo = 0x00100000,
765 DmaTxThreshCtrl = 0x0001C000,
766 DmaTxThreshCtrl16 = 0x0001C000,
767 DmaTxThreshCtrl24 = 0x00018000,
768 DmaTxThreshCtrl32 = 0x00014000,
769 DmaTxThreshCtrl40 = 0x00010000,
770 DmaTxThreshCtrl256 = 0x0000c000,
771 DmaTxThreshCtrl192 = 0x00008000,
772 DmaTxThreshCtrl128 = 0x00004000,
773 DmaTxThreshCtrl64 = 0x00000000,
775 DmaTxStart = 0x00002000,
777 DmaRxFlowCtrlDeact = 0x00401800,
778 DmaRxFlowCtrlDeact1K = 0x00000000,
779 DmaRxFlowCtrlDeact2K = 0x00000800,
780 DmaRxFlowCtrlDeact3K = 0x00001000,
781 DmaRxFlowCtrlDeact4K = 0x00001800,
782 DmaRxFlowCtrlDeact5K = 0x00400000,
783 DmaRxFlowCtrlDeact6K = 0x00400800,
784 DmaRxFlowCtrlDeact7K = 0x00401000,
786 DmaRxFlowCtrlAct = 0x00800600,
787 DmaRxFlowCtrlAct1K = 0x00000000,
788 DmaRxFlowCtrlAct2K = 0x00000200,
789 DmaRxFlowCtrlAct3K = 0x00000400,
790 DmaRxFlowCtrlAct4K = 0x00000300,
791 DmaRxFlowCtrlAct5K = 0x00800000,
792 DmaRxFlowCtrlAct6K = 0x00800200,
793 DmaRxFlowCtrlAct7K = 0x00800400,
795 DmaRxThreshCtrl = 0x00000018,
796 DmaRxThreshCtrl64 = 0x00000000,
797 DmaRxThreshCtrl32 = 0x00000008,
798 DmaRxThreshCtrl96 = 0x00000010,
799 DmaRxThreshCtrl128 = 0x00000018,
801 DmaEnHwFlowCtrl = 0x00000100,
802 DmaDisHwFlowCtrl = 0x00000000,
804 DmaFwdErrorFrames = 0x00000080,
805 DmaFwdUnderSzFrames = 0x00000040,
806 DmaTxSecondFrame = 0x00000004,
807 DmaRxStart = 0x00000002,
812 enum DmaInterruptReg {
813 DmaIeNormal = DmaIntNormal ,
814 DmaIeAbnormal = DmaIntAbnormal ,
816 DmaIeEarlyRx = DmaIntEarlyRx ,
817 DmaIeBusError = DmaIntBusError ,
818 DmaIeEarlyTx = DmaIntEarlyTx ,
819 DmaIeRxWdogTO = DmaIntRxWdogTO ,
820 DmaIeRxStopped = DmaIntRxStopped ,
821 DmaIeRxNoBuffer = DmaIntRxNoBuffer ,
822 DmaIeRxCompleted = DmaIntRxCompleted,
823 DmaIeTxUnderflow = DmaIntTxUnderflow,
825 DmaIeRxOverflow = DmaIntRcvOverflow,
826 DmaIeTxJabberTO = DmaIntTxJabberTO ,
827 DmaIeTxNoBuffer = DmaIntTxNoBuffer ,
828 DmaIeTxStopped = DmaIntTxStopped ,
829 DmaIeTxCompleted = DmaIntTxCompleted,
870 enum DmaDescriptorStatus
873 DescOwnByDma = 0x80000000,
875 DescDAFilterFail = 0x40000000,
877 DescFrameLengthMask = 0x3FFF0000,
878 DescFrameLengthShift = 16,
880 DescError = 0x00008000,
882 DescRxTruncated = 0x00004000,
883 DescSAFilterFail = 0x00002000,
884 DescRxLengthError = 0x00001000,
885 DescRxDamaged = 0x00000800,
886 DescRxVLANTag = 0x00000400,
887 DescRxFirst = 0x00000200,
888 DescRxLast = 0x00000100,
889 DescRxLongFrame = 0x00000080,
890 DescRxTSAvailable = 0x00000080,
891 DescRxCollision = 0x00000040,
892 DescRxFrameEther = 0x00000020,
893 DescRxWatchdog = 0x00000010,
894 DescRxMiiError = 0x00000008,
895 DescRxDribbling = 0x00000004,
896 DescRxCrc = 0x00000002,
899 DescRxEXTsts = 0x00000001,
901 DescTxIntEnable = 0x40000000,
902 DescTxLast = 0x20000000,
903 DescTxFirst = 0x10000000,
904 DescTxDisableCrc = 0x08000000,
905 DescTxDisablePadd = 0x04000000,
906 DescTxTSEnable = 0x02000000,
907 DescTxCrcReplacement = 0x01000000,
908 DescTxCisMask = 0x00c00000,
909 DescTxCisBypass = 0x00000000,
910 DescTxCisIpv4HdrCs = 0x00400000,
911 DescTxCisTcpOnlyCs = 0x00800000,
912 DescTxCisTcpPseudoCs = 0x00c00000,
914 TxDescEndOfRing = 0x00200000,
915 TxDescChain = 0x00100000,
917 DescRxChkBit0 = 0x00000001,
918 DescRxChkBit7 = 0x00000080,
919 DescRxChkBit5 = 0x00000020,
921 DescRxTSavail = 0x00000080,
922 DescRxFrameType = 0x00000020,
923 DescTxTSStatus = 0x00020000,
924 DescTxIpv4ChkError = 0x00010000,
925 DescTxTimeout = 0x00004000,
926 DescTxFrameFlushed = 0x00002000,
927 DescTxPayChkError = 0x00001000,
928 DescTxLostCarrier = 0x00000800,
929 DescTxNoCarrier = 0x00000400,
930 DescTxLateCollision = 0x00000200,
931 DescTxExcCollisions = 0x00000100,
932 DescTxVLANFrame = 0x00000080,
934 DescTxCollMask = 0x00000078,
937 DescTxExcDeferral = 0x00000004,
938 DescTxUnderflow = 0x00000002,
939 DescTxDeferred = 0x00000001,
951 RxDisIntCompl = 0x80000000,
952 RxDescEndOfRing = 0x00008000,
953 RxDescChain = 0x00004000,
956 DescSize2Mask = 0x1FFF0000,
958 DescSize1Mask = 0x00001FFF,
969 DescRxPtpAvail = 0x00004000,
970 DescRxPtpVer = 0x00002000,
971 DescRxPtpFrameType = 0x00001000,
972 DescRxPtpMessageType = 0x00000F00,
973 DescRxPtpNo = 0x00000000,
974 DescRxPtpSync = 0x00000100,
975 DescRxPtpFollowUp = 0x00000200,
976 DescRxPtpDelayReq = 0x00000300,
977 DescRxPtpDelayResp = 0x00000400,
978 DescRxPtpPdelayReq = 0x00000500,
979 DescRxPtpPdelayResp = 0x00000600,
980 DescRxPtpPdelayRespFP = 0x00000700,
981 DescRxPtpIPV6 = 0x00000080,
982 DescRxPtpIPV4 = 0x00000040,
984 DescRxChkSumBypass = 0x00000020,
986 DescRxIpPayloadError = 0x00000010,
987 DescRxIpHeaderError = 0x00000008,
990 DescRxIpPayloadType = 0x00000007,
992 DescRxIpPayloadUnknown= 0x00000000,
993 DescRxIpPayloadUDP = 0x00000001,
994 DescRxIpPayloadTCP = 0x00000002,
995 DescRxIpPayloadICMP = 0x00000003,
1001 enum RxDescCOEEncode {
1003 RxIpHdrPayLoadChkBypass = 1,
1004 RxIpHdrPayLoadRes = 2,
1007 RxPayLoadChkError = 5,
1008 RxIpHdrChkError = 6,
1009 RxIpHdrPayLoadChkError = 7,
1016 enum synopGMACDmaIntEnum
1018 synopGMACDmaRxNormal = 0x01,
1019 synopGMACDmaRxAbnormal = 0x02,
1020 synopGMACDmaRxStopped = 0x04,
1021 synopGMACDmaTxNormal = 0x08,
1022 synopGMACDmaTxAbnormal = 0x10,
1023 synopGMACDmaTxStopped = 0x20,
1024 synopGMACDmaError = 0x80,
1032 enum InitialRegisters {
1034 GmacConfigInitFdx1000 = GmacWatchdogEnable | GmacJabberEnable | GmacFrameBurstEnable | GmacJumboFrameDisable
1035 | GmacSelectGmii | GmacEnableRxOwn | GmacLoopbackOff
1036 | GmacFullDuplex | GmacRetryEnable | GmacPadCrcStripDisable
1037 | GmacBackoffLimit0 | GmacDeferralCheckDisable | GmacTxEnable | GmacRxEnable,
1040 GmacConfigInitFdx110 = GmacWatchdogEnable | GmacJabberEnable | GmacFrameBurstEnable | GmacJumboFrameDisable
1041 | GmacSelectMii | GmacEnableRxOwn | GmacLoopbackOff
1042 | GmacFullDuplex | GmacRetryEnable | GmacPadCrcStripDisable
1043 | GmacBackoffLimit0 | GmacDeferralCheckDisable | GmacTxEnable | GmacRxEnable,
1049 GmacFrameFilterInitFdx = GmacFilterOn | GmacPassControl0 | GmacBroadcastEnable | GmacSrcAddrFilterDisable
1050 | GmacMulticastFilterOn | GmacDestAddrFilterNor | GmacMcastHashFilterOff
1051 | GmacPromiscuousModeOff | GmacUcastHashFilterOff,
1054 GmacFlowControlInitFdx = GmacUnicastPauseFrameOff | GmacRxFlowControlEnable | GmacTxFlowControlEnable,
1057 GmacGmiiAddrInitFdx = GmiiCsrClk2,
1063 GmacConfigInitHdx1000 = GmacWatchdogEnable | GmacJabberEnable | GmacFrameBurstEnable | GmacJumboFrameDisable
1064 | GmacSelectGmii | GmacDisableRxOwn | GmacLoopbackOff
1065 | GmacHalfDuplex | GmacRetryEnable | GmacPadCrcStripDisable
1066 | GmacBackoffLimit0 | GmacDeferralCheckDisable | GmacTxEnable | GmacRxEnable,
1069 GmacConfigInitHdx110 = GmacWatchdogEnable | GmacJabberEnable | GmacFrameBurstEnable | GmacJumboFrameDisable
1070 | GmacSelectMii | GmacDisableRxOwn | GmacLoopbackOff
1071 | GmacHalfDuplex | GmacRetryEnable | GmacPadCrcStripDisable
1072 | GmacBackoffLimit0 | GmacDeferralCheckDisable | GmacTxEnable | GmacRxEnable,
1075 GmacFrameFilterInitHdx = GmacFilterOn | GmacPassControl0 | GmacBroadcastEnable | GmacSrcAddrFilterDisable
1076 | GmacMulticastFilterOn | GmacDestAddrFilterNor | GmacMcastHashFilterOff
1077 | GmacUcastHashFilterOff| GmacPromiscuousModeOff,
1080 GmacFlowControlInitHdx = GmacUnicastPauseFrameOff | GmacRxFlowControlDisable | GmacTxFlowControlDisable,
1083 GmacGmiiAddrInitHdx = GmiiCsrClk2,
1091 DmaBusModeInit = DmaFixedBurstEnable | DmaBurstLength8 | DmaDescriptorSkip2 | DmaResetOff,
1095 DmaControlInit1000 = DmaStoreAndForward,
1098 DmaControlInit100 = DmaStoreAndForward,
1101 DmaControlInit10 = DmaStoreAndForward,
1104 DmaIntErrorMask = DmaIntBusError,
1105 DmaIntRxAbnMask = DmaIntRxNoBuffer,
1106 DmaIntRxNormMask = DmaIntRxCompleted,
1107 DmaIntRxStoppedMask = DmaIntRxStopped,
1108 DmaIntTxAbnMask = DmaIntTxUnderflow,
1109 DmaIntTxNormMask = DmaIntTxCompleted,
1110 DmaIntTxStoppedMask = DmaIntTxStopped,
1112 DmaIntEnable = DmaIeNormal | DmaIeAbnormal | DmaIntErrorMask
1113 | DmaIntRxAbnMask | DmaIntRxNormMask | DmaIntRxStoppedMask
1114 | DmaIntTxAbnMask | DmaIntTxNormMask | DmaIntTxStoppedMask,
1139 #define WAKEUP_REG_LENGTH 8 1141 enum GmacPmtCtrlStatusBitDefinition {
1142 GmacPmtFrmFilterPtrReset = 0x80000000,
1143 GmacPmtGlobalUnicast = 0x00000200,
1144 GmacPmtWakeupFrameReceived = 0x00000040,
1145 GmacPmtMagicPktReceived = 0x00000020,
1146 GmacPmtWakeupFrameEnable = 0x00000004,
1147 GmacPmtMagicPktEnable = 0x00000002,
1148 GmacPmtPowerDown = 0x00000001,
1157 enum PTPMessageType {
1164 Pdelay_Resp_Follow_Up = 0xA,
1195 GmacTSENMACADDR = 0x00040000,
1197 GmacTSCLKTYPE = 0x00030000,
1208 GmacTSOrdClk = 0x00000000,
1209 GmacTSBouClk = 0x00010000,
1210 GmacTSEtoEClk = 0x00020000,
1211 GmacTSPtoPClk = 0x00030000,
1213 GmacTSMSTRENA = 0x00008000,
1214 GmacTSEVNTENA = 0x00004000,
1215 GmacTSIPV4ENA = 0x00002000,
1216 GmacTSIPV6ENA = 0x00001000,
1217 GmacTSIPENA = 0x00000800,
1218 GmacTSVER2ENA = 0x00000400,
1220 GmacTSCTRLSSR = 0x00000200,
1222 GmacTSENALL = 0x00000100,
1224 GmacTSADDREG = 0x00000020,
1225 GmacTSUPDT = 0x00000008,
1226 GmacTSINT = 0x00000004,
1228 GmacTSTRIG = 0x00000010,
1230 GmacTSCFUPDT = 0x00000002,
1231 GmacTSCUPDTCoarse = 0x00000000,
1232 GmacTSCUPDTFine = 0x00000002,
1234 GmacTSENA = 0x00000001,
1239 enum GmacTSSubSecIncrReg {
1240 GmacSSINCMsk = 0x000000FF,
1245 GmacTSSign = 0x80000000,
1246 GmacTSPositive = 0x00000000,
1247 GmacTSNegative = 0x80000000,
1252 GmacTSDecThr = 0x3B9AC9FF,
1256 enum GmacTSHighWordReg {
1257 GmacTSHighWordMask = 0x0000FFFF,
1260 enum GmacTSStatusReg {
1261 GmacTSTargTimeReached = 0x00000002,
1262 GmacTSSecondsOverflow = 0x00000001,
1287 void synopGMAC_TS_ptp_over_ethernet_disable(
synopGMACdevice *gmacdev);
1305 u32 * sec_val,
u32 * sub_sec_val);
1308 void synopGMAC_TS_load_timestamp_higher_val(
synopGMACdevice *gmacdev,
u32 higher_sec_val);
1309 void synopGMAC_TS_read_timestamp_higher_val(
synopGMACdevice *gmacdev,
u16 * higher_sec_val);
1310 void synopGMAC_TS_read_target_timestamp(
synopGMACdevice *gmacdev,
u32 * sec_val,
u32 * sub_sec_val);
1318 s32 synopGMAC_read_phy_reg(
u32 *RegBase,
u32 PhyBase,
u32 RegOffset,
u16 * data);
1319 s32 synopGMAC_write_phy_reg(
u32 *RegBase,
u32 PhyBase,
u32 RegOffset,
u16 data);
1368 void synopGMAC_multicast_hash_filter_enable(
synopGMACdevice * gmacdev);
1369 void synopGMAC_multicast_hash_filter_disable(
synopGMACdevice * gmacdev);
1373 void synopGMAC_unicast_hash_filter_disable(
synopGMACdevice * gmacdev);
1374 void synopGMAC_unicast_pause_frame_detect_enable(
synopGMACdevice * gmacdev);
1375 void synopGMAC_unicast_pause_frame_detect_disable(
synopGMACdevice * gmacdev);
1388 void synopGMAC_rx_desc_init_ring(
DmaDesc *desc,
bool last_ring_desc);
1389 void synopGMAC_tx_desc_init_ring(
DmaDesc *desc,
bool last_ring_desc);
1390 void synopGMAC_rx_desc_init_chain(
DmaDesc * desc);
1391 void synopGMAC_tx_desc_init_chain(
DmaDesc * desc);
1395 void synopGMAC_set_owner_dma(
DmaDesc *desc);
1396 void synopGMAC_set_desc_sof(
DmaDesc *desc);
1397 void synopGMAC_set_desc_eof(
DmaDesc *desc);
1398 bool synopGMAC_is_sof_in_rx_desc(
DmaDesc *desc);
1399 bool synopGMAC_is_eof_in_rx_desc(
DmaDesc *desc);
1400 bool synopGMAC_is_da_filter_failed(
DmaDesc *desc);
1401 bool synopGMAC_is_sa_filter_failed(
DmaDesc *desc);
1402 bool synopGMAC_is_desc_owned_by_dma(
DmaDesc *desc);
1403 u32 synopGMAC_get_rx_desc_frame_length(
u32 status);
1404 bool synopGMAC_is_desc_valid(
u32 status);
1405 bool synopGMAC_is_desc_empty(
DmaDesc *desc);
1406 bool synopGMAC_is_rx_desc_valid(
u32 status);
1407 bool synopGMAC_is_tx_aborted(
u32 status);
1408 bool synopGMAC_is_tx_carrier_error(
u32 status);
1409 u32 synopGMAC_get_tx_collision_count(
u32 status);
1410 u32 synopGMAC_is_exc_tx_collisions(
u32 status);
1411 bool synopGMAC_is_rx_frame_damaged(
u32 status);
1412 bool synopGMAC_is_rx_frame_collision(
u32 status);
1413 bool synopGMAC_is_rx_crc(
u32 status);
1414 bool synopGMAC_is_frame_dribbling_errors(
u32 status);
1415 bool synopGMAC_is_rx_frame_length_errors(
u32 status);
1418 bool synopGMAC_is_rx_desc_chained(
DmaDesc * desc);
1419 bool synopGMAC_is_tx_desc_chained(
DmaDesc * desc);
1420 void synopGMAC_get_desc_data(
DmaDesc * desc,
u32 * Status,
u32 * Buffer1,
u32 * Length1,
u32 * Data1);
1439 void synopGMAC_take_desc_ownership(
DmaDesc * desc);
1462 void synopGMAC_write_wakeup_frame_register(
synopGMACdevice *gmacdev,
u32 * filter_contents);
1468 void synopGMAC_rx_tcpip_chksum_drop_disable(
synopGMACdevice *gmacdev);
1470 bool synopGMAC_is_tx_ipv4header_checksum_error(
synopGMACdevice *gmacdev,
u32 status);
signed int s32
Define 32-bit signed data type.
GmacTSControlReg
IEEE 1588-2008 is the optional module to support Ethernet frame time stamping.
unsigned char u8
Define 8-bit unsigned data type.
unsigned short u16
Define 16-bit unsigned data type.
unsigned int u32
Define 32-bit unsigned data type.
This file serves as the wrapper for the platform/OS dependent functions It is needed to modify these ...