예제 #1
0
static int smdk5410_vbus_ctrl(struct platform_device *pdev, int on)
{
	int phy_num = pdev->id;
	unsigned gpio;
	int ret = -EINVAL;

	if (phy_num == 0)
		gpio = EXYNOS5410_GPK3(3);
	else if (phy_num == 1)
		gpio = EXYNOS5410_GPK2(7);
	else
		return ret;

	ret = gpio_request(gpio, "UDRD3_VBUSCTRL_U3");
	if (ret < 0) {
		pr_err("failed to request UDRD3_%d_VBUSCTRL_U3\n",
				phy_num);
		return ret;
	}

	gpio_set_value(gpio, !!on);
	gpio_free(gpio);

	return ret;
}
예제 #2
0
static void __init __maybe_unused smdk5410_drd0_init(void)
{
	/* Initialize DRD0 gpio */
	if (gpio_request(EXYNOS5410_GPK3(0), "UDRD3_0_OVERCUR_U2")) {
		pr_err("failed to request UDRD3_0_OVERCUR_U2\n");
	} else {
		s3c_gpio_cfgpin(EXYNOS5410_GPK3(0), (0x2 << 0));
		s3c_gpio_setpull(EXYNOS5410_GPK3(0), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(0));
	}
	if (gpio_request(EXYNOS5410_GPK3(1), "UDRD3_0_OVERCUR_U3")) {
		pr_err("failed to request UDRD3_0_OVERCUR_U3\n");
	} else {
		s3c_gpio_cfgpin(EXYNOS5410_GPK3(1), (0x2 << 4));
		s3c_gpio_setpull(EXYNOS5410_GPK3(1), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(1));
	}

	if (gpio_request_one(EXYNOS5410_GPK3(2), GPIOF_OUT_INIT_LOW,
						"UDRD3_0_VBUSCTRL_U2")) {
		pr_err("failed to request UDRD3_0_VBUSCTRL_U2\n");
	} else {
		s3c_gpio_setpull(EXYNOS5410_GPK3(2), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(2));
	}

	if (gpio_request_one(EXYNOS5410_GPK3(3), GPIOF_OUT_INIT_LOW,
						 "UDRD3_0_VBUSCTRL_U3")) {
		pr_err("failed to request UDRD3_0_VBUSCTRL_U3\n");
	} else {
		s3c_gpio_setpull(EXYNOS5410_GPK3(3), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(3));
	}

#if defined(CONFIG_USB_EXYNOS5_USB3_DRD_CH0)
	if (gpio_request_one(SMDK5410_ID0_GPIO, GPIOF_IN, "UDRD3_0_ID")) {
		pr_err("failed to request UDRD3_0_ID\n");
		smdk5410_drd_pdata.id_irq = -1;
	} else {
		s3c_gpio_cfgpin(SMDK5410_ID0_GPIO, S3C_GPIO_SFN(0xF));
		s3c_gpio_setpull(SMDK5410_ID0_GPIO, S3C_GPIO_PULL_NONE);
		gpio_free(SMDK5410_ID0_GPIO);

		smdk5410_drd_pdata.id_irq = gpio_to_irq(SMDK5410_ID0_GPIO);
	}

	if (gpio_request_one(SMDK5410_VBUS0_GPIO, GPIOF_IN, "UDRD3_0_VBUS")) {
		pr_err("failed to request UDRD3_0_VBUS\n");
		smdk5410_drd_pdata.vbus_irq = -1;
	} else {
		s3c_gpio_cfgpin(SMDK5410_VBUS0_GPIO, S3C_GPIO_SFN(0xF));
		s3c_gpio_setpull(SMDK5410_VBUS0_GPIO, S3C_GPIO_PULL_NONE);
		gpio_free(SMDK5410_VBUS0_GPIO);

		smdk5410_drd_pdata.vbus_irq = gpio_to_irq(SMDK5410_VBUS0_GPIO);
	}

	smdk5410_drd_pdata.quirks = 0;
#if !defined(CONFIG_USB_XHCI_EXYNOS)
	smdk5410_drd_pdata.quirks |= FORCE_RUN_PERIPHERAL;
#endif
#else
	smdk5410_drd_pdata.id_irq = -1;
	smdk5410_drd_pdata.vbus_irq = -1;
	smdk5410_drd_pdata.quirks = DUMMY_DRD;
#endif

	exynos5_usb3_drd0_set_platdata(&smdk5410_drd_pdata);
}
static void __init smdk5410_drd0_init(void)
{
	/* Initialize DRD0 gpio */
	if (gpio_request(EXYNOS5410_GPK3(0), "UDRD3_0_OVERCUR_U2")) {
		pr_err("failed to request UDRD3_0_OVERCUR_U2\n");
	} else {
		s3c_gpio_cfgpin(EXYNOS5410_GPK3(0), (0x2 << 0));
		s3c_gpio_setpull(EXYNOS5410_GPK3(0), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(0));
	}
	if (gpio_request(EXYNOS5410_GPK3(1), "UDRD3_0_OVERCUR_U3")) {
		pr_err("failed to request UDRD3_0_OVERCUR_U3\n");
	} else {
		s3c_gpio_cfgpin(EXYNOS5410_GPK3(1), (0x2 << 4));
		s3c_gpio_setpull(EXYNOS5410_GPK3(1), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(1));
	}

	if (gpio_request_one(EXYNOS5410_GPK3(2), GPIOF_OUT_INIT_LOW,
						"UDRD3_0_VBUSCTRL_U2")) {
		pr_err("failed to request UDRD3_0_VBUSCTRL_U2\n");
	} else {
		s3c_gpio_setpull(EXYNOS5410_GPK3(2), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(2));
	}

	if (gpio_request_one(EXYNOS5410_GPK3(3), GPIOF_OUT_INIT_LOW,
						 "UDRD3_0_VBUSCTRL_U3")) {
		pr_err("failed to request UDRD3_0_VBUSCTRL_U3\n");
	} else {
		s3c_gpio_setpull(EXYNOS5410_GPK3(3), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(3));
	}

	if (gpio_request_one(SMDK5410_ID0_GPIO, GPIOF_IN, "UDRD3_0_ID")) {
		pr_err("failed to request UDRD3_0_ID\n");
		smdk5410_drd_pdata.id_irq = -1;
	} else {
		s3c_gpio_cfgpin(SMDK5410_ID0_GPIO, S3C_GPIO_SFN(0xF));
		s3c_gpio_setpull(SMDK5410_ID0_GPIO, S3C_GPIO_PULL_NONE);
		gpio_free(SMDK5410_ID0_GPIO);

		smdk5410_drd_pdata.id_irq = gpio_to_irq(SMDK5410_ID0_GPIO);
	}

	if (gpio_request_one(SMDK5410_VBUS0_GPIO, GPIOF_IN, "UDRD3_0_VBUS")) {
		pr_err("failed to request UDRD3_0_VBUS\n");
		smdk5410_drd_pdata.vbus_irq = -1;
	} else {
		s3c_gpio_cfgpin(SMDK5410_VBUS0_GPIO, S3C_GPIO_SFN(0xF));
		s3c_gpio_setpull(SMDK5410_VBUS0_GPIO, S3C_GPIO_PULL_NONE);
		gpio_free(SMDK5410_VBUS0_GPIO);

		smdk5410_drd_pdata.vbus_irq = gpio_to_irq(SMDK5410_VBUS0_GPIO);
	}

	smdk5410_drd_pdata.quirks = 0;

	exynos5_usb3_drd0_set_platdata(&smdk5410_drd_pdata);
}
예제 #4
0
static void __init universal5410_drd0_init(void)
{
	/* initialize DRD0 gpio */
        if (gpio_request(EXYNOS5410_GPK3(0), "UDRD3_0_OVERCUR_U2"))
		printk(KERN_ERR "failed to request UDRD3_0_OVERCUR_U2\n");
        else {
		s3c_gpio_cfgpin(EXYNOS5410_GPK3(0), (0x2 << 0));
		s3c_gpio_setpull(EXYNOS5410_GPK3(0), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(0));
	}
	if (gpio_request(EXYNOS5410_GPK3(1), "UDRD3_0_OVERCUR_U3"))
		printk(KERN_ERR "failed to request UDRD3_0_OVERCUR_U3\n");
	else {
		s3c_gpio_cfgpin(EXYNOS5410_GPK3(1), (0x2 << 4));
		s3c_gpio_setpull(EXYNOS5410_GPK3(1), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(1));
	}

	if (gpio_request_one(EXYNOS5410_GPK3(2), GPIOF_OUT_INIT_LOW, "UDRD3_0_VBUSCTRL_U2"))
		printk(KERN_ERR "failed to request UDRD3_0_VBUSCTRL_U2\n");
	else {
		s3c_gpio_setpull(EXYNOS5410_GPK3(2), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(2));
	}

	if (gpio_request_one(EXYNOS5410_GPK3(3), GPIOF_OUT_INIT_LOW, "UDRD3_0_VBUSCTRL_U3"))
		printk(KERN_ERR "failed to request UDRD3_0_VBUSCTRL_U3\n");
	else {
		s3c_gpio_setpull(EXYNOS5410_GPK3(3), S3C_GPIO_PULL_NONE);
		gpio_free(EXYNOS5410_GPK3(3));
	}

	/*
	 * Activate USB Device Controller (UDC) during booting.
	 *
	 * IMPORTANT: this solution is temporal. Use
	 * exynos_drd_switch_id_event() and exynos_drd_switch_vbus_event()
	 * callbacks to switch DRD role at runtime.
	 */
#if !defined(CONFIG_USB_EXYNOS5_USB3_DRD_CH0)
	universal5410_drd_pdata.quirks = DUMMY_DRD;
#elif defined(CONFIG_USB_EXYNOS_SS_UDC)
	universal5410_drd_pdata.quirks |= FORCE_RUN_PERIPHERAL;
#endif

	exynos5_usb3_drd0_set_platdata(&universal5410_drd_pdata);
}
예제 #5
0
static void __init universal5420_drd0_init(void)
{
    /* initialize DRD0 gpio */
    if (gpio_request(EXYNOS5410_GPK3(0), "UDRD3_0_OVERCUR_U2"))
        printk(KERN_ERR "failed to request UDRD3_0_OVERCUR_U2\n");
    else {
        s3c_gpio_cfgpin(EXYNOS5410_GPK3(0), (0x2 << 0));
        s3c_gpio_setpull(EXYNOS5410_GPK3(0), S3C_GPIO_PULL_NONE);
        gpio_free(EXYNOS5410_GPK3(0));
    }
    if (gpio_request(EXYNOS5410_GPK3(1), "UDRD3_0_OVERCUR_U3"))
        printk(KERN_ERR "failed to request UDRD3_0_OVERCUR_U3\n");
    else {
        s3c_gpio_cfgpin(EXYNOS5410_GPK3(1), (0x2 << 4));
        s3c_gpio_setpull(EXYNOS5410_GPK3(1), S3C_GPIO_PULL_NONE);
        gpio_free(EXYNOS5410_GPK3(1));
    }

    if (gpio_request_one(EXYNOS5410_GPK3(2), GPIOF_OUT_INIT_LOW, "UDRD3_0_VBUSCTRL_U2"))
        printk(KERN_ERR "failed to request UDRD3_0_VBUSCTRL_U2\n");
    else {
        s3c_gpio_setpull(EXYNOS5410_GPK3(2), S3C_GPIO_PULL_NONE);
        gpio_free(EXYNOS5410_GPK3(2));
    }

    if (gpio_request_one(EXYNOS5410_GPK3(3), GPIOF_OUT_INIT_LOW, "UDRD3_0_VBUSCTRL_U3"))
        printk(KERN_ERR "failed to request UDRD3_0_VBUSCTRL_U3\n");
    else {
        s3c_gpio_setpull(EXYNOS5410_GPK3(3), S3C_GPIO_PULL_NONE);
        gpio_free(EXYNOS5410_GPK3(3));
    }
#if !defined(CONFIG_USB_EXYNOS5_USB3_DRD_CH0)
    universal5420_drd_pdata.quirks = DUMMY_DRD;
#elif defined(CONFIG_USB_EXYNOS_SS_UDC)
    universal5420_drd_pdata.quirks |= FORCE_RUN_PERIPHERAL;
#endif
    universal5420_drd_pdata.quirks |= LOW_VBOOST;

    exynos5_usb3_drd0_set_platdata(&universal5420_drd_pdata);
}