The phone acts by default as a USB Gadget (i.e. it emulates a memory stick). However, the hardware is capable of supporting USB host mode aswell. The goal of this project is to develop a kernel module that allows switching between USB Gadget and USB host mode on the fly.
Current status:
I can plug in a Memory stick, and the CCS (Current Connection Status) goes high, indicating that a new
device was plugged in. However, the kernel doesn't seem to enumerate it.
EMU = Enhanced Mini USB USB signals, 3,3volt UART and audio signals multiplexed on same port. See here for details
set_GPIO_mode(GPIO34_TXENB_MD); set_GPIO_mode(GPIO35_XRXD_MD); set_GPIO_mode(GPIO36_VMOUT_MD); set_GPIO_mode(GPIO39_VPOUT_MD); set_GPIO_mode(GPIO40_VPIN_MD); set_GPIO_mode(GPIO53_VMIN_MD); UP2OCR = 0x02000000;
See /drivers/misc/ezx-emu.c of kernel source (e680.sf.net) /* set the MUX1/2 to data mode */ clr_GPIO(GPIO_EMU_MUX1); clr_GPIO(GPIO_EMU_MUX2);
Simple usb cable with usb host port and mini - B plug, integrates two 15kohm pulldowns from both datalines to GND
I want to thank to cyph for the code to read / write PCAP bits. Was very helpful, thanks ! One 1,5kohm pullup towards 3,3 volts is controlled by PCAP USB_PU bit and can be disabled by software. There is at least another one (about) 200Kohm pullup towards 2,8 volts and it is controlled by neptune chip. We don't know how to control it directly, but netptune disables it about 10 sec after setting PCAP VBUS_MASTER_EN bit. So there seems to be a thread running on Neptune which reads these bits from time to time...
Simply recompiled the kernel with scsi and usb-storage enables as a module. Both modules seem to load ok. Its encouraging to see there are no unresolved symbols. Don't know if they work, though
The problem is that the stock motorola kernel contains a crippled down usb stack that was not compiled as a module. It would have been easy to compile a new usb stack as module with the proper options, however it cannot load, because the build-in is occupying the needed hooks. To continue this road, we would need to develop a kind of Root-Kit. How to hijack usb_register_bus calls from kernel ???
The problem is that the phone switches oft after 45 sec because of a watchdog in the Baseband processor. The people on the openEZX mailinglist are working on this. Once the kernel runns stable I will add my patches to the 2.6 and try it out.
Background:
The hardware is a Intel PXA271 ochi-compliant usb host controller (3 ports). Port3 is internally hardwired to Motorolas GSM radio modem. Port2 is multiplexed between the OCHI controller and a USB Gadget Controller. It is the link to the outside world via a mini-USB connector.
The kernel of these phones is a Linux 2.4.17 from montavista. It has usbcore and the ohci-hcd drivers enabled, (for the communication with theMotorolas GSM radio chip) but usb(dev)fs was disabled.