Skip to content

Commit a28a39a

Browse files
Change emac completion detection to interrupt
Changing the emac software to monitor for an interrupt assertion triggered from the last RX descriptor to indicate that the data movement is complete. The original method of waiting for the DMA to indicate it had exhausted all TX and RX descriptors was not working reliably on the Critical Link board. Signed-off-by: Rod Frazer <rod.frazer@intel.com>
1 parent 493a6bb commit a28a39a

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

common_sw/linux_apps/emac.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ void do_the_interesting_thing(struct hps_emac_s *hps_emac,
451451
rx_descriptors[i].desc3 = 0x80000000;
452452
}
453453

454+
/* enable interrupt from last RX descriptor */
455+
rx_descriptors[i-1].desc3 |= 0x40000000;
456+
454457
/* null the last tx descriptor in the ring */
455458
tx_descriptors[i].desc0 = 0;
456459
tx_descriptors[i].desc1 = 0;
@@ -607,7 +610,7 @@ void do_the_interesting_thing(struct hps_emac_s *hps_emac,
607610

608611
temp_32 = *((volatile uint32_t *)(emac_uio_map->uio_mmap_addr +
609612
((EMAC0_DMA_CH0_BASE + DMA_CH0_Status_OFST) & 0x3FFF)));
610-
while(temp_32 != 0x00000084) {
613+
while((temp_32 & 0x00000040) == 0) {
611614
asm volatile (
612615
"mrs %[temp], cntvct_el0\n"
613616
: [temp] "=r" (temp)

common_sw/u-boot_standalone_apps/emac.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ void do_the_interesting_thing(struct hps_emac_s *hps_emac) {
293293
rx_descriptors[i].desc3 = 0x80000000;
294294
}
295295

296+
/* enable interrupt from last RX descriptor */
297+
rx_descriptors[i-1].desc3 |= 0x40000000;
298+
296299
/* null the last tx descriptor in the ring */
297300
tx_descriptors[i].desc0 = 0;
298301
tx_descriptors[i].desc1 = 0;
@@ -481,7 +484,7 @@ void do_the_interesting_thing(struct hps_emac_s *hps_emac) {
481484

482485
temp_32 = *((volatile uint32_t *)(EMAC0_DMA_CH0_BASE +
483486
DMA_CH0_Status_OFST));
484-
while(temp_32 != 0x00000084) {
487+
while((temp_32 & 0x00000040) == 0) {
485488
asm volatile (
486489
"mrs %[temp], cntpct_el0\n"
487490
: [temp] "=r" (temp)
@@ -601,6 +604,9 @@ void do_the_interesting_thing(struct hps_emac_s *hps_emac) {
601604
rx_descriptors[i].desc3 = 0x80000000;
602605
}
603606

607+
/* enable interrupt from last RX descriptor */
608+
rx_descriptors[i-1].desc3 |= 0x40000000;
609+
604610
/* null the last tx descriptor in the ring */
605611
tx_descriptors[i].desc0 = 0;
606612
tx_descriptors[i].desc1 = 0;
@@ -789,7 +795,7 @@ void do_the_interesting_thing(struct hps_emac_s *hps_emac) {
789795

790796
temp_32 = *((volatile uint32_t *)(EMAC0_DMA_CH0_BASE +
791797
DMA_CH0_Status_OFST));
792-
while(temp_32 != 0x00000084) {
798+
while((temp_32 & 0x00000040) == 0) {
793799
asm volatile (
794800
"mrs %[temp], cntpct_el0\n"
795801
: [temp] "=r" (temp)

0 commit comments

Comments
 (0)