From 4327cbc9b8886ec0697086d2a91cdff0d698e172 Mon Sep 17 00:00:00 2001 From: Mihail Zenkov Date: Sun, 17 Apr 2016 16:31:33 +0000 Subject: C2X0v2: use GPIO to check button state in dualboot C240v2 freeze on booting OF if SD card inserted. Use GPIO instead DBOP should help. Change-Id: Idec0028040f91c6d2c7c04327ca0e1af204f58eb --- rbutil/mkamsboot/dualboot/dualboot.S | 63 ++++++------------------------------ 1 file changed, 9 insertions(+), 54 deletions(-) (limited to 'rbutil/mkamsboot') diff --git a/rbutil/mkamsboot/dualboot/dualboot.S b/rbutil/mkamsboot/dualboot/dualboot.S index 4e4dbe5505..d5bb6610c1 100644 --- a/rbutil/mkamsboot/dualboot/dualboot.S +++ b/rbutil/mkamsboot/dualboot/dualboot.S @@ -28,9 +28,7 @@ .set GPIOD, 0xC80E0000 .set CGU_PROC, 0xC80F0010 .set CGU_PERI, 0xC80F0014 -.set CGU_DBOP, 0xC80F0038 .set CCU_IO, 0xC810000C -.set DBOP, 0xC8120000 .set I2C_BASE, 0xC8070000 .set I2C_DATA, 0x00 .set I2C_SLAD0, 0x04 @@ -149,6 +147,15 @@ uclcopy: cmp r1, #0 /* C3 = #0 means button pressed */ beq boot_of +#elif defined(SANSA_C200V2) + ldr r0, =GPIOC + mov r1, #0 + str r1, [r0, #0x400] + ldr r1, [r0, #0x10] /* read pin C2 */ + + cmp r1, #0 /* C2 = #0 means button pressed */ + beq boot_of + #elif defined(SANSA_FUZEV2) ldr r0, =GPIOC mov r1, #0 @@ -200,58 +207,6 @@ uclcopy: cmp r1, #0 bne boot_of -#elif defined(SANSA_C200V2) -.set BUTTON_LEFT, (1<< 2) -.set BUTTON_DOWN, (1<< 3) -.set BUTTON_SELECT, (1<< 4) -.set BUTTON_UP, (1<< 5) -.set BUTTON_RIGHT, (1<< 6) -.set BUTTON_HOLD, (1<<12) - - ldr r0, =CGU_DBOP - mov r1, #(1<<3) @ DBOP freq = PCLK, clock enabled - str r1, [r0] - - @ AFSEL needs to be set for this to work - ldr r2, =GPIOB - mov r1, #0xc - str r1, [r2, #0x420] @ GPIOB_AFSEL - ldr r2, =GPIOC - mov r1, #0xff - str r1, [r2, #0x420] @ GPIOC_AFSEL - - ldr r0, =DBOP - @ TIMPOL doesn't matter here since we don't need - @ the control signals. - - @ 16 bit data width - @ enable write - @ tri-state output - ldr r1, =0x00091000 - str r1, [r0, #8] @ DBOP_CTRL - - ldr r1, =0xf0ff @ precharge - str r1, [r0, #0x10] @ DBOP_DOUT - -2: ldr r1, [r0, #0xc] @ DOBP_STAT - ands r1, r1, #(1<<10) - beq 2b @ make sure fifo is empty - - @ 16 bit data width - @ start read - @ tri-state output - @ strobe time 31 - ldr r1, =0x0008901f - str r1, [r0, #8] @ DBOP_CTRL - -3: ldr r1, [r0, #0xc] @ DOBP_STAT - ands r1, r1, #(1<<16) - beq 3b @ wait for valid data - - ldrh r1, [r0, #0x14] @ DBOP_DIN - - tst r1, #BUTTON_LEFT @ boot of? - beq boot_of #elif defined(SANSA_M200V4) .set row, (1<<5) /* enable output on A5 */ .set col, (1<<0) /* read keyscan column A0 */ -- cgit v1.2.3