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/arm/tms320dm320/mrobe-500/usb-mr500.c | |
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/arm/tms320dm320/mrobe-500/usb-mr500.c')
-rw-r--r-- | firmware/target/arm/tms320dm320/mrobe-500/usb-mr500.c | 74 |
1 files changed, 46 insertions, 28 deletions
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 | |||