summaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)Author
2023-11-16spl: Only support bl_len when we have toSean Anderson
Aligning addresses and sizes causes overhead which is unnecessary when we are not loading from block devices. Remove bl_len when it is not needed. For example, on iot2050 we save 144 bytes with this patch (once the rest of this series is applied): add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-144 (-144) Function old new delta spl_load_simple_fit 920 904 -16 load_simple_fit 496 444 -52 spl_spi_load_image 384 308 -76 Total: Before=87431, After=87287, chg -0.16% We use panic() instead of BUILD_BUG_ON in spl_set_bl_len because we still need to be able to compile it for things like mmc_load_image_raw_sector, even if that function will not be used. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-16spl: Remove dev from spl_load_infoSean Anderson
dev and priv serve the same purpose, and are never set at the same time. Remove dev and convert all users to priv. While we're at it, reorder bl_len to be last for better alignment. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-16Merge patch series "nand: Add sandbox tests"Tom Rini
To quote the author: This series tests raw nand flash in sandbox and fixes various bugs discovered in the process. I've tried to do things in a contemporary manner, avoiding the (numerous) variations present on only a few boards. The test is pretty minimal. Future work could test the rest of the nand API as well as the MTD API. Bloat (for v1) at [1] (for boards with SPL_NAND_SUPPORT enabled). Almost everything grows by a few bytes due to nand_page_size. A few boards grow more, mostly those using nand_spl_loaders.c. CI at [2]. [1] https://gist.github.com/Forty-Bot/9694f3401893c9e706ccc374922de6c2 [2] https://source.denx.de/u-boot/custodians/u-boot-clk/-/pipelines/18443
2023-11-16test: spl: Add a test for NANDSean Anderson
Add a SPL test for the NAND load method. We use some different functions to do the writing from the main test since things like nand_write_skip_bad aren't available in SPL. We disable BBT scanning, since scan_bbt is only populated when not in SPL. We use nand_spl_loaders.c as it seems to be common to at least a few boards already. However, we do not use nand_spl_simple.c because it would require us to implement cmd_ctrl. The various nand load functions are adapted from omap_gpmc. However, they have been modified for simplicity/correctness. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-11-16nand: Add sandbox driverSean Anderson
Add a sandbox NAND flash driver to facilitate testing. This driver supports any number of devices, each using a single chip-select. The OOB data is stored in-band, with the separation enforced through the API. For now, create two devices to test with. The first is a very small device with basic ECC. The second is an 8G device (chosen to be larger than 32 bits). It uses ONFI, with the values copied from the datasheet. It also doesn't need too strong ECC, which speeds things up. Although the nand subsystem determines the parameters of a chip based on the ID, the driver itself requires devicetree properties for each parameter. We do not derive parameters from the ID because parsing the ID is non-trivial. We do not just use the parameters that the nand subsystem has calculated since that is something we should be testing. An exception is made for the ECC layout, since that is difficult to encode in the device tree and is not a property of the device itself. Despite using file I/O to access the backing data, we do not support using external files. In my experience, these are unnecessary for testing since tests can generally be written to write their expected data beforehand. Additionally, we would need to store the "programmed" information somewhere (complicating the format and the programming process) or try to detect whether block are erased at runtime (degrading probe speeds). Information about whether each page has been programmed is stored in an in-memory buffer. To simplify the implementation, we only support a single program per erase. While this is accurate for many larger flashes, some smaller flashes (512 byte) support multiple programs and/or subpage programs. Support for this could be added later as I believe some filesystems expect this. To test ECC, we support error-injection. Surprisingly, only ECC bytes in the OOB area are protected, even though all bytes are equally susceptible to error. Because of this, we take care to only corrupt ECC bytes. Similarly, because ECC covers "steps" and not the whole page, we must take care to corrupt data in the same way. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-11-16nand: Allow reinitializationSean Anderson
NAND devices are destroyed in between unit tests. Provide a function to reinitialize the subsystem at the beginning of each test. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2023-11-16nand: Add function to unregister NAND devicesSean Anderson
This performs the opposite of nand_register, allowing drivers to unregister nand devices. This is probably unnecessary for most regular drivers, but we expect sandbox drivers to get repeatedly bound/unbound, so this will help avoid dangling pointers. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2023-11-16mtd: Add some fallbacks for add/del_mtd_deviceSean Anderson
This allows using these functions without ifdefs. OneNAND depends on MTD, so this ifdef was redundant in the first place. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
2023-11-16mtd: Rename SPL_MTD_SUPPORT to SPL_MTDSean Anderson
Rename SPL_MTD_SUPPORT to SPL_MTD in order to match MTD. This allows using CONFIG_IS_ENABLED to test for MTD support. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-11-16spl: nand: Set bl_len to page sizeSean Anderson
Since commit 34793598c83 ("mtd: nand: mxs_nand_spl: Remove the page aligned access") there are no longer any users of nand_get_mtd. However, it is still important to know what the page size is so we can allocate a large-enough buffer. If the image size is not page-aligned, we will go off the end of the buffer and clobber some memory. Introduce a new function nand_page_size which returns the page size. For most drivers it is easy to determine the page size. However, a few need to be modified since they only keep the page size around temporarily. It's possible that this patch could cause a regression on some platforms if the offset is non-aligned and there is invalid address space immediately before the load address. spl_load_legacy_img does not (except when compressing) respect bl_len, so only boards with SPL_LOAD_FIT (8 boards) or SPL_LOAD_IMX_CONTAINER (none in tree) would be affected. defconfig CONFIG_TEXT_BASE ======================= ================ am335x_evm 0x80800000 am43xx_evm 0x80800000 am43xx_evm_rtconly 0x80800000 am43xx_evm_usbhost_boot 0x80800000 am43xx_hs_evm 0x80800000 dra7xx_evm 0x80800000 gwventana_nand 0x17800000 imx8mn_bsh_smm_s2 0x40200000 All the sitara boards have DDR mapped at 0x80000000. gwventana is an i.MX6Q which has DDR at 0x10000000. I don't have the IMX8MNRM handy, but on the i.MX8M DDR starts at 0x40000000. Therefore all of these boards can handle a little underflow. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-11-16nand: spl_loaders: Only read enough pages to load the imageSean Anderson
All other implementations of nand_spl_load_image only read as many pages as are necessary to load the image. However, nand_spl_loaders.c loads the full block. Align it with other load functions so that it is easier to determine how large of a load buffer we need. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
2023-11-16nand: Calculate SYS_NAND_BLOCK_PAGES (neé SYS_NAND_PAGE_COUNT) automaticallySean Anderson
Contrary to what the help message says, this is the number of pages per block. Calculate it automatically based on SYS_NAND_BLOCK_SIZE and SYS_NAND_PAGE_SIZE. To better reflect its semantics, rename it to SYS_NAND_BLOCK_PAGES. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2023-11-16nand: Don't dereference NULL manufacturer_descSean Anderson
When no manufacturer is matched, manufacturer_desc is NULL. Avoid dereferencing it in that case. Fixes: 4e67c571252 ("mtd,ubi,ubifs: sync with linux v3.15") Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
2023-11-13pinctrl: pinctrl_stm32: Add stm32mp2 supportPatrice Chotard
Add stm32mp2 compatible. Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-11-13serial: stm32: Fix AARCH64 compilation warningsPatrice Chotard
When building with AARCH64 defconfig, we got warnings, fix them by using registers base address defined as void __iomem * instead of fdt_addr_t. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2023-11-07scsi: Forceably finish migration to DM_SCSITom Rini
The migration deadline for moving to DM_SCSI was v2023.04. A further reminder was sent out in August 2023 to the remaining platforms that had not migrated already, and that a few more over the line (or configs deleted). With this commit we: - Rename CONFIG_DM_SCSI to CONFIG_SCSI. - Remove all of the non-DM SCSI code. This includes removing other legacy symbols and code and removes some legacy non-DM AHCI code. - Some platforms that had previously been DM_SCSI=y && SCSI=n are now fully migrated to DM_SCSI as a few corner cases in the code assumed DM_SCSI=y meant SCSI=y. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-07qe: Add <asm/ppc.h> on PowerPCTom Rini
This driver needs <asm/ppc.h> when building on PowerPC, add it. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-07spi: Add <errno.h> to spi-mem-nodm.cTom Rini
This file uses errno return values in functions, so include <errno.h> here rather than rely on indirect inclusion. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-07fsl_qe: Drop common.hTom Rini
In both include/fsl_qe.h and then also remove common.h from the files which had included fsl_qe.h Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-07m68k: Remove CONFIG_FSLDMAFECTom Rini
There are no platforms which enable this feature, so remove it. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-07clk_k210.c: Clean up how we handle nopTom Rini
Now that sandbox has <asm/barrier.h> and defines nop() there we should include that in our driver for clarity and then remove our local nop() from <k210/pll.h>. Reviewed-by: Sean Anderson <seanga2@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-07block: rkmtd: select CONFIG_RANDOM_UUID explicitlyAKASHI Takahiro
This option is necessary to compile any way. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2023-11-07fastboot: Depend on CMDLINETom Rini
Much of the functionality of fastboot relies on being able to run commands as defined in the environment. This means it does depend on CMDLINE being enabled. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-07video: Don't require the font commandSimon Glass
While it is nice to have the font command, using 'select' makes it impossible to build the console code without it. Stop using 'select' and make it default if CONSOLE_TRUETYPE is enabled when asking the command. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-07dfu: Make DFU_TFTP depend on NETDEVICESTom Rini
In order to do a DFU update over TFTP we need to have some network device available, so make this depend on NETDEVICES Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-07virtio: Make VIRTIO_NET depend on NETDEVICESTom Rini
As VIRTIO_NET is the symbol for enabling network devices, make this depend on NETDEVICES Signed-off-by: Tom Rini <trini@konsulko.com>
2023-11-06Merge tag 'u-boot-amlogic-20231106' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-amlogic - fixup to also enabled DFU RAM boot for libretech-ac - sm fix to bind child sm devices in the device tree - add missing A1 clocks for USB stack
2023-11-06drivers: sm: bind child sm devices in the device treeDmitry Rokosov
One well-known sm child device that provides secure power control is the Secure Power Controller. This device utilizes SMC calls to communicate with power domains on the secure monitor side. Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com> Signed-off-by: Alexey Romanov <avromanov@salutedevices.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20231101140500.9025-3-avromanov@salutedevices.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-11-06clk: a1: add new clocks for USB stackAlexey Romanov
Since we sync device tree with Linux, we have to add this clock definition for USB stack. Signed-off-by: Alexey Romanov <avromanov@salutedevices.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20231101140500.9025-2-avromanov@salutedevices.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-11-05net: designware: add DMA offset awarenessBaruch Siach
Older DesignWare Ethernet MAC versions that this driver supports can only work with 32-bit DMA source/destination addresses. Some platforms have no physical RAM at the lowest 4GB address space. For these platforms the driver must translate DMA addresses to/from physical memory addresses. Call translation routines so that properly configured platforms can use the DesignWare Ethernet MAC. For platforms using device-tree this usually means adding dma-ranges property to the bus the device node is in. Signed-off-by: Baruch Siach <baruch@tkos.co.il>
2023-11-05net: e1000: Drop e1000_eth_ids[]Bin Meng
e1000_eth_ids holds compatible strings for e1000 devices, but it is meaningless as e1000 is a PCI device and there is no such compatible string assigned to e1000 by the DT bindings community. Drop it. Signed-off-by: Bin Meng <bmeng@tinylab.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-05net: phy: TI DP83869 fix invalid clock delay configurationFrank de Brabander
Setting the clock delay from the device tree settings rx-internal-delay-ps and tx-internal-delay-ps was broken: - The expected value in the device tree is suppose to be a delay in picoseconds, but the driver only allowed an array index. - Driver converted this array index to the actual delay in picoseconds and tried to apply this in the device register. This however is not a valid register value. The actual logic here was reversed, it converted an register representation of the delay to the device tree delay in picoseconds. Only when the internal delays were NOT configured in the device tree and they default value of 7 (=2000ps) was used, a valid value was loaded in the register. Signed-off-by: Frank de Brabander <debrabander@gmail.com>
2023-11-05net: add hifemac_mdio MDIO bus driver for HiSilicon platformYang Xiwen
It adds the driver for the internal MDIO bus of HIFEMAC Ethernet controller. It's based on the mainstream linux driver. Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
2023-11-05net: add hifemac Ethernet driver for HiSilicon platformYang Xiwen
It adds the driver for HIFEMAC Ethernet controller found on HiSilicon SoCs like Hi3798MV200. It's based on the mainstream linux driver, but quite a lot of code gets rewritten and cleaned up to adopt u-boot driver model. Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
2023-11-05net: mv88e6xxx: add Clause 45 supportRobert Marko
Marvell LinkStreet switches support Clause 45 MDIO on the internal bus. C45 read or writes require the register address to be written first to the SMI PHY Data register, and then a special C45 Write Address Register OP is used on the SMI PHY Register before making a C45 Read Data Register OP and being able to actually read the register. Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2023-11-05net: mv88e6xxx: use generic bitfield macros for MDIORobert Marko
Driver is currently defining the mask and bit shifting itself, there is no need for that as U-Boot has generic bitfield macros that help us achieve the same result but in a cleaner way. Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2023-11-05net: ftgmac100: Add reset controlDylan Hung
Add optional reset control, especially for the Aspeed SOC. For the hardware without a reset line, the reset assertion/deassertion will be skipped. Signed-off-by: Dylan Hung <dylan_hung@aspeedtech.com> Reviewed-by: Ryan Chen <ryan_chen@aspeedtech.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2023-11-05net: dw_eth_qos: Add 64-bit addressingLey Foon Tan
Set upper 32bit address for DMA descriptors and buffer address to support 64-bit addressing. Signed-off-by: Ley Foon Tan <leyfoon.tan@starfivetech.com>
2023-11-03sysreset: implement PALMAS sysreset functionsSvyatoslav Ryhel
PALMAS PMIC family has embedded poweroff function used by some device to initiane device power off. Implement it as sysreset driver. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03sysreset: implement TPS65910 sysreset functionsSvyatoslav Ryhel
TPS65910/TPS65911 PMICs have embedded power control functions used by some device to initiane device power off. Implement it as sysreset driver. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03sysreset: implement TPS80031 sysreset functionsSvyatoslav Ryhel
TPS80031/TPS80032 PMICs have embedded power control functions used by some device to initiane device power off. Implement it as sysreset driver. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03sysreset: implement MAX77663 sysreset functionsSvyatoslav Ryhel
MAX77663 PMIC has embedded poweroff function used by some device to initiane device power off. Implement it as sysreset driver. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03sysreset: tegra: create arch specific sysreset driverSvyatoslav Ryhel
Tegra uses built in Power Management Controller (PMC) to perform CPU reset. Code to perform this was located in mach-tegra, so lest create DM driver to handle this. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
2023-11-03power: regulator: tps65911: add regulator supportSvyatoslav Ryhel
The driver provides regulator set/get voltage enable/disable functions for TI TPS5911 PMIC. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-03power: pmic: tps65910: add TPS65911 PMIC supportSvyatoslav Ryhel
Add support to bind the regulators/child nodes with the pmic. Also adds the pmic i2c based read/write functions to access pmic registers. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-03power: regulator: tps80031: add regulator supportSvyatoslav Ryhel
The driver provides regulator set/get voltage enable/disable functions for TI TPS80031/TPS80032 PMICs. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-03power: pmic: add the base TPS80031 PMIC supportSvyatoslav Ryhel
Add support to bind the regulators/child nodes with the pmic. Also adds the pmic i2c based read/write functions to access pmic registers. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-03power: regulator: max77663: add regulator supportSvyatoslav Ryhel
The driver provides regulator set/get voltage enable/disable functions for MAXIM MAX77663 PMICs. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-11-03power: pmic: add the base MAX77663 PMIC supportSvyatoslav Ryhel
Add support to bind the regulators/child nodes with the pmic. Also adds the pmic i2c based read/write functions to access pmic registers. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
2023-11-03power: regulator: palmas: fix ldoln and ldousb detectionSvyatoslav Ryhel
dev->driver_data will carry the tail of ldo if there is a number and if there is no number it will be an error code, anyway it will not be zero. This results in a wrong ldo regulator detection. To avoid this check for non-numerical ldo first and then manipulate dev->driver_data. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>