diff --git a/soc/powerpc/CMakeLists.txt b/soc/powerpc/CMakeLists.txt index cc6e9318b6c38834cf23663b88fb3c0935ebd089..405dc077a1bcd905f5876a18285bb20178f1f2e9 100644 --- a/soc/powerpc/CMakeLists.txt +++ b/soc/powerpc/CMakeLists.txt @@ -1,7 +1,7 @@ # SPDX-License-Identifier: Apache-2.0 -#if(SOC_FAMILY) -#add_subdirectory(${SOC_FAMILY}) -#else() -#add_subdirectory(${SOC_NAME}) -#endif() +if(SOC_FAMILY) +add_subdirectory(${SOC_FAMILY}) +else() +add_subdirectory(${SOC_NAME}) +endif() diff --git a/soc/powerpc/litex-kestrel/CMakeLists.txt b/soc/powerpc/litex-kestrel/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..e23bdf2629e70b2d1edf795db12ca8ea59cfc330 --- /dev/null +++ b/soc/powerpc/litex-kestrel/CMakeLists.txt @@ -0,0 +1,9 @@ +# +# Copyright (c) 2021 Raptor Engineering, LLC <sales@raptorengineering.com> +# +# SPDX-License-Identifier: Apache-2.0 +# + +zephyr_sources( + soc.c +) diff --git a/soc/powerpc/litex-kestrel/soc.c b/soc/powerpc/litex-kestrel/soc.c index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b04b7449fbfd428aad3f15aec5381df830308521 100644 --- a/soc/powerpc/litex-kestrel/soc.c +++ b/soc/powerpc/litex-kestrel/soc.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 Raptor Engineering, LLC <sales@raptorengineering.com> + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include <kernel.h> +#include <init.h> +#include <device.h> +#include <logging/log.h> + +#define LOG_LEVEL CONFIG_SOC_LOG_LEVEL +LOG_MODULE_REGISTER(soc); + +#ifdef CONFIG_OPENPOWER_LITEX_IRQ +extern void microwatt_irq_set_base(void *ivt_base); +#endif + +// SoC base controller information +#define SOC_CTL_BASE DT_REG_ADDR(DT_INST(0, litex_soc_controller)) + +// Overrides the weak PowerPC implementation +// Reboot SoC +void sys_arch_reboot(int type) +{ + // Shut down interrupts + irq_lock(); + + // Reset IRQ vector table base address +#ifdef CONFIG_OPENPOWER_LITEX_IRQ + microwatt_irq_set_base(0x0); +#endif + + // Hard reboot + *((uint8_t*)(SOC_CTL_BASE)) = 1; +}