Fix accidental USB port resets by GPIO on Zynq/Zedboard boards

The Zynq/Zedboard GPIO driver attempts to tri-state all GPIO pins on
boot up but the order in which I reset the hardware can cause the pins
to be briefly held low before being tri-stated.  This is a problem on
boards that use GPIO pins to reset devices.

In particular, the Zybo and ZC-706 boards use a GPIO pin as a USB PHY
reset.  If U-boot enables the USB port before booting the kernel, the
GPIO driver attach causes a glitch on the USB PHY reset and the USB
port loses power.  My fix is to have the GPIO driver leave the pins in
whatever configuration U-boot placed them.

PR:		225713
Submitted by:	Thomas Skibo <thoma555-bsd@yahoo.com>
MFC after:	1 week
This commit is contained in:
Oleksandr Tymoshenko 2018-04-03 04:31:54 +00:00
parent 643dc495a0
commit 8857481840
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=331906

View File

@ -298,24 +298,6 @@ zy7_gpio_probe(device_t dev)
return (0);
}
static void
zy7_gpio_hw_reset(struct zy7_gpio_softc *sc)
{
int i;
for (i = 0; i < NUMBANKS; i++) {
WR4(sc, ZY7_GPIO_DATA(i), 0);
WR4(sc, ZY7_GPIO_DIRM(i), 0);
WR4(sc, ZY7_GPIO_OEN(i), 0);
WR4(sc, ZY7_GPIO_INT_DIS(i), 0xffffffff);
WR4(sc, ZY7_GPIO_INT_POLARITY(i), 0);
WR4(sc, ZY7_GPIO_INT_TYPE(i),
i == 1 ? 0x003fffff : 0xffffffff);
WR4(sc, ZY7_GPIO_INT_ANY(i), 0);
WR4(sc, ZY7_GPIO_INT_STAT(i), 0xffffffff);
}
}
static int zy7_gpio_detach(device_t dev);
static int
@ -338,9 +320,6 @@ zy7_gpio_attach(device_t dev)
return (ENOMEM);
}
/* Completely reset. */
zy7_gpio_hw_reset(sc);
sc->busdev = gpiobus_attach_bus(dev);
if (sc->busdev == NULL) {
zy7_gpio_detach(dev);