rendered paste body/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: usb-pp.c 12360 2007-02-17 21:54:17Z bagder $
*
* Copyright (C) 2002 by Linus Nielsen Feltzing
*
* iPod driver based on code from the ipodlinux project - http://ipodlinux.org
* Adapted for Rockbox in January 2006
* Original file: podzilla/usb.c
* Copyright (C) 2005 Adam Johnston
*
* 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 "usb-target.h"
#include "arcotg_udc.h"
void usb_init_device(void)
{
int r0;
outl(inl(0x70000084) | 0x200, 0x70000084);
outl(inl(0x7000002C) | 0x3000000, 0x7000002C);
DEV_EN |= DEV_USB;
DEV_RS |= DEV_USB; /* reset usb start */
DEV_RS &=~DEV_USB;/* reset usb end */
DEV_INIT |= INIT_USB;
while ((inl(0x70000028) & 0x80) == 0);
UDC_PORTSC1 |= PORTSCX_PORT_RESET;
while ((UDC_PORTSC1 & PORTSCX_PORT_RESET) != 0);
UDC_OTGSC |= 0x5F000000;
if( (UDC_OTGSC & 0x100) == 0) {
UDC_USBMODE &=~ USB_MODE_CTRL_MODE_HOST;
UDC_USBMODE |= USB_MODE_CTRL_MODE_DEVICE;
outl(inl(0x70000028) | 0x4000, 0x70000028);
outl(inl(0x70000028) | 0x2, 0x70000028);
} else {
UDC_USBMODE |= USB_MODE_CTRL_MODE_DEVICE;
outl(inl(0x70000028) &~0x4000, 0x70000028);
outl(inl(0x70000028) | 0x2, 0x70000028);
}
UDC_USBCMD |= USB_CMD_CTRL_RESET;
while((UDC_USBCMD & USB_CMD_CTRL_RESET) != 0);
r0 = UDC_PORTSC1;
/* Note from IPL source (referring to next 5 lines of code:
THIS NEEDS TO BE CHANGED ONCE THERE IS KERNEL USB */
DEV_INIT |= INIT_USB;
DEV_EN |= DEV_USB;
while ((inl(0x70000028) & 0x80) == 0);
outl(inl(0x70000028) | 0x2, 0x70000028);
udelay(0x186A0);
}
void usb_enable(bool on)
{
(void)on;
}
bool usb_detect(void)
{
return false;
}