summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tatung/tpj1022
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2006-08-31 19:19:35 +0000
committerDave Chapman <dave@dchapman.com>2006-08-31 19:19:35 +0000
commit657dcb5165e80b3363b89ca3108356878d4c048e (patch)
tree1f7af6e22ee866dcce37f9d1fa310c26a8bb44b4 /firmware/target/arm/tatung/tpj1022
parent20332bce1d49d7285109564d2e29ee18b0acd54e (diff)
Initial commit of work for port to the Tatung Elio TPJ-1022 - yet another PortalPlayer PP5020 target.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10828 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/tatung/tpj1022')
-rw-r--r--firmware/target/arm/tatung/tpj1022/adc-target.h42
-rw-r--r--firmware/target/arm/tatung/tpj1022/adc-tpj1022.c101
-rw-r--r--firmware/target/arm/tatung/tpj1022/backlight-target.h28
-rw-r--r--firmware/target/arm/tatung/tpj1022/backlight-tpj1022.c44
-rw-r--r--firmware/target/arm/tatung/tpj1022/button-target.h58
-rw-r--r--firmware/target/arm/tatung/tpj1022/button-tpj1022.c83
-rw-r--r--firmware/target/arm/tatung/tpj1022/lcd-tpj1022.c97
-rw-r--r--firmware/target/arm/tatung/tpj1022/power-tpj1022.c67
-rw-r--r--firmware/target/arm/tatung/tpj1022/usb-target.h27
-rw-r--r--firmware/target/arm/tatung/tpj1022/usb-tpj1022.c107
10 files changed, 654 insertions, 0 deletions
diff --git a/firmware/target/arm/tatung/tpj1022/adc-target.h b/firmware/target/arm/tatung/tpj1022/adc-target.h
new file mode 100644
index 0000000000..3aab373290
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/adc-target.h
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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.
+ *
+ ****************************************************************************/
+#ifndef _ADC_TARGET_H_
+#define _ADC_TARGET_H_
+
+#define ADC_ENABLE_ADDR (*(volatile unsigned long*)(0x70000010))
+#define ADC_ENABLE 0x1100
+
+#define ADC_ADDR (*(volatile unsigned long*)(0x7000ad00))
+#define ADC_STATUS (*(volatile unsigned long*)(0x7000ad04))
+#define ADC_DATA_1 (*(volatile unsigned long*)(0x7000ad20))
+#define ADC_DATA_2 (*(volatile unsigned long*)(0x7000ad24))
+#define ADC_INIT (*(volatile unsigned long*)(0x7000ad2c))
+
+#define NUM_ADC_CHANNELS 4
+
+#define ADC_BATTERY 0
+#define ADC_UNKNOWN_1 1
+#define ADC_UNKNOWN_2 2
+#define ADC_SCROLLPAD 3
+#define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */
+
+/* Force a scan now */
+unsigned short adc_scan(int channel);
+
+#endif
diff --git a/firmware/target/arm/tatung/tpj1022/adc-tpj1022.c b/firmware/target/arm/tatung/tpj1022/adc-tpj1022.c
new file mode 100644
index 0000000000..134b90b587
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/adc-tpj1022.c
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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 "system.h"
+#include "kernel.h"
+#include "thread.h"
+#include "adc.h"
+
+static unsigned short adcdata[NUM_ADC_CHANNELS];
+
+/* Scan ADC so that adcdata[channel] gets updated */
+unsigned short adc_scan(int channel)
+{
+ unsigned int adc_data_1;
+ unsigned int adc_data_2;
+
+ /* Initialise */
+ ADC_ADDR=0x130;
+ ADC_STATUS=0; /* 4 bytes, 1 per channel. Each byte is 0 if the channel is
+ off, 0x40 if the channel is on */
+
+ /* Enable Channel */
+ ADC_ADDR |= (0x1000000<<channel);
+
+ /* Start? */
+ ADC_ADDR |= 0x20000000;
+ ADC_ADDR |= 0x80000000;
+
+ /* ADC_DATA_1 and ADC_DATA_2 are both four bytes, one byte per channel.
+ For each channel, ADC_DATA_1 stores the 8-bit msb, ADC_DATA_2 stores the
+ 2-bit lsb (in bits 0 and 1). Each channel is 10 bits total. */
+ adc_data_1 = ((ADC_DATA_1 >> (8*channel)) & 0xff);
+ adc_data_2 = ((ADC_DATA_2 >> (8*channel+6)) & 0x3);
+
+ adcdata[channel] = (adc_data_1<<2 | adc_data_2);
+
+ return adcdata[channel];
+}
+
+/* Read 10-bit channel data */
+unsigned short adc_read(int channel)
+{
+ return adcdata[channel];
+}
+
+static int adc_counter;
+
+static void adc_tick(void)
+{
+ if(++adc_counter == HZ)
+ {
+ adc_counter = 0;
+ adc_scan(ADC_BATTERY);
+ adc_scan(ADC_UNKNOWN_1);
+ adc_scan(ADC_UNKNOWN_2);
+ adc_scan(ADC_SCROLLPAD);
+ }
+}
+
+void adc_init(void)
+{
+ /* Enable ADC */
+ ADC_ENABLE_ADDR |= ADC_ENABLE;
+
+ /* Initialise */
+ ADC_INIT=0;
+ ADC_ADDR=0x130;
+ ADC_STATUS=0;
+
+ /* Enable Channels 1-4 */
+ ADC_ADDR |= 0x1000000;
+ ADC_ADDR |= 0x2000000;
+ ADC_ADDR |= 0x4000000;
+ ADC_ADDR |= 0x8000000;
+
+ /* Start? */
+ ADC_ADDR |= 0x20000000;
+ ADC_ADDR |= 0x80000000;
+
+ /* Wait 50ms for things to settle */
+ sleep(HZ/20);
+
+ tick_add_task(adc_tick);
+}
diff --git a/firmware/target/arm/tatung/tpj1022/backlight-target.h b/firmware/target/arm/tatung/tpj1022/backlight-target.h
new file mode 100644
index 0000000000..b5fe2f7c5d
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/backlight-target.h
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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.
+ *
+ ****************************************************************************/
+
+/* Taken from the x5's implementation */
+
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+void __backlight_on(void);
+void __backlight_off(void);
+
+#endif
diff --git a/firmware/target/arm/tatung/tpj1022/backlight-tpj1022.c b/firmware/target/arm/tatung/tpj1022/backlight-tpj1022.c
new file mode 100644
index 0000000000..51218e21be
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/backlight-tpj1022.c
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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.
+ *
+ ****************************************************************************/
+
+/* The H10 display (and hence backlight) possibly identical to that of the X5,
+ so that code was used here but left #if 0'ed out for the moment */
+
+#include "config.h"
+#include "cpu.h"
+#include "system.h"
+#include "backlight.h"
+
+void __backlight_on(void)
+{
+#if 0
+ int level = set_irq_level(HIGHEST_IRQ_LEVEL);
+ pcf50606_write(0x38, 0xb0); /* Backlight ON, GPO1INV=1, GPO1ACT=011 */
+ set_irq_level(level);
+#endif
+}
+
+void __backlight_off(void)
+{
+#if 0
+ int level = set_irq_level(HIGHEST_IRQ_LEVEL);
+ pcf50606_write(0x38, 0x80); /* Backlight OFF, GPO1INV=1, GPO1ACT=000 */
+ set_irq_level(level);
+#endif
+}
diff --git a/firmware/target/arm/tatung/tpj1022/button-target.h b/firmware/target/arm/tatung/tpj1022/button-target.h
new file mode 100644
index 0000000000..74bd61ed3d
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/button-target.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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.
+ *
+ ****************************************************************************/
+
+#ifndef _BUTTON_TARGET_H_
+#define _BUTTON_TARGET_H_
+
+#include <stdbool.h>
+#include "config.h"
+
+#define HAS_BUTTON_HOLD
+
+bool button_hold(void);
+void button_init_device(void);
+int button_read_device(void);
+
+/* Tatung Elio TPJ-1022 button codes */
+
+/* Main unit's buttons */
+#define BUTTON_POWER 0x00000001
+
+#define BUTTON_LEFT 0x00000002
+#define BUTTON_RIGHT 0x00000004
+#define BUTTON_UP 0x00000008
+#define BUTTON_DOWN 0x00000010
+
+#define BUTTON_MENU 0x00000020
+#define BUTTON_FF 0x00000040
+#define BUTTON_REW 0x00000080
+#define BUTTON_REC 0x00000100
+#define BUTTON_AB 0x00000200
+#define BUTTON_PLUS 0x00000400
+#define BUTTON_MINUS 0x00000800
+
+#define BUTTON_MAIN 0x00000fff
+
+/* No Remote control */
+#define BUTTON_REMOTE 0
+
+#define POWEROFF_BUTTON BUTTON_POWER
+#define POWEROFF_COUNT 10
+
+#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/tatung/tpj1022/button-tpj1022.c b/firmware/target/arm/tatung/tpj1022/button-tpj1022.c
new file mode 100644
index 0000000000..f0b338c1c1
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/button-tpj1022.c
@@ -0,0 +1,83 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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.
+ *
+ ****************************************************************************/
+
+/* Custom written for the TPJ-1022 based on analysis of the GPIO data */
+
+#include <stdlib.h>
+#include "config.h"
+#include "cpu.h"
+#include "system.h"
+#include "button.h"
+#include "kernel.h"
+#include "backlight.h"
+#include "adc.h"
+#include "system.h"
+
+void button_init_device(void)
+{
+ /* No hardware initialisation required as it is done by the bootloader */
+}
+
+bool button_hold(void)
+{
+ return false;
+}
+
+/*
+ * Get button pressed from hardware
+ */
+int button_read_device(void)
+{
+ int btn = BUTTON_NONE;
+ unsigned char state;
+ static bool hold_button = false;
+
+#if 0
+ /* light handling */
+ if (hold_button && !button_hold())
+ {
+ backlight_on();
+ }
+#endif
+
+ hold_button = button_hold();
+ if (!hold_button)
+ {
+ /* Read normal buttons */
+ state = GPIOA_INPUT_VAL;
+ if ((state & 0x2) == 0) btn |= BUTTON_REW;
+ if ((state & 0x4) == 0) btn |= BUTTON_FF;
+ if ((state & 0x80) == 0) btn |= BUTTON_RIGHT;
+
+ /* Buttons left to figure out:
+ button_hold()
+ BUTTON_POWER
+ BUTTON_LEFT
+ BUTTON_UP
+ BUTTON_DOWN
+ BUTTON_MENU
+ BUTTON_REC
+ BUTTON_AB
+ BUTTON_PLUS
+ BUTTON_MINUS
+ */
+ }
+
+ return btn;
+}
diff --git a/firmware/target/arm/tatung/tpj1022/lcd-tpj1022.c b/firmware/target/arm/tatung/tpj1022/lcd-tpj1022.c
new file mode 100644
index 0000000000..53f32792c3
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/lcd-tpj1022.c
@@ -0,0 +1,97 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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 "lcd.h"
+#include "kernel.h"
+#include "system.h"
+
+/*** hardware configuration ***/
+
+void lcd_set_contrast(int val)
+{
+ /* TODO: Implement lcd_set_contrast() */
+ (void)val;
+}
+
+void lcd_set_invert_display(bool yesno)
+{
+ /* TODO: Implement lcd_set_invert_display() */
+ (void)yesno;
+}
+
+/* turn the display upside down (call lcd_update() afterwards) */
+void lcd_set_flip(bool yesno)
+{
+ /* TODO: Implement lcd_set_flip() */
+ (void)yesno;
+}
+
+/* LCD init */
+void lcd_init_device(void)
+{
+
+}
+
+/*** update functions ***/
+
+/* Performance function that works with an external buffer
+ note that by and bheight are in 4-pixel units! */
+void lcd_blit(const fb_data* data, int x, int by, int width,
+ int bheight, int stride)
+{
+ /* TODO: Implement lcd_blit() */
+ (void)data;
+ (void)x;
+ (void)by;
+ (void)width;
+ (void)bheight;
+ (void)stride;
+}
+
+/* Performance function to blit a YUV bitmap directly to the LCD */
+void lcd_yuv_blit(unsigned char * const src[3],
+ int src_x, int src_y, int stride,
+ int x, int y, int width, int height)
+{
+ (void)src;
+ (void)src_x;
+ (void)src_y;
+ (void)stride;
+ (void)x;
+ (void)y;
+ (void)width;
+ (void)height;
+}
+
+/* Update a fraction of the display. */
+void lcd_update_rect(int x0, int y0, int width, int height)
+{
+ (void)x0;
+ (void)y0;
+ (void)width;
+ (void)height;
+}
+
+/* Update the display.
+ This must be called after all other LCD functions that change the display. */
+void lcd_update(void)
+{
+ lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
+}
diff --git a/firmware/target/arm/tatung/tpj1022/power-tpj1022.c b/firmware/target/arm/tatung/tpj1022/power-tpj1022.c
new file mode 100644
index 0000000000..e8bc4e1fb0
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/power-tpj1022.c
@@ -0,0 +1,67 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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.
+ *
+ ****************************************************************************/
+
+/* Created from power.c using some iPod code, and some custom stuff based on
+ GPIO analysis
+*/
+
+#include "config.h"
+#include "cpu.h"
+#include <stdbool.h>
+#include "adc.h"
+#include "kernel.h"
+#include "system.h"
+#include "power.h"
+#include "hwcompat.h"
+#include "logf.h"
+#include "usb.h"
+
+#if CONFIG_CHARGING == CHARGING_CONTROL
+bool charger_enabled;
+#endif
+
+void power_init(void)
+{
+}
+
+bool charger_inserted(void)
+{
+ return false;
+}
+
+void ide_power_enable(bool on)
+{
+ (void)on;
+ /* We do nothing on the iPod */
+}
+
+
+bool ide_powered(void)
+{
+ /* pretend we are always powered - we don't turn it off on the ipod */
+ return true;
+}
+
+void power_off(void)
+{
+ /* Give things a second to settle before cutting power */
+ sleep(HZ);
+
+ //GPIOF_OUTPUT_VAL &=~ 0x20;
+}
diff --git a/firmware/target/arm/tatung/tpj1022/usb-target.h b/firmware/target/arm/tatung/tpj1022/usb-target.h
new file mode 100644
index 0000000000..7a17f7bacf
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/usb-target.h
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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
new file mode 100644
index 0000000000..b238de4369
--- /dev/null
+++ b/firmware/target/arm/tatung/tpj1022/usb-tpj1022.c
@@ -0,0 +1,107 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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
+}