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>
14 int soc_get(struct udevice **devp)
16 return uclass_first_device_err(UCLASS_SOC, devp);
19 int soc_get_machine(struct udevice *dev, char *buf, int size)
21 struct soc_ops *ops = soc_get_ops(dev);
23 if (!ops->get_machine)
26 return ops->get_machine(dev, buf, size);
29 int soc_get_family(struct udevice *dev, char *buf, int size)
31 struct soc_ops *ops = soc_get_ops(dev);
36 return ops->get_family(dev, buf, size);
39 int soc_get_revision(struct udevice *dev, char *buf, int size)
41 struct soc_ops *ops = soc_get_ops(dev);
43 if (!ops->get_revision)
46 return ops->get_revision(dev, buf, size);
49 const struct soc_attr *
50 soc_device_match(const struct soc_attr *matches)
54 char str[SOC_MAX_STR_SIZE];
63 if (!(matches->machine || matches->family ||
69 if (matches->machine) {
70 if (!soc_get_machine(soc, str, SOC_MAX_STR_SIZE)) {
71 if (strcmp(matches->machine, str))
76 if (matches->family) {
77 if (!soc_get_family(soc, str, SOC_MAX_STR_SIZE)) {
78 if (strcmp(matches->family, str))
83 if (matches->revision) {
84 if (!soc_get_revision(soc, str, SOC_MAX_STR_SIZE)) {
85 if (strcmp(matches->revision, str))
99 UCLASS_DRIVER(soc) = {