phy: test: Implement sandbox PHY .set_mode and DM test

Implement trivial extension to the sandbox PHY, which makes it pretend
to support selecting USB Host mode and nothing else. Any other mode is
rejected with -EINVAL. Any submode except for default submode 0 is
rejected with -EOPNOTSUPP . The implementation behaves in this trivial
way to permit easy unit testing using test which is also added in this
commit.

To run the test, use e.g. sandbox64_defconfig and run U-Boot as follows:
$ ./u-boot -Tc 'ut dm phy_setup'

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
diff --git a/drivers/phy/sandbox-phy.c b/drivers/phy/sandbox-phy.c
index b159147..e70d204 100644
--- a/drivers/phy/sandbox-phy.c
+++ b/drivers/phy/sandbox-phy.c
@@ -72,6 +72,18 @@
 	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)
@@ -96,6 +108,7 @@
 	.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[] = {