--- zzzz-none-000/linux-2.6.39.4/drivers/usb/host/ehci-hcd.c 2011-08-03 19:43:28.000000000 +0000 +++ puma6-atom-6490-729/linux-2.6.39.4/drivers/usb/host/ehci-hcd.c 2021-11-10 13:38:17.000000000 +0000 @@ -44,6 +44,12 @@ #include #include +#ifdef CONFIG_X86 +#include +#include + static int gpio_usb_power = -1; +#endif + /*-------------------------------------------------------------------------*/ /* @@ -1300,6 +1306,18 @@ } #endif +#ifdef CONFIG_X86 + { + if(avm_get_hw_config(AVM_HW_CONFIG_VERSION, "gpio_avm_usb_pwr_en0", &gpio_usb_power, NULL) == 0) { + avm_gpio_ctrl(gpio_usb_power, GPIO_PIN, GPIO_OUTPUT_PIN); + avm_gpio_out_bit(gpio_usb_power , 1); + /* Let some time to power up the ports */ + /* 20180110 AVM/VGJ change to 2 s makes enumeration more stable */ + msleep (2000); + } + } +#endif + #ifdef PLATFORM_DRIVER retval = platform_driver_register(&PLATFORM_DRIVER); if (retval < 0) @@ -1329,8 +1347,8 @@ if (retval < 0) goto clean4; #endif - return retval; + return retval; #ifdef XILINX_OF_PLATFORM_DRIVER /* platform_driver_unregister(&XILINX_OF_PLATFORM_DRIVER); */ clean4: @@ -1356,6 +1374,12 @@ ehci_debug_root = NULL; err_debug: #endif + +#ifdef CONFIG_X86 + if(gpio_usb_power >= 0) { + avm_gpio_out_bit(gpio_usb_power , 0); + } +#endif clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded); return retval; } @@ -1381,6 +1405,11 @@ #ifdef DEBUG debugfs_remove(ehci_debug_root); #endif +#ifdef CONFIG_X86 + if(gpio_usb_power >= 0) { + avm_gpio_out_bit(gpio_usb_power , 0); + } +#endif clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded); } module_exit(ehci_hcd_cleanup);