summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2006-12-20 15:28:32 +0000
committerBarry Wardell <rockbox@barrywardell.net>2006-12-20 15:28:32 +0000
commit4b54302b0713be2995a33cfa30d1615fc206f1eb (patch)
treeca05677c3d23d5091c9abd4949732c6ea91519e7
parent57228769a2a0da43042d57048215ad67cd49e443 (diff)
Combine USB code for all PortalPlayer targets since they most likely all use the same USB hardware. Add register defines for the USB hardware addresses, based off the Freescale i.MX31 datasheet. Use usb_init() from the iPod code, but modified to use the new register defines rather than oul/inl on the hardware addresses.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11823 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/SOURCES22
-rw-r--r--firmware/export/pp5020.h8
-rw-r--r--firmware/target/arm/ipod/usb-target.h24
-rw-r--r--firmware/target/arm/iriver/h10/usb-h10.c58
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/usb-e200.c39
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/usb-target.h25
-rw-r--r--firmware/target/arm/tatung/tpj1022/usb-target.h27
-rw-r--r--firmware/target/arm/tatung/tpj1022/usb-tpj1022.c107
-rw-r--r--firmware/target/arm/usb-pp.c (renamed from firmware/target/arm/ipod/usb-ipod.c)73
-rw-r--r--firmware/target/arm/usb-target.h128
10 files changed, 190 insertions, 321 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 386d3707c4..6a4f172e47 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -331,7 +331,7 @@ target/arm/sandisk/sansa-e200/ata-e200.c
target/arm/sandisk/sansa-e200/lcd-e200.c
target/arm/sandisk/sansa-e200/adc-e200.c
target/arm/sandisk/sansa-e200/backlight-e200.c
-target/arm/sandisk/sansa-e200/usb-e200.c
+target/arm/usb-pp.c
target/arm/sandisk/sansa-e200/button-e200.c
target/arm/sandisk/sansa-e200/power-e200.c
target/arm/i2s-pp.c
@@ -416,7 +416,7 @@ target/arm/iriver/h10/backlight-h10.c
target/arm/iriver/h10/button-h10.c
target/arm/iriver/h10/lcd-h10_20gb.c
target/arm/iriver/h10/power-h10.c
-target/arm/iriver/h10/usb-h10.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* IRIVER_H10 */
@@ -430,7 +430,7 @@ target/arm/iriver/h10/backlight-h10.c
target/arm/iriver/h10/button-h10.c
target/arm/iriver/h10/lcd-h10_5gb.c
target/arm/iriver/h10/power-h10.c
-target/arm/iriver/h10/usb-h10.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* IRIVER_H10_5GB */
@@ -460,7 +460,7 @@ target/arm/tatung/tpj1022/backlight-tpj1022.c
target/arm/tatung/tpj1022/button-tpj1022.c
target/arm/tatung/tpj1022/lcd-tpj1022.c
target/arm/tatung/tpj1022/power-tpj1022.c
-target/arm/tatung/tpj1022/usb-tpj1022.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* ELIO_TPJ1022 */
@@ -475,7 +475,7 @@ target/arm/ipod/adc-ipod.c
target/arm/ipod/backlight-4g_color.c
target/arm/ipod/button-clickwheel.c
target/arm/ipod/power-ipod.c
-target/arm/ipod/usb-ipod.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* IPOD_4G */
@@ -490,7 +490,7 @@ target/arm/ipod/adc-ipod.c
target/arm/ipod/backlight-4g_color.c
target/arm/ipod/button-clickwheel.c
target/arm/ipod/power-ipod.c
-target/arm/ipod/usb-ipod.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* IPOD_COLOR */
@@ -505,7 +505,7 @@ target/arm/ipod/adc-ipod.c
target/arm/ipod/backlight-nano_video.c
target/arm/ipod/button-clickwheel.c
target/arm/ipod/power-ipod.c
-target/arm/ipod/usb-ipod.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* IPOD_NANO */
@@ -520,7 +520,7 @@ target/arm/ipod/adc-ipod.c
target/arm/ipod/backlight-nano_video.c
target/arm/ipod/button-clickwheel.c
target/arm/ipod/power-ipod.c
-target/arm/ipod/usb-ipod.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* IPOD_VIDEO */
@@ -535,7 +535,7 @@ target/arm/ipod/adc-ipod.c
target/arm/ipod/3g/backlight-3g.c
target/arm/ipod/3g/button-3g.c
target/arm/ipod/power-ipod.c
-target/arm/ipod/usb-ipod.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* IPOD_3G */
@@ -550,7 +550,7 @@ target/arm/ipod/adc-ipod.c
target/arm/ipod/backlight-mini1g_mini2g.c
target/arm/ipod/button-mini1g.c
target/arm/ipod/power-ipod.c
-target/arm/ipod/usb-ipod.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* IPOD_MINI */
@@ -565,7 +565,7 @@ target/arm/ipod/adc-ipod.c
target/arm/ipod/backlight-mini1g_mini2g.c
target/arm/ipod/button-clickwheel.c
target/arm/ipod/power-ipod.c
-target/arm/ipod/usb-ipod.c
+target/arm/usb-pp.c
#endif /* SIMULATOR */
#endif /* IPOD_MINI2G */
diff --git a/firmware/export/pp5020.h b/firmware/export/pp5020.h
index 37d8882519..cbae083913 100644
--- a/firmware/export/pp5020.h
+++ b/firmware/export/pp5020.h
@@ -126,6 +126,11 @@
#define DEV_EN (*(volatile unsigned long *)(0x6000600c))
#define DEV_SYSTEM 0x4
+#define DEV_USB 0x400000
+
+#define DEV_INIT (*(volatile unsigned long *)(0x70000020))
+
+#define INIT_USB 0x80000000
#define TIMER1_CFG (*(volatile unsigned long *)(0x60005000))
#define TIMER1_VAL (*(volatile unsigned long *)(0x60005004))
@@ -158,9 +163,6 @@
#define SER1_MASK (1 << (SER1_IRQ-32))
#define I2C_MASK (1 << (I2C_IRQ-32))
-#define USB2D_IDENT (*(volatile unsigned long*)(0xc5000000))
-#define USB_STATUS (*(volatile unsigned long*)(0xc50001a4))
-
#define IISCONFIG (*(volatile unsigned long*)(0x70002800))
#define IISFIFO_CFG (*(volatile unsigned long*)(0x7000280c))
diff --git a/firmware/target/arm/ipod/usb-target.h b/firmware/target/arm/ipod/usb-target.h
deleted file mode 100644
index 69a81472f8..0000000000
--- a/firmware/target/arm/ipod/usb-target.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 by Barry Wardelll
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-#ifndef USB_TARGET_H
-#define USB_TARGET_H
-
-bool usb_init_device(void);
-
-#endif
diff --git a/firmware/target/arm/iriver/h10/usb-h10.c b/firmware/target/arm/iriver/h10/usb-h10.c
deleted file mode 100644
index b11eb53deb..0000000000
--- a/firmware/target/arm/iriver/h10/usb-h10.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 by Barry Wardell
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-#include "config.h"
-#include "cpu.h"
-#include "kernel.h"
-#include "thread.h"
-#include "system.h"
-#include "debug.h"
-#include "ata.h"
-#include "fat.h"
-#include "disk.h"
-#include "panic.h"
-#include "lcd.h"
-#include "adc.h"
-#include "usb.h"
-#include "button.h"
-#include "sprintf.h"
-#include "string.h"
-#include "hwcompat.h"
-#include "pp5020.h"
-
-void usb_init_device(void)
-{
- /* USB is initialized by bootloader */
-}
-
-bool usb_detect(void)
-{
- return (GPIOL_INPUT_VAL & 0x04)?true:false;
-}
-
-void usb_enable(bool on)
-{
- /* For the H10, we reboot if BUTTON_RIGHT is held so that the iriver
- * bootloader can start up in UMS mode. This does not return. */
- if (on && (button_status()==BUTTON_RIGHT))
- {
- ata_sleepnow(); /* Immediately spindown the disk. */
- sleep(HZ*2);
- system_reboot();
- }
-}
diff --git a/firmware/target/arm/sandisk/sansa-e200/usb-e200.c b/firmware/target/arm/sandisk/sansa-e200/usb-e200.c
deleted file mode 100644
index 031ba07253..0000000000
--- a/firmware/target/arm/sandisk/sansa-e200/usb-e200.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 by Barry Wardelll
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-#include <stdbool.h>
-#include "system.h"
-
-bool usb_init_device(void)
-{
- return true;
-}
-
-bool usb_detect(void)
-{
- if(GPIOB_INPUT_VAL & 0x10)
- return true;
- return false;
-}
-
-void usb_enable(bool on)
-{
- (void)on;
-}
-
diff --git a/firmware/target/arm/sandisk/sansa-e200/usb-target.h b/firmware/target/arm/sandisk/sansa-e200/usb-target.h
deleted file mode 100644
index 3f309ff30b..0000000000
--- a/firmware/target/arm/sandisk/sansa-e200/usb-target.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 by Barry Wardelll
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-#ifndef USB_TARGET_H
-#define USB_TARGET_H
-
-bool usb_init_device(void);
-
-#endif
-
diff --git a/firmware/target/arm/tatung/tpj1022/usb-target.h b/firmware/target/arm/tatung/tpj1022/usb-target.h
deleted file mode 100644
index 7a17f7bacf..0000000000
--- a/firmware/target/arm/tatung/tpj1022/usb-target.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 by Barry Wardelll
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-/* Based off x5 version */
-
-#ifndef USB_TARGET_H
-#define USB_TARGET_H
-
-bool usb_init_device(void);
-
-#endif
diff --git a/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c b/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c
deleted file mode 100644
index b238de4369..0000000000
--- a/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/***************************************************************************
- * __________ __ ___.
- * Open \______ \ ____ ____ | | _\_ |__ _______ ___
- * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
- * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
- * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
- * \/ \/ \/ \/ \/
- * $Id$
- *
- * Copyright (C) 2006 by Barry Wardell
- *
- * All files in this archive are subject to the GNU General Public License.
- * See the file COPYING in the source tree root for full license agreement.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ****************************************************************************/
-
-/* Code from the iPod port but commented out. USB detection custom made based
- on GPIO analysis */
-
-#include "config.h"
-#include "cpu.h"
-#include "kernel.h"
-#include "thread.h"
-#include "system.h"
-#include "debug.h"
-#include "ata.h"
-#include "fat.h"
-#include "disk.h"
-#include "panic.h"
-#include "lcd.h"
-#include "adc.h"
-#include "usb.h"
-#include "button.h"
-#include "sprintf.h"
-#include "string.h"
-#include "hwcompat.h"
-#ifdef HAVE_MMC
-#include "ata_mmc.h"
-#endif
-
-void usb_init_device(void)
-{
-#if 0
- int r0;
- outl(inl(0x70000084) | 0x200, 0x70000084);
-
- outl(inl(0x7000002C) | 0x3000000, 0x7000002C);
- outl(inl(0x6000600C) | 0x400000, 0x6000600C);
-
- outl(inl(0x60006004) | 0x400000, 0x60006004); /* reset usb start */
- outl(inl(0x60006004) & ~0x400000, 0x60006004); /* reset usb end */
-
- outl(inl(0x70000020) | 0x80000000, 0x70000020);
- while ((inl(0x70000028) & 0x80) == 0);
-
- outl(inl(0xc5000184) | 0x100, 0xc5000184);
- while ((inl(0xc5000184) & 0x100) != 0);
-
- outl(inl(0xc50001A4) | 0x5F000000, 0xc50001A4);
- if ((inl(0xc50001A4) & 0x100) == 0) {
- outl(inl(0xc50001A8) & ~0x3, 0xc50001A8);
- outl(inl(0xc50001A8) | 0x2, 0xc50001A8);
- outl(inl(0x70000028) | 0x4000, 0x70000028);
- outl(inl(0x70000028) | 0x2, 0x70000028);
- } else {
- outl(inl(0xc50001A8) | 0x3, 0xc50001A8);
- outl(inl(0x70000028) &~0x4000, 0x70000028);
- outl(inl(0x70000028) | 0x2, 0x70000028);
- }
- outl(inl(0xc5000140) | 0x2, 0xc5000140);
- while((inl(0xc5000140) & 0x2) != 0);
- r0 = inl(0xc5000184);
-
- /* Note from IPL source (referring to next 5 lines of code:
- THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */
- outl(inl(0x70000020) | 0x80000000, 0x70000020);
- outl(inl(0x6000600C) | 0x400000, 0x6000600C);
- while ((inl(0x70000028) & 0x80) == 0);
- outl(inl(0x70000028) | 0x2, 0x70000028);
-
- udelay(0x186A0);
-#endif
-}
-
-bool usb_detect(void)
-{
- return false;
-}
-
-void usb_enable(bool on)
-{
- (void)on;
-#if 0
- /* For the ipod, we can only do one thing with USB mode - reboot
- into Apple's flash-based disk-mode. This does not return. */
- if (on)
- {
- /* The following code is copied from ipodlinux */
- unsigned char* storage_ptr = (unsigned char *)0x40017F00;
- memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21);
- DEV_RS |= 4; /* Reboot */
- }
-#endif
-}
diff --git a/firmware/target/arm/ipod/usb-ipod.c b/firmware/target/arm/usb-pp.c
index 9298d65ff7..f8d0a836ad 100644
--- a/firmware/target/arm/ipod/usb-ipod.c
+++ b/firmware/target/arm/usb-pp.c
@@ -38,6 +38,8 @@
#include "sprintf.h"
#include "string.h"
#include "hwcompat.h"
+
+#include "usb-target.h"
void usb_init_device(void)
{
@@ -45,36 +47,36 @@ void usb_init_device(void)
outl(inl(0x70000084) | 0x200, 0x70000084);
outl(inl(0x7000002C) | 0x3000000, 0x7000002C);
- outl(inl(0x6000600C) | 0x400000, 0x6000600C);
+ DEV_EN |= DEV_USB;
- outl(inl(0x60006004) | 0x400000, 0x60006004); /* reset usb start */
- outl(inl(0x60006004) & ~0x400000, 0x60006004); /* reset usb end */
+ DEV_RS |= DEV_USB; /* reset usb start */
+ DEV_RS &=~DEV_USB;/* reset usb end */
- outl(inl(0x70000020) | 0x80000000, 0x70000020);
+ DEV_INIT |= INIT_USB;
while ((inl(0x70000028) & 0x80) == 0);
- outl(inl(0xc5000184) | 0x100, 0xc5000184);
- while ((inl(0xc5000184) & 0x100) != 0);
+ UOG_PORTSC1 |= 0x100;
+ while ((UOG_PORTSC1 & 0x100) != 0);
- outl(inl(0xc50001A4) | 0x5F000000, 0xc50001A4);
- if ((inl(0xc50001A4) & 0x100) == 0) {
- outl(inl(0xc50001A8) & ~0x3, 0xc50001A8);
- outl(inl(0xc50001A8) | 0x2, 0xc50001A8);
+ UOG_OTGSC |= 0x5F000000;
+ if( (UOG_OTGSC & 0x100) == 0) {
+ UOG_USBMODE &=~ 0x3;
+ UOG_USBMODE |= 0x2;
outl(inl(0x70000028) | 0x4000, 0x70000028);
outl(inl(0x70000028) | 0x2, 0x70000028);
} else {
- outl(inl(0xc50001A8) | 0x3, 0xc50001A8);
+ UOG_USBMODE |= 0x2;
outl(inl(0x70000028) &~0x4000, 0x70000028);
outl(inl(0x70000028) | 0x2, 0x70000028);
}
- outl(inl(0xc5000140) | 0x2, 0xc5000140);
- while((inl(0xc5000140) & 0x2) != 0);
- r0 = inl(0xc5000184);
+ UOG_USBCMD |= 0x2;
+ while((UOG_USBCMD & 0x2) != 0);
+ r0 = UOG_PORTSC1;
/* Note from IPL source (referring to next 5 lines of code:
THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */
outl(inl(0x70000020) | 0x80000000, 0x70000020);
- outl(inl(0x6000600C) | 0x400000, 0x6000600C);
+ DEV_EN |= DEV_USB;
while ((inl(0x70000028) & 0x80) == 0);
outl(inl(0x70000028) | 0x2, 0x70000028);
@@ -83,22 +85,34 @@ void usb_init_device(void)
void usb_enable(bool on)
{
- /* For the ipod, we can only do one thing with USB mode - reboot
- into Apple's flash-based disk-mode. This does not return. */
+ /* This device specific code will eventually give way to proper USB
+ handling, which should be the same for all PortalPlayer targets. */
if (on)
{
- /* The following code is copied from ipodlinux */
+#if IPOD_ARCH || defined(IRIVER_H10) || defined (IRIVER_H10_5GB)
+ /* For the H10 and iPod, we can only do one thing with USB mode - reboot
+ into the flash-based disk-mode. This does not return. */
+
+ /* The following code is copied from ipodlinux */
#if defined(IPOD_COLOR) || defined(IPOD_3G) || \
defined(IPOD_4G) || defined(IPOD_MINI)
unsigned char* storage_ptr = (unsigned char *)0x40017F00;
#elif defined(IPOD_NANO) || defined(IPOD_VIDEO) || defined(IPOD_MINI2G)
unsigned char* storage_ptr = (unsigned char *)0x4001FF00;
#endif
-
- ata_sleepnow(); /* Immediately spindown the disk. */
- sleep(HZ*2);
- memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21);
- DEV_RS |= 4; /* Reboot */
+
+#if defined(IRIVER_H10) || defined (IRIVER_H10_5GB)
+ if(button_status()==BUTTON_RIGHT)
+#endif
+ {
+ ata_sleepnow(); /* Immediately spindown the disk. */
+ sleep(HZ*2);
+#ifdef IPOD_ARCH
+ memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21);
+#endif
+ system_reboot(); /* Reboot */
+ }
+#endif
}
}
@@ -106,12 +120,17 @@ bool usb_detect(void)
{
bool current_status;
- /* The following check is in the ipodlinux source, with the
- comment "USB2D_IDENT is bad" if USB2D_IDENT != 0x22FA05 */
- if (USB2D_IDENT != 0x22FA05) {
+ /* UOG_ID should have the bit format:
+ [31:24] = 0x0
+ [23:16] = 0x22 (Revision number)
+ [15:14] = 0x3 (Reserved)
+ [13:8] = 0x3a (NID - 1's compliment of ID)
+ [7:6] = 0x0 (Reserved)
+ [5:0] = 0x05 (ID) */
+ if (UOG_ID != 0x22FA05) {
return false;
}
- current_status = (USB_STATUS & 0x800)?true:false;
+ current_status = (UOG_OTGSC & 0x800)?true:false;
return current_status;
}
diff --git a/firmware/target/arm/usb-target.h b/firmware/target/arm/usb-target.h
new file mode 100644
index 0000000000..2a5400be7e
--- /dev/null
+++ b/firmware/target/arm/usb-target.h
@@ -0,0 +1,128 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2006 by Barry Wardelll
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef USB_TARGET_H
+#define USB_TARGET_H
+
+/* The PortalPlayer USB controller is compatible with Freescale i.MX31 */
+
+/* Register addresses */
+/* OTG */
+#define UOG_ID (*(volatile unsigned long *)(0xc5000000))
+#define UOG_HWGENERAL (*(volatile unsigned long *)(0xc5000004))
+#define UOG_HWHOST (*(volatile unsigned long *)(0xc5000008))
+#define UOG_HWTXBUF (*(volatile unsigned long *)(0xc5000010))
+#define UOG_HWRXBUF (*(volatile unsigned long *)(0xc5000014))
+#define UOG_CAPLENGTH (*(volatile unsigned char *)(0xc5000100))
+#define UOG_HCIVERSION (*(volatile unsigned short *)(0xc5000102))
+#define UOG_HCSPARAMS (*(volatile unsigned long *)(0xc5000104))
+#define UOG_HCCPARAMS (*(volatile unsigned long *)(0xc5000108))
+#define UOG_DCIVERSION (*(volatile unsigned short *)(0xc5000120))
+#define UOG_DCCPARAMS (*(volatile unsigned long *)(0xc5000124))
+#define UOG_USBCMD (*(volatile unsigned long *)(0xc5000140))
+#define UOG_USBSTS (*(volatile unsigned long *)(0xc5000144))
+#define UOG_USBINTR (*(volatile unsigned long *)(0xc5000148))
+#define UOG_FRINDEX (*(volatile unsigned long *)(0xc500014c))
+#define UOG_PERIODICLISTBASE (*(volatile unsigned long *)(0xc5000154))
+#define UOG_ASYNCLISTADDR (*(volatile unsigned long *)(0xc5000158))
+#define UOG_BURSTSIZE (*(volatile unsigned long *)(0xc5000160))
+#define UOG_TXFILLTUNING (*(volatile unsigned long *)(0xc5000164))
+#define UOG_ULPIVIEW (*(volatile unsigned long *)(0xc5000170))
+#define UOG_CFGFLAG (*(volatile unsigned long *)(0xc5000180))
+#define UOG_PORTSC1 (*(volatile unsigned long *)(0xc5000184))
+/*#define UOG_PORTSC2 (*(volatile unsigned long *)(0xc5000188))
+#define UOG_PORTSC3 (*(volatile unsigned long *)(0xc500018c))
+#define UOG_PORTSC4 (*(volatile unsigned long *)(0xc5000190))
+#define UOG_PORTSC5 (*(volatile unsigned long *)(0xc5000194))
+#define UOG_PORTSC6 (*(volatile unsigned long *)(0xc5000198))
+#define UOG_PORTSC7 (*(volatile unsigned long *)(0xc500019c))
+#define UOG_PORTSC8 (*(volatile unsigned long *)(0xc50001a0))*/
+#define UOG_OTGSC (*(volatile unsigned long *)(0xc50001a4))
+#define UOG_USBMODE (*(volatile unsigned long *)(0xc50001a8))
+#define UOG_ENDPTSETUPSTAT (*(volatile unsigned long *)(0xc50001ac))
+#define UOG_ENDPTPRIME (*(volatile unsigned long *)(0xc50001b0))
+#define UOG_ENDPTFLUSH (*(volatile unsigned long *)(0xc50001b4))
+#define UOG_ENDPTSTAT (*(volatile unsigned long *)(0xc50001b8))
+#define UOG_ENDPTCOMPLETE (*(volatile unsigned long *)(0xc50001bc))
+#define ENDPTCRTL0 (*(volatile unsigned long *)(0xc50001c0))
+#define ENDPTCRTL1 (*(volatile unsigned long *)(0xc50001c4))
+#define ENDPTCRTL2 (*(volatile unsigned long *)(0xc50001c8))
+#define ENDPTCRTL3 (*(volatile unsigned long *)(0xc50001cc))
+#define ENDPTCRTL4 (*(volatile unsigned long *)(0xc50001d0))
+#define ENDPTCRTL5 (*(volatile unsigned long *)(0xc50001d4))
+#define ENDPTCRTL6 (*(volatile unsigned long *)(0xc50001d8))
+#define ENDPTCRTL7 (*(volatile unsigned long *)(0xc50001dc))
+/*#define ENDPTCRTL8 (*(volatile unsigned long *)(0xc50001e0))
+#define ENDPTCRTL9 (*(volatile unsigned long *)(0xc50001e4))
+#define ENDPTCRTL10 (*(volatile unsigned long *)(0xc50001e8))
+#define ENDPTCRTL11 (*(volatile unsigned long *)(0xc50001ec))
+#define ENDPTCRTL12 (*(volatile unsigned long *)(0xc50001f0))
+#define ENDPTCRTL13 (*(volatile unsigned long *)(0xc50001f4))
+#define ENDPTCRTL14 (*(volatile unsigned long *)(0xc50001f8))
+#define ENDPTCRTL15 (*(volatile unsigned long *)(0xc50001fc))*/
+
+/* Host 1 */
+#define UH1_ID (*(volatile unsigned long *)(0xc5000200))
+#define UH1_HWGENERAL (*(volatile unsigned long *)(0xc5000204))
+#define UH1_HWHOST (*(volatile unsigned long *)(0xc5000208))
+#define UH1_HWTXBUF (*(volatile unsigned long *)(0xc5000210))
+#define UH1_HWRXBUF (*(volatile unsigned long *)(0xc5000214))
+#define UH1_CAPLENGTH (*(volatile unsigned long *)(0xc5000300))
+#define UH1_HCIVERSION (*(volatile unsigned long *)(0xc5000302))
+#define UH1_HCSPARAMS (*(volatile unsigned long *)(0xc5000304))
+#define UH1_HCCPARAMS (*(volatile unsigned long *)(0xc5000308))
+#define UH1_USBCMD (*(volatile unsigned long *)(0xc5000340))
+#define UH1_USBSTS (*(volatile unsigned long *)(0xc5000344))
+#define UH1_USBINTR (*(volatile unsigned long *)(0xc5000348))
+#define UH1_FRINDEX (*(volatile unsigned long *)(0xc500034c))
+#define UH1_PERIODICLISTBASE (*(volatile unsigned long *)(0xc5000354))
+#define UH1_ASYNCLISTADDR (*(volatile unsigned long *)(0xc5000358))
+#define UH1_BURSTSIZE (*(volatile unsigned long *)(0xc5000360))
+#define UH1_TXFILLTUNING (*(volatile unsigned long *)(0xc5000364))
+#define UH1_PORTSC1 (*(volatile unsigned long *)(0xc5000384))
+#define UH1_USBMODE (*(volatile unsigned long *)(0xc50003a8))
+
+/* Host 2 */
+#define UH2_ID (*(volatile unsigned long *)(0xc5000400))
+#define UH2_HWGENERAL (*(volatile unsigned long *)(0xc5000404))
+#define UH2_HWHOST (*(volatile unsigned long *)(0xc5000408))
+#define UH2_HWTXBUF (*(volatile unsigned long *)(0xc5000410))
+#define UH2_HWRXBUF (*(volatile unsigned long *)(0xc5000414))
+#define UH2_CAPLENGTH (*(volatile unsigned long *)(0xc5000500))
+#define UH2_HCIVERSION (*(volatile unsigned long *)(0xc5000502))
+#define UH2_HCSPARAMS (*(volatile unsigned long *)(0xc5000504))
+#define UH2_HCCPARAMS (*(volatile unsigned long *)(0xc5000508))
+#define UH2_USBCMD (*(volatile unsigned long *)(0xc5000540))
+#define UH2_USBSTS (*(volatile unsigned long *)(0xc5000544))
+#define UH2_USBINTR (*(volatile unsigned long *)(0xc5000548))
+#define UH2_FRINDEX (*(volatile unsigned long *)(0xc500054c))
+#define UH2_PERIODICLISTBASE (*(volatile unsigned long *)(0xc5000554))
+#define UH2_ASYNCLISTADDR (*(volatile unsigned long *)(0xc5000558))
+#define UH2_BURSTSIZE (*(volatile unsigned long *)(0xc5000560))
+#define UH2_TXFILLTUNING (*(volatile unsigned long *)(0xc5000564))
+#define UH2_ULPIVIEW (*(volatile unsigned long *)(0xc5000570))
+#define UH2_PORTSC1 (*(volatile unsigned long *)(0xc5000584))
+#define UH2_USBMODE (*(volatile unsigned long *)(0xc50005a8))
+
+/* General */
+#define USB_CTRL (*(volatile unsigned long *)(0xc5000600))
+#define USB_OTG_MIRROR (*(volatile unsigned long *)(0xc5000604))
+
+void usb_init_device(void);
+
+#endif