1 // SPDX-License-Identifier: GPL-2.0+
4 * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
11 #include "gdsys_soc.h"
14 * struct gdsys_soc_priv - Private data for gdsys soc bus
15 * @fpga: The gdsys IHS FPGA this bus is associated with
17 struct gdsys_soc_priv {
21 static const struct udevice_id gdsys_soc_ids[] = {
22 { .compatible = "gdsys,soc" },
26 int gdsys_soc_get_fpga(struct udevice *child, struct udevice **fpga)
28 struct gdsys_soc_priv *bus_priv;
31 debug("%s: Invalid parent\n", child->name);
35 if (!device_is_compatible(child->parent, "gdsys,soc")) {
36 debug("%s: Not child of a gdsys soc\n", child->name);
40 bus_priv = dev_get_priv(child->parent);
42 *fpga = bus_priv->fpga;
47 static int gdsys_soc_probe(struct udevice *dev)
49 struct gdsys_soc_priv *priv = dev_get_priv(dev);
51 int res = uclass_get_device_by_phandle(UCLASS_MISC, dev, "fpga",
54 debug("%s: Could not find 'fpga' phandle\n", dev->name);
59 debug("%s: Could not get FPGA device\n", dev->name);
68 U_BOOT_DRIVER(gdsys_soc_bus) = {
69 .name = "gdsys_soc_bus",
70 .id = UCLASS_SIMPLE_BUS,
71 .of_match = gdsys_soc_ids,
72 .probe = gdsys_soc_probe,
73 .priv_auto_alloc_size = sizeof(struct gdsys_soc_priv),