linux4sam / dt-overlay-at91

AT91 Device Tree Overlays and FIT image descriptors
Other
10 stars 33 forks source link

sam9x60ek fix wilc #4

Closed fedepell closed 3 years ago

fedepell commented 3 years ago

This PR is composed by two changes to make the WILC overlay work correctly on SAM9x60-EK (rev B, if that changes things, but could not find rev A docs/schematics any place) with a soldered ATWILCx000 module.

It is composed of two commits for separate issues (therefore I would suggest to not squash them):

This has been tested with success with the SAM9x60-EK. Note the same mistakes are present also in the prebuilt images shipped on the website that therefore prevent the WILC module working.

Signed-off-by: Federico Pellegrin fede@evolware.org

cristibirsan commented 3 years ago

Hi Federico,

Please have a look at latest SAM9X60-EK Errata 5.3: https://ww1.microchip.com/downloads/en/DeviceDoc/SAM9X60-EK-UG-DS50002907B.pdf.

"There is a known issue that can occur on the SAM9X60-EK Rev. B, Rev. 2 and Rev. 3 boards if the user tries to mount and use the optional WILC3000 module together with the LCD or with the Ethernet PHY. With WILC3000, a special power-up sequence applies, requiring that the reset line be held low for a specific period of time. However, as all devices share the same reset line, this can cause communication disruptions during runtime.To solve this issue, we recommend separating the reset line going to the WILC3000 by cutting the trace and connecting it to a free GPIO from the 40-pin GPIO connector (J16). Our recommendation is to use PC31 (pin 29), as this is the one implemented in our current Linux distribution."

The device tree overlay implements the fix described in the errata.

I hope this helps, Cristian

fedepell commented 3 years ago

Hi Cristian, Thanks a lot for the feedback! Indeed I did not notice the Errata :-( Sorry for that! I've followed the document on how to solder the module (this: http://ww1.microchip.com/downloads/en/Appnotes/AN3227-Manually-Solder-ATWILC3000-Module-on-MPU-Board-00003227a.pdf ) indeed, which is likely much older.

Now after reading the errata the decision is pretty clear! As I'm not using the LCD and the ethernet actively, I'm not sure I would take the risk to cut the line on the EVB (already the soldering was quite a challenge for me ;-) ) but it is nice that now things are clear!

This being said: I believe the first commit (setting the state to okay) is still necessary for the driver to be loaded. As for the PC31<->PB25 change I now removed it of course and added just a note documenting this. Not sure if this is something you'd like to keep or not.

Thanks a lot! Federico

cristibirsan commented 3 years ago

Hi Federico,

I think there are 3 potential cases:

Case 1: Board without WILC soldered – no change is needed. Case 2: Board with WILC soldered but without hardware change that moves PB25 to PC31. For this case the wifi_pwrseq needs to be disabled because it can reset the LCD and the Ethernet PHY at runtime when WILC driver is probed. The power sequence to initialize the WILC is performed in AT91Bootstrap https://github.com/linux4sam/at91bootstrap/blob/09d45f5153d0da95edb5464fd2b3da9f62981d0c/board/sam9x60ek/sam9x60ek.c#L210

Case 3: Board with WILC soldered and PB25 moved to PC31. The user needs to enable the wifi_pwrseq driver by hand. We do not make this case default because we do not think the board will be modified by all customers.

Now I have no problem to take a documentation patch from you that explains all this, especially when you spent time to investigate it.

Kind regards, Cristian

fedepell commented 3 years ago

Thanks Cristian for the detailed clarification! I will therefore close this PR for now, I will try to create a separate one just indeed to document the possible scenarios as you describe! Thanks!