summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2017-03-12 12:44:35 +0000
committerkettenis <kettenis@openbsd.org>2017-03-12 12:44:35 +0000
commitebc46d471bfdf8a13021d99ff0ef7bf9fa85559b (patch)
tree431e7ed1231672bd236036d32b4e0e5b74156fa5
parentEnable exdwusb(4) and xhci(4). (diff)
downloadwireguard-openbsd-ebc46d471bfdf8a13021d99ff0ef7bf9fa85559b.tar.xz
wireguard-openbsd-ebc46d471bfdf8a13021d99ff0ef7bf9fa85559b.zip
Hook exclock(4) up to the clock framework using a dummy implementation that
prints the clock ids it is being called for. This allows us to identify which clocks need to be implemented. Attach early such that clocks are available when needed.
-rw-r--r--sys/arch/armv7/conf/GENERIC4
-rw-r--r--sys/arch/armv7/conf/RAMDISK4
-rw-r--r--sys/arch/armv7/exynos/exclock.c42
3 files changed, 45 insertions, 5 deletions
diff --git a/sys/arch/armv7/conf/GENERIC b/sys/arch/armv7/conf/GENERIC
index 9b20b34ef8d..0fbae372b5e 100644
--- a/sys/arch/armv7/conf/GENERIC
+++ b/sys/arch/armv7/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.79 2017/03/12 12:32:04 kettenis Exp $
+# $OpenBSD: GENERIC,v 1.80 2017/03/12 12:44:35 kettenis Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -115,7 +115,7 @@ wsdisplay* at simplefb?
# Exynos
#exdisplay* at exynos?
#wsdisplay* at exdisplay? console ?
-exclock* at fdt?
+exclock* at fdt? early 1
expower* at fdt? early 1
exsysreg* at fdt? early 1
exmct* at fdt? early 1
diff --git a/sys/arch/armv7/conf/RAMDISK b/sys/arch/armv7/conf/RAMDISK
index 46ed77ddcef..74e7f1c09e8 100644
--- a/sys/arch/armv7/conf/RAMDISK
+++ b/sys/arch/armv7/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.74 2017/03/12 12:32:04 kettenis Exp $
+# $OpenBSD: RAMDISK,v 1.75 2017/03/12 12:44:35 kettenis Exp $
machine armv7 arm
@@ -111,7 +111,7 @@ syscon* at fdt?
# Exynos
#exdisplay* at exynos?
#wsdisplay* at exdisplay? console ?
-exclock* at fdt?
+exclock* at fdt? early 1
expower* at fdt? early 1
exsysreg* at fdt? early 1
exmct* at fdt? early 1
diff --git a/sys/arch/armv7/exynos/exclock.c b/sys/arch/armv7/exynos/exclock.c
index 8ff5eddaf50..ed6c1fb5f9d 100644
--- a/sys/arch/armv7/exynos/exclock.c
+++ b/sys/arch/armv7/exynos/exclock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exclock.c,v 1.5 2017/03/04 18:17:24 kettenis Exp $ */
+/* $OpenBSD: exclock.c,v 1.6 2017/03/12 12:44:35 kettenis Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -25,6 +25,7 @@
#include <machine/fdt.h>
#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_clock.h>
#include <dev/ofw/fdt.h>
/* registers */
@@ -67,6 +68,8 @@ struct exclock_softc {
struct device sc_dev;
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
+
+ struct clock_device sc_cd;
};
enum clocks {
@@ -101,6 +104,10 @@ struct cfdriver exclock_cd = {
NULL, "exclock", DV_DULL
};
+uint32_t exclock_get_frequency(void *, uint32_t *);
+int exclock_set_frequency(void *, uint32_t *, uint32_t);
+void exclock_enable(void *, uint32_t *, int);
+
int
exclock_match(struct device *parent, void *match, void *aux)
{
@@ -127,9 +134,42 @@ exclock_attach(struct device *parent, struct device *self, void *aux)
printf(": Exynos 5 CPU freq: %d MHz\n",
exclock_get_armclk() / 1000);
+ sc->sc_cd.cd_node = faa->fa_node;
+ sc->sc_cd.cd_cookie = sc;
+ sc->sc_cd.cd_enable = exclock_enable;
+ sc->sc_cd.cd_get_frequency = exclock_get_frequency;
+ sc->sc_cd.cd_set_frequency = exclock_set_frequency;
+ clock_register(&sc->sc_cd);
+
cpu_cpuspeed = exclock_cpuspeed;
}
+uint32_t
+exclock_get_frequency(void *cookie, uint32_t *cells)
+{
+ uint32_t idx = cells[0];
+
+ printf("%s: 0x%08x\n", __func__, idx);
+ return 0;
+}
+
+int
+exclock_set_frequency(void *cookie, uint32_t *cells, uint32_t freq)
+{
+ uint32_t idx = cells[0];
+
+ printf("%s: 0x%08x\n", __func__, idx);
+ return -1;
+}
+
+void
+exclock_enable(void *cookie, uint32_t *cells, int on)
+{
+ uint32_t idx = cells[0];
+
+ printf("%s: 0x%08x\n", __func__, idx);
+}
+
int
exclock_cpuspeed(int *freq)
{