aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-03-13 17:15:46 -0400
committerTom Rini <trini@konsulko.com>2024-03-13 17:15:46 -0400
commita81242099c56a0680658a3420f2a7ede08db2c14 (patch)
tree9dc2c39e0ab3bc939c565f4514773dc68f1188ea
parent7422f661e25afc1343e529a7128ae336988449fb (diff)
parent6806a133cde6f99777925953ee046bf2f050d4ef (diff)
Merge tag 'mips-fixes-for-v2024.04' of https://source.denx.de/u-boot/custodians/u-boot-mips
- mips: implement __udivdi3 to fix building of SquashFS - mips: fix bug in cache init on MIPS32r2 or later
-rw-r--r--arch/mips/lib/Makefile2
-rw-r--r--arch/mips/lib/cache_init.S4
-rw-r--r--arch/mips/lib/udivdi3.c17
3 files changed, 20 insertions, 3 deletions
diff --git a/arch/mips/lib/Makefile b/arch/mips/lib/Makefile
index 9ee1fcb5c7..1621cc9a1f 100644
--- a/arch/mips/lib/Makefile
+++ b/arch/mips/lib/Makefile
@@ -14,4 +14,4 @@ obj-$(CONFIG_CMD_BOOTM) += bootm.o
obj-$(CONFIG_CMD_GO) += boot.o
obj-$(CONFIG_SPL_BUILD) += spl.o
-lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o
+lib-$(CONFIG_USE_PRIVATE_LIBGCC) += ashldi3.o ashrdi3.o lshrdi3.o udivdi3.o
diff --git a/arch/mips/lib/cache_init.S b/arch/mips/lib/cache_init.S
index 602741c65d..d64209d76a 100644
--- a/arch/mips/lib/cache_init.S
+++ b/arch/mips/lib/cache_init.S
@@ -431,9 +431,9 @@ LEAF(change_k0_cca)
#else
xor a0, a0, t0
andi a0, a0, CONF_CM_CMASK
- xor a0, a0, t0
+ xor t0, a0, t0
#endif
- mtc0 a0, CP0_CONFIG
+ mtc0 t0, CP0_CONFIG
jr.hb ra
END(change_k0_cca)
diff --git a/arch/mips/lib/udivdi3.c b/arch/mips/lib/udivdi3.c
new file mode 100644
index 0000000000..4d780117cf
--- /dev/null
+++ b/arch/mips/lib/udivdi3.c
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include "libgcc.h"
+
+#if BITS_PER_LONG == 32
+
+#include <div64.h>
+
+long long __udivdi3(long long u, word_type b)
+{
+ long long ret = u;
+
+ __div64_32(&ret, b);
+ return ret;
+}
+
+#endif /* BITS_PER_LONG == 32 */