Date: Fri, 30 May 2014 07:48:55 +0000 (UTC) From: Ruslan Bukin <br@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r266875 - in head/sys: arm/samsung/exynos boot/fdt/dts/arm Message-ID: <201405300748.s4U7mt0o009656@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: br Date: Fri May 30 07:48:55 2014 New Revision: 266875 URL: http://svnweb.freebsd.org/changeset/base/266875 Log: 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> Modified: head/sys/arm/samsung/exynos/exynos5_ehci.c head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts Modified: head/sys/arm/samsung/exynos/exynos5_ehci.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_ehci.c Fri May 30 07:43:55 2014 (r266874) +++ head/sys/arm/samsung/exynos/exynos5_ehci.c Fri May 30 07:48:55 2014 (r266875) @@ -180,9 +180,43 @@ gpio_ctrl(struct exynos_ehci_softc *esc, } 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); Modified: head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts ============================================================================== --- head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts Fri May 30 07:43:55 2014 (r266874) +++ head/sys/boot/fdt/dts/arm/exynos5250-chromebook-spring.dts Fri May 30 07:48:55 2014 (r266875) @@ -70,4 +70,9 @@ stdin = &serial2; stdout = &serial2; }; + + hsichub@13400000 { + compatible = "smsc,usb3503"; + freebsd,reset-gpio = <172>; + }; };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405300748.s4U7mt0o009656>