+ control_usb->remote_wakeup = of_property_read_bool(np,
+ "rockchip,remote_wakeup");
+ control_usb->usb_irq_wakeup = of_property_read_bool(np,
+ "rockchip,usb_irq_wakeup");
+
+ INIT_DELAYED_WORK(&control_usb->usb_charger_det_work,
+ usb_battery_charger_detect_work);
+
+ control_usb->host_gpios =
+ devm_kzalloc(&pdev->dev, sizeof(struct gpio), GFP_KERNEL);
+ if (!control_usb->host_gpios) {
+ dev_err(&pdev->dev, "unable to alloc memory for host_gpios\n");
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ gpio = of_get_named_gpio(np, "host_drv_gpio", 0);
+ control_usb->host_gpios->gpio = gpio;
+
+ if (!gpio_is_valid(gpio)) {
+ dev_err(&pdev->dev, "invalid host gpio%d\n", gpio);
+ } else {
+ err = devm_gpio_request(&pdev->dev, gpio, "host_drv_gpio");
+ if (err) {
+ dev_err(&pdev->dev,
+ "failed to request GPIO%d for host_drv\n",
+ gpio);
+ ret = err;
+ goto out;
+ }
+ gpio_direction_output(control_usb->host_gpios->gpio, 1);
+ }
+
+ control_usb->otg_gpios =
+ devm_kzalloc(&pdev->dev, sizeof(struct gpio), GFP_KERNEL);
+ if (!control_usb->otg_gpios) {
+ dev_err(&pdev->dev, "unable to alloc memory for otg_gpios\n");
+ ret = -ENOMEM;
+ goto out;
+ }
+
+ gpio = of_get_named_gpio(np, "otg_drv_gpio", 0);
+ control_usb->otg_gpios->gpio = gpio;
+
+ if (!gpio_is_valid(gpio)) {
+ dev_err(&pdev->dev, "invalid otg gpio%d\n", gpio);
+ } else {
+ err = devm_gpio_request(&pdev->dev, gpio, "otg_drv_gpio");
+ if (err) {
+ dev_err(&pdev->dev,
+ "failed to request GPIO%d for otg_drv\n", gpio);
+ ret = err;
+ goto out;
+ }
+ gpio_direction_output(control_usb->otg_gpios->gpio, 0);
+ }
+
+out:
+ return ret;
+}
+
+static int rk_usb_control_remove(struct platform_device *pdev)
+{
+ return 0;
+}
+
+static struct platform_driver rk_usb_control_driver = {
+ .probe = rk_usb_control_probe,
+ .remove = rk_usb_control_remove,
+ .driver = {
+ .name = "rk3288-usb-control",
+ .owner = THIS_MODULE,
+ .of_match_table = of_match_ptr(rk_usb_control_id_table),
+ },
+};
+
+#ifdef CONFIG_OF
+
+static const struct of_device_id dwc_otg_control_usb_id_table[] = {
+ {
+ .compatible = "rockchip,rk3288-dwc-control-usb",
+ },
+ {},
+};
+
+#endif
+
+static int dwc_otg_control_usb_probe(struct platform_device *pdev)
+{
+ struct clk *hclk_usb_peri, *phyclk_480m, *phyclk480m_parent;
+ int ret = 0;
+
+ if (!control_usb) {
+ dev_err(&pdev->dev, "unable to alloc memory for control usb\n");
+ ret = -ENOMEM;
+ goto err1;
+ }
+