diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-03-09 16:29:38 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-03-09 16:29:38 +0000 |
commit | 1f251ea30dbcd23494e5981d6ef21f18211096f2 (patch) | |
tree | 418a9c7abe82263ef8c51393e6493accfa3db993 | |
parent | 8d720f4d4e956a0c97466def1f3600ae5c10f268 (diff) | |
download | rockbox-1f251ea30dbcd23494e5981d6ef21f18211096f2.tar.gz rockbox-1f251ea30dbcd23494e5981d6ef21f18211096f2.zip |
mkamsboot: Use audio master irq_enrd0 usb_status bit instead of gpio on C200V2
FlySpray: FS#11085
Author: Tobias Diedrich
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25088 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | rbutil/mkamsboot/dualboot.c | 28 | ||||
-rw-r--r-- | rbutil/mkamsboot/dualboot.h | 2 | ||||
-rw-r--r-- | rbutil/mkamsboot/dualboot/dualboot.S | 77 |
3 files changed, 91 insertions, 16 deletions
diff --git a/rbutil/mkamsboot/dualboot.c b/rbutil/mkamsboot/dualboot.c index db94aaa1bf..aab9a18c36 100644 --- a/rbutil/mkamsboot/dualboot.c +++ b/rbutil/mkamsboot/dualboot.c | |||
@@ -50,22 +50,28 @@ unsigned char dualboot_e200v2[236] = { | |||
50 | 0x01, 0x00, 0x83, 0xe2, 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00, | 50 | 0x01, 0x00, 0x83, 0xe2, 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00, |
51 | 0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x00, 0x00, 0x0d, 0xc8 | 51 | 0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x00, 0x00, 0x0d, 0xc8 |
52 | }; | 52 | }; |
53 | unsigned char dualboot_c200v2[236] = { | 53 | unsigned char dualboot_c200v2[336] = { |
54 | 0xd4, 0xf0, 0x9f, 0xe5, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, | 54 | 0x38, 0xf1, 0x9f, 0xe5, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, |
55 | 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, | 55 | 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, |
56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 56 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x1f, 0xe5, | 57 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x1f, 0xe5, |
58 | 0x24, 0x10, 0x1f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 0x18, 0x30, 0x1f, 0xe5, 0x01, 0x40, 0x50, 0xe4, | 58 | 0x24, 0x10, 0x1f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 0x18, 0x30, 0x1f, 0xe5, 0x01, 0x40, 0x50, 0xe4, |
59 | 0x01, 0x40, 0x43, 0xe4, 0x00, 0x00, 0x52, 0xe1, 0xfb, 0xff, 0xff, 0x1a, 0x2c, 0x30, 0x0f, 0xe5, | 59 | 0x01, 0x40, 0x43, 0xe4, 0x00, 0x00, 0x52, 0xe1, 0xfb, 0xff, 0xff, 0x1a, 0x2c, 0x30, 0x0f, 0xe5, |
60 | 0x78, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x01, 0x18, 0x81, 0xe3, 0x00, 0x10, 0x80, 0xe5, | 60 | 0xdc, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x01, 0x18, 0x81, 0xe3, 0x00, 0x10, 0x80, 0xe5, |
61 | 0x6c, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, 0x00, 0x14, 0x80, 0xe5, 0x08, 0x10, 0x90, 0xe5, | 61 | 0xcc, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0x90, 0xe5, 0x02, 0x18, 0x81, 0xe3, 0x7f, 0x10, 0xc1, 0xe3, |
62 | 0x00, 0x00, 0x51, 0xe3, 0x08, 0x00, 0x00, 0x1a, 0x58, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, | 62 | 0x00, 0x10, 0x80, 0xe5, 0xbc, 0x00, 0x9f, 0xe5, 0x00, 0x10, 0xa0, 0xe3, 0x24, 0x10, 0x80, 0xe5, |
63 | 0x00, 0x14, 0x80, 0xe5, 0x00, 0x11, 0x90, 0xe5, 0x00, 0x00, 0x51, 0xe3, 0x02, 0x00, 0x00, 0x0a, | 63 | 0x3c, 0x10, 0xa0, 0xe3, 0x1c, 0x10, 0x80, 0xe5, 0x00, 0x10, 0xa0, 0xe3, 0x20, 0x10, 0x80, 0xe5, |
64 | 0x78, 0x00, 0x1f, 0xe5, 0x78, 0x10, 0x1f, 0xe5, 0x01, 0x00, 0x00, 0xea, 0x8c, 0x00, 0x1f, 0xe5, | 64 | 0x8c, 0x10, 0xa0, 0xe3, 0x04, 0x10, 0x80, 0xe5, 0x51, 0x20, 0xa0, 0xe3, 0x0c, 0x20, 0x80, 0xe5, |
65 | 0x8c, 0x10, 0x1f, 0xe5, 0x84, 0x30, 0x1f, 0xe5, 0x02, 0x50, 0x83, 0xe2, 0x01, 0x40, 0x43, 0xe0, | 65 | 0x30, 0x10, 0x90, 0xe5, 0x01, 0x00, 0x11, 0xe3, 0xfc, 0xff, 0xff, 0x1a, 0x25, 0x10, 0xa0, 0xe3, |
66 | 0x01, 0x20, 0x50, 0xe4, 0x01, 0x20, 0x43, 0xe4, 0x04, 0x00, 0x53, 0xe1, 0xfb, 0xff, 0xff, 0x1a, | 66 | 0x44, 0x10, 0x80, 0xe5, 0x02, 0x20, 0x82, 0xe3, 0x0c, 0x20, 0x80, 0xe5, 0x01, 0x10, 0xa0, 0xe3, |
67 | 0x01, 0x00, 0x83, 0xe2, 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, 0x3c, 0x00, 0x00, 0x00, | 67 | 0x10, 0x10, 0x80, 0xe5, 0x10, 0x10, 0x90, 0xe5, 0x00, 0x00, 0x51, 0xe3, 0xfc, 0xff, 0xff, 0x1a, |
68 | 0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x0b, 0xc8, 0x00, 0x00, 0x0d, 0xc8 | 68 | 0x00, 0x10, 0x90, 0xe5, 0x08, 0x00, 0x11, 0xe3, 0x08, 0x00, 0x00, 0x1a, 0x58, 0x00, 0x9f, 0xe5, |
69 | 0x00, 0x10, 0xa0, 0xe3, 0x00, 0x14, 0x80, 0xe5, 0x00, 0x11, 0x90, 0xe5, 0x00, 0x00, 0x51, 0xe3, | ||
70 | 0x02, 0x00, 0x00, 0x0a, 0xdc, 0x00, 0x1f, 0xe5, 0xdc, 0x10, 0x1f, 0xe5, 0x01, 0x00, 0x00, 0xea, | ||
71 | 0xf0, 0x00, 0x1f, 0xe5, 0xf0, 0x10, 0x1f, 0xe5, 0xe8, 0x30, 0x1f, 0xe5, 0x02, 0x50, 0x83, 0xe2, | ||
72 | 0x01, 0x40, 0x43, 0xe0, 0x01, 0x20, 0x50, 0xe4, 0x01, 0x20, 0x43, 0xe4, 0x04, 0x00, 0x53, 0xe1, | ||
73 | 0xfb, 0xff, 0xff, 0x1a, 0x01, 0x00, 0x83, 0xe2, 0x00, 0x20, 0xa0, 0xe3, 0x15, 0xff, 0x2f, 0xe1, | ||
74 | 0x3c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x0f, 0xc8, 0x00, 0x00, 0x07, 0xc8, 0x00, 0x00, 0x0d, 0xc8 | ||
69 | }; | 75 | }; |
70 | unsigned char dualboot_m200v4[212] = { | 76 | unsigned char dualboot_m200v4[212] = { |
71 | 0xc0, 0xf0, 0x9f, 0xe5, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, | 77 | 0xc0, 0xf0, 0x9f, 0xe5, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, 0xfe, 0xff, 0xff, 0xea, |
diff --git a/rbutil/mkamsboot/dualboot.h b/rbutil/mkamsboot/dualboot.h index d67ad2b6d1..57306def10 100644 --- a/rbutil/mkamsboot/dualboot.h +++ b/rbutil/mkamsboot/dualboot.h | |||
@@ -3,7 +3,7 @@ | |||
3 | extern unsigned char nrv2e_d8[168]; | 3 | extern unsigned char nrv2e_d8[168]; |
4 | extern unsigned char dualboot_clip[256]; | 4 | extern unsigned char dualboot_clip[256]; |
5 | extern unsigned char dualboot_e200v2[236]; | 5 | extern unsigned char dualboot_e200v2[236]; |
6 | extern unsigned char dualboot_c200v2[236]; | 6 | extern unsigned char dualboot_c200v2[336]; |
7 | extern unsigned char dualboot_m200v4[212]; | 7 | extern unsigned char dualboot_m200v4[212]; |
8 | extern unsigned char dualboot_fuze[236]; | 8 | extern unsigned char dualboot_fuze[236]; |
9 | extern unsigned char dualboot_clipv2[280]; | 9 | extern unsigned char dualboot_clipv2[280]; |
diff --git a/rbutil/mkamsboot/dualboot/dualboot.S b/rbutil/mkamsboot/dualboot/dualboot.S index d1a9721f9f..8bb2059d78 100644 --- a/rbutil/mkamsboot/dualboot/dualboot.S +++ b/rbutil/mkamsboot/dualboot/dualboot.S | |||
@@ -27,7 +27,26 @@ | |||
27 | .set GPIOC, 0xC80D0000 | 27 | .set GPIOC, 0xC80D0000 |
28 | .set GPIOD, 0xC80E0000 | 28 | .set GPIOD, 0xC80E0000 |
29 | .set CGU_PERI, 0xC80F0014 | 29 | .set CGU_PERI, 0xC80F0014 |
30 | 30 | .set I2C_BASE, 0xC8070000 | |
31 | .set I2C_DATA, 0x00 | ||
32 | .set I2C_SLAD0, 0x04 | ||
33 | .set I2C_CNTRL, 0x0c | ||
34 | .set I2C_DACNT, 0x10 | ||
35 | .set I2C_CPSR0, 0x1c | ||
36 | .set I2C_CPSR1, 0x20 | ||
37 | .set I2C_IMR, 0x24 | ||
38 | .set I2C_SR, 0x30 | ||
39 | .set I2C_SADDR, 0x44 | ||
40 | .set AS3514_I2C_ADDR, 0x46 | ||
41 | .set AS3514_IRQ_ENRD0, 0x25 | ||
42 | .set PCLK, 24000000 | ||
43 | .set I2C_CLK, 400000 | ||
44 | .set I2C_PRESCALER, ((PCLK + I2C_CLK -1) / I2C_CLK) | ||
45 | .set I2C_PRESCALER_LOW, (I2C_PRESCALER & 0xff) | ||
46 | .set I2C_PRESCALER_HIGH, (I2C_PRESCALER >> 8) | ||
47 | #if I2C_PRESCALER_HIGH > 3 | ||
48 | #error i2c prescaler too big! | ||
49 | #endif | ||
31 | 50 | ||
32 | /* Vectors */ | 51 | /* Vectors */ |
33 | 52 | ||
@@ -80,9 +99,7 @@ uclcopy: | |||
80 | 99 | ||
81 | 100 | ||
82 | /* TODO : M200V4 ? */ | 101 | /* TODO : M200V4 ? */ |
83 | #if defined(SANSA_C200V2) | 102 | #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) |
84 | #define USB_PIN 1 /* FIXME: not correct on some c200v2s */ | ||
85 | #elif defined(SANSA_CLIP) || defined(SANSA_CLIPV2) | ||
86 | #define USB_PIN 6 | 103 | #define USB_PIN 6 |
87 | #elif defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2) | 104 | #elif defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2) |
88 | #define USB_PIN 3 | 105 | #define USB_PIN 3 |
@@ -96,6 +113,58 @@ uclcopy: | |||
96 | cmp r1, #0 | 113 | cmp r1, #0 |
97 | bne boot_of | 114 | bne boot_of |
98 | #endif | 115 | #endif |
116 | #if defined(SANSA_C200V2) | ||
117 | /* Instead of checking the GPIO, check the audio master IRQ_ENRD0 | ||
118 | * USB_STATUS bit on C200V2 */ | ||
119 | |||
120 | ldr r0, =CGU_PERI | ||
121 | ldr r1, [r0] | ||
122 | /* enable i2c audio master clock */ | ||
123 | orr r1, r1, #(1<<17) | ||
124 | /* make sure 24MHz clk_main is selected */ | ||
125 | bic r1, r1, #0x7f | ||
126 | str r1, [r0] | ||
127 | |||
128 | ldr r0, =I2C_BASE | ||
129 | /* disable i2c interrupts */ | ||
130 | mov r1, #0 | ||
131 | str r1, [r0, #I2C_IMR] | ||
132 | /* setup prescaler */ | ||
133 | mov r1, #I2C_PRESCALER_LOW | ||
134 | str r1, [r0, #I2C_CPSR0] | ||
135 | mov r1, #I2C_PRESCALER_HIGH | ||
136 | str r1, [r0, #I2C_CPSR1] | ||
137 | /* setup i2c slave address */ | ||
138 | mov r1, #(AS3514_I2C_ADDR << 1) | ||
139 | str r1, [r0, #I2C_SLAD0] | ||
140 | mov r2, #0x51 | ||
141 | str r2, [r0, #I2C_CNTRL] | ||
142 | |||
143 | /* wait for not busy */ | ||
144 | 1: | ||
145 | ldr r1, [r0, #I2C_SR] | ||
146 | tst r1, #1 | ||
147 | bne 1b | ||
148 | |||
149 | /* start read of irq_enrd0 */ | ||
150 | mov r1, #AS3514_IRQ_ENRD0 | ||
151 | str r1, [r0, #I2C_SADDR] | ||
152 | orr r2, r2, #(1 << 1) | ||
153 | str r2, [r0, #I2C_CNTRL] | ||
154 | mov r1, #1 | ||
155 | str r1, [r0, #I2C_DACNT] | ||
156 | |||
157 | /* wait for transfer to finish */ | ||
158 | 1: | ||
159 | ldr r1, [r0, #I2C_DACNT] | ||
160 | cmp r1, #0 | ||
161 | bne 1b | ||
162 | |||
163 | /* load result and test USB_STATUS bit */ | ||
164 | ldr r1, [r0, #I2C_DATA] | ||
165 | tst r1, #(1 << 3) | ||
166 | bne boot_of | ||
167 | #endif | ||
99 | 168 | ||
100 | /* Here are model specific tests, for dual boot without a computer */ | 169 | /* Here are model specific tests, for dual boot without a computer */ |
101 | /* All models use left button */ | 170 | /* All models use left button */ |