summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorMarco Felsch <m.felsch@pengutronix.de>2024-01-25 14:38:55 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-01-29 11:16:40 +0100
commit1a91677680f05c1fc4777b6ddae4873483b260c0 (patch)
treec1a2461aa5700e067a45b8cbc656ab873f0da94c /include/linux
parentd027782af9d40b3f03c80549b15499afcf832fcd (diff)
downloadbarebox-1a91677680f05c1fc4777b6ddae4873483b260c0.tar.gz
barebox-1a91677680f05c1fc4777b6ddae4873483b260c0.tar.xz
Port SoC framework from Linux
This adds the initial support for the Linux soc framework which can be used to register all SoC relevant informations. The framework can be used by driver to check for errata for an specific soc(-revision) in the future since this require porting the matching function. For now it gathers all required SoC information and provide a standard interface to query the data via device params. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20240125133856.3792552-1-m.felsch@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sys_soc.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/linux/sys_soc.h b/include/linux/sys_soc.h
new file mode 100644
index 0000000000..fd597ae540
--- /dev/null
+++ b/include/linux/sys_soc.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) ST-Ericsson SA 2011
+ * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson.
+ */
+#ifndef __SOC_BUS_H
+#define __SOC_BUS_H
+
+#include <linux/device.h>
+
+struct soc_device_attribute {
+ const char *machine;
+ const char *family;
+ const char *revision;
+ const char *serial_number;
+ const char *soc_id;
+ const void *data;
+};
+
+/**
+ * soc_device_register - register SoC as a device
+ * @soc_plat_dev_attr: Attributes passed from platform to be attributed to a SoC
+ */
+struct soc_device *soc_device_register(
+ struct soc_device_attribute *soc_plat_dev_attr);
+
+/**
+ * soc_device_unregister - unregister SoC device
+ * @dev: SoC device to be unregistered
+ */
+void soc_device_unregister(struct soc_device *soc_dev);
+
+/**
+ * soc_device_to_device - helper function to fetch struct device
+ * @soc: Previously registered SoC device container
+ */
+struct device *soc_device_to_device(struct soc_device *soc);
+
+#endif /* __SOC_BUS_H */