This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x Industrial SDK1.1.0.3, CPSW sysbios driver init

Hi,

with reference to the function cpsw_MDIO_Init() in

am335x_sysbios_ind_sdk_1.1.0.3\sdk\os_drivers\src\CPSW\cpsw_miimdio.c

Why do we call MDIOInit() only once?

static unsigned int one_check = 0;

int cpsw_MDIO_Init(CPSW_PHY_....)

    (....)

 /*To make sure MDIOInit is only done once */
  if(one_check == 0)
  {
      MDIOInit(PhyDev->miibase, MdioBusFreq, MdioClockFreq);
      one_check = 1;
  }

  (....)


If the network interface is restarted (in example to change the configuration), we reset the MDIO interface with a call to _cpsw_MDIO_ResetPhy().  So without a new call to MDIOInit() the stack hangs.
At least using the NDK as tcp/ip stack.

But it all seems to work removing the "one_check condition". I have a test case, in case.

Best regards
Massimo

  • Massimo,

    The intent of "one_check_condition" was to make sure MDIO is initialized only once. I am not sure if resetting the phy requires a re-initialization of MDIO(there is no harm in doing it though).

    If a Phy reset is done, it should be reconfigured(it might be that in your case the re-init of MDIO does this job). Can you share the test case of this experiment?

    Thanks,
    Vinesh 

  • Hi Vinesh,

    I'll will send you a test case for the IDK by email, based on the old configuration example of ndk/nsp.

    If we don't re-initalize MDIO, it won't have a valid clock if the stack is restarted. At least this is what I understand.

    Thanks, best regards
    Massimo