#include <usb.h>
#include <asm/io.h>
#include <linux/iopoll.h>
+#include <power/regulator.h>
#include "r8a66597.h"
{
struct r8a66597 *priv = dev_get_priv(dev);
struct usb_bus_priv *bus_priv = dev_get_uclass_priv(dev);
+ int ret;
bus_priv->desc_before_addr = true;
+ if (CONFIG_IS_ENABLED(DM_REGULATOR)) {
+ ret = device_get_supply_regulator(dev, "vbus-supply",
+ &priv->vbus_supply);
+ if (ret) {
+ dev_err(dev,
+ "can't get VBUS supply\n");
+ return ret;
+ }
+
+ ret = regulator_set_enable(priv->vbus_supply, true);
+ if (ret) {
+ dev_err(dev,
+ "can't enable VBUS supply\n");
+ return ret;
+ }
+ }
+
disable_controller(priv);
mdelay(100);
static int r8a66597_usb_remove(struct udevice *dev)
{
struct r8a66597 *priv = dev_get_priv(dev);
+ int ret;
disable_controller(priv);
+ if (CONFIG_IS_ENABLED(DM_REGULATOR)) {
+ ret = regulator_set_enable(priv->vbus_supply, false);
+ if (ret) {
+ dev_err(dev,
+ "can't disable VBUS supply\n");
+ return ret;
+ }
+ }
+
return 0;
}
unsigned short port_change;
u16 speed; /* HSMODE or FSMODE or LSMODE */
unsigned char rh_devnum;
+ struct udevice *vbus_supply;
};
static inline u16 r8a66597_read(struct r8a66597 *r8a66597, unsigned long offset)