-# XXX: remove this check later when we have PCI support properly detected on all targets
-ifneq ($(CONFIG_TARGET_ar7)$(CONFIG_TARGET_uml),)
- BUS:=
-endif
-
-ifeq ($(ARCH),mips)
- HAL_TARGET:=mips-be-elf
-endif
-ifeq ($(ARCH),mipsel)
- HAL_TARGET:=mips-le-elf
+ifneq ($(CONFIG_CPU_MIPS32_R2),)
+ ifeq ($(ARCH),mips)
+ HAL_TARGET:=mips32r2-be-elf
+ endif
+ ifeq ($(ARCH),mipsel)
+ HAL_TARGET:=mips32r2-le-elf
+ endif
+else
+ ifeq ($(ARCH),mips)
+ HAL_TARGET:=$(if $(CONFIG_MADWIFI_UPSTREAM),mips-be-elf,mips32-be-elf)
+ endif
+ ifeq ($(ARCH),mipsel)
+ HAL_TARGET:=$(if $(CONFIG_MADWIFI_UPSTREAM),mips-le-elf,mips32-le-elf)
+ endif