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
This commit is contained in:
Karl Kurbjun 2009-06-08 00:19:16 +00:00
parent f8a8619615
commit 4a483bb1bf
12 changed files with 1048 additions and 56 deletions

View file

@ -138,9 +138,20 @@ SECTIONS
. += TTB_SIZE;
} > DRAM
/* The LCD buffer should be at the end of memory to protect against
* overflowing something else when the YUV blitter is fudging the screen
* size.
*/
.lcdbuffer (NOLOAD) :
{
_lcdbuf = .;
. += LCD_BUFFER_SIZE;
} > DRAM
.lcdbuffer2 (NOLOAD) :
{
_lcdbuf2 = .;
. += LCD_BUFFER_SIZE;
} > DRAM
}

View file

@ -75,7 +75,7 @@ start:
strhi r5, [r3], #4
bhi 1b
#endif
#endif /* !BOOTLOADER,!STUB */
#endif /* !STUB */
/* Initialise bss section to zero */
@ -113,26 +113,6 @@ stackmunge:
/* Switch to supervisor mode (no IRQ) */
msr cpsr_c, #0xd3
ldr sp, =stackend
#if defined(BOOTLOADER) && !defined(CREATIVE_ZVx)
/* get the high part of our execute address */
ldr r2, =0xffffff00
and r4, pc, r2
/* Copy bootloader to safe area - 0x01900000 */
mov r5, #0x01900000
ldr r6, = _dataend
sub r0, r6, r5 /* length of loader */
add r0, r4, r0 /* r0 points to start of loader */
1:
cmp r5, r6
ldrcc r2, [r4], #4
strcc r2, [r5], #4
bcc 1b
ldr pc, =start_loc /* jump to the relocated start_loc: */
#endif
start_loc:
bl main

View file

@ -25,9 +25,9 @@
#include "tsc2100.h"
#include "kernel.h"
unsigned short current_bat2 = 3910;
unsigned short current_aux = 3910;
static unsigned short current_voltage = 3910;
unsigned short current_bat2 = 4200;
unsigned short current_aux = 4200;
static unsigned short current_voltage = 4200;
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
{
3450
@ -69,7 +69,7 @@ unsigned int battery_adc_voltage(void)
current_aux=((short)((int)(aux<<10)/4096*6*2.5));
}
if (TIME_BEFORE(last_tick+2*HZ, current_tick))
if (TIME_BEFORE(last_tick+2*HZ, current_tick) || last_tick==0)
{
tsadc=tsc2100_readreg(TSADC_PAGE, TSADC_ADDRESS);

View file

@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2007 by Karl Kurbjun
* Copyright (C) 2007, 2009 by Karl Kurbjun
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -18,42 +18,60 @@
* KIND, either express or implied.
*
****************************************************************************/
#define LOGF_ENABLE
#include "config.h"
#include "logf.h"
#include "cpu.h"
#include "system.h"
#include "kernel.h"
#include "ata.h"
#include "usb.h"
#include "usb-target.h"
#define USB_RST_ASSERT
#define USB_RST_DEASSERT
#include "m66591.h"
#define USB_VPLUS_PWR_ASSERT
#define USB_VPLUS_PWR_DEASSERT
void usb_init_device(void) {
logf("mxx: SOC Init");
#define USB_UNIT_IS_PRESENT USB_EXTRACTED
/* The EMIF timing that is currently used may not be apropriate when the
* device is boosted. The following values were used with sucess too:
* IO_EMIF_CS4CTRL1 = 0x66AB;
* IO_EMIF_CS4CTRL2 = 0x4220;
*/
IO_EMIF_CS4CTRL1 = 0x2245;
IO_EMIF_CS4CTRL2 = 0x4110;
/* The usb detect is one pin to the cpu active low */
inline int usb_detect(void)
{
return USB_UNIT_IS_PRESENT;
IO_GIO_DIR0 &= ~(1<<2);
IO_GIO_INV0 &= ~(1<<2);
IO_GIO_FSEL0 &= ~(0x03);
/* Drive the reset pin low */
IO_GIO_BITCLR0 = 1<<2;
/* Wait a bit */
udelay(3);
/* Release the reset (drive it high) */
IO_GIO_BITSET0 = 1<<2;
udelay(300);
IO_GIO_DIR0 |= 1<<3;
IO_GIO_INV0 &= ~(1<<3);
IO_GIO_IRQPORT |= 1<<3;
/* Enable the MXX interrupt */
IO_INTC_EINT1 |= (1<<8); /* IRQ_GIO3 */
}
void usb_init_device(void)
{
// ata_enable(true);
/* This is the initial interupt handler routine for the USB controller */
void GIO3 (void) {
/* Clear the interrupt, this is critical to do before running the full
* handler otherwise you might miss an interrupt and everything will stop
* working.
*
* The M66591 interrupt line is attached to GPIO3.
*/
IO_INTC_IRQ1 = (1<<8);
/* Start the full handler which is located in the driver */
USB_DEVICE();
}
void usb_enable(bool on)
{
if (on)
{
USB_VPLUS_PWR_ASSERT;
}
else
{
USB_VPLUS_PWR_DEASSERT;
}
}

View file

@ -28,6 +28,7 @@
#include "spi.h"
#ifdef CREATIVE_ZVx
#include "dma-target.h"
#include "usb-mr500.h"
#endif
#define default_interrupt(name) \
@ -308,3 +309,14 @@ void set_cpu_frequency(long frequency)
}
#endif
/* This function is pretty crude. It is not acurate to a usec, but errors on
* longer.
*/
void udelay(int usec) {
volatile int temp=usec*(175000/200);
while(temp) {
temp--;
}
}

View file

@ -28,4 +28,6 @@
#define CPUFREQ_NORMAL 87500000
#define CPUFREQ_MAX 175000000
void udelay(int usec);
#endif /* SYSTEM_TARGET_H */