summaryrefslogtreecommitdiffstats
path: root/drivers
Commit message (Collapse)AuthorAgeFilesLines
* reset: remove duplicate imx8mq-reset.h and use correct definesLucas Stach2020-03-231-6/+6
| | | | | | | | | | | | The defines in the Barebox copy of imx8mq-reset.h had a typo, which has been fixed in the upstream Linux version of this file. So depending on include ordering the reset driver using those defines would fail to compile. Use the typo fixed versions of the define in the driver and remove the duplicate include file, as we also have the proper upstream version now. Reported-by: Giorgio Dal Molin <giorgio.nicole@arcor.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32'Sascha Hauer2020-03-1816-117/+958
|\
| * phy: port over Linux stm32 usbphyc driverAhmad Fatoum2020-02-253-0/+448
| | | | | | | | | | | | | | | | This ports over the Linux v5.6-rc1 state of the driver. It'll be needed for both EHCI and DWC2 usb connectivity on the stm32mp1. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * regulator: port over Linux stm32 PWR regulator driverAhmad Fatoum2020-02-253-0/+223
| | | | | | | | | | | | | | | | | | | | | | This driver supports internal regulators (1V1, 1V8, 3V3) in the STMicroelectronics STM32 chips. Control of these regulators will be required when adding USB support later on. Imported here is the Linux v5.6-rc1 state of the driver. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * phy: introduce phy_get_by_indexAhmad Fatoum2020-02-251-0/+14
| | | | | | | | | | | | | | | | | | The upstream (v5.6-rc1) device tree node of the stm32mp157c-dk2's OHCI has a phys property, but not phy-names. We have no API to reference such a phy easily (passing NULL isn't allowed). Add one. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * phy: populate existing ->pwr member with phy-supplyAhmad Fatoum2020-02-251-0/+10
| | | | | | | | | | | | | | | | | | barebox already enables/disables the ->pwr regulator at the correct places, but doesn't assign a value anywhere. Initialize it with the phy-supply regulator like Linux does. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * phy: remove unused init_data parameterAhmad Fatoum2020-02-255-9/+6
| | | | | | | | | | | | | | | | Linux has since migrated to a new lookup API that lacks the init_data parameter. As it's unused in barebox, follow suit. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * regulator: import Linux regulator_bulk APIAhmad Fatoum2020-02-251-0/+139
| | | | | | | | | | | | | | | | | | Linux v5.6-rc1 contains 168 references to regultor_bulk_get, which allows getting multiple regulators to set at once. Instead of open coding them when porting code, port over the helpers to barebox. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * reset: stm32: migrate restart reason and handler from stm32_iwdgAhmad Fatoum2020-02-192-103/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | The watchdog driver will remain unprobed if the driver or the OF node is disabled, but the reset reason is useful even then. System reset and reset source determination is achieved with the RCC peripheral for which we have a reset controller driver. Move the code over there, so reset reason and reset are available always. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * reset_source: migrate from reset_source_name to reset_source_to_stringAhmad Fatoum2020-02-192-2/+2
| | | | | | | | | | | | | | | | | | | | Whether reset_source_name() returns the just set reset_source is dependent on probe order and the priorities of prior reset sources in relation to the current one. Make this more robust by using the new reset_source_to_string. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * watchdog: f71808e: only print reset reason if one's indicatedAhmad Fatoum2020-02-191-4/+4
| | | | | | | | | | | | | | | | | | | | On most resets, a "reset reason: unknown" would clutter the console, because the watchdog doesn't support differentiating between POR and RST. Reduce the clutter by only printing the message when we have something interesting to say (i.e. watchdog reset). Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2020-03-189-104/+131
|\ \
| * | of: overlay: rework error message for symbolsRouven Czerwinski2020-03-091-11/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Missing symbols for overlay or root tree are valid if the overlay only adds paths to the device tree. The code handles this correctly, however it still isues a WARNING for the missing symbols. Demote the warning to info and move into the of_overlay_apply_symbols() function. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | video/ssd1307fb: make reset GPIO optionalAhmad Fatoum2020-03-091-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | Both reset GPIO and regulator are optional as per the binding and the driver can work without if we ignore their absence. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | video/ssd1307fb: drop unneeded regulator NULL checksAhmad Fatoum2020-03-091-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | regulator_{enable,disable} are already no-ops when the parameter is NULL. Drop the NULL checks thusly. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | video/ssd1307fb: fix NULL pointer dereference in probeAhmad Fatoum2020-03-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | info->priv is dereferenced before a valid value has been set leading to a NULL pointer dereference in the probe function. Fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: host: ehci: distinguish DMA addressesPeter Mamonov2020-03-051-33/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds translation from CPU to DMA addresses, which is required for proper operation on certain architectures like MIPS. This patch also fixes the bug introduced by 4350744bf5 "usb: ehci-hcd: port periodic transactions implementation from the u-boot", which is still present in the original U-Boot code: td->qt_buffer[0] = cpu_to_hc32((unsigned long)buffer + i * elementsize); td->qt_buffer[1] = cpu_to_hc32((td->qt_buffer[0] + 0x1000) & ~0xfff); ... In case of a big-endian CPU 0x1000 is added to the byte-swapped value `td->qt_buffer[0]`, the result is byte swapped once again and stored to `td->qt_buffer[1]`. This results in erroneous values being stored in `td->qt_buffer[1..4]`. N.B.: This patch needs some testing on architectures different from MIPS. Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | net: designware: eqos: mimic Linux gmac4 mdio_{read, write}Ahmad Fatoum2020-03-024-21/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code was ported over from U-Boot and has some things different than the Kernel driver: - It reads ->mdio_address, but the kernel driver doesn't - It doesn't write ->mdio_data in a read, but the kernel driver does - It has delays in addition to spinning on MII_BUSY, but the kernel driver doesn't Adopt the same flow as used by the kernel. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | net: designware: eqos: remove left-over PHY quirk work aroundAhmad Fatoum2020-03-021-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The dummy read was a left over from an abandoned merge with the existing support for the SoCFPGA variant of the Designware MAC. It doesn't exist in either the U-Boot or kernel drivers for the EQOS, thus drop it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | gadget: f_fastboot: New Kconfig option USB_GADGET_FASTBOOT_CMD_OEMChristian Eggers2020-02-252-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most fastboot commands are suitable for a secure boot environment as they only allow to download/flash/erase to files/partitions which were explicitly specified in the usbgadget command. The "oem" group of commands allows execution of arbitrary barebox commands. This needs to be disabled for secure boot devices. Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | of: add missing newline to pr_warnRouven Czerwinski2020-02-251-1/+1
| |/ | | | | | | | | | | | | Add a missing newline to the pr_warn call while applying the overlays. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer2020-03-1826-394/+2813
|\ \
| * | usb: imx: add i.MX8MM support for usbmiscSascha Hauer2020-02-251-0/+6
| | | | | | | | | | | | | | | | | | | | | The i.MX8MM also has a usbmisc unit. It's the same as for the i.MX7d, add the compatible entry for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ARM: i.MX8M: Add DDR controller supportSascha Hauer2020-02-199-0/+1463
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the DDR driver for the i.MX8MQ/i.MX8MM. It's taken from U-Boot v2020.04-rc1 with slight modifications for barebox The i.MX8MQ boards in the tree currently use the output of an earlier version of the NXP i.MX8M DDR Tool which doesn't use a controller driver but instead does most stuff in board code. It seems this can coexist with the new driver, only a few helper functions that previously lived in arch/arm/mach-imx/imx8-ddrc.c are now provided by the new driver. Tested on an i.MX8MM EVK Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | iomux: Add i.MX8MM supportSascha Hauer2020-02-191-0/+2
| | | | | | | | | | | | | | | | | | Just add the compatible string, nothing more to do. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: imx: Add imx8mm clk driverSascha Hauer2020-02-192-0/+578
| | | | | | | | | | | | | | | | | | This adds clock support for the i.MX8MM, taken from Linux-5.5. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: imx: Add imx8m_clk_composite_criticalSascha Hauer2020-02-191-0/+3
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | clk: imx: Add pll14xx supportSascha Hauer2020-02-193-0/+492
| | | | | | | | | | | | | | | | | | | | | | | | This adds support for the pll14xx found on i.MX8MM devices. This is taken from the Kernel as of v5.5. Since we'll need some early setup for the PLL a PBL hook is added to be called from lowlevel code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | I2C: i.MX: Add early i2c support for i.MX8MSascha Hauer2020-02-191-0/+12
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: imx-esdhc: Add i.MX8mm supportSascha Hauer2020-02-191-0/+1
| | | | | | | | | | | | | | | | | | Only add the compatible string to let the driver match. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | serial: imx: Add imx8mm compatibleSascha Hauer2020-02-191-0/+3
| | | | | | | | | | | | | | | | | | Only add the compatible string to let the driver match. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: imx: Add i.MX8mm supportSascha Hauer2020-02-191-0/+2
| | | | | | | | | | | | | | | | | | Only add the compatible string to let the driver match. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: gadget: fsl_udc: Fix warnings on 64bit compilationSascha Hauer2020-02-191-2/+15
| | | | | | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | usb: gadget: fsl_udc: Add PBL image loading supportSascha Hauer2020-02-194-1/+215
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For boards that do the RAM setup in code we can up to now only download the PBL part to SRAM. This patch adds support for downloading the rest of the image after the RAM has been configured. The ROM is nice enough to leave the USB controller initialized after a download, so we don't have to reinitialize it, but can simply continue to use the controller. Like all two-staged loading processes on i.MX this needs board support, it will only work when a board calls imx_barebox_load_usb() or one of the SoC specific variants. This needs the host counterpart in imx-usb-loader which is done in the next patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | USB: gadget: fsl_udc: move register definitions to header fileSascha Hauer2020-02-191-376/+1
| | | | | | | | | | | | | | | | | | | | | The register definitions will be shared by the regular and the pbl driver, so move them to a header file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mci: imx-esdhc-pbl: Add instance 2 for i.MX8MMSascha Hauer2020-02-191-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike the i.MX8MQ the i.MX8MM has three SDHCI controllers. Add support for picking the base address of the third controller from the instance number. While at it use the IMX8M_ base addresses rather than the IMX8MQ_ base addresses. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | ARM: i.MX8M: rename functions to be i.MX8M specificSascha Hauer2020-02-191-6/+6
| | | | | | | | | | | | | | | | | | | | | imx8_esdhc_load_image() and friends can't be used on the big variants of the i.MX8, so rename to imx8m_esdhc_load_image() Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | HAB: i.MX8M: rename imx8_* functions to imx8m_*Sascha Hauer2020-02-191-6/+6
| | | | | | | | | | | | | | | | | | | | | The big i.MX8 does HAB through the SCU which will be different. To avoid confusion rename the functions to imx8m_* Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/clk'Sascha Hauer2020-03-181-5/+38
|\ \ \
| * | | clk: print more consistent clock statesSascha Hauer2020-02-251-2/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In clk_dump we only print the state of clk_is_enabled(). Depending on the clock this can mean different things. When the clock provides an is_enabled() callback it will print its result, so the enabled state matches the hardware state of that clock, but doesn't necessarily mean its parents are enabled. If a clock does not provide an is_enabled() callback then we rely on our internal enable_count tracker. Change this to always print the hardware state of the current clock. It can be: - disabled: The clock is disabled (as provided by is_enabled()) - enabled: The clock is enabled (as provided by is_enabled()) - always enabled: The clock can't be disabled (no is_enabled callback and can't be enabled/disabled) - unknown: no is_enabled callback but can be enabled/disabled Additionally we print the enable_count variable, so from enable_count != 0 we can know that barebox has enabled the clock. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | clk: Do not let the enable count of critical clocks go below 1Sascha Hauer2020-02-251-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The enable count of critical clocks may not drop below 1. Otherwise the new parent during a reparenting of a critical clock will not be enabled. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | | clk: initially enable critical clocksSascha Hauer2020-02-251-0/+3
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | Critical clocks have to be enabled initially. We have to do this not only to enable the clock itself, but also to make sure its parents stay enabled and also to correctly enable the new parents during reparenting of the clock. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/block'Sascha Hauer2020-03-181-0/+2
|\ \ \
| * | | usb: gadget: fastboot: call discard_range for sparse files as wellAhmad Fatoum2020-03-031-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can save some time by explicitly telling the block layer that a range is unused before overwriting it. This brought time my sample write from 445s to 376s. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | pinctrl-single: fix parsing of `pinctrl-single,bits` propertyPeter Mamonov2020-03-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to dts/Bindings/pinctrl/pinctrl-single.txt:113 the correct order of parameters is <offset, value, mask>. Fixes: f7e0cae43 ('pinctrl-single: Handle "pinctrl-single,function-mask" dt property') Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | usb: Add extra delay for device scanChristian Eggers2020-03-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since b1d9837182, detection of various USB flash drives stopped working. While the changes itself look correct, probably the HUB requires some "recovery time" between the GET_STATUS commands in order to be able to detect devices. Our configuration: i.MX6ULL (USB-OTG) with only one port on the root HUB. This port is connected to a Microchip USB4916 hub (permanently attached). The USB4916 is configured with it's power on defaults which means that bPwrOn2PwrGood is set to the maximum (0xFF = 510 ms). Fixes: b1d9837182 ("usb: Change power-on / scanning timeout handling") Signed-off-by: Christian Eggers <ceggers@arri.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | USB: MUSB: defer driver probes where necessaryAhmad Fatoum2020-03-024-23/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Kernel commit 0782e8572c ("ARM: dts: Probe am335x musb with ti-sysc") which we pulled in during the v2020.02.0 dts/ sync moved the USB nodes to be under a ti-sysc bus instead of ti,am33xx-usb. This new probe order broke am335x USB under barebox, because the MUSB drivers couldn't cope with the now different device probe order. Pepper some -EPROBE_DEFER around to make USB work again. Fixes: 574eed3f6f ("dts: update to v5.5-rc1") Reported-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Tested-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | | USB: MUSB: PHY: scrap singleton am335x_get_usb_phy()Ahmad Fatoum2020-03-023-20/+13
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | am335x_get_usb_phy() retrieves the last probed USB phy. On the BeagleBone with both PHYs enabled, this means that dependent on probe order, both MUSB instances could end up with the same PHY. Remove the global variable and have the MUSB driver parse the "phys" property instead. The cleaner way to achieve this would be to migrate phy-am335x.c and phy-am335x-control.c to the generic phy framework and have MUSB use of_phy_get, alas, even Linux hasn't done this so far and we need a short patch for master anyway, thus just do it the easy way. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Tested-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | net: designware: eqos: stm32: drop no longer needed syscfg-clkAhmad Fatoum2020-02-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The upstream device tree no longer lists "syscfg-clk" and the syscon node contains a clocks property that the barebox syscon driver now automatically clocks before access. Thus drop the requirement that "syscfg-clk" is specified. Fixes: 4aaceef58 ("dts: update to v5.6-rc1") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | mfd: syscon: clock peripheral if specified in device treeAhmad Fatoum2020-02-191-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux supports a clocks property in syscon nodes to indicate that access should only occur with the clock active. Attach the clock to the regmap if found. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>