diff options
author | Evan Lojewski <github@meklort.com> | 2020-02-08 13:15:14 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-08 13:15:14 -0700 |
commit | 21a0b16483c5df070bcdb3d19b9ff7d9e0b7d849 (patch) | |
tree | 02057065d11eb3e482c025a73cbf9445012f2501 /ape | |
parent | b5e14fd732fd1af3f59ba40c6e72ef10b261a76e (diff) | |
download | bcm5719-ortega-21a0b16483c5df070bcdb3d19b9ff7d9e0b7d849.tar.gz bcm5719-ortega-21a0b16483c5df070bcdb3d19b9ff7d9e0b7d849.zip |
ape: Add reset procedure to finish resetting the PCIe/RX CPU blocks. (#30)
Diffstat (limited to 'ape')
-rw-r--r-- | ape/main.c | 44 |
1 files changed, 43 insertions, 1 deletions
@@ -208,9 +208,51 @@ void __attribute__((noreturn)) loaderLoop(void) } } +void handle_reset(void) +{ + uint32_t chip_id = DEVICE.ChipId.r32; + if (!chip_id) + { + printf("Resetting...\n"); + RegAPEGpio_t apegpio; + apegpio.r32 = APE.Gpio.r32; + + // Reset needed. + // Configure the clock mux to be driving by the APE. + apegpio.bits.PIN0ModeOutput = 1; + apegpio.bits.PIN1ModeOutput = 1; + apegpio.bits.PIN2ModeOutput = 1; + apegpio.bits.PIN0UnknownOut = 1; // Clock_P + apegpio.bits.PIN1UnknownOut = 0; // Clock_N + apegpio.bits.PIN2UnknownOut = 1; // CLock Mux = APE GPIO + APE.Gpio.r32 = apegpio.r32; + + for (int i = 0; i < 38; i++) + { + // Clock it... + apegpio.bits.PIN0UnknownOut = ~apegpio.bits.PIN0UnknownOut; // Clock_P + apegpio.bits.PIN1UnknownOut = ~apegpio.bits.PIN1UnknownOut; // Clock_N + APE.Gpio.r32 = apegpio.r32; + } + + do + { + // Wait for the ChipID register to be readable + chip_id = DEVICE.ChipId.r32; + } while (!chip_id); + + // Restore the mux settings. + apegpio.bits.PIN2UnknownOut = 0; // CLock Mux = PCIe clock + APE.Gpio.r32 = apegpio.r32; + + // The RX CPUs should not be executing and booting from NVRam + } +} + void __attribute__((noreturn)) __start() { - printf("----------------\n"); + handle_reset(); + APE_releaseAllLocks(); NVRam_releaseAllLocks(); |