summaryrefslogtreecommitdiffstats
path: root/include/dm
Commit message (Collapse)AuthorAgeFilesLines
* dm: core: add function uclass_probe_all() to probe all devicesVabhav Sharma2021-01-161-0/+11
| | | | | | | | | | | | | | | | | | | | Support a common method to probe all devices associated with uclass. This includes data structures and code for finding the first device and looping for remaining devices associated with uclasses (groups of devices with the same purpose, e.g. all SERIAL ports will be in the same uclass). An example is SBSA compliant PL011 UART IP, where firmware does the serial port initialization and prepare uart device to let the kernel use it for sending and reveiving the characters.SERIAL uclass will use this function to initialize PL011 UART ports. The feature is enabled with CONFIG_DM. Signed-off-by: Vabhav Sharma <vabhav.sharma@nxp.com> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com>
* dm: core: add a function to decode display timingsDario Binacchi2021-01-121-0/+24
| | | | | | | | The patch adds a function to get display timings from the device tree node attached to the device. Signed-off-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Simon Glass <sjg@chromium.org>
* dtoc: Drop dm_populate_phandle_data()Simon Glass2021-01-051-8/+0
| | | | | | | | | | | | | This has not been needed since parent information was added and we started using indicies for references to other drivers instead of pointers. It was kept around in the expectation that it might be needed later. However with the latest updates, it doesn't seem likely that we'll need this in the foreseeable future. Drop dm_populate_phandle_data() from dtoc and driver model. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Rename dt-platdata.c to dt-plat.cSimon Glass2021-01-051-1/+1
| | | | | | | Use this new name to be consistent with the rest of U-Boot, which talks about 'plat' for the platform data, which is what this file holds. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Rename U_BOOT_DRIVER_ALIAS to DM_DRIVER_ALIASSimon Glass2021-01-051-1/+1
| | | | | | | | | | | | | We use the U_BOOT_ prefix (i.e. U_BOOT_DRIVER) to declare a driver but in every other case we just use DM_. Update the alias macros to use the DM_ prefix. We could perhaps rename U_BOOT_DRIVER() to DM_DRIVER(), but this macro is widely used and there is at least some benefit to indicating it us a U-Boot driver, particularly for code ported from Linux. So for now, let's keep that name. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Rename DM_GET_DRIVER() to DM_DRIVER_GET()Simon Glass2021-01-052-2/+2
| | | | | | | | In the spirit of using the same base name for all of these related macros, rename this to have the operation at the end. This is not widely used so the impact is fairly small. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Rename DM_GET_DEVICE() to DM_DRVINFO_GET()Simon Glass2021-01-051-7/+3
| | | | | | | | | | | This does not get a device (struct udevice *) but a struct driver_info * so the name is confusing. Rename it accordingly. Since we plan to have several various of these macros, put GET at the end instead of the middle, so it is easier to spot the related macros. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Rename U_BOOT_DEVICE() to U_BOOT_DRVINFO()Simon Glass2021-01-054-12/+12
| | | | | | | | | | | | | | | | | | | | The current macro is a misnomer since it does not declare a device directly. Instead, it declares driver_info record which U-Boot uses at runtime to create a device. The distinction seems somewhat minor most of the time, but is becomes quite confusing when we actually want to declare a device, with of-platdata. We are left trying to distinguish between a device which isn't actually device, and a device that is (perhaps an 'instance'?) It seems better to rename this macro to describe what it actually is. The macros is not widely used, since boards should use devicetree to declare devices. Rename it to U_BOOT_DRVINFO(), which indicates clearly that this is declaring a new driver_info record, not a device. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Allow the uclass list to moveSimon Glass2021-01-051-0/+1
| | | | | | | | | | | At present the uclass list head is in global_data. This is convenient but with the new of-platdata we need the list head to be declared by the generated code. Change this over to be a pointer. Provide a 'static' version in global_data to retain the current behaviour. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Rename device node to indicate it is privateSimon Glass2021-01-051-4/+7
| | | | | | | | To avoid having people accidentally access this member, add a trailing underscore. Also remove it when of-platdata is enabled, since it is not used. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Access device ofnode through functionsSimon Glass2021-01-052-3/+22
| | | | | | | | At present ofnode is present in the device even if it is never used. With of-platdata this field is not used, so can be removed. In preparation for this, change the access to go through inline functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Use dev_has_ofnode() instead of dev_of_valid()Simon Glass2021-01-052-17/+12
| | | | | | | | | | | We have two functions which do the same thing. Standardise on dev_has_ofnode() since there is no such thing as an 'invalid' ofnode in normal operation: it is either null or missing. Also move the functions into one place. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* dm: core: Rename dev_has_of_node() to dev_has_ofnode()Simon Glass2021-01-051-1/+1
| | | | | | | We use 'ofnode' rather than 'of_node' in U-Boot. Rename this function to fit. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Rename device flags to indicate it is privateSimon Glass2021-01-051-8/+9
| | | | | | | To avoid having people accidentally access this member, add a trailing underscore. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Access device flags through functionsSimon Glass2021-01-051-0/+15
| | | | | | | At present flags are stored as part of the device. In preparation for storing them separately, change the access to go through inline functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Rename sqq to seq_Simon Glass2021-01-051-4/+5
| | | | | | | | | Now that the sequence-numbering migration is complete, rename this member back to seq_, adding an underscore to indicate it is internal to driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
* dm: core: Move priv/plat structs for simple_bus to headersSimon Glass2021-01-051-0/+15
| | | | | | | With the new of-platdata, these need to be available to dt_platdata.c so must be in header files. Move them. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Move some test drivers into their own fileSimon Glass2021-01-051-0/+18
| | | | | | | | | | | At present several test drivers are part of the test file itself. Some of these are useful for of-platdata tests. Separate them out so we can use them for other things also. A few adjustments are needed so this driver can build for sandbox_spl as well. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Use a simple variable to record removed deviceSimon Glass2021-01-051-2/+0
| | | | | | | | | | | | At present the entire test state is effective passed into a test driver just to record which device was removed. This is unnecessary and makes it harder to track what is going on. Use a simple boolean instead. Also drop the unused 'removed' member while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Rename the priv/plat membersSimon Glass2021-01-052-14/+19
| | | | | | | These are supposed to be private to driver model, not accessed by any code outside. Add a trailing underscore to indicate this. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add functions to set priv/platSimon Glass2021-01-051-0/+84
| | | | | | | This should not normally be needed in drivers, but add accessors for the few cases that exist. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add function to access uclass privSimon Glass2021-01-052-0/+22
| | | | | | | Add functions so this information is not accessed directly. This will be needed for of-platdata which stores it in a different place. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Use 'uclass_driver' for the uclass linker_listSimon Glass2021-01-051-1/+1
| | | | | | | At present the name 'uclass_driver' is used for the uclass linker list. This does not follow the convention of using the struct name. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Inline a few ofnode functions in SPLSimon Glass2020-12-221-11/+45
| | | | | | | | | | | | | | | | A recent change to unify the flattree/livetree code introduced a small size increase in SPL on some boards. For example SPL code size for px30-core-ctouch2-px30 increased by 40 bytes. To address this we can take advantage of the fact that some of the ofnode functions are only called a few times in SPL, so it is worth inlining them. Add new Kconfig options to control this. These functions are not inlined for U-Boot proper, since this increases code size. Fixes: 2ebea5eaebf ("dm: core: Combine the flattree and livetree binding code") Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Drop seq and req_seqSimon Glass2020-12-181-8/+1
| | | | | | | | | | Now that migration to the new sequence numbers is complete, drop the old fields. Add a test that covers the new behaviour. Also drop the check for OF_PRIOR_STAGE since we always assign sequence numbers now. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Update uclass_find_next_free_req_seq() for new schemeSimon Glass2020-12-181-7/+10
| | | | | | | | This function current deals with req_seq which is deprecated. Update it to use the new sequence numbers, putting them above existing aliases. Rename the function to make this clear. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Drop the unused arg in uclass_find_device_by_seq()Simon Glass2020-12-182-26/+10
| | | | | | | | Now that there is only one sequence number (rather than both requested and assigned ones) we can simplify this function. Also update its caller to simplify the logic. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Drop uclass_resolve_seq()Simon Glass2020-12-181-15/+0
| | | | | | This function is not needed anymore. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: test: Add a test for DM_UC_FLAG_NO_AUTO_SEQSimon Glass2020-12-181-0/+1
| | | | | | | Check that this flag operates as expected. This patch is not earlier in this series since is uses the new behaviour of dev_seq(). Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Switch over to use new sequence number for dev_seq()Simon Glass2020-12-181-1/+1
| | | | | | | Update this function to use the new sequence number and fix up the test that deals with this. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Allow manual sequence numberingSimon Glass2020-12-181-0/+3
| | | | | | | | | | | | | Some buses have their own rules which require assigning sequence numbers with a bus-specific algorithm. For example, PCI requires that sub-buses are numbered higher than their parent buses, meaning effectively that parent buses must be numbered only after all of their child buses have been numbered. Add a uclass flag to indicate that driver model should not assign sequence numbers. In this case, the uclass must do it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add a new sequence number for devicesSimon Glass2020-12-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | At present each device has two sequence numbers, with 'req_seq' being set up at bind time and 'seq' at probe time. The idea is that devices can 'request' a sequence number and then the conflicts are resolved when the device is probed. This makes things complicated in a few cases, since we don't really know what the sequence number will end up being. We want to honour the bind-time requests if at all possible, but in fact the only source of these at present is the devicetree aliases. Since we have the devicetree available at bind time, we may as well just use it, in the hope that the required processing will turn out to be useful later (i.e. the device actually gets used). Add a new 'sqq' member, the bind-time sequence number. It operates in parallel to the old values for now. All devices get a valid sqq value, i.e. it is never -1. Drop an #ifdef while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Update uclass_find_next_free_req_seq() argsSimon Glass2020-12-181-2/+2
| | | | | | | | | | | At present this is passed a uclass ID and it has to do a lookup. The callers all have the uclass pointer, except for the I2C uclass where the code will soon be deleted. Update the argument to a uclass * instead of an ID since it is more efficient. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Avoid accessing seq directlySimon Glass2020-12-181-0/+5
| | | | | | | | | | At present various drivers etc. access the device's 'seq' member directly. This makes it harder to change the meaning of that member. Change access to go through a function instead. The drivers/i2c/lpc32xx_i2c.c file is left unchanged for now. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename ..._platdata variables to just ..._platSimon Glass2020-12-1312-17/+17
| | | | | | | Try to maintain some consistency between these variables by using _plat as a suffix for them. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename ofdata_to_platdata() to of_to_plat()Simon Glass2020-12-133-11/+11
| | | | | | | This name is far too long. Rename it to remove the 'data' bits. This makes it consistent with the platdata->plat rename. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename dev_get_platdata() to dev_get_plat()Simon Glass2020-12-131-2/+2
| | | | | | Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Rename 'platdata_size' to 'plat_size'Simon Glass2020-12-131-2/+2
| | | | | | Rename this to be consistent with the change from 'platdata'. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename 'platdata' variables to just 'plat'Simon Glass2020-12-137-45/+45
| | | | | | | | | | We use 'priv' for private data but often use 'platdata' for platform data. We can't really use 'pdata' since that is ambiguous (it could mean private or platform data). Rename some of the latter variables to end with 'plat' for consistency. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: treewide: Rename auto_alloc_size members to be shorterSimon Glass2020-12-132-19/+19
| | | | | | | | | | | | This construct is quite long-winded. In earlier days it made some sense since auto-allocation was a strange concept. But with driver model now used pretty universally, we can shorten this to 'auto'. This reduces verbosity and makes it easier to read. Coincidentally it also ensures that every declaration is on one line, thus making dtoc's job easier. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Drop unused parameter from dm_extended_scan_fdt()Simon Glass2020-12-131-3/+2
| | | | | | | This doesn't need to be passed the devicetree anymore. Drop it. Also rename the function to drop the _fdt suffix. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Drop unused parameter from dm_scan_fdt()Simon Glass2020-12-131-2/+1
| | | | | | This doesn't need to be passed the devicetree anymore. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add an ofnode function to get the devicetree rootSimon Glass2020-12-131-0/+12
| | | | | | | This is needed in at least one place. Avoid the conditional code in root.c by adding this inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Drop device_bind_offset()Simon Glass2020-12-131-7/+3
| | | | | | | This function is not needed since the standard device_bind() can be used instead. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Drop dev_set_of_offset()Simon Glass2020-12-131-5/+0
| | | | | | This pre-livetree function is not needed anymore. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Remove uses of device_bind_offset()Simon Glass2020-12-131-2/+2
| | | | | | | This function is not needed since the standard device_bind() can be used instead. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Add a livetree function to check node statusSimon Glass2020-12-131-0/+11
| | | | | | | Add a way to find out if a node is enabled or not, based on its 'status' property. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Rename device_bind_ofnode() to device_bind()Simon Glass2020-12-131-3/+3
| | | | | | | This is the standard function to use when binding devices. Drop the '_ofnode' suffix to make this clear. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: core: Rename device_bind() to device_bind_offset()Simon Glass2020-12-131-4/+4
| | | | | | | | | This function is not necessary anymore, since device_bind_ofnode() does the same thing and works with both flattree and livetree. Rename it to indicate that it is special. Signed-off-by: Simon Glass <sjg@chromium.org>
* board: Rename uclass to sysinfoSimon Glass2020-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | This uclass is intended to provide a way to obtain information about a U-Boot board. But the concept of a U-Boot 'board' is the whole system, not just one circuit board, meaning that 'board' is something of a misnomer for this uclass. In addition, the name 'board' is a bit overused in U-Boot and we want to use the same uclass to provide SMBIOS information. The obvious name is 'system' but that is so vague as to be meaningless. Use 'sysinfo' instead, since this uclass is aimed at providing information on the system. Rename everything accordingly. Note: Due to the patch delta caused by the symbol renames, this patch shows some renamed files as being deleted in one place and created in another. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>