summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMihail Zenkov <mihail.zenkov@gmail.com>2016-05-04 01:34:08 +0000
committerMihail Zenkov <mihail.zenkov@gmail.com>2016-05-04 01:34:08 +0000
commit2a1e9eb8a8f50f636f86988de1f0cd1b3acf55bb (patch)
tree0fcf6c2c32d7b74d1f72fb359e5ed3a98c7dff7b
parent4327cbc9b8886ec0697086d2a91cdff0d698e172 (diff)
downloadrockbox-2a1e9eb.tar.gz
rockbox-2a1e9eb.tar.bz2
rockbox-2a1e9eb.zip
Reverting 4327cbc9b8886e
I do testing incorrectly: fix don't work as expected. Change-Id: Ie32672ec213861c02295ae0a14e22b9ca9035585
-rw-r--r--rbutil/mkamsboot/dualboot/dualboot.S63
1 files changed, 54 insertions, 9 deletions
diff --git a/rbutil/mkamsboot/dualboot/dualboot.S b/rbutil/mkamsboot/dualboot/dualboot.S
index d5bb6610c1..4e4dbe5505 100644
--- a/rbutil/mkamsboot/dualboot/dualboot.S
+++ b/rbutil/mkamsboot/dualboot/dualboot.S
@@ -28,7 +28,9 @@
.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
@@ -147,15 +149,6 @@ 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
@@ -207,6 +200,58 @@ 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 */