summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ofw/ofw_misc.c15
-rw-r--r--sys/dev/ofw/ofw_misc.h3
2 files changed, 16 insertions, 2 deletions
diff --git a/sys/dev/ofw/ofw_misc.c b/sys/dev/ofw/ofw_misc.c
index 5de54ab64f8..63f10f34e79 100644
--- a/sys/dev/ofw/ofw_misc.c
+++ b/sys/dev/ofw/ofw_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_misc.c,v 1.4 2018/03/21 09:16:13 kettenis Exp $ */
+/* $OpenBSD: ofw_misc.c,v 1.5 2018/04/02 17:42:15 patrick Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis
*
@@ -52,6 +52,19 @@ regmap_register(int node, bus_space_tag_t tag, bus_space_handle_t handle,
}
struct regmap *
+regmap_bycompatible(char *compatible)
+{
+ struct regmap *rm;
+
+ LIST_FOREACH(rm, &regmaps, rm_list) {
+ if (OF_is_compatible(rm->rm_node, compatible))
+ return rm;
+ }
+
+ return NULL;
+}
+
+struct regmap *
regmap_bynode(int node)
{
struct regmap *rm;
diff --git a/sys/dev/ofw/ofw_misc.h b/sys/dev/ofw/ofw_misc.h
index add4cdf303a..736ad11a2a7 100644
--- a/sys/dev/ofw/ofw_misc.h
+++ b/sys/dev/ofw/ofw_misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_misc.h,v 1.2 2018/01/03 04:15:51 kettenis Exp $ */
+/* $OpenBSD: ofw_misc.h,v 1.3 2018/04/02 17:42:15 patrick Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis
*
@@ -21,6 +21,7 @@
void regmap_register(int, bus_space_tag_t, bus_space_handle_t, bus_size_t);
struct regmap;
+struct regmap *regmap_bycompatible(char *);
struct regmap *regmap_bynode(int);
struct regmap *regmap_byphandle(uint32_t);