soc-framework.rst 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. .. SPDX-License-Identifier: GPL-2.0+
  2. .. (C) Copyright 2020
  3. .. Texas Instruments Incorporated - http://www.ti.com/
  4. SOC ID Framework
  5. ================
  6. Introduction
  7. ------------
  8. The driver-model SOC ID framework is able to provide identification
  9. information about a specific SoC in use at runtime, and also provide matching
  10. from a set of identification information from an array. This can be useful for
  11. enabling small quirks in drivers that exist between SoC variants that are
  12. impractical to implement using device tree flags. It is based on UCLASS_SOC.
  13. UCLASS_SOC:
  14. - drivers/soc/soc-uclass.c
  15. - include/soc.h
  16. Configuration:
  17. - CONFIG_SOC_DEVICE is selected by drivers as needed.
  18. Implementing a UCLASS_SOC provider
  19. ----------------------------------
  20. The purpose of this framework is to allow UCLASS_SOC provider drivers to supply
  21. identification information about the SoC in use at runtime. The framework
  22. allows drivers to define soc_ops that return identification strings. All
  23. soc_ops need not be defined and can be left as NULL, in which case the
  24. framework will return -ENOSYS and not consider the value when doing an
  25. soc_device_match.
  26. It is left to the driver implementor to decide how the information returned is
  27. determined, but in general the same SOC should always return the same set of
  28. identifying information. Information returned must be in the form of a NULL
  29. terminated string.
  30. See include/soc.h for documentation of the available soc_ops and the intended
  31. meaning of the values that can be returned. See drivers/soc/soc_sandbox.c for
  32. an example UCLASS_SOC provider driver.
  33. Using a UCLASS_SOC driver
  34. -------------------------
  35. The framework provides the ability to retrieve and use the identification
  36. strings directly. It also has the ability to return a match from a list of
  37. different sets of SoC data using soc_device_match.
  38. An array of 'struct soc_attr' can be defined, each containing ID information
  39. for a specific SoC, and when passed to soc_device_match, the identifier values
  40. for each entry in the list will be compared against the values provided by the
  41. UCLASS_SOC driver that is in use. The first entry in the list that matches all
  42. non-null values will be returned by soc_device_match.
  43. An example of various uses of the framework can be found at test/dm/soc.c.
  44. Describing the device using device tree
  45. ---------------------------------------
  46. .. code-block:: none
  47. chipid: chipid {
  48. compatible = "sandbox,soc";
  49. };
  50. All that is required in a DT node is a compatible for a corresponding
  51. UCLASS_SOC driver.