diff options
author | Karl Kurbjun <kkurbjun@gmail.com> | 2009-06-08 00:19:16 +0000 |
---|---|---|
committer | Karl Kurbjun <kkurbjun@gmail.com> | 2009-06-08 00:19:16 +0000 |
commit | 4a483bb1bf69a0f0a1bf99aaa9bb47c6f79ab990 (patch) | |
tree | 974333299e937024bcd8b34ab998ceb137011d56 /firmware/target | |
parent | f8a861961582c2809a8267ad0918d9c74072a440 (diff) | |
download | rockbox-4a483bb1bf69a0f0a1bf99aaa9bb47c6f79ab990.tar.gz rockbox-4a483bb1bf69a0f0a1bf99aaa9bb47c6f79ab990.zip |
M:Robe 500: Mostly complete USB driver, supports BULK mode currently and gets about 2 MB/s writes vs 1.1 MB/s on the OF. Mostly tested against Linux, preliminary testing in Windows appears to work. There is currently a bug in the attach process where it only works once per boot that needs to be fixed. There are a few other minor M:Robe 500 changes as well.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21208 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/tms320dm320/boot.lds | 11 | ||||
-rwxr-xr-x | firmware/target/arm/tms320dm320/crt0.S | 22 | ||||
-rwxr-xr-x | firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c | 8 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/usb-mr500.c | 74 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/system-dm320.c | 12 | ||||
-rwxr-xr-x | firmware/target/arm/tms320dm320/system-target.h | 2 |
6 files changed, 76 insertions, 53 deletions
diff --git a/firmware/target/arm/tms320dm320/boot.lds b/firmware/target/arm/tms320dm320/boot.lds index ff8203ccd8..0ee6c202a4 100644 --- a/firmware/target/arm/tms320dm320/boot.lds +++ b/firmware/target/arm/tms320dm320/boot.lds | |||
@@ -138,9 +138,20 @@ SECTIONS | |||
138 | . += TTB_SIZE; | 138 | . += TTB_SIZE; |
139 | } > DRAM | 139 | } > DRAM |
140 | 140 | ||
141 | /* The LCD buffer should be at the end of memory to protect against | ||
142 | * overflowing something else when the YUV blitter is fudging the screen | ||
143 | * size. | ||
144 | */ | ||
145 | |||
141 | .lcdbuffer (NOLOAD) : | 146 | .lcdbuffer (NOLOAD) : |
142 | { | 147 | { |
143 | _lcdbuf = .; | 148 | _lcdbuf = .; |
144 | . += LCD_BUFFER_SIZE; | 149 | . += LCD_BUFFER_SIZE; |
145 | } > DRAM | 150 | } > DRAM |
151 | |||
152 | .lcdbuffer2 (NOLOAD) : | ||
153 | { | ||
154 | _lcdbuf2 = .; | ||
155 | . += LCD_BUFFER_SIZE; | ||
156 | } > DRAM | ||
146 | } | 157 | } |
diff --git a/firmware/target/arm/tms320dm320/crt0.S b/firmware/target/arm/tms320dm320/crt0.S index 0243c13971..7c0c27eb74 100755 --- a/firmware/target/arm/tms320dm320/crt0.S +++ b/firmware/target/arm/tms320dm320/crt0.S | |||
@@ -75,7 +75,7 @@ start: | |||
75 | strhi r5, [r3], #4 | 75 | strhi r5, [r3], #4 |
76 | bhi 1b | 76 | bhi 1b |
77 | #endif | 77 | #endif |
78 | #endif /* !BOOTLOADER,!STUB */ | 78 | #endif /* !STUB */ |
79 | 79 | ||
80 | 80 | ||
81 | /* Initialise bss section to zero */ | 81 | /* Initialise bss section to zero */ |
@@ -113,26 +113,6 @@ stackmunge: | |||
113 | /* Switch to supervisor mode (no IRQ) */ | 113 | /* Switch to supervisor mode (no IRQ) */ |
114 | msr cpsr_c, #0xd3 | 114 | msr cpsr_c, #0xd3 |
115 | ldr sp, =stackend | 115 | ldr sp, =stackend |
116 | |||
117 | #if defined(BOOTLOADER) && !defined(CREATIVE_ZVx) | ||
118 | /* get the high part of our execute address */ | ||
119 | ldr r2, =0xffffff00 | ||
120 | and r4, pc, r2 | ||
121 | |||
122 | /* Copy bootloader to safe area - 0x01900000 */ | ||
123 | mov r5, #0x01900000 | ||
124 | ldr r6, = _dataend | ||
125 | sub r0, r6, r5 /* length of loader */ | ||
126 | add r0, r4, r0 /* r0 points to start of loader */ | ||
127 | 1: | ||
128 | cmp r5, r6 | ||
129 | ldrcc r2, [r4], #4 | ||
130 | strcc r2, [r5], #4 | ||
131 | bcc 1b | ||
132 | |||
133 | ldr pc, =start_loc /* jump to the relocated start_loc: */ | ||
134 | |||
135 | #endif | ||
136 | 116 | ||
137 | start_loc: | 117 | start_loc: |
138 | bl main | 118 | bl main |
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c index b81c34ac3b..6e361aac15 100755 --- a/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c | |||
@@ -25,9 +25,9 @@ | |||
25 | #include "tsc2100.h" | 25 | #include "tsc2100.h" |
26 | #include "kernel.h" | 26 | #include "kernel.h" |
27 | 27 | ||
28 | unsigned short current_bat2 = 3910; | 28 | unsigned short current_bat2 = 4200; |
29 | unsigned short current_aux = 3910; | 29 | unsigned short current_aux = 4200; |
30 | static unsigned short current_voltage = 3910; | 30 | static unsigned short current_voltage = 4200; |
31 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 31 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
32 | { | 32 | { |
33 | 3450 | 33 | 3450 |
@@ -69,7 +69,7 @@ unsigned int battery_adc_voltage(void) | |||
69 | current_aux=((short)((int)(aux<<10)/4096*6*2.5)); | 69 | current_aux=((short)((int)(aux<<10)/4096*6*2.5)); |
70 | } | 70 | } |
71 | 71 | ||
72 | if (TIME_BEFORE(last_tick+2*HZ, current_tick)) | 72 | if (TIME_BEFORE(last_tick+2*HZ, current_tick) || last_tick==0) |
73 | { | 73 | { |
74 | tsadc=tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS); | 74 | tsadc=tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS); |
75 | 75 | ||
diff --git a/firmware/target/arm/tms320dm320/mrobe-500/usb-mr500.c b/firmware/target/arm/tms320dm320/mrobe-500/usb-mr500.c index 41211c2b47..2e3518868b 100644 --- a/firmware/target/arm/tms320dm320/mrobe-500/usb-mr500.c +++ b/firmware/target/arm/tms320dm320/mrobe-500/usb-mr500.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2007 by Karl Kurbjun | 10 | * Copyright (C) 2007, 2009 by Karl Kurbjun |
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
13 | * modify it under the terms of the GNU General Public License | 13 | * modify it under the terms of the GNU General Public License |
@@ -18,42 +18,60 @@ | |||
18 | * KIND, either express or implied. | 18 | * KIND, either express or implied. |
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #define LOGF_ENABLE | ||
21 | 22 | ||
22 | #include "config.h" | 23 | #include "config.h" |
24 | #include "logf.h" | ||
23 | #include "cpu.h" | 25 | #include "cpu.h" |
24 | #include "system.h" | 26 | #include "system.h" |
25 | #include "kernel.h" | ||
26 | #include "ata.h" | ||
27 | #include "usb.h" | ||
28 | #include "usb-target.h" | ||
29 | 27 | ||
30 | #define USB_RST_ASSERT | 28 | #include "m66591.h" |
31 | #define USB_RST_DEASSERT | ||
32 | 29 | ||
33 | #define USB_VPLUS_PWR_ASSERT | 30 | void usb_init_device(void) { |
34 | #define USB_VPLUS_PWR_DEASSERT | 31 | logf("mxx: SOC Init"); |
35 | 32 | ||
36 | #define USB_UNIT_IS_PRESENT USB_EXTRACTED | 33 | /* The EMIF timing that is currently used may not be apropriate when the |
34 | * device is boosted. The following values were used with sucess too: | ||
35 | * IO_EMIF_CS4CTRL1 = 0x66AB; | ||
36 | * IO_EMIF_CS4CTRL2 = 0x4220; | ||
37 | */ | ||
38 | IO_EMIF_CS4CTRL1 = 0x2245; | ||
39 | IO_EMIF_CS4CTRL2 = 0x4110; | ||
37 | 40 | ||
38 | /* The usb detect is one pin to the cpu active low */ | 41 | IO_GIO_DIR0 &= ~(1<<2); |
39 | inline int usb_detect(void) | 42 | IO_GIO_INV0 &= ~(1<<2); |
40 | { | 43 | IO_GIO_FSEL0 &= ~(0x03); |
41 | return USB_UNIT_IS_PRESENT; | 44 | |
42 | } | 45 | /* Drive the reset pin low */ |
46 | IO_GIO_BITCLR0 = 1<<2; | ||
47 | |||
48 | /* Wait a bit */ | ||
49 | udelay(3); | ||
43 | 50 | ||
44 | void usb_init_device(void) | 51 | /* Release the reset (drive it high) */ |
45 | { | 52 | IO_GIO_BITSET0 = 1<<2; |
46 | // ata_enable(true); | 53 | |
54 | udelay(300); | ||
55 | |||
56 | IO_GIO_DIR0 |= 1<<3; | ||
57 | IO_GIO_INV0 &= ~(1<<3); | ||
58 | IO_GIO_IRQPORT |= 1<<3; | ||
59 | |||
60 | /* Enable the MXX interrupt */ | ||
61 | IO_INTC_EINT1 |= (1<<8); /* IRQ_GIO3 */ | ||
47 | } | 62 | } |
48 | 63 | ||
49 | void usb_enable(bool on) | 64 | /* This is the initial interupt handler routine for the USB controller */ |
50 | { | 65 | void GIO3 (void) { |
51 | if (on) | 66 | /* Clear the interrupt, this is critical to do before running the full |
52 | { | 67 | * handler otherwise you might miss an interrupt and everything will stop |
53 | USB_VPLUS_PWR_ASSERT; | 68 | * working. |
54 | } | 69 | * |
55 | else | 70 | * The M66591 interrupt line is attached to GPIO3. |
56 | { | 71 | */ |
57 | USB_VPLUS_PWR_DEASSERT; | 72 | IO_INTC_IRQ1 = (1<<8); |
58 | } | 73 | |
74 | /* Start the full handler which is located in the driver */ | ||
75 | USB_DEVICE(); | ||
59 | } | 76 | } |
77 | |||
diff --git a/firmware/target/arm/tms320dm320/system-dm320.c b/firmware/target/arm/tms320dm320/system-dm320.c index b8c9eee87f..8742f59691 100644 --- a/firmware/target/arm/tms320dm320/system-dm320.c +++ b/firmware/target/arm/tms320dm320/system-dm320.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "spi.h" | 28 | #include "spi.h" |
29 | #ifdef CREATIVE_ZVx | 29 | #ifdef CREATIVE_ZVx |
30 | #include "dma-target.h" | 30 | #include "dma-target.h" |
31 | #include "usb-mr500.h" | ||
31 | #endif | 32 | #endif |
32 | 33 | ||
33 | #define default_interrupt(name) \ | 34 | #define default_interrupt(name) \ |
@@ -308,3 +309,14 @@ void set_cpu_frequency(long frequency) | |||
308 | } | 309 | } |
309 | #endif | 310 | #endif |
310 | 311 | ||
312 | /* This function is pretty crude. It is not acurate to a usec, but errors on | ||
313 | * longer. | ||
314 | */ | ||
315 | void udelay(int usec) { | ||
316 | volatile int temp=usec*(175000/200); | ||
317 | |||
318 | while(temp) { | ||
319 | temp--; | ||
320 | } | ||
321 | } | ||
322 | |||
diff --git a/firmware/target/arm/tms320dm320/system-target.h b/firmware/target/arm/tms320dm320/system-target.h index 63d314f572..285dd0275f 100755 --- a/firmware/target/arm/tms320dm320/system-target.h +++ b/firmware/target/arm/tms320dm320/system-target.h | |||
@@ -28,4 +28,6 @@ | |||
28 | #define CPUFREQ_NORMAL 87500000 | 28 | #define CPUFREQ_NORMAL 87500000 |
29 | #define CPUFREQ_MAX 175000000 | 29 | #define CPUFREQ_MAX 175000000 |
30 | 30 | ||
31 | void udelay(int usec); | ||
32 | |||
31 | #endif /* SYSTEM_TARGET_H */ | 33 | #endif /* SYSTEM_TARGET_H */ |