return 0;
}
+static int
+sandbox_phy_set_mode(struct phy *phy, enum phy_mode mode, int submode)
+{
+ if (submode)
+ return -EOPNOTSUPP;
+
+ if (mode != PHY_MODE_USB_HOST)
+ return -EINVAL;
+
+ return 0;
+}
+
static int sandbox_phy_bind(struct udevice *dev)
{
if (dev_get_driver_data(dev) != DRIVER_DATA)
.power_off = sandbox_phy_power_off,
.init = sandbox_phy_init,
.exit = sandbox_phy_exit,
+ .set_mode = sandbox_phy_set_mode,
};
static const struct udevice_id sandbox_phy_ids[] = {
ut_assertok(generic_setup_phy(parent, &phy, 0, PHY_MODE_USB_HOST, 0));
ut_assertok(generic_shutdown_phy(&phy));
+ /* set_mode as USB Host passes, anything else is not supported */
+ ut_assertok(generic_setup_phy(parent, &phy, 0, PHY_MODE_USB_HOST, 0));
+ ut_assertok(generic_phy_set_mode(&phy, PHY_MODE_USB_HOST, 0));
+ ut_asserteq(-EOPNOTSUPP, generic_phy_set_mode(&phy, PHY_MODE_USB_HOST, 1));
+ ut_asserteq(-EINVAL, generic_phy_set_mode(&phy, PHY_MODE_USB_DEVICE, 0));
+ ut_assertok(generic_shutdown_phy(&phy));
+
/* power_off fail with -EIO */
ut_assertok(generic_setup_phy(parent, &phy, 1, PHY_MODE_USB_HOST, 0));
ut_asserteq(-EIO, generic_shutdown_phy(&phy));