summaryrefslogtreecommitdiffstats
path: root/drivers/misc/tegra_car.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2016-09-13 10:45:57 -0600
committerTom Warren <twarren@nvidia.com>2016-09-27 09:11:02 -0700
commitbd3ee84ac71237656992ae78d0c7dfa7dcb4ceac (patch)
tree5491295f7139b809d4e9e99071da0d3d58eb71ac /drivers/misc/tegra_car.c
parentd0ad8a5cbfe8d52339ac5bea3617af21d2fd079a (diff)
downloadu-boot-bd3ee84ac71237656992ae78d0c7dfa7dcb4ceac.tar.gz
u-boot-bd3ee84ac71237656992ae78d0c7dfa7dcb4ceac.tar.xz
u-boot-bd3ee84ac71237656992ae78d0c7dfa7dcb4ceac.zip
misc: implement Tegra CAR core driver
The Tegra CAR (Clock And Reset) module provides control of most clocks and reset signals within the Tegra SoC. This change implements a driver for this module. However, since the module implements multiple kinds of services (clocks, resets, perhaps more), all this driver does is bind various sub-devices, which in turn provide the real services. This driver is essentially an "MFD" (Multi-Function Device) in Linux kernel speak. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Tom Warren <twarren@nvidia.com>
Diffstat (limited to 'drivers/misc/tegra_car.c')
-rw-r--r--drivers/misc/tegra_car.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/drivers/misc/tegra_car.c b/drivers/misc/tegra_car.c
new file mode 100644
index 0000000000..0eb009657c
--- /dev/null
+++ b/drivers/misc/tegra_car.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2016, NVIDIA CORPORATION.
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/lists.h>
+#include <dm/root.h>
+
+/**
+ * The CAR exposes multiple different services. We create a sub-device for
+ * each separate type of service, since each device must be of the appropriate
+ * UCLASS.
+ */
+static int tegra_car_bpmp_bind(struct udevice *dev)
+{
+ int ret;
+ struct udevice *child;
+
+ debug("%s(dev=%p)\n", __func__, dev);
+
+ ret = device_bind_driver_to_node(dev, "tegra_car_clk", "tegra_car_clk",
+ dev->of_offset, &child);
+ if (ret)
+ return ret;
+
+ ret = device_bind_driver_to_node(dev, "tegra_car_reset",
+ "tegra_car_reset", dev->of_offset,
+ &child);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+static int tegra_car_bpmp_probe(struct udevice *dev)
+{
+ debug("%s(dev=%p)\n", __func__, dev);
+
+ return 0;
+}
+
+static int tegra_car_bpmp_remove(struct udevice *dev)
+{
+ debug("%s(dev=%p)\n", __func__, dev);
+
+ return 0;
+}
+
+static const struct udevice_id tegra_car_bpmp_ids[] = {
+ { .compatible = "nvidia,tegra20-car" },
+ { .compatible = "nvidia,tegra30-car" },
+ { .compatible = "nvidia,tegra114-car" },
+ { .compatible = "nvidia,tegra124-car" },
+ { .compatible = "nvidia,tegra210-car" },
+ { }
+};
+
+U_BOOT_DRIVER(tegra_car_bpmp) = {
+ .name = "tegra_car",
+ .id = UCLASS_MISC,
+ .of_match = tegra_car_bpmp_ids,
+ .bind = tegra_car_bpmp_bind,
+ .probe = tegra_car_bpmp_probe,
+ .remove = tegra_car_bpmp_remove,
+};