fix backwards compatibility with software that exclusively uses the old SPI interface

fix PXI acknowledgement bug that prevented older GM9 from booting
This commit is contained in:
Wolfvak 2019-07-19 15:35:20 -03:00 committed by d0k3
parent 3061da4dcc
commit 07b2a2beb6
5 changed files with 17 additions and 5 deletions

View File

@ -172,14 +172,14 @@ void MCU_HandleInterrupts(u32 __attribute__((unused)) irqn)
case MCU_SHELL_OPEN:
MCU_PushToLCD(true);
MCU_UpdateShellState(true);
TIMER_WaitTicks(CLK_MS_TO_TICKS(10));
TIMER_WaitTicks(CLK_MS_TO_TICKS(5));
MCU_ResetLED();
break;
case MCU_SHELL_CLOSE:
MCU_PushToLCD(false);
MCU_UpdateShellState(false);
TIMER_WaitTicks(CLK_MS_TO_TICKS(10));
TIMER_WaitTicks(CLK_MS_TO_TICKS(5));
break;
case MCU_VOL_SLIDER:
@ -196,7 +196,7 @@ void MCU_HandleInterrupts(u32 __attribute__((unused)) irqn)
void MCU_Init(void)
{
u32 mask = 0xFFBF0800;
const u32 mask = 0xFFBF0800;
MCU_WriteRegBuf(REG_INT_EN, (const u8*)&mask, sizeof(mask));
MCU_ResetLED();

View File

@ -126,3 +126,10 @@ void SPI_Init(void)
// interface used during the NDS days
*REG_CFG_SPI_CNT = 7;
}
void SPI_Deinit(void)
{
// Keep backwards compatibility with software that
// assumes all bus interfaces will be set to old
*REG_CFG_SPI_CNT = 0;
}

View File

@ -29,3 +29,4 @@ typedef struct {
int SPI_DoXfer(u32 dev, const SPI_XferInfo *xfer, u32 xfer_cnt);
void SPI_Init(void);
void SPI_Deinit(void);

View File

@ -118,7 +118,7 @@ void SYS_CoreZeroInit(void)
GPU_SetFramebufferMode(1, PDC_RGB24);
MCU_PushToLCD(true);
TIMER_WaitTicks(CLK_MS_TO_TICKS(10));
TIMER_WaitTicks(CLK_MS_TO_TICKS(5));
}
void SYS_CoreInit(void)
@ -163,6 +163,8 @@ void __attribute__((noreturn)) SYS_CoreShutdown(void)
ARM_SetACR(ARM_GetACR() &
~(ACR_RETSTK | ACR_DBPRED | ACR_SBPRED | ACR_FOLDING | ACR_SMP));
SPI_Deinit();
if (!core) {
while(*LEGACY_BOOT_ENTRYPOINT == 0);
((void (*)(void))(*LEGACY_BOOT_ENTRYPOINT))();

View File

@ -68,6 +68,7 @@ enum {
#define PXI_CNT_RECV_FIFO_EMPTY (BIT(8))
#define PXI_CNT_RECV_FIFO_FULL (BIT(9))
#define PXI_CNT_RECV_FIFO_AVAIL_IRQ (BIT(10))
#define PXI_CNT_ACKNOWLEDGE_ERROR (BIT(14))
#define PXI_CNT_ENABLE_FIFO (BIT(15))
static inline void PXI_SetRemote(u8 msg)
@ -93,7 +94,8 @@ static inline void PXI_Reset(void)
*PXI_RECV;
*PXI_CNT = 0;
*PXI_CNT = PXI_CNT_RECV_FIFO_AVAIL_IRQ | PXI_CNT_ENABLE_FIFO;
*PXI_CNT = PXI_CNT_RECV_FIFO_AVAIL_IRQ | PXI_CNT_ENABLE_FIFO |
PXI_CNT_ACKNOWLEDGE_ERROR;
PXI_SetRemote(0xFF);
}