Index: apps/main.c
===================================================================
RCS file: /cvsroot/rockbox/apps/main.c,v
retrieving revision 1.176
diff -u -r1.176 main.c
--- apps/main.c	16 Jun 2006 17:34:17 -0000	1.176
+++ apps/main.c	11 Jul 2006 08:58:54 -0000
@@ -92,6 +92,10 @@
 #include "isp1362.h"
 #endif
 
+#if CONFIG_USBOTG == USBOTG_M5636
+#include "m5636.h"
+#endif
+
 /*#define AUTOROCK*/ /* define this to check for "autostart.rock" on boot */
 
 const char appsversion[]=APPSVERSION;
@@ -282,6 +286,8 @@
     usb_init();
 #if CONFIG_USBOTG == USBOTG_ISP1362
     isp1362_init();
+#elif CONFIG_USBOTG == USBOTG_M5636
+    m5636_init();
 #endif
 
     backlight_init();
Index: docs/CREDITS
===================================================================
RCS file: /cvsroot/rockbox/docs/CREDITS,v
retrieving revision 1.154
diff -u -r1.154 CREDITS
--- docs/CREDITS	3 Jul 2006 21:15:13 -0000	1.154
+++ docs/CREDITS	11 Jul 2006 08:58:55 -0000
@@ -209,3 +209,4 @@
 Ioannis Koutoulakis
 Alistair Marshall
 Karl Ove Hufthammer
+Ulrich Pegelow
Index: firmware/SOURCES
===================================================================
RCS file: /cvsroot/rockbox/firmware/SOURCES,v
retrieving revision 1.86
diff -u -r1.86 SOURCES
--- firmware/SOURCES	16 Jun 2006 17:34:17 -0000	1.86
+++ firmware/SOURCES	11 Jul 2006 08:58:55 -0000
@@ -206,7 +206,9 @@
 #if CONFIG_USBOTG == USBOTG_ISP1362
 drivers/isp1362.c
 #endif
-
+#if CONFIG_USBOTG == USBOTG_M5636
+drivers/m5636.c
+#endif
 
 #ifndef SIMULATOR
 #ifdef IAUDIO_X5
@@ -219,5 +221,6 @@
 target/coldfire/iaudio/x5/system-x5.c
 target/coldfire/iaudio/x5/usb-x5.c
 target/coldfire/iaudio/x5/backlight-x5.c
+target/coldfire/iaudio/x5/m5636-x5.c
 #endif
 #endif
Index: firmware/drivers/m5636.c
===================================================================
RCS file: firmware/drivers/m5636.c
diff -N firmware/drivers/m5636.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ firmware/drivers/m5636.c	11 Jul 2006 08:58:55 -0000
@@ -0,0 +1,45 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: $
+ *
+ * Copyright (C) 2006 Ulrich Pegelow
+ *
+ * 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 "system.h"
+#include "kernel.h"
+#include "logf.h"
+#include "m5636.h"
+#include "m5636-target.h"
+
+/* Disclaimer: This code had to be developed without any documentation for the
+               M5636 USBOTG chip, due to the restrictive information policy of
+               its manufacturer.
+               The development is solely based on reverse engineering.
+               Malfunctioning (with the risk of possible damage to the
+               hardware) can not be fully excluded.
+               USE THIS CODE AT YOUR OWN RISK!
+*/
+
+/* Init: This currently just puts the M5636 into sleep mode */
+
+void m5636_init(void)
+{
+    m5636_device_init();
+
+    M5636_4068 |= 0x0003; /* ???? */
+    M5636_4068 |= 0x0080; /* ???? */
+    M5636_4078 |= 0x0001; /* ???? */
+}
+
Index: firmware/export/config-iaudiox5.h
===================================================================
RCS file: /cvsroot/rockbox/firmware/export/config-iaudiox5.h,v
retrieving revision 1.22
diff -u -r1.22 config-iaudiox5.h
--- firmware/export/config-iaudiox5.h	6 Jun 2006 22:23:41 -0000	1.22
+++ firmware/export/config-iaudiox5.h	11 Jul 2006 08:58:55 -0000
@@ -102,6 +102,9 @@
 
 #define USB_X5STYLE
 
