summaryrefslogtreecommitdiff
path: root/sys/src/9/imx8/iomux.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2022-06-13 19:48:01 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2022-06-13 19:48:01 +0000
commit8dd05d041ed65e8c74c23baccaf99ba6ad424c39 (patch)
treed96583b4d3968496909a61d012ff1fad3f1e6e64 /sys/src/9/imx8/iomux.c
parent5388575c149445928b2eb98794998225ecf1ccfa (diff)
imx8: provide iomuxgpr() function to access iomuxc's gpr's
Diffstat (limited to 'sys/src/9/imx8/iomux.c')
-rw-r--r--sys/src/9/imx8/iomux.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/src/9/imx8/iomux.c b/sys/src/9/imx8/iomux.c
index b023649c5..9aed7562c 100644
--- a/sys/src/9/imx8/iomux.c
+++ b/sys/src/9/imx8/iomux.c
@@ -15,6 +15,8 @@ enum {
IOMUXC_SW_PAD_CTL_PAD_TEST_MODE = 0x254/4,
IOMUXC_CCM_PMIC_READY_SELECT_INPUT = 0x4BC/4,
+
+ IOMUXC_GPR_GPR0 = 0x10000/4,
};
enum {
@@ -1123,3 +1125,15 @@ Muxok:
// iprint("iomuxpad: %s_input_select %p <= %.8ux & %.8ux\n", signame[sig], PADDR(reg), val, mask);
*reg = (*reg & ~mask) | val;
}
+
+uint
+iomuxgpr(int gpr, uint set, uint mask)
+{
+ u32int *reg = &iomuxc[IOMUXC_GPR_GPR0 + gpr];
+
+ if(mask == 0)
+ return *reg;
+
+// iprint("iomuxgpr: gpr%d %p <= %.8ux & %.8ux\n", gpr, PADDR(reg), set, mask);
+ return *reg = (*reg & ~mask) | (set & mask);
+}