1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2020 - Texas Instruments Incorporated - http://www.ti.com/
4 * Dave Gerlach <d-gerlach@ti.com>
7 #define LOG_CATEGORY UCLASS_SOC
16 int soc_get(struct udevice **devp)
18 return uclass_first_device_err(UCLASS_SOC, devp);
21 int soc_get_machine(struct udevice *dev, char *buf, int size)
23 struct soc_ops *ops = soc_get_ops(dev);
25 if (!ops->get_machine)
28 return ops->get_machine(dev, buf, size);
31 int soc_get_family(struct udevice *dev, char *buf, int size)
33 struct soc_ops *ops = soc_get_ops(dev);
38 return ops->get_family(dev, buf, size);
41 int soc_get_revision(struct udevice *dev, char *buf, int size)
43 struct soc_ops *ops = soc_get_ops(dev);
45 if (!ops->get_revision)
48 return ops->get_revision(dev, buf, size);
51 const struct soc_attr *
52 soc_device_match(const struct soc_attr *matches)
56 char str[SOC_MAX_STR_SIZE];
65 if (!(matches->machine || matches->family ||
71 if (matches->machine) {
72 if (!soc_get_machine(soc, str, SOC_MAX_STR_SIZE)) {
73 if (strcmp(matches->machine, str))
78 if (matches->family) {
79 if (!soc_get_family(soc, str, SOC_MAX_STR_SIZE)) {
80 if (strcmp(matches->family, str))
85 if (matches->revision) {
86 if (!soc_get_revision(soc, str, SOC_MAX_STR_SIZE)) {
87 if (strcmp(matches->revision, str))
101 UCLASS_DRIVER(soc) = {