Noted, will use it.+Please use devm_reset_control_get_exclusive() instead.
+ for (i = 0; i < ARRAY_SIZE(CTL_RESETS); i++) {
+ resets[i] = devm_reset_control_get(dev, CTL_RESETS[i]);
Agreed!, re-write the assert/de-assert logic as you have suggested.
+ if (IS_ERR(resets[i])) {You should request all reset controls first, and only then start
+ dev_err(dev, "%s reset not found\n", CTL_RESETS[i]);
+ return PTR_ERR(resets[i]);
+ }
+ reset_control_assert(resets[i]);
+ }
asserting / deasserting, otherwise you may end up with partially
asserted resets in case a later reset control is not found.
yes, you are right, it's in wrong place, Thanks!
+Same as above.
+ for (i = 0; i < ARRAY_SIZE(PHY_RESETS); i++) {
+ ta->resets[i] = devm_reset_control_get(dev, PHY_RESETS[i]);
+ if (IS_ERR(ta->resets[i])) {This waits 20us after de-asserting the reset, not before. Is this in the
+ dev_err(dev, "%s reset not found\n", PHY_RESETS[i]);
+ return PTR_ERR(ta->resets[i]);
+ }
+ reset_control_assert(ta->resets[i]);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(CTL_RESETS); i++)
+ reset_control_deassert(resets[i]);
+ /* Need to wait at least 20us before de-assert the PHY */
+ usleep_range(20, 100);
correct place?