aboutsummaryrefslogtreecommitdiff
path: root/include/dm
AgeCommit message (Collapse)AuthorFilesLines
2022-08-12dm: core: Introduce support for multiple treesSimon Glass3-2/+49
At present ofnode only works with a single device tree, for the most part. This is the control FDT used by U-Boot. When booting an OS we may obtain a different device tree and want to modify it. Add some initial support for this into the ofnode API. Note that we don't permit aliases in this other device tree, since the of_access implementation maintains a list of aliases collected at start-up. Also, we don't need aliases to do fixups in the other FDT. So make sure that flat tree and live tree processing are consistent in this area. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Add a note about how livetree updates workSimon Glass1-1/+2
The unflattening algorithm results in a single block of memory being allocated for the whole tree. When writing new properties, these are allocated new memory outside that block. When the block is freed, the allocated properties remain. Document how this works and the potential memory leak, as well as mentioning that updating the livetree is actually supported now. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12dm: core: Split out the declaration of ofnodeSimon Glass2-60/+73
This is used by a lot of files, but ofnode.h needs to include a lot of header files. This can create dependency cycles, particularly with global_data.h which must include various declarations. Split the core delcarations into a separate file to fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-07-28pinctrl: Add third argument label for pinctrl_gpio_request() functionPali Rohár1-1/+2
This change allows to use pinctrl_gpio_request() function as a direct pointer for dm_gpio_ops's .request callback. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-07-28pinctrl: Add new function pinctrl_generic_set_state_prefix()Pali Rohár1-0/+2
This new function pinctrl_generic_set_state_prefix() behaves like pinctrl_generic_set_state() but it takes third string argument which is used as the prefix for each device tree string property. This is needed for Marvell pinctrl drivers, becase Linux device tree files have pinmux properties prefixed by "marvell," string. This change allows to use generic U-Boot pinctrl functions for Armada 38x pinctrl driver without need to copy+paste of the majority U-Boot pinctrl code. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-07-08Merge tag 'dm-pull-28jun22' of ↵Tom Rini6-26/+160
https://source.denx.de/u-boot/custodians/u-boot-dm into next nman external-symbol improvements Driver model memory-usage reporting patman test-reporting improvements Add bloblist design goals
2022-07-07arm: Remove PXA architecture supportTom Rini2-62/+0
With the last platform for this architecture removed, remove the rest of the architecture support as well. Cc: Marek Vasut <marex@denx.de> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-06-28dm: core: Add a command to show driver model statisticsSimon Glass3-1/+18
This command shows the memory used by driver model along with various hints as to what it might be if some 'core' tags were moved to use the tag list instead of a core (i.e. always-there) pointer. This may help with future work to reduce memory usage. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28dm: core: Add a way to collect memory usageSimon Glass2-0/+56
Add a function for collecting the amount of memory used by driver model, including devices, uclasses and attached data and tags. This information can provide insights into how to reduce the memory required by driver model. Future work may look at execution speed also. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28dm: core: Support accessing core tagsSimon Glass2-1/+37
At present tag numbers are only allocated for non-core data, meaning that the 'core' data, like priv and plat, are accessed through dedicated functions. For debugging and consistency it is convenient to use tags for this 'core' data too. Add support for this, with new tag numbers and functions to access the pointer and size for each. Update one of the test drivers so that the uclass-private data can be tested here. There is some code duplication with functions like device_alloc_priv() but this is not addressed for now. At some point, some rationalisation may help to reduce code size, but more thought it needed on that. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28dm: core: Switch the testbus driver to use a new structSimon Glass1-0/+7
At present this driver uses 'priv' struct to hold 'plat' data, which is confusing. The contents of the strct don't matter, since only dtoc is using it. Create a new struct with the correct name. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28dm: core: Rename dm_dump_all()Simon Glass1-1/+1
This is not a good name anymore as it does not dump everything. Rename it to dm_dump_tree() to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28dm: core: Provide fallbacks for ofnode_conf_read_...Sean Anderson1-24/+42
Because fdt_get_config_str et al. were moved/renamed to ofnode_conf_read_str, they now depend on CONFIG_DM as well as CONFIG_OF_CONTROL. Add some fallback implementations, preventing a linker error when CONFIG_SPL_OF_CONTROL and CONFIG_SPL_ENV_IS_IN_MMC are enabled and CONFIG_SPL_DM is disabled. Fixes: 7de8bd03c3 ("treewide: fdt: Move fdt_get_config_... to ofnode_conf_read...") Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2022-06-23fuzzing_engine: Add fuzzing engine uclassAndrew Scull1-0/+1
This new class of device will provide fuzzing inputs from a fuzzing engine. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-06-06arm: pxa: Remove CONFIG_CPU_PXA25XTom Rini1-15/+0
There are no platforms that set this, remove the code. Signed-off-by: Tom Rini <trini@konsulko.com>
2022-04-28dm: core: Add DM_FLAG_PROBE_AFTER_BIND flagMarek Vasut1-0/+3
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-25Merge branch '2022-04-25-initial-implementation-of-stdboot'Tom Rini4-4/+23
To quote the author: The bootflow feature provide a built-in way for U-Boot to automatically boot an Operating System without custom scripting and other customisation. This is called 'standard boot' since it provides a standard way for U-Boot to boot a distro, without scripting. It introduces the following concepts: - bootdev - a device which can hold a distro - bootmeth - a method to scan a bootdev to find bootflows (owned by U-Boot) - bootflow - a description of how to boot (owned by the distro) This series provides an implementation of these, enabled to scan for bootflows from MMC, USB and Ethernet. It supports the existing distro boot as well as the EFI loader flow (bootefi/bootmgr). It works similiarly to the existing script-based approach, but is native to U-Boot. With this we can boot on a Raspberry Pi 3 with just one command: bootflow scan -lb which means to scan, listing (-l) each bootflow and trying to boot each one (-b). The final patch shows this. With a standard way to identify boot devices, booting become easier. It also should be possible to support U-Boot scripts, for backwards compatibility only. ... The design is described in these two documents: https://drive.google.com/file/d/1ggW0KJpUOR__vBkj3l61L2dav4ZkNC12/view?usp=sharing https://drive.google.com/file/d/1kTrflO9vvGlKp-ZH_jlgb9TY3WYG6FF9/view?usp=sharing
2022-04-25bootstd: Add the bootmeth uclass and helpersSimon Glass1-0/+1
A bootmeth is a method of locating an operating system. For now, just add the uclass itself. Drivers for particular bootmeths are added later. If no bootmeths devices are included in the devicetree, create them automatically. This avoids the need for boilerplate in the devicetree files. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the bootdev uclassSimon Glass1-0/+1
A 'bootdev' is a device which can be used to boot an operating system. It is a child of the media device (e.g. MMC) which handles reading files from that device, such as a bootflow file. Add a uclass for bootdev and the various helpers needed to make it work. Also add a binding file, empty for now. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add the bootstd uclass and core implementationSimon Glass1-0/+1
The 'bootstd' device provides the central information about U-Boot standard boot. Add a uclass for bootstd and the various helpers needed to make it work. Also add a binding file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Allow finding a uclass device by partial nameSimon Glass2-1/+17
In some cases two devices are related and the only way to tell is to check that the names partially patch. Add a way to check this without needing to create a new string for the comparison. Fix the comment for device_find_child_by_namelen() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25dm: core: Rename and fix uclass_get_by_name_len()Simon Glass1-3/+3
It seems that namelen is more common in U-Boot. Rename this function to fit in better. Also fix a bug where it breaks the operation of uclass_get_by_name() and add a test. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reported-by: Tim Harvey <tharvey@gateworks.com>
2022-04-23dm: disk: add UCLASS_PARTITIONAKASHI Takahiro1-0/+1
NOTE: probably we have to update config dependencies, in particular, SPL/TPL_PRINTF? With this new function, UCLASS_PARTITION devices will be created as child nodes of UCLASS_BLK device. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2022-04-18dm: core: Deal with a wrinkle with linker listsWIP/2022-04-18-dm-reducing-spl-memory-usageSimon Glass1-0/+8
When every member of a linker list is aligned by the compiler, we can no longer rely on the sizeof of the struct to determine the number of entries. For example, if the struct size is 0x90 but every entry is aligned to 0xa0 by the compiler, the linker list entries takes more space in memory and the calculation of the number of entries is incorrect. For example, we may see 0x12 entries when there are only 0x11. This is a real problem. There may be a general solution, although I cannot currently think of one. So far it only bites with OF_PLATDATA_RT which creates a pointer to each entry of the 'struct udevice' linker_list. This does not happen without that option, so it only affects SPL. Work around it by manually calculating the aligned size of struct udevice, then using that for the n_ent calculation. Note: the alignment fix to linker list was here: 0b2fa98aa5e linker_lists: Fix alignment issue Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-18dm: core: Allow devres to be disabled in SPLSimon Glass3-6/+6
At present if devres is enabled in U-Boot proper it is enabled in SPL. We don't normally want it there, so disable it. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Angus Ainslie <angus@akkea.ca>
2022-04-15Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-netTom Rini2-0/+63
- DM9000 DM support - tftp server bug fix - mdio ofnode support functions - Various phy fixes and improvements. [trini: Fixup merge conflicts in drivers/net/phy/ethernet_id.c drivers/net/phy/phy.c include/phy.h]
2022-04-10treewide: Rename PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NAMarek Behún2-2/+2
Rename constant PHY_INTERFACE_MODE_NONE to PHY_INTERFACE_MODE_NA to make it compatible with Linux' naming. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
2022-04-10net: introduce helpers to get PHY interface mode from a device/ofnodeMarek Behún2-0/+30
Add helpers ofnode_read_phy_mode() and dev_read_phy_mode() to parse the "phy-mode" / "phy-connection-type" property. Add corresponding UT test. Use them treewide. This allows us to inline the phy_get_interface_by_name() into ofnode_read_phy_mode(), since the former is not used anymore. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-10net: introduce helpers to get PHY ofnode from MACMarek Behún2-0/+33
Add helpers ofnode_get_phy_node() and dev_get_phy_node() and use it in net/mdio-uclass.c function dm_eth_connect_phy_handle(). Also add corresponding UT test. This is useful because other part's of U-Boot may want to get PHY ofnode without connecting a PHY. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-09dm: add tag supportAKASHI Takahiro1-0/+110
With dm-tag feature, any U-Boot subsystem is allowed to associate arbitrary number of data with a particular udevice. This can been see as expanding "struct udevice" without modifying the definition. As a first user, UEFI subsystem makes use of tags to associate an efi_disk object with a block device. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-06dm: core: Tidy up comments in uclass headersSimon Glass2-16/+15
Improve some of the comments in these files, which don't follow the correct style. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-06dm: core: Add a required struct declarationSimon Glass1-0/+1
This file uses struct driver, so declare it at the top in case the header-inclusion order is not as expected. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-06dm: fix function documentation in include/dm/ofnode.hWIP/2022-04-06-assorted-updatesHeinrich Schuchardt1-4/+4
We use Sphinx style comments to describe functions. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-03-16Merge tag 'xilinx-for-v2022.07-rc1' of ↵WIP/16Mar2022-nextTom Rini2-25/+38
https://source.denx.de/u-boot/custodians/u-boot-microblaze into next Xilinx changes for v2022.07-rc1 microblaze: - Add support for reserved memory xilinx: - Update FRU code with MAC reading zynqmp: - Remove double AMS setting - DT updates (mostly for SOMs) - Add support for zcu106 rev 1.0 zynq: - Update nand binding nand: - Aligned zynq_nand to upstream DT binding net: - Add support for ethernet-phy-id mmc: - Workaround CD in zynq_sdhci driver also for ZynqMP - Add support for dynamic/run-time SD config for SOMs gpio: - Add driver for slg7xl45106 firmware: - Add support for dynamic SD config power-domain: - Update zynqmp driver with the latest firmware video: - Add skeleton driver for DP and DPDMA i2c: - Fix i2c to work with QEMU pinctrl: - Add driver for zynqmp pinctrl driver
2022-03-14pinctrl: Increase length of pinmux status bufferAshok Reddy Soma1-1/+1
Xilinx ZynqMP SOC can set 6 parameters for its pins. pinmux status command will print the status of these parameters for each pin. But current print buffer length is only 40 characters long, increase it to 80 to print all the parameters. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Link: https://lore.kernel.org/r/3a6be84c8354f38754a9838670cc0319e84f29e8.1645626183.git.michal.simek@xilinx.com
2022-03-10event: Add events for device probe/removeSimon Glass1-0/+10
Generate events when devices are probed or removed, allowing hooks to be added for these situations. This is controlled by the DM_EVENT config option. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-09net: phy: Add new read ethernet phy id functionMichal Simek1-0/+13
Add new function to get ethernet phy id from compatible property of the mdio phy node. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com> Link: https://lore.kernel.org/r/16019efb3820a50330935fdaae191cec1f101b5c.1645627539.git.michal.simek@xilinx.com
2022-03-07dm: pinctrl: Use explicit values for enumsAshok Reddy Soma1-24/+24
Based on discussion at https://lore.kernel.org/r/20200318125003.GA2727094@kroah.com we got recommendation to use explicit values for all enums. So, add explicit values to all pinctrl related enums for readability. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org> Link: https://lore.kernel.org/r/dcdb20e7252ea7465e9f984d815e9624c30e9558.1645624969.git.michal.simek@xilinx.com
2022-02-09dm: Use parenthesis for the device_get_ops macro argumentSughosh Ganu1-1/+1
Use parenthesis for the device_get_ops macro argument. This prevents errors when using an expression for the parameter. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-01-25acpi: Collect tables in the acpi_item listSimon Glass1-0/+14
At present this list is used to collect items within the DSDT and SSDT tables. It is useful for it to collect the whole tables as well, so there is a list of what was created and which write created each one. Refactor the code accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25x86: Move DSDT table to a writer functionSimon Glass1-0/+2
Move this table over to use a writer function, moving the code from the x86 implementation. Add a pointer to the DSDT in struct acpi_ctx so we can reference it later. Disable this table for sandbox since we don't actually compile real ASL code. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25x86: Move FACS table to a writer functionSimon Glass1-0/+2
Move this table over to use a writer function, moving the code from the x86 implementation. Add a pointer to the DSDT in struct acpi_ctx so we can reference it later. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25x86: Move base tables to a writer functionSimon Glass1-2/+21
Use the new ACPI writer to write the base tables at the start of the area, moving this code from the x86 implementation. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25x86: acpi: Split out context creation from base tablesSimon Glass1-0/+12
At present acpi_setup_base_tables() both sets up the ACPI context and writes out the base tables. We want to use an ACPI writer to write the base tables, so split this function into two, with acpi_setup_ctx() doing the context set, and acpi_setup_base_tables() just doing the base tables. Disable the writer's write_acpi_tables() function for now, to avoid build errors. It is enabled in a following patch. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25acpi: Add a linker list for ACPI tablesSimon Glass1-0/+57
At present we call lots of functions to generate the required ACPI tables. It would be better to standardise these functions and allow them to be automatically collected and used when needed. Add a linker list to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25acpi: Add a table startSimon Glass1-0/+4
It is useful to record the start of an ACPI table so that offsets from that point can be easily calculated. Add this to the context and set it before calling the writer method. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt6-37/+37
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-15doc: add include/dm/fdtaddr.h to the HTML documentationPatrick Delaunay1-13/+12
Correct Sphinx style comments in include/dm/fdtaddr.h and add the devfdt API to the HTML documentation; these functions are NOT compatible with live tree. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-15doc: add include/dm/of*.h to the HTML documentationPatrick Delaunay5-275/+288
Correct Sphinx style comments in include/dm/ofnode.h and add the device tree node API to the HTML documentation; the ofnode functions are compatible with Live tree or with flat device tree. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-15doc: add include/dm/read.h to the HTML documentationPatrick Delaunay1-80/+81
Correct Sphinx style comments in include/dm/read.h and add the device read from device tree API to the HTML documentation. Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>