Reset HSIC hub during EHCI initialization. This makes devices connected

to external USB ports available to the system.

Submitted by:	Maxim Ignatenko <gelraen.ua@gmail.com>
This commit is contained in:
br 2014-05-30 07:48:55 +00:00
parent a26f767f98
commit 7976af5d5f
2 changed files with 43 additions and 0 deletions

View File

@ -179,10 +179,44 @@ gpio_ctrl(struct exynos_ehci_softc *esc, int dir, int power)
return (0); return (0);
} }
static int
reset_hsic_hub(struct exynos_ehci_softc *esc, phandle_t hub)
{
device_t gpio_dev;
pcell_t pin;
/* TODO(imax): check that hub is compatible with "smsc,usb3503" */
if (!OF_hasprop(hub, "freebsd,reset-gpio")) {
device_printf(esc->dev,
"cannot detect reset GPIO pin for HSIC hub\n");
return (1);
}
if (OF_getencprop(hub, "freebsd,reset-gpio", &pin, sizeof(pin)) < 0) {
device_printf(esc->dev,
"failed to decode reset GPIO pin number for HSIC hub\n");
return (1);
}
/* Get the GPIO device, we need this to give power to USB */
gpio_dev = devclass_get_device(devclass_find("gpio"), 0);
if (gpio_dev == NULL) {
device_printf(esc->dev, "cant find gpio_dev\n");
return (1);
}
GPIO_PIN_SET(gpio_dev, pin, GPIO_PIN_LOW);
DELAY(100);
GPIO_PIN_SET(gpio_dev, pin, GPIO_PIN_HIGH);
return (0);
}
static int static int
phy_init(struct exynos_ehci_softc *esc) phy_init(struct exynos_ehci_softc *esc)
{ {
int reg; int reg;
phandle_t hub;
gpio_ctrl(esc, GPIO_INPUT, 1); gpio_ctrl(esc, GPIO_INPUT, 1);
@ -212,6 +246,10 @@ phy_init(struct exynos_ehci_softc *esc)
reg &= ~(HOST_CTRL_RESET_LINK); reg &= ~(HOST_CTRL_RESET_LINK);
bus_space_write_4(esc->host_bst, esc->host_bsh, 0x0, reg); bus_space_write_4(esc->host_bst, esc->host_bsh, 0x0, reg);
if ((hub = OF_finddevice("/hsichub")) != 0) {
reset_hsic_hub(esc, hub);
}
gpio_ctrl(esc, GPIO_OUTPUT, 1); gpio_ctrl(esc, GPIO_OUTPUT, 1);
return (0); return (0);

View File

@ -70,4 +70,9 @@
stdin = &serial2; stdin = &serial2;
stdout = &serial2; stdout = &serial2;
}; };
hsichub@13400000 {
compatible = "smsc,usb3503";
freebsd,reset-gpio = <172>;
};
}; };