diff --git a/apps/bitmaps/native/SOURCES b/apps/bitmaps/native/SOURCES index 62deb0afac..094b2d61b1 100644 --- a/apps/bitmaps/native/SOURCES +++ b/apps/bitmaps/native/SOURCES @@ -31,7 +31,11 @@ usblogo.176x48x16.bmp usblogo.128x37x16.bmp #endif #elif LCD_DEPTH > 1 /* greyscale */ +#ifdef IPOD_1G2G /* use firewire logo */ +usblogo.fw.128x39x2.bmp +#else usblogo.128x33x2.bmp +#endif #else /* monochrome */ #if LCD_WIDTH == 112 usblogo.100x20x1.bmp diff --git a/apps/bitmaps/native/usblogo.fw.128x39x2.bmp b/apps/bitmaps/native/usblogo.fw.128x39x2.bmp new file mode 100644 index 0000000000..bdf7af52b7 Binary files /dev/null and b/apps/bitmaps/native/usblogo.fw.128x39x2.bmp differ diff --git a/firmware/SOURCES b/firmware/SOURCES index 91cead088d..ccd6f11570 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -382,7 +382,7 @@ target/arm/sandisk/sansa-e200/lcd-e200.c target/arm/sandisk/sansa-e200/lcd-as-e200.S target/arm/sandisk/sansa-e200/adc-e200.c target/arm/sandisk/sansa-e200/backlight-e200.c -target/arm/usb-pp.c +target/arm/usb-fw-pp502x.c target/arm/sandisk/sansa-e200/button-e200.c target/arm/sandisk/sansa-e200/power-e200.c target/arm/i2s-pp.c @@ -497,7 +497,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/usb-pp.c +target/arm/usb-fw-pp502x.c #endif /* SIMULATOR */ #endif /* IRIVER_H10 */ @@ -512,7 +512,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/usb-pp.c +target/arm/usb-fw-pp502x.c #endif /* SIMULATOR */ #endif /* IRIVER_H10_5GB */ @@ -551,7 +551,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/usb-pp.c +target/arm/usb-fw-pp502x.c #endif /* SIMULATOR */ #endif /* ELIO_TPJ1022 */ @@ -567,7 +567,7 @@ target/arm/ipod/backlight-4g_color.c target/arm/ipod/button-clickwheel.c target/arm/ipod/lcd-gray.c target/arm/ipod/power-ipod.c -target/arm/usb-pp.c +target/arm/usb-fw-pp502x.c #endif /* SIMULATOR */ #endif /* IPOD_4G */ @@ -583,7 +583,7 @@ target/arm/ipod/backlight-4g_color.c target/arm/ipod/button-clickwheel.c target/arm/ipod/lcd-color_nano.c target/arm/ipod/power-ipod.c -target/arm/usb-pp.c +target/arm/usb-fw-pp502x.c #endif /* SIMULATOR */ #endif /* IPOD_COLOR */ @@ -599,7 +599,7 @@ target/arm/ipod/backlight-nano_video.c target/arm/ipod/button-clickwheel.c target/arm/ipod/lcd-color_nano.c target/arm/ipod/power-ipod.c -target/arm/usb-pp.c +target/arm/usb-fw-pp502x.c #endif /* SIMULATOR */ #endif /* IPOD_NANO */ @@ -615,7 +615,7 @@ target/arm/ipod/backlight-nano_video.c target/arm/ipod/button-clickwheel.c target/arm/ipod/power-ipod.c target/arm/ipod/video/lcd-video.c -target/arm/usb-pp.c +target/arm/usb-fw-pp502x.c #endif /* SIMULATOR */ #endif /* IPOD_VIDEO */ @@ -630,7 +630,7 @@ target/arm/ipod/3g/backlight-3g.c target/arm/ipod/button-1g-3g.c target/arm/ipod/lcd-gray.c target/arm/ipod/power-ipod.c -target/arm/usb-pp.c +target/arm/usb-fw-pp5002.c #endif /* SIMULATOR */ #endif /* IPOD_3G */ @@ -644,6 +644,7 @@ target/arm/ipod/1g2g/backlight-1g2g.c target/arm/ipod/button-1g-3g.c target/arm/ipod/lcd-gray.c target/arm/ipod/power-ipod.c +target/arm/usb-fw-pp5002.c #endif /* SIMULATOR */ #endif /* IPOD_1G2G */ @@ -659,7 +660,7 @@ target/arm/ipod/backlight-mini1g_mini2g.c target/arm/ipod/button-mini1g.c target/arm/ipod/lcd-gray.c target/arm/ipod/power-ipod.c -target/arm/usb-pp.c +target/arm/usb-fw-pp502x.c #endif /* SIMULATOR */ #endif /* IPOD_MINI */ @@ -675,7 +676,7 @@ target/arm/ipod/backlight-mini1g_mini2g.c target/arm/ipod/button-clickwheel.c target/arm/ipod/lcd-gray.c target/arm/ipod/power-ipod.c -target/arm/usb-pp.c +target/arm/usb-fw-pp502x.c #endif /* SIMULATOR */ #endif /* IPOD_MINI2G */ diff --git a/firmware/export/config-ipod1g2g.h b/firmware/export/config-ipod1g2g.h index 0eb3614dd6..37ebb32f86 100644 --- a/firmware/export/config-ipod1g2g.h +++ b/firmware/export/config-ipod1g2g.h @@ -110,7 +110,8 @@ /* Offset ( in the firmware file's header ) to the real data */ #define FIRMWARE_OFFSET_FILE_DATA 8 -#define USB_NONE +#define USB_IPODSTYLE +/* actually firewire only, but handled like USB */ /* Virtual LED (icon) */ #define CONFIG_LED LED_VIRTUAL diff --git a/firmware/export/config-ipod3g.h b/firmware/export/config-ipod3g.h index c3e63e87e3..466fb19601 100644 --- a/firmware/export/config-ipod3g.h +++ b/firmware/export/config-ipod3g.h @@ -110,7 +110,8 @@ /* Offset ( in the firmware file's header ) to the real data */ #define FIRMWARE_OFFSET_FILE_DATA 8 -#define USB_NONE +#define USB_IPODSTYLE +/* actually both firewire and USB, USB isn't handled yet */ /* Virtual LED (icon) */ #define CONFIG_LED LED_VIRTUAL diff --git a/firmware/export/pp5002.h b/firmware/export/pp5002.h index 83f8456bf0..9d757ead7d 100644 --- a/firmware/export/pp5002.h +++ b/firmware/export/pp5002.h @@ -141,9 +141,4 @@ #define MMAP3_LOGICAL (*(volatile unsigned long *)(0xf000f018)) #define MMAP3_PHYSICAL (*(volatile unsigned long *)(0xf000f01c)) -/* FIXME: These are PP502x definitions, but without them, iPod 3rd gen - * doesn't compile. The correct values for 3rd gen are not yet known. */ -#define DEV_INIT (*(volatile unsigned long *)(0x70000020)) -#define INIT_USB 0x80000000 - #endif diff --git a/firmware/target/arm/usb-fw-pp5002.c b/firmware/target/arm/usb-fw-pp5002.c new file mode 100644 index 0000000000..e64d4f8f81 --- /dev/null +++ b/firmware/target/arm/usb-fw-pp5002.c @@ -0,0 +1,70 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2007 by Jens Arnold + * + * 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 "ata.h" +#include "cpu.h" +#include "string.h" +#include "system.h" +#include "usb.h" +#include "usb-target.h" + +void usb_init_device(void) +{ + /* TODO: add USB init for iPod 3rd gen */ + +#if defined(IPOD_1G2G) || defined(IPOD_3G) + /* GPIO C bit 7 is firewire detect */ + GPIOC_ENABLE |= 0x80; + GPIOC_OUTPUT_EN &= ~0x80; +#endif +} + +void usb_enable(bool on) +{ + /* This device specific code will eventually give way to proper USB + handling, which should be the same for all PP5002 targets. */ + if (on) + { +#ifdef IPOD_ARCH + /* For iPod, we can only do one thing with USB mode atm - reboot + into the flash-based disk-mode. This does not return. */ + + ata_sleepnow(); /* Immediately spindown the disk. */ + sleep(HZ*2); + + memcpy((void *)0x40017f00, "diskmodehotstuff\1", 17); + + system_reboot(); /* Reboot */ +#endif + } +} + +bool usb_detect(void) +{ +#if defined(IPOD_1G2G) || defined(IPOD_3G) + /* GPIO C bit 7 is firewire detect */ + if (!(GPIOC_INPUT_VAL & 0x80)) + return true; +#endif + + /* TODO: add USB detection for iPod 3rd gen */ + + return false; +} diff --git a/firmware/target/arm/usb-pp.c b/firmware/target/arm/usb-fw-pp502x.c similarity index 85% rename from firmware/target/arm/usb-pp.c rename to firmware/target/arm/usb-fw-pp502x.c index b497e86804..92e3dee562 100644 --- a/firmware/target/arm/usb-pp.c +++ b/firmware/target/arm/usb-fw-pp502x.c @@ -86,27 +86,25 @@ void usb_init_device(void) udelay(0x186A0); - dr_controller_setup(); + +#if defined(IPOD_COLOR) || defined(IPOD_4G) \ + || defined(IPOD_MINI) || defined(IPOD_MINI2G) + /* GPIO C bit 1 is firewire detect */ + GPIOC_ENABLE |= 0x02; + GPIOC_OUTPUT_EN &= ~0x02; +#endif } void usb_enable(bool on) { /* This device specific code will eventually give way to proper USB - handling, which should be the same for all PortalPlayer targets. */ + handling, which should be the same for all PP502x targets. */ if (on) { #if defined(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 #if defined(IRIVER_H10) || defined (IRIVER_H10_5GB) if(button_status()==BUTTON_RIGHT) @@ -114,9 +112,15 @@ void usb_enable(bool on) { ata_sleepnow(); /* Immediately spindown the disk. */ sleep(HZ*2); -#ifdef IPOD_ARCH - memcpy(storage_ptr, "diskmode\0\0hotstuff\0\0\1", 21); + +#ifdef IPOD_ARCH /* The following code is based on ipodlinux */ +#if CONFIG_CPU == PP5020 + memcpy((void *)0x40017f00, "diskmode\0\0hotstuff\0\0\1", 21); +#elif CONFIG_CPU == PP5022 + memcpy((void *)0x4001ff00, "diskmode\0\0hotstuff\0\0\1", 21); #endif +#endif + system_reboot(); /* Reboot */ } #endif @@ -128,6 +132,13 @@ bool usb_detect(void) static bool prev_usbstatus1 = false; bool usbstatus1,usbstatus2; +#if defined(IPOD_COLOR) || defined(IPOD_4G) \ + || defined(IPOD_MINI) || defined(IPOD_MINI2G) + /* GPIO C bit 1 is firewire detect */ + if (!(GPIOC_INPUT_VAL & 0x02)) + return true; +#endif + /* UDC_ID should have the bit format: [31:24] = 0x0 [23:16] = 0x22 (Revision number)