+/* USB On-the-go */
+#define CONFIG_USBOTG USBOTG_M5636
+
 /* Define this if you have adjustable CPU frequency */
 #define HAVE_ADJUSTABLE_CPU_FREQ
 
Index: firmware/export/config.h
===================================================================
RCS file: /cvsroot/rockbox/firmware/export/config.h,v
retrieving revision 1.69
diff -u -r1.69 config.h
--- firmware/export/config.h	10 Jul 2006 16:22:03 -0000	1.69
+++ firmware/export/config.h	11 Jul 2006 08:58:55 -0000
@@ -135,6 +135,7 @@
 
 /* USB On-the-go */
 #define USBOTG_ISP1362 1362
+#define USBOTG_M5636 5636
 
 /* now go and pick yours */
 #if defined(ARCHOS_PLAYER)
Index: firmware/export/m5636.h
===================================================================
RCS file: firmware/export/m5636.h
diff -N firmware/export/m5636.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ firmware/export/m5636.h	11 Jul 2006 08:58:55 -0000
@@ -0,0 +1,25 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: $
+ *
+ * Copyright (C) 2006 Ulrich Pegelow
+ *
+ * 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 M5636_H
+#define M5636_H
+
+void m5636_init(void);
+void m5636_dump_regs(void);
+
+#endif
Index: firmware/target/coldfire/iaudio/x5/m5636-target.h
===================================================================
RCS file: firmware/target/coldfire/iaudio/x5/m5636-target.h
diff -N firmware/target/coldfire/iaudio/x5/m5636-target.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ firmware/target/coldfire/iaudio/x5/m5636-target.h	11 Jul 2006 08:58:55 -0000
@@ -0,0 +1,37 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: $
+ *
+ * Copyright (C) 2006 Ulrich Pegelow
+ *
+ * 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 M5636_TARGET_H
+#define M5636_TARGET_H
+
+#define M5636_BASE 0xf0004000L /* Rockbox: 0xf0004000; OF: 0x20004000 */
+
+/* We are currently lacking a datasheet for the M5636. No mnemonics available.
+   The registers are named according to their respective hexadecimal offsets.
+*/
+   
+#define M5636_4064 (*(volatile unsigned short *)(M5636_BASE + 0x64L))
+#define M5636_4068 (*(volatile unsigned short *)(M5636_BASE + 0x68L))
+#define M5636_4078 (*(volatile unsigned short *)(M5636_BASE + 0x78L))
+
+extern void m5636_device_init(void);
+
+/* for debugging purposes only */
+extern void m5636_dump_regs(void);
+
+#endif
Index: firmware/target/coldfire/iaudio/x5/m5636-x5.c
===================================================================
RCS file: firmware/target/coldfire/iaudio/x5/m5636-x5.c
diff -N firmware/target/coldfire/iaudio/x5/m5636-x5.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ firmware/target/coldfire/iaudio/x5/m5636-x5.c	11 Jul 2006 08:58:55 -0000
@@ -0,0 +1,50 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: $
+ *
+ * Copyright (C) 2006 Ulrich Pegelow
+ *
+ * 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 "system.h"
+#include "logf.h"
+#include "m5636-target.h"
+
+void m5636_device_init(void)
+{
+    and_l(~0x00004000, &GPIO_INT_EN);  /* probably redundant: disable
+                                          interrupt; just in case ... */
+    and_l(~0x00000004, &GPIO1_OUT);    /* probably redundant: set GPIO34 low */
+    or_l(  0x00000004, &GPIO1_ENABLE);   /* GPIO34 enable (see above) */
+    or_l(  0x00000004, &GPIO1_FUNCTION); /* GPIO34 function (see above) */
+}
+
+/* for debugging purposes only */
+void m5636_dump_regs(void)
+{
+    unsigned short *address;
+
+    for (address = (unsigned short *)M5636_BASE;
+         address < (unsigned short *)(M5636_BASE + 0x100);
+         address++)
+    {
+         logf("m5636 A:%08x D:%04x", address, (unsigned)*address);
+    }
+
+    logf("GPIO_INT_EN    %08x", GPIO_INT_EN);
+    logf("GPIO1_OUT      %08x", GPIO1_OUT);
+    logf("GPIO1_ENABLE   %08x", GPIO1_ENABLE);
+    logf("GPIO1_FUNCTION %08x", GPIO1_FUNCTION);
+}
