Skip to content
  • Alexander Potashev's avatar
    RT77090. kinetis eth: Fix receiving of Ethernet packets · fe65e8bf
    Alexander Potashev authored
    The Ethernet module of the MCU requires that the RDAR register is set
    only after a while after the RDSR register is set; i.e. the RDAR
    register should not be set immediately after RDSR during initialization
    of the Ethernet module.
      1. If we write to the ENET_RDAR register immediately after initializing
    the ENET_RDSR register, the incoming packets can _never_ be received.
      2. If we make the MCU wait for 10us before writing to ENET_RDAR, the
    incoming packets are _always_ received correctly.
      3. If we perform a few instructions (about 10 of them) between setting
    RDSR and RDAR, then the problem manifests randomly from time to time.
    
    In order to fix the bug, we add a 10us delay just before writing
    to the RDAR register.
    
    Things just work in Freescale MQX and in Linux, because there is a lot
    of other initialization code between the RDAR and RDSR register are set,
    so this other initialization code serves as a delay.
    fe65e8bf