dm: usb: Remove use of fdtdec GPIO support

These functions are going away, so use the new uclass support instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2015-01-05 20:05:39 -07:00
parent 0347960b87
commit 46927e1ef4
3 changed files with 28 additions and 30 deletions

View File

@ -31,7 +31,7 @@ DECLARE_GLOBAL_DATA_PTR;
struct exynos_ehci { struct exynos_ehci {
struct exynos_usb_phy *usb; struct exynos_usb_phy *usb;
struct ehci_hccr *hcd; struct ehci_hccr *hcd;
struct fdt_gpio_state vbus_gpio; struct gpio_desc vbus_gpio;
}; };
static struct exynos_ehci exynos; static struct exynos_ehci exynos;
@ -61,7 +61,8 @@ static int exynos_usb_parse_dt(const void *blob, struct exynos_ehci *exynos)
exynos->hcd = (struct ehci_hccr *)addr; exynos->hcd = (struct ehci_hccr *)addr;
/* Vbus gpio */ /* Vbus gpio */
fdtdec_decode_gpio(blob, node, "samsung,vbus-gpio", &exynos->vbus_gpio); gpio_request_by_name_nodev(blob, node, "samsung,vbus-gpio", 0,
&exynos->vbus_gpio, GPIOD_IS_OUT);
depth = 0; depth = 0;
node = fdtdec_next_compatible_subnode(blob, node, node = fdtdec_next_compatible_subnode(blob, node,
@ -236,9 +237,8 @@ int ehci_hcd_init(int index, enum usb_init_type init,
#ifdef CONFIG_OF_CONTROL #ifdef CONFIG_OF_CONTROL
/* setup the Vbus gpio here */ /* setup the Vbus gpio here */
if (fdt_gpio_isvalid(&ctx->vbus_gpio) && if (dm_gpio_is_valid(&ctx->vbus_gpio))
!fdtdec_setup_gpio(&ctx->vbus_gpio)) dm_gpio_set_value(&ctx->vbus_gpio, 1);
gpio_direction_output(ctx->vbus_gpio.gpio, 1);
#endif #endif
setup_usb_phy(ctx->usb); setup_usb_phy(ctx->usb);

View File

@ -72,8 +72,8 @@ struct fdt_usb {
enum usb_init_type init_type; enum usb_init_type init_type;
enum dr_mode dr_mode; /* dual role mode */ enum dr_mode dr_mode; /* dual role mode */
enum periph_id periph_id;/* peripheral id */ enum periph_id periph_id;/* peripheral id */
struct fdt_gpio_state vbus_gpio; /* GPIO for vbus enable */ struct gpio_desc vbus_gpio; /* GPIO for vbus enable */
struct fdt_gpio_state phy_reset_gpio; /* GPIO to reset ULPI phy */ struct gpio_desc phy_reset_gpio; /* GPIO to reset ULPI phy */
}; };
static struct fdt_usb port[USB_PORTS_MAX]; /* List of valid USB ports */ static struct fdt_usb port[USB_PORTS_MAX]; /* List of valid USB ports */
@ -252,17 +252,14 @@ static void set_up_vbus(struct fdt_usb *config, enum usb_init_type init)
return; return;
} }
if (fdt_gpio_isvalid(&config->vbus_gpio)) { if (dm_gpio_is_valid(&config->vbus_gpio)) {
int vbus_value; int vbus_value;
fdtdec_setup_gpio(&config->vbus_gpio); vbus_value = (init == USB_INIT_HOST);
dm_gpio_set_value(&config->vbus_gpio, vbus_value);
vbus_value = (init == USB_INIT_HOST) ^ debug("set_up_vbus: GPIO %d %d\n",
!!(config->vbus_gpio.flags & FDT_GPIO_ACTIVE_LOW); gpio_get_number(&config->vbus_gpio), vbus_value);
gpio_direction_output(config->vbus_gpio.gpio, vbus_value);
debug("set_up_vbus: GPIO %d %d\n", config->vbus_gpio.gpio,
vbus_value);
} }
} }
@ -360,7 +357,7 @@ static int init_utmi_usb_controller(struct fdt_usb *config,
* mux must be switched to actually use a_sess_vld threshold. * mux must be switched to actually use a_sess_vld threshold.
*/ */
if (config->dr_mode == DR_MODE_OTG && if (config->dr_mode == DR_MODE_OTG &&
fdt_gpio_isvalid(&config->vbus_gpio)) dm_gpio_is_valid(&config->vbus_gpio))
clrsetbits_le32(&usbctlr->usb1_legacy_ctrl, clrsetbits_le32(&usbctlr->usb1_legacy_ctrl,
VBUS_SENSE_CTL_MASK, VBUS_SENSE_CTL_MASK,
VBUS_SENSE_CTL_A_SESS_VLD << VBUS_SENSE_CTL_SHIFT); VBUS_SENSE_CTL_A_SESS_VLD << VBUS_SENSE_CTL_SHIFT);
@ -569,11 +566,10 @@ static int init_ulpi_usb_controller(struct fdt_usb *config,
clock_set_pllout(CLOCK_ID_PERIPH, PLL_OUT4, CONFIG_ULPI_REF_CLK); clock_set_pllout(CLOCK_ID_PERIPH, PLL_OUT4, CONFIG_ULPI_REF_CLK);
/* reset ULPI phy */ /* reset ULPI phy */
if (fdt_gpio_isvalid(&config->phy_reset_gpio)) { if (dm_gpio_is_valid(&config->phy_reset_gpio)) {
fdtdec_setup_gpio(&config->phy_reset_gpio); dm_gpio_set_value(&config->phy_reset_gpio, 0);
gpio_direction_output(config->phy_reset_gpio.gpio, 0);
mdelay(5); mdelay(5);
gpio_set_value(config->phy_reset_gpio.gpio, 1); dm_gpio_set_value(&config->phy_reset_gpio, 1);
} }
/* Reset the usb controller */ /* Reset the usb controller */
@ -685,14 +681,16 @@ static int fdt_decode_usb(const void *blob, int node, struct fdt_usb *config)
debug("%s: Missing/invalid peripheral ID\n", __func__); debug("%s: Missing/invalid peripheral ID\n", __func__);
return -FDT_ERR_NOTFOUND; return -FDT_ERR_NOTFOUND;
} }
fdtdec_decode_gpio(blob, node, "nvidia,vbus-gpio", &config->vbus_gpio); gpio_request_by_name_nodev(blob, node, "nvidia,vbus-gpio", 0,
fdtdec_decode_gpio(blob, node, "nvidia,phy-reset-gpio", &config->vbus_gpio, GPIOD_IS_OUT);
&config->phy_reset_gpio); gpio_request_by_name_nodev(blob, node, "nvidia,phy-reset-gpio", 0,
&config->phy_reset_gpio, GPIOD_IS_OUT);
debug("enabled=%d, legacy_mode=%d, utmi=%d, ulpi=%d, periph_id=%d, " debug("enabled=%d, legacy_mode=%d, utmi=%d, ulpi=%d, periph_id=%d, "
"vbus=%d, phy_reset=%d, dr_mode=%d\n", "vbus=%d, phy_reset=%d, dr_mode=%d\n",
config->enabled, config->has_legacy_mode, config->utmi, config->enabled, config->has_legacy_mode, config->utmi,
config->ulpi, config->periph_id, config->vbus_gpio.gpio, config->ulpi, config->periph_id,
config->phy_reset_gpio.gpio, config->dr_mode); gpio_get_number(&config->vbus_gpio),
gpio_get_number(&config->phy_reset_gpio), config->dr_mode);
return 0; return 0;
} }

