summaryrefslogtreecommitdiff
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2018-05-28 09:04:15 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2018-05-28 09:04:15 +0000
commit0a4d26c2af2469a57b8b76189f1aba1245a115b0 (patch)
treeda679fcaf0bad6c9f453d7df3336d70f4ef88361 /sys/dev/fdt
parente7d195cdf41f4161b5851871187dace57b6c1b0c (diff)
Add clock support for i.MX8MQ. Most of the clocks can be configured
using a single register which consists of root, div, pre-div, clock gate and src (mux). The device tree node references the root clock, and an "enable" call has to enable the clock's parents so that the clock gate is toggled as well. ok kettenis@
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r--sys/dev/fdt/imxccm.c287
-rw-r--r--sys/dev/fdt/imxccm_clocks.h245
2 files changed, 523 insertions, 9 deletions
diff --git a/sys/dev/fdt/imxccm.c b/sys/dev/fdt/imxccm.c
index 186a6c911ab..dfd5af73551 100644
--- a/sys/dev/fdt/imxccm.c
+++ b/sys/dev/fdt/imxccm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: imxccm.c,v 1.2 2018/05/16 13:42:35 patrick Exp $ */
+/* $OpenBSD: imxccm.c,v 1.3 2018/05/28 09:03:59 patrick Exp $ */
/*
* Copyright (c) 2012-2013 Patrick Wildt <patrick@blueri.se>
*
@@ -109,9 +109,23 @@
HWRITE4((sc), (reg), HREAD4((sc), (reg)) & ~(bits))
struct imxccm_gate {
- uint8_t reg;
+ uint16_t reg;
uint8_t pos;
- uint8_t parent;
+ uint16_t parent;
+};
+
+struct imxccm_divider {
+ uint16_t reg;
+ uint16_t shift;
+ uint16_t mask;
+ uint16_t parent;
+ uint16_t fixed;
+};
+
+struct imxccm_mux {
+ uint16_t reg;
+ uint16_t shift;
+ uint16_t mask;
};
#include "imxccm_clocks.h"
@@ -124,6 +138,10 @@ struct imxccm_softc {
struct imxccm_gate *sc_gates;
int sc_ngates;
+ struct imxccm_divider *sc_divs;
+ int sc_ndivs;
+ struct imxccm_mux *sc_muxs;
+ int sc_nmuxs;
struct clock_device sc_cd;
};
@@ -146,8 +164,14 @@ uint32_t imxccm_get_ahbclk(struct imxccm_softc *);
uint32_t imxccm_get_ipgclk(struct imxccm_softc *);
uint32_t imxccm_get_ipg_perclk(struct imxccm_softc *);
uint32_t imxccm_get_uartclk(struct imxccm_softc *);
+uint32_t imxccm_imx8mq_i2c(struct imxccm_softc *sc, uint32_t);
+uint32_t imxccm_imx8mq_uart(struct imxccm_softc *sc, uint32_t);
+uint32_t imxccm_imx8mq_usdhc(struct imxccm_softc *sc, uint32_t);
+uint32_t imxccm_imx8mq_usb(struct imxccm_softc *sc, uint32_t);
void imxccm_enable(void *, uint32_t *, int);
uint32_t imxccm_get_frequency(void *, uint32_t *);
+int imxccm_set_frequency(void *, uint32_t *, uint32_t);
+int imxccm_set_parent(void *, uint32_t *, uint32_t *);
int
imxccm_match(struct device *parent, void *match, void *aux)
@@ -157,7 +181,8 @@ imxccm_match(struct device *parent, void *match, void *aux)
return (OF_is_compatible(faa->fa_node, "fsl,imx6q-ccm") ||
OF_is_compatible(faa->fa_node, "fsl,imx6sl-ccm") ||
OF_is_compatible(faa->fa_node, "fsl,imx6sx-ccm") ||
- OF_is_compatible(faa->fa_node, "fsl,imx6ul-ccm"));
+ OF_is_compatible(faa->fa_node, "fsl,imx6ul-ccm") ||
+ OF_is_compatible(faa->fa_node, "fsl,imx8mq-ccm"));
}
void
@@ -174,7 +199,14 @@ 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__);
- if (OF_is_compatible(sc->sc_node, "fsl,imx6ul-ccm")) {
+ if (OF_is_compatible(sc->sc_node, "fsl,imx8mq-ccm")) {
+ sc->sc_gates = imx8mq_gates;
+ sc->sc_ngates = nitems(imx8mq_gates);
+ sc->sc_divs = imx8mq_divs;
+ sc->sc_ndivs = nitems(imx8mq_divs);
+ sc->sc_muxs = imx8mq_muxs;
+ sc->sc_nmuxs = nitems(imx8mq_muxs);
+ } else if (OF_is_compatible(sc->sc_node, "fsl,imx6ul-ccm")) {
sc->sc_gates = imx6ul_gates;
sc->sc_ngates = nitems(imx6ul_gates);
} else {
@@ -188,6 +220,8 @@ imxccm_attach(struct device *parent, struct device *self, void *aux)
sc->sc_cd.cd_cookie = sc;
sc->sc_cd.cd_enable = imxccm_enable;
sc->sc_cd.cd_get_frequency = imxccm_get_frequency;
+ sc->sc_cd.cd_set_frequency = imxccm_set_frequency;
+ sc->sc_cd.cd_set_parent = imxccm_set_parent;
clock_register(&sc->sc_cd);
}
@@ -331,12 +365,130 @@ imxccm_get_ipg_perclk(struct imxccm_softc *sc)
return freq / (ipg_podf + 1);
}
+uint32_t
+imxccm_imx8mq_enet(struct imxccm_softc *sc, uint32_t idx)
+{
+ uint32_t mux;
+
+ if (idx >= sc->sc_nmuxs || sc->sc_muxs[idx].reg == 0)
+ return 0;
+
+ mux = HREAD4(sc, sc->sc_muxs[idx].reg);
+ mux >>= sc->sc_muxs[idx].shift;
+ mux &= sc->sc_muxs[idx].mask;
+
+ switch (mux) {
+ case 0:
+ return clock_get_frequency(sc->sc_node, "osc_25m");
+ case 1:
+ return 266 * 1000 * 1000; /* sys1_pll_266m */
+ default:
+ printf("%s: 0x%08x 0x%08x\n", __func__, idx, mux);
+ return 0;
+ }
+}
+
+uint32_t
+imxccm_imx8mq_i2c(struct imxccm_softc *sc, uint32_t idx)
+{
+ uint32_t mux;
+
+ if (idx >= sc->sc_nmuxs || sc->sc_muxs[idx].reg == 0)
+ return 0;
+
+ mux = HREAD4(sc, sc->sc_muxs[idx].reg);
+ mux >>= sc->sc_muxs[idx].shift;
+ mux &= sc->sc_muxs[idx].mask;
+
+ switch (mux) {
+ case 0:
+ return clock_get_frequency(sc->sc_node, "osc_25m");
+ default:
+ printf("%s: 0x%08x 0x%08x\n", __func__, idx, mux);
+ return 0;
+ }
+}
+
+uint32_t
+imxccm_imx8mq_uart(struct imxccm_softc *sc, uint32_t idx)
+{
+ uint32_t mux;
+
+ if (idx >= sc->sc_nmuxs || sc->sc_muxs[idx].reg == 0)
+ return 0;
+
+ mux = HREAD4(sc, sc->sc_muxs[idx].reg);
+ mux >>= sc->sc_muxs[idx].shift;
+ mux &= sc->sc_muxs[idx].mask;
+
+ switch (mux) {
+ case 0:
+ return clock_get_frequency(sc->sc_node, "osc_25m");
+ default:
+ printf("%s: 0x%08x 0x%08x\n", __func__, idx, mux);
+ return 0;
+ }
+}
+
+uint32_t
+imxccm_imx8mq_usdhc(struct imxccm_softc *sc, uint32_t idx)
+{
+ uint32_t mux;
+
+ if (idx >= sc->sc_nmuxs || sc->sc_muxs[idx].reg == 0)
+ return 0;
+
+ mux = HREAD4(sc, sc->sc_muxs[idx].reg);
+ mux >>= sc->sc_muxs[idx].shift;
+ mux &= sc->sc_muxs[idx].mask;
+
+ switch (mux) {
+ case 0:
+ return clock_get_frequency(sc->sc_node, "osc_25m");
+ case 1:
+ return 400 * 1000 * 1000; /* sys1_pll_400m */
+ default:
+ printf("%s: 0x%08x 0x%08x\n", __func__, idx, mux);
+ return 0;
+ }
+}
+
+uint32_t
+imxccm_imx8mq_usb(struct imxccm_softc *sc, uint32_t idx)
+{
+ uint32_t mux;
+
+ if (idx >= sc->sc_nmuxs || sc->sc_muxs[idx].reg == 0)
+ return 0;
+
+ mux = HREAD4(sc, sc->sc_muxs[idx].reg);
+ mux >>= sc->sc_muxs[idx].shift;
+ mux &= sc->sc_muxs[idx].mask;
+
+ switch (mux) {
+ case 0:
+ return clock_get_frequency(sc->sc_node, "osc_25m");
+ case 1:
+ if (idx == IMX8MQ_CLK_USB_CORE_REF_SRC ||
+ idx == IMX8MQ_CLK_USB_PHY_REF_SRC)
+ return 100 * 1000 * 1000; /* sys1_pll_100m */
+ if (idx == IMX8MQ_CLK_USB_BUS_SRC)
+ return 500 * 1000 * 1000; /* sys2_pll_500m */
+ printf("%s: 0x%08x 0x%08x\n", __func__, idx, mux);
+ return 0;
+ default:
+ printf("%s: 0x%08x 0x%08x\n", __func__, idx, mux);
+ return 0;
+ }
+}
+
void
imxccm_enable(void *cookie, uint32_t *cells, int on)
{
struct imxccm_softc *sc = cookie;
- uint32_t idx = cells[0];
- uint8_t reg, pos;
+ uint32_t idx = cells[0], parent;
+ uint16_t reg;
+ uint8_t pos;
/* Dummy clock. */
if (idx == 0)
@@ -356,11 +508,31 @@ imxccm_enable(void *cookie, uint32_t *cells, int on)
case IMX6_CLK_ENET_REF:
imxanatop_enable_enet();
return;
+ case IMX6_CLK_IPG:
+ case IMX6_CLK_IPG_PER:
+ /* always on */
+ return;
default:
break;
}
}
+ if (on) {
+ if (idx < sc->sc_ngates && sc->sc_gates[idx].parent) {
+ parent = sc->sc_gates[idx].parent;
+ imxccm_enable(sc, &parent, on);
+ }
+
+ if (idx < sc->sc_ndivs && sc->sc_divs[idx].parent) {
+ parent = sc->sc_divs[idx].parent;
+ imxccm_enable(sc, &parent, on);
+ }
+ }
+
+ if ((idx < sc->sc_ndivs && sc->sc_divs[idx].reg != 0) ||
+ (idx < sc->sc_nmuxs && sc->sc_muxs[idx].reg != 0))
+ return;
+
if (idx >= sc->sc_ngates || sc->sc_gates[idx].reg == 0) {
printf("%s: 0x%08x\n", __func__, idx);
return;
@@ -380,7 +552,7 @@ imxccm_get_frequency(void *cookie, uint32_t *cells)
{
struct imxccm_softc *sc = cookie;
uint32_t idx = cells[0];
- uint32_t parent;
+ uint32_t div, parent;
/* Dummy clock. */
if (idx == 0)
@@ -391,7 +563,39 @@ imxccm_get_frequency(void *cookie, uint32_t *cells)
return imxccm_get_frequency(sc, &parent);
}
- if (sc->sc_gates == imx6ul_gates) {
+ if (idx < sc->sc_ndivs && sc->sc_divs[idx].parent) {
+ div = HREAD4(sc, sc->sc_divs[idx].reg);
+ div = div >> sc->sc_divs[idx].shift;
+ div = div & sc->sc_divs[idx].mask;
+ parent = sc->sc_divs[idx].parent;
+ return imxccm_get_frequency(sc, &parent) / (div + 1);
+ }
+
+ if (sc->sc_gates == imx8mq_gates) {
+ switch (idx) {
+ case IMX8MQ_CLK_A53_SRC:
+ return 1000 * 1000 * 1000; /* arm_pll */
+ case IMX8MQ_CLK_ENET_AXI_SRC:
+ return imxccm_imx8mq_enet(sc, idx);
+ case IMX8MQ_CLK_I2C1_SRC:
+ case IMX8MQ_CLK_I2C2_SRC:
+ case IMX8MQ_CLK_I2C3_SRC:
+ case IMX8MQ_CLK_I2C4_SRC:
+ return imxccm_imx8mq_i2c(sc, idx);
+ case IMX8MQ_CLK_UART1_SRC:
+ case IMX8MQ_CLK_UART2_SRC:
+ case IMX8MQ_CLK_UART3_SRC:
+ case IMX8MQ_CLK_UART4_SRC:
+ return imxccm_imx8mq_uart(sc, idx);
+ case IMX8MQ_CLK_USDHC1_SRC:
+ case IMX8MQ_CLK_USDHC2_SRC:
+ return imxccm_imx8mq_usdhc(sc, idx);
+ case IMX8MQ_CLK_USB_BUS_SRC:
+ case IMX8MQ_CLK_USB_CORE_REF_SRC:
+ case IMX8MQ_CLK_USB_PHY_REF_SRC:
+ return imxccm_imx8mq_usb(sc, idx);
+ }
+ } else if (sc->sc_gates == imx6ul_gates) {
switch (idx) {
case IMX6UL_CLK_ARM:
return imxccm_get_armclk(sc);
@@ -429,3 +633,68 @@ imxccm_get_frequency(void *cookie, uint32_t *cells)
return 0;
}
+int
+imxccm_set_frequency(void *cookie, uint32_t *cells, uint32_t freq)
+{
+ struct imxccm_softc *sc = cookie;
+ uint32_t idx = cells[0];
+ uint32_t div, parent;
+
+ if (sc->sc_divs == imx8mq_divs) {
+ switch (idx) {
+ case IMX8MQ_CLK_USB_BUS_SRC:
+ case IMX8MQ_CLK_USB_CORE_REF_SRC:
+ case IMX8MQ_CLK_USB_PHY_REF_SRC:
+ if (imxccm_get_frequency(sc, cells) != freq)
+ break;
+ return 0;
+ case IMX8MQ_CLK_USDHC1_DIV:
+ parent = sc->sc_divs[idx].parent;
+ if (imxccm_get_frequency(sc, &parent) != freq)
+ break;
+ imxccm_enable(cookie, &parent, 1);
+ div = HREAD4(sc, sc->sc_divs[idx].reg);
+ div &= ~(sc->sc_divs[idx].mask << sc->sc_divs[idx].shift);
+ div |= (0x0 << sc->sc_divs[idx].shift);
+ HWRITE4(sc, sc->sc_divs[idx].reg, div);
+ return 0;
+ }
+ }
+
+ printf("%s: 0x%08x %x\n", __func__, idx, freq);
+ return -1;
+}
+
+int
+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 mux;
+
+ if (sc->sc_muxs == imx8mq_muxs) {
+ switch (idx) {
+ case IMX8MQ_CLK_USB_BUS_SRC:
+ if (pidx != IMX8MQ_SYS2_PLL_500M)
+ break;
+ mux = HREAD4(sc, sc->sc_muxs[idx].reg);
+ mux &= ~(sc->sc_muxs[idx].mask << sc->sc_muxs[idx].shift);
+ mux |= (0x1 << sc->sc_muxs[idx].shift);
+ HWRITE4(sc, sc->sc_muxs[idx].reg, mux);
+ return 0;
+ case IMX8MQ_CLK_USB_CORE_REF_SRC:
+ case IMX8MQ_CLK_USB_PHY_REF_SRC:
+ if (pidx != IMX8MQ_SYS1_PLL_100M)
+ break;
+ mux = HREAD4(sc, sc->sc_muxs[idx].reg);
+ mux &= ~(sc->sc_muxs[idx].mask << sc->sc_muxs[idx].shift);
+ mux |= (0x1 << sc->sc_muxs[idx].shift);
+ HWRITE4(sc, sc->sc_muxs[idx].reg, mux);
+ return 0;
+ }
+ }
+
+ printf("%s: 0x%08x 0x%08x\n", __func__, idx, pidx);
+ return -1;
+}
diff --git a/sys/dev/fdt/imxccm_clocks.h b/sys/dev/fdt/imxccm_clocks.h
index 2bf09ffb954..c6fdd524ccf 100644
--- a/sys/dev/fdt/imxccm_clocks.h
+++ b/sys/dev/fdt/imxccm_clocks.h
@@ -74,3 +74,248 @@ struct imxccm_gate imx6ul_gates[] =
[IMX6UL_CLK_USDHC1] = { CCM_CCGR6, 1 },
[IMX6UL_CLK_USDHC2] = { CCM_CCGR6, 2 },
};
+
+/*
+ * i.MX8MQ clocks.
+ */
+
+#define IMX8MQ_SYS1_PLL_100M 0x48
+#define IMX8MQ_SYS1_PLL_266M 0x4c
+#define IMX8MQ_SYS1_PLL_400M 0x4d
+#define IMX8MQ_SYS2_PLL_500M 0x56
+#define IMX8MQ_CLK_A53_SRC 0x58
+#define IMX8MQ_CLK_A53_CG 0x59
+#define IMX8MQ_CLK_A53_DIV 0x5a
+#define IMX8MQ_CLK_ENET_AXI_SRC 0x6b
+#define IMX8MQ_CLK_ENET_AXI_CG 0x6c
+#define IMX8MQ_CLK_ENET_AXI_PRE_DIV 0x6d
+#define IMX8MQ_CLK_ENET_AXI_DIV 0x6e
+#define IMX8MQ_CLK_USB_BUS_SRC 0x83
+#define IMX8MQ_CLK_USB_BUS_CG 0x84
+#define IMX8MQ_CLK_USB_BUS_PRE_DIV 0x85
+#define IMX8MQ_CLK_PCIE1_CTRL_SRC 0xb7
+#define IMX8MQ_CLK_PCIE1_CTRL_CG 0xb8
+#define IMX8MQ_CLK_PCIE1_CTRL_PRE_DIV 0xb9
+#define IMX8MQ_CLK_PCIE1_CTRL_DIV 0xba
+#define IMX8MQ_CLK_PCIE1_PHY_SRC 0xbb
+#define IMX8MQ_CLK_PCIE1_PHY_CG 0xbc
+#define IMX8MQ_CLK_PCIE1_PHY_PRE_DIV 0xbd
+#define IMX8MQ_CLK_PCIE1_PHY_DIV 0xbe
+#define IMX8MQ_CLK_PCIE1_AUX_SRC 0xbf
+#define IMX8MQ_CLK_PCIE1_AUX_CG 0xc0
+#define IMX8MQ_CLK_PCIE1_AUX_PRE_DIV 0xc1
+#define IMX8MQ_CLK_PCIE1_AUX_DIV 0xc2
+#define IMX8MQ_CLK_USB_BUS_DIV 0x86
+#define IMX8MQ_CLK_ENET_REF_SRC 0xeb
+#define IMX8MQ_CLK_ENET_REF_CG 0xec
+#define IMX8MQ_CLK_ENET_REF_PRE_DIV 0xed
+#define IMX8MQ_CLK_ENET_REF_DIV 0xee
+#define IMX8MQ_CLK_ENET_TIMER_SRC 0xef
+#define IMX8MQ_CLK_ENET_TIMER_CG 0xf0
+#define IMX8MQ_CLK_ENET_TIMER_PRE_DIV 0xf1
+#define IMX8MQ_CLK_ENET_TIMER_DIV 0xf2
+#define IMX8MQ_CLK_ENET_PHY_REF_SRC 0xf3
+#define IMX8MQ_CLK_ENET_PHY_REF_CG 0xf4
+#define IMX8MQ_CLK_ENET_PHY_REF_PRE_DIV 0xf5
+#define IMX8MQ_CLK_ENET_PHY_REF_DIV 0xf6
+#define IMX8MQ_CLK_USDHC1_SRC 0xff
+#define IMX8MQ_CLK_USDHC1_CG 0x100
+#define IMX8MQ_CLK_USDHC1_PRE_DIV 0x101
+#define IMX8MQ_CLK_USDHC1_DIV 0x102
+#define IMX8MQ_CLK_USDHC2_SRC 0x103
+#define IMX8MQ_CLK_USDHC2_CG 0x104
+#define IMX8MQ_CLK_USDHC2_PRE_DIV 0x105
+#define IMX8MQ_CLK_USDHC2_DIV 0x106
+#define IMX8MQ_CLK_I2C1_SRC 0x107
+#define IMX8MQ_CLK_I2C1_CG 0x108
+#define IMX8MQ_CLK_I2C1_PRE_DIV 0x109
+#define IMX8MQ_CLK_I2C1_DIV 0x10a
+#define IMX8MQ_CLK_I2C2_SRC 0x10b
+#define IMX8MQ_CLK_I2C2_CG 0x10c
+#define IMX8MQ_CLK_I2C2_PRE_DIV 0x10d
+#define IMX8MQ_CLK_I2C2_DIV 0x10e
+#define IMX8MQ_CLK_I2C3_SRC 0x10f
+#define IMX8MQ_CLK_I2C3_CG 0x110
+#define IMX8MQ_CLK_I2C3_PRE_DIV 0x111
+#define IMX8MQ_CLK_I2C3_DIV 0x112
+#define IMX8MQ_CLK_I2C4_SRC 0x113
+#define IMX8MQ_CLK_I2C4_CG 0x114
+#define IMX8MQ_CLK_I2C4_PRE_DIV 0x115
+#define IMX8MQ_CLK_I2C4_DIV 0x116
+#define IMX8MQ_CLK_UART1_SRC 0x117
+#define IMX8MQ_CLK_UART1_CG 0x118
+#define IMX8MQ_CLK_UART1_PRE_DIV 0x119
+#define IMX8MQ_CLK_UART1_DIV 0x11a
+#define IMX8MQ_CLK_UART2_SRC 0x11b
+#define IMX8MQ_CLK_UART2_CG 0x11c
+#define IMX8MQ_CLK_UART2_PRE_DIV 0x11d
+#define IMX8MQ_CLK_UART2_DIV 0x11e
+#define IMX8MQ_CLK_UART3_SRC 0x11f
+#define IMX8MQ_CLK_UART3_CG 0x120
+#define IMX8MQ_CLK_UART3_PRE_DIV 0x121
+#define IMX8MQ_CLK_UART3_DIV 0x122
+#define IMX8MQ_CLK_UART4_SRC 0x123
+#define IMX8MQ_CLK_UART4_CG 0x124
+#define IMX8MQ_CLK_UART4_PRE_DIV 0x125
+#define IMX8MQ_CLK_UART4_DIV 0x126
+#define IMX8MQ_CLK_USB_CORE_REF_SRC 0x127
+#define IMX8MQ_CLK_USB_CORE_REF_CG 0x128
+#define IMX8MQ_CLK_USB_CORE_REF_PRE_DIV 0x129
+#define IMX8MQ_CLK_USB_CORE_REF_DIV 0x12a
+#define IMX8MQ_CLK_USB_PHY_REF_SRC 0x12b
+#define IMX8MQ_CLK_USB_PHY_REF_CG 0x12c
+#define IMX8MQ_CLK_USB_PHY_REF_PRE_DIV 0x12d
+#define IMX8MQ_CLK_USB_PHY_REF_DIV 0x12e
+#define IMX8MQ_CLK_PCIE2_CTRL_SRC 0x17b
+#define IMX8MQ_CLK_PCIE2_CTRL_CG 0x17c
+#define IMX8MQ_CLK_PCIE2_CTRL_PRE_DIV 0x17d
+#define IMX8MQ_CLK_PCIE2_CTRL_DIV 0x17e
+#define IMX8MQ_CLK_PCIE2_PHY_SRC 0x17f
+#define IMX8MQ_CLK_PCIE2_PHY_CG 0x180
+#define IMX8MQ_CLK_PCIE2_PHY_PRE_DIV 0x181
+#define IMX8MQ_CLK_PCIE2_PHY_DIV 0x182
+#define IMX8MQ_CLK_PCIE2_AUX_SRC 0x183
+#define IMX8MQ_CLK_PCIE2_AUX_CG 0x184
+#define IMX8MQ_CLK_PCIE2_AUX_PRE_DIV 0x185
+#define IMX8MQ_CLK_PCIE2_AUX_DIV 0x186
+#define IMX8MQ_CLK_ENET1_ROOT 0x190
+#define IMX8MQ_CLK_I2C1_ROOT 0x192
+#define IMX8MQ_CLK_I2C2_ROOT 0x193
+#define IMX8MQ_CLK_I2C3_ROOT 0x194
+#define IMX8MQ_CLK_I2C4_ROOT 0x195
+#define IMX8MQ_CLK_PCIE1_ROOT 0x197
+#define IMX8MQ_CLK_PCIE2_ROOT 0x198
+#define IMX8MQ_CLK_UART1_ROOT 0x1a4
+#define IMX8MQ_CLK_UART2_ROOT 0x1a5
+#define IMX8MQ_CLK_UART3_ROOT 0x1a6
+#define IMX8MQ_CLK_UART4_ROOT 0x1a7
+#define IMX8MQ_CLK_USB1_CTRL_ROOT 0x1a8
+#define IMX8MQ_CLK_USB2_CTRL_ROOT 0x1a9
+#define IMX8MQ_CLK_USB1_PHY_ROOT 0x1aa
+#define IMX8MQ_CLK_USB2_PHY_ROOT 0x1ab
+#define IMX8MQ_CLK_USDHC1_ROOT 0x1ac
+#define IMX8MQ_CLK_USDHC2_ROOT 0x1ad
+
+struct imxccm_gate imx8mq_gates[] =
+{
+ [IMX8MQ_CLK_A53_CG] = { 0x8000, 14, IMX8MQ_CLK_A53_SRC },
+ [IMX8MQ_CLK_ENET_AXI_CG] = { 0x8880, 14, IMX8MQ_CLK_ENET_AXI_SRC },
+ [IMX8MQ_CLK_USB_BUS_CG] = { 0x8b80, 14, IMX8MQ_CLK_USB_BUS_SRC },
+ [IMX8MQ_CLK_PCIE1_CTRL_CG] = { 0xa300, 14, IMX8MQ_CLK_PCIE1_CTRL_SRC },
+ [IMX8MQ_CLK_PCIE1_PHY_CG] = { 0xa380, 14, IMX8MQ_CLK_PCIE1_PHY_SRC },
+ [IMX8MQ_CLK_PCIE1_AUX_CG] = { 0xa400, 14, IMX8MQ_CLK_PCIE1_AUX_SRC },
+ [IMX8MQ_CLK_ENET_REF_CG] = { 0xa980, 14, IMX8MQ_CLK_ENET_REF_SRC },
+ [IMX8MQ_CLK_ENET_TIMER_CG] = { 0xaa00, 14, IMX8MQ_CLK_ENET_TIMER_SRC },
+ [IMX8MQ_CLK_ENET_PHY_REF_CG] = { 0xaa80, 14, IMX8MQ_CLK_ENET_PHY_REF_SRC },
+ [IMX8MQ_CLK_USDHC1_CG] = { 0xac00, 14, IMX8MQ_CLK_USDHC1_SRC },
+ [IMX8MQ_CLK_USDHC2_CG] = { 0xac80, 14, IMX8MQ_CLK_USDHC2_SRC },
+ [IMX8MQ_CLK_I2C1_CG] = { 0xad00, 14, IMX8MQ_CLK_I2C1_SRC },
+ [IMX8MQ_CLK_I2C2_CG] = { 0xad80, 14, IMX8MQ_CLK_I2C2_SRC },
+ [IMX8MQ_CLK_I2C3_CG] = { 0xae00, 14, IMX8MQ_CLK_I2C3_SRC },
+ [IMX8MQ_CLK_I2C4_CG] = { 0xae80, 14, IMX8MQ_CLK_I2C4_SRC },
+ [IMX8MQ_CLK_UART1_CG] = { 0xaf00, 14, IMX8MQ_CLK_UART1_SRC },
+ [IMX8MQ_CLK_UART2_CG] = { 0xaf80, 14, IMX8MQ_CLK_UART2_SRC },
+ [IMX8MQ_CLK_UART3_CG] = { 0xb000, 14, IMX8MQ_CLK_UART3_SRC },
+ [IMX8MQ_CLK_UART4_CG] = { 0xb080, 14, IMX8MQ_CLK_UART4_SRC },
+ [IMX8MQ_CLK_USB_CORE_REF_CG] = { 0xb100, 14, IMX8MQ_CLK_USB_CORE_REF_SRC },
+ [IMX8MQ_CLK_USB_PHY_REF_CG] = { 0xb180, 14, IMX8MQ_CLK_USB_PHY_REF_SRC },
+ [IMX8MQ_CLK_PCIE2_CTRL_CG] = { 0xc000, 14, IMX8MQ_CLK_PCIE2_CTRL_SRC },
+ [IMX8MQ_CLK_PCIE2_PHY_CG] = { 0xc080, 14, IMX8MQ_CLK_PCIE2_PHY_SRC },
+ [IMX8MQ_CLK_PCIE2_AUX_CG] = { 0xc100, 14, IMX8MQ_CLK_PCIE2_AUX_SRC },
+ [IMX8MQ_CLK_ENET1_ROOT] = { 0x40a0, 0, IMX8MQ_CLK_ENET_AXI_DIV },
+ [IMX8MQ_CLK_I2C1_ROOT] = { 0x4170, 0, IMX8MQ_CLK_I2C1_DIV },
+ [IMX8MQ_CLK_I2C2_ROOT] = { 0x4180, 0, IMX8MQ_CLK_I2C2_DIV },
+ [IMX8MQ_CLK_I2C3_ROOT] = { 0x4190, 0, IMX8MQ_CLK_I2C3_DIV },
+ [IMX8MQ_CLK_I2C4_ROOT] = { 0x41a0, 0, IMX8MQ_CLK_I2C4_DIV },
+ [IMX8MQ_CLK_PCIE1_ROOT] = { 0x4250, 0, IMX8MQ_CLK_PCIE1_CTRL_DIV },
+ [IMX8MQ_CLK_PCIE2_ROOT] = { 0x4640, 0, IMX8MQ_CLK_PCIE2_CTRL_DIV },
+ [IMX8MQ_CLK_UART1_ROOT] = { 0x4490, 0, IMX8MQ_CLK_UART1_DIV },
+ [IMX8MQ_CLK_UART2_ROOT] = { 0x44a0, 0, IMX8MQ_CLK_UART2_DIV },
+ [IMX8MQ_CLK_UART3_ROOT] = { 0x44b0, 0, IMX8MQ_CLK_UART3_DIV },
+ [IMX8MQ_CLK_UART4_ROOT] = { 0x44c0, 0, IMX8MQ_CLK_UART4_DIV },
+ [IMX8MQ_CLK_USB1_CTRL_ROOT] = { 0x44d0, 0, IMX8MQ_CLK_USB_CORE_REF_DIV },
+ [IMX8MQ_CLK_USB2_CTRL_ROOT] = { 0x44e0, 0, IMX8MQ_CLK_USB_CORE_REF_DIV },
+ [IMX8MQ_CLK_USB1_PHY_ROOT] = { 0x44f0, 0, IMX8MQ_CLK_USB_PHY_REF_DIV },
+ [IMX8MQ_CLK_USB2_PHY_ROOT] = { 0x4500, 0, IMX8MQ_CLK_USB_PHY_REF_DIV },
+ [IMX8MQ_CLK_USDHC1_ROOT] = { 0x4510, 0, IMX8MQ_CLK_USDHC1_DIV },
+ [IMX8MQ_CLK_USDHC2_ROOT] = { 0x4520, 0, IMX8MQ_CLK_USDHC2_DIV },
+};
+
+struct imxccm_divider imx8mq_divs[] =
+{
+ [IMX8MQ_CLK_A53_DIV] = { 0x8000, 0, 0x7, IMX8MQ_CLK_A53_CG },
+ [IMX8MQ_CLK_ENET_AXI_PRE_DIV] = { 0x8880, 16, 0x7, IMX8MQ_CLK_ENET_AXI_CG },
+ [IMX8MQ_CLK_ENET_AXI_DIV] = { 0x8880, 0, 0x3f, IMX8MQ_CLK_ENET_AXI_PRE_DIV },
+ [IMX8MQ_CLK_USB_BUS_PRE_DIV] = { 0x8b80, 16, 0x7, IMX8MQ_CLK_USB_BUS_CG },
+ [IMX8MQ_CLK_USB_BUS_DIV] = { 0x8b80, 0, 0x3f, IMX8MQ_CLK_USB_BUS_PRE_DIV },
+ [IMX8MQ_CLK_PCIE1_CTRL_PRE_DIV] = { 0xa300, 16, 0x7, IMX8MQ_CLK_PCIE1_CTRL_CG },
+ [IMX8MQ_CLK_PCIE1_CTRL_DIV] = { 0xa300, 0, 0x3f, IMX8MQ_CLK_PCIE1_CTRL_PRE_DIV },
+ [IMX8MQ_CLK_PCIE1_PHY_PRE_DIV] = { 0xa380, 16, 0x7, IMX8MQ_CLK_PCIE1_CTRL_CG },
+ [IMX8MQ_CLK_PCIE1_PHY_DIV] = { 0xa380, 0, 0x3f, IMX8MQ_CLK_PCIE1_CTRL_PRE_DIV },
+ [IMX8MQ_CLK_PCIE1_AUX_PRE_DIV] = { 0xa400, 16, 0x7, IMX8MQ_CLK_PCIE1_AUX_CG },
+ [IMX8MQ_CLK_PCIE1_AUX_DIV] = { 0xa400, 0, 0x3f, IMX8MQ_CLK_PCIE1_AUX_PRE_DIV },
+ [IMX8MQ_CLK_ENET_REF_PRE_DIV] = { 0xa980, 16, 0x7, IMX8MQ_CLK_ENET_REF_CG },
+ [IMX8MQ_CLK_ENET_REF_DIV] = { 0xa980, 0, 0x3f, IMX8MQ_CLK_ENET_REF_PRE_DIV },
+ [IMX8MQ_CLK_ENET_TIMER_PRE_DIV] = { 0xaa00, 16, 0x7, IMX8MQ_CLK_ENET_TIMER_CG },
+ [IMX8MQ_CLK_ENET_TIMER_DIV] = { 0xaa00, 0, 0x3f, IMX8MQ_CLK_ENET_TIMER_PRE_DIV },
+ [IMX8MQ_CLK_ENET_PHY_REF_PRE_DIV] = { 0xaa80, 16, 0x7, IMX8MQ_CLK_ENET_PHY_REF_CG },
+ [IMX8MQ_CLK_ENET_PHY_REF_DIV] = { 0xaa80, 0, 0x3f, IMX8MQ_CLK_ENET_PHY_REF_PRE_DIV },
+ [IMX8MQ_CLK_USDHC1_PRE_DIV] = { 0xac00, 16, 0x7, IMX8MQ_CLK_USDHC1_CG },
+ [IMX8MQ_CLK_USDHC1_DIV] = { 0xac00, 0, 0x3f, IMX8MQ_CLK_USDHC1_PRE_DIV },
+ [IMX8MQ_CLK_USDHC2_PRE_DIV] = { 0xac80, 16, 0x7, IMX8MQ_CLK_USDHC2_CG },
+ [IMX8MQ_CLK_USDHC2_DIV] = { 0xac80, 0, 0x3f, IMX8MQ_CLK_USDHC2_PRE_DIV },
+ [IMX8MQ_CLK_I2C1_PRE_DIV] = { 0xad00, 16, 0x7, IMX8MQ_CLK_I2C1_CG },
+ [IMX8MQ_CLK_I2C1_DIV] = { 0xad00, 0, 0x3f, IMX8MQ_CLK_I2C1_PRE_DIV },
+ [IMX8MQ_CLK_I2C2_PRE_DIV] = { 0xad80, 16, 0x7, IMX8MQ_CLK_I2C2_CG },
+ [IMX8MQ_CLK_I2C2_DIV] = { 0xad80, 0, 0x3f, IMX8MQ_CLK_I2C2_PRE_DIV },
+ [IMX8MQ_CLK_I2C3_PRE_DIV] = { 0xae00, 16, 0x7, IMX8MQ_CLK_I2C3_CG },
+ [IMX8MQ_CLK_I2C3_DIV] = { 0xae00, 0, 0x3f, IMX8MQ_CLK_I2C3_PRE_DIV },
+ [IMX8MQ_CLK_I2C4_PRE_DIV] = { 0xae80, 16, 0x7, IMX8MQ_CLK_I2C4_CG },
+ [IMX8MQ_CLK_I2C4_DIV] = { 0xae80, 0, 0x3f, IMX8MQ_CLK_I2C4_PRE_DIV },
+ [IMX8MQ_CLK_UART1_PRE_DIV] = { 0xaf00, 16, 0x7, IMX8MQ_CLK_UART1_CG },
+ [IMX8MQ_CLK_UART1_DIV] = { 0xaf00, 0, 0x3f, IMX8MQ_CLK_UART1_PRE_DIV },
+ [IMX8MQ_CLK_UART2_PRE_DIV] = { 0xaf80, 16, 0x7, IMX8MQ_CLK_UART2_CG },
+ [IMX8MQ_CLK_UART2_DIV] = { 0xaf80, 0, 0x3f, IMX8MQ_CLK_UART2_PRE_DIV },
+ [IMX8MQ_CLK_UART3_PRE_DIV] = { 0xb000, 16, 0x7, IMX8MQ_CLK_UART3_CG },
+ [IMX8MQ_CLK_UART3_DIV] = { 0xb000, 0, 0x3f, IMX8MQ_CLK_UART3_PRE_DIV },
+ [IMX8MQ_CLK_UART4_PRE_DIV] = { 0xb080, 16, 0x7, IMX8MQ_CLK_UART4_CG },
+ [IMX8MQ_CLK_UART4_DIV] = { 0xb080, 0, 0x3f, IMX8MQ_CLK_UART4_PRE_DIV },
+ [IMX8MQ_CLK_USB_CORE_REF_PRE_DIV] = { 0xb100, 16, 0x7, IMX8MQ_CLK_USB_CORE_REF_CG },
+ [IMX8MQ_CLK_USB_CORE_REF_DIV] = { 0xb100, 0, 0x3f, IMX8MQ_CLK_USB_CORE_REF_PRE_DIV },
+ [IMX8MQ_CLK_USB_PHY_REF_PRE_DIV] = { 0xb180, 16, 0x7, IMX8MQ_CLK_USB_PHY_REF_CG },
+ [IMX8MQ_CLK_USB_PHY_REF_DIV] = { 0xb180, 0, 0x3f, IMX8MQ_CLK_USB_PHY_REF_PRE_DIV },
+ [IMX8MQ_CLK_PCIE2_CTRL_PRE_DIV] = { 0xc000, 16, 0x7, IMX8MQ_CLK_PCIE2_CTRL_CG },
+ [IMX8MQ_CLK_PCIE2_CTRL_DIV] = { 0xc000, 0, 0x3f, IMX8MQ_CLK_PCIE2_CTRL_PRE_DIV },
+ [IMX8MQ_CLK_PCIE2_PHY_PRE_DIV] = { 0xc080, 16, 0x7, IMX8MQ_CLK_PCIE2_CTRL_CG },
+ [IMX8MQ_CLK_PCIE2_PHY_DIV] = { 0xc080, 0, 0x3f, IMX8MQ_CLK_PCIE2_CTRL_PRE_DIV },
+ [IMX8MQ_CLK_PCIE2_AUX_PRE_DIV] = { 0xc100, 16, 0x7, IMX8MQ_CLK_PCIE2_AUX_CG },
+ [IMX8MQ_CLK_PCIE2_AUX_DIV] = { 0xc100, 0, 0x3f, IMX8MQ_CLK_PCIE2_AUX_PRE_DIV },
+};
+
+struct imxccm_mux imx8mq_muxs[] =
+{
+ [IMX8MQ_CLK_A53_SRC] = { 0x8000, 24, 0x7 },
+ [IMX8MQ_CLK_ENET_AXI_SRC] = { 0x8880, 24, 0x7 },
+ [IMX8MQ_CLK_USB_BUS_SRC] = { 0x8b80, 24, 0x7 },
+ [IMX8MQ_CLK_PCIE1_CTRL_SRC] = { 0xa300, 24, 0x7 },
+ [IMX8MQ_CLK_PCIE1_PHY_SRC] = { 0xa380, 24, 0x7 },
+ [IMX8MQ_CLK_PCIE1_AUX_SRC] = { 0xa400, 24, 0x7 },
+ [IMX8MQ_CLK_ENET_REF_SRC] = { 0xa980, 24, 0x7 },
+ [IMX8MQ_CLK_ENET_TIMER_SRC] = { 0xaa00, 24, 0x7 },
+ [IMX8MQ_CLK_ENET_PHY_REF_SRC] = { 0xaa80, 24, 0x7 },
+ [IMX8MQ_CLK_USDHC1_SRC] = { 0xac00, 24, 0x7 },
+ [IMX8MQ_CLK_USDHC2_SRC] = { 0xac80, 24, 0x7 },
+ [IMX8MQ_CLK_I2C1_SRC] = { 0xad00, 24, 0x7 },
+ [IMX8MQ_CLK_I2C2_SRC] = { 0xad80, 24, 0x7 },
+ [IMX8MQ_CLK_I2C3_SRC] = { 0xae00, 24, 0x7 },
+ [IMX8MQ_CLK_I2C4_SRC] = { 0xae80, 24, 0x7 },
+ [IMX8MQ_CLK_UART1_SRC] = { 0xaf00, 24, 0x7 },
+ [IMX8MQ_CLK_UART2_SRC] = { 0xaf80, 24, 0x7 },
+ [IMX8MQ_CLK_UART3_SRC] = { 0xb000, 24, 0x7 },
+ [IMX8MQ_CLK_UART4_SRC] = { 0xb080, 24, 0x7 },
+ [IMX8MQ_CLK_USB_CORE_REF_SRC] = { 0xb100, 24, 0x7 },
+ [IMX8MQ_CLK_USB_PHY_REF_SRC] = { 0xb180, 24, 0x7 },
+ [IMX8MQ_CLK_PCIE2_CTRL_SRC] = { 0xc000, 24, 0x7 },
+ [IMX8MQ_CLK_PCIE2_PHY_SRC] = { 0xc080, 24, 0x7 },
+ [IMX8MQ_CLK_PCIE2_AUX_SRC] = { 0xc100, 24, 0x7 },
+};