summaryrefslogtreecommitdiffstats
path: root/drivers
Commit message (Collapse)AuthorAgeFilesLines
* clk: zynq: remove clkdevsLucas Stach2019-11-111-9/+0
| | | | | | | | They aren't needed anymore, as all the Zynq devices now use a DT based clock lookup. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: zynq: partially sync with LinuxLucas Stach2019-11-111-16/+71
| | | | | | | | | | Sync the clock enum with the clocks used by Linux and the DT binding. Implement AMBA bus clocks and SPI and SDIO peripheral clocks and register a DT clock controller, so the clocks can be looked up by DT handle. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: zynq: fix up address from DTLucas Stach2019-11-111-1/+23
| | | | | | | | | | The upstream Zynq 7000 DT describes the SLCR child devices physical address as an offset within the SLCR. The driver thus needs to add the SLCR base offset to the address before trying to map the MMIO region. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: zynq: improve PLL enable handlingLucas Stach2019-11-111-1/+12
| | | | | | | | | | | Ensure that both the powerdown and reset bits are cleared when the PLL gets enabled, as any of those set would prevent the PLL from working. Also add a status readback function, so the real status of the PLL is reflected in the Barebox clock state. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* clk: zynq: use base address of clock controllerLucas Stach2019-11-111-15/+15
| | | | | | | | | The clock controller is a subregion of the SLCR, use the real base of this region for mapping the registers. This will allow to switch to DT based probing later. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: zynq: move clock controller driver to drivers/clkLucas Stach2019-11-113-0/+428
| | | | | | | No functional change, just adjusting the Zynq code to common practise. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: add Zynq compatibleLucas Stach2019-11-111-0/+1
| | | | | | | Add compatible for the GEM on the Zynq 7000 device. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: macb: handle more clocksLucas Stach2019-11-111-2/+22
| | | | | | | | | Both pclk and hclk are required clocks in the DT binding. rx_clk and tx_clk are optional, but must be enabled if a system has separate gates for them. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/zynqmp'Sascha Hauer2019-11-073-0/+418
|\
| * firmware: zynqmp-fpga: print Xilinx bitstream headerMichael Tretter2019-10-281-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | The bitstream header has 5 fields, that start with a char for the type. Four fields have a big-ending length and a null-terminated string for the design name, the part number, and the date and time of creation. The last field is a big-endian 32 bit unsigned int for the size of the bitstream. Print this info when loading the bitstream. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * firmware: zynqmp-fpga: introduce driver to load bitstream to FPGAThomas Haemmerle2019-10-283-0/+367
| | | | | | | | | | | | | | | | | | The driver provides functionalities to check and load a bitstream to FPGA. A boolean parameter to check if FPGA is already programmed is added. Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/watchdog'Sascha Hauer2019-11-075-27/+63
|\ \
| * | mfd: da9063: fix watchdog ping executionMarco Felsch2019-11-051-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | The watchdog resets the system if the watchdog gets pinged to fast. Between each watchdog ping must be a pause of at least 200ms. This commit fixes that by rejecting two fast requests. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mfd: da9063: fix TWDSCALE debug messageMarco Felsch2019-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The TWDSCALE is the found scale + 1 as described in the datasheets for the DA9062/3 devices. The driver logic is correct just the debug message is wrong. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | watchdog: add timeout_cur parameter only when poller is enabledAhmad Fatoum2019-10-291-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | timeout_curr is the timeout programmed into the watchdog hardware every 500 milliseconds. If watchdog poller support is disabled, it still shows up as a configurable device parameter, but has no effect. Improve user experience by having it show up only if watchdog poller support was compiled in. This is already the case for the autoping parameter. The timeout_max parameter is a generic parameter and will remain unchanged. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | watchdog: rename timeout_curr to poller_timeout_curr internallyAhmad Fatoum2019-10-291-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | timeout_curr is the timeout programmed into the watchdog hardware every 500 milliseconds. If watchdog poller support is disabled, it serves no purpose, prefix it with poller_ to better communicate this fact. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | watchdog: remove wrong uses of timeout_curAhmad Fatoum2019-10-292-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The barebox watchdog poller uses the struct watchdog.timeout_cur as the timeout value to configure the watchdog with. There's no need for the device driver to set this. I didn't know that when I wrote the drivers, but I do now, hence this commit. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | watchdog: export API to configure watchdogs by nameAhmad Fatoum2019-10-291-16/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far watchdog users could only configure the watchdog with the highest priority. In preparation for having the wd command configure a watchdog by name, extend watchdog_set_timeout with a struct watchdog *parameter and export functions to query default watchdog and to find watchdog by name. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | watchdog: export priority as device parameterAhmad Fatoum2019-10-241-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 8f4cf30903 ("watchdog: Allow multiple watchdogs") introduced the ability to set a per-watchdog priority from within drivers, which is usually populated with of_get_watchdog_priority. For debugging, it can be useful to query and override this priority on the fly. Provide a device parameter to do so. As watchdog_get_default only considers priorities > 0, it makes sense to have a newly set priority of 0 disable the watchdog. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | watchdog: efi: bump down priority below defaultAhmad Fatoum2019-10-241-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The barebox EFI documentation notes: > Current linux kernel (v5.0) will execute ExitBootServices() during the > early boot stage and thus will automatically disable the (U)EFI watchdog. > Since it is the proper behavior according to the (U)EFI specification, it > is impossible to protect full boot chain by using this watchdog only. > It is recommended to use an alternative hardware watchdog Heed the advice and bump down the EFI watchdog priority below the watchdog priority default. This ensures the EFI watchdog isn't inadvertently used if other watchdogs are registered. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/stm32'Sascha Hauer2019-11-0722-90/+3466
|\ \
| * | regulator: add driver for stpmic1-regulatorsAhmad Fatoum2019-11-063-1/+447
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit imports the Linux v5.3 state of the driver. This allows us to regulate at least the v3v3 voltage rail used by the DK1 and DK2 Ethernet PHY and SD-Card. Eventually, this driver should be used by the USB host driver to supply the vbus voltage as well. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mfd: stpmic1: use dev_get_regmap instead of priv memberAhmad Fatoum2019-11-062-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | When we call regmap_init, the regmap is associated with the device supplied and can be queried with dev_get_regmap. This is more natural than expecting cell drivers to cast dev->parent->priv. Do it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | regulator: import linear voltage range helpersAhmad Fatoum2019-11-061-0/+186
| | | | | | | | | | | | | | | | | | | | | | | | | | | The incoming stpmic1 regulator driver makes use of these helpers internally. Thus port them out of Linux v5.3. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | regulator: port Linux of_regulator_matchAhmad Fatoum2019-11-062-0/+230
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux regulator drivers like the pfuze and the incoming stpmic make use of of_regulator_match to parse regulator init data from the device tree. Port the function over from Linux v5.3, so drivers depending on it can follow. As we have no use in barebox for power saving and suspend states, these parts are omitted. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | net: eqos: extend Designware Ethernet QoS for Tegra 186 supportAhmad Fatoum2019-11-063-0/+354
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The U-Boot dwc_eth_qos driver ported in the previous commit had support for both the Tegra 186/194 and STM32MP variants of the EQOS IP. The barebox Tegra supported doesn't include the 186, but as the driver was nevertheless ported along with the rest, lets include it in the source tree. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | net: add Designware Ethernet QoS for STM32MPAhmad Fatoum2019-11-065-1/+1227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already have Designware NIC support in barebox, but for the DWMAC1000, the DWMAC4 (also called GMAC4), no support was mainline so far. The DWMAC4 is different enough that sharing code with the DWMAC1000 is not really that helpful, because even basics like MDIO registers have different layout. Instead of coding bit masks and shifts into the driver data, like Linux does, we'll keep both driver kinds separate. Nevertheless, we collect functions that are not SoC-specific into a separate 'library' file. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: stm32_sdmmc2: parse generic MCI oftree propertiesAhmad Fatoum2019-11-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mci_of_parse takes care of the generic oftree bits, like removable flag, aliases and max-frequency. Insert it, so we can start to refer to the controller's block devices by a fixed name. Sticking in the mci_of_parse shows that the SD/MMC2 driver in barebox doesn't play nicely with the device tree specification of the SD/MMC2 for the dk2 board, however: Specifying the bus-width = <4> property in the device tree now made mmc usage fail when reading the environment: ERROR: error SDMMC_STA_DCRCFAIL (0x81042) for cmd 18 ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12 WARNING: stm32_sdmmc2_send_cmd: cmd 12 failed, retrying ... ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12 WARNING: stm32_sdmmc2_send_cmd: cmd 12 failed, retrying ... ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12 WARNING: stm32_sdmmc2_send_cmd: cmd 12 failed, retrying ... ERROR: stm32_sdmmc2_end_cmd: error SDMMC_STA_CTIMEOUT (0x4) for cmd 12 We'll want to fix this eventually, but for now force the bus width to 1. So we don't forget about this, print a notice to the console that we've done so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | nvmem: add read support for STM32MP1 bsec OTPAhmad Fatoum2019-11-063-1/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | The bsec on the STM32MP157C provides a 380 byte OTP. Add initial support for reading and writing the shadow copy of the fuses. Direct fuse access is not yet supported. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pinctrl: stm32: parse pinctrl nodes without subnodes as wellAhmad Fatoum2019-11-061-81/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | | The bindings allow the pinmux node to occur directly in the node under the pin controller as well. Check for this and support both types of pinctrl specification. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pinctrl: demote dev_info on successful probes to dev_dbgAhmad Fatoum2019-11-063-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SoC's pin controller is virtually always built and probed, so there's is little information to gain from the fact it was successfully probed. Have the success message show up as debug message to reduce probe clutter like this: NOTICE: stm32-pinctrl soc:pin-controller@50002000.of: pinctrl/gpio driver registered NOTICE: stm32-pinctrl soc:pin-controller-z@54004000.of: pinctrl/gpio driver registered Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pinctrl: stm32: fix debug print of uninitialized variableAhmad Fatoum2019-11-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | mode and alt are printed with the dev_dbg before they are initialized. Remedy this by moving the dev_dbg after them. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: add support for stm32mp sd/mmc controllerOleksij Rempel2019-11-063-0/+675
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver was ported from u-boot v2019.10. Instead of devicetree compatible it is using ARM AMBA id. So, there is no need to patch devicetree with different compatible as it was implemented in u-boot. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/socfpga'Sascha Hauer2019-11-072-16/+118
|\ \ \
| * | | net: designware: socfpga: fix phy setup for Arria10Steffen Trumtrar2019-10-182-16/+118
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Barebox-version of the Linux v5.2 patch: 40ae25505fe834648ce4aa70b073ee934942bfdb net: stmmac: socfpga: fix phy and ptp_ref setup for Arria10/Stratix10 On the Arria10, Agilex, and Stratix10 SoC, there are a few differences from the Cyclone5 and Arria5: - The emac PHY setup bits are in separate registers. - The PTP reference clock select mask is different. - The register to enable the emac signal from FPGA is different. Thus, this patch creates a separate function for setting the phy modes on Arria10/Agilex/Stratix10. The separation is based a new DTS binding: "altr,socfpga-stmmac-a10-s10". Signed-off-by: Dinh Nguyen <dinguyen@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> The new DTS binding is already part of v2019.10.0 and the driver doesn't probe on Arria10 without the new binding introduced in this patch. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/misc'Sascha Hauer2019-11-075-10/+13
|\ \ \
| * | | usb: storage: Increase retries for usb_stor_transport()Robert Karszniewicz2019-11-041-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This should make writing and reading more reliable. Also: - change loop condition to make "retries" semantically correct - add a debug message in case of fatal failure Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | of: of_path: fix return in case of EPROBE_DEFERMarco Felsch2019-11-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As said in commit 82eb3dff10 ("of_path: handle no driver for device") this case happens if the driver isn't probed yet. So we should return -EPROBE_DEFER to signal that. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | OF: gpio: don't warn if ignored GPIO flag matches the behaviorLucas Stach2019-11-041-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Port of the upstream accepted change to the Linux kernel. Some devicetrees specify the ACTIVE_LOW flag in the fixed regulator GPIO handle. While this has always been ignored, it's consistent with the behavior of the regulator binding in the absence of the "enable-active-high" DT property. It doesn't make much sense to print a user visible warning for a configuration which is consistent, so only print the warning if the GPIO flag contradicts the behavior dictated by by the enable-active-high property. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | mfd: superio: use strerrorp helper instead of open-codingAhmad Fatoum2019-10-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently, we have a helper for strerror(-PTR_ERR(regmap)). Use it. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | hwrng: dev-random: always use /dev/urandomAhmad Fatoum2019-10-231-3/+3
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | /dev/random can block long after boot time. It seems there's a consensus that /dev/urandom is safe to use except for very early boot, which isn't when barebox sandbox is usually run. To make the HWRNG more useful, always use /dev/urandom. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/efi'Sascha Hauer2019-11-074-17/+146
|\ \ \ | |_|/ |/| |
| * | efi: populate boot source instanceAhmad Fatoum2019-10-282-5/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We already determine the boot source variable at core init level, but so far we didn't populate the instance because the numbering of the block devices isn't known that early. Introduce a helper to check if a block device is the boot source and if it is, have the block device driver populate the missing boot source instance. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | serial: efi-stdio: Add simple_text_input_ex_protocol backendAhmad Fatoum2019-10-232-10/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | EFI implementations differ in how simple_text_input_protocol treats ctrl+alpha combinations. OVMF (used with QEMU) returns a Unicode control character, the UEFI on the Dell Latitude 7490 on the other hand ignores the ctrl completely and returns just the letter rendering utilities like barebox edit unusable. To fix this, the simple_text_input_ex_protocol can be leveraged as it additionally provides the state of modifier keys. Extend efi-stdio to use it where possible. Cc: Michael Olbrich <mol@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | serial: efi-stdio: replace globals with handles in priv structAhmad Fatoum2019-10-231-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Despite assigning efi_sys_table->{con_in,con_out} to priv->{in,out}, some functions still use the global efi_sys_table->{con_in,con_out}. Let's restrict globals access to the probe function and have the priv struct completely describe input and output used in the callbacks. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | efi: use efi_guidcmp helper where appropriateAhmad Fatoum2019-10-181-1/+1
| |/ | | | | | | | | | | | | We have a helper for it. Let's use it. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / serial: cadence: fix serial_flushLucas Stach2019-11-041-1/+1
|/ | | | | | | | The TXEMPTY bit gets set as soon as the transmit FIFO gets empty, so flushing must wait until the bit is set instead of being unset. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/usb'Sascha Hauer2019-10-171-25/+159
|\
| * usb: Change power-on / scanning timeout handlingPrimoz Fiser2019-10-021-19/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change USB port scanning procedure and timeout handling in the following ways: 1) The power-on delay in usb_hub_power_on() is now reduced to a value of max(100ms, "hub->desc.bPwrOn2PwrGood * 2"). The code does not wait using mdelay, instead usb_hub_power_on() will wait before querying the device in the scanning loop later. The total connection timeout for this hub, which is (1 second + hub->desc.bPwrOn2PwrGood * 2) is calculated and will be used in the following per-port scanning loop as the timeout to detect active USB devices on this hub. 2) Don't delay the minimum delay (for power to stabilize) in usb_hub_power_on(). Instead skip querying these devices in the scanning loop usb_scan_port() until the delay time is reached. 3) The ports are now scanned in a quasi parallel way. The current code did wait for each (unconnected) port to reach its timeout and only then continue with the next port. This patch now changes this to scan all ports of all USB hubs quasi simultaneously. For this, all ports are added to a scanning list in usb_hub_configure_ports(). The list is later scanned in usb_device_list_scan() until all ports are ready by either a) reaching the connection timeout (calculated earlier), or by b) detecting a USB device. This results in a faster USB scan time as the recursive scanning of USB hubs connected to the hub that's currently being scanned will start earlier. 4) Ports with overcurrent detection will get scanned multiple times if OC condition is detected (PORT_OVERCURRENT_MAX_SCAN_COUNT). Without patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 10344ms With patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 4529ms Delta: ~6 seconds Signed-off-by: Primoz Fiser <primoz.fiser@norik.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * usb: usb_hub_port_connect_change(): Remove unnecessary delaysPrimoz Fiser2019-10-021-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove two mdelay(200) calls from usb_hub_port_connect_change() before and after calling hub_port_reset(). These delays don't seem to be necessary since hub_port_reset() already incorporates delays on its own. Without patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 16355ms With patch: $ time usb usb: USB: scanning bus for devices... usb: 17 USB Device(s) found time: 10344ms Delta: ~6 seconds Signed-off-by: Primoz Fiser <primoz.fiser@norik.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>