mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
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:
parent
f8a8619615
commit
4a483bb1bf
12 changed files with 1048 additions and 56 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue