Firewire detection with reboot into diskmode for all iPods that support it (all but Nano and Video). * Hack for compiling iPod G3 removed. * Code cleanup.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14131 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-08-01 22:44:02 +00:00
parent a049fa7c82
commit cb896cdd04
8 changed files with 113 additions and 30 deletions

View file

@ -31,7 +31,11 @@ usblogo.176x48x16.bmp
usblogo.128x37x16.bmp usblogo.128x37x16.bmp
#endif #endif
#elif LCD_DEPTH > 1 /* greyscale */ #elif LCD_DEPTH > 1 /* greyscale */
#ifdef IPOD_1G2G /* use firewire logo */
usblogo.fw.128x39x2.bmp
#else
usblogo.128x33x2.bmp usblogo.128x33x2.bmp
#endif
#else /* monochrome */ #else /* monochrome */
#if LCD_WIDTH == 112 #if LCD_WIDTH == 112
usblogo.100x20x1.bmp usblogo.100x20x1.bmp

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View file

@ -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/lcd-as-e200.S
target/arm/sandisk/sansa-e200/adc-e200.c target/arm/sandisk/sansa-e200/adc-e200.c
target/arm/sandisk/sansa-e200/backlight-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/button-e200.c
target/arm/sandisk/sansa-e200/power-e200.c target/arm/sandisk/sansa-e200/power-e200.c
target/arm/i2s-pp.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/button-h10.c
target/arm/iriver/h10/lcd-h10_20gb.c target/arm/iriver/h10/lcd-h10_20gb.c
target/arm/iriver/h10/power-h10.c target/arm/iriver/h10/power-h10.c
target/arm/usb-pp.c target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IRIVER_H10 */ #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/button-h10.c
target/arm/iriver/h10/lcd-h10_5gb.c target/arm/iriver/h10/lcd-h10_5gb.c
target/arm/iriver/h10/power-h10.c target/arm/iriver/h10/power-h10.c
target/arm/usb-pp.c target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IRIVER_H10_5GB */ #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/button-tpj1022.c
target/arm/tatung/tpj1022/lcd-tpj1022.c target/arm/tatung/tpj1022/lcd-tpj1022.c
target/arm/tatung/tpj1022/power-tpj1022.c target/arm/tatung/tpj1022/power-tpj1022.c
target/arm/usb-pp.c target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* ELIO_TPJ1022 */ #endif /* ELIO_TPJ1022 */
@ -567,7 +567,7 @@ target/arm/ipod/backlight-4g_color.c
target/arm/ipod/button-clickwheel.c target/arm/ipod/button-clickwheel.c
target/arm/ipod/lcd-gray.c target/arm/ipod/lcd-gray.c
target/arm/ipod/power-ipod.c target/arm/ipod/power-ipod.c
target/arm/usb-pp.c target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IPOD_4G */ #endif /* IPOD_4G */
@ -583,7 +583,7 @@ target/arm/ipod/backlight-4g_color.c
target/arm/ipod/button-clickwheel.c target/arm/ipod/button-clickwheel.c
target/arm/ipod/lcd-color_nano.c target/arm/ipod/lcd-color_nano.c
target/arm/ipod/power-ipod.c target/arm/ipod/power-ipod.c
target/arm/usb-pp.c target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IPOD_COLOR */ #endif /* IPOD_COLOR */
@ -599,7 +599,7 @@ target/arm/ipod/backlight-nano_video.c
target/arm/ipod/button-clickwheel.c target/arm/ipod/button-clickwheel.c
target/arm/ipod/lcd-color_nano.c target/arm/ipod/lcd-color_nano.c
target/arm/ipod/power-ipod.c target/arm/ipod/power-ipod.c
target/arm/usb-pp.c target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IPOD_NANO */ #endif /* IPOD_NANO */
@ -615,7 +615,7 @@ target/arm/ipod/backlight-nano_video.c
target/arm/ipod/button-clickwheel.c target/arm/ipod/button-clickwheel.c
target/arm/ipod/power-ipod.c target/arm/ipod/power-ipod.c
target/arm/ipod/video/lcd-video.c target/arm/ipod/video/lcd-video.c
target/arm/usb-pp.c target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IPOD_VIDEO */ #endif /* IPOD_VIDEO */
@ -630,7 +630,7 @@ target/arm/ipod/3g/backlight-3g.c
target/arm/ipod/button-1g-3g.c target/arm/ipod/button-1g-3g.c
target/arm/ipod/lcd-gray.c target/arm/ipod/lcd-gray.c
target/arm/ipod/power-ipod.c target/arm/ipod/power-ipod.c
target/arm/usb-pp.c target/arm/usb-fw-pp5002.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IPOD_3G */ #endif /* IPOD_3G */
@ -644,6 +644,7 @@ target/arm/ipod/1g2g/backlight-1g2g.c
target/arm/ipod/button-1g-3g.c target/arm/ipod/button-1g-3g.c
target/arm/ipod/lcd-gray.c target/arm/ipod/lcd-gray.c
target/arm/ipod/power-ipod.c target/arm/ipod/power-ipod.c
target/arm/usb-fw-pp5002.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IPOD_1G2G */ #endif /* IPOD_1G2G */
@ -659,7 +660,7 @@ target/arm/ipod/backlight-mini1g_mini2g.c
target/arm/ipod/button-mini1g.c target/arm/ipod/button-mini1g.c
target/arm/ipod/lcd-gray.c target/arm/ipod/lcd-gray.c
target/arm/ipod/power-ipod.c target/arm/ipod/power-ipod.c
target/arm/usb-pp.c target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IPOD_MINI */ #endif /* IPOD_MINI */
@ -675,7 +676,7 @@ target/arm/ipod/backlight-mini1g_mini2g.c
target/arm/ipod/button-clickwheel.c target/arm/ipod/button-clickwheel.c
target/arm/ipod/lcd-gray.c target/arm/ipod/lcd-gray.c
target/arm/ipod/power-ipod.c target/arm/ipod/power-ipod.c
target/arm/usb-pp.c target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */ #endif /* SIMULATOR */
#endif /* IPOD_MINI2G */ #endif /* IPOD_MINI2G */

View file

@ -110,7 +110,8 @@
/* Offset ( in the firmware file's header ) to the real data */ /* Offset ( in the firmware file's header ) to the real data */
#define FIRMWARE_OFFSET_FILE_DATA 8 #define FIRMWARE_OFFSET_FILE_DATA 8
#define USB_NONE #define USB_IPODSTYLE
/* actually firewire only, but handled like USB */
/* Virtual LED (icon) */ /* Virtual LED (icon) */
#define CONFIG_LED LED_VIRTUAL #define CONFIG_LED LED_VIRTUAL

View file

@ -110,7 +110,8 @@
/* Offset ( in the firmware file's header ) to the real data */ /* Offset ( in the firmware file's header ) to the real data */
#define FIRMWARE_OFFSET_FILE_DATA 8 #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) */ /* Virtual LED (icon) */
#define CONFIG_LED LED_VIRTUAL #define CONFIG_LED LED_VIRTUAL

View file

@ -141,9 +141,4 @@
#define MMAP3_LOGICAL (*(volatile unsigned long *)(0xf000f018)) #define MMAP3_LOGICAL (*(volatile unsigned long *)(0xf000f018))
#define MMAP3_PHYSICAL (*(volatile unsigned long *)(0xf000f01c)) #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 #endif

View file

@ -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;
}

View file

@ -86,27 +86,25 @@ void usb_init_device(void)
udelay(0x186A0); udelay(0x186A0);
dr_controller_setup(); 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) void usb_enable(bool on)
{ {
/* This device specific code will eventually give way to proper USB /* 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 (on)
{ {
#if defined(IPOD_ARCH) || defined(IRIVER_H10) || defined (IRIVER_H10_5GB) #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 /* 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. */ 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 defined(IRIVER_H10) || defined (IRIVER_H10_5GB)
if(button_status()==BUTTON_RIGHT) if(button_status()==BUTTON_RIGHT)
@ -114,9 +112,15 @@ void usb_enable(bool on)
{ {
ata_sleepnow(); /* Immediately spindown the disk. */ ata_sleepnow(); /* Immediately spindown the disk. */
sleep(HZ*2); 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
#endif
system_reboot(); /* Reboot */ system_reboot(); /* Reboot */
} }
#endif #endif
@ -128,6 +132,13 @@ bool usb_detect(void)
static bool prev_usbstatus1 = false; static bool prev_usbstatus1 = false;
bool usbstatus1,usbstatus2; 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: /* UDC_ID should have the bit format:
[31:24] = 0x0 [31:24] = 0x0
[23:16] = 0x22 (Revision number) [23:16] = 0x22 (Revision number)