32 #define TRACE_LEVEL NIC_TRACE_LEVEL
35 #include <hw_include/csl_cpswitch.h>
36 #include <kernel/dpl/AddrTranslateP.h>
37 #include <drivers/pinmux.h>
38 #include <drivers/udma/udma_priv.h>
39 #include <networking/enet/utils/include/enet_apputils.h>
40 #include <networking/enet/utils/include/enet_appmemutils.h>
41 #include <networking/enet/utils/include/enet_appmemutils_cfg.h>
47 #define MDIO_INPUT_CLK 250000000
49 #define MDIO_OUTPUT_CLK 1000000
57 static EnetDma_TxChHandle txChHandle = NULL;
59 static EnetDma_RxChHandle rxChHandle = NULL;
62 static EnetDma_PktQ txFreePacketQueue;
64 static EnetDma_PktQ rxFreePacketQueue;
127 volatile CSL_Xge_cpswRegs *ctrlRegs;
128 volatile CSL_AleRegs *aleRegs;
129 volatile CSL_main_ctrl_mmr_cfg0Regs *mmrRegs;
132 TRACE_INFO(
"Initializing AM64x Ethernet MAC (port 1)...\r\n");
138 nicDriverInterface1 = interface;
141 error = interface->phyDriver->init(interface);
152 mmrRegs = (
volatile CSL_main_ctrl_mmr_cfg0Regs *) CSL_CTRL_MMR0_CFG0_BASE;
155 interface->macAddr.b[0] = (mmrRegs->MAC_ID1 >> 8) & 0xFF;
156 interface->macAddr.b[1] = mmrRegs->MAC_ID1 & 0xFF;
157 interface->macAddr.b[2] = (mmrRegs->MAC_ID0 >> 24) & 0xFF;
158 interface->macAddr.b[3] = (mmrRegs->MAC_ID0 >> 16) & 0xFF;
159 interface->macAddr.b[4] = (mmrRegs->MAC_ID0 >> 8) & 0xFF;
160 interface->macAddr.b[5] = mmrRegs->MAC_ID0 & 0xFF;
167 ctrlRegs = (
volatile CSL_Xge_cpswRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_NU_OFFSET);
169 aleRegs = (
volatile CSL_AleRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_ALE_OFFSET);
172 ctrlRegs->ENETPORT[0].PN_MAC_CONTROL_REG |= CSL_XGE_CPSW_PN_MAC_CONTROL_REG_CMD_IDLE_MASK;
175 while((ctrlRegs->ENETPORT[0].PN_MAC_STATUS_REG & CSL_XGE_CPSW_PN_MAC_STATUS_REG_IDLE_MASK) == 0)
180 ctrlRegs->ENETPORT[0].PN_MAC_SOFT_RESET_REG |= CSL_XGE_CPSW_PN_MAC_SOFT_RESET_REG_SOFT_RESET_MASK;
183 while((ctrlRegs->ENETPORT[0].PN_MAC_SOFT_RESET_REG &
184 CSL_XGE_CPSW_PN_MAC_SOFT_RESET_REG_SOFT_RESET_MASK) != 0)
189 temp = aleRegs->I0_ALE_PORTCTL0[1] & ~CSL_ALE_I0_ALE_PORTCTL0_I0_REG_P0_PORTSTATE_MASK;
190 aleRegs->I0_ALE_PORTCTL0[1] = temp | (3 << CSL_ALE_I0_ALE_PORTCTL0_I0_REG_P0_PORTSTATE_SHIFT);
193 ctrlRegs->ENETPORT[0].PN_SA_H_REG = interface->macAddr.w[0] | (interface->macAddr.w[1] << 16);
194 ctrlRegs->ENETPORT[0].PN_SA_L_REG = interface->macAddr.w[2];
197 ctrlRegs->ENETPORT[0].PN_PORT_VLAN_REG = (0 << CSL_XGE_CPSW_PN_PORT_VLAN_REG_PORT_PRI_SHIFT) |
198 (
CPSW_PORT1 << CSL_XGE_CPSW_PN_PORT_VLAN_REG_PORT_VID_SHIFT);
207 ctrlRegs->STAT_PORT_EN_REG |= CSL_XGE_CPSW_STAT_PORT_EN_REG_P1_STAT_EN_MASK;
210 ctrlRegs->ENETPORT[0].PN_MAC_CONTROL_REG = CSL_XGE_CPSW_PN_MAC_CONTROL_REG_GMII_EN_MASK;
230 volatile CSL_Xge_cpswRegs *ctrlRegs;
231 volatile CSL_AleRegs *aleRegs;
234 TRACE_INFO(
"Initializing AM64x Ethernet MAC (port 2)...\r\n");
240 nicDriverInterface2 = interface;
243 error = interface->phyDriver->init(interface);
251 ctrlRegs = (
volatile CSL_Xge_cpswRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_NU_OFFSET);
253 aleRegs = (
volatile CSL_AleRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_ALE_OFFSET);
256 ctrlRegs->ENETPORT[1].PN_MAC_CONTROL_REG |= CSL_XGE_CPSW_PN_MAC_CONTROL_REG_CMD_IDLE_MASK;
259 while((ctrlRegs->ENETPORT[1].PN_MAC_STATUS_REG & CSL_XGE_CPSW_PN_MAC_STATUS_REG_IDLE_MASK) == 0)
264 ctrlRegs->ENETPORT[1].PN_MAC_SOFT_RESET_REG |= CSL_XGE_CPSW_PN_MAC_SOFT_RESET_REG_SOFT_RESET_MASK;
267 while((ctrlRegs->ENETPORT[1].PN_MAC_SOFT_RESET_REG &
268 CSL_XGE_CPSW_PN_MAC_SOFT_RESET_REG_SOFT_RESET_MASK) != 0)
273 temp = aleRegs->I0_ALE_PORTCTL0[2] & ~CSL_ALE_I0_ALE_PORTCTL0_I0_REG_P0_PORTSTATE_MASK;
274 aleRegs->I0_ALE_PORTCTL0[2] = temp | (3 << CSL_ALE_I0_ALE_PORTCTL0_I0_REG_P0_PORTSTATE_SHIFT);
277 ctrlRegs->ENETPORT[1].PN_SA_H_REG = interface->macAddr.w[0] | (interface->macAddr.w[1] << 16);
278 ctrlRegs->ENETPORT[1].PN_SA_L_REG = interface->macAddr.w[2];
281 ctrlRegs->ENETPORT[1].PN_PORT_VLAN_REG = (0 << CSL_XGE_CPSW_PN_PORT_VLAN_REG_PORT_PRI_SHIFT) |
282 (
CPSW_PORT2 << CSL_XGE_CPSW_PN_PORT_VLAN_REG_PORT_VID_SHIFT);
291 ctrlRegs->STAT_PORT_EN_REG |= CSL_XGE_CPSW_STAT_PORT_EN_REG_P2_STAT_EN_MASK;
294 ctrlRegs->ENETPORT[1].PN_MAC_CONTROL_REG = CSL_XGE_CPSW_PN_MAC_CONTROL_REG_GMII_EN_MASK;
317 EnetOsal_Cfg osalConfig;
318 EnetUtils_Cfg utilsConfig;
319 EnetUdma_Cfg dmaConfig;
320 EnetUdma_OpenTxChPrms txChCfg;
321 EnetUdma_OpenRxFlowPrms rxChCfg;
322 Enet_IoctlPrms ioctlParams;
323 EnetPer_AttachCoreOutArgs attachCoreOutArgs;
324 Enet_Handle enetHandle;
325 Udma_DrvHandle udmaHandle;
326 EnetDma_Pkt *packetInfo;
327 volatile CSL_Xge_cpswRegs *ctrlRegs;
328 volatile CSL_AleRegs *aleRegs;
329 volatile CSL_MdioRegs *mdioRegs;
330 uint8_t macAddr[ENET_MAC_ADDR_LEN];
333 if(nicDriverInterface1 == NULL && nicDriverInterface2 == NULL)
335 uint32_t txChNum = 0;
336 uint32_t rxFlowIdx = 0;
337 uint32_t rxStartFlowIdx = 0;
340 coreId = EnetSoc_getCoreId();
346 memset(&cpswConfig, 0,
sizeof(Cpsw_Cfg));
347 memset(&dmaConfig, 0,
sizeof(EnetUdma_Cfg));
350 Enet_initOsalCfg(&osalConfig);
351 Enet_initUtilsCfg(&utilsConfig);
352 Enet_init(&osalConfig, &utilsConfig);
358 status = EnetMem_init();
360 if(status != ENET_SOK)
363 TRACE_ERROR(
"Failed to initialize memory (status = %d)\r\n", status);
365 EnetAppUtils_assert(
false);
369 EnetQueue_initQ(&txFreePacketQueue);
372 TRACE_INFO(
" Initializing UDMA driver...\r\n");
375 udmaHandle = EnetAppUtils_udmaOpen(ENET_CPSW_3G, NULL);
377 if(udmaHandle == NULL)
382 EnetAppUtils_assert(
false);
386 TRACE_INFO(
" Initializing CPSW clocks...\r\n");
388 EnetAppUtils_enableClocks(ENET_CPSW_3G, 0);
391 dmaConfig.rxChInitPrms.dmaPriority = UDMA_DEFAULT_RX_CH_DMA_PRIORITY;
392 dmaConfig.hUdmaDrv = udmaHandle;
395 Enet_initCfg(ENET_CPSW_3G, 0, &cpswConfig,
sizeof(Cpsw_Cfg));
396 cpswConfig.vlanCfg.vlanAware =
false;
397 cpswConfig.hostPortCfg.removeCrc =
false;
398 cpswConfig.hostPortCfg.padShortPacket =
true;
399 cpswConfig.hostPortCfg.passCrcErrors =
false;
400 cpswConfig.dmaCfg = &dmaConfig;
403 TRACE_INFO(
" Initializing RM configuration...\r\n");
405 EnetAppUtils_initResourceConfig(ENET_CPSW_3G, coreId, &cpswConfig.resCfg);
408 TRACE_INFO(
" Initializing CPSW peripheral...\r\n");
411 enetHandle = Enet_open(ENET_CPSW_3G, 0, &cpswConfig,
sizeof(Cpsw_Cfg));
413 if(enetHandle == NULL)
418 EnetAppUtils_assert(
false);
425 ENET_IOCTL_SET_INOUT_ARGS(&ioctlParams, &coreId, &attachCoreOutArgs);
428 status = Enet_ioctl(enetHandle, coreId, ENET_PER_IOCTL_ATTACH_CORE,
431 if(status != ENET_SOK)
434 TRACE_ERROR(
"Failed to attach core with RM (status = %d)\r\n", status);
436 EnetAppUtils_assert(
false);
440 coreKey = attachCoreOutArgs.coreKey;
443 EnetDma_initTxChParams(&txChCfg);
444 txChCfg.hUdmaDrv = udmaHandle;
445 txChCfg.notifyCb = NULL;
446 txChCfg.cbArg = NULL;
447 txChCfg.useGlobalEvt =
true;
450 EnetAppUtils_setCommonTxChPrms(&txChCfg);
456 EnetAppUtils_openTxCh(enetHandle, coreKey, coreId, &txChNum,
457 &txChHandle, &txChCfg);
459 if(txChHandle == NULL)
464 EnetAppUtils_assert(
false);
468 for(i = 0; i < ENET_MEM_NUM_TX_PKTS; i++)
471 packetInfo = EnetMem_allocEthPkt(NULL, ENET_MEM_LARGE_POOL_PKT_SIZE,
472 ENETDMA_CACHELINE_ALIGNMENT);
475 EnetAppUtils_assert(packetInfo != NULL);
478 EnetQueue_enq(&txFreePacketQueue, &packetInfo->node);
482 TRACE_INFO(
" TX queue initialized with %u packets\r\n",
483 EnetQueue_getQCount(&txFreePacketQueue));
486 EnetDma_initRxChParams(&rxChCfg);
487 rxChCfg.hUdmaDrv = udmaHandle;
489 rxChCfg.cbArg = NULL;
490 rxChCfg.useGlobalEvt =
true;
491 rxChCfg.flowPrms.sizeThreshEn = 0;
494 EnetAppUtils_setCommonRxFlowPrms(&rxChCfg);
497 EnetAppUtils_openRxFlowForChIdx(ENET_CPSW_3G, enetHandle, coreKey,
498 coreId,
true, 0, &rxStartFlowIdx, &rxFlowIdx, macAddr, &rxChHandle,
501 if(rxChHandle == NULL)
506 EnetAppUtils_assert(
false);
510 EnetQueue_initQ(&rxFreePacketQueue);
513 for(i = 0; i < ENET_MEM_NUM_RX_PKTS; i++)
516 packetInfo = EnetMem_allocEthPkt(NULL, ENET_MEM_LARGE_POOL_PKT_SIZE,
517 ENETDMA_CACHELINE_ALIGNMENT);
520 EnetAppUtils_assert(packetInfo != NULL);
523 EnetQueue_enq(&rxFreePacketQueue, &packetInfo->node);
527 TRACE_INFO(
" RX queue initialized with %u packets\r\n",
528 EnetQueue_getQCount(&rxFreePacketQueue));
531 EnetDma_submitRxPktQ(rxChHandle, &rxFreePacketQueue);
534 ctrlRegs = (
volatile CSL_Xge_cpswRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_NU_OFFSET);
536 aleRegs = (
volatile CSL_AleRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_ALE_OFFSET);
538 mdioRegs = (
volatile CSL_MdioRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_MDIO_OFFSET);
541 aleRegs->ALE_CONTROL = CSL_ALE_ALE_CONTROL_ENABLE_ALE_MASK |
542 CSL_ALE_ALE_CONTROL_CLEAR_TABLE_MASK;
545 aleRegs->ALE_CONTROL |= CSL_ALE_ALE_CONTROL_ALE_VLAN_AWARE_MASK;
548 temp = aleRegs->I0_ALE_PORTCTL0[0] & ~CSL_ALE_I0_ALE_PORTCTL0_I0_REG_P0_PORTSTATE_MASK;
549 aleRegs->I0_ALE_PORTCTL0[0] = temp | (3 << CSL_ALE_I0_ALE_PORTCTL0_I0_REG_P0_PORTSTATE_SHIFT);
552 ctrlRegs->P0_CONTROL_REG = 0;
555 temp = ctrlRegs->P0_RX_MAXLEN_REG & ~CSL_XGE_CPSW_P0_RX_MAXLEN_REG_RX_MAXLEN_MASK;
556 ctrlRegs->P0_RX_MAXLEN_REG = temp | (
ETH_MAX_FRAME_SIZE << CSL_XGE_CPSW_P0_RX_MAXLEN_REG_RX_MAXLEN_SHIFT);
559 ctrlRegs->CONTROL_REG = CSL_XGE_CPSW_CONTROL_REG_P0_RX_PAD_MASK |
560 CSL_XGE_CPSW_CONTROL_REG_P0_ENABLE_MASK;
563 ctrlRegs->STAT_PORT_EN_REG |= CSL_XGE_CPSW_STAT_PORT_EN_REG_P0_STAT_EN_MASK;
569 mdioRegs->CONTROL_REG = CSL_MDIO_CONTROL_REG_ENABLE_MASK |
570 CSL_MDIO_CONTROL_REG_FAULT_DETECT_ENABLE_MASK |
571 (temp & CSL_MDIO_CONTROL_REG_CLKDIV_MASK);
584 #if defined(USE_TMDS64GPEVM)
586 const Pinmux_PerCfg_t mdioPins[] =
589 {PIN_PRG0_PRU1_GPO19, PIN_MODE(4) | PIN_PULL_DISABLE},
591 {PIN_PRG0_PRU1_GPO18, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
594 {PIN_PRG1_PRU0_GPO10, PIN_MODE(4) | PIN_PULL_DISABLE},
596 {PIN_PRG1_PRU0_GPO9, PIN_MODE(4) | PIN_PULL_DISABLE},
598 {PIN_PRG1_PRU1_GPO7, PIN_MODE(4) | PIN_PULL_DISABLE},
600 {PIN_PRG1_PRU1_GPO9, PIN_MODE(4) | PIN_PULL_DISABLE},
602 {PIN_PRG1_PRU1_GPO10, PIN_MODE(4) | PIN_PULL_DISABLE},
604 {PIN_PRG1_PRU1_GPO17, PIN_MODE(4) | PIN_PULL_DISABLE},
606 {PIN_PRG0_PRU0_GPO10, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
608 {PIN_PRG0_PRU0_GPO9, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
610 {PIN_PRG0_PRU1_GPO7, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
612 {PIN_PRG0_PRU1_GPO9, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
614 {PIN_PRG0_PRU1_GPO10, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
616 {PIN_PRG0_PRU1_GPO17, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
619 {PIN_PRG1_PRU1_GPO16, PIN_MODE(4) | PIN_PULL_DISABLE},
621 {PIN_PRG1_PRU1_GPO15, PIN_MODE(4) | PIN_PULL_DISABLE},
623 {PIN_PRG1_PRU1_GPO11, PIN_MODE(4) | PIN_PULL_DISABLE},
625 {PIN_PRG1_PRU1_GPO12, PIN_MODE(4) | PIN_PULL_DISABLE},
627 {PIN_PRG1_PRU1_GPO13, PIN_MODE(4) | PIN_PULL_DISABLE},
629 {PIN_PRG1_PRU1_GPO14, PIN_MODE(4) | PIN_PULL_DISABLE},
631 {PIN_PRG1_PRU1_GPO6, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
633 {PIN_PRG1_PRU1_GPO4, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
635 {PIN_PRG1_PRU1_GPO0, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
637 {PIN_PRG1_PRU1_GPO1, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
639 {PIN_PRG1_PRU1_GPO2, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
641 {PIN_PRG1_PRU1_GPO3, PIN_MODE(4) | PIN_INPUT_ENABLE | PIN_PULL_DISABLE},
644 {PINMUX_END, PINMUX_END}
648 Pinmux_config(mdioPins, PINMUX_DOMAIN_ID_MAIN);
665 if(interface->phyDriver != NULL)
668 interface->phyDriver->tick(interface);
670 else if(interface->switchDriver != NULL)
673 interface->switchDriver->tick(interface);
690 if(interface->phyDriver != NULL)
693 interface->phyDriver->enableIrq(interface);
695 else if(interface->switchDriver != NULL)
698 interface->switchDriver->enableIrq(interface);
715 if(interface->phyDriver != NULL)
718 interface->phyDriver->disableIrq(interface);
720 else if(interface->switchDriver != NULL)
723 interface->switchDriver->disableIrq(interface);
745 nicDriverInterface1->nicEvent =
TRUE;
761 static uint32_t temp[ENET_MEM_LARGE_POOL_PKT_SIZE / 4];
764 EnetDma_PktQ readyPacketQueue;
765 EnetDma_PktQ freePacketQueue;
766 EnetDma_Pkt *packetInfo;
770 EnetQueue_initQ(&readyPacketQueue);
771 EnetQueue_initQ(&freePacketQueue);
774 status = EnetDma_retrieveRxPktQ(rxChHandle, &readyPacketQueue);
777 if(status == ENET_SOK)
780 packetInfo = (EnetDma_Pkt *) EnetQueue_deq(&readyPacketQueue);
783 while(packetInfo != NULL)
786 if(packetInfo->rxPortNum == ENET_MAC_PORT_1)
789 interface = nicDriverInterface1;
791 else if(packetInfo->rxPortNum == ENET_MAC_PORT_2)
794 interface = nicDriverInterface2;
803 n = packetInfo->userBufLen;
806 if(interface != NULL)
809 osMemcpy(temp, packetInfo->bufPtr, (
n + 3) & ~3UL);
819 packetInfo->userBufLen = ENET_MEM_LARGE_POOL_PKT_SIZE;
822 EnetQueue_enq(&freePacketQueue, &packetInfo->node);
825 packetInfo = (EnetDma_Pkt *) EnetQueue_deq(&readyPacketQueue);
829 EnetDma_submitRxPktQ(rxChHandle, &freePacketQueue);
849 EnetDma_PktQ freePacketQueue;
850 EnetDma_PktQ submitPacketQueue;
851 EnetDma_Pkt *packetInfo;
854 EnetQueue_initQ(&freePacketQueue);
855 EnetQueue_initQ(&submitPacketQueue);
858 status = EnetDma_retrieveTxPktQ(txChHandle, &freePacketQueue);
861 if(status == ENET_SOK)
864 packetInfo = (EnetDma_Pkt *) EnetQueue_deq(&freePacketQueue);
867 while(packetInfo != NULL)
869 EnetQueue_enq(&txFreePacketQueue, &packetInfo->node);
870 packetInfo = (EnetDma_Pkt *) EnetQueue_deq(&freePacketQueue);
878 if(
length > ENET_MEM_LARGE_POOL_PKT_SIZE)
887 packetInfo = (EnetDma_Pkt *) EnetQueue_deq(&txFreePacketQueue);
890 if(packetInfo != NULL)
896 packetInfo->userBufLen =
length;
897 packetInfo->appPriv = NULL;
898 packetInfo->tsInfo.enableHostTxTs =
false;
901 if(interface == nicDriverInterface1)
904 packetInfo->txPortNum = ENET_MAC_PORT_1;
909 packetInfo->txPortNum = ENET_MAC_PORT_2;
913 EnetQueue_enq(&submitPacketQueue, &packetInfo->node);
917 status = EnetDma_submitTxPktQ(txChHandle, &submitPacketQueue);
923 if(status == ENET_SOK)
950 if(interface == nicDriverInterface1)
954 else if(interface == nicDriverInterface2)
968 entry = &interface->macAddrFilter[i];
1000 uint32_t config = 0;
1001 volatile CSL_Xge_cpswRegs *ctrlRegs;
1004 ctrlRegs = (
volatile CSL_Xge_cpswRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_NU_OFFSET);
1007 if(interface == nicDriverInterface1)
1009 config = ctrlRegs->ENETPORT[0].PN_MAC_CONTROL_REG;
1011 else if(interface == nicDriverInterface2)
1013 config = ctrlRegs->ENETPORT[1].PN_MAC_CONTROL_REG;
1019 config |= CSL_XGE_CPSW_PN_MAC_CONTROL_REG_GIG_MASK;
1020 config &= ~CSL_XGE_CPSW_PN_MAC_CONTROL_REG_IFCTL_A_MASK;
1025 config &= ~CSL_XGE_CPSW_PN_MAC_CONTROL_REG_GIG_MASK;
1026 config |= CSL_XGE_CPSW_PN_MAC_CONTROL_REG_IFCTL_A_MASK;
1031 config &= ~CSL_XGE_CPSW_PN_MAC_CONTROL_REG_GIG_MASK;
1032 config &= ~CSL_XGE_CPSW_PN_MAC_CONTROL_REG_IFCTL_A_MASK;
1038 config |= CSL_XGE_CPSW_PN_MAC_CONTROL_REG_FULLDUPLEX_MASK;
1042 config &= ~CSL_XGE_CPSW_PN_MAC_CONTROL_REG_FULLDUPLEX_MASK;
1046 if(interface == nicDriverInterface1)
1048 ctrlRegs->ENETPORT[0].PN_MAC_CONTROL_REG = config;
1050 else if(interface == nicDriverInterface2)
1052 ctrlRegs->ENETPORT[1].PN_MAC_CONTROL_REG = config;
1072 volatile CSL_MdioRegs *mdioRegs;
1075 mdioRegs = (
volatile CSL_MdioRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_MDIO_OFFSET);
1081 temp = CSL_MDIO_USER_GROUP_USER_ACCESS_REG_GO_MASK |
1082 CSL_MDIO_USER_GROUP_USER_ACCESS_REG_WRITE_MASK;
1085 temp |= (phyAddr << CSL_MDIO_USER_GROUP_USER_ACCESS_REG_PHYADR_SHIFT) &
1086 CSL_MDIO_USER_GROUP_USER_ACCESS_REG_PHYADR_MASK;
1089 temp |= (
regAddr << CSL_MDIO_USER_GROUP_USER_ACCESS_REG_REGADR_SHIFT) &
1090 CSL_MDIO_USER_GROUP_USER_ACCESS_REG_REGADR_MASK;
1093 temp |=
data & CSL_MDIO_USER_GROUP_USER_ACCESS_REG_DATA_MASK;
1096 mdioRegs->USER_GROUP[0].USER_ACCESS_REG = temp;
1099 while((mdioRegs->USER_GROUP[0].USER_ACCESS_REG &
1100 CSL_MDIO_USER_GROUP_USER_ACCESS_REG_GO_MASK) != 0)
1124 volatile CSL_MdioRegs *mdioRegs;
1127 mdioRegs = (
volatile CSL_MdioRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_MDIO_OFFSET);
1133 temp = CSL_MDIO_USER_GROUP_USER_ACCESS_REG_GO_MASK;
1136 temp |= (phyAddr << CSL_MDIO_USER_GROUP_USER_ACCESS_REG_PHYADR_SHIFT) &
1137 CSL_MDIO_USER_GROUP_USER_ACCESS_REG_PHYADR_MASK;
1140 temp |= (
regAddr << CSL_MDIO_USER_GROUP_USER_ACCESS_REG_REGADR_SHIFT) &
1141 CSL_MDIO_USER_GROUP_USER_ACCESS_REG_REGADR_MASK;
1144 mdioRegs->USER_GROUP[0].USER_ACCESS_REG = temp;
1147 while((mdioRegs->USER_GROUP[0].USER_ACCESS_REG &
1148 CSL_MDIO_USER_GROUP_USER_ACCESS_REG_GO_MASK) != 0)
1153 data = mdioRegs->USER_GROUP[0].USER_ACCESS_REG &
1154 CSL_MDIO_USER_GROUP_USER_ACCESS_REG_DATA_MASK;
1175 volatile CSL_AleRegs *aleRegs;
1178 aleRegs = (
volatile CSL_AleRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_ALE_OFFSET);
1181 aleRegs->ALE_TBLW2 = entry->
word2;
1182 aleRegs->ALE_TBLW1 = entry->
word1;
1183 aleRegs->ALE_TBLW0 = entry->
word0;
1186 aleRegs->ALE_TBLCTL = CSL_ALE_ALE_TBLCTL_TABLEWR_MASK | index;
1198 volatile CSL_AleRegs *aleRegs;
1201 aleRegs = (
volatile CSL_AleRegs *) (CSL_CPSW0_NUSS_BASE + CPSW_ALE_OFFSET);
1204 aleRegs->ALE_TBLCTL = index;
1207 entry->
word2 = aleRegs->ALE_TBLW2;
1208 entry->
word1 = aleRegs->ALE_TBLW1;
1209 entry->
word0 = aleRegs->ALE_TBLW0;
1319 if(macAddr->b[0] == (uint8_t) (entry.
word1 >> 8) &&
1320 macAddr->b[1] == (uint8_t) (entry.
word1 >> 0) &&
1321 macAddr->b[2] == (uint8_t) (entry.
word0 >> 24) &&
1322 macAddr->b[3] == (uint8_t) (entry.
word0 >> 16) &&
1323 macAddr->b[4] == (uint8_t) (entry.
word0 >> 8) &&
1324 macAddr->b[5] == (uint8_t) (entry.
word0 >> 0))
1445 entry.
word1 |= (macAddr->b[0] << 8) | macAddr->b[1];
1448 entry.
word0 |= (macAddr->b[2] << 24) | (macAddr->b[3] << 16) |
1449 (macAddr->b[4] << 8) | macAddr->b[5];