Zyxel NSA320S USB power not enabled by default
Introduction:
Through testing with real hardware and the kwboot utility I've determined that the usb ports on the Zyxel NSA320S nas aren't getting any power when using the latest U-boot built from the master branch with the nsa310s_defconfig configuration. I came to this conclusion after trying both usb start and usb reset commands multiple times, after which the device still didn't recognize any attached usb storage media.
The problem:
After looking at the device tree file for this specific nas, and trying different GPIO configurations with the built in gpio command line tool in U-boot, I came to the conclusion that certain pins that would need to be set to output mode are incorrectly set to input mode. This affects the usb interface, because on this device the the usb power supply is tied to a gpio pin that is expected to output a high (1) signal, but it is instead waiting for input getting a low (0) signal.
Solution:
In the following source file (board/zyxel/nsa310s/nsa310s.c
) on lines 35, 36, 41 and 42 there seem to be macros defining the initial values and output_enable properties of the lower and higher gpio registers. Although the values are initialized, the corresponding output bits aren't set for those pins so they revert to beeing input pins. I suggest altering the NSA310S_OE_LOW
and NSA310S_OE_HIGH
macros, replacing the constant 0
with the pins whose values are needed as ouput.
// The bitwise inversion is intentional
#define NSA310S_OE_LOW (~(SYS_GREEN_LED | USB_POWER))
#define NSA310S_VAL_LOW (SYS_GREEN_LED | USB_POWER)
// The bitwise inversion is intentional
#define NSA310S_OE_HIGH (~(HDD2_POWER))
#define NSA310S_VAL_HIGH (HDD2_POWER)
Note:
This fix works for the Zyxel NSA320S nas, but it's not clear that it would work, and have the same effect on the NSA310S model. It is because of this I suggest counting the two boards as separate.