diff options
author | br <br@FreeBSD.org> | 2014-05-30 07:48:55 +0000 |
---|---|---|
committer | br <br@FreeBSD.org> | 2014-05-30 07:48:55 +0000 |
commit | 7976af5d5f6142cc5e5492d657f8ba149606993e (patch) | |
tree | 7824780989473152791565ac47c0d9e5c5bb69e7 | |
parent | a26f767f986ba6d8f73fd3c8bbaface98659bd88 (diff) | |
download | FreeBSD-src-7976af5d5f6142cc5e5492d657f8ba149606993e.zip FreeBSD-src-7976af5d5f6142cc5e5492d657f8ba149606993e.tar.gz |
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>
-rw-r--r-- | sys/arm/samsung/exynos/exynos5_ehci.c | 38 | ||||
-rw-r--r-- | sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts | 5 |
2 files changed, 43 insertions, 0 deletions
diff --git a/sys/arm/samsung/exynos/exynos5_ehci.c b/sys/arm/samsung/exynos/exynos5_ehci.c index 7dacafa..84e4c5f 100644 --- a/sys/arm/samsung/exynos/exynos5_ehci.c +++ b/sys/arm/samsung/exynos/exynos5_ehci.c @@ -180,9 +180,43 @@ gpio_ctrl(struct exynos_ehci_softc *esc, int dir, int power) } 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 phy_init(struct exynos_ehci_softc *esc) { int reg; + phandle_t hub; gpio_ctrl(esc, GPIO_INPUT, 1); @@ -212,6 +246,10 @@ phy_init(struct exynos_ehci_softc *esc) reg &= ~(HOST_CTRL_RESET_LINK); 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); return (0); diff --git a/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts b/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts index 9f7c1fa..c0e4285 100644 --- a/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts +++ b/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts @@ -70,4 +70,9 @@ stdin = &serial2; stdout = &serial2; }; + + hsichub@13400000 { + compatible = "smsc,usb3503"; + freebsd,reset-gpio = <172>; + }; }; |