Fix RK3588 support. Makes dwmmc(4) actually work.
authorkettenis <kettenis@openbsd.org>
Mon, 19 Jun 2023 13:37:22 +0000 (13:37 +0000)
committerkettenis <kettenis@openbsd.org>
Mon, 19 Jun 2023 13:37:22 +0000 (13:37 +0000)
ok patrick@

sys/dev/fdt/rkpinctrl.c

index b98a88d..36db072 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rkpinctrl.c,v 1.11 2023/03/04 22:51:12 kettenis Exp $ */
+/*     $OpenBSD: rkpinctrl.c,v 1.12 2023/06/19 13:37:22 kettenis Exp $ */
 /*
  * Copyright (c) 2017, 2018 Mark Kettenis <kettenis@openbsd.org>
  *
@@ -1174,9 +1174,9 @@ rk3588_pinctrl(uint32_t phandle, void *cookie)
                bank = pins[i];
                idx = pins[i + 1];
                mux = pins[i + 2];
-               pull = rk3568_pull(bank, idx, pins[i + 3]);
-               strength = rk3568_strength(bank, idx, pins[i + 3]);
-               schmitt = rk3568_schmitt(bank, idx, pins[i + 3]);
+               pull = rk3588_pull(bank, idx, pins[i + 3]);
+               strength = rk3588_strength(bank, idx, pins[i + 3]);
+               schmitt = rk3588_schmitt(bank, idx, pins[i + 3]);
 
                if (bank > 5 || idx > 32 || mux > 15)
                        continue;
@@ -1237,7 +1237,7 @@ rk3588_pinctrl(uint32_t phandle, void *cookie)
                if (strength >= 0) {
                        off = bank * 0x20 + (idx / 4) * 0x04;
                        mask = (0xf << ((idx % 4) * 4));
-                       bits = ((1 << (strength + 1)) - 1) << ((idx % 4) * 4);
+                       bits = (strength << ((idx % 4) * 4));
                        regmap_write_4(rm, ds_base + off, mask << 16 | bits);
                }
 
@@ -1245,7 +1245,7 @@ rk3588_pinctrl(uint32_t phandle, void *cookie)
                if (schmitt >= 0) {
                        off = bank * 0x10 + (idx / 8) * 0x04;
                        mask = (0x1 << (idx % 8));
-                       bits = schmitt << (idx % 8);
+                       bits = (schmitt << (idx % 8));
                        regmap_write_4(rm, smt_base + off, mask << 16 | bits);
                }