View File

@ -40,7 +40,7 @@ struct exynos_xhci {
struct exynos_usb3_phy *usb3_phy; struct exynos_usb3_phy *usb3_phy;
struct xhci_hccr *hcd; struct xhci_hccr *hcd;
struct dwc3 *dwc3_reg; struct dwc3 *dwc3_reg;
struct fdt_gpio_state vbus_gpio; struct gpio_desc vbus_gpio;
}; };
static struct exynos_xhci exynos; static struct exynos_xhci exynos;
@ -69,7 +69,8 @@ static int exynos_usb3_parse_dt(const void *blob, struct exynos_xhci *exynos)
exynos->hcd = (struct xhci_hccr *)addr; exynos->hcd = (struct xhci_hccr *)addr;
/* Vbus gpio */ /* Vbus gpio */
fdtdec_decode_gpio(blob, node, "samsung,vbus-gpio", &exynos->vbus_gpio); gpio_request_by_name_nodev(blob, node, "samsung,vbus-gpio", 0,
&exynos->vbus_gpio, GPIOD_IS_OUT);
depth = 0; depth = 0;
node = fdtdec_next_compatible_subnode(blob, node, node = fdtdec_next_compatible_subnode(blob, node,
@ -298,9 +299,8 @@ int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor)
#ifdef CONFIG_OF_CONTROL #ifdef CONFIG_OF_CONTROL
/* setup the Vbus gpio here */ /* setup the Vbus gpio here */
if (fdt_gpio_isvalid(&ctx->vbus_gpio) && if (dm_gpio_is_valid(&ctx->vbus_gpio))
!fdtdec_setup_gpio(&ctx->vbus_gpio)) dm_gpio_set_value(&ctx->vbus_gpio, 1);
gpio_direction_output(ctx->vbus_gpio.gpio, 1);
#endif #endif
ret = exynos_xhci_core_init(ctx); ret = exynos_xhci_core_init(ctx);