aboutsummaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2022-05-04net: mvneta: Rename CONFIG_NR_CPUS to MVNETA_NR_CPUSMarek Behún
The CONFIG_* macros are reserved for Kconfig. This was probably done when this driver was being imported from Linux. Rename the macro. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Don't check for CONFIG_PHYLIBMarek Behún
Drop checking for CONFIG_PHYLIB in mvneta, this is already done in Kconfig. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Drop unnecessary spaceMarek Behún
Drop unnecessary space in mvneta_adjust_link(). Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Use bool instead of int for boolean variableMarek Behún
Use the bool type instead of int for status_change variable. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Drop one indentation level in mvneta_adjust_link()Marek Behún
Drop one indentation level in the mvneta_adjust_link() function. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Fix unused variable warning if DM_GPIO is disabledMarek Behún
The `ret` variable in mvneta_probe() is unused if DM_GPIO is disabled. Since the variable is used only once after assigning value, we can inline the usage and drop the variable. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Don't register MDIO busMarek Behún
This MDIO bus is now handled by a proper mvmdio DM driver. Remove it from mvneta. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Remember fixed link instead of PHY address in priv dataMarek Behún
We don't need to remember PHY address anymore, because since using DM MDIO for connecting PHY, the address is parsed by mdio-uclass from the ofnode. But the driver uses a special value of the address to signal fixed link usage. Drop phyaddr add fixed_link in driver private structure. This simplifies code a little. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Use DM MDIO API for connecting PHYMarek Behún
Use the modern DM MDIO API for connecting PHY in the mvneta driver. This requires enabling MVMDIO driver in several config files. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Fix 10Mbps speedMarek Behún
In mvneta_adjust_link() we need to set MII_SPEED bit only if PHY reports the speed at 100Mbps. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: mvneta: Get rid of platdataMarek Behún
Drop .of_to_plat() from the mvneta driver and parse the two properties in .probe(). Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2022-05-04net: Add ethernet support for MIPS OcteonStefan Roese
This patchs adds the ethernet & MDIO driver for the MIPS Octeon II / III SoC platform. Please note that these drivers are based on the 2013 U-Boot version from Marvell and make use of the platform supported helper functions for the ethernet functionality, including stuff like SFP handling. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Ramon Fried <rfried.dev@gmail.com> Cc: Joe Hershberger <joe.hershberger@ni.com>
2022-05-03pci: Add config for Enhanced AllocationAndrew Scull
Add a config to control whether Enhanced Allocation is supported by the driver. Signed-off-by: Andrew Scull <ascull@google.com>
2022-05-03virtio: pci: Make use of dm_pci_map_bar()Andrew Scull
The virtio PCI capabilities describe regions of memory that should be mapped. Map those with dm_pci_map_bar() which will ensure they are valid PCI regions. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03virtio: pci: Check virtio configs are mappedAndrew Scull
Prepare for calls to `virtio_pci_map_capability()` failing by returning NULL on error. If this happens, later accesses to the pointers would be unsafe so cause the probe to fail if such an error occurs. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03pci: Add mask parameter to dm_pci_map_bar()Andrew Scull
Add a mask parameter to control the lookup of the PCI region from which the mapping can be made. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03pci: Update dm_pci_bus_to_virt() parametersAndrew Scull
Add mask parameter and reorder length parameter to match the other PCI address conversion functions. Using PCI_REGION_TYPE as the mask gives the old behaviour. It's converted from a macro to an inline function as the length parameter is now used twice, but should only be calculated once. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03pci: Match region flags using a maskAndrew Scull
When converting addresses, apply a mask to the region flags during lookup. This allows the caller to specify which flags are important and which are not, for example to exclude system memory regions. The behaviour of the function is changed such that they don't preferentially search for a non-system memory region. However, system memory regions are added after other regions in decode_regions() leading to a similar outcome. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03pci: Map bars with offset and lengthAndrew Scull
Evolve dm_pci_map_bar() to include an offset and length parameter. These allow a portion of the memory to be mapped and range checks to be applied. Passing both the offset and length as zero results in the previous behaviour and this is used to migrate the previous callers. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03pci: Range check address conversionsAndrew Scull
When converting between PCI bus and physical addresses, include a length parameter that can be used to check that the entire range fits within one of the PCI regions. This prevents an address being returned that might be only partially valid for the range it is going to be used for. Where the range check is not wanted, passing a length of 0 will have the same behaviour as before this change. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03pci: Check region ranges are addressableAndrew Scull
When parsing the `ranges` DT node, check that both extremes of the regions are addressable without overflow. This assumption can then be safely made when processing the regions. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03pci: Fix use of flags in dm_pci_map_bar()Andrew Scull
The flags parameter of dm_pci_map_bar() is used for PCI region flags rather than memory mapping flags. Fix the type to match that of the region flags and stop using the regions flags as memory mapping flags. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03virtio: pci: Read entire capability into memoryAndrew Scull
Read the virtio PCI capability out of the device configuration space to a struct rather than accessing fields directly from the configuration space as they are needed. This both makes access to the fields easier and avoids re-reading fields. Re-reading fields could result in time-of-check to time-of-use problems, should the value in the configuration space change. The range check of the `bar` field and the later call to `dm_pci_read_bar32()` is an example of where this could happen. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03virtio: pci: Check virtio capability is in boundsAndrew Scull
Ensure the virtio PCI capabilities are contained within the bounds of the device's configuration space. The expected size of the capability is passed when searching for the capability to enforce this check. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03virtio: pci: Check virtio common config sizeAndrew Scull
Check that the common config is at least as large as the struct it is expected to contain. Only then is it safe to cast the pointer and be safe from out-of-bounds accesses. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03virtio: pci: Bounds check notification writesAndrew Scull
Make sure virtio notifications are written within their allocated buffer. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03virtio: pci: Bounds check device config accessAndrew Scull
The device config is optional, so check it was present and mapped before trying to use the pointer. Bounds violations are an error, not just a warning, so bail if the checks fail. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03virtio: pci: Fix discovery of device config lengthAndrew Scull
The length of the device config was erroneously being taken from the notify capability. Correct this by finding the length in the device capability. Fixes: 550435edf810 ("virtio: pci: Support non-legacy PCI transport device") Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03virtio: pci: Allow exclusion of legacy driverAndrew Scull
Add a new config to control whether the driver for legacy virtio PCI devices is included in the build. VIRTIO_PCI_LEGACY is included by default when VIRTIO_PCI is selected, but it can also be independently toggled. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-03lib: fix selection of CONFIG_CHARSETHeinrich Schuchardt
lib/charset.c is not optional for EFI_APP || EFI_LOADER || UFS || UT_UNICODE. These must select CONFIG_CHARSET. Fixes: 726cd9836db0 ("efi: Make unicode printf available to the app") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-03sf: dataflash: add support for AT45DB641ELuca Ellero
NOTE: this chip uses "extened device information" Signed-off-by: Luca Ellero <l.ellero@asem.it> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2022-05-03sf: dataflash: add support for "extended ID"Luca Ellero
Take as reference Linux kernel code: drivers/mtd/devices/mtd_dataflash.c commit 1da8869a428317a6d3cd8d47184cf87feb34a98b Author: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Luca Ellero <luca.ellero@brickedbrain.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2022-05-03spi: npcm-fiu: add NPCM7xx FIU controller driverJim Liu
Add Nuvoton NPCM BMC Flash Interface Unit(FIU) SPI master controller driver using SPI-MEM interface. The FIU supports single, dual or quad communication interface. The FIU controller driver provides flash access in UMA(User Mode Access) mode by using an indirect address/data mechanism. the dts node is followed upstream kernel dts name. Signed-off-by: Jim Liu <JJLIU0@nuvoton.com> Signed-off-by: Stanley Chu <yschu@nuvoton.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com> [Jagan: fixed the Kconfig, Makefile order] Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
2022-05-03mtd: spi-nor-ids: add Macronix mx25u51245g flash entryTien Fong Chee
Add Macronix mx25u51245g flash entry, so this can be used on SoCFPGA devices. Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com> [Jagan: updated commit head] Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2022-05-03mtd: spi-nor-ids: Add Winbond W25Q128JW IDMarek Vasut
Add ID for Winbond W25Q128JW device. This is a 128 Mbit QSPI NOR. Tested on W25Q128JWPIM part. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Horatiu Vultur <horatiu.vultur@microchip.com> Cc: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> Cc: Stefan Roese <sr@denx.de> Cc: Vignesh R <vigneshr@ti.com> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2022-05-02Merge branch '2022-05-02-add-verifying-program-loader'Tom Rini
To quote the author: U-Boot provides a verified-boot feature based around FIT, but there is no standard way of implementing it for a board. At present the various required pieces must be built up separately, to produce a working implementation. In particular, there is no built-in support for selecting A/B boot or recovery mode. This series introduces VPL, a verified program loader phase for U-Boot. Its purpose is to run the verified-boot process and decide which SPL binary should be run. It is critical that this decision happens before SPL runs, since SPL sets up SDRAM and we need to be able to update the SDRAM-init code in the field. Adding VPL into the boot flow provides a standard place to implement verified boot. This series includes the phase itself, some useful Kconfig options and a sandbox_vpl build for sandbox. No verfied-boot support is provided in this series. Most of the patches in this series are fixes and improvements to docs and various Kconfig conditions for SPL.
2022-05-02vpl: Add Kconfig options for VPLSimon Glass
Add VPL versions of commonly used Kconfig options. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-05-02Introduce Verifying Program Loader (VPL)Simon Glass
Add support for VPL, a new phase of U-Boot. This runs after TPL. It is responsible for selecting which SPL binary to run, based on a verified-boot process. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-05-02net: marvell: mvgbe: Set PHY page 0 before phy_connectTony Dinh
For most Kirkwood boards, the PHY page is already set to page 0 (in register 22) before phy_connect is invoked. But some board like the Zyxel NSA310S (which uses the network chip MV88E1318S), the PHY page is not set to page 0. There seems to be some bad data remained in register 22 when the uclass MVGBE about to invoke phy_connect(). This patch enables the uclass MVGBE to always set the PHY page to 0 before phy_connect. For reference, please see this discussion: [RFC PATCH v2] arm: kirkwood: nsa310s: Use Marvell uclass mvgbe and PHY driver for DM Ethernet. https://lists.denx.de/pipermail/u-boot/2022-April/480946.html This patch has been tested with the following Kirkwood boards: NSA310S (88F6702, network chip MV88E1318S) Sheevaplug (88F6281, network chip MV88E1318) Pogo V4 (88F6192, network chip 88E1116R) GF Home(88F6281, network chip 88E1116R) Dreamplug (88F6281, network chip MV88E1318) Dell Kace M300 (88F6282, network chip MV88E1318) - out of tree u-boot Signed-off-by: Tony Dinh <mibodhi@gmail.com>
2022-04-29sound: Fix buffer overflow in square wave generationAndrew Scull
Data is written for each channel but is only tracked as having one channel written. This resulted in a buffer overflow and corruption of the allocator's metadata which caused further problems when the buffer was later freed. This could be observed with sandbox unit tests. Resolve the overflow by tracking the writes for each channel. Fixes: f987177db9 ("dm: sound: Use the correct number of channels for sound") Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-29usb: sandbox: Bounds check read from bufferAndrew Scull
The buffer is 512 bytes but read requests can be 800 bytes. Limit the request to the size of the buffer. Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Cc: Marek Vasut <marex@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-29usb: sandbox: Check for string end in copy_to_unicode()Andrew Scull
When copying the string in copy_to_unicode(), check for the null terminator in each position, not just at the start, to avoid reading beyond the end of the string. Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Cc: Marek Vasut <marex@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-29x86: sandbox: Add missing PCI bar to barinfoAndrew Scull
There are expecte to be bars 0 through 5, but the last of these was missing leading to an read beyond the buffer. Add the missing element with zero values. Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-28led: Drop led_default_state()Marek Vasut
This function is empty, drop it. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-28led: gpio: Use NOP uclass driver for top-level nodeMarek Vasut
The top level DT node of gpio-leds is not a LED itself, bind NOP uclass driver to it, and bind different LED uclass driver to its subnodes which represent the actual LEDs. This simplifies the probe() implementation and fixes the bogus top-level not-an-LED in 'led list' command output: ``` => led list led Error -121 <--- This is removed/fixed by this patch green:user0 off ``` Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-28led: gpio: Check device compatible string to determine the top level nodeMarek Vasut
Since 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing"), all LED nodes have some sort of label. Use device_is_compatible(..."leds-gpio") to determine whether this is a top-level node, since it is only the top level node which is compatible with "leds-gpio", the GPIO LEDs subnodes are not. Fixes: 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing") Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-28led: Mark device instance with DM_FLAG_PROBE_AFTER_BINDMarek Vasut
Calling device_probe() from uclass .post_bind() callback has all kinds of odd side-effects, e.g. device instances not being available just yet. Make use of the DM_FLAG_PROBE_AFTER_BIND instead, mark device instances which need to be probe()d in order to configure the LED default state with this flag and let the DM core do the device_probe() at the right time instead. Fixes: 72675b063b6 ("led: Configure LED default-state on boot") Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-28dm: core: Add DM_FLAG_PROBE_AFTER_BIND flagMarek Vasut
Introduce DM_FLAG_PROBE_AFTER_BIND flag, which can be set by driver or uclass in .bind(), to indicate such driver instance should be probe()d once binding of all devices is complete. This is useful in case the driver determines that hardware initialization is mandatory on boot, and such initialization happens only in probe(). This also solves the inability to call device_probe() from .bind(). Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-27Merge https://gitlab.denx.de/u-boot/custodians/u-boot-mpc85xxTom Rini
fsl-qoriq: Fixes and updates on fsl-layerscape mpc85xx: fixes and code cleanup
2022-04-27Merge tag 'u-boot-amlogic-20220427' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-amlogic - Add AXG support for SARADC, including minimal ao-clk driver - Update Amlogic documentation for Matrix & Jethub D1