summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/fdt/imxccm.c14
-rw-r--r--sys/dev/ofw/ofw_clock.c8
2 files changed, 14 insertions, 8 deletions
diff --git a/sys/dev/fdt/imxccm.c b/sys/dev/fdt/imxccm.c
index dfd5af73551..5ffe426656b 100644
--- a/sys/dev/fdt/imxccm.c
+++ b/sys/dev/fdt/imxccm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxccm.c,v 1.3 2018/05/28 09:03:59 patrick Exp $ */
+/* $OpenBSD: imxccm.c,v 1.4 2018/06/03 18:17:27 kettenis Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -135,6 +135,7 @@ struct imxccm_softc {
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
int sc_node;
+ uint32_t sc_phandle;
struct imxccm_gate *sc_gates;
int sc_ngates;
@@ -199,6 +200,8 @@ imxccm_attach(struct device *parent, struct device *self, void *aux)
faa->fa_reg[0].size, 0, &sc->sc_ioh))
panic("%s: bus_space_map failed!", __func__);
+ sc->sc_phandle = OF_getpropint(sc->sc_node, "phandle", 0);
+
if (OF_is_compatible(sc->sc_node, "fsl,imx8mq-ccm")) {
sc->sc_gates = imx8mq_gates;
sc->sc_ngates = nitems(imx8mq_gates);
@@ -670,9 +673,16 @@ imxccm_set_parent(void *cookie, uint32_t *cells, uint32_t *pcells)
{
struct imxccm_softc *sc = cookie;
uint32_t idx = cells[0];
- uint32_t pidx = pcells[0];
+ uint32_t pidx;
uint32_t mux;
+ if (pcells[0] != sc->sc_phandle) {
+ printf("%s: 0x%08x parent 0x%08x\n", __func__, idx, pcells[0]);
+ return -1;
+ }
+
+ pidx = pcells[1];
+
if (sc->sc_muxs == imx8mq_muxs) {
switch (idx) {
case IMX8MQ_CLK_USB_BUS_SRC:
diff --git a/sys/dev/ofw/ofw_clock.c b/sys/dev/ofw/ofw_clock.c
index 459a24f3838..4242641a48d 100644
--- a/sys/dev/ofw/ofw_clock.c
+++ b/sys/dev/ofw/ofw_clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_clock.c,v 1.9 2018/05/03 10:56:14 patrick Exp $ */
+/* $OpenBSD: ofw_clock.c,v 1.10 2018/06/03 18:17:27 kettenis Exp $ */
/*
* Copyright (c) 2016 Mark Kettenis
*
@@ -97,17 +97,13 @@ clock_set_parent_cells(uint32_t *cells, uint32_t *pcells)
struct clock_device *cd;
uint32_t phandle = cells[0];
- /* We expect that clocks are on the same handle. */
- if (phandle != pcells[0])
- return -1;
-
LIST_FOREACH(cd, &clock_devices, cd_list) {
if (cd->cd_phandle == phandle)
break;
}
if (cd && cd->cd_set_parent)
- return cd->cd_set_parent(cd->cd_cookie, &cells[1], &pcells[1]);
+ return cd->cd_set_parent(cd->cd_cookie, &cells[1], pcells);
return -1;
}